summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_cipher.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c
index b9bc15e371..9632c4bacd 100644
--- a/src/lib/libcrypto/evp/evp_cipher.c
+++ b/src/lib/libcrypto/evp/evp_cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_cipher.c,v 1.4 2024/01/02 18:21:02 tb Exp $ */ 1/* $OpenBSD: evp_cipher.c,v 1.5 2024/01/02 18:28:35 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -807,12 +807,12 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
807 807
808/* Convert the various cipher NIDs and dummies to a proper OID NID */ 808/* Convert the various cipher NIDs and dummies to a proper OID NID */
809int 809int
810EVP_CIPHER_type(const EVP_CIPHER *ctx) 810EVP_CIPHER_type(const EVP_CIPHER *cipher)
811{ 811{
812 ASN1_OBJECT *aobj;
812 int nid; 813 int nid;
813 ASN1_OBJECT *otmp;
814 nid = EVP_CIPHER_nid(ctx);
815 814
815 nid = EVP_CIPHER_nid(cipher);
816 switch (nid) { 816 switch (nid) {
817 case NID_rc2_cbc: 817 case NID_rc2_cbc:
818 case NID_rc2_64_cbc: 818 case NID_rc2_64_cbc:
@@ -850,10 +850,11 @@ EVP_CIPHER_type(const EVP_CIPHER *ctx)
850 850
851 default: 851 default:
852 /* Check it has an OID and it is valid */ 852 /* Check it has an OID and it is valid */
853 otmp = OBJ_nid2obj(nid); 853 if (((aobj = OBJ_nid2obj(nid)) == NULL) || aobj->data == NULL)
854 if (!otmp || !otmp->data)
855 nid = NID_undef; 854 nid = NID_undef;
856 ASN1_OBJECT_free(otmp); 855
856 ASN1_OBJECT_free(aobj);
857
857 return nid; 858 return nid;
858 } 859 }
859} 860}