mbed TLS v2.7.6
padlock.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
9  * SPDX-License-Identifier: Apache-2.0
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License"); you may
12  * not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  * This file is part of mbed TLS (https://tls.mbed.org)
24  */
25 #ifndef MBEDTLS_PADLOCK_H
26 #define MBEDTLS_PADLOCK_H
27 
28 #include "aes.h"
29 
30 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030
32 #if defined(__has_feature)
33 #if __has_feature(address_sanitizer)
34 #define MBEDTLS_HAVE_ASAN
35 #endif
36 #endif
37 
38 /* Some versions of ASan result in errors about not enough registers */
39 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
40  !defined(MBEDTLS_HAVE_ASAN)
41 
42 #ifndef MBEDTLS_HAVE_X86
43 #define MBEDTLS_HAVE_X86
44 #endif
45 
46 #include <stdint.h>
47 
48 #define MBEDTLS_PADLOCK_RNG 0x000C
49 #define MBEDTLS_PADLOCK_ACE 0x00C0
50 #define MBEDTLS_PADLOCK_PHE 0x0C00
51 #define MBEDTLS_PADLOCK_PMM 0x3000
52 
53 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15))
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
66 int mbedtls_padlock_has_support( int feature );
67 
78 int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
79  int mode,
80  const unsigned char input[16],
81  unsigned char output[16] );
82 
95 int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
96  int mode,
97  size_t length,
98  unsigned char iv[16],
99  const unsigned char *input,
100  unsigned char *output );
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /* HAVE_X86 */
107 
108 #endif /* padlock.h */
The Advanced Encryption Standard (AES) specifies a FIPS-approved cryptographic algorithm that can be ...
The AES context-type definition.
Definition: aes.h:73