diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2022-02-11 16:39:17 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2022-02-11 16:39:17 +0000 |
commit | e986d558b7ce95b3432641a986976c24518ce576 (patch) | |
tree | 696a000393f328586d410749f37108d5921c4997 /lib/libcrypto | |
parent | ddeaa07d64ffd7fc11163cd5a2d8f8ce0ba9be1b (diff) |
Make OBJ_obj2nid() work correctly with NID_undef.
Currently OBJ_obj2nid() with NID_undef returns NID_ccitt - this is due to
doing a lookup on an empty value and having NID_undef conflict with an
uninitialised NID value.
Somewhat based on OpenSSL 0fb99904809.
ok tb@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/objects/obj_dat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index 4f7396f669b..7aecda2641d 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.45 2022/01/08 21:36:39 tb Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.46 2022/02/11 16:39:16 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -458,9 +458,9 @@ OBJ_obj2nid(const ASN1_OBJECT *a) const unsigned int *op; ADDED_OBJ ad, *adp; - if (a == NULL) + if (a == NULL || a->length == 0) return (NID_undef); - if (a->nid != 0) + if (a->nid != NID_undef) return (a->nid); if (added != NULL) { |