microsoft / SymCrypt

Cryptographic library
MIT License
654 stars 68 forks source link

Building on Fedora linux #26

Open bkmgit opened 1 year ago

bkmgit commented 1 year ago

Default build options need some changes when packaging for Fedora Linux. For a release build, following test fails:

Starting performance measurements...
Perf min measurement clock time = 30000
Sanity check measurements:
512.0 cycles fixedTimeLoop, 6.0 cycles null, 39.0 cycles (for 32), 71.0 cycles (for 64), 135.0 cycles (for 128), 263.0 cycles (for 256), 519.0 cycles (for 512), 1030.9 cycles (for 1024), 2054.7 cycles (for 2048), 4103.1 cycles (for 4096), 8198.2 cycles (for 8192), 16391.6 cycles (for 16384)
*

***** FATAL ERROR /builddir/build/BUILD/SymCrypt-103.1.0/unittest/lib/perf.cpp(670): Measurement too fast
error: Bad exit status from /var/tmp/rpm-tmp.KJeasA (%check)

Build log

FIPS verification also seems to fail with a debug build:

Traceback (most recent call last):
  File "/builddir/build/BUILD/SymCrypt-103.1.0/scripts/process_fips_module.py", line 402, in <module>
    main()
  File "/builddir/build/BUILD/SymCrypt-103.1.0/scripts/process_fips_module.py", line 365, in main
    assert(fips_boundary_variable.value == PLACEHOLDER_VALUE)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
make[2]: *** [modules_linux/generic/CMakeFiles/symcrypt_generic_linux.dir/build.make:149: module/generic/libsymcrypt.so.103.1.0] Error 1
make[2]: *** Deleting file 'module/generic/libsymcrypt.so.103.1.0'
make[1]: *** [CMakeFiles/Makefile2:328: modules_linux/generic/CMakeFiles/symcrypt_generic_linux.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.2aryKX (%build)

Build log

Can investigate further if of interest to see how SymCrypt can be adapted to other platforms.

NielsFerguson commented 1 year ago

First one could be due to the compiler being more aggressive in inlining and optimizing and not performing all the computations in the performance measurement loop.

Niels

mlindgren commented 1 year ago

Fedora isn't currently a priority for us, but if you happen to find out what the issue is, we'd be happy to make reasonable changes to improve our cross-distro support. The interesting thing is that we do have a package which builds for Mariner using their build environment; Mariner is RedHat/Fedora based, and I believe the Mariner build tools should be similar to what's used there. Possibly just different default compiler flags - we may need to be more explicit in choosing which flags we set or don't set.