MCPcopy Create free account
hub / github.com/Chuyu-Team/YY-Thunks / CreateHash

Method CreateHash

src/Thunks/bcrypt.hpp:1041–1086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1039
1040
1041 NTSTATUS
1042 WINAPI
1043 CreateHash(
1044 _Outptr_ BCryptHash** ppHash,
1045 _Out_writes_bytes_all_opt_(cbHashObject) PUCHAR pbHashObject,
1046 _In_ ULONG cbHashObject,
1047 _In_reads_bytes_opt_(cbSecret) PUCHAR pbSecret, // optional
1048 _In_ ULONG cbSecret, // optional
1049 _In_ ULONG dwFlags)
1050 {
1051 BCryptHash* _pBCryptHash = reinterpret_cast<BCryptHash*>(pbHashObject);
1052 if (_pBCryptHash)
1053 {
1054 if (cbHashObject < sizeof(BCryptHash))
1055 {
1056 return STATUS_BUFFER_TOO_SMALL;
1057 }
1058
1059 new (_pBCryptHash) BCryptHash(this);
1060 _pBCryptHash->bCanFree = false;
1061 }
1062 else
1063 {
1064 if (cbHashObject != 0)
1065 {
1066 return STATUS_INVALID_PARAMETER;
1067 }
1068 const auto _hProcessHeap = ((TEB*)NtCurrentTeb())->ProcessEnvironmentBlock->ProcessHeap;
1069 _pBCryptHash = (BCryptHash*)HeapAlloc(_hProcessHeap, 0, sizeof(BCryptHash));
1070 if (!_pBCryptHash)
1071 {
1072 return STATUS_NO_MEMORY;
1073 }
1074
1075 new (_pBCryptHash) BCryptHash(this);
1076 }
1077
1078 auto _Status = _pBCryptHash->Init(pbSecret, cbSecret, dwFlags);
1079 if (_Status)
1080 {
1081 _pBCryptHash->Release();
1082 return _Status;
1083 }
1084 *ppHash = _pBCryptHash;
1085 return STATUS_SUCCESS;
1086 }
1087 };
1088
1089 struct BCryptRngAlgorithm : public BCryptAlgorithm

Callers

nothing calls this directly

Calls 2

InitMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected