Skip to content

Commit b9462b2

Browse files
committed
Initial PQC edits to build with upstream updates
1 parent 6db9125 commit b9462b2

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ get-info-full = []
3737
large-blobs = []
3838
third-party-payment = []
3939

40-
backend-mldsa-44 = []
41-
backend-mldsa-65 = []
42-
backend-mldsa-87 = []
40+
mldsa44 = []
41+
mldsa65 = []
42+
mldsa87 = []
4343

4444
log-all = []
4545
log-none = []

src/sizes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ pub const LARGE_BLOB_MAX_FRAGMENT_LENGTH: usize = 3008;
3030

3131
// TODO: update these, and grab them from a common crate?
3232
cfg_if::cfg_if! {
33-
if #[cfg(feature = "backend-mldsa-87")] {
33+
if #[cfg(feature = "mldsa87")] {
3434
pub const MAX_MESSAGE_LENGTH: usize = MAX_COMMITTMENT_LENGTH;
3535
pub const MAX_CREDENTIAL_ID_LENGTH: usize = 7523 + 57 + 30 + 37;
3636
pub const AUTHENTICATOR_DATA_LENGTH: usize = MAX_CREDENTIAL_ID_LENGTH + 2031; // TODO: this will have to be larger
3737
pub const ASN1_SIGNATURE_LENGTH: usize = 4627;
38-
} else if #[cfg(feature = "backend-mldsa-65")] {
38+
} else if #[cfg(feature = "mldsa65")] {
3939
pub const MAX_MESSAGE_LENGTH: usize = MAX_COMMITTMENT_LENGTH;
4040
pub const MAX_CREDENTIAL_ID_LENGTH: usize = 6019 + 57 + 30 + 37;
4141
pub const AUTHENTICATOR_DATA_LENGTH: usize = MAX_CREDENTIAL_ID_LENGTH + 2031;
4242
pub const ASN1_SIGNATURE_LENGTH: usize = 3309;
43-
} else if #[cfg(feature = "backend-mldsa-44")] {
43+
} else if #[cfg(feature = "mldsa44")] {
4444
pub const MAX_MESSAGE_LENGTH: usize = MAX_COMMITTMENT_LENGTH;
4545
pub const MAX_CREDENTIAL_ID_LENGTH: usize = 3907 + 57 + 30 + 37;
4646
pub const AUTHENTICATOR_DATA_LENGTH: usize = MAX_CREDENTIAL_ID_LENGTH + 2031; // TODO: this can be smaller

src/webauthn.rs

+10-20
Original file line numberDiff line numberDiff line change
@@ -159,37 +159,27 @@ pub const ES256: i32 = -7;
159159
/// EdDSA
160160
pub const ED_DSA: i32 = -8;
161161
/// ML0DSA
162-
#[cfg(feature = "backend-mldsa-44")]
162+
#[cfg(feature = "mldsa44")]
163163
pub const MLDSA44: i32 = -87;
164-
#[cfg(feature = "backend-mldsa-65")]
164+
#[cfg(feature = "mldsa65")]
165165
pub const MLDSA65: i32 = -88;
166-
#[cfg(feature = "backend-mldsa-87")]
166+
#[cfg(feature = "mldsa87")]
167167
pub const MLDSA87: i32 = -89;
168168

169169
// Dynamically calculate the number of different known algorithms
170-
pub const COUNT_KNOWN_ALGS: usize =
171-
2 + (if cfg!(feature = "backend-mldsa-44") {
172-
1
173-
} else {
174-
0
175-
}) + (if cfg!(feature = "backend-mldsa-65") {
176-
1
177-
} else {
178-
0
179-
}) + (if cfg!(feature = "backend-mldsa-87") {
180-
1
181-
} else {
182-
0
183-
});
170+
pub const COUNT_KNOWN_ALGS: usize = 2
171+
+ (if cfg!(feature = "mldsa44") { 1 } else { 0 })
172+
+ (if cfg!(feature = "mldsa65") { 1 } else { 0 })
173+
+ (if cfg!(feature = "mldsa87") { 1 } else { 0 });
184174

185175
pub const KNOWN_ALGS: [i32; COUNT_KNOWN_ALGS] = [
186176
ES256,
187177
ED_DSA,
188-
#[cfg(feature = "backend-mldsa-44")]
178+
#[cfg(feature = "mldsa44")]
189179
MLDSA44,
190-
#[cfg(feature = "backend-mldsa-65")]
180+
#[cfg(feature = "mldsa65")]
191181
MLDSA65,
192-
#[cfg(feature = "backend-mldsa-87")]
182+
#[cfg(feature = "mldsa87")]
193183
MLDSA87,
194184
];
195185

0 commit comments

Comments
 (0)