ReactOS 0.4.17-dev-1005-g171e1de
hmacsha224.c
Go to the documentation of this file.
1//
2// HmacSha224.c
3//
4// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5//
6
7#include "precomp.h"
8
9#define SymCryptSha224AppendBlocks SymCryptSha256AppendBlocks
10
11#define ALG SHA224
12#define Alg Sha224
13#define SET_DATALENGTH( state, len ) {state.dataLengthL = len;}
14#include "hmac_pattern.c"
15#undef SET_DATALENGTH
16#undef Alg
17#undef ALG
18
29};
30
32
33static const BYTE hmacSha224Kat[28] = {
34 0x3e, 0x1c, 0x48, 0x2f, 0x66, 0x49, 0x67, 0xa9,
35 0xad, 0x4f, 0x76, 0x52, 0x36, 0xf8, 0x5a, 0x1f,
36 0x63, 0x5b, 0x34, 0xe9, 0x35, 0x71, 0x62, 0x35,
37 0xa2, 0x9e, 0x61, 0xb1
38};
39
40
41VOID
44{
47
50
51 SymCryptInjectError( res, sizeof( res ) );
52
53 if( memcmp( res, hmacSha224Kat, 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 SYMCRYPT_MAC SymCryptHmacSha224Algorithm_default
Definition: hmacsha224.c:19
const PCSYMCRYPT_MAC SymCryptHmacSha224Algorithm
Definition: hmacsha224.c:31
static const BYTE hmacSha224Kat[28]
Definition: hmacsha224.c:33
VOID SYMCRYPT_CALL SymCryptHmacSha224Selftest(void)
Definition: hmacsha224.c:43
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
#define SYMCRYPT_HMAC_SHA224_RESULT_SIZE
Definition: symcrypt.h:2792
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha224ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA224_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
VOID SYMCRYPT_CALL SymCryptHmacSha224Append(_Inout_ PSYMCRYPT_HMAC_SHA224_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
const PCSYMCRYPT_HASH SymCryptSha224Algorithm
Definition: sha256.c:45
VOID SYMCRYPT_CALL SymCryptHmacSha224Result(_Inout_ PSYMCRYPT_HMAC_SHA224_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA224_RESULT_SIZE) PBYTE pbResult)
VOID SYMCRYPT_CALL SymCryptHmacSha224Init(_Out_ PSYMCRYPT_HMAC_SHA224_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA224_EXPANDED_KEY pExpandedKey)
VOID SYMCRYPT_CALL SymCryptHmacSha224(_In_ PCSYMCRYPT_HMAC_SHA224_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA224_RESULT_SIZE) PBYTE pbResult)
#define SYMCRYPT_CALL
SYMCRYPT_MD5_CHAINING_STATE outerState
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA224_STATE
#define SYMCRYPT_FIELD_OFFSET(type, field)
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA224_EXPANDED_KEY
unsigned char BYTE
Definition: xxhash.c:193