pykyber 3.2.0__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {pykyber-3.2.0 → pykyber-3.3.0}/CHANGELOG.md +15 -0
  2. {pykyber-3.2.0 → pykyber-3.3.0}/CONTRIBUTING.md +8 -8
  3. {pykyber-3.2.0 → pykyber-3.3.0}/Cargo.lock +38 -74
  4. {pykyber-3.2.0 → pykyber-3.3.0}/Cargo.toml +6 -4
  5. {pykyber-3.2.0 → pykyber-3.3.0}/Makefile +1 -1
  6. {pykyber-3.2.0 → pykyber-3.3.0}/PKG-INFO +25 -22
  7. {pykyber-3.2.0 → pykyber-3.3.0}/README.md +23 -20
  8. {pykyber-3.2.0 → pykyber-3.3.0}/SECURITY.md +68 -3
  9. pykyber-3.3.0/clippy.toml +6 -0
  10. {pykyber-3.2.0 → pykyber-3.3.0}/docs/api.md +13 -1
  11. {pykyber-3.2.0 → pykyber-3.3.0}/docs/enterprise.md +2 -2
  12. {pykyber-3.2.0 → pykyber-3.3.0}/docs/index.md +1 -1
  13. {pykyber-3.2.0 → pykyber-3.3.0}/docs/migration.md +10 -0
  14. {pykyber-3.2.0 → pykyber-3.3.0}/docs/security.md +1 -1
  15. {pykyber-3.2.0 → pykyber-3.3.0}/performance-tests/benchmark.py +22 -16
  16. pykyber-3.3.0/performance-tests/latency.png +0 -0
  17. pykyber-3.3.0/performance-tests/ml_kem_vs_kyber.png +0 -0
  18. pykyber-3.3.0/performance-tests/results.json +330 -0
  19. {pykyber-3.2.0 → pykyber-3.3.0}/pyproject.toml +15 -2
  20. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/__init__.py +19 -8
  21. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_error.py +8 -0
  22. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_hybrid.py +4 -4
  23. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_kyber.py +3 -3
  24. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_mlkem.py +6 -6
  25. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_pykyber.pyi +2 -0
  26. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_tls.py +4 -4
  27. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_types.py +9 -7
  28. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_validation.py +26 -7
  29. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_kyber.py +44 -0
  30. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_ml_kem_nist_hybrids.py +2 -2
  31. pykyber-3.3.0/python/tests/test_stub.py +70 -0
  32. pykyber-3.3.0/python/tests/test_threads.py +51 -0
  33. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_tls_hybrid_groups.py +4 -1
  34. pykyber-3.3.0/python/tests/test_version.py +14 -0
  35. pykyber-3.3.0/python/tests/test_wrong_lengths.py +72 -0
  36. {pykyber-3.2.0 → pykyber-3.3.0}/requirements-dev.txt +2 -0
  37. {pykyber-3.2.0 → pykyber-3.3.0}/scripts/check.sh +1 -0
  38. pykyber-3.3.0/scripts/security/README.md +50 -0
  39. pykyber-3.3.0/scripts/security/fuzz_nist.py +227 -0
  40. pykyber-3.3.0/scripts/security/fuzz_tls.py +275 -0
  41. pykyber-3.3.0/scripts/security/fuzz_xwing.py +173 -0
  42. pykyber-3.3.0/scripts/security/timing_decaps.py +249 -0
  43. pykyber-3.3.0/scripts/security/timing_mlkem.py +78 -0
  44. pykyber-3.3.0/scripts/security/timing_nist.py +280 -0
  45. pykyber-3.3.0/scripts/security/timing_tls.py +94 -0
  46. pykyber-3.3.0/scripts/security/timing_xwing.py +255 -0
  47. {pykyber-3.2.0 → pykyber-3.3.0}/src/hybrid.rs +10 -6
  48. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/api.rs +20 -19
  49. pykyber-3.3.0/src/kyber/fips202.rs +308 -0
  50. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/indcpa.rs +4 -4
  51. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/kem.rs +7 -7
  52. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/mod.rs +1 -1
  53. {pykyber-3.2.0 → pykyber-3.3.0}/src/lib.rs +28 -7
  54. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/cctv_tests.rs +1 -1
  55. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/compress.rs +6 -0
  56. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/differential_tests.rs +50 -38
  57. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/kem.rs +27 -26
  58. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/kpke.rs +13 -16
  59. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/params.rs +47 -0
  60. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/sample.rs +5 -0
  61. {pykyber-3.2.0 → pykyber-3.3.0}/src/nistec.rs +3 -0
  62. {pykyber-3.2.0 → pykyber-3.3.0}/src/pyhybrid.rs +11 -5
  63. {pykyber-3.2.0 → pykyber-3.3.0}/src/pymlkem.rs +10 -5
  64. {pykyber-3.2.0 → pykyber-3.3.0}/src/pytls.rs +11 -6
  65. {pykyber-3.2.0 → pykyber-3.3.0}/src/pyxwing.rs +12 -5
  66. {pykyber-3.2.0 → pykyber-3.3.0}/src/tls.rs +13 -10
  67. {pykyber-3.2.0 → pykyber-3.3.0}/src/xwing/tests.rs +13 -14
  68. {pykyber-3.2.0 → pykyber-3.3.0}/src/xwing.rs +9 -6
  69. {pykyber-3.2.0 → pykyber-3.3.0}/tests/api_kem.rs +31 -31
  70. {pykyber-3.2.0 → pykyber-3.3.0}/tests/integration_kem.rs +17 -18
  71. {pykyber-3.2.0 → pykyber-3.3.0}/tests/legacy_decaps_rejection.rs +8 -9
  72. {pykyber-3.2.0 → pykyber-3.3.0}/tests/legacy_length_checks.rs +12 -12
  73. {pykyber-3.2.0 → pykyber-3.3.0}/tests/legacy_rng_failure.rs +11 -10
  74. {pykyber-3.2.0 → pykyber-3.3.0}/tests/legacy_vectors.rs +8 -9
  75. pykyber-3.2.0/.github/CODEOWNERS +0 -5
  76. pykyber-3.2.0/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
  77. pykyber-3.2.0/.github/ISSUE_TEMPLATE/config.yml +0 -8
  78. pykyber-3.2.0/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
  79. pykyber-3.2.0/.github/dependabot.yml +0 -37
  80. pykyber-3.2.0/.github/pull_request_template.md +0 -34
  81. pykyber-3.2.0/.github/workflows/CI.yml +0 -447
  82. pykyber-3.2.0/.github/workflows/audit.yml +0 -39
  83. pykyber-3.2.0/AGENTS.md +0 -137
  84. pykyber-3.2.0/CLAUDE.md +0 -67
  85. pykyber-3.2.0/performance-tests/latency.png +0 -0
  86. pykyber-3.2.0/performance-tests/ml_kem_vs_kyber.png +0 -0
  87. pykyber-3.2.0/performance-tests/results.json +0 -228
  88. pykyber-3.2.0/python/tests/test_stub.py +0 -45
  89. pykyber-3.2.0/src/kyber/fips202.rs +0 -477
  90. {pykyber-3.2.0 → pykyber-3.3.0}/.cargo/config.toml +0 -0
  91. {pykyber-3.2.0 → pykyber-3.3.0}/.gitignore +0 -0
  92. {pykyber-3.2.0 → pykyber-3.3.0}/LICENSE-APACHE +0 -0
  93. {pykyber-3.2.0 → pykyber-3.3.0}/LICENSE-MIT +0 -0
  94. {pykyber-3.2.0 → pykyber-3.3.0}/docs/assets/logo-mono.png +0 -0
  95. {pykyber-3.2.0 → pykyber-3.3.0}/docs/assets/logo.png +0 -0
  96. {pykyber-3.2.0 → pykyber-3.3.0}/performance-tests/requirements.txt +0 -0
  97. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/_deprecation.py +0 -0
  98. {pykyber-3.2.0 → pykyber-3.3.0}/python/pykyber/py.typed +0 -0
  99. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_features.py +0 -0
  100. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_kyber_deprecation.py +0 -0
  101. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_legacy_vectors.py +0 -0
  102. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_ml_kem_768_x25519.py +0 -0
  103. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_mlkem.py +0 -0
  104. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_mlkem_acvp.py +0 -0
  105. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_mlkem_bindings.py +0 -0
  106. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_mlkem_cctv.py +0 -0
  107. {pykyber-3.2.0 → pykyber-3.3.0}/python/tests/test_mlkem_wycheproof.py +0 -0
  108. {pykyber-3.2.0 → pykyber-3.3.0}/scripts/fetch_vectors.py +0 -0
  109. {pykyber-3.2.0 → pykyber-3.3.0}/src/hybrid/tests.rs +0 -0
  110. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/cbd.rs +0 -0
  111. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/error.rs +0 -0
  112. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/ntt.rs +0 -0
  113. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/params.rs +0 -0
  114. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/poly.rs +0 -0
  115. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/polyvec.rs +0 -0
  116. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/reduce.rs +0 -0
  117. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/symmetric.rs +0 -0
  118. {pykyber-3.2.0 → pykyber-3.3.0}/src/kyber/verify.rs +0 -0
  119. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/acvp_tests.rs +0 -0
  120. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/check.rs +0 -0
  121. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/ct.rs +0 -0
  122. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/mod.rs +0 -0
  123. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/polyvec.rs +0 -0
  124. {pykyber-3.2.0 → pykyber-3.3.0}/src/mlkem/wycheproof_tests.rs +0 -0
  125. {pykyber-3.2.0 → pykyber-3.3.0}/src/tls/tests.rs +0 -0
  126. {pykyber-3.2.0 → pykyber-3.3.0}/src/x25519.rs +0 -0
  127. {pykyber-3.2.0 → pykyber-3.3.0}/tests/mlkem_shared_primitives.rs +0 -0
  128. {pykyber-3.2.0 → pykyber-3.3.0}/tests/unit_params.rs +0 -0
  129. {pykyber-3.2.0 → pykyber-3.3.0}/tests/vectors/gen_capture.rs +0 -0
  130. {pykyber-3.2.0 → pykyber-3.3.0}/tests/vectors/generate.py +0 -0
  131. {pykyber-3.2.0 → pykyber-3.3.0}/tests/vectors/legacy-kyber-v1.0.5.json +0 -0
  132. {pykyber-3.2.0 → pykyber-3.3.0}/tests/vectors/manifest.json +0 -0
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v3.3.0
6
+
7
+ Released 2026-12-06. The ML-KEM, hybrid and TLS classes release the GIL, so calls in different threads run in parallel; free-threaded Python 3.14 gets its own wheels; and `pykyber.__version__` and the key pair and result types are public. The output of every class is unchanged, and no existing API changes. See "Upgrading to 3.3" in `docs/migration.md`.
8
+
9
+ - Docs (#115): the performance table in the README has all nine classes, the three TLS groups included, and every number in it comes from one run of `performance-tests/benchmark.py` on 3.2.0. The script now times the hybrid and TLS classes too.
10
+ - Changed (#111): the ML-KEM, hybrid and TLS classes release the GIL while a key generation, encapsulation or decapsulation runs, so calls in different threads run in parallel. On a four-core machine, ML-KEM-768 decapsulation went from about 14 000 calls per second on any number of threads to about 51 000 on four threads. One thread is as fast as before, and no output changes. The deprecated Kyber classes are unchanged.
11
+ - Fixed (#109): `Kyber512`, `Kyber768` and `Kyber1024` raised a bare `TypeError` for an argument that has no length (`None`, a number), and `from_keys` did for text of the right length. They now raise a `KyberError`, like every other refusal. The error is still a `TypeError` as well, so code that catches that keeps working. No output changes.
12
+ - Added (#108): `pykyber.__version__`, the version of the package as a string. It is compiled into the extension, so it is the version of the code that runs.
13
+ - Added (#112): wheels for free-threaded Python 3.14 (`cp314t`) on Linux (glibc and musl), macOS and Windows, beside the abi3 wheels. `pip install pykyber` on `python3.14t` built from the sdist before. The extension does not switch the GIL back on, and the test suite runs on 3.14t in CI. There is no wheel for 3.13t: PyO3 0.30 does not support it.
14
+ - Added (#102): `MlKemKeypair`, `MlKemEncapsulationResult`, `HybridKeypair`, `HybridEncapsulationResult`, `TlsKeypair` and `TlsEncapsulationResult` can be imported from `pykyber`, for annotations and `isinstance` checks. They were only in the private module `pykyber._types`. The classes are the same; the two types of the deprecated Kyber classes stay where they are.
15
+ - Fixed (#102): under mypy, unpacking a key pair or a result (`public_key, secret_key = keypair`) and the size constants (`PUBLIC_KEY_SIZE` and the others) were `Any`. They are `bytes` and `int` now. Nothing changes at run time.
16
+ - Dependency (#101): `rand` 0.10.4 and `rand_core` 0.10.1 replace 0.8.6 and 0.6.4. The operating system generator is now `SysRng` from `getrandom` 0.4.3; it was `OsRng` on `getrandom` 0.2.17. The wheel is built with one `rand_core` instead of two, and without `rand_chacha`, `ppv-lite86` and `zerocopy`. On Linux and Android `getrandom` 0.4 calls the C library's `getrandom()` where 0.2 made the system call itself, and on Windows it calls `ProcessPrng` where 0.2 called `BCryptGenRandom`. Keys and secrets are drawn as before, and a failing generator still raises `RandomnessError`.
17
+ - Packaging: the sdist no longer contains `.github/`, `AGENTS.md` and `CLAUDE.md`, files that are about working in the repository and not about building the package. Everything else in it is unchanged, and the wheels are not affected.
18
+ - Dependency: `zeroize`, the crate that wipes secrets from memory, moves from 1.8.2 to 1.9.2 in `Cargo.lock`, so the wheels are built with it. The requirement in `Cargo.toml` (`1.7`) is unchanged. The wipes pykyber relies on were read in the new source and checked in release assembly (x86_64, aarch64).
19
+
5
20
  ## v3.2.0
6
21
 
7
22
  Released 2026-12-04. Adds the key exchange of the three TLS 1.3 hybrid groups of RFC 10024 as `TLS_X25519_ML_KEM_768`, `TLS_P256_ML_KEM_768` and `TLS_P384_ML_KEM_1024`. The output of every existing class is unchanged, and no existing API changes. See "Upgrading to 3.2" in `docs/migration.md`.
@@ -1,10 +1,11 @@
1
1
  # Contributing to PyKyber
2
2
 
3
- PyKyber is a post-quantum KEM library: round-3 CRYSTALS-Kyber, implemented
4
- from scratch in Rust (the only third-party crypto at runtime is the curve arithmetic of the hybrids, from three pinned crates) and exposed to Python
5
- through PyO3. Release 2.0.0 added ML-KEM (FIPS 203) beside the legacy Kyber
6
- API. This file covers how to work on the repo; `AGENTS.md` is the binding
7
- rulebook for humans *and* AI agents.
3
+ PyKyber is a post-quantum KEM library: ML-KEM (FIPS 203), hybrids of ML-KEM
4
+ with X25519, P-256 and P-384, the TLS 1.3 hybrid groups and the legacy round-3
5
+ Kyber classes, implemented from scratch in Rust and exposed to Python through
6
+ PyO3. The only third-party crypto at runtime is the curve arithmetic of the
7
+ hybrids, from three pinned crates. This file covers how to work on the repo;
8
+ `AGENTS.md` is the binding rulebook for humans *and* AI agents.
8
9
 
9
10
  ## Development setup
10
11
 
@@ -35,7 +36,7 @@ make benchmark # performance-tests/benchmark.py
35
36
  These commands are the gate for every PR:
36
37
 
37
38
  ```bash
38
- scripts/check.sh # fmt, clippy -D warnings, cargo test, maturin develop, pytest
39
+ scripts/check.sh # fmt, clippy -D warnings, cargo test, mypy, maturin develop, pytest
39
40
  ```
40
41
 
41
42
  CI runs the same checks on Linux, macOS and Windows.
@@ -77,8 +78,7 @@ branch.
77
78
  - To prove the *whole* branch passes, not only the tip:
78
79
 
79
80
  ```bash
80
- git rebase --exec 'cargo fmt --check && cargo clippy --all-targets -- -D warnings \
81
- && cargo test --no-fail-fast' dev
81
+ git rebase --exec scripts/check.sh dev
82
82
  ```
83
83
 
84
84
  ## Code rules (the short list)
@@ -41,6 +41,17 @@ version = "1.0.4"
41
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
42
42
  checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
43
43
 
44
+ [[package]]
45
+ name = "chacha20"
46
+ version = "0.10.2"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
49
+ dependencies = [
50
+ "cfg-if",
51
+ "cpufeatures",
52
+ "rand_core",
53
+ ]
54
+
44
55
  [[package]]
45
56
  name = "cmov"
46
57
  version = "0.5.4"
@@ -87,7 +98,7 @@ dependencies = [
87
98
  "ctutils",
88
99
  "hybrid-array",
89
100
  "num-traits",
90
- "rand_core 0.10.1",
101
+ "rand_core",
91
102
  "subtle",
92
103
  "zeroize",
93
104
  ]
@@ -99,7 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
99
110
  checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
100
111
  dependencies = [
101
112
  "hybrid-array",
102
- "rand_core 0.10.1",
113
+ "rand_core",
103
114
  ]
104
115
 
105
116
  [[package]]
@@ -171,7 +182,7 @@ dependencies = [
171
182
  "ff",
172
183
  "group",
173
184
  "hybrid-array",
174
- "rand_core 0.10.1",
185
+ "rand_core",
175
186
  "sec1",
176
187
  "subtle",
177
188
  "zeroize",
@@ -183,7 +194,7 @@ version = "0.14.0"
183
194
  source = "registry+https://github.com/rust-lang/crates.io-index"
184
195
  checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f"
185
196
  dependencies = [
186
- "rand_core 0.10.1",
197
+ "rand_core",
187
198
  "subtle",
188
199
  ]
189
200
 
@@ -206,13 +217,14 @@ dependencies = [
206
217
 
207
218
  [[package]]
208
219
  name = "getrandom"
209
- version = "0.2.17"
220
+ version = "0.4.3"
210
221
  source = "registry+https://github.com/rust-lang/crates.io-index"
211
- checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
222
+ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
212
223
  dependencies = [
213
224
  "cfg-if",
214
225
  "libc",
215
- "wasi",
226
+ "r-efi",
227
+ "rand_core",
216
228
  ]
217
229
 
218
230
  [[package]]
@@ -222,7 +234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
222
234
  checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4"
223
235
  dependencies = [
224
236
  "ff",
225
- "rand_core 0.10.1",
237
+ "rand_core",
226
238
  "subtle",
227
239
  ]
228
240
 
@@ -267,7 +279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
267
279
  checksum = "01737161ba802849cfd486b5bd209d38ba4943494c249a8126005170c7621edd"
268
280
  dependencies = [
269
281
  "crypto-common",
270
- "rand_core 0.10.1",
282
+ "rand_core",
271
283
  ]
272
284
 
273
285
  [[package]]
@@ -302,7 +314,7 @@ dependencies = [
302
314
  "kem",
303
315
  "module-lattice",
304
316
  "pkcs8",
305
- "rand_core 0.10.1",
317
+ "rand_core",
306
318
  "sha3",
307
319
  "shake",
308
320
  ]
@@ -372,15 +384,6 @@ version = "1.13.1"
372
384
  source = "registry+https://github.com/rust-lang/crates.io-index"
373
385
  checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
374
386
 
375
- [[package]]
376
- name = "ppv-lite86"
377
- version = "0.2.21"
378
- source = "registry+https://github.com/rust-lang/crates.io-index"
379
- checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
380
- dependencies = [
381
- "zerocopy",
382
- ]
383
-
384
387
  [[package]]
385
388
  name = "primefield"
386
389
  version = "0.14.0"
@@ -390,7 +393,7 @@ dependencies = [
390
393
  "crypto-bigint",
391
394
  "crypto-common",
392
395
  "ff",
393
- "rand_core 0.10.1",
396
+ "rand_core",
394
397
  "subtle",
395
398
  "zeroize",
396
399
  ]
@@ -417,7 +420,7 @@ dependencies = [
417
420
 
418
421
  [[package]]
419
422
  name = "pykyber"
420
- version = "3.2.0"
423
+ version = "3.3.0"
421
424
  dependencies = [
422
425
  "curve25519-dalek",
423
426
  "flate2",
@@ -426,7 +429,7 @@ dependencies = [
426
429
  "p384",
427
430
  "pyo3",
428
431
  "rand",
429
- "rand_core 0.6.4",
432
+ "rand_core",
430
433
  "serde",
431
434
  "serde_json",
432
435
  "x-wing",
@@ -500,33 +503,20 @@ dependencies = [
500
503
  ]
501
504
 
502
505
  [[package]]
503
- name = "rand"
504
- version = "0.8.6"
505
- source = "registry+https://github.com/rust-lang/crates.io-index"
506
- checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
507
- dependencies = [
508
- "libc",
509
- "rand_chacha",
510
- "rand_core 0.6.4",
511
- ]
512
-
513
- [[package]]
514
- name = "rand_chacha"
515
- version = "0.3.1"
506
+ name = "r-efi"
507
+ version = "6.0.0"
516
508
  source = "registry+https://github.com/rust-lang/crates.io-index"
517
- checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
518
- dependencies = [
519
- "ppv-lite86",
520
- "rand_core 0.6.4",
521
- ]
509
+ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
522
510
 
523
511
  [[package]]
524
- name = "rand_core"
525
- version = "0.6.4"
512
+ name = "rand"
513
+ version = "0.10.4"
526
514
  source = "registry+https://github.com/rust-lang/crates.io-index"
527
- checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
515
+ checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11"
528
516
  dependencies = [
517
+ "chacha20",
529
518
  "getrandom",
519
+ "rand_core",
530
520
  ]
531
521
 
532
522
  [[package]]
@@ -697,12 +687,6 @@ version = "1.0.24"
697
687
  source = "registry+https://github.com/rust-lang/crates.io-index"
698
688
  checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
699
689
 
700
- [[package]]
701
- name = "wasi"
702
- version = "0.11.1+wasi-snapshot-preview1"
703
- source = "registry+https://github.com/rust-lang/crates.io-index"
704
- checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
705
-
706
690
  [[package]]
707
691
  name = "wnaf"
708
692
  version = "0.14.1"
@@ -735,43 +719,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
735
719
  checksum = "e7e8131a03190127fb2263afc72b322ecadae46b6ff8c6f399ff5d02f5559af6"
736
720
  dependencies = [
737
721
  "curve25519-dalek",
738
- "rand_core 0.10.1",
739
- ]
740
-
741
- [[package]]
742
- name = "zerocopy"
743
- version = "0.8.39"
744
- source = "registry+https://github.com/rust-lang/crates.io-index"
745
- checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
746
- dependencies = [
747
- "zerocopy-derive",
748
- ]
749
-
750
- [[package]]
751
- name = "zerocopy-derive"
752
- version = "0.8.39"
753
- source = "registry+https://github.com/rust-lang/crates.io-index"
754
- checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
755
- dependencies = [
756
- "proc-macro2",
757
- "quote",
758
- "syn 2.0.117",
722
+ "rand_core",
759
723
  ]
760
724
 
761
725
  [[package]]
762
726
  name = "zeroize"
763
- version = "1.8.2"
727
+ version = "1.9.2"
764
728
  source = "registry+https://github.com/rust-lang/crates.io-index"
765
- checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
729
+ checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa"
766
730
  dependencies = [
767
731
  "zeroize_derive",
768
732
  ]
769
733
 
770
734
  [[package]]
771
735
  name = "zeroize_derive"
772
- version = "1.4.3"
736
+ version = "1.5.0"
773
737
  source = "registry+https://github.com/rust-lang/crates.io-index"
774
- checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e"
738
+ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
775
739
  dependencies = [
776
740
  "proc-macro2",
777
741
  "quote",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pykyber"
3
- version = "3.2.0"
3
+ version = "3.3.0"
4
4
  edition = "2021"
5
5
  # What the curve crates need: the fixes for RUSTSEC-2026-0385 and
6
6
  # RUSTSEC-2026-0387 are only in releases that require 1.87.
@@ -23,8 +23,10 @@ zeroize = { version = "1.7", features = ["derive"] }
23
23
  curve25519-dalek = { version = "=5.1.0", default-features = false, features = ["zeroize"] }
24
24
  p256 = { version = "=0.14.0", default-features = false, features = ["arithmetic"] }
25
25
  p384 = { version = "=0.14.0", default-features = false, features = ["arithmetic"] }
26
- rand = "0.8"
27
- rand_core = "0.6"
26
+ # Only the operating system generator (`SysRng`, from `getrandom`) and the
27
+ # `TryCryptoRng` trait are used; no userspace generator is compiled in.
28
+ rand = { version = "0.10", default-features = false, features = ["sys_rng"] }
29
+ rand_core = "0.10"
28
30
 
29
31
  [features]
30
32
  # Exposes the ML-KEM `*_internal` functions that take caller-chosen randomness,
@@ -36,7 +38,7 @@ flate2 = "1"
36
38
  # Independent FIPS 203 implementation for the differential test only (never a
37
39
  # runtime dependency). `hazmat` exposes encapsulation with a caller-chosen m.
38
40
  ml-kem = { version = "=0.3.4", features = ["hazmat"] }
39
- rand = "0.8"
41
+ rand = "0.10"
40
42
  # Independent X-Wing implementation for the differential test only (never a
41
43
  # runtime dependency). Its `encapsulate_deterministic` takes a caller-chosen eseed.
42
44
  x-wing = "=0.1.1"
@@ -7,7 +7,7 @@ dev-build-package:
7
7
  maturin develop
8
8
 
9
9
  clean:
10
- rm ./python/pykyber/*.so
10
+ rm -f ./python/pykyber/*.so
11
11
  rm -rf ./target/
12
12
 
13
13
  benchmark:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pykyber
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Classifier: Programming Language :: Python :: 3.11
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Programming Language :: Python :: 3.13
@@ -18,7 +18,7 @@ Author-email: Yoav Haimov <haimovyoav@gmail.com>
18
18
  License-Expression: MIT OR Apache-2.0
19
19
  Requires-Python: >=3.11
20
20
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
21
- Project-URL: Documentation, https://github.com/Zikithezikit/pykyber/tree/v3.2.0/docs
21
+ Project-URL: Documentation, https://github.com/Zikithezikit/pykyber/tree/v3.3.0/docs
22
22
  Project-URL: Homepage, https://github.com/Zikithezikit/pykyber
23
23
  Project-URL: Issues, https://github.com/Zikithezikit/pykyber/issues
24
24
  Project-URL: Repository, https://github.com/Zikithezikit/pykyber
@@ -37,7 +37,7 @@ Post-quantum key encapsulation for Python: ML-KEM (FIPS 203, the standard that c
37
37
  pip install pykyber
38
38
  ```
39
39
 
40
- Python 3.11 or newer. Prebuilt wheels cover Linux (glibc and musl), macOS, Windows and Android.
40
+ Python 3.11 or newer. Prebuilt wheels cover Linux (glibc and musl), macOS, Windows and Android. Free-threaded Python 3.14 (`python3.14t`) has its own wheels on Linux, macOS and Windows.
41
41
 
42
42
  ## Quick start
43
43
 
@@ -100,14 +100,17 @@ Time per call from Python on an Intel Core i7-7700 (Python 3.14, release build,
100
100
 
101
101
  | Class | Key generation | Encapsulation | Decapsulation |
102
102
  |-------|----------------|---------------|---------------|
103
- | `ML_KEM_512` | 0.031 ms | 0.037 ms | 0.047 ms |
104
- | `ML_KEM_768` | 0.051 ms | 0.058 ms | 0.072 ms |
105
- | `ML_KEM_1024` | 0.080 ms | 0.083 ms | 0.099 ms |
106
- | `ML_KEM_768_X25519` | 0.100 ms | 0.152 ms | 0.208 ms |
107
- | `ML_KEM_768_P256` | 0.261 ms | 0.479 ms | 0.537 ms |
108
- | `ML_KEM_1024_P384` | 0.788 ms | 1.527 ms | 1.599 ms |
109
-
110
- The ML-KEM rows are from the run of 2026-12-04 below. The three hybrid rows were measured the same way in earlier runs, `ML_KEM_768_X25519` on 2026-12-03 and the other two on 2026-12-04, and are not in the chart.
103
+ | `ML_KEM_512` | 0.030 ms | 0.036 ms | 0.045 ms |
104
+ | `ML_KEM_768` | 0.053 ms | 0.061 ms | 0.073 ms |
105
+ | `ML_KEM_1024` | 0.082 ms | 0.091 ms | 0.103 ms |
106
+ | `ML_KEM_768_X25519` | 0.098 ms | 0.154 ms | 0.212 ms |
107
+ | `ML_KEM_768_P256` | 0.268 ms | 0.490 ms | 0.553 ms |
108
+ | `ML_KEM_1024_P384` | 0.815 ms | 1.576 ms | 1.657 ms |
109
+ | `TLS_X25519_ML_KEM_768` | 0.102 ms | 0.154 ms | 0.118 ms |
110
+ | `TLS_P256_ML_KEM_768` | 0.269 ms | 0.501 ms | 0.292 ms |
111
+ | `TLS_P384_ML_KEM_1024` | 0.822 ms | 1.576 ms | 0.842 ms |
112
+
113
+ All nine rows are from the run of 2026-12-05 described below. The chart shows the three ML-KEM classes. In a TLS group the server's step (encapsulation) does two curve multiplications, one for its own key share and one for the shared secret, and the client's step (decapsulation) does one.
111
114
 
112
115
  ![ML-KEM time per operation](https://raw.githubusercontent.com/Zikithezikit/pykyber/main/performance-tests/latency.png)
113
116
 
@@ -117,17 +120,17 @@ The same script times ML-KEM in two other Python libraries, in the same process
117
120
 
118
121
  | Parameter set | Library | Key generation | Encapsulation | Decapsulation |
119
122
  |---------------|---------|----------------|---------------|---------------|
120
- | ML-KEM-512 | pykyber 3.1.0 | 0.031 ms | 0.037 ms | 0.047 ms |
121
- | ML-KEM-512 | liboqs-python 0.16.0.2 | 0.011 ms | 0.014 ms | 0.013 ms |
122
- | ML-KEM-512 | kyber-py 1.2.0 | 1.747 ms | 2.485 ms | 3.469 ms |
123
- | ML-KEM-768 | pykyber 3.1.0 | 0.051 ms | 0.058 ms | 0.072 ms |
124
- | ML-KEM-768 | liboqs-python 0.16.0.2 | 0.015 ms | 0.018 ms | 0.018 ms |
125
- | ML-KEM-768 | kyber-py 1.2.0 | 2.836 ms | 3.775 ms | 5.145 ms |
126
- | ML-KEM-1024 | pykyber 3.1.0 | 0.080 ms | 0.083 ms | 0.099 ms |
127
- | ML-KEM-1024 | liboqs-python 0.16.0.2 | 0.020 ms | 0.022 ms | 0.023 ms |
128
- | ML-KEM-1024 | kyber-py 1.2.0 | 4.220 ms | 5.535 ms | 7.103 ms |
129
-
130
- Measured on 2026-12-04 on an Intel Core i7-7700 (Linux, Python 3.14.4) with pykyber 3.1.0, liboqs-python 0.16.0.2 on liboqs 0.16.0, and kyber-py 1.2.0. liboqs was built from source with the options liboqs-python picks, a release build with its x86_64-optimized ML-KEM code enabled; pykyber has no platform-specific code. One machine, one run. The numbers are in [results.json](performance-tests/results.json), and `performance-tests/benchmark.py` says how to repeat them.
123
+ | ML-KEM-512 | pykyber 3.2.0 | 0.030 ms | 0.036 ms | 0.045 ms |
124
+ | ML-KEM-512 | liboqs-python 0.16.0.2 | 0.011 ms | 0.013 ms | 0.012 ms |
125
+ | ML-KEM-512 | kyber-py 1.2.0 | 1.781 ms | 2.678 ms | 3.701 ms |
126
+ | ML-KEM-768 | pykyber 3.2.0 | 0.053 ms | 0.061 ms | 0.073 ms |
127
+ | ML-KEM-768 | liboqs-python 0.16.0.2 | 0.016 ms | 0.017 ms | 0.018 ms |
128
+ | ML-KEM-768 | kyber-py 1.2.0 | 2.992 ms | 4.000 ms | 5.407 ms |
129
+ | ML-KEM-1024 | pykyber 3.2.0 | 0.082 ms | 0.091 ms | 0.103 ms |
130
+ | ML-KEM-1024 | liboqs-python 0.16.0.2 | 0.021 ms | 0.023 ms | 0.024 ms |
131
+ | ML-KEM-1024 | kyber-py 1.2.0 | 4.504 ms | 5.682 ms | 7.452 ms |
132
+
133
+ Measured on 2026-12-05 on an Intel Core i7-7700 (Linux, Python 3.14.4) with pykyber 3.2.0, liboqs-python 0.16.0.2 on liboqs 0.16.0, and kyber-py 1.2.0. liboqs was built from source with the options liboqs-python picks, a release build with its x86_64-optimized ML-KEM code enabled; pykyber has no platform-specific code. One machine, one run. The numbers are in [results.json](performance-tests/results.json), and `performance-tests/benchmark.py` says how to repeat them.
131
134
 
132
135
  ## Testing and validation
133
136
 
@@ -12,7 +12,7 @@ Post-quantum key encapsulation for Python: ML-KEM (FIPS 203, the standard that c
12
12
  pip install pykyber
13
13
  ```
14
14
 
15
- Python 3.11 or newer. Prebuilt wheels cover Linux (glibc and musl), macOS, Windows and Android.
15
+ Python 3.11 or newer. Prebuilt wheels cover Linux (glibc and musl), macOS, Windows and Android. Free-threaded Python 3.14 (`python3.14t`) has its own wheels on Linux, macOS and Windows.
16
16
 
17
17
  ## Quick start
18
18
 
@@ -75,14 +75,17 @@ Time per call from Python on an Intel Core i7-7700 (Python 3.14, release build,
75
75
 
76
76
  | Class | Key generation | Encapsulation | Decapsulation |
77
77
  |-------|----------------|---------------|---------------|
78
- | `ML_KEM_512` | 0.031 ms | 0.037 ms | 0.047 ms |
79
- | `ML_KEM_768` | 0.051 ms | 0.058 ms | 0.072 ms |
80
- | `ML_KEM_1024` | 0.080 ms | 0.083 ms | 0.099 ms |
81
- | `ML_KEM_768_X25519` | 0.100 ms | 0.152 ms | 0.208 ms |
82
- | `ML_KEM_768_P256` | 0.261 ms | 0.479 ms | 0.537 ms |
83
- | `ML_KEM_1024_P384` | 0.788 ms | 1.527 ms | 1.599 ms |
84
-
85
- The ML-KEM rows are from the run of 2026-12-04 below. The three hybrid rows were measured the same way in earlier runs, `ML_KEM_768_X25519` on 2026-12-03 and the other two on 2026-12-04, and are not in the chart.
78
+ | `ML_KEM_512` | 0.030 ms | 0.036 ms | 0.045 ms |
79
+ | `ML_KEM_768` | 0.053 ms | 0.061 ms | 0.073 ms |
80
+ | `ML_KEM_1024` | 0.082 ms | 0.091 ms | 0.103 ms |
81
+ | `ML_KEM_768_X25519` | 0.098 ms | 0.154 ms | 0.212 ms |
82
+ | `ML_KEM_768_P256` | 0.268 ms | 0.490 ms | 0.553 ms |
83
+ | `ML_KEM_1024_P384` | 0.815 ms | 1.576 ms | 1.657 ms |
84
+ | `TLS_X25519_ML_KEM_768` | 0.102 ms | 0.154 ms | 0.118 ms |
85
+ | `TLS_P256_ML_KEM_768` | 0.269 ms | 0.501 ms | 0.292 ms |
86
+ | `TLS_P384_ML_KEM_1024` | 0.822 ms | 1.576 ms | 0.842 ms |
87
+
88
+ All nine rows are from the run of 2026-12-05 described below. The chart shows the three ML-KEM classes. In a TLS group the server's step (encapsulation) does two curve multiplications, one for its own key share and one for the shared secret, and the client's step (decapsulation) does one.
86
89
 
87
90
  ![ML-KEM time per operation](https://raw.githubusercontent.com/Zikithezikit/pykyber/main/performance-tests/latency.png)
88
91
 
@@ -92,17 +95,17 @@ The same script times ML-KEM in two other Python libraries, in the same process
92
95
 
93
96
  | Parameter set | Library | Key generation | Encapsulation | Decapsulation |
94
97
  |---------------|---------|----------------|---------------|---------------|
95
- | ML-KEM-512 | pykyber 3.1.0 | 0.031 ms | 0.037 ms | 0.047 ms |
96
- | ML-KEM-512 | liboqs-python 0.16.0.2 | 0.011 ms | 0.014 ms | 0.013 ms |
97
- | ML-KEM-512 | kyber-py 1.2.0 | 1.747 ms | 2.485 ms | 3.469 ms |
98
- | ML-KEM-768 | pykyber 3.1.0 | 0.051 ms | 0.058 ms | 0.072 ms |
99
- | ML-KEM-768 | liboqs-python 0.16.0.2 | 0.015 ms | 0.018 ms | 0.018 ms |
100
- | ML-KEM-768 | kyber-py 1.2.0 | 2.836 ms | 3.775 ms | 5.145 ms |
101
- | ML-KEM-1024 | pykyber 3.1.0 | 0.080 ms | 0.083 ms | 0.099 ms |
102
- | ML-KEM-1024 | liboqs-python 0.16.0.2 | 0.020 ms | 0.022 ms | 0.023 ms |
103
- | ML-KEM-1024 | kyber-py 1.2.0 | 4.220 ms | 5.535 ms | 7.103 ms |
104
-
105
- Measured on 2026-12-04 on an Intel Core i7-7700 (Linux, Python 3.14.4) with pykyber 3.1.0, liboqs-python 0.16.0.2 on liboqs 0.16.0, and kyber-py 1.2.0. liboqs was built from source with the options liboqs-python picks, a release build with its x86_64-optimized ML-KEM code enabled; pykyber has no platform-specific code. One machine, one run. The numbers are in [results.json](performance-tests/results.json), and `performance-tests/benchmark.py` says how to repeat them.
98
+ | ML-KEM-512 | pykyber 3.2.0 | 0.030 ms | 0.036 ms | 0.045 ms |
99
+ | ML-KEM-512 | liboqs-python 0.16.0.2 | 0.011 ms | 0.013 ms | 0.012 ms |
100
+ | ML-KEM-512 | kyber-py 1.2.0 | 1.781 ms | 2.678 ms | 3.701 ms |
101
+ | ML-KEM-768 | pykyber 3.2.0 | 0.053 ms | 0.061 ms | 0.073 ms |
102
+ | ML-KEM-768 | liboqs-python 0.16.0.2 | 0.016 ms | 0.017 ms | 0.018 ms |
103
+ | ML-KEM-768 | kyber-py 1.2.0 | 2.992 ms | 4.000 ms | 5.407 ms |
104
+ | ML-KEM-1024 | pykyber 3.2.0 | 0.082 ms | 0.091 ms | 0.103 ms |
105
+ | ML-KEM-1024 | liboqs-python 0.16.0.2 | 0.021 ms | 0.023 ms | 0.024 ms |
106
+ | ML-KEM-1024 | kyber-py 1.2.0 | 4.504 ms | 5.682 ms | 7.452 ms |
107
+
108
+ Measured on 2026-12-05 on an Intel Core i7-7700 (Linux, Python 3.14.4) with pykyber 3.2.0, liboqs-python 0.16.0.2 on liboqs 0.16.0, and kyber-py 1.2.0. liboqs was built from source with the options liboqs-python picks, a release build with its x86_64-optimized ML-KEM code enabled; pykyber has no platform-specific code. One machine, one run. The numbers are in [results.json](performance-tests/results.json), and `performance-tests/benchmark.py` says how to repeat them.
106
109
 
107
110
  ## Testing and validation
108
111
 
@@ -164,6 +164,23 @@ secret key is wiped if the second draw fails. Checked by Rust tests with a
164
164
  generator that fails, and end to end with `strace -e inject=getrandom:error=EIO`
165
165
  (all six Python entry points raised `RandomnessError`, no panic). Status: FIXED.
166
166
 
167
+ Update for #101 (2026-12-05). With `rand` 0.10 the generator is `SysRng`, which
168
+ is `getrandom` 0.4.3. On Linux it calls the C library's `getrandom()`, found
169
+ with `dlsym`, where 0.2.17 made the system call itself. On the machine used
170
+ here (glibc 2.43, Linux 7.0) that call makes no system call, so the `strace`
171
+ injection above no longer reaches pykyber: `strace -c` counted three
172
+ `getrandom` calls for twelve key generations, all from Python's start-up. The
173
+ check was repeated with an `LD_PRELOAD` library that makes `getrandom()` fail
174
+ with EIO once the keys exist. Key generation and encapsulation in all twelve
175
+ classes, and `from_keys` in the six that draw randomness, raised
176
+ `RandomnessError`. With ENOSYS or EPERM the calls succeeded: `getrandom` then
177
+ reads `/dev/urandom` after waiting for `/dev/random` to become readable, as
178
+ 0.2.17 did. It does the same when the C library has no `getrandom()` (glibc
179
+ older than 2.25), where 0.2.17 still made the system call. That is the same
180
+ kernel generator, not a weaker source. Not checked: a failure on the
181
+ `/dev/urandom` path, and the macOS (`getentropy`) and Windows (`ProcessPrng`)
182
+ code, which was read but not run.
183
+
167
184
  ## 10. Decapsulation intermediates (SEC-004, Low, fixed)
168
185
 
169
186
  `m'`, the KDF input and the re-encrypted ciphertext were wiped only on the
@@ -392,7 +409,8 @@ pairs, with |t| between 24 and 27 at the 80th percentile crop.
392
409
  This shows no difference between accepted and rejected ciphertexts of the
393
410
  size stated, on one machine. It says nothing about smaller differences, other
394
411
  CPUs, or power and electromagnetic leakage. The script is a small adaptation
395
- of the one written for issue #16 and is not in the repository. Its delay
412
+ of the one written for issue #16; both are in `scripts/security/`
413
+ (`timing_xwing.py`, `timing_decaps.py`) since #114. Its delay
396
414
  injection counted from the start of the call, which adds nothing to a call
397
415
  longer than the delay; the control above was run with that corrected.
398
416
 
@@ -599,8 +617,9 @@ These runs show no difference of the stated size on one machine. They say
599
617
  nothing about smaller differences, other CPUs, or power and electromagnetic
600
618
  leakage. The multiplication program is not the library: it uses the same
601
619
  crate versions and optimization level, and the compiler may still have
602
- generated different code for it. The scripts and the program are not in the
603
- repository.
620
+ generated different code for it. The decapsulation script is
621
+ `scripts/security/timing_nist.py` (since #114). The multiplication program is
622
+ not in the repository.
604
623
 
605
624
  Malformed inputs. The eight private functions were called from Python
606
625
  against a debug build, where integer overflow and debug assertions (the
@@ -796,3 +815,49 @@ a seed.
796
815
  Not checked: the branches of key generation and encapsulation (counted
797
816
  only); the aarch64 branches of `decaps` beyond their number; timing on
798
817
  another CPU; a TLS handshake, or an exchange with BoringSSL, Go or rustls.
818
+
819
+ # 3.3 checks
820
+
821
+ ## 23. Keccak rewrite, the Python boundary and SampleNTT (no findings)
822
+
823
+ Keccak (#125). `keccakf1600_statepermute` is now written from the FIPS 202
824
+ step mappings instead of the unrolled rounds of the reference C. The output
825
+ is unchanged (hashlib comparison, ACVP, CCTV, Wycheproof, legacy golden
826
+ vectors). Both versions were built in release mode with rustc 1.100.1 for
827
+ x86_64 on 2026-12-06 and counted the same way:
828
+
829
+ | | Before (`298fd8a`) | After (`1968fca`) |
830
+ |---|---|---|
831
+ | Instructions | 744 | 379 |
832
+ | Conditional jumps | 26: 25 bounds checks and the round loop | 1: the round loop |
833
+ | Stack frame | 248 bytes | 424 bytes, 192 of them a copy of the 24 public round constants |
834
+ | Register stores to the stack | 71 | 54 |
835
+
836
+ So the temporaries that item 15 is about are still there, somewhat fewer
837
+ than before. The item 15 figures were made with rustc 1.95.0 and do not
838
+ match either column, which that item already says about its own numbers.
839
+ Its status does not change.
840
+
841
+ The Python boundary (#132). Every PR now runs
842
+ `python/tests/test_wrong_lengths.py`, which calls each of the 48 functions of
843
+ the compiled module with every combination of 56 argument lengths around the
844
+ declared sizes (70 293 calls) and fails on anything that is not an
845
+ `Exception`, which is how a Rust panic would arrive. clippy denies `unwrap`,
846
+ `expect`, `panic!` and `unreachable!` in library code, and the crate forbids
847
+ `unsafe`. That is a regression guard, not fuzzing: the inputs are lengths,
848
+ not contents.
849
+
850
+ SampleNTT (#126, #133). The rejection loop of FIPS 203 Algorithm 7 has no
851
+ iteration limit, as Appendix B recommends ("Implementations should not
852
+ bound this loop, if at all possible"). `rho` comes from the encapsulation
853
+ key, so the peer chooses it, but it cannot steer the SHAKE128 output: more
854
+ than 280 iterations has probability 2^-261 (Table 4). Not a finding;
855
+ recorded so the unbounded loop is not reported as one.
856
+
857
+ Threads (#111). The ML-KEM, hybrid and TLS calls release the GIL. The
858
+ arguments are immutable `bytes` borrowed for the call, and the secret
859
+ buffers and their wipes are unchanged. The timing runs of items 17, 19 and
860
+ 22 were made with the GIL held and were not repeated.
861
+
862
+ Not checked: aarch64 and the other wheel targets for the Keccak counts; the
863
+ timing of anything in this release.
@@ -0,0 +1,6 @@
1
+ # Settings for the lints that src/lib.rs turns on.
2
+ too-many-lines-threshold = 60
3
+ allow-unwrap-in-tests = true
4
+ allow-expect-in-tests = true
5
+ allow-panic-in-tests = true
6
+ allow-dbg-in-tests = true
@@ -57,7 +57,7 @@ keypair = pykyber.ML_KEM_768.from_keys(pk, sk)
57
57
 
58
58
  ### `MlKemKeypair`
59
59
 
60
- Returned by `ML_KEM_*()` instantiation and `from_keys()`.
60
+ Returned by `ML_KEM_*()` instantiation and `from_keys()`. For annotations it can be imported from `pykyber`, like `MlKemEncapsulationResult` and the hybrid and TLS types (`HybridKeypair`, `HybridEncapsulationResult`, `TlsKeypair`, `TlsEncapsulationResult`).
61
61
 
62
62
  #### Properties
63
63
 
@@ -219,6 +219,12 @@ Key exchanges with OpenSSL 3.5.5's implementation of the three groups agree in b
219
219
 
220
220
  ---
221
221
 
222
+ ## Version
223
+
224
+ `pykyber.__version__` is the version of the installed package as a string, for example `"3.2.0"`. It is compiled into the extension.
225
+
226
+ ---
227
+
222
228
  ## Exceptions
223
229
 
224
230
  ### `KyberError`
@@ -250,6 +256,12 @@ Subclass of `DeprecationWarning`, emitted once per process on the first use of a
250
256
 
251
257
  ---
252
258
 
259
+ ## Threads
260
+
261
+ The ML-KEM, hybrid and TLS classes can be used from several threads at once. Their methods release the GIL while the key generation, encapsulation or decapsulation runs, so calls in different threads run in parallel on separate cores. No method changes the object it is called on, so one key pair can be shared by any number of threads. The deprecated Kyber classes are safe to use from threads too, but hold the GIL for the whole call.
262
+
263
+ ---
264
+
253
265
  ## Kyber (deprecated)
254
266
 
255
267
  `Kyber512`, `Kyber768` and `Kyber1024` implement round-3 CRYSTALS-Kyber, not ML-KEM. They are deprecated in favor of `ML_KEM_512`, `ML_KEM_768` and `ML_KEM_1024`, and are kept so that existing code and data keep working: their output is byte-identical to pykyber 1.0.5. Nothing has been removed or renamed.
@@ -15,11 +15,11 @@ MIT OR Apache-2.0, at your option ([LICENSE-MIT](../LICENSE-MIT), [LICENSE-APACH
15
15
 
16
16
  ## Platforms
17
17
 
18
- Python 3.11 or newer (one abi3 wheel per platform; on Android one wheel per Python version, 3.11 to 3.15). CI builds wheels for Linux (glibc and musl; x86_64, x86, aarch64, armv7, s390x, ppc64le), macOS (Intel and Apple silicon), Windows (x64, x86, arm64) and Android, plus an sdist. Tests run on Linux, macOS and Windows. On Android an extension module has to be linked against the `libpython` of one Python version, so from 3.0 each Android wheel is tagged for that version and CI checks the link; the x86_64 wheels for 3.14 and 3.15 are also imported in an emulator. The 2.x Android wheels claim every Python from 3.8 but need `libpython3.9.so` ([#54](https://github.com/Zikithezikit/pykyber/issues/54)).
18
+ Python 3.11 or newer (one abi3 wheel per platform; on Android one wheel per Python version, 3.11 to 3.15). Free-threaded Python cannot load abi3 wheels, so 3.14t has a wheel of its own on Linux, macOS and Windows, and the test suite runs on it in CI. There is none for 3.13t, which PyO3 no longer supports. CI builds wheels for Linux (glibc and musl; x86_64, x86, aarch64, armv7, s390x, ppc64le), macOS (Intel and Apple silicon), Windows (x64, x86, arm64) and Android, plus an sdist. Tests run on Linux, macOS and Windows. On Android an extension module has to be linked against the `libpython` of one Python version, so from 3.0 each Android wheel is tagged for that version and CI checks the link; the x86_64 wheels for 3.14 and 3.15 are also imported in an emulator. The 2.x Android wheels claim every Python from 3.8 but need `libpython3.9.so` ([#54](https://github.com/Zikithezikit/pykyber/issues/54)).
19
19
 
20
20
  ## Supply chain
21
21
 
22
- - Release wheels are built in GitHub Actions and carry a build-provenance attestation (`actions/attest-build-provenance`). Verify a downloaded file with `gh attestation verify <wheel> --repo Zikithezikit/pykyber`.
22
+ - Release wheels are built in GitHub Actions and carry a build-provenance attestation (`actions/attest-build-provenance`). The workflow names every action it uses by commit, not by a tag that can move. Verify a downloaded file with `gh attestation verify <wheel> --repo Zikithezikit/pykyber`.
23
23
  - Pin the version and, if you can, the hash: `pip install --require-hashes -r requirements.txt` with `pykyber==<version> --hash=sha256:...`.
24
24
  - Building from the sdist needs a stable Rust toolchain (1.87 or newer) and `maturin`.
25
25