Skip to content

pss: remove redundant verify_algorithm_id call in SigningKey::try_from - #660

Merged
tarcieri merged 1 commit into
RustCrypto:masterfrom
VolodymyrBg:redundant-verify-algorithm-id
Oct 18, 2026
Merged

tarcieri merged 1 commit into
RustCrypto:masterfrom
VolodymyrBg:redundant-verify-algorithm-id

Conversation

@VolodymyrBg

Copy link
Copy Markdown
Contributor

The explicit [verify_algorithm_id()]

RSA/src/encoding.rs

Lines 152 to 169 in 1e94064

/// Verify that the `AlgorithmIdentifier` for a key is correct.
pub(crate) fn verify_algorithm_id(algorithm: &spki::AlgorithmIdentifierRef) -> spki::Result<()> {
match algorithm.oid {
pkcs1::ALGORITHM_OID => {
if algorithm.parameters_any()? != pkcs8::der::asn1::Null.into() {
return Err(spki::Error::KeyMalformed);
}
}
ID_RSASSA_PSS => {
if algorithm.parameters.is_some() {
return Err(spki::Error::KeyMalformed);
}
}
_ => return Err(spki::Error::OidUnknown { oid: algorithm.oid }),
};
Ok(())
}
call before RsaPrivateKey::try_from() was redundant because RsaPrivateKey::try_from() already performs the same
check internally. This matches the pattern used in [BlindedSigningKey]
pub struct BlindedSigningKey<D>
where
D: Digest,
{
inner: RsaPrivateKey,
salt_len: usize,
phantom: PhantomData<D>,
}

@tarcieri
tarcieri merged commit b83a81f into RustCrypto:master Oct 18, 2026
12 checks passed
kaidokert pushed a commit to kaidokert/RSA that referenced this pull request Nov 5, 2026
kaidokert added a commit to kaidokert/RSA that referenced this pull request Nov 6, 2026
* build(deps): bump sha3 from 0.11.0 to 0.12.0 (RustCrypto#700)

(cherry picked from commit a1d075c)

* build(deps): bump rstest from 0.26.1 to 0.28.0 (RustCrypto#742)

(cherry picked from commit f97f860)

Fork: Cargo.lock dropped; manifest line resolved by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* build(deps): bump crate-ci/typos from 1.44.0 to 1.51.1 (RustCrypto#743)

(cherry picked from commit a2dfdf5)

* build(deps): bump actions/checkout from 6 to 7 (RustCrypto#741)

(cherry picked from commit 2ea8a8b)

* Add `Clone` derive to `Error` (RustCrypto#694)

I believe all of the variants here are cloneable, this should be too.

(cherry picked from commit ba228a1)

* pss: remove redundant `verify_algorithm_id` call in `SigningKey::try_from` (RustCrypto#660)

(cherry picked from commit b83a81f)

* CI: move our own workflows to actions/checkout v7

Upstream RustCrypto#741 only touches the workflows it has. Without this the fork's
target and ct-verify workflows stay on v4 and v6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Steven Malis <137308034+smalis-msft@users.noreply.github.com>
Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants