From 948d4ca4abdd228b02a462a961f27b0be0c78ac5 Mon Sep 17 00:00:00 2001 From: tb <> Date: Tue, 2 Jan 2024 18:48:02 +0000 Subject: Two spellings of key length are enough The API is called EVP_CIPHER_CTX_set_key_length() it has an argument called keylen and, the EVP_CIPHER_CTX's member is called key_len. One of the three is trivial to adjust, so do it. --- src/lib/libcrypto/evp/evp_cipher.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index 38aeaa0030..c762c968eb 100644 --- a/src/lib/libcrypto/evp/evp_cipher.c +++ b/src/lib/libcrypto/evp/evp_cipher.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_cipher.c,v 1.6 2024/01/02 18:30:27 tb Exp $ */ +/* $OpenBSD: evp_cipher.c,v 1.7 2024/01/02 18:48:02 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -643,15 +643,16 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx) } int -EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *ctx, int keylen) +EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *ctx, int key_len) { + /* XXX - remove this. It's unused. */ if (ctx->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_KEY_LENGTH, - keylen, NULL); - if (ctx->key_len == keylen) + key_len, NULL); + if (ctx->key_len == key_len) return 1; - if (keylen > 0 && (ctx->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { - ctx->key_len = keylen; + if (key_len > 0 && (ctx->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { + ctx->key_len = key_len; return 1; } EVPerror(EVP_R_INVALID_KEY_LENGTH); -- cgit v1.2.3-55-g6feb