#include <stdio.h>
#include <stdlib.h>
#include <openssl/crypto.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
static int allow_customize = 1; /* we provide flexible functions for */
static int allow_customize_debug = 1; /* exchanging memory-related functions
ret = malloc_ex_func(num, file, line);
if (ret) {
memcpy(ret, str, old_len);
- OPENSSL_cleanse(str, old_len);
- free_func(str);
+ OPENSSL_clear_free(str, old_len);
}
#ifdef LEVITTE_DEBUG_MEM
fprintf(stderr,
free_debug_func(NULL, 1);
}
+void CRYPTO_clear_free(void *str, size_t num)
+{
+ if (!str)
+ return;
+ if (num)
+ OPENSSL_cleanse(str, num);
+ CRYPTO_free(str);
+}
+
void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
{
- if (a != NULL)
- OPENSSL_free(a);
+ OPENSSL_free(a);
a = OPENSSL_malloc(num);
return (a);
}