Skip to content

Conversation

mamckee
Copy link
Collaborator

@mamckee mamckee commented Sep 4, 2025

This PR fixes a regression where encrypt-then-mac was failing with block ciphers provided by the symcrypt provider. When ETM is used, the mac size passed to the provider is 0. Instead of removing the padding and skipping mac extraction, the SymCrypt provider treated a zero-mac length as invalid and failed before removing padding.

This PR also fixes a corner case issue when the SymCrypt provider is used with TLSv1, where an empty block was passed for encryption, and the caller expected an encrypted block of padding bytes.

@samuel-lee-msft
Copy link
Contributor

// the unpadded record, and saves the result to ctx->tlsMac.

Worth documenting that this part is optional based on ctx->tlsMacSize = 0 and Encrypt then MAC vs. MAC then Encrypt ciphersuites


Refers to: SymCryptProvider/src/ciphers/p_scossl_aes.c:154 in 1640b26. [](commit_id = 1640b26, deletion_comment = False)

samuel-lee-msft
samuel-lee-msft previously approved these changes Sep 5, 2025
Copy link
Contributor

@samuel-lee-msft samuel-lee-msft left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments

@mamckee mamckee merged commit bd8d622 into scossl-1.9 Sep 17, 2025
1 check passed
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