ReactOS 0.4.17-dev-1005-g171e1de
hmacsha384.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 SymCryptSha384AppendBlocks SymCryptSha512AppendBlocks
10
11#define ALG SHA384
12#define Alg Sha384
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 hmacSha384Kat[48] = {
34 0x67, 0xdb, 0x9d, 0x4d, 0x66, 0xed, 0xf2, 0xe7, 0x2b, 0x88, 0xb8, 0x50, 0x55, 0x68, 0xa0, 0x00,
35 0xa9, 0x83, 0x2b, 0xa3, 0x5e, 0x4f, 0xde, 0xcf, 0xe5, 0x38, 0x9a, 0x5d, 0x92, 0x79, 0x81, 0x53,
36 0x6d, 0xdb, 0x94, 0xc0, 0xf6, 0xc0, 0xbd, 0x94, 0xc4, 0x18, 0x96, 0x4b, 0xbe, 0x4b, 0x6c, 0xf2,
37};
38
39VOID
42{
45
48
49 SymCryptInjectError( res, sizeof( res ) );
50 if( memcmp( res, hmacSha384Kat, sizeof( res ) ) != 0 )
51 {
52 SymCryptFatal( 'hsh3' );
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
static const BYTE hmacSha384Kat[48]
Definition: hmacsha384.c:33
const PCSYMCRYPT_MAC SymCryptHmacSha384Algorithm
Definition: hmacsha384.c:31
VOID SYMCRYPT_CALL SymCryptHmacSha384Selftest(void)
Definition: hmacsha384.c:41
const SYMCRYPT_MAC SymCryptHmacSha384Algorithm_default
Definition: hmacsha384.c:19
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
VOID SYMCRYPT_CALL SymCryptHmacSha384Result(_Inout_ PSYMCRYPT_HMAC_SHA384_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA384_RESULT_SIZE) PBYTE pbResult)
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha384ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA384_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
VOID SYMCRYPT_CALL SymCryptHmacSha384(_In_ PCSYMCRYPT_HMAC_SHA384_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA384_RESULT_SIZE) PBYTE pbResult)
const PCSYMCRYPT_HASH SymCryptSha384Algorithm
Definition: sha512.c:169
#define SYMCRYPT_HMAC_SHA384_RESULT_SIZE
Definition: symcrypt.h:2920
VOID SYMCRYPT_CALL SymCryptHmacSha384Append(_Inout_ PSYMCRYPT_HMAC_SHA384_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
VOID SYMCRYPT_CALL SymCryptHmacSha384Init(_Out_ PSYMCRYPT_HMAC_SHA384_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA384_EXPANDED_KEY pExpandedKey)
#define SYMCRYPT_CALL
SYMCRYPT_MD5_CHAINING_STATE outerState
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA384_STATE
#define SYMCRYPT_FIELD_OFFSET(type, field)
SYMCRYPT_MAGIC_FIELD SYMCRYPT_HMAC_SHA384_EXPANDED_KEY
unsigned char BYTE
Definition: xxhash.c:193