[release/9.0-staging] Fix shimmed implementation of TryGetHashAndReset to handle HMAC.#112015
Merged
bartonjs merged 3 commits intorelease/9.0-stagingfrom Feb 6, 2025
Merged
Conversation
The TryGetHashAndReset in switches on the algorithm name of IncrementalHash. IncrementalHash prepends "HMAC" in front of the algorithm name, so the shim did not correctly handle the HMAC-prepended algorithm names.
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
bartonjs
approved these changes
Feb 4, 2025
Member
|
/ba-g The modified code is not reachable on the leg that timed out. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #111929 to release/9.0-staging
/cc @vcsjones
Customer Impact
Reported by a customer in https://stackoverflow.com/questions/79392501/whats-so-dangerous-about-pkcs12loaderlimits-dangerousnolimits (tracked at #111926). Customers that use
X509CertificateLoader.LoadPkcs12from the Microsoft.Bcl.Cryptography package will be unable to use it with the default limits if the platform selectsnetstandard2.0assets, and will receive aCryptographicException. This may occur for platforms such as UWP.This occurred because the validator incorrectly handled the name of HMAC algorithms.
Regression
Testing
The fix was manually verified by building the changes locally and observing that the exception no long occurred.
Risk
Low. The code that was identified as problematic was removed, as it was determined that checking the algorithm names in that location was not needed.