open-quantum-safe / liboqs-python

Python 3 bindings for liboqs
https://openquantumsafe.org/
MIT License
106 stars 36 forks source link

Versioning difference between liboqs-python and liboqs? #50

Closed baentsch closed 1 year ago

baentsch commented 2 years ago

https://github.com/open-quantum-safe/liboqs-python/blob/2928d8a6327dcfdb3cef4e515afd7c0e25f9bb0d/setup.py#L7 specifies a definite liboqs version number, but https://github.com/open-quantum-safe/liboqs-python/blob/2928d8a6327dcfdb3cef4e515afd7c0e25f9bb0d/oqs/oqs.py#L30 seems to load any liboqs library -- including one with a distinctly different version number.

This issue is to ask how to reconcile/avoid such mismatch 1) Add assertion to not run a library different from the version stated in "setup.py" 2) Obtain version number from liboqs and drop/supersede the one in "setup.py".

Other suggestions welcome.

baentsch commented 1 year ago

liboqs indeed has no runtime API to query its version number (in a shared lib, say). So, either we add such function (and then query it from a language wrapper as discussed) OR we document that "wrapper and liboqs version may differ with unknown functional results in case of mismatch". The latter I find personally unsatisfactory. The former would be trivial. Right now, the only way to query the liboqs version is by running the test programs that output the version string (and that would be the only way someone can detect such differences to explain possibly weird behaviours).

@dstebila @vsoftco : Other suggestions? Preferences?

vsoftco commented 1 year ago

I'd go with a char const* get_oqs_ver() function that we can invoke at runtime

dstebila commented 1 year ago

Yes, an char *OQS_version() function defined in src/common.h and implemented in src/common.c seems appropriate for this.

vsoftco commented 1 year ago

I'll implement that then propagate to the wrappers

baentsch commented 1 year ago

Thanks. Proposal in https://github.com/open-quantum-safe/liboqs/tree/mb-version

vsoftco commented 1 year ago

done in the wrapper as well (oqs_version() and oqs_python_version())

vsoftco commented 1 year ago

@baentsch @dstebila Fixed in the latest release https://github.com/open-quantum-safe/liboqs-python/blob/4be47c8d8fcc4e59f262ea2a96955349de8bb40f/oqs/oqs.py#L69, we emit a warning if the versions don't coincide

baentsch commented 1 year ago

we emit a warning if the versions don't coincide

That's OK -- but something seems to be not quite OK as CI fails...

baentsch commented 1 year ago

Problem found: Docker image didn't install the package/call setup.py.