pq-crystals/kyber

randombytes.c dependency on shared libraries

RafKarr opened this issue · 3 comments

Hello
When compiling Kyber as shared libraries, I believe that you are missing the randombytes.c file in the Makefile. I tried using the shared library in a Python script and it states "OS Error: randombytes symbol not found". I fixed it, by adding said file to the compilation command and now it works perfectly.

Environment:
Ubuntu 20.04
GCC 9.3.0
Python 3.8

Reproductible action:
Compiling shared libraries with "make shared" and then calling the libraries from Python

Expected result:
Libraries loaded and functions working

Actual result:
Library not loaded and error message "OS Error: randombytes symbol not found"

Cheers !

Yes randombytes.c is missing, after adding it I could suddenly link everything just fine, will this issue be fixed? After adding the randombytes.c dependency the shared objects seem to work fine but standard "make" will then fail due to multiple names being the same...

@Adrian-Grana is this going to be an issue still? I am looking at running this library via Swift.

@realityworks Sorry for the late reply, yes it is but I think it's intentional because randombytes.c is the entropy source and depending on the project, other people may not want urandom from Linux, so this way you can choose the source of entropy yourself and link it with the rest of the project allong with the Kyber libraries.

What these PQC libraries need is a documentation, guess work should never be a part of implementing a crypto library.... So if you're doing anything that should be safe, either contact someone from the Crystals Team or wait for the standard from NIST.