00001 00006 /* 00007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 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 * This file is part of mbed TLS (https://tls.mbed.org) 00050 */ 00051 #ifndef MBEDTLS_AESNI_H 00052 #define MBEDTLS_AESNI_H 00053 00054 #if !defined(MBEDTLS_CONFIG_FILE) 00055 #include "config.h" 00056 #else 00057 #include MBEDTLS_CONFIG_FILE 00058 #endif 00059 00060 #include "aes.h" 00061 00062 #define MBEDTLS_AESNI_AES 0x02000000u 00063 #define MBEDTLS_AESNI_CLMUL 0x00000002u 00064 00065 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \ 00066 ( defined(__amd64__) || defined(__x86_64__) ) && \ 00067 ! defined(MBEDTLS_HAVE_X86_64) 00068 #define MBEDTLS_HAVE_X86_64 00069 #endif 00070 00071 #if defined(MBEDTLS_HAVE_X86_64) 00072 00073 #ifdef __cplusplus 00074 extern "C" { 00075 #endif 00076 00085 int mbedtls_aesni_has_support( unsigned int what ); 00086 00097 int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx, 00098 int mode, 00099 const unsigned char input[16], 00100 unsigned char output[16] ); 00101 00112 void mbedtls_aesni_gcm_mult( unsigned char c[16], 00113 const unsigned char a[16], 00114 const unsigned char b[16] ); 00115 00123 void mbedtls_aesni_inverse_key( unsigned char *invkey, 00124 const unsigned char *fwdkey, int nr ); 00125 00135 int mbedtls_aesni_setkey_enc( unsigned char *rk, 00136 const unsigned char *key, 00137 size_t bits ); 00138 00139 #ifdef __cplusplus 00140 } 00141 #endif 00142 00143 #endif /* MBEDTLS_HAVE_X86_64 */ 00144 00145 #endif /* MBEDTLS_AESNI_H */