Rename `SignatureScheme::sign`

The old name doesn't really make sense for me.
This commit is contained in:
Joseph Birr-Pixton 2024-05-03 10:31:30 +01:00
parent c46cf7e6ca
commit 17e6c953a0
5 changed files with 10 additions and 9 deletions

View File

@ -882,11 +882,12 @@ impl State<ClientConnectionData> for ExpectServerDone<'_> {
// Check the signature is compatible with the ciphersuite.
let sig = &st.server_kx.kx_sig;
if !SupportedCipherSuite::from(suite).usable_for_signature_algorithm(sig.scheme.sign())
if !SupportedCipherSuite::from(suite)
.usable_for_signature_algorithm(sig.scheme.algorithm())
{
warn!(
"peer signed kx with wrong algorithm (got {:?} expect {:?})",
sig.scheme.sign(),
sig.scheme.algorithm(),
suite.sign
);
return Err(PeerMisbehaved::SignedKxWithWrongAlgorithm.into());

View File

@ -248,7 +248,7 @@ impl SigningKey for EcdsaSigningKey {
}
fn algorithm(&self) -> SignatureAlgorithm {
self.scheme.sign()
self.scheme.algorithm()
}
}
@ -332,7 +332,7 @@ impl SigningKey for Ed25519SigningKey {
}
fn algorithm(&self) -> SignatureAlgorithm {
self.scheme.sign()
self.scheme.algorithm()
}
}

View File

@ -286,7 +286,7 @@ impl SigningKey for EcdsaSigningKey {
}
fn algorithm(&self) -> SignatureAlgorithm {
self.scheme.sign()
self.scheme.algorithm()
}
}
@ -370,7 +370,7 @@ impl SigningKey for Ed25519SigningKey {
}
fn algorithm(&self) -> SignatureAlgorithm {
self.scheme.sign()
self.scheme.algorithm()
}
}

View File

@ -513,7 +513,7 @@ enum_builder! {
}
impl SignatureScheme {
pub(crate) fn sign(&self) -> SignatureAlgorithm {
pub(crate) fn algorithm(&self) -> SignatureAlgorithm {
match *self {
Self::RSA_PKCS1_SHA1
| Self::RSA_PKCS1_SHA256

View File

@ -101,7 +101,7 @@ impl SupportedCipherSuite {
Self::Tls12(inner) => inner
.sign
.iter()
.any(|scheme| scheme.sign() == _sig_alg),
.any(|scheme| scheme.algorithm() == _sig_alg),
}
}
@ -164,7 +164,7 @@ pub(crate) fn compatible_sigscheme_for_suites(
sigscheme: SignatureScheme,
common_suites: &[SupportedCipherSuite],
) -> bool {
let sigalg = sigscheme.sign();
let sigalg = sigscheme.algorithm();
common_suites
.iter()
.any(|&suite| suite.usable_for_signature_algorithm(sigalg))