00001 00006 /* 00007 * Copyright The Mbed TLS Contributors 00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 00009 * 00010 * This file is provided under the Apache License 2.0, or the 00011 * GNU General Public License v2.0 or later. 00012 * 00013 * ********** 00014 * Apache License 2.0: 00015 * 00016 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00017 * not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at 00019 * 00020 * http://www.apache.org/licenses/LICENSE-2.0 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00024 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 * 00028 * ********** 00029 * 00030 * ********** 00031 * GNU General Public License v2.0 or later: 00032 * 00033 * This program is free software; you can redistribute it and/or modify 00034 * it under the terms of the GNU General Public License as published by 00035 * the Free Software Foundation; either version 2 of the License, or 00036 * (at your option) any later version. 00037 * 00038 * This program is distributed in the hope that it will be useful, 00039 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00040 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00041 * GNU General Public License for more details. 00042 * 00043 * You should have received a copy of the GNU General Public License along 00044 * with this program; if not, write to the Free Software Foundation, Inc., 00045 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00046 * 00047 * ********** 00048 */ 00049 #ifndef MBEDTLS_AESNI_H 00050 #define MBEDTLS_AESNI_H 00051 00052 #if !defined(MBEDTLS_CONFIG_FILE) 00053 #include "config.h" 00054 #else 00055 #include MBEDTLS_CONFIG_FILE 00056 #endif 00057 00058 #include "aes.h" 00059 00060 #define MBEDTLS_AESNI_AES 0x02000000u 00061 #define MBEDTLS_AESNI_CLMUL 0x00000002u 00062 00063 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \ 00064 ( defined(__amd64__) || defined(__x86_64__) ) && \ 00065 ! defined(MBEDTLS_HAVE_X86_64) 00066 #define MBEDTLS_HAVE_X86_64 00067 #endif 00068 00069 #if defined(MBEDTLS_HAVE_X86_64) 00070 00071 #ifdef __cplusplus 00072 extern "C" { 00073 #endif 00074 00083 int mbedtls_aesni_has_support( unsigned int what ); 00084 00095 int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx, 00096 int mode, 00097 const unsigned char input[16], 00098 unsigned char output[16] ); 00099 00110 void mbedtls_aesni_gcm_mult( unsigned char c[16], 00111 const unsigned char a[16], 00112 const unsigned char b[16] ); 00113 00121 void mbedtls_aesni_inverse_key( unsigned char *invkey, 00122 const unsigned char *fwdkey, int nr ); 00123 00133 int mbedtls_aesni_setkey_enc( unsigned char *rk, 00134 const unsigned char *key, 00135 size_t bits ); 00136 00137 #ifdef __cplusplus 00138 } 00139 #endif 00140 00141 #endif /* MBEDTLS_HAVE_X86_64 */ 00142 00143 #endif /* MBEDTLS_AESNI_H */