Skip to content

Provider bugfixes (main branch)#169

Open
mamckee wants to merge 15 commits into
mainfrom
mamckee-provider-buxfixes-main
Open

Provider bugfixes (main branch)#169
mamckee wants to merge 15 commits into
mainfrom
mamckee-provider-buxfixes-main

Conversation

@mamckee
Copy link
Copy Markdown
Collaborator

@mamckee mamckee commented May 8, 2026

This PR ports the bugfixes from #165 to the main branch.

In addition

  • Fixes a bug in ML-KEM decode (p_scossl_SubjectPublicKeyInfo_to_mlkem), where the incorrect free function was called on subjPubKeyInfo, which could potentially lead to a memory leak.
  • Fixes a compiler warning in the generic skeymgmt interface

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread SymCryptProvider/src/skeymgmt/p_scossl_generic_skeymgmt.c
Comment thread SymCryptProvider/src/asymcipher/p_scossl_rsa_cipher.c
@mamckee mamckee marked this pull request as ready for review May 11, 2026 16:46
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