wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers aes.h Source File

aes.h

00001 /* aes.h
00002  *
00003  * Copyright (C) 2006-2016 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 #ifdef WOLFSSL_AES_DIRECT
00036 
00037 #ifdef __cplusplus
00038     extern "C" {
00039 #endif
00040 
00041 
00042 typedef Aes AES_KEY;
00043 
00044 WOLFSSL_API void wolfSSL_AES_set_encrypt_key
00045     (const unsigned char *, const int bits, AES_KEY *);
00046 WOLFSSL_API void wolfSSL_AES_set_decrypt_key
00047     (const unsigned char *, const int bits, AES_KEY *);
00048 WOLFSSL_API void wolfSSL_AES_encrypt
00049     (const unsigned char* input, unsigned char* output, AES_KEY *);
00050 WOLFSSL_API void wolfSSL_AES_decrypt
00051     (const unsigned char* input, unsigned char* output, AES_KEY *);
00052 
00053 #define AES_set_encrypt_key wolfSSL_AES_set_encrypt_key
00054 #define AES_set_decrypt_key wolfSSL_AES_set_decrypt_key
00055 #define AES_encrypt         wolfSSL_AES_encrypt
00056 #define AES_decrypt         wolfSSL_AES_decrypt
00057 
00058 #define wolfSSL_AES_set_encrypt_key(key, bits, aes) \
00059     wc_AesSetKey(aes, key, ((bits)/8), NULL, AES_ENCRYPTION)
00060 #define wolfSSL_AES_set_decrypt_key(key, bits, aes) \
00061     wc_AesSetKey(aes, key, ((bits)/8), NULL, AES_DECRYPTION)
00062 
00063 #define wolfSSL_AES_encrypt(in, out, aes) wc_AesEncryptDirect(aes, out, in)
00064 #define wolfSSL_AES_decrypt(in, out, aes) wc_AesDecryptDirect(aes, out, in)
00065 
00066 #ifdef __cplusplus
00067     } /* extern "C" */
00068 #endif
00069 
00070 #endif /* HAVE_AES_DIRECT */
00071 #endif /* NO_AES */
00072 
00073 #endif /* WOLFSSL_DES_H_ */
00074