mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-07-31 18:07:23 -04:00
Clean ups to the error codes in CMS signature parsing
This commit is contained in:
@@ -108,8 +108,8 @@ pub enum RawX509SignatureParseError {
|
||||
#[error("could not parse SignatureAlgorithm.parameters")]
|
||||
SignatureAlgorithmParametersParseError(#[source] der::Error),
|
||||
|
||||
#[error("SignatureAlgorithm hash type does not match digest algorithm")]
|
||||
UnexpectedSignatureAlgorithmHash,
|
||||
#[error("unsupported SignatureAlgorithm hash algorithm: {}", .0.actual)]
|
||||
UnsupportedSignatureAlgorithmHash(OidMismatch),
|
||||
|
||||
#[error("unsupported SignatureAlgorithm mask generation function: {}", .0.actual)]
|
||||
UnsupportedSignatureAlgorithmMaskGen(OidMismatch),
|
||||
@@ -118,9 +118,9 @@ pub enum RawX509SignatureParseError {
|
||||
SignatureAlgorithmMaskGenParametersNotSet,
|
||||
|
||||
#[error(
|
||||
"SignatureAlgorithm mask generation function hash type does not match digest algorithm"
|
||||
"unsupported SignatureAlgorithm mask generation function hash algorithm: {}", .0.actual
|
||||
)]
|
||||
UnexpectedSignatureAlgorithmMaskGenHash,
|
||||
UnsupportedSignatureAlgorithmMaskGenHash(OidMismatch),
|
||||
|
||||
#[error("SignatureAlgorithm salt length is not 64: {0}")]
|
||||
UnsupportedSignatureAlgorithmSaltLen(u8),
|
||||
|
||||
@@ -333,7 +333,7 @@ fn map_signer_info_algorithms_to_signature_scheme(
|
||||
.map_err(RawX509SignatureParseError::SignatureAlgorithmParametersParseError)?;
|
||||
|
||||
assert_oid_matches(&signature_algorithm_params.hash.oid, &const_oid::db::rfc5912::ID_SHA_512)
|
||||
.map_err(RawX509SignatureParseError::UnsupportedDigestAlgorithm)?;
|
||||
.map_err(RawX509SignatureParseError::UnsupportedSignatureAlgorithmHash)?;
|
||||
assert_digest_alg_params_null_or_absent(&signature_algorithm_params.hash.parameters)?;
|
||||
|
||||
assert_oid_matches(&signature_algorithm_params.mask_gen.oid, &const_oid::db::rfc5912::ID_MGF_1)
|
||||
@@ -345,7 +345,7 @@ fn map_signer_info_algorithms_to_signature_scheme(
|
||||
.ok_or(RawX509SignatureParseError::SignatureAlgorithmMaskGenParametersNotSet)?;
|
||||
|
||||
assert_oid_matches(&mask_gen_params.oid, &const_oid::db::rfc5912::ID_SHA_512)
|
||||
.map_err(RawX509SignatureParseError::UnsupportedDigestAlgorithm)?;
|
||||
.map_err(RawX509SignatureParseError::UnsupportedSignatureAlgorithmMaskGenHash)?;
|
||||
assert_digest_alg_params_null_or_absent(&mask_gen_params.parameters)?;
|
||||
|
||||
if signature_algorithm_params.salt_len != 64 {
|
||||
|
||||
Reference in New Issue
Block a user