From 75580eac7165a80d9f7f36b053ac7c852bd3c1b8 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 7 Dec 2021 20:13:15 +0000 Subject: [PATCH] Simple conversion to opaque EVP_CIPHER. --- usr.bin/openssl/enc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/usr.bin/openssl/enc.c b/usr.bin/openssl/enc.c index ed18527fcf2..7955d9b9401 100644 --- a/usr.bin/openssl/enc.c +++ b/usr.bin/openssl/enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enc.c,v 1.23 2019/07/25 11:42:12 bcook Exp $ */ +/* $OpenBSD: enc.c,v 1.24 2021/12/07 20:13:15 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -703,21 +703,25 @@ enc_main(int argc, char **argv) BIO_set_callback_arg(benc, (char *) bio_err); } if (enc_config.printkey) { + int key_len, iv_len; + if (!enc_config.nosalt) { printf("salt="); for (i = 0; i < (int) sizeof(salt); i++) printf("%02X", salt[i]); printf("\n"); } - if (enc_config.cipher->key_len > 0) { + key_len = EVP_CIPHER_key_length(enc_config.cipher); + if (key_len > 0) { printf("key="); - for (i = 0; i < enc_config.cipher->key_len; i++) + for (i = 0; i < key_len; i++) printf("%02X", key[i]); printf("\n"); } - if (enc_config.cipher->iv_len > 0) { + iv_len = EVP_CIPHER_iv_length(enc_config.cipher); + if (iv_len > 0) { printf("iv ="); - for (i = 0; i < enc_config.cipher->iv_len; i++) + for (i = 0; i < iv_len; i++) printf("%02X", iv[i]); printf("\n"); } -- 2.20.1