Mbed TLS v2.28.8
padlock.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright The Mbed TLS Contributors
12  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
13  */
14 #ifndef MBEDTLS_PADLOCK_H
15 #define MBEDTLS_PADLOCK_H
16 
17 #if !defined(MBEDTLS_CONFIG_FILE)
18 #include "mbedtls/config.h"
19 #else
20 #include MBEDTLS_CONFIG_FILE
21 #endif
22 
23 #include "mbedtls/aes.h"
24 
26 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030
27 
28 #if defined(__has_feature)
29 #if __has_feature(address_sanitizer)
30 #define MBEDTLS_HAVE_ASAN
31 #endif
32 #endif
33 
34 /* Some versions of ASan result in errors about not enough registers */
35 #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_ASM) && \
36  defined(__GNUC__) && defined(__i386__) && \
37  !defined(MBEDTLS_HAVE_ASAN)
38 
39 #define MBEDTLS_VIA_PADLOCK_HAVE_CODE
40 
41 #ifndef MBEDTLS_HAVE_X86
42 #define MBEDTLS_HAVE_X86
43 #endif
44 
45 #include <stdint.h>
46 
47 #define MBEDTLS_PADLOCK_RNG 0x000C
48 #define MBEDTLS_PADLOCK_ACE 0x00C0
49 #define MBEDTLS_PADLOCK_PHE 0x0C00
50 #define MBEDTLS_PADLOCK_PMM 0x3000
51 
52 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) (x) & ~15))
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
68 int mbedtls_padlock_has_support(int feature);
69 
83 int mbedtls_padlock_xcryptecb(mbedtls_aes_context *ctx,
84  int mode,
85  const unsigned char input[16],
86  unsigned char output[16]);
87 
103 int mbedtls_padlock_xcryptcbc(mbedtls_aes_context *ctx,
104  int mode,
105  size_t length,
106  unsigned char iv[16],
107  const unsigned char *input,
108  unsigned char *output);
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* MBEDTLS_PADLOCK_C && MBEDTLS_HAVE_ASM &&
115  __GNUC__ && __i386__ && !MBEDTLS_HAVE_ASAN */
116 
117 #endif /* padlock.h */
aes.h
This file contains AES definitions and functions.
mbedtls_aes_context
The AES context-type definition.
Definition: aes.h:79
config.h
Configuration options (set of defines)