Check if test_rehash is run as root
[openssl.git] / engines / e_sureware.c
index 4580250d98e5c151576dce9f5dab0b84bba37efc..fb5e55c930a8e1b4fa26c16315390bf7cf46faf9 100644 (file)
@@ -560,8 +560,7 @@ static int surewarehk_init(ENGINE *e)
 
     return 1;
  err:
-    if (surewarehk_dso)
-        DSO_free(surewarehk_dso);
+    DSO_free(surewarehk_dso);
     surewarehk_dso = NULL;
     p_surewarehk_Init = NULL;
     p_surewarehk_Finish = NULL;
@@ -890,7 +889,7 @@ static int surewarehk_rsa_priv_dec(int flen, const unsigned char *from,
                     ENGINE_R_NOT_INITIALISED);
     }
     /* extract ref to private key */
-    else if (!(hptr = RSA_get_ex_data(rsa, rsaHndidx))) {
+    else if ((hptr = RSA_get_ex_data(rsa, rsaHndidx)) == NULL) {
         SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,
                     SUREWARE_R_MISSING_KEY_COMPONENTS);
         goto err;
@@ -948,10 +947,7 @@ static int surewarehk_rsa_priv_dec(int flen, const unsigned char *from,
                         SUREWARE_R_PADDING_CHECK_FAILED);
     }
  err:
-    if (buf) {
-        OPENSSL_cleanse(buf, tlen);
-        OPENSSL_free(buf);
-    }
+    OPENSSL_clear_free(buf, tlen);
     return ret;
 }
 
@@ -968,7 +964,7 @@ static int surewarehk_rsa_sign(int flen, const unsigned char *from,
         SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_SIGN, ENGINE_R_NOT_INITIALISED);
     }
     /* extract ref to private key */
-    else if (!(hptr = RSA_get_ex_data(rsa, rsaHndidx))) {
+    else if ((hptr = RSA_get_ex_data(rsa, rsaHndidx)) == NULL) {
         SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_SIGN,
                     SUREWARE_R_MISSING_KEY_COMPONENTS);
     } else {
@@ -1006,7 +1002,7 @@ static DSA_SIG *surewarehk_dsa_do_sign(const unsigned char *from, int flen,
         goto err;
     }
     /* extract ref to private key */
-    else if (!(hptr = DSA_get_ex_data(dsa, dsaHndidx))) {
+    else if ((hptr = DSA_get_ex_data(dsa, dsaHndidx)) == NULL) {
         SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,
                     SUREWARE_R_MISSING_KEY_COMPONENTS);
         goto err;