]> git.ipfire.org Git - thirdparty/openssl.git/commit
Check for OBJ_create() conflicts after write lock.
authorViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 17 Sep 2025 09:07:07 +0000 (19:07 +1000)
committerTomas Mraz <tomas@openssl.org>
Thu, 25 Sep 2025 09:24:22 +0000 (11:24 +0200)
commite70c3efd7c387cb32d8efc0b594e02d0dbca737b
treeb1beae931be5454b617e1639185b755e1082e1fa
parent174c992b15e9c91f4d888625eb1728019037b9a3
Check for OBJ_create() conflicts after write lock.

For now subsequent calls to OBJ_create() with identical inputs return
NID_undef.  It may be better to return the previous NID in the future.

The real work actually happens in OBJ_add_object().  Duplicate compares
*all* the input object's fields with any of the objects found by lookup.

If these are identical, then necessarily all the lookups found the same
data, and we can return the existing nid in low-level calls via
OBJ_add_object() that specify the nid also.  If any of the fields are
different the new object is not installed and NID_undef is returned.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28582)

(cherry picked from commit 556ba81601a37530c3620016bdeaf13094b4fb91)
crypto/objects/obj_dat.c