[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Tue Mar 8 23:33:45 UTC 2016


The branch master has been updated
       via  be1251f73def8169b98d53430b631df13d430dbc (commit)
       via  6d5667110a6844640af4c7a9cb91b0cffa297ce7 (commit)
      from  8458f1bfab1b30ce96a39593331a94b44efbe2b2 (commit)


- Log -----------------------------------------------------------------
commit be1251f73def8169b98d53430b631df13d430dbc
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Mar 9 00:07:10 2016 +0100

    Remove the transfer of lock hooks from bind_engine
    
    With the new threads API, this is no longer needed.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit 6d5667110a6844640af4c7a9cb91b0cffa297ce7
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Mar 6 02:54:40 2016 +0100

    Engine API repair - memory management hooks
    
    The Engine API lost the setting of memory management hooks in
    bind_engine.  Here's putting that back.
    
    EX_DATA and ERR functions need the same treatment.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/engine/eng_dyn.c  |  7 ++-----
 include/openssl/engine.h | 33 ++++++++++++---------------------
 2 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c
index 648332a..8d29d9a 100644
--- a/crypto/engine/eng_dyn.c
+++ b/crypto/engine/eng_dyn.c
@@ -510,11 +510,8 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
      * would also increase opaqueness.
      */
     fns.static_state = ENGINE_get_static_state();
-    fns.lock_fns.lock_locking_cb = CRYPTO_get_locking_callback();
-    fns.lock_fns.lock_add_lock_cb = CRYPTO_get_add_lock_callback();
-    fns.lock_fns.dynlock_create_cb = CRYPTO_get_dynlock_create_callback();
-    fns.lock_fns.dynlock_lock_cb = CRYPTO_get_dynlock_lock_callback();
-    fns.lock_fns.dynlock_destroy_cb = CRYPTO_get_dynlock_destroy_callback();
+    CRYPTO_get_mem_functions(fns.mem_fns.malloc_fn, fns.mem_fns.realloc_fn,
+                             fns.mem_fns.free_fn);
     /*
      * Now that we've loaded the dynamic engine, make sure no "dynamic"
      * ENGINE elements will show through.
diff --git a/include/openssl/engine.h b/include/openssl/engine.h
index 7b7b2a1..d1cd17a 100644
--- a/include/openssl/engine.h
+++ b/include/openssl/engine.h
@@ -725,29 +725,22 @@ void ENGINE_add_conf_module(void);
  * same static data as the calling application (or library), and thus whether
  * these callbacks need to be set or not.
  */
+typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int);
+typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int);
+typedef void (*dyn_MEM_free_fn) (void *, const char *, int);
+typedef struct st_dynamic_MEM_fns {
+    dyn_MEM_malloc_fn malloc_fn;
+    dyn_MEM_realloc_fn realloc_fn;
+    dyn_MEM_free_fn free_fn;
+} dynamic_MEM_fns;
 /*
  * FIXME: Perhaps the memory and locking code (crypto.h) should declare and
  * use these types so we (and any other dependant code) can simplify a bit??
  */
-typedef void (*dyn_lock_locking_cb) (int, int, const char *, int);
-typedef int (*dyn_lock_add_lock_cb) (int *, int, int, const char *, int);
-typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb) (const char *,
-                                                               int);
-typedef void (*dyn_dynlock_lock_cb) (int, struct CRYPTO_dynlock_value *,
-                                     const char *, int);
-typedef void (*dyn_dynlock_destroy_cb) (struct CRYPTO_dynlock_value *,
-                                        const char *, int);
-typedef struct st_dynamic_LOCK_fns {
-    dyn_lock_locking_cb lock_locking_cb;
-    dyn_lock_add_lock_cb lock_add_lock_cb;
-    dyn_dynlock_create_cb dynlock_create_cb;
-    dyn_dynlock_lock_cb dynlock_lock_cb;
-    dyn_dynlock_destroy_cb dynlock_destroy_cb;
-} dynamic_LOCK_fns;
 /* The top-level structure */
 typedef struct st_dynamic_fns {
     void *static_state;
-    dynamic_LOCK_fns lock_fns;
+    dynamic_MEM_fns mem_fns;
 } dynamic_fns;
 
 /*
@@ -795,11 +788,9 @@ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id,
         OPENSSL_EXPORT \
         int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
                 if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
-                CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
-                CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
-                CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
-                CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
-                CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
+                CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \
+                                         fns->mem_fns.realloc_fn, \
+                                         fns->mem_fns.free_fn); \
         skip_cbs: \
                 if(!fn(e,id)) return 0; \
                 return 1; }


More information about the openssl-commits mailing list