open-quantum-safe / liboqs-cpp

C++ bindings for liboqs
https://openquantumsafe.org/
MIT License
36 stars 8 forks source link

Seeing compilation failure here. #15

Closed sagar0976 closed 8 months ago

sagar0976 commented 8 months ago

Hi,

I cloned this C++ wrapper for liboqs. When I compiled as per the instructions, I see the below compilation error:

In file included from /auto/bausers/skamble/PQC/liboqs-cpp/examples/rand.cpp:8: /auto/bausers/skamble/PQC/liboqs-cpp/include/rand/rand.hpp: In function ‘void oqs::rand::randombytes_nist_kat_init_256bit(const bytes&, const bytes&)’: /auto/bausers/skamble/PQC/liboqs-cpp/include/rand/rand.hpp:92:12: error: ‘OQS_randombytes_nist_kat_init_256bit’ is not a member of ‘oqs::C’ C::OQS_randombytes_nist_kat_init_256bit(entropy_input.data(), ^~~~~~~~ /auto/bausers/skamble/PQC/liboqs-cpp/include/rand/rand.hpp:92:12: note: suggested alternative: ‘OQS_randombytes_custom_algorithm’ C::OQS_randombytes_nist_kat_init_256bit(entropy_input.data(), ^~~~~~~~ OQS_randombytes_custom_algorithm /auto/bausers/skamble/PQC/liboqs-cpp/include/rand/rand.hpp:96:8: error: ‘OQS_randombytes_nist_kat_init_256bit’ is not a member of ‘oqs::C’ C::OQS_randombytes_nist_kat_init_256bit(entropy_input.data(), nullptr); ^~~~~~~~ /auto/bausers/skamble/PQC/liboqs-cpp/include/rand/rand.hpp:96:8: note: suggested alternative: ‘OQS_randombytes_custom_algorithm’ C::OQS_randombytes_nist_kat_init_256bit(entropy_input.data(), nullptr); ^~~~~~~~ OQS_randombytes_custom_algorithm /auto/bausers/skamble/PQC/liboqs-cpp/examples/rand.cpp: In function ‘int main()’: /auto/bausers/skamble/PQC/liboqs-cpp/examples/rand.cpp:21:45: error: ‘OQS_RAND_alg_nist_kat’ was not declared in this scope oqs::rand::randombytes_switch_algorithm(OQS_RAND_alg_nist_kat); ^~~~~ /auto/bausers/skamble/PQC/liboqs-cpp/examples/rand.cpp:21:45: note: suggested alternative: ‘OQS_RAND_alg_system’ oqs::rand::randombytes_switch_algorithm(OQS_RAND_alg_nist_kat);

Is something missing in the code?

https://github.com/open-quantum-safe/liboqs-cpp/blob/d3c5d371dc0f312f7b31c82cfd31fba64c5d3e30/include/rand/rand.hpp#L96

Merricx commented 8 months ago

I think this error happens if your liboqs version is above 0.9.0, since the affected function (OQS_randombytes_nist_kat_init_256bit) is now moved to the rand_nist.h.

Downgrading liboqs to version 0.9.0 works for me.

sagar0976 commented 8 months ago

Thanks Merricx, initially I didn't notice the version. Later when I cloned lower version, it worked for me. Forgot to update the forum.