ReactOS 0.4.17-dev-1005-g171e1de
hmacsha3_384.c
Go to the documentation of this file.
1//
2// HmacSha3_256.c
3//
4// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5//
6
7#include "precomp.h"
8
15{
17}
18
19VOID
24{
25 SymCryptHmacKeyCopy(&pSrc->generic, &pDst->generic);
26}
27
28VOID
35{
37}
38
39VOID
45{
46 SymCryptHmacStateCopy(&pSrc->generic, pExpandedKey == NULL ? NULL : &pExpandedKey->generic, &pDst->generic);
47}
48
49VOID
54{
55 SymCryptHmacInit(&pState->generic, &pExpandedKey->generic);
56}
57
58VOID
64{
66}
67
68VOID
73{
75}
76
77
88};
89
91
92
93static const BYTE hmacSha3_384Kat[48] =
94{
95 0x8f, 0xc4, 0x8a, 0x84, 0xb5, 0xa7, 0xa1, 0x36,
96 0x3c, 0x3b, 0x4b, 0x21, 0x3c, 0xfb, 0x65, 0x36,
97 0xa6, 0x2b, 0xa3, 0x4c, 0x12, 0x33, 0xa1, 0x27,
98 0xbc, 0xfc, 0xb2, 0xd7, 0xae, 0xaf, 0x30, 0x6b,
99 0xc9, 0xe6, 0x90, 0xfd, 0xf1, 0xfa, 0x12, 0x61,
100 0xa4, 0x7e, 0xb2, 0x27, 0x1a, 0xeb, 0xf1, 0x34
101};
102
103VOID
106{
109
112
113 SymCryptInjectError( res, sizeof( res ) );
114
115 if( memcmp( res, hmacSha3_384Kat, sizeof( res ) ) != 0 )
116 {
117 SymCryptFatal( 'hsh3' );
118 }
119
120 //
121 // Normally we would wipe the expanded key structure here,
122 // but as this is a selftest with known data this is not needed.
123 //
124}
#define NULL
Definition: types.h:112
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLuint res
Definition: glext.h:9613
const SYMCRYPT_MAC SymCryptHmacSha3_384Algorithm_default
Definition: hmacsha3_384.c:78
VOID SYMCRYPT_CALL SymCryptHmacSha3_384Append(_Inout_ PSYMCRYPT_HMAC_SHA3_384_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
Definition: hmacsha3_384.c:60
VOID SYMCRYPT_CALL SymCryptHmacSha3_384Init(_Out_ PSYMCRYPT_HMAC_SHA3_384_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pExpandedKey)
Definition: hmacsha3_384.c:51
const PCSYMCRYPT_MAC SymCryptHmacSha3_384Algorithm
Definition: hmacsha3_384.c:90
static const BYTE hmacSha3_384Kat[48]
Definition: hmacsha3_384.c:93
VOID SYMCRYPT_CALL SymCryptHmacSha3_384KeyCopy(_In_ PCSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pSrc, _Out_ PSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pDst)
Definition: hmacsha3_384.c:21
VOID SYMCRYPT_CALL SymCryptHmacSha3_384Result(_Inout_ PSYMCRYPT_HMAC_SHA3_384_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA3_384_RESULT_SIZE) PBYTE pbResult)
Definition: hmacsha3_384.c:70
VOID SYMCRYPT_CALL SymCryptHmacSha3_384StateCopy(_In_ PCSYMCRYPT_HMAC_SHA3_384_STATE pSrc, _In_opt_ PCSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pExpandedKey, _Out_ PSYMCRYPT_HMAC_SHA3_384_STATE pDst)
Definition: hmacsha3_384.c:41
VOID SYMCRYPT_CALL SymCryptHmacSha3_384(_In_ PCSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA3_384_RESULT_SIZE) PBYTE pbResult)
Definition: hmacsha3_384.c:30
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_384ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
Definition: hmacsha3_384.c:11
VOID SYMCRYPT_CALL SymCryptHmacSha3_384Selftest(void)
Definition: hmacsha3_384.c:105
#define _In_reads_(s)
Definition: no_sal2.h:168
#define _Inout_
Definition: no_sal2.h:162
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _Out_
Definition: no_sal2.h:160
#define _In_reads_opt_(s)
Definition: no_sal2.h:222
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
@ generic
Definition: optimize.h:97
BYTE * PBYTE
Definition: pedump.c:66
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
static const BYTE pbResult[]
SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptHmacResult(_Inout_ PSYMCRYPT_HMAC_STATE pState, _Out_writes_(pState->pKey->pHash->resultSize) PBYTE pbResult)
Definition: hmac.c:141
const PCSYMCRYPT_HASH SymCryptSha3_384Algorithm
Definition: sha3_384.c:27
VOID SYMCRYPT_CALL SymCryptHmacKeyCopy(_In_ PCSYMCRYPT_HMAC_EXPANDED_KEY pSrc, _Out_ PSYMCRYPT_HMAC_EXPANDED_KEY pDst)
Definition: hmac.c:36
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
VOID SYMCRYPT_CALL SymCryptHmacAppend(_Inout_ PSYMCRYPT_HMAC_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
Definition: hmac.c:130
VOID SYMCRYPT_CALL SymCryptHmacStateCopy(_In_ PCSYMCRYPT_HMAC_STATE pSrc, _In_opt_ PCSYMCRYPT_HMAC_EXPANDED_KEY pExpandedKey, _Out_ PSYMCRYPT_HMAC_STATE pDst)
Definition: hmac.c:10
#define SYMCRYPT_HMAC_SHA3_384_RESULT_SIZE
Definition: symcrypt.h:3310
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacExpandKey(_In_ PCSYMCRYPT_HASH pHash, _Out_ PSYMCRYPT_HMAC_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
Definition: hmac.c:53
SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptHmacInit(_Out_ PSYMCRYPT_HMAC_STATE pState, _In_ PCSYMCRYPT_HMAC_EXPANDED_KEY pExpandedKey)
Definition: hmac.c:115
SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptHmac(_In_ PCSYMCRYPT_HMAC_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(pExpandedKey->pHash->resultSize) PBYTE pbResult)
Definition: hmac.c:184
SYMCRYPT_ERROR
Definition: symcrypt.h:227
#define SYMCRYPT_CALL
* PSYMCRYPT_HMAC_SHA3_384_STATE
PCBYTE pbKey
SYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY
PCBYTE SIZE_T cbKey
const SYMCRYPT_HMAC_SHA3_384_STATE * PCSYMCRYPT_HMAC_SHA3_384_STATE
PCBYTE PBYTE SIZE_T cbData
#define SYMCRYPT_FIELD_OFFSET(type, field)
SYMCRYPT_HMAC_SHA3_384_STATE
PSYMCRYPT_COMMON_HASH_STATE pState
const BYTE * PCBYTE
PCBYTE pbData
const SYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY * PCSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY
* PSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY
PCVOID pExpandedKey
ULONG_PTR SIZE_T
Definition: typedefs.h:80
unsigned char BYTE
Definition: xxhash.c:193