Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions google/cloud/internal/sha256_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ namespace {
Sha256Type Sha256Hash(void const* data, std::size_t count) {
Sha256Type hash;
#ifdef _WIN32
// Workaround missing macros in MinGW-w64:
// https://github.com/mingw-w64/mingw-w64/issues/49
#ifndef BCRYPT_SHA256_ALG_HANDLE
#define BCRYPT_SHA256_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x00000041)
#endif
BCryptHash(BCRYPT_SHA256_ALG_HANDLE, nullptr, 0,
static_cast<PUCHAR>(const_cast<void*>(data)),
static_cast<ULONG>(count), hash.data(),
Expand Down
5 changes: 5 additions & 0 deletions google/cloud/internal/sha256_hmac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Sha256Type Sha256HmacImpl(absl::Span<T const> key, unsigned char const* data,
std::size_t count) {
Sha256Type hash;
#ifdef _WIN32
// Workaround missing macros in MinGW-w64:
// https://github.com/mingw-w64/mingw-w64/issues/49
#ifndef BCRYPT_HMAC_SHA256_ALG_HANDLE
#define BCRYPT_HMAC_SHA256_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x000000b1)
#endif
BCryptHash(BCRYPT_HMAC_SHA256_ALG_HANDLE,
reinterpret_cast<PUCHAR>(const_cast<T*>(key.data())),
static_cast<ULONG>(key.size()), const_cast<PUCHAR>(data),
Expand Down