summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-01-02 18:28:35 +0000
committertb <>2024-01-02 18:28:35 +0000
commit87aa0694f8442339e8640b047d7dc8c05c23c6f5 (patch)
treefce294bbcbe84ef6edfb48d013340df0791e2316 /src
parentb6549e2a0696898a23eee24771874a505fe4881e (diff)
downloadopenbsd-87aa0694f8442339e8640b047d7dc8c05c23c6f5.tar.gz
openbsd-87aa0694f8442339e8640b047d7dc8c05c23c6f5.tar.bz2
openbsd-87aa0694f8442339e8640b047d7dc8c05c23c6f5.zip
Better variable names in EVP_CIPHER_type()
The EVP_CIPHER *ctx (yes) is renamed to cipher, otmp becomes an aobj. Change two !ptr to ptr == NULL checks.
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}