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>
diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index 73a8e07..49c157a 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -243,10 +243,7 @@
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- OPENSSL_cleanse(buf, num);
- OPENSSL_free(buf);
- }
+ OPENSSL_clear_free(buf, num);
return (r);
}
@@ -480,10 +477,7 @@
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- OPENSSL_cleanse(buf, num);
- OPENSSL_free(buf);
- }
+ OPENSSL_clear_free(buf, num);
return (r);
}
@@ -622,10 +616,7 @@
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- OPENSSL_cleanse(buf, num);
- OPENSSL_free(buf);
- }
+ OPENSSL_clear_free(buf, num);
return (r);
}
@@ -725,10 +716,7 @@
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
- if (buf != NULL) {
- OPENSSL_cleanse(buf, num);
- OPENSSL_free(buf);
- }
+ OPENSSL_clear_free(buf, num);
return (r);
}