ReactOS 0.4.17-dev-1005-g171e1de
hmacsha512_256.c
Go to the documentation of this file.
1//
2// HmacSha512_256.c
3//
4// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5//
6
7#include "precomp.h"
8
9#define SymCryptSha512_256AppendBlocks SymCryptSha512AppendBlocks
10
11#define ALG SHA512_256
12#define Alg Sha512_256
13#define SET_DATALENGTH( state, len ) {state.dataLengthL = len; state.dataLengthH = 0;}
14#include "hmac_pattern.c"
15#undef SET_DATALENGTH
16#undef Alg
17#undef ALG
18
29};
30
32
33static const BYTE hmacSha512_256Kat[32] = {
34 0x79, 0x44, 0xb9, 0x97, 0xc0, 0xaa, 0xf7, 0x11,
35 0xdd, 0xb3, 0x78, 0x60, 0x68, 0xdb, 0x2b, 0xa1,
36 0x40, 0x80, 0x4f, 0xdc, 0xb7, 0x02, 0x7b, 0x6a,
37 0xe9, 0x9f, 0x5a, 0x38, 0xc8, 0x28, 0x67, 0x4c
38};
39
40
41VOID
44{
47
50
51 SymCryptInjectError( res, sizeof( res ) );
52
53 if( memcmp( res, hmacSha512_256Kat, sizeof( res ) ) != 0 )
54 {
55 SymCryptFatal( 'hsh4' );
56 }
57
58 //
59 // Normally we would wipe the expanded key structure here,
60 // but as this is a selftest with known data this is not needed.
61 //
62}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLuint res
Definition: glext.h:9613
const PCSYMCRYPT_MAC SymCryptHmacSha512_256Algorithm
VOID SYMCRYPT_CALL SymCryptHmacSha512_256Selftest(void)
static const BYTE hmacSha512_256Kat[32]
const SYMCRYPT_MAC SymCryptHmacSha512_256Algorithm_default
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
const PCSYMCRYPT_HASH SymCryptSha512_256Algorithm
Definition: sha512.c:172
VOID SYMCRYPT_CALL SymCryptHmacSha512_256(_In_ PCSYMCRYPT_HMAC_SHA512_256_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA512_256_RESULT_SIZE) PBYTE pbResult)
VOID SYMCRYPT_CALL SymCryptHmacSha512_256Append(_Inout_ PSYMCRYPT_HMAC_SHA512_256_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha512_256ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA512_256_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
VOID SYMCRYPT_CALL SymCryptHmacSha512_256Result(_Inout_ PSYMCRYPT_HMAC_SHA512_256_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA512_256_RESULT_SIZE) PBYTE pbResult)
VOID SYMCRYPT_CALL SymCryptHmacSha512_256Init(_Out_ PSYMCRYPT_HMAC_SHA512_256_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA512_256_EXPANDED_KEY pExpandedKey)
#define SYMCRYPT_HMAC_SHA512_256_RESULT_SIZE
Definition: symcrypt.h:3116
#define SYMCRYPT_CALL
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA512_256_EXPANDED_KEY
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA512_256_STATE
SYMCRYPT_MD5_CHAINING_STATE outerState
#define SYMCRYPT_FIELD_OFFSET(type, field)
unsigned char BYTE
Definition: xxhash.c:193