Provider bugfixes (main branch)#169
Open
mamckee wants to merge 15 commits into
Open
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Ports SymCrypt provider bugfixes from #165 into main, plus additional fixes around ML-KEM decoding cleanup and a generic skeymgmt compiler warning.
Changes:
- Harden RSA cipher encrypt/decrypt buffer sizing behavior (incl. TLS padding) and fix RSA key matching private exponent comparison.
- Fix X25519 sizing/validation by centralizing the constant and enforcing key-length checks during import.
- Fix memory management/cleanup issues (ML-KEM SubjectPublicKeyInfo free) and add MAC initialization-state tracking to prevent use-before-key.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SymCryptProvider/src/skeymgmt/p_scossl_generic_skeymgmt.c | Adjusts generic skey export parameter construction (addresses compiler warning). |
| SymCryptProvider/src/p_scossl_ecc.h | Introduces shared X25519 key-size constant. |
| SymCryptProvider/src/p_scossl_ecc.c | Uses the shared X25519 key-size constant for sizing. |
| SymCryptProvider/src/keymgmt/p_scossl_rsa_keymgmt.c | Fixes RSA key match logic (private exponent comparison) and minor formatting. |
| SymCryptProvider/src/keymgmt/p_scossl_ecc_keymgmt.c | Hardens X25519 import (length checks, safer key replacement/cleanup). |
| SymCryptProvider/src/keymgmt/p_scossl_dh_keymgmt.c | Fixes DH group duplication allocation sizing (bits vs bytes). |
| SymCryptProvider/src/decoder/p_scossl_decode_mlkem.c | Fixes ML-KEM SPKI decode cleanup to use correct ASN.1 free routine. |
| SymCryptProvider/src/ciphers/p_scossl_aes.c | Fixes TLS MAC size validation to check the parameter value being set. |
| SymCryptProvider/src/asymcipher/p_scossl_rsa_cipher.c | Deep-copies OAEP label on dupctx and adds output length/buffer checks for RSA encrypt/decrypt. |
| ScosslCommon/src/scossl_mac.c | Tracks MAC initialization state and blocks update/final prior to key initialization. |
| ScosslCommon/src/scossl_helpers.c | Registers function names for new MAC function codes. |
| ScosslCommon/src/scossl_dh.c | Fixes DH group copy allocation sizing (bits vs bytes). |
| ScosslCommon/inc/scossl_mac.h | Adds initialized flag to MAC context struct. |
| ScosslCommon/inc/scossl_helpers.h | Adds new function codes for MAC update/final. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ports the bugfixes from #165 to the main branch.
In addition
p_scossl_SubjectPublicKeyInfo_to_mlkem), where the incorrect free function was called on subjPubKeyInfo, which could potentially lead to a memory leak.