diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-05 13:47:53 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-05 13:47:53 +0000 |
commit | df7d9adcbcd3616938133d84d6c9525b238c2e20 (patch) | |
tree | f0e7f18646ff0f18a783590f6abf18591c55b5d5 | |
parent | 273d6bf5ddcc35e94ee932f411cd0d0dcd97d726 (diff) |
Allow libradius tests to compile with opaque HMAC_CTX.
-rw-r--r-- | regress/lib/libradius/test23.c | 15 |
1 files 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); |