mbed TLS v2.16.7
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 OR GPL-2.0-or-later
13  *
14  * This file is provided under the Apache License 2.0, or the
15  * GNU General Public License v2.0 or later.
16  *
17  * **********
18  * Apache License 2.0:
19  *
20  * Licensed under the Apache License, Version 2.0 (the "License"); you may
21  * not use this file except in compliance with the License.
22  * You may obtain a copy of the License at
23  *
24  * http://www.apache.org/licenses/LICENSE-2.0
25  *
26  * Unless required by applicable law or agreed to in writing, software
27  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  * See the License for the specific language governing permissions and
30  * limitations under the License.
31  *
32  * **********
33  *
34  * **********
35  * GNU General Public License v2.0 or later:
36  *
37  * This program is free software; you can redistribute it and/or modify
38  * it under the terms of the GNU General Public License as published by
39  * the Free Software Foundation; either version 2 of the License, or
40  * (at your option) any later version.
41  *
42  * This program is distributed in the hope that it will be useful,
43  * but WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  * GNU General Public License for more details.
46  *
47  * You should have received a copy of the GNU General Public License along
48  * with this program; if not, write to the Free Software Foundation, Inc.,
49  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
50  *
51  * **********
52  *
53  * This file is part of mbed TLS (https://tls.mbed.org)
54  */
55 #ifndef MBEDTLS_PADLOCK_H
56 #define MBEDTLS_PADLOCK_H
57 
58 #if !defined(MBEDTLS_CONFIG_FILE)
59 #include "config.h"
60 #else
61 #include MBEDTLS_CONFIG_FILE
62 #endif
63 
64 #include "aes.h"
65 
66 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030
68 #if defined(__has_feature)
69 #if __has_feature(address_sanitizer)
70 #define MBEDTLS_HAVE_ASAN
71 #endif
72 #endif
73 
74 /* Some versions of ASan result in errors about not enough registers */
75 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
76  !defined(MBEDTLS_HAVE_ASAN)
77 
78 #ifndef MBEDTLS_HAVE_X86
79 #define MBEDTLS_HAVE_X86
80 #endif
81 
82 #include <stdint.h>
83 
84 #define MBEDTLS_PADLOCK_RNG 0x000C
85 #define MBEDTLS_PADLOCK_ACE 0x00C0
86 #define MBEDTLS_PADLOCK_PHE 0x0C00
87 #define MBEDTLS_PADLOCK_PMM 0x3000
88 
89 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) (x) & ~15))
90 
91 #ifdef __cplusplus
92 extern "C" {
93 #endif
94 
105 int mbedtls_padlock_has_support( int feature );
106 
120 int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
121  int mode,
122  const unsigned char input[16],
123  unsigned char output[16] );
124 
140 int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
141  int mode,
142  size_t length,
143  unsigned char iv[16],
144  const unsigned char *input,
145  unsigned char *output );
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* HAVE_X86 */
152 
153 #endif /* padlock.h */
Configuration options (set of defines)
This file contains AES definitions and functions.
The AES context-type definition.
Definition: aes.h:114