From 5a0b87fdf6773eb39ebd5cd9f584b0746ccc6ad3 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 14 Dec 2023 18:31:03 +0000 Subject: [PATCH] OBJ_create: use a nid variable to avoid nested function call --- lib/libcrypto/objects/obj_dat.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index 93c6e12cd30..eaa53509eba 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.78 2023/12/14 18:16:13 tb Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.79 2023/12/14 18:31:03 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -591,7 +591,7 @@ OBJ_create(const char *oid, const char *sn, const char *ln) { ASN1_OBJECT *op = NULL; unsigned char *buf = NULL; - int len; + int len, nid; int ret = 0; if ((len = a2d_ASN1_OBJECT(NULL, 0, oid, -1)) <= 0) @@ -605,7 +605,8 @@ OBJ_create(const char *oid, const char *sn, const char *ln) if ((len = a2d_ASN1_OBJECT(buf, len, oid, -1)) == 0) goto err; - if ((op = ASN1_OBJECT_create(OBJ_new_nid(1), buf, len, sn, ln)) == NULL) + nid = OBJ_new_nid(1); + if ((op = ASN1_OBJECT_create(nid, buf, len, sn, ln)) == NULL) goto err; ret = OBJ_add_object(op); -- 2.20.1