From f9b6c93bd6023f825d7b9bf71dab0514df39ac98 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 2 Apr 2024 14:05:46 -0400 Subject: [PATCH] [FIX] ipc: update HMAC_CTX initilization with updated OpenSSL --- opennopd/subsystems/ipc.c | 11 +++++------ opennopd/utility.c | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/opennopd/subsystems/ipc.c b/opennopd/subsystems/ipc.c index 20f2ece..3c26f67 100644 --- a/opennopd/subsystems/ipc.c +++ b/opennopd/subsystems/ipc.c @@ -165,15 +165,14 @@ struct neighbor *find_neighbor_by_socket(int fd) { */ int calculate_hmac_sha256(struct opennop_ipc_header *data, char *key, char *result) { unsigned int result_len = 32; - HMAC_CTX ctx; + HMAC_CTX *ctx = HMAC_CTX_new(); ENGINE_load_builtin_engines(); ENGINE_register_all_complete(); - HMAC_CTX_init(&ctx); - HMAC_Init_ex(&ctx, key, 64, EVP_sha256(), NULL); - HMAC_Update(&ctx, (unsigned char*)data, data->length); - HMAC_Final(&ctx, (unsigned char*)result, &result_len); - HMAC_CTX_cleanup(&ctx); + HMAC_Init_ex(ctx, key, 64, EVP_sha256(), NULL); + HMAC_Update(ctx, (unsigned char*)data, data->length); + HMAC_Final(ctx, (unsigned char*)result, &result_len); + HMAC_CTX_free(ctx); return 0; } diff --git a/opennopd/utility.c b/opennopd/utility.c index 14b00b0..147958c 100644 --- a/opennopd/utility.c +++ b/opennopd/utility.c @@ -2,6 +2,7 @@ #include #include // for getting ip addresses #include +#include #include #include