-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add ChaCha20Poly1305 skeleton #52030
Add ChaCha20Poly1305 skeleton #52030
Conversation
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks Issue DetailsContributes to #45130. This adds the skeleton ChaCha20Poly1305 API and hooks up support on Win10. The basic structure for adding non-Windows support is also present. I can't test that right now (so I didn't try), but some enterprising individual may be able to do it in a followup PR with minimal effort. There are a few other changes here:
Marking draft since I want to ensure the general structure is acceptable before I march forward. I leave it to the discretion of the product group at large as to whether non-Windows support should come in a followup PR or whether this should be handed off to somebody else to put the finishing touches. This PR is currently blocked on dotnet/arcade#7316, which causes the Browser target to fail to compile.
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to 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. |
I can commit time to implement the OpenSSL side if desired. Though, it may be best to wait until the OpenSSL 3 work is complete. |
...s/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Browser.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/BCrypt/AEADBCryptHandles.cs
Outdated
Show resolved
Hide resolved
...stem.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AEADCommon.Windows.cs
Outdated
Show resolved
Hide resolved
...s/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Windows.cs
Outdated
Show resolved
Hide resolved
....Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.NotImplemented.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs
Outdated
Show resolved
Hide resolved
new AEADTest | ||
{ | ||
Source = Rfc8439TestVectors, | ||
CaseId = 1, |
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.
Since at least cases 1 and 2 aren't from the same section, it'd be nice to link to the places they came from in a comment.
I think the second is https://tools.ietf.org/html/rfc8439#appendix-A.5, and the first is https://tools.ietf.org/html/rfc8439#section-2.4.2
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.
Sure. BTW if you have any other ideas for where I can find test vectors, I'm all ears. The RFC isn't exactly flush with them. :/
For reference, symcrypt uses its own test vectors.
src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs
Outdated
Show resolved
Hide resolved
...System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.cs
Outdated
Show resolved
Hide resolved
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.
Some naming, style, and test nits... but overall looks reasonable.
Note: I've temporarily updated the GenFacades package (see 498dde9) because it contains a fix required for this to build on browser. This is just to make CI happy during development. Once Maestro slurps up the fixed GenFacades package and commits it, this PR will experience a merge conflict, and I can drop our local changes to the versions.props file to resolve the conflict. |
Next iteration will revert the GenFacades change now that maestro has updated our dependencies. |
Contributes to #45130.
This adds the skeleton ChaCha20Poly1305 API and hooks up support on Win10. The basic structure for adding non-Windows support is also present. I can't test that right now (so I didn't try), but some enterprising individual may be able to do it in a followup PR with minimal effort.
There are a few other changes here:
IsSupported
APIs toAesGcm
andAesCcm
and hooked up unit tests for them.The unit tests are based off the
AesGcm
andAesCcm
tests. The expected tag and ciphertext const values were generated from a C++ program targeting the Win32 APIs directly.Marking draft since I want to ensure the general structure is acceptable before I march forward. I leave it to the discretion of the product group at large as to whether non-Windows support should come in a followup PR or whether this should be handed off to somebody else to put the finishing touches.
This PR is currently blocked on dotnet/arcade#7316, which causes the Browser target to fail to compile.