Repository navigation
Use correct data types for DWORD - #78
Merged
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
alexherrero
self-requested a review
June 13, 2025 23:02
alexherrero
approved these changes
Jun 13, 2025
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.
Currently, the code reads a property that is supposed to be a DWORD (ref: https://learn.microsoft.com/en-us/windows/win32/seccng/key-storage-property-identifiers#ncrypt_impl_type_property) using a cast to a golang
intbut those are only guaranteed to be "at least" 32 bits. This caused an issue where it was actually reading a 64-bit value and thus setting the upper 32 bits to undefined data.This int/uint32 inconsistency is present in the "Chain resolution constants" as well (and possible elsewhere) but I didn't touch them in this PR.
This was then combined with the fact that the
nCryptImplSoftwareFlagis compared using==and not with a mask, which would be more proper for a flag, caused the condition to incorrectly be evaluated to false.I have changed the reading of the property to be a uint32 to match the spec. I changed the name of the reading function since it was only ever used there anyway and now it's clearer. I also changed the comparison to treat the field as a flag.