ReactOS 0.4.17-dev-1005-g171e1de
hmacsha3_256.c File Reference
#include "precomp.h"
Include dependency graph for hmacsha3_256.c:

Go to the source code of this file.

Functions

SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_256ExpandKey (_Out_ PSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256KeyCopy (_In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pSrc, _Out_ PSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pDst)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256 (_In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA3_256_RESULT_SIZE) PBYTE pbResult)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256StateCopy (_In_ PCSYMCRYPT_HMAC_SHA3_256_STATE pSrc, _In_opt_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _Out_ PSYMCRYPT_HMAC_SHA3_256_STATE pDst)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Init (_Out_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Append (_Inout_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Result (_Inout_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA3_256_RESULT_SIZE) PBYTE pbResult)
 
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Selftest (void)
 

Variables

const SYMCRYPT_MAC SymCryptHmacSha3_256Algorithm_default
 
const PCSYMCRYPT_MAC SymCryptHmacSha3_256Algorithm = &SymCryptHmacSha3_256Algorithm_default
 
static const BYTE hmacSha3_256Kat [32]
 

Function Documentation

◆ SymCryptHmacSha3_256()

Definition at line 30 of file hmacsha3_256.c.

35{
37}
static const BYTE pbResult[]
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
PCBYTE PBYTE SIZE_T cbData
PCBYTE pbData
PCVOID pExpandedKey

Referenced by SymCryptHmacSha3_256Selftest().

◆ SymCryptHmacSha3_256Append()

VOID SYMCRYPT_CALL SymCryptHmacSha3_256Append ( _Inout_ PSYMCRYPT_HMAC_SHA3_256_STATE  pState,
_In_reads_(cbData) PCBYTE  pbData,
SIZE_T  cbData 
)

Definition at line 60 of file hmacsha3_256.c.

64{
66}
VOID SYMCRYPT_CALL SymCryptHmacAppend(_Inout_ PSYMCRYPT_HMAC_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
Definition: hmac.c:130
PSYMCRYPT_COMMON_HASH_STATE pState

◆ SymCryptHmacSha3_256ExpandKey()

SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_256ExpandKey ( _Out_ PSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY  pExpandedKey,
_In_reads_opt_(cbKey) PCBYTE  pbKey,
SIZE_T  cbKey 
)

Definition at line 11 of file hmacsha3_256.c.

15{
17}
const PCSYMCRYPT_HASH SymCryptSha3_256Algorithm
Definition: sha3_256.c:27
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
PCBYTE pbKey
PCBYTE SIZE_T cbKey

Referenced by SymCryptHmacSha3_256Selftest().

◆ SymCryptHmacSha3_256Init()

VOID SYMCRYPT_CALL SymCryptHmacSha3_256Init ( _Out_ PSYMCRYPT_HMAC_SHA3_256_STATE  pState,
_In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY  pExpandedKey 
)

Definition at line 51 of file hmacsha3_256.c.

54{
55 SymCryptHmacInit(&pState->generic, &pExpandedKey->generic);
56}
SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptHmacInit(_Out_ PSYMCRYPT_HMAC_STATE pState, _In_ PCSYMCRYPT_HMAC_EXPANDED_KEY pExpandedKey)
Definition: hmac.c:115

◆ SymCryptHmacSha3_256KeyCopy()

Definition at line 21 of file hmacsha3_256.c.

24{
25 SymCryptHmacKeyCopy(&pSrc->generic, &pDst->generic);
26}
VOID SYMCRYPT_CALL SymCryptHmacKeyCopy(_In_ PCSYMCRYPT_HMAC_EXPANDED_KEY pSrc, _Out_ PSYMCRYPT_HMAC_EXPANDED_KEY pDst)
Definition: hmac.c:36

◆ SymCryptHmacSha3_256Result()

Definition at line 70 of file hmacsha3_256.c.

73{
75}
SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptHmacResult(_Inout_ PSYMCRYPT_HMAC_STATE pState, _Out_writes_(pState->pKey->pHash->resultSize) PBYTE pbResult)
Definition: hmac.c:141

◆ SymCryptHmacSha3_256Selftest()

VOID SYMCRYPT_CALL SymCryptHmacSha3_256Selftest ( void  )

Definition at line 103 of file hmacsha3_256.c.

104{
107
110
111 SymCryptInjectError( res, sizeof( res ) );
112
113 if( memcmp( res, hmacSha3_256Kat, sizeof( res ) ) != 0 )
114 {
115 SymCryptFatal( 'hsh3' );
116 }
117
118 //
119 // Normally we would wipe the expanded key structure here,
120 // but as this is a selftest with known data this is not needed.
121 //
122}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLuint res
Definition: glext.h:9613
VOID SYMCRYPT_CALL SymCryptHmacSha3_256(_In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData, _Out_writes_(SYMCRYPT_HMAC_SHA3_256_RESULT_SIZE) PBYTE pbResult)
Definition: hmacsha3_256.c:30
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_256ExpandKey(_Out_ PSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE pbKey, SIZE_T cbKey)
Definition: hmacsha3_256.c:11
static const BYTE hmacSha3_256Kat[32]
Definition: hmacsha3_256.c:93
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_SHA3_256_RESULT_SIZE
Definition: symcrypt.h:3246
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
SYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY
unsigned char BYTE
Definition: xxhash.c:193

◆ SymCryptHmacSha3_256StateCopy()

Definition at line 41 of file hmacsha3_256.c.

45{
46 SymCryptHmacStateCopy(&pSrc->generic, pExpandedKey == NULL ? NULL : &pExpandedKey->generic, &pDst->generic);
47}
#define NULL
Definition: types.h:112
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

Variable Documentation

◆ hmacSha3_256Kat

const BYTE hmacSha3_256Kat[32]
static
Initial value:
=
{
0x18, 0xe8, 0x2e, 0xa4, 0x5a, 0x94, 0x07, 0xcc,
0xb7, 0x87, 0x29, 0x16, 0x80, 0x99, 0xd6, 0xc6,
0x73, 0x1b, 0x56, 0x2e, 0x0d, 0x16, 0x67, 0x5a,
0x1f, 0xe2, 0xe3, 0xd6, 0x81, 0x56, 0x52, 0x77
}

Definition at line 93 of file hmacsha3_256.c.

Referenced by SymCryptHmacSha3_256Selftest().

◆ SymCryptHmacSha3_256Algorithm

Definition at line 90 of file hmacsha3_256.c.

◆ SymCryptHmacSha3_256Algorithm_default

const SYMCRYPT_MAC SymCryptHmacSha3_256Algorithm_default
Initial value:
= {
}
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Result(_Inout_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _Out_writes_(SYMCRYPT_HMAC_SHA3_256_RESULT_SIZE) PBYTE pbResult)
Definition: hmacsha3_256.c:70
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Init(_Out_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _In_ PCSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey)
Definition: hmacsha3_256.c:51
VOID SYMCRYPT_CALL SymCryptHmacSha3_256Append(_Inout_ PSYMCRYPT_HMAC_SHA3_256_STATE pState, _In_reads_(cbData) PCBYTE pbData, SIZE_T cbData)
Definition: hmacsha3_256.c:60
@ generic
Definition: optimize.h:97
SYMCRYPT_HMAC_SHA3_256_STATE
#define SYMCRYPT_FIELD_OFFSET(type, field)

Definition at line 78 of file hmacsha3_256.c.