MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClMacModes_Constants.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2021-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 MCUXCLMACMODES_CONSTANTS_H_
20 #define MCUXCLMACMODES_CONSTANTS_H_
21 
22 #include <mcuxClConfig.h> // Exported features flags header
23 
31 /* Output sizes */
32 #define MCUXCLMAC_CBCMAC_OUTPUT_SIZE (16u)
33 #define MCUXCLMAC_CBCMAC_OUTPUT_SIZE_IN_WORDS (MCUXCLMAC_CBCMAC_OUTPUT_SIZE / sizeof(uint32_t))
34 #define MCUXCLMAC_CMAC_OUTPUT_SIZE (16u)
35 #define MCUXCLMAC_CMAC_OUTPUT_SIZE_IN_WORDS (MCUXCLMAC_CMAC_OUTPUT_SIZE / sizeof(uint32_t))
36 #define MCUXCLMAC_HMAC_SHA_256_OUTPUT_SIZE (32u)
37 #define MCUXCLMAC_HMAC_SHA_256_OUTPUT_SIZE_IN_WORDS (MCUXCLMAC_HMAC_SHA_256_OUTPUT_SIZE / sizeof(uint32_t))
38 
39 #define MCUXCLMAC_MAX_OUTPUT_SIZE (32u)
40 #define MCUXCLMAC_MAX_OUTPUT_SIZE_IN_WORDS (MCUXCLMAC_MAX_OUTPUT_SIZE / sizeof(uint32_t))
41 
42 /* Helper macros and constants for HMAC buffer sizes */
43 #define MCUXCLMAC_HMAC_SHA_256_BLOCK_SIZE (64u)
44 #define MCUXCLMAC_HMAC_SIZE_OF_LENGTH_FIELD (8u)
45 #define MCUXCLMAC_HMAC_MIN_PADDING_LENGTH (MCUXCLMAC_HMAC_SIZE_OF_LENGTH_FIELD + 1u)
46 #define MCUXCLMACMODES_GET_HMAC_INPUTBUFFER_LENGTH(dataLength) \
47  ((((dataLength) + MCUXCLMAC_HMAC_MIN_PADDING_LENGTH) + (MCUXCLMAC_HMAC_SHA_256_BLOCK_SIZE) - 1) / (MCUXCLMAC_HMAC_SHA_256_BLOCK_SIZE)) * MCUXCLMAC_HMAC_SHA_256_BLOCK_SIZE
48 
49 
51 #endif /* MCUXCLMACMODES_CONSTANTS_H_ */