]> git.ipfire.org Git - thirdparty/openssl.git/commit
property: do not overwrite the NULL-provider cache entry on set
authorJakub Zelenka <jakub.zelenka@openssl.foundation>
Wed, 17 Jun 2026 15:59:40 +0000 (17:59 +0200)
committerNeil Horman <nhorman@openssl.org>
Thu, 18 Jun 2026 18:02:13 +0000 (14:02 -0400)
commit9d476175d777c4da1a1b4f218d14b54ef4ba7505
tree86dc9c59e4926e7ecbe9d093f5bc9764d8b11252
parent3989ab04c6061d62382fb7d4b03ec6ed7601160e
property: do not overwrite the NULL-provider cache entry on set

ossl_method_store_cache_set inserts two entries per method: one keyed
on (nid, prop_query, prov) and one keyed on (nid, prop_query) with a
NULL provider, used to match "any provider" lookups.

Previously the set path always replaced the NULL-provider entry. When a
second provider cached the same nid, its method became the result for
"any provider" lookups, even though an earlier provider was already
cached. A shared nid could then resolve to the wrong provider: a
certificate's SPKI would decode through that provider's keymgmt and
X509_check_private_key would fail with a key value mismatch.

Only insert the NULL-provider entry when one does not already exist, so
the first provider to cache the nid owns it, matching the order
ossl_method_store_fetch would select.

Assisted-by: Claude:claude-opus-4-8
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Thu Jun 18 18:02:32 2026
(Merged from https://github.com/openssl/openssl/pull/31568)
crypto/property/property.c