Skip to content

Commit 16c1411

Browse files
feature revamp and implementing the last hash feature todo
1 parent 051219e commit 16c1411

File tree

24 files changed

+319
-216
lines changed

24 files changed

+319
-216
lines changed

Cargo.lock

Lines changed: 7 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 123 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,33 @@ resolver = "2"
1818
# Ensure all dependencies + feats are mapped to crate features for correct usage
1919
# default features often have std breaking no_std and potentially other unwanted
2020
[dependencies]
21-
aes = { version = "0.8.4", default-features = false, optional = true }
21+
# Cryptographic dependencies
2222
aead = { version = "0.5.2", default-features = false, optional = true }
23+
aes = { version = "0.8.4", default-features = false, optional = true }
2324
aes-gcm = { version = "0.10.3", default-features = false, optional = true }
24-
ccm = { version = "0.5.0", optional = true, default-features = false }
25+
ccm = { version = "0.5.0", default-features = false, optional = true }
2526
chacha20poly1305 = { version = "0.10.1", default-features = false, optional = true }
2627
crypto-common = { version = "0.1.6", default-features = false }
2728
der = { version = "0.7.9", default-features = false, optional = true }
2829
digest = { version = "0.10.7", default-features = false }
2930
ecdsa = { version = "0.16.9", default-features = false, optional = true }
3031
ed25519-dalek = { version = "2", default-features = false, optional = true }
32+
elliptic-curve = { version = "0.13.8", default-features = false, optional = true }
3133
hmac = { version = "0.12.1", default-features = false }
3234
p256 = { version = "0.13.2", default-features = false, optional = true }
3335
p384 = { version = "0.13.0", default-features = false, optional = true }
3436
p521 = { version = "0.13.3", default-features = false, optional = true }
3537
pkcs1 = { version = "0.7.5", default-features = false, optional = true }
36-
pkcs8 = { version = "0.10.2", default-features = false, features = [
37-
"pkcs5",
38-
], optional = true }
39-
rsa = { version = "0.9.7", default-features = false, features = [
40-
"sha2",
41-
], optional = true }
38+
pkcs8 = { version = "0.10.2", default-features = false, optional = true }
39+
rsa = { version = "0.9.7", default-features = false, optional = true }
4240
sec1 = { version = "0.7.3", default-features = false, optional = true }
4341
sha2 = { version = "0.10.8", default-features = false }
4442
signature = { version = "2.2.0", default-features = false, optional = true }
43+
typenum = { version = "1.17.0", features = ["no_std", "const-generics"] }
4544
x25519-dalek = { version = "2", default-features = false, optional = true }
4645

47-
getrandom = { version = "0.2", default-features = false, features = [
48-
"custom"
49-
] }
46+
# External groups
47+
getrandom = { version = "0.2", default-features = false, features = ["custom"] }
5048
paste = { version = "1.0.15", default-features = false }
5149
pki-types = { package = "rustls-pki-types", version = "1.10.0", default-features = false }
5250
rand_core = { version = "0.6.4", default-features = false, features = [
@@ -56,32 +54,27 @@ rustls = { version = "0.23.19", default-features = false }
5654
webpki = { package = "rustls-webpki", version = "0.102.8", default-features = false, optional = true }
5755

5856
[target.'cfg(target_arch = "wasm32")'.dependencies]
59-
getrandom = { version = "0.2", features = [
60-
"js"
61-
] }
57+
getrandom = { version = "0.2", features = ["wasm-bindgen"] }
6258

6359
[dev-dependencies]
6460
bytes = { version = "1.9.0", default-features = false }
65-
itertools = "0.13.0"
66-
rsa = { version = "0.9.7", default-features = false, features = [
67-
"sha2",
68-
] }
61+
itertools = { version = "0.13.0", default-features = false }
62+
rsa = { version = "0.9.7", default-features = false, features = ["sha2"] }
6963
rustls = { version = "0.23.19", default-features = false, features = ["std"] }
70-
sha2 = { version = "0.10.8", default-features = false, features = ["oid"] }
71-
spki = { version = "0.7.3", features = ["alloc"] }
64+
sha2 = { version = "0.10.8", default-features = false }
65+
spki = { version = "0.7.3", default-features = false, features = ["alloc"] }
7266
x509-cert = { version = "0.2.5", default-features = false, features = [
7367
"builder",
74-
"pem"
7568
] }
7669

7770
[features]
78-
default = ["std", "tls12", "zeroize", "full"]
71+
default = ["std", "tls12", "zeroize", "full", "fast"]
7972
full = [
8073
"aead-full",
81-
"ecdsa-full",
82-
"eddsa-full",
74+
"sign-full",
75+
"verify-full",
8376
"kx-full",
84-
"rsa-full",
77+
"hash-full",
8578
"format",
8679
]
8780
format = ["pem", "pkcs1", "pkcs8", "sec1"]
@@ -90,69 +83,143 @@ tls12 = ["rustls/tls12"]
9083

9184
# RustCrypto is preparing to migrate to core::error::Error
9285
# and in before most of the use case for std is just std::error::Error
93-
std = ["alloc"]
94-
alloc = ["ecdsa?/alloc", "signature?/alloc"]
86+
std = ["alloc", "rustls/std"]
87+
alloc = [
88+
"ecdsa?/alloc",
89+
"elliptic-curve?/alloc",
90+
"pkcs8?/alloc",
91+
"sec1?/alloc",
92+
"signature?/alloc",
93+
]
94+
zeroize = [
95+
"aes-gcm?/zeroize",
96+
"aes?/zeroize",
97+
"der?/zeroize",
98+
"ed25519-dalek?/zeroize",
99+
"pkcs1?/zeroize",
100+
"sec1?/zeroize",
101+
"x25519-dalek?/zeroize",
102+
]
103+
subtle = ["digest/subtle", "pkcs8?/subtle", "sec1?/subtle"]
104+
fast = [
105+
"ed25519-dalek?/fast",
106+
"rsa?/u64_digit",
107+
"x25519-dalek?/precomputed-tables",
108+
]
95109

96110
nist = []
97111
p256 = ["dep:p256", "nist"]
98112
p384 = ["dep:p384", "nist"]
99113
p521 = ["dep:p521", "nist"]
100114
ed25519 = ["dep:ed25519-dalek"]
101115

102-
verify = ["dep:webpki"]
103-
104-
ecdsa = ["dep:ecdsa", "verify", "signature", "rand", "der"]
105-
ecdsa-p256 = ["p256", "p256/ecdsa", "ecdsa"]
106-
ecdsa-p384 = ["p384", "p384/ecdsa", "ecdsa"]
107-
ecdsa-p521 = ["p521", "p521/ecdsa", "ecdsa"]
116+
ecdsa = ["dep:ecdsa", "verify", "signature", "rand", "der", "elliptic-curve"]
117+
ecdsa-p256 = ["ecdsa", "p256", "p256/ecdsa"]
118+
ecdsa-p384 = ["ecdsa", "p384", "p384/ecdsa"]
119+
ecdsa-p521 = ["ecdsa", "p521", "p521/ecdsa"]
108120
ecdsa-full = ["ecdsa-p256", "ecdsa-p384", "ecdsa-p521"]
109121

110-
eddsa = ["verify", "signature"]
111-
eddsa-ed25519 = ["ed25519", "eddsa"]
122+
eddsa = ["verify", "signature", "elliptic-curve"]
123+
eddsa-ed25519 = ["eddsa", "ed25519"]
112124
eddsa-full = ["eddsa-ed25519"]
113125

114-
kx = ["rand"]
115-
kx-x25519 = ["dep:x25519-dalek", "kx"]
116-
kx-p256 = ["p256", "p256/ecdh", "kx"]
117-
kx-p384 = ["p384", "p384/ecdh", "kx"]
118-
kx-p521 = ["p521", "p521/ecdh", "kx"]
126+
kx = ["rand", "elliptic-curve"]
127+
kx-x25519 = ["kx", "dep:x25519-dalek"]
128+
kx-nist = ["sec1"]
129+
kx-p256 = ["kx", "p256", "kx-nist", "p256/ecdh"]
130+
kx-p384 = ["kx", "p384", "kx-nist", "p384/ecdh"]
131+
kx-p521 = ["kx", "p521", "kx-nist", "p521/ecdh"]
119132
kx-full = ["kx-x25519", "kx-p256", "kx-p384", "kx-p521"]
120133

121-
rsa = ["dep:rsa", "rsa/sha2", "verify", "signature", "pkcs1"]
134+
rsa = ["dep:rsa", "rsa/sha2", "pkcs1"]
122135
rsa-pkcs1 = ["rsa", "pkcs1"]
123136
rsa-pss = ["rsa"]
124-
rsa-full = ["rsa-pkcs1", "rsa-pss"]
125137

126138
aead = ["dep:aead"]
127-
aes-gcm = ["dep:aes-gcm", "aes", "gcm", "aead"]
128-
aes-ccm = ["aes", "ccm", "aead"]
129-
chacha20poly1305 = ["dep:chacha20poly1305", "aead"]
130-
aead-full = ["aes-gcm", "aes-ccm", "chacha20poly1305"]
139+
aead-aes-gcm = ["aead", "aes-gcm"]
140+
aead-aes-ccm = ["aead", "aes-ccm"]
141+
aead-chacha20poly1305 = ["aead", "chacha20poly1305"]
142+
aead-full = ["aead-aes-gcm", "aead-aes-ccm", "aead-chacha20poly1305"]
143+
144+
sign = ["signature", "der"]
145+
sign-ecdsa-nist = ["sign"]
146+
sign-ecdsa-p256 = ["sign-ecdsa-nist", "ecdsa-p256"]
147+
sign-ecdsa-p384 = ["sign-ecdsa-nist", "ecdsa-p384"]
148+
sign-ecdsa-p521 = ["sign-ecdsa-nist", "ecdsa-p521"]
149+
sign-eddsa = ["sign"]
150+
sign-eddsa-ed25519 = ["sign-eddsa", "eddsa-ed25519"]
151+
sign-rsa = ["sign", "rsa"]
152+
sign-rsa-pkcs1 = ["sign-rsa", "rsa-pkcs1"]
153+
sign-rsa-pss = ["sign-rsa", "rsa-pss"]
154+
sign-full = [
155+
"sign-ecdsa-p256",
156+
"sign-ecdsa-p384",
157+
"sign-ecdsa-p521",
158+
"sign-eddsa-ed25519",
159+
"sign-rsa-pkcs1",
160+
"sign-rsa-pss",
161+
]
162+
163+
verify = ["dep:webpki"]
164+
verify-ecdsa-nist = ["verify"]
165+
verify-ecdsa-p256 = ["verify-ecdsa-nist", "ecdsa-p256"]
166+
verify-ecdsa-p256-sha256 = ["verify-ecdsa-p256", "hash-sha256"]
167+
verify-ecdsa-p256-sha384 = ["verify-ecdsa-p256", "hash-sha384"]
168+
verify-ecdsa-p384 = ["verify-ecdsa-nist", "ecdsa-p384"]
169+
verify-ecdsa-p384-sha256 = ["verify-ecdsa-p384", "hash-sha256"]
170+
verify-ecdsa-p384-sha384 = ["verify-ecdsa-p384", "hash-sha384"]
171+
verify-eddsa-ed25519 = ["verify", "eddsa-ed25519"]
172+
verify-rsa-pkcs1 = ["verify", "rsa-pkcs1"]
173+
verify-rsa-pkcs1-sha256 = ["verify-rsa-pkcs1", "hash-sha256"]
174+
verify-rsa-pkcs1-sha384 = ["verify-rsa-pkcs1", "hash-sha384"]
175+
verify-rsa-pkcs1-sha512 = ["verify-rsa-pkcs1", "hash-sha512"]
176+
verify-rsa-pss = ["verify", "rsa-pss"]
177+
verify-rsa-pss-sha256 = ["verify-rsa-pss", "hash-sha256"]
178+
verify-rsa-pss-sha384 = ["verify-rsa-pss", "hash-sha384"]
179+
verify-rsa-pss-sha512 = ["verify-rsa-pss", "hash-sha512"]
180+
verify-full = [
181+
"verify-ecdsa-p256-sha256",
182+
"verify-ecdsa-p256-sha384",
183+
"verify-ecdsa-p384-sha256",
184+
"verify-ecdsa-p384-sha384",
185+
"verify-eddsa-ed25519",
186+
"verify-rsa-pkcs1-sha256",
187+
"verify-rsa-pkcs1-sha384",
188+
"verify-rsa-pkcs1-sha512",
189+
"verify-rsa-pss-sha256",
190+
"verify-rsa-pss-sha384",
191+
"verify-rsa-pss-sha512",
192+
]
131193

132-
# TODO
133194
hash = []
195+
hash-sha224 = ["hash"]
134196
hash-sha256 = ["hash"]
135197
hash-sha384 = ["hash"]
136198
hash-sha512 = ["hash"]
137-
hash-full = ["hash-sha256", "hash-sha384", "hash-sha512"]
199+
hash-full = ["hash-sha224", "hash-sha256", "hash-sha384", "hash-sha512"]
138200

139201
# Formats
140202
der = ["dep:der"]
141-
sec1 = ["dep:sec1", "der"]
142-
pem = ["sec1?/pem", "pkcs8?/pem", "p256?/pem", "p384?/pem", "p521?/pem", "der"]
143-
pkcs1 = ["dep:pkcs1", "der"]
203+
sec1 = ["dep:sec1", "elliptic-curve?/sec1"]
204+
pem = ["elliptic-curve?/pem", "ecdsa?/pem"]
205+
pkcs1 = ["dep:pkcs1"]
144206
pkcs8 = [
145207
"dep:pkcs8",
208+
"ecdsa?/pkcs8",
146209
"ed25519-dalek?/pkcs8",
147-
"sec1?/pkcs8",
210+
"elliptic-curve?/pkcs8",
148211
"p256?/pkcs8",
149212
"p384?/pkcs8",
150213
"p521?/pkcs8",
151-
"der",
214+
"sec1?/pkcs8",
152215
]
153216

154-
signature = ["dep:signature"]
155-
rand = ["dep:rand_core", "signature?/rand_core"]
156217
aes = ["dep:aes"]
218+
aes-ccm = ["aes", "ccm"]
219+
aes-gcm = ["dep:aes-gcm", "aes", "gcm"]
157220
ccm = ["dep:ccm"]
158-
gcm = []
221+
chacha20poly1305 = ["dep:chacha20poly1305"]
222+
elliptic-curve = ["dep:elliptic-curve"]
223+
gcm = []
224+
rand = ["dep:rand_core", "signature?/rand_core"]
225+
signature = ["dep:signature"]

0 commit comments

Comments
 (0)