=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/speed.c,v retrieving revision 1.27 retrieving revision 1.28 diff -c -r1.27 -r1.28 *** src/usr.bin/openssl/speed.c 2021/12/26 15:34:26 1.27 --- src/usr.bin/openssl/speed.c 2022/01/14 09:27:30 1.28 *************** *** 1,4 **** ! /* $OpenBSD: speed.c,v 1.27 2021/12/26 15:34:26 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * --- 1,4 ---- ! /* $OpenBSD: speed.c,v 1.28 2022/01/14 09:27:30 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * *************** *** 1256,1264 **** const EVP_AEAD *aead = EVP_aead_aes_128_gcm(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX ctx; ! EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); nonce_len = EVP_AEAD_nonce_length(aead); --- 1256,1270 ---- const EVP_AEAD *aead = EVP_aead_aes_128_gcm(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX *ctx; ! 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); nonce_len = EVP_AEAD_nonce_length(aead); *************** *** 1266,1286 **** print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) ! EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_AES_128_GCM,j,count,d); } ! EVP_AEAD_CTX_cleanup(&ctx); } if (doit[D_AES_256_GCM]) { const EVP_AEAD *aead = EVP_aead_aes_256_gcm(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX ctx; ! EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); nonce_len = EVP_AEAD_nonce_length(aead); --- 1272,1298 ---- print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) ! EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_AES_128_GCM,j,count,d); } ! EVP_AEAD_CTX_free(ctx); } if (doit[D_AES_256_GCM]) { const EVP_AEAD *aead = EVP_aead_aes_256_gcm(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX *ctx; ! 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); nonce_len = EVP_AEAD_nonce_length(aead); *************** *** 1288,1299 **** print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) ! EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_AES_256_GCM, j, count, d); } ! EVP_AEAD_CTX_cleanup(&ctx); } #endif #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) --- 1300,1311 ---- print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) ! EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_AES_256_GCM, j, count, d); } ! EVP_AEAD_CTX_free(ctx); } #endif #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) *************** *** 1301,1309 **** const EVP_AEAD *aead = EVP_aead_chacha20_poly1305(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX ctx; ! EVP_AEAD_CTX_init(&ctx, aead, key32, EVP_AEAD_key_length(aead), EVP_AEAD_DEFAULT_TAG_LENGTH, NULL); nonce_len = EVP_AEAD_nonce_length(aead); --- 1313,1327 ---- const EVP_AEAD *aead = EVP_aead_chacha20_poly1305(); static const unsigned char nonce[32] = {0}; size_t buf_len, nonce_len; ! EVP_AEAD_CTX *ctx; ! 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); nonce_len = EVP_AEAD_nonce_length(aead); *************** *** 1312,1323 **** c[D_CHACHA20_POLY1305][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) ! EVP_AEAD_CTX_seal(&ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_CHACHA20_POLY1305, j, count, d); } ! EVP_AEAD_CTX_cleanup(&ctx); } #endif #ifndef OPENSSL_NO_CAMELLIA --- 1330,1341 ---- c[D_CHACHA20_POLY1305][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) ! EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, nonce_len, buf, lengths[j], NULL, 0); d=Time_F(STOP); print_result(D_CHACHA20_POLY1305, j, count, d); } ! EVP_AEAD_CTX_free(ctx); } #endif #ifndef OPENSSL_NO_CAMELLIA