OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
padlock.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * This file is part of mbed TLS (https://tls.mbed.org)
27  */
28 #ifndef MBEDTLS_PADLOCK_H
29 #define MBEDTLS_PADLOCK_H
30 
31 #include "aes.h"
32 
33 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030
35 #if defined(__has_feature)
36 #if __has_feature(address_sanitizer)
37 #define MBEDTLS_HAVE_ASAN
38 #endif
39 #endif
40 
41 /* Some versions of ASan result in errors about not enough registers */
42 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
43  !defined(MBEDTLS_HAVE_ASAN)
44 
45 #ifndef MBEDTLS_HAVE_X86
46 #define MBEDTLS_HAVE_X86
47 #endif
48 
49 #include <stdint.h>
50 
51 #define MBEDTLS_PADLOCK_RNG 0x000C
52 #define MBEDTLS_PADLOCK_ACE 0x00C0
53 #define MBEDTLS_PADLOCK_PHE 0x0C00
54 #define MBEDTLS_PADLOCK_PMM 0x3000
55 
56 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15))
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
72 int mbedtls_padlock_has_support( int feature );
73 
87 int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
88  int mode,
89  const unsigned char input[16],
90  unsigned char output[16] );
91 
107 int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
108  int mode,
109  size_t length,
110  unsigned char iv[16],
111  const unsigned char *input,
112  unsigned char *output );
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif /* HAVE_X86 */
119 
120 #endif /* padlock.h */
This file contains AES definitions and functions.
The AES context-type definition.
Definition: aes.h:86