open-quantum-safe / oqs-provider

OpenSSL 3 provider containing post-quantum algorithms
https://openquantumsafe.org
MIT License
197 stars 83 forks source link

Windows: Build fails when using OQS_MINIMAL_BUILD #482

Open fwh-dc opened 3 weeks ago

fwh-dc commented 3 weeks ago

Describe the bug I've built a liboqs with cmake arg -DOQS_MINIMAL_BUILD="KEM_kyber;OQS_ENABLE_KEM_kyber_512;OQS_ENABLE_KEM_kyber_768;OQS_ENABLE_KEM_kyber_1024;"

When building oqs-provider on windows I get

C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo -DOQSPROVIDER_VERSION_TEXT=\"0.5.3\" -DOQS_PROVIDER_COMMIT="\" (42ff366)\"" -DOQS_PROVIDER_NOATOMIC -DOQS_PROVIDER_STATIC -D_CRT_SECURE_NO_WARNINGS -external:IC:\Users\****\build\debug\windows\x86_64\install\include -external:IC:\Users\****\build\debug\windows\x86_64\install\include\oqs -external:W0 /DWIN32 /D_WINDOWS /Zi /Ob0 /Od /RTC1 -std:c11 -MDd /showIncludes /Fooqsprov\CMakeFiles\oqsprovider.dir\oqsprov_capabilities.c.obj /Fdoqsprov\CMakeFiles\oqsprovider.dir\oqsprovider.pdb /FS -c C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c
14:47:40  C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c(222): error C2059: syntax error: '}'
14:47:40  C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c(437): warning C4034: sizeof returns 0
14:47:40  C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c(535): error C2059: syntax error: '}'
14:47:40  C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c(543): warning C4034: sizeof returns 0
14:47:40  C:\Users\****\oqs-provider\oqsprov\oqsprov_capabilities.c(544): warning C4034: sizeof returns 0

Expected behavior I'm not sure what the actual fix should be but I would expect compilation to succeed.

Environment (please complete the following information):

baentsch commented 3 weeks ago

Correct expectation. But there's not too many people on the team that use or have experience with Windows. I used to spend many hours trying to understand / get stuff tested on that platform, but those hours are now taken away by discussions about process and procedure with LinuxFoundation, Sorry.

Anyone else reading, by all means please chip in your Windows experience!

@fwh-dc if this is related to your work on DTLS13, any chance this could be done on a Unixish platform?

fwh-dc commented 3 weeks ago

@fwh-dc if this is related to your work on DTLS13, any chance this could be done on a Unixish platform?

No it's unrelated. We are building apps for all major platforms that should be upgraded with pqc TLS for a start (DTLS will come later). And I am more mac/unix oriented too.

I did a little digging. Turns out that no algorithms were enabled at all (somehow an issue with cmake externalproject and argument parsing). So I've fixed that part to correctly allow only Kyber.

I think I've found a workaround which is to enable at least one KEM and one signature algorithm. If there are no signature algorithms or KEMs enabled then oqs_param_sigalg_list and/or oqs_param_group_list are empty which causes windows to fail compilation.