MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClHmac_Constants.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2023 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13 
19 #ifndef MCUXCLHMAC_CONSTANTS_H_
20 #define MCUXCLHMAC_CONSTANTS_H_
21 
22 #include <mcuxClConfig.h> // Exported features flags header
24 
32 /* Output sizes */
33 
34 #define MCUXCLHMAC_ELS_OUTPUT_SIZE (32u) /* Size of HMAC SHA-256 output in bytes: 256 bits (32 bytes) */
35 #define MCUXCLHMAC_ELS_OUTPUT_SIZE_IN_WORDS (MCUXCLHMAC_ELS_OUTPUT_SIZE / sizeof(uint32_t))
36 
37 #define MCUXCLHMAC_MAX_OUTPUT_SIZE (MCUXCLHASH_MAX_OUTPUT_SIZE)
38 #define MCUXCLHMAC_MAX_OUTPUT_SIZE_IN_WORDS (MCUXCLHMAC_MAX_OUTPUT_SIZE / sizeof(uint32_t))
39 
40 /* Helper macros and constants for HMAC buffer sizes, assuming HMAC on ELS with SHA-256 is used */
41 #define MCUXCLHMAC_ELS_BLOCK_SIZE (64u)
42 #define MCUXCLHMAC_ELS_SIZE_OF_LENGTH_FIELD (8u)
43 #define MCUXCLHMAC_ELS_MIN_PADDING_LENGTH (MCUXCLHMAC_ELS_SIZE_OF_LENGTH_FIELD + 1u)
44 #define MCUXCLHMAC_ELS_INPUTBUFFER_LENGTH(dataLength) \
45  ((((dataLength) + MCUXCLHMAC_ELS_MIN_PADDING_LENGTH) + (MCUXCLHMAC_ELS_BLOCK_SIZE) - 1) / (MCUXCLHMAC_ELS_BLOCK_SIZE)) * MCUXCLHMAC_ELS_BLOCK_SIZE
46 
47 
49 #endif /* MCUXCLHMAC_CONSTANTS_H_ */
Constants for use with the mcuxClHashModes component.