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_aesccm_star
9  @{
10  */
11 
12 /*!
13  @file
14 
15  @brief This file contains the CryptoCell AES-CCM star APIs, their enums and
16  definitions.
17 
18  This API supports AES-CCM*, as defined in <em>IEEE 802.15.4: IEEE Standard
19  for Local and metropolitan area networks— Part 15.4: Low-Rate Wireless
20  Personal Area Networks (LR-WPANs)</em>, with the instantiations defined in
21  section B.3.2, and the nonce defined in section 7.3.2.
22  */
23 
24 
25 #ifndef _MBEDTLS_AES_CCM_STAR_H
26 #define _MBEDTLS_AES_CCM_STAR_H
27 
28 
29 #include "cc_pal_types.h"
30 #include "cc_error.h"
31 
32 #include "mbedtls/ccm.h"
33 #include "mbedtls_ccm_common.h"
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 
41 /************************ Defines ******************************/
42 
43 /************************ Typedefs  ****************************/
44 
45 /************************ Enums ********************************/
46 
47 /************************ Structs  ******************************/
48 
49 /************************ context Structs  ******************************/
50 
51 /*!
52  @brief     This function receives the MAC source address, the frame counter,
53             and the MAC size, and returns the required nonce for AES-CCM*, as
54             defined in <em>IEEE 802.15.4: IEEE Standard for Local and
55             metropolitan area networks— Part 15.4: Low-Rate Wireless Personal
56             Area Networks (LR-WPANs)</em>.
57 
58  @note      This API should be called before mbedtls_ccm_star_encrypt_and_tag()
59             or mbedtls_ccm_star_auth_decrypt(). The generated nonce should
60             be provided to these functions. \par
61 
62  @return              \c zero on success.
63  @return              A non-zero value on failure, as defined in ccm.h.
64  */
65 int mbedtls_ccm_star_nonce_generate(
66         /*! The MAC address in EUI-64 format. */
67         unsigned char * src_addr,
68         /*! The MAC frame counter. */
69         uint32_t frame_counter,
70         /*! The size of the AES-CCM* MAC tag in bytes:
71             4, 6, 8, 10, 12, 14 or 16. */
72         uint8_t size_of_t,
73         /*! The required nonce for AES-CCM*. */
74         unsigned char * nonce_buf);
75 
76 
77  #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* _MBEDTLS_AES_CCM_STAR_H */
82 
83 /*!
84 @}
85  */
86