Add a lock around the OBJ_NAME table
authorRich Salz <rsalz@openssl.org>
Wed, 7 Jun 2017 15:23:37 +0000 (11:23 -0400)
committerRich Salz <rsalz@openssl.org>
Wed, 7 Jun 2017 17:06:55 +0000 (13:06 -0400)
commit1ec7eff1b2d761592df564d7ee92f65e08da4cd6
treea6cb87a9d109897e8b3262846f0a44eae3d224b9
parentc1abfde735eca6346eb2c0641b67b11d0e68b94c
Add a lock around the OBJ_NAME table

Various initialization functions modify this table, which can cause heap
corruption in the absence of external synchronization.

Some stats are modified from OPENSSL_LH_retrieve, where callers aren't
expecting to have to take out an exclusive lock. Switch to using atomic
operations for those stats.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3525)
(cherry picked from commit be606c013d31847718ceb5d97c567988a771c2e5)
crypto/lhash/lh_stats.c
crypto/lhash/lhash.c
crypto/lhash/lhash_lcl.h
crypto/objects/o_names.c