Implement safe wrappers for GCM incremental APIs #84
Open
jacsmi-msft wants to merge 6 commits intomicrosoft:mainfrom
Open
Implement safe wrappers for GCM incremental APIs #84jacsmi-msft wants to merge 6 commits intomicrosoft:mainfrom
jacsmi-msft wants to merge 6 commits intomicrosoft:mainfrom
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Changes:
This PR implements safe wrappers for the GCM incremental APIs:
SymCryptGcmAuthPartSymCryptGcmDecryptPartSymCryptGcmDecryptFinalSymCryptGcmEncryptPartSymCryptGcmEncryptFinalThe new public types are:
GcmUninitializedKey- Represents storage for an uninitializedSYMCRYPT_GCM_EXPANDED_KEYGcmExpandedKeyHandle- Wraps an&mut GcmExpandedKeyStoragewith the guarantee that theSYMCRYPT_GCM_EXPANDED_KEYis initialized and that it is zeroed on drop.GcmExpandedKeyRef- Wraps an&GcmExpandedKeyStoragewith the guarantee that theSYMCRYPT_GCM_EXPANDED_KEYis initialized.GcmStream- Represents an uninitializedSYMCRYPT_GCM_STATEGcmAuthStream- Represents an initializedSYMCRYPT_GCM_STATEthat can be used for authenticating dataGcmAuthStreamRefMut- Roughly equivalent to an&mut GcmAuthStream, but removes a layer of indirectionGcmDecryptionStream- Represents an initializedSYMCRYPT_GCM_STATEthat can be used to decrypt dataGcmDecryptionStreamRefMut- Roughly equivalent to an&mut GcmDecryptionStream, but removes a layer of indirectionGcmEncryptionStream- Represents an initializedSYMCRYPT_GCM_STATEthat can be used to encrypt dataGcmEncryptionStreamRefMut- Roughly equivalent to an&mut GcmEncryptionStream, but removes a layer of indirectionThe new internal types are:
GcmInitializedStream- Wraps an&mut GcmStreamwith the additional guarantee that theSYMCRYPT_GCM_STATEis initialized and zeroed on drop.GcmInitializedStreamRefMut- Wraps an&mut GcmStreamwith the additional guarantee that theSYMCRYPT_GCM_STATEis initialized, but not zeroed on drop.Next steps are to introduce an
stdfeature so that this crate can be used in ano-stdenvironment. All of the new types should beno-stdcompatible. This will likely be in a different PR though.Breaking Changes if any:
This should not contain any breaking changes for users of the existing non-incremental API wrappers.
✅ Admin Checklist
cargo test --all-featuresonWindowsandWSL.Check the Developer Guidelines in DEVELOPER.md for more info.