diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:57:32 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:57:32 -0400 |
commit | 4b45c6e52b208deff7da333d1c7f84bcd3986609 (patch) | |
tree | db26f7a51ad582f203dce2145a43c3e0d4376f69 /engines | |
parent | 68dc682499ea3fe27d909c946d7abd39062d6efd (diff) |
free cleanup almost the finale
Add OPENSSL_clear_free which merges cleanse and free.
(Names was picked to be similar to BN_clear_free, etc.)
Removed OPENSSL_freeFunc macro.
Fixed the small simple ones that are left:
CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_4758cca.c | 12 | ||||
-rw-r--r-- | engines/e_sureware.c | 5 |
2 files changed, 5 insertions, 12 deletions
diff --git a/engines/e_4758cca.c b/engines/e_4758cca.c index 3b593c79c5..b605a79cff 100644 --- a/engines/e_4758cca.c +++ b/engines/e_4758cca.c @@ -709,10 +709,8 @@ static int cca_rsa_verify(int type, const unsigned char *m, &keyTokenLength, keyToken, &length, hashBuffer, &lsiglen, (unsigned char *)sigbuf); - if (type == NID_sha1 || type == NID_md5) { - OPENSSL_cleanse(hashBuffer, keyLength + 1); - OPENSSL_free(hashBuffer); - } + if (type == NID_sha1 || type == NID_md5) + OPENSSL_clear_free(hashBuffer, keyLength + 1); return ((returnCode || reasonCode) ? 0 : 1); } @@ -820,10 +818,8 @@ static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, &keyTokenLength, keyToken, &length, hashBuffer, &outputLength, &outputBitLength, sigret); - if (type == NID_sha1 || type == NID_md5) { - OPENSSL_cleanse(hashBuffer, keyLength + 1); - OPENSSL_free(hashBuffer); - } + if (type == NID_sha1 || type == NID_md5) + OPENSSL_clear_free(hashBuffer, keyLength + 1); *siglen = outputLength; diff --git a/engines/e_sureware.c b/engines/e_sureware.c index 4580250d98..9e56a7d28e 100644 --- a/engines/e_sureware.c +++ b/engines/e_sureware.c @@ -948,10 +948,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; } |