Commit 9025578
Add MLKEM1024-P384 hybrid KEM support in HPKE (pyca#14722)
* Add MLKEM1024-P384 hybrid KEM support in HPKE
Implements the MLKEM1024-P384 hybrid KEM (KEM ID 0x0051) as specified in
draft-ietf-hpke-pq. This combines ML-KEM-1024 with ECDH over NIST P-384,
using the QSF-style SHA3-256 combiner:
ss = SHA3-256(ss_PQ || ss_T || ct_T || ek_T || "MLKEM1024-P384")
Exposes MLKEM1024P384PrivateKey / MLKEM1024P384PublicKey, which accept
an MLKEM1024Private/PublicKey plus a SECP384R1 EllipticCurvePrivate/
PublicKey, and wires them through the new KEM.MLKEM1024_P384 variant.
Validated end-to-end against the draft-ietf-hpke-pq test vectors via
test_vector_decryption.
https://claude.ai/code/session_01WMt6uNpXMN2skhuiEtEMx7
* Address review comments on pyca#14722
- Consolidate mlkem768_x25519_combine and mlkem1024_p384_combine into a
single hybrid_kem_combine helper that takes the label as an argument.
Both KEMs use the same QSF-style SHA3-256 combiner structure
(ss_PQ || ss_T || ct_T || ek_T || Label), so the duplication wasn't
pulling its weight.
- Move MLKEM1024P384Private/PublicKey assignments under the
MLKEM768X25519 ones in cryptography/hazmat/primitives/hpke.py to match
the ordering of __all__.
https://claude.ai/code/session_01WMt6uNpXMN2skhuiEtEMx7
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent ef66de4 commit 9025578
5 files changed
Lines changed: 540 additions & 41 deletions
File tree
- docs/hazmat/primitives
- src
- cryptography/hazmat
- bindings/_rust/openssl
- primitives
- rust/src/backend
- tests/hazmat/primitives
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
| |||
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
151 | 196 | | |
152 | 197 | | |
153 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
| |||
50 | 66 | | |
51 | 67 | | |
52 | 68 | | |
53 | | - | |
| 69 | + | |
| 70 | + | |
54 | 71 | | |
55 | 72 | | |
56 | 73 | | |
| |||
60 | 77 | | |
61 | 78 | | |
62 | 79 | | |
63 | | - | |
| 80 | + | |
| 81 | + | |
64 | 82 | | |
65 | 83 | | |
66 | 84 | | |
| |||
71 | 89 | | |
72 | 90 | | |
73 | 91 | | |
74 | | - | |
| 92 | + | |
| 93 | + | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
| |||
82 | 101 | | |
83 | 102 | | |
84 | 103 | | |
85 | | - | |
| 104 | + | |
| 105 | + | |
86 | 106 | | |
87 | 107 | | |
88 | 108 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
0 commit comments