On Tue, 2016-03-22 at 07:50 -0700, Patrick Armstrong wrote:
+NTSTATUS WINAPI BCryptHash( BCRYPT_ALG_HANDLE algorithm, UCHAR *secret, ULONG secretlen,
UCHAR *input, ULONG inputlen, UCHAR *output, ULONG outputlen )
+{
- NTSTATUS status;
- BCRYPT_HASH_HANDLE handle;
- TRACE( "%p, %p, %u, %p, %u, %p, %u\n", algorithm, secret, secretlen,
input, inputlen, output, outputlen );
- status = BCryptCreateHash( algorithm, &handle, NULL, 0, secret, secretlen, 0);
- if (status != STATUS_SUCCESS)
- {
BCryptDestroyHash( handle );
return status;
- }
BCryptCreateHash doesn't return a handle when it fails.
NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG); NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE); +NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG); NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG); NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
While you're at it, please keep these sorted.