Skip to content

crypto: Add support for sha512 - #4210

Merged
Steven Malis (smalis-msft) merged 1 commit into
microsoft:mainfrom
smalis-msft:crypto-sha512
Aug 12, 2026
Merged

crypto: Add support for sha512#4210
Steven Malis (smalis-msft) merged 1 commit into
microsoft:mainfrom
smalis-msft:crypto-sha512

Conversation

@smalis-msft

Copy link
Copy Markdown
Contributor

And move one bit from windows into hashes to keep things as contained as we can.

@smalis-msft
Steven Malis (smalis-msft) requested a review from a team as a code owner August 11, 2026 15:02
Copilot AI lite review requested due to automatic review settings August 11, 2026 15:02
@smalis-msft Steven Malis (smalis-msft) added the backport_1.8.2607 Change should be backported to the release/1.8.2607 branch label Aug 11, 2026
@github-actions github-actions Bot added the unsafe Related to unsafe code label Aug 11, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SHA-512 as a supported hash algorithm in the support/crypto crate and wires it through RSA operations across backends, while also centralizing Windows RSA signature-OID parsing into hashes.rs to reduce Windows-specific logic in the X.509 backend.

Changes:

  • Extend HashAlgorithm with Sha512 and add backend-specific mappings (SymCrypt/OpenSSL/BCrypt/macOS Security.framework, plus DER OID support).
  • Add SHA-512 support to the RustCrypto RSA backend for OAEP, PKCS#1 v1.5, and PSS.
  • Refactor Windows X.509 verification to use a shared RSA signature-OID → HashAlgorithm helper and expand OAEP round-trip coverage to include SHA-512.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
support/crypto/src/x509/win.rs Refactors signature-algorithm OID parsing to use a shared helper, keeping Windows X.509 code smaller.
support/crypto/src/rsa/rust.rs Implements RSA OAEP/PKCS#1/PSS SHA-512 support for the RustCrypto backend.
support/crypto/src/rsa/mod.rs Expands OAEP round-trip tests to cover all supported hash algorithms, including SHA-512.
support/crypto/src/hashes.rs Adds Sha512 to HashAlgorithm, backend mappings, DER OID mapping, and the Windows RSA signature-OID helper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread support/crypto/src/rsa/mod.rs
Comment thread support/crypto/src/hashes.rs
@github-actions

Copy link
Copy Markdown

@smalis-msft
Steven Malis (smalis-msft) merged commit 9a4cdb5 into microsoft:main Aug 12, 2026
97 of 98 checks passed
@smalis-msft
Steven Malis (smalis-msft) deleted the crypto-sha512 branch August 12, 2026 17:42
@benhillis

Copy link
Copy Markdown
Member

Steven Malis (@smalis-msft), please either backport this change to release/1.8.2607 or remove the backport_1.8.2607 label. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport_1.8.2607 Change should be backported to the release/1.8.2607 branch unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants