• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright The Mbed TLS Contributors
3  *  SPDX-License-Identifier: Apache-2.0
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
6  *  not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *  Copyright (c) 2023 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
17  */
18 
19 #ifndef AES_ALT_H
20 #define AES_ALT_H
21 
22 #if defined(MBEDTLS_AES_ALT)
23 // Regular implementation
24 //
25 
26 /**
27  * \brief The AES context-type definition.
28  */
29 typedef struct mbedtls_aes_context {
30     int MBEDTLS_PRIVATE(nr);           /*!< The number of rounds. */
31     uint32_t *MBEDTLS_PRIVATE(rk);     /*!< AES round keys. */
32     uint32_t MBEDTLS_PRIVATE(buf)[68]; /*!< Unaligned data buffer. This buffer can
33                                                       hold 32 extra Bytes, which can be used for
34                                                       one of the following purposes:
35                                                       <ul><li>Alignment if VIA padlock is used.</li>
36                                                       <li>Simplifying key expansion in the 256-bit
37                                                           case by generating an extra round key.
38                                                       </li></ul> */
39 } mbedtls_aes_context;
40 
41 #if defined(MBEDTLS_CIPHER_MODE_XTS)
42 /**
43  * \brief The AES XTS context-type definition.
44  */
45 typedef struct mbedtls_aes_xts_context {
46     mbedtls_aes_context MBEDTLS_PRIVATE(crypt); /*!< The AES context to use for AES block encryption or decryption. */
47     mbedtls_aes_context MBEDTLS_PRIVATE(tweak); /*!< The AES context used for tweak computation. */
48 } mbedtls_aes_xts_context;
49 
50 #endif /* MBEDTLS_CIPHER_MODE_XTS */
51 
52 #endif /* MBEDTLS_AES_ALT */
53 
54 #endif /* aes_alt.h */
55