1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*!
8  @addtogroup cc_utils_defs
9  @{
10  */
11 
12 /*!
13  @file
14  @brief This file contains general definitions of the CryptoCell utility APIs.
15  */
16 
17 #ifndef  _MBEDTLS_CC_UTIL_DEFS_H
18 #define  _MBEDTLS_CC_UTIL_DEFS_H
19 
20 
21 
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26 
27 #include "cc_pal_types_plat.h"
28 #include "mbedtls_cc_util_key_derivation_defs.h"
29 
30 
31 /******************************************************************************
32 *                           DEFINITIONS
33 ******************************************************************************/
34 /*! The size of the AES 128-bit key in bytes. */
35 #define CC_UTIL_AES_128BIT_SIZE 16
36 /*! The size of the AES 192-bit key in bytes. */
37 #define CC_UTIL_AES_192BIT_SIZE 24
38 /*! The size of the AES 256-bit key in bytes. */
39 #define CC_UTIL_AES_256BIT_SIZE 32
40 /*****************************************/
41 /* CMAC derive key definitions*/
42 /*****************************************/
43 /*! The minimal size of the data for the CMAC derivation operation. */
44 #define CC_UTIL_CMAC_DERV_MIN_DATA_IN_SIZE  CC_UTIL_FIX_DATA_MIN_SIZE_IN_BYTES+2
45 /*! The maximal size of the data for CMAC derivation operation. */
46 #define CC_UTIL_CMAC_DERV_MAX_DATA_IN_SIZE  CC_UTIL_MAX_KDF_SIZE_IN_BYTES
47 /*! The size of the AES CMAC result in bytes. */
48 #define CC_UTIL_AES_CMAC_RESULT_SIZE_IN_BYTES   0x10UL
49 /*! The size of the AES CMAC result in words. */
50 #define CC_UTIL_AES_CMAC_RESULT_SIZE_IN_WORDS   (CC_UTIL_AES_CMAC_RESULT_SIZE_IN_BYTES/sizeof(uint32_t))
51 
52 /*! Util error type. */
53 typedef uint32_t CCUtilError_t;
54 
55 
56 
57 /*! The key data. */
58 typedef struct mbedtls_util_keydata {
59     /*! A pointer to the key. */
60     uint8_t*  pKey;
61     /*! The size of the key in bytes. */
62     size_t    keySize;
63 }mbedtls_util_keydata;
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 /*!
70  @}
71  */
72 #endif /*_MBEDTLS_CC_UTIL_DEFS_H*/
73 
74