[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Wed Jun 1 12:17:43 UTC 2016


The branch master has been updated
       via  b2b361f6afb55c501bedef664c1fdc0d71a91d4b (commit)
      from  57358a83a401ef469353b7ebdae0cf3b870a4d5e (commit)


- Log -----------------------------------------------------------------
commit b2b361f6afb55c501bedef664c1fdc0d71a91d4b
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Sat Apr 30 16:23:33 2016 +0200

    Raise an Err when CRYPTO_THREAD_lock_new fails
    
    Add missing error raise call, as it is done everywhere else.
    and as CRYPTO_THREAD_lock_new don't do it internally.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>

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

Summary of changes:
 crypto/asn1/tasn_utl.c | 5 ++++-
 crypto/dh/dh_lib.c     | 1 +
 crypto/dsa/dsa_lib.c   | 1 +
 crypto/dso/dso_lib.c   | 1 +
 engines/e_chil.c       | 8 ++++++--
 engines/e_chil_err.h   | 2 ++
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c
index cb24593..f03f9e9 100644
--- a/crypto/asn1/tasn_utl.c
+++ b/crypto/asn1/tasn_utl.c
@@ -50,6 +50,7 @@ int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
  * then the count is incremented. If op is 0 count is set to 1. If op is -1
  * count is decremented and the return value is the current reference count
  * or 0 if no reference count exists.
+ * FIXME: return and manage any error from inside this method
  */
 
 int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
@@ -68,8 +69,10 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
     if (op == 0) {
         *lck = 1;
         *lock = CRYPTO_THREAD_lock_new();
-        if (*lock == NULL)
+        if (*lock == NULL) {
+            /* FIXME: should report an error (-1) at this point */
             return 0;
+        }
         return 1;
     }
     CRYPTO_atomic_add(lck, op, &ret, *lock);
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index 8645b67..6a59f7f 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -64,6 +64,7 @@ DH *DH_new_method(ENGINE *engine)
     ret->references = 1;
     ret->lock = CRYPTO_THREAD_lock_new();
     if (ret->lock == NULL) {
+        DHerr(DH_F_DH_NEW_METHOD, ERR_R_MALLOC_FAILURE);
         OPENSSL_free(ret);
         return NULL;
     }
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 9294594..14cb35f 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -73,6 +73,7 @@ DSA *DSA_new_method(ENGINE *engine)
     ret->references = 1;
     ret->lock = CRYPTO_THREAD_lock_new();
     if (ret->lock == NULL) {
+        DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
         OPENSSL_free(ret);
         return NULL;
     }
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 6bb9f5f..bea8776 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -39,6 +39,7 @@ static DSO *DSO_new_method(DSO_METHOD *meth)
     ret->references = 1;
     ret->lock = CRYPTO_THREAD_lock_new();
     if (ret->lock == NULL) {
+        DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
         sk_void_free(ret->meth_data);
         OPENSSL_free(ret);
         return NULL;
diff --git a/engines/e_chil.c b/engines/e_chil.c
index 0fb7aa4..c660aa9 100644
--- a/engines/e_chil.c
+++ b/engines/e_chil.c
@@ -309,8 +309,10 @@ static int bind_helper(ENGINE *e)
 #  endif
 
     chil_lock = CRYPTO_THREAD_lock_new();
-    if (chil_lock == NULL)
+    if (chil_lock == NULL) {
+        HWCRHKerr(HWCRHK_F_BIND_HELPER, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     if (!ENGINE_set_id(e, engine_hwcrhk_id) ||
         !ENGINE_set_name(e, engine_hwcrhk_name) ||
@@ -1092,8 +1094,10 @@ static int hwcrhk_mutex_init(HWCryptoHook_Mutex * mt,
                              HWCryptoHook_CallerContext * cactx)
 {
     mt->lock = CRYPTO_THREAD_lock_new();
-    if (mt->lock == NULL)
+    if (mt->lock == NULL) {
+        HWCRHKerr(HWCRHK_F_HWCRHK_MUTEX_INIT, ERR_R_MALLOC_FAILURE);
         return 1;               /* failure */
+    }
     return 0;                   /* success */
 }
 
diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h
index 42fdd19..b0f0dd9 100644
--- a/engines/e_chil_err.h
+++ b/engines/e_chil_err.h
@@ -39,6 +39,8 @@ static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
 # define HWCRHK_F_HWCRHK_MOD_EXP                          107
 # define HWCRHK_F_HWCRHK_RAND_BYTES                       108
 # define HWCRHK_F_HWCRHK_RSA_MOD_EXP                      109
+# define HWCRHK_F_BIND_HELPER                             110
+# define HWCRHK_F_HWCRHK_MUTEX_INIT                       111
 
 /* Reason codes. */
 # define HWCRHK_R_ALREADY_LOADED                          100


More information about the openssl-commits mailing list