Replumbing: pass callback data to the algo destructor too
authorRichard Levitte <levitte@openssl.org>
Wed, 13 Mar 2019 10:12:00 +0000 (11:12 +0100)
committerRichard Levitte <levitte@openssl.org>
Mon, 18 Mar 2019 13:27:02 +0000 (14:27 +0100)
All relevant OSSL_METHOD_CONSTRUCT_METHOD callbacks got the callback
data passed to them, except 'destruct'.  There's no reason why it
shouldn't get that pointer passed, so we make a small adjustment.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8341)

crypto/core_fetch.c
include/internal/core.h

index d2d77665125627aab460e8904fad8d82c67637d7..bfdd36d42977c2a09b706b002b9504ff247112d2 100644 (file)
@@ -47,7 +47,7 @@ static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata)
             if (!data->mcm->put(data->libctx, NULL,
                                 thismap->property_definition,
                                 method, data->mcm_data)) {
-                data->mcm->destruct(method);
+                data->mcm->destruct(method, data->mcm_data);
                 continue;
             }
         }
@@ -55,7 +55,7 @@ static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata)
         if (!data->mcm->put(data->libctx, data->store,
                             thismap->property_definition,
                             method, data->mcm_data)) {
-            data->mcm->destruct(method);
+            data->mcm->destruct(method, data->mcm_data);
             continue;
         }
     }
index 2f0df376d3bb8fd1faa7b2ca5a57deb523d4d79d..b395025eccd448faca7a9026957e3b1d790ca322 100644 (file)
@@ -41,7 +41,7 @@ typedef struct ossl_method_construct_method_st {
     void *(*construct)(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov,
                        void *data);
     /* Destruct a method */
-    void (*destruct)(void *method);
+    void (*destruct)(void *method, void *data);
 } OSSL_METHOD_CONSTRUCT_METHOD;
 
 void *ossl_method_construct(OPENSSL_CTX *ctx, int operation_id,