ReactOS 0.4.17-dev-1005-g171e1de
sp800_108_hmacsha1.c
Go to the documentation of this file.
1//
2// sp800_108_hmacsha1.c
3//
4// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5//
6
7#include "precomp.h"
8
9//
10// The SP800-108 SHA-1 test
11// This is in a separate module to avoid pulling in SHA-1 whenever we use SP800_108
12//
13
14static const BYTE sp800_108_sha1Answer[] =
15{
16 0xcf, 0x4b, 0xfe, 0x4f, 0x85, 0xa1, 0x0b, 0xad,
17};
18
19VOID
22{
24
27 &SymCryptTestKey32[0], 8, // key
28 (PCBYTE)"Label", 5, // label
29 &SymCryptTestKey32[16], 16, // context
30 res,
31 sizeof(res));
32
33 SymCryptInjectError( res, sizeof( res ) );
34
35 if (memcmp(res, sp800_108_sha1Answer, sizeof(res)) !=0)
36 {
37 SymCryptFatal('8108');
38 }
39}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLuint res
Definition: glext.h:9613
VOID SYMCRYPT_CALL SymCryptInjectError(PBYTE pbData, SIZE_T cbData)
const BYTE SymCryptTestKey32[32]
Definition: selftest.c:10
VOID SYMCRYPT_CALL SymCryptSp800_108_HmacSha1SelfTest(void)
static const BYTE sp800_108_sha1Answer[]
SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptSp800_108(PCSYMCRYPT_MAC macAlgorithm, _In_reads_(cbKey) PCBYTE pbKey, SIZE_T cbKey, _In_reads_opt_(cbLabel) PCBYTE pbLabel, SIZE_T cbLabel, _In_reads_opt_(cbContext) PCBYTE pbContext, SIZE_T cbContext, _Out_writes_(cbResult) PBYTE pbResult, SIZE_T cbResult)
Definition: sp800_108.c:104
const PCSYMCRYPT_MAC SymCryptHmacSha1Algorithm
Definition: hmacsha1.c:36
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatal(UINT32 fatalCode)
#define SYMCRYPT_CALL
const BYTE * PCBYTE
unsigned char BYTE
Definition: xxhash.c:193