Skip to content

[release/9.0-staging] Do not set the salt or info if they are NULL for OpenSSL HKDF. #114877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Apr 21, 2025

Backport of #114864 to release/9.0-staging

/cc @vcsjones

Customer Impact

  • Customer reported
  • Found internally

This issue was found internally by scouting a nightly build of OpenSSL 3.5.1-dev. Customers that use the HKDF.Expand on Linux with OpenSSL 3.0 or greater will unconditionally receive an exception:

Error Message:
   Interop+Crypto+OpenSslCryptographicException : error:078C0102:common libcrypto routines::passed a null parameter
  Stack Trace:
     at Interop.Crypto.HkdfExpand(SafeEvpKdfHandle kdf, ReadOnlySpan`1 prk, String algorithm, ReadOnlySpan`1 info, Span`1 destination) in /__w/runtime-ci/runtime-ci/runtime/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.Kdf.cs:line 113
   at System.Security.Cryptography.HKDF.Expand(HashAlgorithmName hashAlgorithmName, Int32 hashLength, ReadOnlySpan`1 prk, Span`1 output, ReadOnlySpan`1 info) in /__w/runtime-ci/runtime-ci/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.OpenSsl.cs:line 44

This is due to setting the salt parameter to NULL, where OpenSSL wants the set to be omitted entirely when there is no salt value. Customers have no means to work around this.

Regression

  • Yes
  • No
  • Upstream

This regressed due to an upstream change in OpenSSL at openssl/openssl#27305, which is cherry-picked for all OpenSSL 3.x releases.

Testing

Existing tests caught the issue when running against OpenSSL 3.5.1-dev. With the changes, the tests are back to green.

Risk

Low. The change is to not set the salt and info parameters if they are NULL, instead of setting them to NULL values. The functionality has strong test coverage and existing tests verify the change is correct.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@vcsjones vcsjones added this to the 9.0.x milestone Apr 21, 2025
@vcsjones vcsjones self-assigned this Apr 21, 2025
@bartonjs bartonjs added the Servicing-consider Issue for next servicing release review label Apr 22, 2025
@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Apr 22, 2025
@leecow leecow modified the milestones: 9.0.x, 9.0.6 Apr 22, 2025
@bartonjs
Copy link
Member

/ba-g this error looks like #108078, and is not in any area that would have been impacted by this change.

@bartonjs bartonjs merged commit 763bc41 into release/9.0-staging Apr 23, 2025
103 of 110 checks passed
@bartonjs bartonjs deleted the backport/pr-114864-to-release/9.0-staging branch April 23, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Security Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants