-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
HashAlgorithmName one-shots #92430
HashAlgorithmName one-shots #92430
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones Issue DetailsThis implements CryptographicOperations.{HashData,HmacData} and removes out internal helper in favor of using the public one. Closes #91407.
|
@@ -15,9 +15,11 @@ public class HmacMD5Tests : Rfc2202HmacTests<HmacMD5Tests.Traits> | |||
public sealed class Traits : IHmacTrait | |||
{ | |||
public static bool IsSupported => true; | |||
public static int HashSizeInBytes => HMACSHA1.HashSizeInBytes; | |||
public static int HashSizeInBytes => HMACMD5.HashSizeInBytes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned out to be a mistake in our HMACMD5 tests but it went unnoticed because the value is only used for "create a buffer that is at least large enough". LEN(SHA1) > LEN(MD5) so it happened to work. But let's fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HmacTests
are in desperate need of some refactoring and love in my opinion. I will look at that hopefully sometime for .NET 9. I would like to re-model the tests similarly to how we did SHAKE.
For now though, I decided to keep the changes small so as to not make too many test changes at the same time as product changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though the implementation is on CryptographicOperations
, the tests are all part of the hashing / HMAC testing infrastructure. Otherwise we would be duplicating a lot of additional test logic, KATs, etc.
These native AOT outerloop checks looks like they ran errantly according to #92432, so though they are failing, I marked this ready for review. |
...ies/System.Security.Cryptography/src/System/Security/Cryptography/CryptographicOperations.cs
Show resolved
Hide resolved
Also change the variable name for the hash length to be consistent accross all methods.
Thanks. |
This implements CryptographicOperations.{HashData,HmacData} and removes our internal helper in favor of using the public one.
Closes #91407.