ReactOS 0.4.17-dev-1005-g171e1de
hmacsha512.c
Go to the documentation of this file.
1//
2// HmacSha512.c
3//
4// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5//
6
7#include "precomp.h"
8
9#define ALG SHA512
10#define Alg Sha512
11#define SET_DATALENGTH( state, len ) {state.dataLengthL = len; state.dataLengthH = 0;}
12#include "hmac_pattern.c"
13#undef SET_DATALENGTH
14#undef Alg
15#undef ALG
16
27};
28
30
31static const BYTE hmacSha512Kat[64] = {
32 0x07, 0x64, 0xa6, 0x58, 0xeb, 0x3e, 0x2f, 0xb0, 0x2c, 0x06, 0x72, 0x93, 0xcd, 0xaa, 0x3c, 0x05,
33 0x28, 0x73, 0x15, 0xf2, 0xd3, 0xb4, 0x5a, 0x28, 0x10, 0x20, 0x1e, 0x26, 0xc3, 0x89, 0x35, 0x48,
34 0xe9, 0xea, 0xca, 0x72, 0xf0, 0x2e, 0x04, 0x19, 0x20, 0x31, 0x71, 0x68, 0xb5, 0x7a, 0x86, 0x40,
35 0x29, 0x1b, 0x3b, 0xb7, 0xaa, 0x4a, 0x5f, 0xaf, 0x80, 0x26, 0xb4, 0xad, 0x23, 0x5a, 0xc4, 0x25,
36};
37
38
39VOID
42{
45
48
49 SymCryptInjectError( res, sizeof( res ) );
50 if( memcmp( res, hmacSha512Kat, sizeof( res ) ) != 0 )
51 {
52 SymCryptFatal( 'hsh5' );
53 }
54
55 //
56 // Normally we would wipe the expanded key structure here,
57 // but as this is a selftest with known data this is not needed.
58 //
59}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLuint res
Definition: glext.h:9613
const PCSYMCRYPT_MAC SymCryptHmacSha512Algorithm
Definition: hmacsha512.c:29
VOID SYMCRYPT_CALL SymCryptHmacSha512Selftest(void)
Definition: hmacsha512.c:41
const SYMCRYPT_MAC SymCryptHmacSha512Algorithm_default
Definition: hmacsha512.c:17
static const BYTE hmacSha512Kat[64]
Definition: hmacsha512.c:31
VOID SYMCRYPT_CALL SymCryptInjectError(PBYTE pbData, SIZE_T cbData)
const BYTE SymCryptTestKey32[32]
Definition: selftest.c:10
const BYTE SymCryptTestMsg3[3]
Definition: selftest.c:8
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
VOID SYMCRYPT_CALL SymCryptHmacSha512(_In_ PCSYMCRYPT_HMAC_SHA512_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA512_RESULT_SIZE) PBYTE pbResult)
VOID SYMCRYPT_CALL SymCryptHmacSha512Append(_Inout_ PSYMCRYPT_HMAC_SHA512_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha512ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA512_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
VOID SYMCRYPT_CALL SymCryptHmacSha512Init(_Out_ PSYMCRYPT_HMAC_SHA512_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA512_EXPANDED_KEY pExpandedKey)
VOID SYMCRYPT_CALL SymCryptHmacSha512Result(_Inout_ PSYMCRYPT_HMAC_SHA512_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA512_RESULT_SIZE) PBYTE pbResult)
#define SYMCRYPT_HMAC_SHA512_RESULT_SIZE
Definition: symcrypt.h:2984
const PCSYMCRYPT_HASH SymCryptSha512Algorithm
Definition: sha512.c:170
#define SYMCRYPT_CALL
SYMCRYPT_MD5_CHAINING_STATE outerState
#define SYMCRYPT_FIELD_OFFSET(type, field)
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA512_EXPANDED_KEY
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA512_STATE
unsigned char BYTE
Definition: xxhash.c:193