TrustCore SDK NanoCrypto API reference  version 7.0
nist_prf.h
Go to the documentation of this file.
1 /*
2  * nist_prf.h
3  *
4  * Implementation of the PRFs described in NIST 800-108
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
22 /*------------------------------------------------------------------*/
23 
24 #ifndef __NIST_PRF_HEADER__
25 #define __NIST_PRF_HEADER__
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #ifdef MOC_EXTERN_NIST_PRF_H
32 #undef MOC_EXTERN_NIST_PRF_H
33 #endif /* MOC_EXTERN_NIST_PRF_H */
34 
35 #ifdef __RTOS_WIN32__
36 
37 #ifdef WIN_EXPORT_CRYPTO
38 #define MOC_EXTERN_NIST_PRF_H __declspec(dllexport)
39 #else
40 #define MOC_EXTERN_NIST_PRF_H __declspec(dllimport) extern
41 #endif /* WIN_EXPORT_CRYPTO */
42 
43 #ifdef WIN_STATIC
44 #undef MOC_EXTERN_NIST_PRF_H
45 #define MOC_EXTERN_NIST_PRF_H extern
46 #endif /* WIN_STATIC */
47 
48 #else
49 
50 #define MOC_EXTERN_NIST_PRF_H extern
51 
52 #endif /* RTOS_WIN32 */
53 
54 #ifdef MOC_EXTERN_P
55 #undef MOC_EXTERN_P
56 #endif /* MOC_EXTERN_P */
57 
58 #define MOC_EXTERN_P MOC_EXTERN_NIST_PRF_H
59 
60 
61 
62 /*------------------------------------------------------------------*/
63 
64 /* Function prototypes */
65 
66 /* This are the function that must be implemented by the PRF -- see example for HMAC and CMAC */
67 
82 typedef MSTATUS (*PRFOutputSizeFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, ubyte4* size);
83 
99 typedef MSTATUS (*PRFUpdateFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, const ubyte *data, ubyte4 dataLen);
100 
116 typedef MSTATUS (*PRFFinalFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, ubyte *result);
117 
123 typedef struct PRF_NIST_108
124 {
125  PRFOutputSizeFunc outputSizeFunc;
126  PRFUpdateFunc updateFunc;
127  PRFFinalFunc finalFunc;
128 } PRF_NIST_108;
129 
130 MOC_EXTERN_NIST_PRF_H const PRF_NIST_108 NIST_PRF_Hmac;
131 
132 #if (!defined(__DISABLE_AES_CMAC__))
133 MOC_EXTERN_NIST_PRF_H const PRF_NIST_108 NIST_PRF_AesCmac;
134 #endif
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* __NIST_PRF_HEADER__ */
141 
Structure that holds a trio of function pointers to the PRF implementations.
Definition: nist_prf.h:123
MSTATUS(* PRFOutputSizeFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, ubyte4 *size)
Function pointer type for a method that gets the output size of a PRF.
Definition: nist_prf.h:82
MSTATUS(* PRFUpdateFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, const ubyte *data, ubyte4 dataLen)
Function pointer type for a method that updates a PRF context with data.
Definition: nist_prf.h:99
MSTATUS(* PRFFinalFunc)(MOC_SYM(hwAccelDescr hwAccelCtx) void *ctx, ubyte *result)
Function pointer type for a method that finalizes a PRF context and outputs a result.
Definition: nist_prf.h:116