Jayashankar Padath | a013560 | 2019-04-22 16:22:58 +0530 | [diff] [blame] | 1 | #include "openssl_alloc.hpp" |
| 2 | |
| 3 | #if OPENSSL_VERSION_NUMBER < 0x10100000L |
| 4 | |
| 5 | #include <string.h> |
| 6 | |
| 7 | static void* OPENSSL_zalloc(size_t num) |
| 8 | { |
| 9 | void* ret = OPENSSL_malloc(num); |
| 10 | |
| 11 | if (ret != NULL) |
| 12 | { |
| 13 | memset(ret, 0, num); |
| 14 | } |
| 15 | return ret; |
| 16 | } |
| 17 | |
| 18 | EVP_MD_CTX* EVP_MD_CTX_new(void) |
| 19 | { |
| 20 | return (EVP_MD_CTX*)OPENSSL_zalloc(sizeof(EVP_MD_CTX)); |
| 21 | } |
| 22 | |
| 23 | void EVP_MD_CTX_free(EVP_MD_CTX* ctx) |
| 24 | { |
| 25 | EVP_MD_CTX_cleanup(ctx); |
| 26 | OPENSSL_free(ctx); |
| 27 | } |
| 28 | |
| 29 | #endif |