diff options
author | Richard Levitte <levitte@openssl.org> | 2019-08-21 10:08:44 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-08-22 01:50:30 +0200 |
commit | c1d56231ef6385b557ec72eec508e55ea26ca8b0 (patch) | |
tree | c813f45c7adc28816afbd199b5df4d972fc54019 /include | |
parent | b1d40ddfe23fd9551b89cdcfa52d1c23fc667f8a (diff) |
Modify ossl_method_store_add() to accept an OSSL_PROVIDER and check for it
If ossl_method_store_add() gets called with a method that already exists
(i.e. the store has one with matching provider, nid and properties), that
method should not be stored. We do this check inside ossl_method_store_add()
because it has all the locking required to do so safely.
Fixes #9561
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9650)
Diffstat (limited to 'include')
-rw-r--r-- | include/internal/core.h | 4 | ||||
-rw-r--r-- | include/internal/property.h | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/internal/core.h b/include/internal/core.h index bd2f9a0989..a40d3c69af 100644 --- a/include/internal/core.h +++ b/include/internal/core.h @@ -37,8 +37,8 @@ typedef struct ossl_method_construct_method_st { void *data); /* Store a method in a store */ int (*put)(OPENSSL_CTX *libctx, void *store, void *method, - int operation_id, const char *name, const char *propdef, - void *data); + const OSSL_PROVIDER *prov, int operation_id, const char *name, + const char *propdef, void *data); /* Construct a new method */ void *(*construct)(const char *name, const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov, void *data); diff --git a/include/internal/property.h b/include/internal/property.h index e7e7f574e8..3c6d6a9002 100644 --- a/include/internal/property.h +++ b/include/internal/property.h @@ -18,12 +18,12 @@ typedef struct ossl_method_store_st OSSL_METHOD_STORE; /* Implementation store functions */ OSSL_METHOD_STORE *ossl_method_store_new(OPENSSL_CTX *ctx); void ossl_method_store_free(OSSL_METHOD_STORE *store); -int ossl_method_store_add(OSSL_METHOD_STORE *store, int nid, - const char *properties, void *implementation, - int (*implementation_up_ref)(void *), - void (*implementation_destruct)(void *)); -int ossl_method_store_remove(OSSL_METHOD_STORE *store, - int nid, const void *implementation); +int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, + int nid, const char *properties, void *method, + int (*method_up_ref)(void *), + void (*method_destruct)(void *)); +int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid, + const void *method); int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid, const char *prop_query, void **result); int ossl_method_store_set_global_properties(OSSL_METHOD_STORE *store, |