Remove OPENSSL_NO_AES guards
no-aes is no longer a Configure option and therefore the OPENSSL_NO_AES guards can be removed. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
@@ -214,11 +214,9 @@ OPTIONS cms_options[] = {
|
||||
{"receipt_request_to", OPT_RR_TO, 's'},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
OPT_V_OPTIONS,
|
||||
# ifndef OPENSSL_NO_AES
|
||||
{"aes128-wrap", OPT_AES128_WRAP, '-', "Use AES128 to wrap key"},
|
||||
{"aes192-wrap", OPT_AES192_WRAP, '-', "Use AES192 to wrap key"},
|
||||
{"aes256-wrap", OPT_AES256_WRAP, '-', "Use AES256 to wrap key"},
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DES
|
||||
{"des3-wrap", OPT_3DES_WRAP, '-', "Use 3DES-EDE to wrap key"},
|
||||
# endif
|
||||
@@ -603,7 +601,6 @@ int cms_main(int argc, char **argv)
|
||||
wrap_cipher = EVP_des_ede3_wrap();
|
||||
# endif
|
||||
break;
|
||||
# ifndef OPENSSL_NO_AES
|
||||
case OPT_AES128_WRAP:
|
||||
wrap_cipher = EVP_aes_128_wrap();
|
||||
break;
|
||||
@@ -613,12 +610,6 @@ int cms_main(int argc, char **argv)
|
||||
case OPT_AES256_WRAP:
|
||||
wrap_cipher = EVP_aes_256_wrap();
|
||||
break;
|
||||
# else
|
||||
case OPT_AES128_WRAP:
|
||||
case OPT_AES192_WRAP:
|
||||
case OPT_AES256_WRAP:
|
||||
break;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
|
||||
@@ -644,9 +644,6 @@ static int SortFnByName(const void *_f1, const void *_f2)
|
||||
static void list_disabled(void)
|
||||
{
|
||||
BIO_puts(bio_out, "Disabled algorithms:\n");
|
||||
#ifdef OPENSSL_NO_AES
|
||||
BIO_puts(bio_out, "AES\n");
|
||||
#endif
|
||||
#ifdef OPENSSL_NO_BF
|
||||
BIO_puts(bio_out, "BF\n");
|
||||
#endif
|
||||
|
||||
12
apps/progs.h
12
apps/progs.h
@@ -248,24 +248,12 @@ static FUNCTION functions[] = {
|
||||
#ifndef OPENSSL_NO_BLAKE2
|
||||
{ FT_md, "blake2s256", dgst_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-128-cbc", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-128-ecb", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-192-cbc", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-192-ecb", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-256-cbc", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{ FT_cipher, "aes-256-ecb", enc_main, enc_options },
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{ FT_cipher, "camellia-128-cbc", enc_main, enc_options },
|
||||
#endif
|
||||
|
||||
29
apps/speed.c
29
apps/speed.c
@@ -99,9 +99,7 @@
|
||||
#ifndef OPENSSL_NO_DES
|
||||
# include <openssl/des.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
# include <openssl/aes.h>
|
||||
#endif
|
||||
#include <openssl/aes.h>
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <openssl/camellia.h>
|
||||
#endif
|
||||
@@ -249,7 +247,6 @@ static int RC4_loop(void *args);
|
||||
static int DES_ncbc_encrypt_loop(void *args);
|
||||
static int DES_ede3_cbc_encrypt_loop(void *args);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
static int AES_cbc_128_encrypt_loop(void *args);
|
||||
static int AES_cbc_192_encrypt_loop(void *args);
|
||||
static int AES_ige_128_encrypt_loop(void *args);
|
||||
@@ -257,7 +254,6 @@ static int AES_cbc_256_encrypt_loop(void *args);
|
||||
static int AES_ige_192_encrypt_loop(void *args);
|
||||
static int AES_ige_256_encrypt_loop(void *args);
|
||||
static int CRYPTO_gcm128_aad_loop(void *args);
|
||||
#endif
|
||||
static int EVP_Update_loop(void *args);
|
||||
static int EVP_Digest_loop(void *args);
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
@@ -508,14 +504,12 @@ static OPT_PAIR doit_choices[] = {
|
||||
{"des-cbc", D_CBC_DES},
|
||||
{"des-ede3", D_EDE3_DES},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
{"aes-128-cbc", D_CBC_128_AES},
|
||||
{"aes-192-cbc", D_CBC_192_AES},
|
||||
{"aes-256-cbc", D_CBC_256_AES},
|
||||
{"aes-128-ige", D_IGE_128_AES},
|
||||
{"aes-192-ige", D_IGE_192_AES},
|
||||
{"aes-256-ige", D_IGE_256_AES},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{"rc2-cbc", D_CBC_RC2},
|
||||
{"rc2", D_CBC_RC2},
|
||||
@@ -819,14 +813,9 @@ static int DES_ede3_cbc_encrypt_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_AES
|
||||
# define MAX_BLOCK_SIZE 128
|
||||
#else
|
||||
# define MAX_BLOCK_SIZE 64
|
||||
#endif
|
||||
#define MAX_BLOCK_SIZE 128
|
||||
|
||||
static unsigned char iv[2 * MAX_BLOCK_SIZE / 8];
|
||||
#ifndef OPENSSL_NO_AES
|
||||
static AES_KEY aes_ks1, aes_ks2, aes_ks3;
|
||||
static int AES_cbc_128_encrypt_loop(void *args)
|
||||
{
|
||||
@@ -914,8 +903,6 @@ static int CRYPTO_gcm128_aad_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int decrypt = 0;
|
||||
static int EVP_Update_loop(void *args)
|
||||
{
|
||||
@@ -1294,7 +1281,6 @@ int speed_main(int argc, char **argv)
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12
|
||||
};
|
||||
#ifndef OPENSSL_NO_AES
|
||||
static const unsigned char key24[24] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
|
||||
@@ -1306,7 +1292,6 @@ int speed_main(int argc, char **argv)
|
||||
0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
|
||||
0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56
|
||||
};
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
static const unsigned char ckey24[24] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||
@@ -1542,13 +1527,11 @@ int speed_main(int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
if (strcmp(*argv, "aes") == 0) {
|
||||
doit[D_CBC_128_AES] = doit[D_CBC_192_AES] =
|
||||
doit[D_CBC_256_AES] = 1;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
if (strcmp(*argv, "camellia") == 0) {
|
||||
doit[D_CBC_128_CML] = doit[D_CBC_192_CML] =
|
||||
@@ -1675,11 +1658,9 @@ int speed_main(int argc, char **argv)
|
||||
DES_set_key_unchecked(&key2, &sch2);
|
||||
DES_set_key_unchecked(&key3, &sch3);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
AES_set_encrypt_key(key16, 128, &aes_ks1);
|
||||
AES_set_encrypt_key(key24, 192, &aes_ks2);
|
||||
AES_set_encrypt_key(key32, 256, &aes_ks3);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
Camellia_set_key(key16, 128, &camellia_ks1);
|
||||
Camellia_set_key(ckey24, 192, &camellia_ks2);
|
||||
@@ -2079,7 +2060,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
|
||||
if (doit[D_CBC_128_AES]) {
|
||||
for (testnum = 0; testnum < SIZE_NUM; testnum++) {
|
||||
print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][testnum],
|
||||
@@ -2157,7 +2138,7 @@ int speed_main(int argc, char **argv)
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
CRYPTO_gcm128_release(loopargs[i].gcm_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
if (doit[D_CBC_128_CML]) {
|
||||
for (testnum = 0; testnum < SIZE_NUM; testnum++) {
|
||||
@@ -2710,9 +2691,7 @@ int speed_main(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_DES
|
||||
printf("%s ", DES_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
printf("%s ", AES_options());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
printf("%s ", idea_options());
|
||||
#endif
|
||||
|
||||
@@ -167,7 +167,6 @@ void openssl_add_all_ciphers_int(void)
|
||||
EVP_add_cipher_alias(SN_rc5_cbc, "RC5");
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_AES
|
||||
EVP_add_cipher(EVP_aes_128_ecb());
|
||||
EVP_add_cipher(EVP_aes_128_cbc());
|
||||
EVP_add_cipher(EVP_aes_128_cfb());
|
||||
@@ -176,9 +175,9 @@ void openssl_add_all_ciphers_int(void)
|
||||
EVP_add_cipher(EVP_aes_128_ofb());
|
||||
EVP_add_cipher(EVP_aes_128_ctr());
|
||||
EVP_add_cipher(EVP_aes_128_gcm());
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
EVP_add_cipher(EVP_aes_128_ocb());
|
||||
# endif
|
||||
#endif
|
||||
EVP_add_cipher(EVP_aes_128_xts());
|
||||
EVP_add_cipher(EVP_aes_128_ccm());
|
||||
EVP_add_cipher(EVP_aes_128_wrap());
|
||||
@@ -194,9 +193,9 @@ void openssl_add_all_ciphers_int(void)
|
||||
EVP_add_cipher(EVP_aes_192_ofb());
|
||||
EVP_add_cipher(EVP_aes_192_ctr());
|
||||
EVP_add_cipher(EVP_aes_192_gcm());
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
EVP_add_cipher(EVP_aes_192_ocb());
|
||||
# endif
|
||||
#endif
|
||||
EVP_add_cipher(EVP_aes_192_ccm());
|
||||
EVP_add_cipher(EVP_aes_192_wrap());
|
||||
EVP_add_cipher_alias(SN_id_aes192_wrap, "aes192-wrap");
|
||||
@@ -211,9 +210,9 @@ void openssl_add_all_ciphers_int(void)
|
||||
EVP_add_cipher(EVP_aes_256_ofb());
|
||||
EVP_add_cipher(EVP_aes_256_ctr());
|
||||
EVP_add_cipher(EVP_aes_256_gcm());
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
EVP_add_cipher(EVP_aes_256_ocb());
|
||||
# endif
|
||||
#endif
|
||||
EVP_add_cipher(EVP_aes_256_xts());
|
||||
EVP_add_cipher(EVP_aes_256_ccm());
|
||||
EVP_add_cipher(EVP_aes_256_wrap());
|
||||
@@ -225,7 +224,6 @@ void openssl_add_all_ciphers_int(void)
|
||||
EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
|
||||
EVP_add_cipher(EVP_aes_128_cbc_hmac_sha256());
|
||||
EVP_add_cipher(EVP_aes_256_cbc_hmac_sha256());
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
EVP_add_cipher(EVP_camellia_128_ecb());
|
||||
|
||||
@@ -49,16 +49,15 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifndef OPENSSL_NO_AES
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/err.h>
|
||||
# include <string.h>
|
||||
# include <assert.h>
|
||||
# include <openssl/aes.h>
|
||||
# include "internal/evp_int.h"
|
||||
# include "modes_lcl.h"
|
||||
# include <openssl/rand.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "internal/evp_int.h"
|
||||
#include "modes_lcl.h"
|
||||
#include <openssl/rand.h>
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
@@ -115,7 +114,7 @@ typedef struct {
|
||||
ccm128_f str;
|
||||
} EVP_AES_CCM_CTX;
|
||||
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
typedef struct {
|
||||
union {
|
||||
double align;
|
||||
@@ -137,11 +136,11 @@ typedef struct {
|
||||
int ivlen; /* IV length */
|
||||
int taglen;
|
||||
} EVP_AES_OCB_CTX;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
|
||||
#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
|
||||
|
||||
# ifdef VPAES_ASM
|
||||
#ifdef VPAES_ASM
|
||||
int vpaes_set_encrypt_key(const unsigned char *userKey, int bits,
|
||||
AES_KEY *key);
|
||||
int vpaes_set_decrypt_key(const unsigned char *userKey, int bits,
|
||||
@@ -156,8 +155,8 @@ void vpaes_cbc_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const AES_KEY *key, unsigned char *ivec, int enc);
|
||||
# endif
|
||||
# ifdef BSAES_ASM
|
||||
#endif
|
||||
#ifdef BSAES_ASM
|
||||
void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char ivec[16], int enc);
|
||||
@@ -170,22 +169,22 @@ void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
|
||||
void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
|
||||
size_t len, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char iv[16]);
|
||||
# endif
|
||||
# ifdef AES_CTR_ASM
|
||||
#endif
|
||||
#ifdef AES_CTR_ASM
|
||||
void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
const unsigned char ivec[AES_BLOCK_SIZE]);
|
||||
# endif
|
||||
# ifdef AES_XTS_ASM
|
||||
#endif
|
||||
#ifdef AES_XTS_ASM
|
||||
void AES_xts_encrypt(const char *inp, char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
void AES_xts_decrypt(const char *inp, char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
||||
#if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
||||
# include "ppc_arch.h"
|
||||
# ifdef VPAES_ASM
|
||||
# define VPAES_CAPABLE (OPENSSL_ppccap_P & PPC_ALTIVEC)
|
||||
@@ -197,9 +196,9 @@ void AES_xts_decrypt(const char *inp, char *out, size_t len,
|
||||
# define HWAES_decrypt aes_p8_decrypt
|
||||
# define HWAES_cbc_encrypt aes_p8_cbc_encrypt
|
||||
# define HWAES_ctr32_encrypt_blocks aes_p8_ctr32_encrypt_blocks
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(AES_ASM) && !defined(I386_ONLY) && ( \
|
||||
#if defined(AES_ASM) && !defined(I386_ONLY) && ( \
|
||||
((defined(__i386) || defined(__i386__) || \
|
||||
defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
|
||||
defined(__x86_64) || defined(__x86_64__) || \
|
||||
@@ -582,7 +581,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
|
||||
const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
|
||||
{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
|
||||
|
||||
# elif defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
|
||||
#elif defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
|
||||
|
||||
# include "sparc_arch.h"
|
||||
|
||||
@@ -979,7 +978,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
|
||||
const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
|
||||
{ return SPARC_AES_CAPABLE?&aes_t4_##keylen##_##mode:&aes_##keylen##_##mode; }
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \
|
||||
static const EVP_CIPHER aes_##keylen##_##mode = { \
|
||||
@@ -1006,9 +1005,9 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
|
||||
const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
|
||||
{ return &aes_##keylen##_##mode; }
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(OPENSSL_CPUID_OBJ) && (defined(__arm__) || defined(__arm) || defined(__aarch64__))
|
||||
#if defined(OPENSSL_CPUID_OBJ) && (defined(__arm__) || defined(__arm) || defined(__aarch64__))
|
||||
# include "arm_arch.h"
|
||||
# if __ARM_MAX_ARCH__>=7
|
||||
# if defined(BSAES_ASM)
|
||||
@@ -1025,9 +1024,9 @@ const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
|
||||
# define HWAES_cbc_encrypt aes_v8_cbc_encrypt
|
||||
# define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(HWAES_CAPABLE)
|
||||
#if defined(HWAES_CAPABLE)
|
||||
int HWAES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int HWAES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
@@ -1042,9 +1041,9 @@ void HWAES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
void HWAES_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
const unsigned char ivec[16]);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \
|
||||
#define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,16,16,cbc,cbc,CBC,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,16,0,ecb,ecb,ECB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,1,16,ofb128,ofb,OFB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
@@ -1062,7 +1061,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
mode = EVP_CIPHER_CTX_mode(ctx);
|
||||
if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE)
|
||||
&& !enc)
|
||||
# ifdef HWAES_CAPABLE
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
ret = HWAES_set_decrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
@@ -1074,16 +1073,16 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
dat->stream.cbc = (cbc128_f) HWAES_cbc_encrypt;
|
||||
# endif
|
||||
} else
|
||||
# endif
|
||||
# ifdef BSAES_CAPABLE
|
||||
#endif
|
||||
#ifdef BSAES_CAPABLE
|
||||
if (BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE) {
|
||||
ret = AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&dat->ks.ks);
|
||||
dat->block = (block128_f) AES_decrypt;
|
||||
dat->stream.cbc = (cbc128_f) bsaes_cbc_encrypt;
|
||||
} else
|
||||
# endif
|
||||
# ifdef VPAES_CAPABLE
|
||||
#endif
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
ret = vpaes_set_decrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
@@ -1092,7 +1091,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
|
||||
(cbc128_f) vpaes_cbc_encrypt : NULL;
|
||||
} else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
ret = AES_set_decrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
@@ -1101,7 +1100,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
|
||||
(cbc128_f) AES_cbc_encrypt : NULL;
|
||||
} else
|
||||
# ifdef HWAES_CAPABLE
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
ret = HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&dat->ks.ks);
|
||||
@@ -1119,16 +1118,16 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
# endif
|
||||
(void)0; /* terminate potentially open 'else' */
|
||||
} else
|
||||
# endif
|
||||
# ifdef BSAES_CAPABLE
|
||||
#endif
|
||||
#ifdef BSAES_CAPABLE
|
||||
if (BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE) {
|
||||
ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&dat->ks.ks);
|
||||
dat->block = (block128_f) AES_encrypt;
|
||||
dat->stream.ctr = (ctr128_f) bsaes_ctr32_encrypt_blocks;
|
||||
} else
|
||||
# endif
|
||||
# ifdef VPAES_CAPABLE
|
||||
#endif
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
ret = vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&dat->ks.ks);
|
||||
@@ -1136,17 +1135,17 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
|
||||
(cbc128_f) vpaes_cbc_encrypt : NULL;
|
||||
} else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&dat->ks.ks);
|
||||
dat->block = (block128_f) AES_encrypt;
|
||||
dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ?
|
||||
(cbc128_f) AES_cbc_encrypt : NULL;
|
||||
# ifdef AES_CTR_ASM
|
||||
#ifdef AES_CTR_ASM
|
||||
if (mode == EVP_CIPH_CTR_MODE)
|
||||
dat->stream.ctr = (ctr128_f) AES_ctr32_encrypt;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -1454,7 +1453,7 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
if (key) {
|
||||
do {
|
||||
# ifdef HWAES_CAPABLE
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&gctx->ks.ks);
|
||||
@@ -1467,8 +1466,8 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
# endif
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
# ifdef BSAES_CAPABLE
|
||||
#endif
|
||||
#ifdef BSAES_CAPABLE
|
||||
if (BSAES_CAPABLE) {
|
||||
AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&gctx->ks.ks);
|
||||
@@ -1477,8 +1476,8 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
gctx->ctr = (ctr128_f) bsaes_ctr32_encrypt_blocks;
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
# ifdef VPAES_CAPABLE
|
||||
#endif
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&gctx->ks.ks);
|
||||
@@ -1487,18 +1486,18 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
gctx->ctr = NULL;
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
#endif
|
||||
(void)0; /* terminate potentially open 'else' */
|
||||
|
||||
AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&gctx->ks.ks);
|
||||
CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks,
|
||||
(block128_f) AES_encrypt);
|
||||
# ifdef AES_CTR_ASM
|
||||
#ifdef AES_CTR_ASM
|
||||
gctx->ctr = (ctr128_f) AES_ctr32_encrypt;
|
||||
# else
|
||||
#else
|
||||
gctx->ctr = NULL;
|
||||
# endif
|
||||
#endif
|
||||
} while (0);
|
||||
|
||||
/*
|
||||
@@ -1559,7 +1558,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
/* Encrypt payload */
|
||||
if (gctx->ctr) {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM)
|
||||
#if defined(AES_GCM_ASM)
|
||||
if (len >= 32 && AES_GCM_ASM(gctx)) {
|
||||
if (CRYPTO_gcm128_encrypt(&gctx->gcm, NULL, NULL, 0))
|
||||
return -1;
|
||||
@@ -1569,7 +1568,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.Yi.c, gctx->gcm.Xi.u);
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
|
||||
in + bulk,
|
||||
out + bulk,
|
||||
@@ -1577,7 +1576,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
goto err;
|
||||
} else {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM2)
|
||||
#if defined(AES_GCM_ASM2)
|
||||
if (len >= 32 && AES_GCM_ASM2(gctx)) {
|
||||
if (CRYPTO_gcm128_encrypt(&gctx->gcm, NULL, NULL, 0))
|
||||
return -1;
|
||||
@@ -1587,7 +1586,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.Yi.c, gctx->gcm.Xi.u);
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_encrypt(&gctx->gcm,
|
||||
in + bulk, out + bulk, len - bulk))
|
||||
goto err;
|
||||
@@ -1600,7 +1599,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
/* Decrypt */
|
||||
if (gctx->ctr) {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM)
|
||||
#if defined(AES_GCM_ASM)
|
||||
if (len >= 16 && AES_GCM_ASM(gctx)) {
|
||||
if (CRYPTO_gcm128_decrypt(&gctx->gcm, NULL, NULL, 0))
|
||||
return -1;
|
||||
@@ -1610,7 +1609,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.Yi.c, gctx->gcm.Xi.u);
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
|
||||
in + bulk,
|
||||
out + bulk,
|
||||
@@ -1618,7 +1617,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
goto err;
|
||||
} else {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM2)
|
||||
#if defined(AES_GCM_ASM2)
|
||||
if (len >= 16 && AES_GCM_ASM2(gctx)) {
|
||||
if (CRYPTO_gcm128_decrypt(&gctx->gcm, NULL, NULL, 0))
|
||||
return -1;
|
||||
@@ -1628,7 +1627,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.Yi.c, gctx->gcm.Xi.u);
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_decrypt(&gctx->gcm,
|
||||
in + bulk, out + bulk, len - bulk))
|
||||
goto err;
|
||||
@@ -1671,7 +1670,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
} else if (EVP_CIPHER_CTX_encrypting(ctx)) {
|
||||
if (gctx->ctr) {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM)
|
||||
#if defined(AES_GCM_ASM)
|
||||
if (len >= 32 && AES_GCM_ASM(gctx)) {
|
||||
size_t res = (16 - gctx->gcm.mres) % 16;
|
||||
|
||||
@@ -1685,7 +1684,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
bulk += res;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
|
||||
in + bulk,
|
||||
out + bulk,
|
||||
@@ -1693,7 +1692,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
return -1;
|
||||
} else {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM2)
|
||||
#if defined(AES_GCM_ASM2)
|
||||
if (len >= 32 && AES_GCM_ASM2(gctx)) {
|
||||
size_t res = (16 - gctx->gcm.mres) % 16;
|
||||
|
||||
@@ -1707,7 +1706,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
bulk += res;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_encrypt(&gctx->gcm,
|
||||
in + bulk, out + bulk, len - bulk))
|
||||
return -1;
|
||||
@@ -1715,7 +1714,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
} else {
|
||||
if (gctx->ctr) {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM)
|
||||
#if defined(AES_GCM_ASM)
|
||||
if (len >= 16 && AES_GCM_ASM(gctx)) {
|
||||
size_t res = (16 - gctx->gcm.mres) % 16;
|
||||
|
||||
@@ -1729,7 +1728,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
bulk += res;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
|
||||
in + bulk,
|
||||
out + bulk,
|
||||
@@ -1737,7 +1736,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
return -1;
|
||||
} else {
|
||||
size_t bulk = 0;
|
||||
# if defined(AES_GCM_ASM2)
|
||||
#if defined(AES_GCM_ASM2)
|
||||
if (len >= 16 && AES_GCM_ASM2(gctx)) {
|
||||
size_t res = (16 - gctx->gcm.mres) % 16;
|
||||
|
||||
@@ -1751,7 +1750,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
gctx->gcm.len.u[1] += bulk;
|
||||
bulk += res;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (CRYPTO_gcm128_decrypt(&gctx->gcm,
|
||||
in + bulk, out + bulk, len - bulk))
|
||||
return -1;
|
||||
@@ -1778,7 +1777,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
|
||||
}
|
||||
|
||||
# define CUSTOM_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 \
|
||||
#define CUSTOM_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 \
|
||||
| EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \
|
||||
| EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT \
|
||||
| EVP_CIPH_CUSTOM_COPY)
|
||||
@@ -1824,13 +1823,13 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
|
||||
if (key)
|
||||
do {
|
||||
# ifdef AES_XTS_ASM
|
||||
#ifdef AES_XTS_ASM
|
||||
xctx->stream = enc ? AES_xts_encrypt : AES_xts_decrypt;
|
||||
# else
|
||||
#else
|
||||
xctx->stream = NULL;
|
||||
# endif
|
||||
#endif
|
||||
/* key_len is two AES keys */
|
||||
# ifdef HWAES_CAPABLE
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
if (enc) {
|
||||
HWAES_set_encrypt_key(key,
|
||||
@@ -1852,13 +1851,13 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
# ifdef BSAES_CAPABLE
|
||||
#endif
|
||||
#ifdef BSAES_CAPABLE
|
||||
if (BSAES_CAPABLE)
|
||||
xctx->stream = enc ? bsaes_xts_encrypt : bsaes_xts_decrypt;
|
||||
else
|
||||
# endif
|
||||
# ifdef VPAES_CAPABLE
|
||||
#endif
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
if (enc) {
|
||||
vpaes_set_encrypt_key(key,
|
||||
@@ -1880,7 +1879,7 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
#endif
|
||||
(void)0; /* terminate potentially open 'else' */
|
||||
|
||||
if (enc) {
|
||||
@@ -1928,9 +1927,9 @@ static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
return 1;
|
||||
}
|
||||
|
||||
# define aes_xts_cleanup NULL
|
||||
#define aes_xts_cleanup NULL
|
||||
|
||||
# define XTS_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV \
|
||||
#define XTS_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV \
|
||||
| EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT \
|
||||
| EVP_CIPH_CUSTOM_COPY)
|
||||
|
||||
@@ -2036,7 +2035,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
if (key)
|
||||
do {
|
||||
# ifdef HWAES_CAPABLE
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&cctx->ks.ks);
|
||||
@@ -2047,8 +2046,8 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
cctx->key_set = 1;
|
||||
break;
|
||||
} else
|
||||
# endif
|
||||
# ifdef VPAES_CAPABLE
|
||||
#endif
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&cctx->ks.ks);
|
||||
@@ -2058,7 +2057,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
cctx->key_set = 1;
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8,
|
||||
&cctx->ks.ks);
|
||||
CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
|
||||
@@ -2190,7 +2189,7 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
}
|
||||
}
|
||||
|
||||
# define aes_ccm_cleanup NULL
|
||||
#define aes_ccm_cleanup NULL
|
||||
|
||||
BLOCK_CIPHER_custom(NID_aes, 128, 1, 12, ccm, CCM,
|
||||
EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
|
||||
@@ -2286,7 +2285,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
return rv ? (int)rv : -1;
|
||||
}
|
||||
|
||||
# define WRAP_FLAGS (EVP_CIPH_WRAP_MODE \
|
||||
#define WRAP_FLAGS (EVP_CIPH_WRAP_MODE \
|
||||
| EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \
|
||||
| EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_FLAG_DEFAULT_ASN1)
|
||||
|
||||
@@ -2374,7 +2373,7 @@ const EVP_CIPHER *EVP_aes_256_wrap_pad(void)
|
||||
return &aes_256_wrap_pad;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
|
||||
{
|
||||
EVP_AES_OCB_CTX *octx = EVP_C_DATA(EVP_AES_OCB_CTX,c);
|
||||
@@ -2690,5 +2689,4 @@ BLOCK_CIPHER_custom(NID_aes, 192, 16, 12, ocb, OCB,
|
||||
EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
|
||||
BLOCK_CIPHER_custom(NID_aes, 256, 16, 12, ocb, OCB,
|
||||
EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
|
||||
# endif /* OPENSSL_NO_OCB */
|
||||
#endif
|
||||
#endif /* OPENSSL_NO_OCB */
|
||||
|
||||
@@ -52,31 +52,29 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(OPENSSL_NO_AES)
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rand.h>
|
||||
#include "modes_lcl.h"
|
||||
#include "internal/evp_int.h"
|
||||
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/objects.h>
|
||||
# include <openssl/aes.h>
|
||||
# include <openssl/sha.h>
|
||||
# include <openssl/rand.h>
|
||||
# include "modes_lcl.h"
|
||||
# include "internal/evp_int.h"
|
||||
|
||||
# ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
|
||||
# define EVP_CTRL_AEAD_TLS1_AAD 0x16
|
||||
# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if !defined(EVP_CIPH_FLAG_DEFAULT_ASN1)
|
||||
#if !defined(EVP_CIPH_FLAG_DEFAULT_ASN1)
|
||||
# define EVP_CIPH_FLAG_DEFAULT_ASN1 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if !defined(EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)
|
||||
#if !defined(EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)
|
||||
# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define TLS1_1_VERSION 0x0302
|
||||
#define TLS1_1_VERSION 0x0302
|
||||
|
||||
typedef struct {
|
||||
AES_KEY ks;
|
||||
@@ -88,9 +86,9 @@ typedef struct {
|
||||
} aux;
|
||||
} EVP_AES_HMAC_SHA1;
|
||||
|
||||
# define NO_PAYLOAD_LENGTH ((size_t)-1)
|
||||
#define NO_PAYLOAD_LENGTH ((size_t)-1)
|
||||
|
||||
# if defined(AES_ASM) && ( \
|
||||
#if defined(AES_ASM) && ( \
|
||||
defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(_M_AMD64) || defined(_M_X64) || \
|
||||
defined(__INTEL__) )
|
||||
@@ -1000,7 +998,7 @@ const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void)
|
||||
return (OPENSSL_ia32cap_P[1] & AESNI_CAPABLE ?
|
||||
&aesni_256_cbc_hmac_sha1_cipher : NULL);
|
||||
}
|
||||
# else
|
||||
#else
|
||||
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void)
|
||||
{
|
||||
return NULL;
|
||||
@@ -1010,5 +1008,4 @@ const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -52,31 +52,30 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(OPENSSL_NO_AES)
|
||||
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/objects.h>
|
||||
# include <openssl/aes.h>
|
||||
# include <openssl/sha.h>
|
||||
# include <openssl/rand.h>
|
||||
# include "modes_lcl.h"
|
||||
# include "internal/evp_int.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rand.h>
|
||||
#include "modes_lcl.h"
|
||||
#include "internal/evp_int.h"
|
||||
|
||||
# ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
|
||||
# define EVP_CTRL_AEAD_TLS1_AAD 0x16
|
||||
# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if !defined(EVP_CIPH_FLAG_DEFAULT_ASN1)
|
||||
#if !defined(EVP_CIPH_FLAG_DEFAULT_ASN1)
|
||||
# define EVP_CIPH_FLAG_DEFAULT_ASN1 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if !defined(EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)
|
||||
#if !defined(EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)
|
||||
# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define TLS1_1_VERSION 0x0302
|
||||
#define TLS1_1_VERSION 0x0302
|
||||
|
||||
typedef struct {
|
||||
AES_KEY ks;
|
||||
@@ -90,7 +89,7 @@ typedef struct {
|
||||
|
||||
# define NO_PAYLOAD_LENGTH ((size_t)-1)
|
||||
|
||||
# if defined(AES_ASM) && ( \
|
||||
#if defined(AES_ASM) && ( \
|
||||
defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(_M_AMD64) || defined(_M_X64) || \
|
||||
defined(__INTEL__) )
|
||||
@@ -982,7 +981,7 @@ const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void)
|
||||
aesni_cbc_sha256_enc(NULL, NULL, 0, NULL, NULL, NULL, NULL) ?
|
||||
&aesni_256_cbc_hmac_sha256_cipher : NULL);
|
||||
}
|
||||
# else
|
||||
#else
|
||||
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void)
|
||||
{
|
||||
return NULL;
|
||||
@@ -992,5 +991,4 @@ const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -138,7 +138,6 @@ const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void)
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_AES
|
||||
# undef EVP_aes_128_cfb
|
||||
const EVP_CIPHER *EVP_aes_128_cfb(void);
|
||||
const EVP_CIPHER *EVP_aes_128_cfb(void)
|
||||
@@ -159,6 +158,5 @@ const EVP_CIPHER *EVP_aes_256_cfb(void)
|
||||
{
|
||||
return EVP_aes_256_cfb128();
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,9 +69,7 @@
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/evp.h>
|
||||
#ifndef OPENSSL_NO_AES
|
||||
# include <openssl/aes.h>
|
||||
#endif
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/modes.h>
|
||||
@@ -137,10 +135,8 @@ static int padlock_init(ENGINE *e);
|
||||
static RAND_METHOD padlock_rand;
|
||||
|
||||
/* Cipher Stuff */
|
||||
# ifndef OPENSSL_NO_AES
|
||||
static int padlock_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
|
||||
const int **nids, int nid);
|
||||
# endif
|
||||
|
||||
/* Engine names */
|
||||
static const char *padlock_id = "padlock";
|
||||
@@ -174,9 +170,7 @@ static int padlock_bind_helper(ENGINE *e)
|
||||
if (!ENGINE_set_id(e, padlock_id) ||
|
||||
!ENGINE_set_name(e, padlock_name) ||
|
||||
!ENGINE_set_init_function(e, padlock_init) ||
|
||||
# ifndef OPENSSL_NO_AES
|
||||
(padlock_use_ace && !ENGINE_set_ciphers(e, padlock_ciphers)) ||
|
||||
# endif
|
||||
(padlock_use_rng && !ENGINE_set_RAND(e, &padlock_rand))) {
|
||||
return 0;
|
||||
}
|
||||
@@ -232,7 +226,7 @@ IMPLEMENT_DYNAMIC_CHECK_FN()
|
||||
IMPLEMENT_DYNAMIC_BIND_FN(padlock_bind_fn)
|
||||
# endif /* DYNAMIC_ENGINE */
|
||||
/* ===== Here comes the "real" engine ===== */
|
||||
# ifndef OPENSSL_NO_AES
|
||||
|
||||
/* Some AES-related constants */
|
||||
# define AES_BLOCK_SIZE 16
|
||||
# define AES_KEY_SIZE_128 16
|
||||
@@ -263,7 +257,6 @@ struct padlock_cipher_data {
|
||||
} cword; /* Control word */
|
||||
AES_KEY ks; /* Encryption key */
|
||||
};
|
||||
# endif
|
||||
|
||||
/* Interface to assembler module */
|
||||
unsigned int padlock_capability();
|
||||
@@ -303,7 +296,6 @@ static int padlock_available(void)
|
||||
}
|
||||
|
||||
/* ===== AES encryption/decryption ===== */
|
||||
# ifndef OPENSSL_NO_AES
|
||||
|
||||
# if defined(NID_aes_128_cfb128) && ! defined (NID_aes_128_cfb)
|
||||
# define NID_aes_128_cfb NID_aes_128_cfb128
|
||||
@@ -731,8 +723,6 @@ padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
}
|
||||
|
||||
# endif /* OPENSSL_NO_AES */
|
||||
|
||||
/* ===== Random Number Generator ===== */
|
||||
/*
|
||||
* This code is not engaged. The reason is that it does not comply
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef OPENSSL_NO_AES
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -130,6 +129,5 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -793,7 +793,6 @@ const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
|
||||
# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
|
||||
const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_AES
|
||||
const EVP_CIPHER *EVP_aes_128_ecb(void);
|
||||
const EVP_CIPHER *EVP_aes_128_cbc(void);
|
||||
const EVP_CIPHER *EVP_aes_128_cfb1(void);
|
||||
@@ -845,7 +844,6 @@ const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
|
||||
const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
|
||||
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void);
|
||||
const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_CAMELLIA
|
||||
const EVP_CIPHER *EVP_camellia_128_ecb(void);
|
||||
const EVP_CIPHER *EVP_camellia_128_cbc(void);
|
||||
|
||||
@@ -97,7 +97,6 @@ static void ossl_init_ssl_base(void)
|
||||
*/
|
||||
EVP_add_cipher(EVP_rc2_40_cbc());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AES
|
||||
EVP_add_cipher(EVP_aes_128_cbc());
|
||||
EVP_add_cipher(EVP_aes_192_cbc());
|
||||
EVP_add_cipher(EVP_aes_256_cbc());
|
||||
@@ -109,7 +108,6 @@ static void ossl_init_ssl_base(void)
|
||||
EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
|
||||
EVP_add_cipher(EVP_aes_128_cbc_hmac_sha256());
|
||||
EVP_add_cipher(EVP_aes_256_cbc_hmac_sha256());
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
EVP_add_cipher(EVP_camellia_128_cbc());
|
||||
EVP_add_cipher(EVP_camellia_256_cbc());
|
||||
|
||||
Reference in New Issue
Block a user