Mistake on this page?
Report an issue in GitHub or email us
gcm_alt.h
1 /**
2  * \file gcm_alt.h.h
3  *
4  * \brief This file contains GCM definitions and functions.
5  *
6  * The Galois/Counter Mode (GCM) for 128-bit block ciphers is defined
7  * in <em>D. McGrew, J. Viega, The Galois/Counter Mode of Operation
8  * (GCM), Natl. Inst. Stand. Technol.</em>
9  *
10  * For more information on GCM, see <em>NIST SP 800-38D: Recommendation for
11  * Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</em>.
12  *
13  */
14 /*
15  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
16  * Copyright (C) 2019-2020 STMicroelectronics, All Rights Reserved
17  * SPDX-License-Identifier: Apache-2.0
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License"); you may
20  * not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  * http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  *
31  * This file implements ST GCM HW services based on API from mbed TLS
32  */
33 
34 /* Define to prevent recursive inclusion -------------------------------------*/
35 #ifndef MBEDTLS_GCM_ALT_H
36 #define MBEDTLS_GCM_ALT_H
37 
38 #if defined(MBEDTLS_GCM_ALT)
39 /* Includes ------------------------------------------------------------------*/
40 #include "cryp_stm32.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /* Exported types ------------------------------------------------------------*/
47 /**
48  * \brief AES context structure
49  *
50  */
51 typedef struct mbedtls_gcm_context {
52  /* Encryption/Decryption key */
53  uint32_t gcm_key[8];
54 
55  CRYP_HandleTypeDef hcryp_gcm; /* HW driver handle */
56  uint32_t ctx_save_cr; /* save context for multi-context */
57  uint64_t len; /* total length of the encrypted data. */
58  int mode; /* The operation to perform:
59  #MBEDTLS_GCM_ENCRYPT or
60  #MBEDTLS_GCM_DECRYPT. */
61 }
62 mbedtls_gcm_context;
63 
64 /* Exported constants --------------------------------------------------------*/
65 /* Uncomment if ADD (Additional Authentication Data) may have not a length */
66 /* over a multiple of 32 bits (Hw implementation dependance) */
67 //#define STM32_AAD_ANY_LENGTH_SUPPORT
68 /* Exported macro ------------------------------------------------------------*/
69 /* Exported functions --------------------------------------------------------*/
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* MBEDTLS_GCM_ALT */
76 #endif /* MBEDTLS_GCM_ALT_H */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.