Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: SAGA Tests

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install ".[dev]"

- name: Generate test vectors
run: python code/generate_test_vectors.py --outdir code/test_vectors --n 10000

- name: Verify compiled C sampler distribution
# Compiles sampler.c, runs it, and chi2-tests the output against
# the folded PDT. Catches comparison-logic bugs (e.g. an ascending
# CDT sampled with the RCDT convention) that the table lint misses.
run: pytest code/tests/test_sampler_c.py -v --tb=short

- name: Run tests
run: pytest code/tests/ -v --tb=short
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
__pycache__/
*.pyc
*.egg-info/
dist/
build/
.eggs/
code/test_vectors/
code/baseline_results.json
code/*.eps
code/samples.txt
.pytest_cache/

# Original HPRR20 reference sample data (~530MB); preserved in the
# pqcrypto2020-as-published tag. Restore with:
# git checkout pqcrypto2020-as-published -- code/testdata
code/testdata/

# macOS / generated artifacts
.DS_Store
figures/
code/power_matrix.json
671 changes: 671 additions & 0 deletions IMPROVEMENTS.md

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,24 @@ Code from the paper available at: https://eprint.iacr.org/2019/1411

SAGA (Statistically Acceptable GAussians) is a test suite proposal for verfying statistical correctness for univariate and multivariate Gaussians. The paper accompanying this code has been published at PQCrypto 2020 and is also available on [ePrint](https://eprint.iacr.org/2019/1411). The following will briefly describe how to setup and use the python script.

## Scope of testing

SAGA's **statistical layer** detects implementation bugs — distributional deviations of order δ ≳ 1/√N. It does not certify proof-level security properties (Rényi divergence R_a − 1 ≲ 2⁻⁷⁵), which require the **analytic certification layer** (`certification.py`). It also does not detect trace-level side-channel leakage; SAGA-passing must not be advertised as side-channel assurance. See [BLLSS18], [Pre17] for the Rényi divergence framework and [QA25], [ZLYW23] for attacks that succeed against statistically perfect implementations.

## Installation

This standalone implementation should be able to run on most machines. We have provided a `requirements.txt` file to install all the dependencies; install these can be done by simple running `pip install -r requirements.txt` for Python 2 or `pip3 install -r requirements.txt` for Python 3.
Requires Python ≥ 3.10. Install with:

```
pip install ".[dev]"
```

Run tests:

```
python code/generate_test_vectors.py --outdir code/test_vectors --n 10000
pytest code/tests/ -v
```

## How to use

Expand Down
Loading
Loading