Skip to content
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

MemorySize attribute missing on BCryptGenerateSymmetricKey #1010

Closed
kennykerr opened this issue Jul 26, 2022 · 0 comments · Fixed by #1016
Closed

MemorySize attribute missing on BCryptGenerateSymmetricKey #1010

kennykerr opened this issue Jul 26, 2022 · 0 comments · Fixed by #1016
Labels
bug Something isn't working

Comments

@kennykerr
Copy link
Contributor

Looks like another SAL annotation parsing issue. The function is declared as follows:

_Must_inspect_result_
NTSTATUS
WINAPI
BCryptGenerateSymmetricKey(
    _Inout_                             BCRYPT_ALG_HANDLE   hAlgorithm,
    _Out_                               BCRYPT_KEY_HANDLE   *phKey,
    _Out_writes_bytes_all_opt_(cbKeyObject)  PUCHAR   pbKeyObject,
    _In_                                ULONG   cbKeyObject,
    _In_reads_bytes_(cbSecret)               PUCHAR   pbSecret,
    _In_                                ULONG   cbSecret,
    _In_                                ULONG   dwFlags);

But the expected MemorySize attribute is missing from the pbKeyObject parameter:

[DllImport("bcrypt", ExactSpelling = true, PreserveSig = false)]
[SupportedOSPlatform("windows6.0.6000")]
public unsafe static extern NTSTATUS BCryptGenerateSymmetricKey([In] BCRYPT_ALG_HANDLE hAlgorithm, [Out] BCRYPT_KEY_HANDLE* phKey, [Optional][Out] byte* pbKeyObject, [In] uint cbKeyObject, [In][MemorySize(BytesParamIndex = 5)] byte* pbSecret, [In] uint cbSecret, [In] uint dwFlags);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants