version 1.27, 2021/12/26 15:34:26 |
version 1.28, 2022/01/14 09:27:30 |
|
|
const EVP_AEAD *aead = EVP_aead_aes_128_gcm(); |
const EVP_AEAD *aead = EVP_aead_aes_128_gcm(); |
static const unsigned char nonce[32] = {0}; |
static const unsigned char nonce[32] = {0}; |
size_t buf_len, nonce_len; |
size_t buf_len, nonce_len; |
EVP_AEAD_CTX ctx; |
EVP_AEAD_CTX *ctx; |
|
|
EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), |
if ((ctx = EVP_AEAD_CTX_new()) == NULL) { |
|
BIO_printf(bio_err, |
|
"Failed to allocate aead context.\n"); |
|
goto end; |
|
} |
|
|
|
EVP_AEAD_CTX_init(ctx, aead, key32, EVP_AEAD_key_length(aead), |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
nonce_len = EVP_AEAD_nonce_length(aead); |
nonce_len = EVP_AEAD_nonce_length(aead); |
|
|
|
|
print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); |
print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); |
Time_F(START); |
Time_F(START); |
for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) |
for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) |
EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, |
EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
nonce_len, buf, lengths[j], NULL, 0); |
nonce_len, buf, lengths[j], NULL, 0); |
d=Time_F(STOP); |
d=Time_F(STOP); |
print_result(D_AES_128_GCM,j,count,d); |
print_result(D_AES_128_GCM,j,count,d); |
} |
} |
EVP_AEAD_CTX_cleanup(&ctx); |
EVP_AEAD_CTX_free(ctx); |
} |
} |
|
|
if (doit[D_AES_256_GCM]) { |
if (doit[D_AES_256_GCM]) { |
const EVP_AEAD *aead = EVP_aead_aes_256_gcm(); |
const EVP_AEAD *aead = EVP_aead_aes_256_gcm(); |
static const unsigned char nonce[32] = {0}; |
static const unsigned char nonce[32] = {0}; |
size_t buf_len, nonce_len; |
size_t buf_len, nonce_len; |
EVP_AEAD_CTX ctx; |
EVP_AEAD_CTX *ctx; |
|
|
EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), |
if ((ctx = EVP_AEAD_CTX_new()) == NULL) { |
|
BIO_printf(bio_err, |
|
"Failed to allocate aead context.\n"); |
|
goto end; |
|
} |
|
|
|
EVP_AEAD_CTX_init(ctx, aead, key32, EVP_AEAD_key_length(aead), |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
nonce_len = EVP_AEAD_nonce_length(aead); |
nonce_len = EVP_AEAD_nonce_length(aead); |
|
|
|
|
print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); |
print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); |
Time_F(START); |
Time_F(START); |
for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) |
for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) |
EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, |
EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
nonce_len, buf, lengths[j], NULL, 0); |
nonce_len, buf, lengths[j], NULL, 0); |
d=Time_F(STOP); |
d=Time_F(STOP); |
print_result(D_AES_256_GCM, j, count, d); |
print_result(D_AES_256_GCM, j, count, d); |
} |
} |
EVP_AEAD_CTX_cleanup(&ctx); |
EVP_AEAD_CTX_free(ctx); |
} |
} |
#endif |
#endif |
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) |
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) |
|
|
const EVP_AEAD *aead = EVP_aead_chacha20_poly1305(); |
const EVP_AEAD *aead = EVP_aead_chacha20_poly1305(); |
static const unsigned char nonce[32] = {0}; |
static const unsigned char nonce[32] = {0}; |
size_t buf_len, nonce_len; |
size_t buf_len, nonce_len; |
EVP_AEAD_CTX ctx; |
EVP_AEAD_CTX *ctx; |
|
|
EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), |
if ((ctx = EVP_AEAD_CTX_new()) == NULL) { |
|
BIO_printf(bio_err, |
|
"Failed to allocate aead context.\n"); |
|
goto end; |
|
} |
|
|
|
EVP_AEAD_CTX_init(ctx, aead, key32, EVP_AEAD_key_length(aead), |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); |
nonce_len = EVP_AEAD_nonce_length(aead); |
nonce_len = EVP_AEAD_nonce_length(aead); |
|
|
|
|
c[D_CHACHA20_POLY1305][j], lengths[j]); |
c[D_CHACHA20_POLY1305][j], lengths[j]); |
Time_F(START); |
Time_F(START); |
for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) |
for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) |
EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, |
EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
nonce_len, buf, lengths[j], NULL, 0); |
nonce_len, buf, lengths[j], NULL, 0); |
d=Time_F(STOP); |
d=Time_F(STOP); |
print_result(D_CHACHA20_POLY1305, j, count, d); |
print_result(D_CHACHA20_POLY1305, j, count, d); |
} |
} |
EVP_AEAD_CTX_cleanup(&ctx); |
EVP_AEAD_CTX_free(ctx); |
} |
} |
#endif |
#endif |
#ifndef OPENSSL_NO_CAMELLIA |
#ifndef OPENSSL_NO_CAMELLIA |