Skip to content

Commit 3efb4fa

Browse files
authored
Rename ML-DSA (#844)
1 parent e2e9e82 commit 3efb4fa

File tree

5 files changed

+66
-36
lines changed

5 files changed

+66
-36
lines changed

aws-lc-rs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "aws-lc-rs"
33
authors = ["AWS-LibCrypto"]
4-
version = "1.13.2"
4+
version = "1.13.3"
55
# this crate re-exports whatever sys crate that was selected
6-
links = "aws_lc_rs_1_13_2_sys"
6+
links = "aws_lc_rs_1_13_3_sys"
77
edition = "2021"
88
rust-version = "1.63.0"
99
keywords = ["crypto", "cryptography", "security"]

aws-lc-rs/src/pqdsa.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,52 @@ use std::os::raw::c_int;
1212
#[derive(Debug, Eq, PartialEq)]
1313
#[allow(non_camel_case_types)]
1414
pub(crate) enum AlgorithmID {
15-
MLDSA_44,
16-
MLDSA_65,
17-
MLDSA_87,
15+
ML_DSA_44,
16+
ML_DSA_65,
17+
ML_DSA_87,
1818
}
1919

2020
impl AlgorithmID {
2121
#[allow(dead_code)]
2222
pub(crate) const fn from_nid(nid: c_int) -> Result<Self, Unspecified> {
2323
match nid {
24-
NID_MLDSA44 => Ok(Self::MLDSA_44),
25-
NID_MLDSA65 => Ok(Self::MLDSA_65),
26-
NID_MLDSA87 => Ok(Self::MLDSA_87),
24+
NID_MLDSA44 => Ok(Self::ML_DSA_44),
25+
NID_MLDSA65 => Ok(Self::ML_DSA_65),
26+
NID_MLDSA87 => Ok(Self::ML_DSA_87),
2727
_ => Err(Unspecified),
2828
}
2929
}
3030

3131
pub(crate) const fn nid(&self) -> c_int {
3232
match self {
33-
Self::MLDSA_44 => NID_MLDSA44,
34-
Self::MLDSA_65 => NID_MLDSA65,
35-
Self::MLDSA_87 => NID_MLDSA87,
33+
Self::ML_DSA_44 => NID_MLDSA44,
34+
Self::ML_DSA_65 => NID_MLDSA65,
35+
Self::ML_DSA_87 => NID_MLDSA87,
3636
}
3737
}
3838

3939
#[allow(dead_code)]
4040
pub(crate) const fn priv_key_size_bytes(&self) -> usize {
4141
match self {
42-
Self::MLDSA_44 => 2560,
43-
Self::MLDSA_65 => 4032,
44-
Self::MLDSA_87 => 4896,
42+
Self::ML_DSA_44 => 2560,
43+
Self::ML_DSA_65 => 4032,
44+
Self::ML_DSA_87 => 4896,
4545
}
4646
}
4747

4848
pub(crate) const fn pub_key_size_bytes(&self) -> usize {
4949
match self {
50-
Self::MLDSA_44 => 1312,
51-
Self::MLDSA_65 => 1952,
52-
Self::MLDSA_87 => 2592,
50+
Self::ML_DSA_44 => 1312,
51+
Self::ML_DSA_65 => 1952,
52+
Self::ML_DSA_87 => 2592,
5353
}
5454
}
5555

5656
pub(crate) const fn signature_size_bytes(&self) -> usize {
5757
match self {
58-
Self::MLDSA_44 => 2420,
59-
Self::MLDSA_65 => 3309,
60-
Self::MLDSA_87 => 4627,
58+
Self::ML_DSA_44 => 2420,
59+
Self::ML_DSA_65 => 3309,
60+
Self::ML_DSA_87 => 4627,
6161
}
6262
}
6363
}

aws-lc-rs/src/pqdsa/key_pair.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ mod tests {
176176
use super::*;
177177

178178
use crate::signature::{UnparsedPublicKey, VerificationAlgorithm};
179-
use crate::unstable::signature::{MLDSA_44_SIGNING, MLDSA_65_SIGNING, MLDSA_87_SIGNING};
179+
use crate::unstable::signature::{ML_DSA_44_SIGNING, ML_DSA_65_SIGNING, ML_DSA_87_SIGNING};
180180

181181
const TEST_ALGORITHMS: &[&PqdsaSigningAlgorithm] =
182-
&[&MLDSA_44_SIGNING, &MLDSA_65_SIGNING, &MLDSA_87_SIGNING];
182+
&[&ML_DSA_44_SIGNING, &ML_DSA_65_SIGNING, &ML_DSA_87_SIGNING];
183183

184184
#[test]
185185
fn test_public_key_serialization() {

aws-lc-rs/src/unstable/signature.rs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,55 @@ pub use crate::pqdsa::signature::{
4343
use crate::pqdsa::AlgorithmID;
4444

4545
/// Verification of MLDSA-44 signatures
46+
#[deprecated(note = "Use ML_DSA_44")]
4647
pub static MLDSA_44: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
47-
id: &AlgorithmID::MLDSA_44,
48+
id: &AlgorithmID::ML_DSA_44,
4849
};
4950

5051
/// Verification of MLDSA-65 signatures
52+
#[deprecated(note = "Use ML_DSA_65")]
5153
pub static MLDSA_65: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
52-
id: &AlgorithmID::MLDSA_65,
54+
id: &AlgorithmID::ML_DSA_65,
5355
};
5456

5557
/// Verification of MLDSA-87 signatures
58+
#[deprecated(note = "Use ML_DSA_87")]
5659
pub static MLDSA_87: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
57-
id: &AlgorithmID::MLDSA_87,
60+
id: &AlgorithmID::ML_DSA_87,
5861
};
5962

6063
/// Sign using MLDSA-44
61-
pub static MLDSA_44_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&MLDSA_44);
64+
#[deprecated(note = "Use ML_DSA_44_SIGNING")]
65+
pub static MLDSA_44_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_44);
6266

6367
/// Sign using MLDSA-65
64-
pub static MLDSA_65_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&MLDSA_65);
68+
#[deprecated(note = "Use ML_DSA_65_SIGNING")]
69+
pub static MLDSA_65_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_65);
6570

6671
/// Sign using MLDSA-87
67-
pub static MLDSA_87_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&MLDSA_87);
72+
#[deprecated(note = "Use ML_DSA_87_SIGNING")]
73+
pub static MLDSA_87_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_87);
74+
75+
/// Verification of ML-DSA-44 signatures
76+
pub static ML_DSA_44: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
77+
id: &AlgorithmID::ML_DSA_44,
78+
};
79+
80+
/// Verification of ML-DSA-65 signatures
81+
pub static ML_DSA_65: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
82+
id: &AlgorithmID::ML_DSA_65,
83+
};
84+
85+
/// Verification of ML-DSA-87 signatures
86+
pub static ML_DSA_87: PqdsaVerificationAlgorithm = PqdsaVerificationAlgorithm {
87+
id: &AlgorithmID::ML_DSA_87,
88+
};
89+
90+
/// Sign using ML-DSA-44
91+
pub static ML_DSA_44_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_44);
92+
93+
/// Sign using ML-DSA-65
94+
pub static ML_DSA_65_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_65);
95+
96+
/// Sign using ML-DSA-87
97+
pub static ML_DSA_87_SIGNING: PqdsaSigningAlgorithm = PqdsaSigningAlgorithm(&ML_DSA_87);

aws-lc-rs/tests/pqdsa_test.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use aws_lc_rs::signature::{KeyPair, VerificationAlgorithm};
66
use aws_lc_rs::unstable::signature::{
7-
PqdsaKeyPair, MLDSA_44, MLDSA_44_SIGNING, MLDSA_65, MLDSA_65_SIGNING, MLDSA_87,
8-
MLDSA_87_SIGNING,
7+
PqdsaKeyPair, ML_DSA_44, ML_DSA_44_SIGNING, ML_DSA_65, ML_DSA_65_SIGNING, ML_DSA_87,
8+
ML_DSA_87_SIGNING,
99
};
1010
use aws_lc_rs::{test, test_file};
1111

@@ -51,30 +51,30 @@ macro_rules! mldsa_sigver_test {
5151

5252
#[test]
5353
fn mldsa_44_keygen_test() {
54-
mldsa_keygen_test!("data/MLDSA_44_ACVP_keyGen.txt", &MLDSA_44_SIGNING);
54+
mldsa_keygen_test!("data/MLDSA_44_ACVP_keyGen.txt", &ML_DSA_44_SIGNING);
5555
}
5656

5757
#[test]
5858
fn mldsa_65_keygen_test() {
59-
mldsa_keygen_test!("data/MLDSA_65_ACVP_keyGen.txt", &MLDSA_65_SIGNING);
59+
mldsa_keygen_test!("data/MLDSA_65_ACVP_keyGen.txt", &ML_DSA_65_SIGNING);
6060
}
6161

6262
#[test]
6363
fn mldsa_87_keygen_test() {
64-
mldsa_keygen_test!("data/MLDSA_87_ACVP_keyGen.txt", &MLDSA_87_SIGNING);
64+
mldsa_keygen_test!("data/MLDSA_87_ACVP_keyGen.txt", &ML_DSA_87_SIGNING);
6565
}
6666

6767
#[test]
6868
fn mldsa_44_sigver_test() {
69-
mldsa_sigver_test!("data/MLDSA_44_sigVer.txt", &MLDSA_44);
69+
mldsa_sigver_test!("data/MLDSA_44_sigVer.txt", &ML_DSA_44);
7070
}
7171

7272
#[test]
7373
fn mldsa_65_sigver_test() {
74-
mldsa_sigver_test!("data/MLDSA_65_sigVer.txt", &MLDSA_65);
74+
mldsa_sigver_test!("data/MLDSA_65_sigVer.txt", &ML_DSA_65);
7575
}
7676

7777
#[test]
7878
fn mldsa_87_sigver_test() {
79-
mldsa_sigver_test!("data/MLDSA_87_sigVer.txt", &MLDSA_87);
79+
mldsa_sigver_test!("data/MLDSA_87_sigVer.txt", &ML_DSA_87);
8080
}

0 commit comments

Comments
 (0)