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

Support Microsoft CL.EXE compiler #137

Merged
merged 7 commits into from
Feb 22, 2024
Merged

Support Microsoft CL.EXE compiler #137

merged 7 commits into from
Feb 22, 2024

Conversation

jonahbeckford
Copy link
Contributor

  • __attribute__((unused)): Convert to MSVC non-standard extensions rather than GCC non-standard extensions
  • Use _WIN64 in addition to __x86_64__ to detect 64 bit
  • Quote shell parameters
  • Drop to 32-bit for some C code on 64-bit Windows to avoid algorithms that use 128-bit integers. MSVC does not support 128 bit integers
  • Use MSVC CPU intrinsics rather than GCC intrinsics

@jonahbeckford
Copy link
Contributor Author

Added commits for all the Opam packages in mirage-crypto that can work with MSVC:

  • ./mirage-crypto.opam
  • ./mirage-crypto-ec.opam
  • ./mirage-crypto-rng.opam
  • ./mirage-crypto-rng-mirage.opam

There are two Opam packages that won't work with MSVC:

  • ./mirage-crypto-pk.opam (relies on conf-gmp through zarith; GNU MP won't be available to MSVC)
  • ./mirage-crypto-rng-async.opam (Async is not supported on Windows)

Thanks!

Copy link
Member

@avsm avsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these comprehensive patches! I just left a few questions in the PR for my Windows-education.

config/cfg.ml Outdated Show resolved Hide resolved
rng/unix/mc_getrandom_stubs.c Outdated Show resolved Hide resolved
@hannesm
Copy link
Member

hannesm commented Sep 2, 2021

Thanks for your PR. This adds quite some #ifdef to the codebase -- would you be able to add a GitHub action (or whichever free-for-use other CI is suitable) that tests these paths?

I'll also need much more time to think about the #ifdef since these turned out to be a maintenance burden in the past.

The two failing ocaml-ci jobs (mirage-crypto-rng-async on s390 and 4.12+domains) are expected.

config/cfg.ml Outdated Show resolved Hide resolved
config/cfg.ml Show resolved Hide resolved
config/cfg.ml Outdated Show resolved Hide resolved
src/native/mirage_crypto.h Outdated Show resolved Hide resolved
@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Sep 5, 2021

Thanks for your PR. This adds quite some #ifdef to the codebase -- would you be able to add a GitHub action (or whichever free-for-use other CI is suitable) that tests these paths?

That may be quite a while, and GitLab will come before GitHub (at least for me). But we can keep this PR open; I can just patch it and pin this version for use in my Windows distribution for quite some time.

EDIT: GitHub Actions are possible but there is still work to-do; see https://github.com/diskuv/diskuv-ocaml-starter-ghmirror/runs/3844831608?check_suite_focus=true for an example. But GitHub Actions doesn't seem to resolve your main issue ("maintenance burden" below).

I'll also need much more time to think about the #ifdef since these turned out to be a maintenance burden in the past.

Yeah, this is related to your CI comment and my 'just patch/pin it' comment. Since the ifdefs will be a maintenance burden, let's figure out something else. Perhaps an expansion of the Dune configurator to simplify the ifdef clauses? Anyway ... there is no point proceeding with this PR without resolving how the PR will fit into the code base long-term!

Action Item:

  • (Owner: Mirage team) Resolve how this PR and ifdefs more generally can be maintainable in the code base

@jonahbeckford
Copy link
Contributor Author

Any progress on the maintainability of ifdefs?

config/cfg.ml Outdated Show resolved Hide resolved
config/cfg.ml Outdated Show resolved Hide resolved
config/cfg.ml Outdated Show resolved Hide resolved
config/cfg.ml Outdated Show resolved Hide resolved
config/cfg.ml Outdated Show resolved Hide resolved
src/native/mirage_crypto.h Outdated Show resolved Hide resolved
@hannesm
Copy link
Member

hannesm commented Dec 22, 2021

Again, thanks for your work. Looking back into this, how to move forward?
I see the following action items:

  • It is crucial to have a CI system for this port. Could you submit this as a separate PR? Then we can rebase this one on top of the CI one.
  • Figure out the __WIN32__ vs _WIN32 situation. We have a GitHub action (windows.yml) which tests cygwin, we'll see errors when only using _WIN32 fails (unclear why the windows CI run is not showing above).
  • is "CL.EXE" (and windows) only available on x86 CPUs? (since you add a || defined (_MSC_VER) to i386/x86_64 ifdef in entropy_cpu_stubs.c, and I'm not convinced that mixing CPU architecture ifdefs with platform ifdefs is a good idea)
  • Microsoft compiler does not support 128-bit integers. Drop down to 32-bit for MSVC. is this really the case, and no other way? Since this has a pretty big performance impact.
  • Please take a look at the code comments and address them
  • Please rebase onto the main branch

@jonahbeckford
Copy link
Contributor Author

I haven't forgotten about this PR. However, it may be quite a while before I get even to the first item (the MSVC CI, which is broader than this one package).

@jonahbeckford
Copy link
Contributor Author

  • Figure out the __WIN32__ vs _WIN32 situation. We have a GitHub action (windows.yml) which tests cygwin, we'll see errors when only using _WIN32 fails (unclear why the windows CI run is not showing above).

According to https://reviews.llvm.org/D40285 the _WIN32 macro works across MSVC, GCC and clang compilers:

In MSVC, WIN32 and WIN64 are never defined by the compiler, neither by system headers. Project files created by the IDE often contains them set manually though.

GCC on the other hand predefines both _WIN32 and WIN32 (and similarly for -64), but only when using the GNU standards additions (which are enabled by default) x86_64-w64-mingw32-gcc -E -dM - < /dev/null | grep WIN32 does include both, while the unprefixed one vanishes if you add e.g. -std=c99 (but are still included if you set -std=gnu99).

clang on the other hand doesn't check the standards version, but provides both WIN32 and _WIN32. And for the really inconsistent case, with clang -target x86_64-w64-mingw32 -E -dM - < /dev/null, you will have WIN64, _WIN64 and _WIN32, but no unprefixed WIN32.

So WIN32 is incorrect, even on GCC compilers.

hannesm added a commit to hannesm/opam-repository that referenced this pull request Mar 29, 2022
…age, mirage-crypto-rng-async, mirage-crypto-pk and mirage-crypto-ec (0.10.6)

CHANGES:

- Use _WIN32 instead of __WIN32__, as proposed by @jonahbeckford in mirage/mirage-crypto#137
- PKG_CONFIG_PATH via cygpath on Window (mirage/mirage-crypto#150 @MisterDA)
- ocaml-solo5 (formerly ocaml-freestanding) defines __ocaml_solo5__, use this
  in ifdef (arm only, mirage/mirage-crypto#152 @hannesm)
- mirag-crypto-rng-mirage test: require mirage-unix >= 5.0.0 (mirage/mirage-crypto#151 @hannesm)
- use oUnit2 as dependency, instead of oUnit (mirage/mirage-crypto#149 @MisterDA)
- support mipsel and mips64el compilation (mirage/mirage-crypto#148 @glondu)
- bugfix: define _POSIX_C_SOURCE in entropy_cpu_stubs.c (otherwise clock_gettime
  is not defined - at least on armhf) (mirage/mirage-crypto#148 @glondu)
- bugfix: compilation on kfreebsd-* (adding __FreeBSD_kernel__ to ifdef)
  (mirage/mirage-crypto#148 @glondu)
@hannesm
Copy link
Member

hannesm commented Jul 31, 2023

More than a year later, any news on this PR? I'm fine to integrate CL.EXE support into mirage-crypto. I'd be very happy to have a CI system.

I proposed some changes above, if you could integrate them and rebase, I'm fine to review again and likely merge.

@jonahbeckford
Copy link
Contributor Author

Oops!! I thought I had gotten all of these MSVC PRs done! I don't how I forgot about this one.

I'll stick an entry in my main issue queue, so I don't lose visibility.

@hannesm
Copy link
Member

hannesm commented Sep 19, 2023

Now that the CI part is merged, would you mind to rebase this PR on top of the main branch? There are some minor comments, which you could address or just rebase and we check whether the CI is happy. :)

@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Sep 19, 2023

Is there a version of mirage-crypto-pk that does not require zarith and conf-gmp-powm-sec? In particular, it looks like the GMP library needs to be compiled for MSVC.

I suspect originally I wasn't using mirage-crypto-pk. Or perhaps I used vcpkg (search for "gmp" in https://vcpkg.io/en/packages) to manually compile and hack the opam packages; but vcpkg (and other C build tools like Conan and even my more recent DkSDK CMake) can't be used in opam. We need to compile with the normal opam, ocaml and dune tools we have today.

  • This issue will stall again if someone can't look at the zarith dependency (either remove it from mirage-crypto-pk, or get zarith compiling with MSVC using opam+dune).
  • Rebase
  • opam exec -- dune runtest -p mirage-crypto-rng-lwt,mirage-crypto-rng-mirage,mirage-crypto-rng,mirage-crypto passes (notice no mirage-crypto-pk and its test consumer mirage-crypto-ec)
#=== ERROR while compiling zarith.1.13 ========================================#
# context     2.2.0~alpha0~20221228 | win32/x86_64 | ocaml-system.4.14.0 | https://opam.ocaml.org#98bb73cb
# path        Z:\source\mirage-crypto\_opam\.opam-switch\build\zarith.1.13
# command     C:\Users\beckf\AppData\Local\Programs\DKMLNA~1\bin\WITH-D~1.EXE ./configure
# exit-code   2
# env-file    C:\Users\beckf\AppData\Local\opam\log\zarith-30492-488a23.env
# output-file C:\Users\beckf\AppData\Local\opam\log\zarith-30492-488a23.out
### output ###
# [...]
# binary ocamlmklib: found in /c/Users/beckf/AppData/Local/Programs/DKMLNA~1/usr/bin
# binary ocamldoc: found in /c/Users/beckf/AppData/Local/Programs/DKMLNA~1/usr/bin
# binary ocamlopt: found in /c/Users/beckf/AppData/Local/Programs/DKMLNA~1/usr/bin
# checking compilation with ocamlc -O3 -Wall -Wextra : not working
# checking compilation with ocamlc -O: working
# include caml/mlvalues.h: found
# library dynlink.cmxa: found
# binary ocamlfind: found in /z/source/mirage-crypto/_opam/bin
# OCaml's word size is 64
# include gmp.h: not found
# include mpir.h: not found
# cannot find GMP nor MPIR


#=== ERROR while compiling conf-gmp-powm-sec.3 ================================#
# context     2.2.0~alpha0~20221228 | win32/x86_64 | ocaml-system.4.14.0 | https://opam.ocaml.org#98bb73cb
# path        Z:\source\mirage-crypto\_opam\.opam-switch\build\conf-gmp-powm-sec.3
# command     C:\Users\beckf\AppData\Local\Programs\DKMLNA~1\bin\WITH-D~1.EXE sh -exc cc -c $CFLAGS -I/usr/local/include test.c
# exit-code   127
# env-file    C:\Users\beckf\AppData\Local\opam\log\conf-gmp-powm-sec-30492-467716.env
# output-file C:\Users\beckf\AppData\Local\opam\log\conf-gmp-powm-sec-30492-467716.out
### output ###
# + cc -c -I/usr/local/include test.c
# sh: line 1: cc: command not found

@hannesm
Copy link
Member

hannesm commented Sep 21, 2023

Thanks for your work. In respect to gmp: there's no effort to make mirage-crypto-pk independent of gmp/zarith so far :/

The good news is there's (esp. for the mirage build setup) an overlay of the zarith package that uses dune: https://github.com/dune-universe/opam-overlays/tree/master/packages/zarith/zarith.1.12%2Bdune (there's even a gmp-compiled-by-dune, released as "gmp" to opam-repository).

There's some discussion ocaml/Zarith#73 ocaml/Zarith#143 about using dune for zarith, but I do not know the state thereof.

@hannesm
Copy link
Member

hannesm commented Feb 3, 2024

6 months later, I'm curious whether there's any interest to move this to completion? As I see, opam 2.2 is supposed to support windows natively - would this help for this PR (my suspicion is that gmp & zarith from opam should then work?) I also have seen ocaml/Zarith#43 (open since 5 years without any comment).

@jonahbeckford
Copy link
Contributor Author

6 months later, I'm curious whether there's any interest to move this to completion?

I think the way forward is just to check in the MSVC code as-is so it doesn't stagnate. Or provide a mock implementation of a subset of zarith (failwith every function) via a virtual library for gmp and zarith ... so at least the MSVC code compiles but does not run.

As I see, opam 2.2 is supposed to support windows natively - would this help for this PR (my suspicion is that gmp & zarith from opam should then work?)

Highly doubt that opam 2.2 is concerned with gmp and zarith. They will just mark those libraries as unavailable on Windows. But those libraries are very likely available in Cygwin, which isn't native Windows but is a stop-gap for some Windows users.

I also have seen ocaml/Zarith#43 (open since 5 years without any comment).

Oh, that is so sad! Eventually we (OCaml community) may need to port over (perhaps machine translate) something from Rust rather than rely on GMP. I assume that crypto just needs big integer not big decimal numbers, right? Regardless, a mock implementation defining exactly what is needed from the leading crypto package (mirage-crypto) would be the first step.

@hannesm
Copy link
Member

hannesm commented Feb 8, 2024

Dear @jonahbeckford, thanks for your reply.

6 months later, I'm curious whether there's any interest to move this to completion?

I think the way forward is just to check in the MSVC code as-is so it doesn't stagnate. Or provide a mock implementation of a subset of zarith (failwith every function) via a virtual library for gmp and zarith ... so at least the MSVC code compiles but does not run.
[...]

I also have seen ocaml/Zarith#43 (open since 5 years without any comment).

Oh, that is so sad! Eventually we (OCaml community) may need to port over (perhaps machine translate) something from Rust rather than rely on GMP. I assume that crypto just needs big integer not big decimal numbers, right? Regardless, a mock implementation defining exactly what is needed from the leading crypto package (mirage-crypto) would be the first step.

Since "a mock implementation" is quite some work, in addition to runtime failures which I do not appreciate, what about (a) solving the conflicts in this PR and (b) focus on mirage-crypto/mirage-crypto-rng/mirage-crypto-ec (but not mirage-crypto-pk which has the gmp dependency) for windows for now -- specifically, can we adapt the windows CI to not compile mirage-crypto-pk (is it as smooth as removing "mirage-crypto-pk" from "ci/build-test.sh")?

@jonahbeckford
Copy link
Contributor Author

Since "a mock implementation" is quite some work, in addition to runtime failures which I do not appreciate,

I took a second look at virtual libraries: https://dune.readthedocs.io/en/stable/variants.html. No mock implementation needed, and we'd be able to avoid bitrot for the MSVC code since that code will compile. The precise steps would be:

  1. Create a virtual library. Let's call it mirage-crypto-bigint for now.
  2. Inside it has a mirage_crypto_bigint.mli specifying exactly what types and functions mirage-crypto needs from Zarith.
  3. Make an implementation library mirage-crypto-bigint.zarith that just passes through to Zarith.

I'm not asking for that today, but I am asking whether you or your team can do that sometime in the next year or two. If not (or something less Dune-specific; perhaps with functors, etc.), this whole exercise is pointless.

After that mirage_crypto_bigint.mli is made, everybody will have a good starting point for what needs to be implemented outside Zarith. (Actually, the num package is perfectly portable although slower, so an implementation library mirage-crypto-bigint.num could be an intermediate step).

@jonahbeckford
Copy link
Contributor Author

(a) solving the conflicts in this PR and (b) focus on mirage-crypto/mirage-crypto-rng/mirage-crypto-ec (but not mirage-crypto-pk which has the gmp dependency) for windows for now -- specifically, can we adapt the windows CI to not compile mirage-crypto-pk (is it as smooth as removing "mirage-crypto-pk" from "ci/build-test.sh")?

Done. Although I can't test my windows CI changes because it does not look like the MSVC tests run as part of PRs.

.github/workflows/dkml.yml Outdated Show resolved Hide resolved
@hannesm
Copy link
Member

hannesm commented Feb 11, 2024

config/cfg.ml Outdated Show resolved Hide resolved
@hannesm
Copy link
Member

hannesm commented Feb 17, 2024

Thanks again for your work, there's only a minor nit to re-establish the std_cflags as before this PR in cfg.ml. Otherwise good to merge. I ran bench/speed.exe on my laptop with this change (including my proposal #137 (comment)) and the main branch (36bc72f), and there's not much difference.

Thus, fine to merge if the proposed re-restablishment of std_cflags is added to your branch. I'd squash and merge since I don't think the individual commits are worth to keep. Let me know if you disagree.

@hannesm
Copy link
Member

hannesm commented Feb 19, 2024

Dear @jonahbeckford, it would be great if you could re-establish the C flags as suggested above. Once this is done, maybe a rebase/merge of the main branch is useful, and then I'd move forward and merge this long-lasting PR finally into the main tree.

Co-authored-by: Hannes Mehnert <hannes@mehnert.org>
@jonahbeckford
Copy link
Contributor Author

I'd squash and merge since I don't think the individual commits are worth to keep. Let me know if you disagree.

Squash and merge is good. Thanks!

@hannesm hannesm merged commit 839558e into mirage:main Feb 22, 2024
27 checks passed
@hannesm
Copy link
Member

hannesm commented Feb 22, 2024

Thanks a lot, merged. Let's see the CI on the main branch :)

@hannesm
Copy link
Member

hannesm commented Feb 22, 2024

Dear @jonahbeckford, I merged this. I also pushed 7f3887e which will hopefully run the DKML CI for each pull request.

I noticed that the DKML CI does not work though:
https://github.com/mirage/mirage-crypto/actions/runs/8003970521/job/21860387635

#=== ERROR while compiling zarith.1.13 ========================================#
# context              2.2.0~alpha0~20221228 | win32/x86_64 |  | [https://opam.ocaml.org#8cda2e5a](https://opam.ocaml.org/#8cda2e5a)
# path                 D:\.opam\dkml\.opam-switch\build\zarith.1.13
# command              D:\.opam\dkml\.opam-switch\build\zarith.1.13\./configure
# exit-code            2
# env-file             D:\.opam\log\zarith-5380-7341b5.env
# output-file          D:\.opam\log\zarith-5380-7341b5.out
### output ###
# [...]
# binary ocamlmklib: found in /d/.opam/dkml/bin
# binary ocamldoc: found in /d/.opam/dkml/bin
# binary ocamlopt: found in /d/.opam/dkml/bin
# checking compilation with ocamlc -O3 -Wall -Wextra : not working
# checking compilation with ocamlc -O: working
# include caml/mlvalues.h: found
# library dynlink.cmxa: found
# binary ocamlfind: found in /d/.opam/dkml/bin
# OCaml's word size is 32
# include gmp.h: not found
# include mpir.h: not found
# cannot find GMP nor MPIR


#=== ERROR while compiling mirage-crypto.0.11.2 ===============================#
# context              2.2.0~alpha0~20221228 | win32/x86_64 |  | [https://opam.ocaml.org#8cda2e5a](https://opam.ocaml.org/#8cda2e5a)
# path                 D:\.opam\dkml\.opam-switch\build\mirage-crypto.0.11.2
# command              D:\.opam\dkml\bin\dune.exe build -p mirage-crypto -j 3
# exit-code            1
# env-file             D:\.opam\log\mirage-crypto-5380-bd0157.env
# output-file          D:\.opam\log\mirage-crypto-5380-bd0157.out
### output ###
# [...]
# (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cst[...]
# cl : Command line error D8021 : invalid numeric argument '/Wextra'
# File "src/dune", line 11, characters 11-25:
# 11 |     chacha poly1305-donna entropy_cpu_stubs)
#                 ^^^^^^^^^^^^^^
# (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cst[...]
# cl : Command line error D8021 : invalid numeric argument '/Wextra'
# File "src/dune", line 9, characters 59-65:
# 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
#                                                                ^^^^^^
# (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cst[...]
# cl : Command line error D8021 : invalid numeric argument '/Wextra'


#=== ERROR while compiling conf-gmp-powm-sec.3 ================================#
# context              2.2.0~alpha0~20221228 | win32/x86_64 |  | [https://opam.ocaml.org#8cda2e5a](https://opam.ocaml.org/#8cda2e5a)
# path                 D:\.opam\dkml\.opam-switch\build\conf-gmp-powm-sec.3
# command              D:\a\_temp\msys64\usr\bin\sh.exe -exc cc -c $CFLAGS -I/usr/local/include test.c
# exit-code            127
# env-file             D:\.opam\log\conf-gmp-powm-sec-5380-fd851c.env
# output-file          D:\.opam\log\conf-gmp-powm-sec-5380-fd851c.out
### output ###
# + cc -c -I/usr/local/include test.c
# /usr/bin/sh: line 1: cc: command not found



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build conf-gmp-powm-sec 3
| - build mirage-crypto     0.11.2
| - build zarith            1.13
+- 
+- The following changes have been performed (the rest was aborted)
| - install alcotest            1.7.0
| - install astring             0.8.5
| - install base-bytes          base
| - install cmdliner            1.2.0
| - install conf-gmp            4
| - install cppo                1.6.9
| - install csexp               1.5.2
| - install cstruct             6.2.0
| - install domain-name         0.4.0
| - install dune                3.12.1
| - install dune-configurator   3.12.1
| - install duration            0.2.1
| - install eqaf                0.9
| - install fmt                 0.9.0
| - install functoria-runtime   4.4.2
| - install hex                 1.5.0
| - install ipaddr              5.5.0
| - install logs                0.7.0
| - install lwt                 5.7.0
| - install macaddr             5.5.0
| - install mirage-clock        4.2.0
| - install mirage-clock-unix   4.2.0
| - install mirage-runtime      4.4.2
| - install mirage-time         3.0.0
| - install mirage-time-unix    3.0.0
| - install mirage-unix         5.0.1
| - install mtime               2.0.0
| - install ocaml-compiler-libs v0.12.4
| - install ocaml-syntax-shims  1.0.0
| - install ocamlbuild          0.14.2+win+unix
| - install ocamlfind           1.9.5
| - install ocplib-endian       1.2
| - install ounit2              2.2.7
| - install ppx_derivers        1.2.1
| - install ppx_deriving        5.2.1
| - install ppx_deriving_yojson 3.7.0
| - install ppxlib              0.30.0
| - install ptime               1.1.0
| - install randomconv          0.1.3
| - install re                  1.11.0
| - install result              1.5
| - install seq                 base
| - install sexplib0            v0.16.0
| - install stdlib-shims        0.3.0
| - install topkg               1.0.7
| - install uutf                1.0.3
| - install yojson              2.1.2
+- 
# Run eval $(opam env '--root=D:\.opam') to update the current shell environment

The former state can be restored with:
    D:\a\mirage-crypto\mirage-crypto\.ci\sd4\bs\bin\opam.exe switch import "D:\\.opam\\dkml\\.opam-switch\\backup\\state-20240222120353.export"


========= [START OF TROUBLESHOOTING] ===========



========= [TROUBLESHOOTING] conf-gmp-powm-sec-5380-fd851c.out ===========

[conf-gmp-powm-sec-5380-fd851c.out] + cc -c -I/usr/local/include test.c
[conf-gmp-powm-sec-5380-fd851c.out] /usr/bin/sh: line 1: cc: command not found


========= [TROUBLESHOOTING] mirage-crypto-5380-bd0157.out ===========

[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 16-25:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]                      ^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foaes_aesni.obj -c native/aes_aesni.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 4-15:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]          ^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foaes_generic.obj -c native/aes_generic.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 17, characters 9-23:
[mirage-crypto-5380-bd0157.out] 17 |   (names chacha_generic)
[mirage-crypto-5380-bd0157.out]               ^^^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fochacha_generic.obj -c native/chacha_generic.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 65-76:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]                                                                       ^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fodes_generic.obj -c native/des_generic.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 9-28:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]              ^^^^^^^^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fodetect_cpu_features.obj -c native/detect_cpu_features.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 11, characters 4-10:
[mirage-crypto-5380-bd0157.out] 11 |     chacha poly1305-donna entropy_cpu_stubs)
[mirage-crypto-5380-bd0157.out]          ^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fochacha.obj -c native/chacha.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 11, characters 26-43:
[mirage-crypto-5380-bd0157.out] 11 |     chacha poly1305-donna entropy_cpu_stubs)
[mirage-crypto-5380-bd0157.out]                                ^^^^^^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foentropy_cpu_stubs.obj -c native/entropy_cpu_stubs.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 40-52:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]                                              ^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foghash_pclmul.obj -c native/ghash_pclmul.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 26-39:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]                                ^^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foghash_generic.obj -c native/ghash_generic.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 10, characters 53-64:
[mirage-crypto-5380-bd0157.out] 10 |     aes_generic aes_aesni ghash_generic ghash_pclmul ghash_ctmul des_generic
[mirage-crypto-5380-bd0157.out]                                                           ^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Foghash_ctmul.obj -c native/ghash_ctmul.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 66-76:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                                                       ^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fohash_stubs.obj -c native/hash_stubs.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 43-46:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                                ^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fomd5.obj -c native/md5.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 34-42:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                       ^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fomisc_sse.obj -c native/misc_sse.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 29-33:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                  ^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fomisc.obj -c native/misc.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 52-58:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                                         ^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fosha256.obj -c native/sha256.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 47-51:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                                    ^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fosha1.obj -c native/sha1.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 11, characters 11-25:
[mirage-crypto-5380-bd0157.out] 11 |     chacha poly1305-donna entropy_cpu_stubs)
[mirage-crypto-5380-bd0157.out]                 ^^^^^^^^^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fopoly1305-donna.obj -c native/poly1305-donna.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'
[mirage-crypto-5380-bd0157.out] File "src/dune", line 9, characters 59-65:
[mirage-crypto-5380-bd0157.out] 9 |   (names detect_cpu_features misc misc_sse md5 sha1 sha256 sha512 hash_stubs
[mirage-crypto-5380-bd0157.out]                                                                ^^^^^^
[mirage-crypto-5380-bd0157.out] (cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD --std=c11 -Wall -Wextra -Wpedantic -O3 -I D:/.opam/dkml/lib/ocaml -I D:\.opam\dkml\lib\cstruct -I D:\.opam\dkml\lib\eqaf -I D:\.opam\dkml\lib\eqaf\bigstring -I D:\.opam\dkml\lib\eqaf\cstruct /Fosha512.obj -c native/sha512.c)
[mirage-crypto-5380-bd0157.out] cl : Command line error D8021 : invalid numeric argument '/Wextra'


========= [TROUBLESHOOTING] zarith-5380-7341b5.out ===========

[zarith-5380-7341b5.out] binary ocaml: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] binary ocamlc: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] binary ocamldep: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] binary ocamlmklib: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] binary ocamldoc: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] binary ocamlopt: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] checking compilation with ocamlc -O3 -Wall -Wextra : not working
[zarith-5380-7341b5.out] checking compilation with ocamlc -O: working
[zarith-5380-7341b5.out] include caml/mlvalues.h: found
[zarith-5380-7341b5.out] library dynlink.cmxa: found
[zarith-5380-7341b5.out] binary ocamlfind: found in /d/.opam/dkml/bin
[zarith-5380-7341b5.out] OCaml's word size is 32
[zarith-5380-7341b5.out] include gmp.h: not found
[zarith-5380-7341b5.out] include mpir.h: not found
[zarith-5380-7341b5.out] cannot find GMP nor MPIR

Scroll up to see the [TROUBLESHOOTING] logs that begin at the [START OF TROUBLESHOOTING] line

(same for the x86_64 CI). I've no clue what the underlying issue is, maybe you have an idea?

@hannesm
Copy link
Member

hannesm commented Feb 22, 2024

somehow it looks like in cfg.ml the std_flags doesn't take the match ccomp_opt with Some "msvc" -> .. turn, but the catchall.

@hannesm
Copy link
Member

hannesm commented Feb 22, 2024

and also the opam install --yes --deps-only --with-test .. mirage-crypto-ec .. leads to mirage-crypto-pk being installed (or trying to at least)

hannesm added a commit to hannesm/opam-repository that referenced this pull request Feb 26, 2024
CHANGES:

* mirage-crypto, mirage-crypto-rng{,lwt,mirage}: support CL.EXE compiler
  (mirage/mirage-crypto#137 @jonahbeckford) - mirage-crypto-pk not yet due to gmp dependency,
  mirage-crypto-ec doesn't pass testsuite
* mirage-crypto-ec: use simpler square root for ed25519 - saving 3
  multiplications and 2 squarings, details
  https://mailarchive.ietf.org/arch/msg/cfrg/qlKpMBqxXZYmDpXXIx6LO3Oznv4/
  (mirage/mirage-crypto#196 @hannesm)
* mirage-crypto-ec: use sliding window method with pre-computed calues of
  multiples of the generator point for NIST curves, speedup around 4x for P-256
  sign (mirage/mirage-crypto#191 @Firobe, review @palainp @hannesm)
* mirage-crypto-ec: documentation: warn about power timing analysis on `k` in
  Dsa.sign (mirage/mirage-crypto#195 @hannesm, as proposed by @edwintorok)
* mirage-crypto-ec: replace internal Cstruct.t by string (speedup up to 2.5x)
  (mirage/mirage-crypto#146 @dinosaure @hannesm @reynir, review @Firobe @palainp @hannesm @reynir)
* bench/speed: add EC (ECDSA & EdDSA generate/sign/verify, ECDH secret/share)
  operations (mirage/mirage-crypto#192 @hannesm)
* mirage-crypto-rng: use rdtime instead of rdcycle on RISC-V (rdcycle is
  privileged since Linux kernel 6.6) (mirage/mirage-crypto#194 @AdrianBunk, review by @edwintorok)
* mirage-crypto-rng: support Loongarch (mirage/mirage-crypto#190 @fangyaling, review @loongson-zn)
* mirage-crypto-rng: support NetBSD (mirage/mirage-crypto#189 @drchrispinnock)
* mirage-crypto-rng: allocate less in Fortuna when feeding (mirage/mirage-crypto#188 @hannesm,
  reported by @palainp)
* mirage-crypto-ec: avoid mirage-crypto-pk and asn1-combinators test dependency
  (instead, craft our own asn.1 decoder -- mirage/mirage-crypto#200 @hannesm)

### Performance differences between v0.11.2 and v0.11.3 and OpenSSL

The overall result is promising: P-256 sign operation improved 9.4 times, but
is still a 4.9 times slower than OpenSSL.

Numbers in operations per second (apart from speedup, which is a factor
v0.11.3 / v0.11.2), gathered on a Intel i7-5600U CPU 2.60GHz using FreeBSD 14.0,
OCaml 4.14.1, and OpenSSL 3.0.12.

#### P224

| op     | v0.11.2 | v0.11.3 | speedup | OpenSSL |
|--------|---------|---------|---------|---------|
| gen    | 1160    | 20609   |    17.8 |         |
| sign   | 931     | 8169    |     8.8 | 21319   |
| verify | 328     | 1606    |     4.9 | 10719   |
| dh-sec | 1011    | 12595   |    12.5 |         |
| dh-kex | 992     | 2021    |     2.0 | 16691   |

#### P256

| op     | v0.11.2 | v0.11.3 | speedup | OpenSSL |
|--------|---------|---------|---------|---------|
| gen    | 990     | 19365   |    19.6 |         |
| sign   | 792     | 7436    |     9.4 | 36182   |
| verify | 303     | 1488    |     4.9 | 13383   |
| dh-sec | 875     | 11508   |    13.2 |         |
| dh-kex | 895     | 1861    |     2.1 | 17742   |

#### P384

| op     | v0.11.2 | v0.11.3 | speedup | OpenSSL |
|--------|---------|---------|---------|---------|
| gen    | 474     | 6703    |    14.1 |         |
| sign   | 349     | 3061    |     8.8 | 900     |
| verify | 147     | 544     |     3.7 | 1062    |
| dh-sec | 378     | 4405    |    11.7 |         |
| dh-kex | 433     | 673     |     1.6 | 973     |

#### P521

| op     | v0.11.2 | v0.11.3 | speedup | OpenSSL |
|--------|---------|---------|---------|---------|
| gen    | 185     | 1996    |    10.8 |         |
| sign   | 137     | 438     |     3.2 | 2737    |
| verify | 66      | 211     |     3.2 | 1354    |
| dh-sec | 180     | 1535    |     8.5 |         |
| dh-kex | 201     | 268     |     1.3 | 2207    |

#### 25519

| op     | v0.11.2 | v0.11.3 | speedup | OpenSSL |
|--------|---------|---------|---------|---------|
| gen    | 23271   | 22345   |     1.0 |         |
| sign   | 11228   | 10985   |     1.0 | 21794   |
| verify | 8149    | 8029    |     1.0 | 7729    |
| dh-sec | 14075   | 13968   |     1.0 |         |
| dh-kex | 13487   | 14079   |     1.0 | 24824   |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants