pq_crypto 0.3.2 → 0.4.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +56 -0
- data/CHANGELOG.md +37 -0
- data/GET_STARTED.md +361 -40
- data/README.md +58 -241
- data/SECURITY.md +101 -82
- data/ext/pqcrypto/extconf.rb +40 -7
- data/ext/pqcrypto/mldsa_api.h +71 -1
- data/ext/pqcrypto/mlkem_api.h +24 -0
- data/ext/pqcrypto/pq_externalmu.c +14 -1
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +484 -81
- data/ext/pqcrypto/pqcrypto_secure.c +179 -72
- data/ext/pqcrypto/pqcrypto_secure.h +87 -7
- data/ext/pqcrypto/pqcrypto_version.h +7 -0
- data/ext/pqcrypto/vendor/.vendored +1 -1
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/LICENSE +5 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile +19 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile.Microsoft_nmake +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/api.h +18 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.c +83 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.h +11 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.c +327 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.h +22 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.c +164 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.h +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.c +146 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.h +14 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/params.h +36 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.c +311 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.h +37 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.c +198 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.h +26 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.c +41 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.h +13 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric-shake.c +71 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric.h +30 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.c +67 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.h +13 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/LICENSE +5 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile +19 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile.Microsoft_nmake +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/api.h +18 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.c +108 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.h +11 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.c +327 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.h +22 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.c +164 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.h +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.c +146 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.h +14 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/params.h +36 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.c +299 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.h +37 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.c +188 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.h +26 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.c +41 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.h +13 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric-shake.c +71 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric.h +30 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.c +67 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.h +13 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/LICENSE +5 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile +19 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile.Microsoft_nmake +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/api.h +50 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.c +98 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.h +10 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.c +261 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.h +31 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/params.h +44 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.c +848 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.h +52 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.c +415 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.h +65 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.c +69 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.h +17 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.c +98 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.h +14 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.c +407 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.h +47 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric-shake.c +26 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric.h +34 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/LICENSE +5 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile +19 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile.Microsoft_nmake +23 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/api.h +50 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.c +98 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.h +10 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.c +261 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.h +31 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/params.h +44 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.c +823 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.h +52 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.c +415 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.h +65 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.c +69 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.h +17 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.c +92 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.h +14 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.c +407 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.h +47 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric-shake.c +26 -0
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric.h +34 -0
- data/lib/pq_crypto/algorithm_registry.rb +200 -0
- data/lib/pq_crypto/hybrid_kem.rb +1 -12
- data/lib/pq_crypto/kem.rb +104 -13
- data/lib/pq_crypto/pkcs8.rb +387 -0
- data/lib/pq_crypto/serialization.rb +1 -14
- data/lib/pq_crypto/signature.rb +123 -17
- data/lib/pq_crypto/spki.rb +131 -0
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +78 -19
- data/script/vendor_libs.rb +4 -0
- metadata +95 -3
data/ext/pqcrypto/mldsa_api.h
CHANGED
|
@@ -5,46 +5,116 @@
|
|
|
5
5
|
#include <stddef.h>
|
|
6
6
|
#include <stdint.h>
|
|
7
7
|
|
|
8
|
+
#define PQCLEAN_MLDSA44_CLEAN_CRYPTO_PUBLICKEYBYTES 1312
|
|
9
|
+
#define PQCLEAN_MLDSA44_CLEAN_CRYPTO_SECRETKEYBYTES 2560
|
|
10
|
+
#define PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES 2420
|
|
11
|
+
#define PQCLEAN_MLDSA44_CLEAN_CRYPTO_ALGNAME "ML-DSA-44"
|
|
12
|
+
|
|
13
|
+
#define PQCLEAN_MLDSA65_CLEAN_CRYPTO_PUBLICKEYBYTES 1952
|
|
14
|
+
#define PQCLEAN_MLDSA65_CLEAN_CRYPTO_SECRETKEYBYTES 4032
|
|
15
|
+
#define PQCLEAN_MLDSA65_CLEAN_CRYPTO_BYTES 3309
|
|
8
16
|
#define PQCLEAN_MLDSA65_CLEAN_CRYPTO_ALGNAME "ML-DSA-65"
|
|
9
17
|
|
|
18
|
+
#define PQCLEAN_MLDSA87_CLEAN_CRYPTO_PUBLICKEYBYTES 2592
|
|
19
|
+
#define PQCLEAN_MLDSA87_CLEAN_CRYPTO_SECRETKEYBYTES 4896
|
|
20
|
+
#define PQCLEAN_MLDSA87_CLEAN_CRYPTO_BYTES 4627
|
|
21
|
+
#define PQCLEAN_MLDSA87_CLEAN_CRYPTO_ALGNAME "ML-DSA-87"
|
|
22
|
+
|
|
23
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_keypair(uint8_t *pk, uint8_t *sk);
|
|
10
24
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_keypair(uint8_t *pk, uint8_t *sk);
|
|
25
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_keypair(uint8_t *pk, uint8_t *sk);
|
|
11
26
|
|
|
27
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_signature_ctx(uint8_t *sig, size_t *siglen,
|
|
28
|
+
const uint8_t *m, size_t mlen,
|
|
29
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
30
|
+
const uint8_t *sk);
|
|
12
31
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_signature_ctx(uint8_t *sig, size_t *siglen,
|
|
13
32
|
const uint8_t *m, size_t mlen,
|
|
14
33
|
const uint8_t *ctx, size_t ctxlen,
|
|
15
34
|
const uint8_t *sk);
|
|
35
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_signature_ctx(uint8_t *sig, size_t *siglen,
|
|
36
|
+
const uint8_t *m, size_t mlen,
|
|
37
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
38
|
+
const uint8_t *sk);
|
|
16
39
|
|
|
40
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_ctx(uint8_t *sm, size_t *smlen,
|
|
41
|
+
const uint8_t *m, size_t mlen,
|
|
42
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
43
|
+
const uint8_t *sk);
|
|
17
44
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_ctx(uint8_t *sm, size_t *smlen,
|
|
18
45
|
const uint8_t *m, size_t mlen,
|
|
19
46
|
const uint8_t *ctx, size_t ctxlen,
|
|
20
47
|
const uint8_t *sk);
|
|
48
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_ctx(uint8_t *sm, size_t *smlen,
|
|
49
|
+
const uint8_t *m, size_t mlen,
|
|
50
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
51
|
+
const uint8_t *sk);
|
|
21
52
|
|
|
53
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_verify_ctx(const uint8_t *sig, size_t siglen,
|
|
54
|
+
const uint8_t *m, size_t mlen,
|
|
55
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
56
|
+
const uint8_t *pk);
|
|
22
57
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_verify_ctx(const uint8_t *sig, size_t siglen,
|
|
23
58
|
const uint8_t *m, size_t mlen,
|
|
24
59
|
const uint8_t *ctx, size_t ctxlen,
|
|
25
60
|
const uint8_t *pk);
|
|
61
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_verify_ctx(const uint8_t *sig, size_t siglen,
|
|
62
|
+
const uint8_t *m, size_t mlen,
|
|
63
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
64
|
+
const uint8_t *pk);
|
|
26
65
|
|
|
66
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_open_ctx(uint8_t *m, size_t *mlen,
|
|
67
|
+
const uint8_t *sm, size_t smlen,
|
|
68
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
69
|
+
const uint8_t *pk);
|
|
27
70
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_open_ctx(uint8_t *m, size_t *mlen,
|
|
28
71
|
const uint8_t *sm, size_t smlen,
|
|
29
72
|
const uint8_t *ctx, size_t ctxlen,
|
|
30
73
|
const uint8_t *pk);
|
|
74
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_open_ctx(uint8_t *m, size_t *mlen,
|
|
75
|
+
const uint8_t *sm, size_t smlen,
|
|
76
|
+
const uint8_t *ctx, size_t ctxlen,
|
|
77
|
+
const uint8_t *pk);
|
|
31
78
|
|
|
79
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_signature(uint8_t *sig, size_t *siglen,
|
|
80
|
+
const uint8_t *m, size_t mlen,
|
|
81
|
+
const uint8_t *sk);
|
|
32
82
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_signature(uint8_t *sig, size_t *siglen,
|
|
33
83
|
const uint8_t *m, size_t mlen,
|
|
34
84
|
const uint8_t *sk);
|
|
85
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_signature(uint8_t *sig, size_t *siglen,
|
|
86
|
+
const uint8_t *m, size_t mlen,
|
|
87
|
+
const uint8_t *sk);
|
|
35
88
|
|
|
89
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign(uint8_t *sm, size_t *smlen,
|
|
90
|
+
const uint8_t *m, size_t mlen,
|
|
91
|
+
const uint8_t *sk);
|
|
36
92
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign(uint8_t *sm, size_t *smlen,
|
|
37
93
|
const uint8_t *m, size_t mlen,
|
|
38
94
|
const uint8_t *sk);
|
|
95
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign(uint8_t *sm, size_t *smlen,
|
|
96
|
+
const uint8_t *m, size_t mlen,
|
|
97
|
+
const uint8_t *sk);
|
|
39
98
|
|
|
99
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_verify(const uint8_t *sig, size_t siglen,
|
|
100
|
+
const uint8_t *m, size_t mlen,
|
|
101
|
+
const uint8_t *pk);
|
|
40
102
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_verify(const uint8_t *sig, size_t siglen,
|
|
41
103
|
const uint8_t *m, size_t mlen,
|
|
42
104
|
const uint8_t *pk);
|
|
105
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_verify(const uint8_t *sig, size_t siglen,
|
|
106
|
+
const uint8_t *m, size_t mlen,
|
|
107
|
+
const uint8_t *pk);
|
|
43
108
|
|
|
109
|
+
int PQCLEAN_MLDSA44_CLEAN_crypto_sign_open(uint8_t *m, size_t *mlen,
|
|
110
|
+
const uint8_t *sm, size_t smlen,
|
|
111
|
+
const uint8_t *pk);
|
|
44
112
|
int PQCLEAN_MLDSA65_CLEAN_crypto_sign_open(uint8_t *m, size_t *mlen,
|
|
45
113
|
const uint8_t *sm, size_t smlen,
|
|
46
114
|
const uint8_t *pk);
|
|
47
|
-
|
|
115
|
+
int PQCLEAN_MLDSA87_CLEAN_crypto_sign_open(uint8_t *m, size_t *mlen,
|
|
116
|
+
const uint8_t *sm, size_t smlen,
|
|
117
|
+
const uint8_t *pk);
|
|
48
118
|
|
|
49
119
|
#endif
|
|
50
120
|
|
data/ext/pqcrypto/mlkem_api.h
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
#ifdef HAVE_PQCLEAN
|
|
5
5
|
#include <stdint.h>
|
|
6
6
|
|
|
7
|
+
#define PQCLEAN_MLKEM512_CLEAN_CRYPTO_SECRETKEYBYTES 1632
|
|
8
|
+
#define PQCLEAN_MLKEM512_CLEAN_CRYPTO_PUBLICKEYBYTES 800
|
|
9
|
+
#define PQCLEAN_MLKEM512_CLEAN_CRYPTO_CIPHERTEXTBYTES 768
|
|
10
|
+
#define PQCLEAN_MLKEM512_CLEAN_CRYPTO_BYTES 32
|
|
11
|
+
#define PQCLEAN_MLKEM512_CLEAN_CRYPTO_ALGNAME "ML-KEM-512"
|
|
12
|
+
|
|
13
|
+
int PQCLEAN_MLKEM512_CLEAN_crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
|
14
|
+
int PQCLEAN_MLKEM512_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
|
|
15
|
+
int PQCLEAN_MLKEM512_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
|
|
16
|
+
int PQCLEAN_MLKEM512_CLEAN_crypto_kem_keypair_derand(uint8_t *pk, uint8_t *sk, const uint8_t *coins);
|
|
17
|
+
int PQCLEAN_MLKEM512_CLEAN_crypto_kem_enc_derand(uint8_t *ct, uint8_t *ss, const uint8_t *pk, const uint8_t *coins);
|
|
18
|
+
|
|
7
19
|
#define PQCLEAN_MLKEM768_CLEAN_CRYPTO_SECRETKEYBYTES 2400
|
|
8
20
|
#define PQCLEAN_MLKEM768_CLEAN_CRYPTO_PUBLICKEYBYTES 1184
|
|
9
21
|
#define PQCLEAN_MLKEM768_CLEAN_CRYPTO_CIPHERTEXTBYTES 1088
|
|
@@ -16,6 +28,18 @@ int PQCLEAN_MLKEM768_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const
|
|
|
16
28
|
int PQCLEAN_MLKEM768_CLEAN_crypto_kem_keypair_derand(uint8_t *pk, uint8_t *sk, const uint8_t *coins);
|
|
17
29
|
int PQCLEAN_MLKEM768_CLEAN_crypto_kem_enc_derand(uint8_t *ct, uint8_t *ss, const uint8_t *pk, const uint8_t *coins);
|
|
18
30
|
|
|
31
|
+
#define PQCLEAN_MLKEM1024_CLEAN_CRYPTO_SECRETKEYBYTES 3168
|
|
32
|
+
#define PQCLEAN_MLKEM1024_CLEAN_CRYPTO_PUBLICKEYBYTES 1568
|
|
33
|
+
#define PQCLEAN_MLKEM1024_CLEAN_CRYPTO_CIPHERTEXTBYTES 1568
|
|
34
|
+
#define PQCLEAN_MLKEM1024_CLEAN_CRYPTO_BYTES 32
|
|
35
|
+
#define PQCLEAN_MLKEM1024_CLEAN_CRYPTO_ALGNAME "ML-KEM-1024"
|
|
36
|
+
|
|
37
|
+
int PQCLEAN_MLKEM1024_CLEAN_crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
|
38
|
+
int PQCLEAN_MLKEM1024_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
|
|
39
|
+
int PQCLEAN_MLKEM1024_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
|
|
40
|
+
int PQCLEAN_MLKEM1024_CLEAN_crypto_kem_keypair_derand(uint8_t *pk, uint8_t *sk, const uint8_t *coins);
|
|
41
|
+
int PQCLEAN_MLKEM1024_CLEAN_crypto_kem_enc_derand(uint8_t *ct, uint8_t *ss, const uint8_t *pk, const uint8_t *coins);
|
|
42
|
+
|
|
19
43
|
#endif
|
|
20
44
|
|
|
21
45
|
#endif
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#include "pqcrypto_secure.h"
|
|
2
2
|
|
|
3
|
+
#undef PQCLEAN_MLDSA65_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
4
|
+
#undef PQCLEAN_MLDSA65_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
5
|
+
#undef PQCLEAN_MLDSA65_CLEAN_CRYPTO_BYTES
|
|
6
|
+
|
|
3
7
|
#include <stdint.h>
|
|
4
8
|
#include <stddef.h>
|
|
5
9
|
#include <string.h>
|
|
@@ -74,7 +78,16 @@ int pq_sign_mu(uint8_t *signature, size_t *signature_len, const uint8_t *mu,
|
|
|
74
78
|
|
|
75
79
|
memcpy(mu_local, mu, CRHBYTES);
|
|
76
80
|
|
|
77
|
-
randombytes(rnd, RNDBYTES)
|
|
81
|
+
if (randombytes(rnd, RNDBYTES) != 0) {
|
|
82
|
+
pq_secure_wipe(rho, sizeof(rho));
|
|
83
|
+
pq_secure_wipe(key, sizeof(key));
|
|
84
|
+
pq_secure_wipe(rnd, sizeof(rnd));
|
|
85
|
+
pq_secure_wipe(mu_local, sizeof(mu_local));
|
|
86
|
+
pq_secure_wipe(&s1, sizeof(s1));
|
|
87
|
+
pq_secure_wipe(&s2, sizeof(s2));
|
|
88
|
+
pq_secure_wipe(&t0, sizeof(t0));
|
|
89
|
+
return PQ_ERROR_RANDOM;
|
|
90
|
+
}
|
|
78
91
|
|
|
79
92
|
{
|
|
80
93
|
uint8_t kr[SEEDBYTES + RNDBYTES + CRHBYTES];
|