From a6a311205504830f0ef5b304b871c24b7e7fb878 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 5 Dec 2021 13:47:52 +0000 Subject: [PATCH] Allow libradius tests to compile with opaque HMAC_CTX. --- regress/lib/libradius/test23.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/regress/lib/libradius/test23.c b/regress/lib/libradius/test23.c index 3085a581237..628c2f3b7e8 100644 --- a/regress/lib/libradius/test23.c +++ b/regress/lib/libradius/test23.c @@ -10,7 +10,7 @@ void test23(void) { RADIUS_PACKET *packet; RADIUS_PACKET *response; - HMAC_CTX ctx; + HMAC_CTX *ctx; uint8_t packetdata[] = { RADIUS_CODE_ACCESS_REQUEST, 0x7f, 0, 48, @@ -42,12 +42,13 @@ void test23(void) radius_put_message_authenticator(response, "sharedsecret"); radius_get_authenticator(response, responsedata + 4); - HMAC_Init(&ctx, "sharedsecret", 12, EVP_md5()); - HMAC_Update(&ctx, responsedata, 4); - HMAC_Update(&ctx, packetdata + 4, 16); - HMAC_Update(&ctx, responsedata + 20, sizeof(responsedata) - 20); - HMAC_Final(&ctx, responsedata + sizeof(responsedata) - 16, NULL); - HMAC_cleanup(&ctx); + ctx = HMAC_CTX_new(); + HMAC_Init_ex(ctx, "sharedsecret", 12, EVP_md5(), NULL); + HMAC_Update(ctx, responsedata, 4); + HMAC_Update(ctx, packetdata + 4, 16); + HMAC_Update(ctx, responsedata + 20, sizeof(responsedata) - 20); + HMAC_Final(ctx, responsedata + sizeof(responsedata) - 16, NULL); + HMAC_CTX_free(ctx); CHECK(radius_get_length(response) == sizeof(responsedata)); CHECK(memcmp(radius_get_data(response), responsedata, sizeof(responsedata)) == 0); -- 2.20.1