From: tb Date: Sat, 13 Jan 2024 11:45:03 +0000 (+0000) Subject: Remove most of EVP_add_{cipher,digest}() internals X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0bfde4de5ff68a07c20b8fb92fedf393ea587efb;p=openbsd Remove most of EVP_add_{cipher,digest}() internals OBJ_NAME_add() is a noop now, so remove all calls and simplify the remainder of these two functions a bit. Intermediate step to a larger diff that was ok jsing --- diff --git a/lib/libcrypto/evp/names.c b/lib/libcrypto/evp/names.c index 6e8cdd55a63..f43534194a4 100644 --- a/lib/libcrypto/evp/names.c +++ b/lib/libcrypto/evp/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.25 2024/01/13 11:41:44 tb Exp $ */ +/* $OpenBSD: names.c,v 1.26 2024/01/13 11:45:03 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -70,47 +70,23 @@ void check_defer(int nid); int EVP_add_cipher(const EVP_CIPHER *c) { - int r; - if (c == NULL) return 0; - r = OBJ_NAME_add(OBJ_nid2sn(c->nid), OBJ_NAME_TYPE_CIPHER_METH, - (const char *)c); - if (r == 0) - return (0); check_defer(c->nid); - r = OBJ_NAME_add(OBJ_nid2ln(c->nid), OBJ_NAME_TYPE_CIPHER_METH, - (const char *)c); - return (r); + + return 1; } int EVP_add_digest(const EVP_MD *md) { - int r; - const char *name; - - name = OBJ_nid2sn(md->type); - r = OBJ_NAME_add(name, OBJ_NAME_TYPE_MD_METH, (const char *)md); - if (r == 0) - return (0); check_defer(md->type); - r = OBJ_NAME_add(OBJ_nid2ln(md->type), OBJ_NAME_TYPE_MD_METH, - (const char *)md); - if (r == 0) - return (0); - if (md->pkey_type && md->type != md->pkey_type) { - r = OBJ_NAME_add(OBJ_nid2sn(md->pkey_type), - OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS, name); - if (r == 0) - return (0); + if (md->pkey_type && md->type != md->pkey_type) check_defer(md->pkey_type); - r = OBJ_NAME_add(OBJ_nid2ln(md->pkey_type), - OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS, name); - } - return (r); + + return 1; } void