open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.77k stars 433 forks source link

Environment-specific Classic McEliece constant-time leaks #1540

Open praveksharma opened 1 year ago

praveksharma commented 1 year ago

Describe the bug The testing suite is reporting potential memory leaks (test_constant_time.txt) for Classic McEliece which are not documented in the suppression files.

To Reproduce I am unable to reproduce this issue locally. Additionally, these errors aren't being caught by the CI during weekly constant time tests. One might try to reproduce this with following steps:

docker run -dti openquantumsafe/ci-ubuntu-focal-x86_64 /bin/bash
docker attach (output of docker run command)
cd
git clone https://github.com/open-quantum-safe/liboqs
cd liboqs
mkdir build
cd build
cmake -GNinja -DOQS_OPT_TARGET=generic -DCMAKE_BUILD_TYPE=Debug -DOQS_ENABLE_TEST_CONSTANT_TIME=ON ..
ninja
cd ..
SKIP_ALGS='BIKE*,Frodo*,HQC*,Kyber*,NTRU*,stru*,ntru*,LightSaber,Saber,FireSaber,Dilithium*,Falcon*,,SPHINCS*' python3 tests/test_constant_time.py  --verbose

Thank you for sharing this issue @bhess! Could you please share information about your environment: Environment (please complete the following information):

praveksharma commented 1 year ago

Addressing the (potential) leaks documented in this issue doesn't fix the larger issue of the current Classic McEliece implementation (potentially) not being constant time in certain environments. Aside from documenting this in the advisories (as in #1541) should we be taking additional measures for the final 0.9.0 release?

bhess commented 1 year ago

Thank you for picking this up @praveksharma !

The environment is:

OS: Ubuntu 22.04.3 LTS OpenSSL version 3.0.2 Compiler version used: GCC 11.4.0 Build variables used: -DCMAKE_BUILD_TYPE=Debug -DOQS_ENABLE_TEST_CONSTANT_TIME=ON liboqs version: main

OfekShochat commented 1 year ago

This is an interesting problem! I have no real experience (I think I understand the McEliece cryptosystem), but if this isn't too bad to fix I can try. Any analysis yet? Why is this happening? What architectures are having this issue and on what version?

dstebila commented 11 months ago

@praveksharma, do we consider this to be resolved?