wolfSSL SSL/TLS library, support up to TLS1.3
Embed:
(wiki syntax)
Show/hide line numbers
aes.h
00001 /* aes.h 00002 * 00003 * Copyright (C) 2006-2017 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 00023 00024 /* aes.h defines mini des openssl compatibility layer 00025 * 00026 */ 00027 00028 00029 #ifndef WOLFSSL_AES_H_ 00030 #define WOLFSSL_AES_H_ 00031 00032 #include <wolfssl/wolfcrypt/settings.h> 00033 00034 #ifndef NO_AES 00035 #include <wolfssl/openssl/ssl.h> /* for size_t */ 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 /* This structure wrapper is done because there is no aes_new function with 00042 * OpenSSL compatibility layer. This makes code working with an AES structure 00043 * to need the size of the structure. */ 00044 typedef struct WOLFSSL_AES_KEY { 00045 /* aligned and big enough for Aes from wolfssl/wolfcrypt/aes.h */ 00046 ALIGN16 void* holder[(360 + WC_ASYNC_DEV_SIZE)/ sizeof(void*)]; 00047 #ifdef GCM_TABLE 00048 /* key-based fast multiplication table. */ 00049 ALIGN16 void* M0[4096 / sizeof(void*)]; 00050 #endif /* GCM_TABLE */ 00051 } WOLFSSL_AES_KEY; 00052 typedef WOLFSSL_AES_KEY AES_KEY; 00053 00054 WOLFSSL_API int wolfSSL_AES_set_encrypt_key 00055 (const unsigned char *, const int bits, AES_KEY *); 00056 WOLFSSL_API int wolfSSL_AES_set_decrypt_key 00057 (const unsigned char *, const int bits, AES_KEY *); 00058 WOLFSSL_API void wolfSSL_AES_cbc_encrypt 00059 (const unsigned char *in, unsigned char* out, size_t len, 00060 AES_KEY *key, unsigned char* iv, const int enc); 00061 WOLFSSL_API void wolfSSL_AES_ecb_encrypt 00062 (const unsigned char *in, unsigned char* out, 00063 AES_KEY *key, const int enc); 00064 WOLFSSL_API void wolfSSL_AES_cfb128_encrypt 00065 (const unsigned char *in, unsigned char* out, size_t len, 00066 AES_KEY *key, unsigned char* iv, int* num, const int enc); 00067 00068 #define AES_cbc_encrypt wolfSSL_AES_cbc_encrypt 00069 #define AES_ecb_encrypt wolfSSL_AES_ecb_encrypt 00070 #define AES_cfb128_encrypt wolfSSL_AES_cfb128_encrypt 00071 #define AES_set_encrypt_key wolfSSL_AES_set_encrypt_key 00072 #define AES_set_decrypt_key wolfSSL_AES_set_decrypt_key 00073 00074 #ifdef WOLFSSL_AES_DIRECT 00075 WOLFSSL_API void wolfSSL_AES_encrypt 00076 (const unsigned char* input, unsigned char* output, AES_KEY *); 00077 WOLFSSL_API void wolfSSL_AES_decrypt 00078 (const unsigned char* input, unsigned char* output, AES_KEY *); 00079 00080 #define AES_encrypt wolfSSL_AES_encrypt 00081 #define AES_decrypt wolfSSL_AES_decrypt 00082 #endif /* HAVE_AES_DIRECT */ 00083 00084 #ifndef AES_ENCRYPT 00085 #define AES_ENCRYPT AES_ENCRYPTION 00086 #endif 00087 #ifndef AES_DECRYPT 00088 #define AES_DECRYPT AES_DECRYPTION 00089 #endif 00090 00091 #ifdef __cplusplus 00092 } /* extern "C" */ 00093 #endif 00094 00095 #endif /* NO_AES */ 00096 00097 #endif /* WOLFSSL_AES_H_ */ 00098
Generated on Wed Jul 13 2022 01:38:41 by 1.7.2