Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dkml] mirage-crypto-ec issues #201

Open
hannesm opened this issue Feb 24, 2024 · 0 comments
Open

[dkml] mirage-crypto-ec issues #201

hannesm opened this issue Feb 24, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@hannesm
Copy link
Member

hannesm commented Feb 24, 2024

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.

@hannesm hannesm added enhancement New feature or request help wanted Extra attention is needed labels Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant