From 5cf727f37e61ac27fadf57c7a507c89e6320d7fe Mon Sep 17 00:00:00 2001 From: inoguchi Date: Thu, 20 Jan 2022 11:22:48 +0000 Subject: [PATCH] Add check for EVP_CIPHER_CTX_set_key_length return value CID 21653 ok jsing@ millert@ tb@ --- lib/libcrypto/evp/e_rc2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/evp/e_rc2.c b/lib/libcrypto/evp/e_rc2.c index de1b24a306d..d8c331d535f 100644 --- a/lib/libcrypto/evp/e_rc2.c +++ b/lib/libcrypto/evp/e_rc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_rc2.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: e_rc2.c,v 1.13 2022/01/20 11:22:48 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -201,7 +201,8 @@ rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) return -1; EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); - EVP_CIPHER_CTX_set_key_length(c, key_bits / 8); + if (!EVP_CIPHER_CTX_set_key_length(c, key_bits / 8)) + return -1; } return (i); } -- 2.20.1