doc: Document that the OBJ creation functions don't lock.
authorPauli <pauli@openssl.org>
Tue, 22 Jun 2021 23:46:42 +0000 (09:46 +1000)
committerPauli <pauli@openssl.org>
Thu, 24 Jun 2021 05:50:26 +0000 (15:50 +1000)
Neither OBJ_create() nor OBJ_add_sigid() use locks.  They are not thread safe.
They can and will cause the other OBJ_ query functions to fail in mysterious
ways if called concurrently with them.

There is no problem calling multiple query functions concurrently.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15865)

doc/man3/OBJ_nid2obj.pod
doc/man7/provider-base.pod

index 4f35e8b2684b545ce48969e1d1efdf0e4d11c146..58fc94f6dd97a921829e94de0070a54875f8f804 100644 (file)
@@ -181,6 +181,10 @@ Instead I<buf> must point to a valid buffer and I<buf_len> should
 be set to a positive value. A buffer length of 80 should be more
 than enough to handle any OID encountered in practice.
 
+Neither OBJ_create() nor OBJ_add_sigid() do any locking and are thus not
+thread safe.  Moreover, none of the other functions should be called while
+concurrent calls to these two functions are possible.
+
 =head1 SEE ALSO
 
 L<ERR_get_error(3)>
index 0eb2f5d243ba5859762c27bb2fb02f2b0baac1e9..5812ece7f8d5dc1b35ebd4efcf16279bc22821e0 100644 (file)
@@ -264,6 +264,7 @@ It will treat as success the case where the OID already exists (even if the
 short name I<sn> or long name I<ln> provided as arguments differ from those
 associated with the existing OID, in which case the new names are not
 associated).
+This function is not thread safe.
 
 The core_obj_add_sigid() function registers a new composite signature algorithm
 (I<sign_name>) consisting of an underlying signature algorithm (I<pkey_name>)
@@ -277,6 +278,7 @@ to identify the object. It will treat as success the case where the composite
 signature algorithm already exists (even if registered against a different
 underlying signature or digest algorithm). It returns 1 on success or 0 on
 failure.
+This function is not thread safe.
 
 CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_memdup(), CRYPTO_strdup(),
 CRYPTO_strndup(), CRYPTO_free(), CRYPTO_clear_free(),