Skip to content

chmodshubham/liboqs-const-time-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

LibOQS Installation with Constant-Time Testing Enabled

Prerequisites

  • OS: Ubuntu 22.04
  • Memory: At least 4-8 GB
  • Disk Space: More than 5 GB

Install required tools and libraries:

sudo apt update
sudo apt install astyle cmake gcc ninja-build libssl-dev \
                 python3-pytest python3-pytest-xdist unzip xsltproc \
                 doxygen graphviz python3-yaml valgrind

Quick Installation

# Get the source code
git clone https://github.com/open-quantum-safe/liboqs.git
cd liboqs

# Create build directory
mkdir build && cd build

# Configure build with constant-time testing enabled
cmake -GNinja .. \
    -DCMAKE_BUILD_TYPE=Debug \
    -DOQS_ENABLE_TEST_CONSTANT_TIME=ON \
    -DOQS_DIST_BUILD=ON

# Optional extra flags you can add:
# -DCMAKE_INSTALL_PREFIX=/usr/local      # Install location
# -DOQS_USE_OPENSSL=ON                   # Use OpenSSL primitives
# -DOQS_ENABLE_KEM_CLASSIC_MCELIECE=OFF  # Skip slow algorithms
# -DBUILD_SHARED_LIBS=ON                  # Build shared libs

# Build the library
ninja

Running Constant-Time Tests

Test All Algorithms

# From the build/ directory
python3 ../tests/test_constant_time.py

Ignore the extra line breaks — I pressed Enter multiple times to ensure the program hadn’t frozen.

image

Test Specific Algorithms

# Test only Kyber
python3 ../tests/test_constant_time.py -k Kyber

# Test specific variant
python3 ../tests/test_constant_time.py -k ML-KEM-512

# Test with verbose output
python3 ../tests/test_constant_time.py -v -k Dilithium

Skip Slow Algorithms

# Set environment variable to skip certain algorithms
export SKIP_ALGS="Classic-McEliece,HQC"
python3 ../tests/test_constant_time.py

Direct Valgrind Testing

# Run Valgrind directly on a test binary
valgrind --tool=memcheck \
         --error-exitcode=1 \
         ./tests/test_kem ML-KEM-512

About

LibOQS Installation with Constant-Time Testing Enabled and test_constant_time.py code flow

Topics

Resources

Stars

Watchers

Forks