1 /** 2 * \file ccm.h 3 * 4 * \brief This file provides an API for the CCM authenticated encryption 5 * mode for block ciphers. 6 * 7 * CCM combines Counter mode encryption with CBC-MAC authentication 8 * for 128-bit block ciphers. 9 * 10 * Input to CCM includes the following elements: 11 * <ul><li>Payload - data that is both authenticated and encrypted.</li> 12 * <li>Associated data (Adata) - data that is authenticated but not 13 * encrypted, For example, a header.</li> 14 * <li>Nonce - A unique value that is assigned to the payload and the 15 * associated data.</li></ul> 16 * 17 * Definition of CCM: 18 * http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf 19 * RFC 3610 "Counter with CBC-MAC (CCM)" 20 * 21 * Related: 22 * RFC 5116 "An Interface and Algorithms for Authenticated Encryption" 23 * 24 * Definition of CCM*: 25 * IEEE 802.15.4 - IEEE Standard for Local and metropolitan area networks 26 * Integer representation is fixed most-significant-octet-first order and 27 * the representation of octets is most-significant-bit-first order. This is 28 * consistent with RFC 3610. 29 */ 30 /* 31 * Copyright The Mbed TLS Contributors 32 * Copyright (C) 2021 STMicroelectronics, All Rights Reserved 33 * SPDX-License-Identifier: Apache-2.0 34 * 35 * Licensed under the Apache License, Version 2.0 (the "License"); you may 36 * not use this file except in compliance with the License. 37 * You may obtain a copy of the License at 38 * 39 * http://www.apache.org/licenses/LICENSE-2.0 40 * 41 * Unless required by applicable law or agreed to in writing, software 42 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 43 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 44 * See the License for the specific language governing permissions and 45 * limitations under the License. 46 * 47 * This file implements ST CCM HW services based on API from mbed TLS 48 */ 49 50 /* Define to prevent recursive inclusion -------------------------------------*/ 51 #ifndef MBEDTLS_CCM_ALT_H 52 #define MBEDTLS_CCM_ALT_H 53 54 #if defined(MBEDTLS_CCM_ALT) 55 /* Includes ------------------------------------------------------------------*/ 56 #include "stm32hal.h" 57 58 #ifdef __cplusplus 59 extern "C" { 60 #endif 61 62 /* Exported types ------------------------------------------------------------*/ 63 /** 64 * \brief The CCM context-type definition. The CCM context is passed 65 * to the APIs called. 66 */ 67 typedef struct mbedtls_ccm_context 68 { 69 /* Encryption/Decryption key */ 70 uint32_t ccm_key[8]; 71 72 CRYP_HandleTypeDef hcryp_ccm; /* CCM context */ 73 uint32_t ctx_save_cr; /* save context for multi-context */ 74 } 75 mbedtls_ccm_context; 76 77 /* Exported constants --------------------------------------------------------*/ 78 /* Exported macro ------------------------------------------------------------*/ 79 /* Exported functions --------------------------------------------------------*/ 80 81 82 #ifdef __cplusplus 83 } 84 #endif 85 86 #endif /* MBEDTLS_CCM_ALT */ 87 #endif /* MBEDTLS_CCM_ALT_H */ 88