mbed TLS v2.7.17
padlock.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright The Mbed TLS Contributors
9  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
10  *
11  * This file is provided under the Apache License 2.0, or the
12  * GNU General Public License v2.0 or later.
13  *
14  * **********
15  * Apache License 2.0:
16  *
17  * Licensed under the Apache License, Version 2.0 (the "License"); you may
18  * not use this file except in compliance with the License.
19  * You may obtain a copy of the License at
20  *
21  * http://www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  *
29  * **********
30  *
31  * **********
32  * GNU General Public License v2.0 or later:
33  *
34  * This program is free software; you can redistribute it and/or modify
35  * it under the terms of the GNU General Public License as published by
36  * the Free Software Foundation; either version 2 of the License, or
37  * (at your option) any later version.
38  *
39  * This program is distributed in the hope that it will be useful,
40  * but WITHOUT ANY WARRANTY; without even the implied warranty of
41  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42  * GNU General Public License for more details.
43  *
44  * You should have received a copy of the GNU General Public License along
45  * with this program; if not, write to the Free Software Foundation, Inc.,
46  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
47  *
48  * **********
49  */
50 #ifndef MBEDTLS_PADLOCK_H
51 #define MBEDTLS_PADLOCK_H
52 
53 #if !defined(MBEDTLS_CONFIG_FILE)
54 #include "config.h"
55 #else
56 #include MBEDTLS_CONFIG_FILE
57 #endif
58 
59 #include "aes.h"
60 
61 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030
63 #if defined(__has_feature)
64 #if __has_feature(address_sanitizer)
65 #define MBEDTLS_HAVE_ASAN
66 #endif
67 #endif
68 
69 /* Some versions of ASan result in errors about not enough registers */
70 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
71  !defined(MBEDTLS_HAVE_ASAN)
72 
73 #ifndef MBEDTLS_HAVE_X86
74 #define MBEDTLS_HAVE_X86
75 #endif
76 
77 #include <stdint.h>
78 
79 #define MBEDTLS_PADLOCK_RNG 0x000C
80 #define MBEDTLS_PADLOCK_ACE 0x00C0
81 #define MBEDTLS_PADLOCK_PHE 0x0C00
82 #define MBEDTLS_PADLOCK_PMM 0x3000
83 
84 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15))
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
97 int mbedtls_padlock_has_support( int feature );
98 
109 int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx,
110  int mode,
111  const unsigned char input[16],
112  unsigned char output[16] );
113 
126 int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx,
127  int mode,
128  size_t length,
129  unsigned char iv[16],
130  const unsigned char *input,
131  unsigned char *output );
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* HAVE_X86 */
138 
139 #endif /* padlock.h */
Configuration options (set of defines)
The Advanced Encryption Standard (AES) specifies a FIPS-approved cryptographic algorithm that can be ...
The AES context-type definition.
Definition: aes.h:99