]> 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:01 +0000 (11:24 +0200)
commit556ba81601a37530c3620016bdeaf13094b4fb91
tree0f27fd513d50254afe5c22d3d2acce27eb1a2664
parent5909d0d3fc9b99b7b9f0577d29515a72fa94bfa0
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)
crypto/objects/obj_dat.c