Skip to content

[dkml] mirage-crypto-ec issues #201

@hannesm

Description

@hannesm

On DKML windows, the mirage-crypto-ec bits and pieces may build, but do not succeed the test cases.

They use the 32bit fiat-crypto implementations due to unavailability of 128bit integers on windows (see #137 (comment), patch merged at 839558e#diff-9616d1c991b5ef59f4bdb173cb3e439bdaf24a6088fb4e91b6a66ea0e29e5bf9).

Now, there's a patch hannesm@5c46f2c to also use the 32bit tables (otherwise compilation fails with "Cannot use 32-bit tables on a 64-bit architecture".

Even with that patch included, the tests fail:

File "tests/dune", line 60, characters 7-25:
60 |  (name test_ec_wycheproof)
            ^^^^^^^^^^^^^^^^^^
(cd _build/default/tests && ./test_ec_wycheproof.exe)
Fatal error: exception File "tests/test_ec_wycheproof.ml", line 418, characters 4-10: Assertion failed

It is not entirely clear to me, why, though. The assetion in question:

let to_ed25519_keys (key : eddsa_key) =
  let priv_cs = Cstruct.of_string key.sk
  and pub_cs = Cstruct.of_string key.pk
  in
  match Ed25519.priv_of_cstruct priv_cs, Ed25519.pub_of_cstruct pub_cs with
  | Ok priv, Ok pub ->
    assert (Cstruct.equal Ed25519.(pub_to_cstruct (pub_of_priv priv)) pub_cs); (* that's the failing one *)
    priv, pub
  | _ -> assert false

It may be useful to do some printf debugging here. The OCaml side for a DKML-windows-64bit assumes word_size being 64 bit, the C side assumes 32 - this may be an issue!?

Once address, in ci/build-test.sh the mirage-crypto-ec package can be added to the packages_TOPOLOGICALSORT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions