Skip to content

Additional fixes for block ciphers in TLS connections#145

Merged
mamckee merged 4 commits into
scossl-1.9from
mamckee-cbc-server-etm-fix
Sep 17, 2025
Merged

Additional fixes for block ciphers in TLS connections#145
mamckee merged 4 commits into
scossl-1.9from
mamckee-cbc-server-etm-fix

Conversation

@mamckee
Copy link
Copy Markdown
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
Copy Markdown
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)

Comment thread SymCryptProvider/src/ciphers/p_scossl_aes.c
samuel-lee-msft
samuel-lee-msft previously approved these changes Sep 5, 2025
Copy link
Copy Markdown
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
@mamckee mamckee deleted the mamckee-cbc-server-etm-fix branch October 9, 2025 19:03
mamckee added a commit that referenced this pull request Jan 26, 2026
* Allow optional mac in TLS block decrypt

* Fix issue found for TLSv1 connections

* Bump minor version

* Add comments describing etm behavior
mamckee added a commit that referenced this pull request Jan 30, 2026
* Allow optional mac in TLS block decrypt

* Fix issue found for TLSv1 connections

* Bump minor version

* Add comments describing etm behavior
mamckee added a commit that referenced this pull request Mar 4, 2026
…SL versions (#159)

* Additional fixes for block ciphers in TLS connections (#145)

* Allow optional mac in TLS block decrypt

* Fix issue found for TLSv1 connections

* Bump minor version

* Add comments describing etm behavior

* Bugfixes for 1.9 (#150)

* Add OSSL_SIGNATURE_PARAM_NONCE_TYPE to ECDSA signature

* Only optimize debug release builds

* Only export EC public/private if available

* Fix HMAC dupctx

* Bump version to 1.9.4

* Add goto cleanup

* Allow MAC context duplication for partially initialized contexts (#156)

* Fix context duplication for partially initialized mac contexts

* Check mac state in init

* Fix error messages

* Fix compilation

* Add missing parameter on older versions

* Fix errors in OpenSSL 3.0 builds

* Use dummy OID on older versions for ml-kem composite

* Use valid dummy OID
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