'Looking to use a library with example code for Open Quantum Safe

So I am trying to use following library: Open Quantum Safe

I am using windows linux subsystem, so I followed the linux setup. I think I followed all the steps correctly, as I didnt have any errors.

I next wanted to run the example provided here: example KEM

This example code is also in the repo.

When I run the command suggested at the bottom of the second link I get the following:

/usr/bin/ld: build/lib/liboqs.a(aes_ossl.c.o): in function OQS_AES128_ECB_load_schedule': aes_ossl.c:(.text.OQS_AES128_ECB_load_schedule+0x2b): undefined reference to EVP_CIPHER_CTX_new' /usr/bin/ld: aes_ossl.c:(.text.OQS_AES128_ECB_load_schedule+0x39): undefined reference to EVP_aes_128_ecb' /usr/bin/ld: aes_ossl.c:(.text.OQS_AES128_ECB_load_schedule+0x4d): undefined reference to EVP_EncryptInit_ex' /usr/bin/ld: aes_ossl.c:(.text.OQS_AES128_ECB_load_schedule+0x61): undefined reference to EVP_CIPHER_CTX_set_padding' /usr/bin/ld: build/lib/liboqs.a(aes_ossl.c.o): in function OQS_AES128_free_schedule': aes_ossl.c:(.text.OQS_AES128_free_schedule+0x17): undefined reference to EVP_CIPHER_CTX_free' /usr/bin/ld: build/lib/liboqs.a(aes_ossl.c.o): in function OQS_AES128_ECB_enc': aes_ossl.c:(.text.OQS_AES128_ECB_enc+0x71): undefined reference to EVP_EncryptUpdate' /usr/bin/ld: aes_ossl.c:(.text.OQS_AES128_ECB_enc+0x8c): undefined reference to EVP_EncryptFinal_ex' /usr/bin/ld: aes_ossl.c:(.text.OQS_AES128_ECB_enc+0xa9): undefined reference to `EVP_CIPHER_CTX_free'

and another 50 or so lines of the same type of errors.

This error is clearly telling me it cannot find functions, or files that it needs to compile, but I am not sure why? Some of these functions I cannot even locate.

My guess is that I somehow built the files wrong, but I am unsure.

If anyone has any experience with this library, or maybe wants to help me with the specifics, please let me know.

Thanks.



Solution 1:[1]

As mentioned by @Tsyvarev, I was using a static library which is why it was not able to find the dependencies. Once I used the dynamic library I was able to run the code.

Specific answer if you are using this exact library:

 cmake -GNinja .. -DBUILD_SHARED_LIBS=ON 

I also had to set the Path to the .so file:

 LD_LIBRARY_PATH=/usr/liboqs/build/lib

I also did ldconfig, not sure if that was necessary or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 FlynnLives