namemap: change ossl_namemap_empty() to do what the documentation says.
authorPauli <paul.dale@oracle.com>
Thu, 18 Jun 2020 01:01:08 +0000 (11:01 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 21 Jun 2020 06:49:51 +0000 (16:49 +1000)
commitc720fc35f4aa90cdc7cdc424b976c5322fb0098e
tree9f07933602da736bf81631410a40ead69c979592
parent7cc5e0d283800c757e46d1476273d271120aa38d
namemap: change ossl_namemap_empty() to do what the documentation says.

The function is documented as returning 1 when passed a NULL argument.
Instead it core dumps.  Added a unit test for this.

Additionally, a performance improvement is incorporated.  The namemap
max_number field is only ever compared against zero and incremented.
The zero comparison grabs a lock specifically for this check.  This change
uses TSAN operations instead if they are available.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12181)
crypto/core_namemap.c
test/namemap_internal_test.c