diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2024-07-25 07:24:41 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2024-07-25 07:24:41 +0000 |
commit | 0c0b5d2aebc97eed532c9ef9611c3ac01a36a1cd (patch) | |
tree | 7984441359ec57585da619cbbfd9fcae8404fd53 | |
parent | 383108ecc341f69f57257c8279238b6300f87109 (diff) |
Fix test23. It assumed the place of the attribute is unchanged. But now,
the message-authenticator is located at first always. found anton
-rw-r--r-- | regress/lib/libradius/test23.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/regress/lib/libradius/test23.c b/regress/lib/libradius/test23.c index 628c2f3b7e8..9b5e35b0866 100644 --- a/regress/lib/libradius/test23.c +++ b/regress/lib/libradius/test23.c @@ -15,14 +15,14 @@ void test23(void) uint8_t packetdata[] = { RADIUS_CODE_ACCESS_REQUEST, 0x7f, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* auth */ - 10, 10, 'h', 'o', 'g', 'e', 'f', 'u', 'g', 'a', RADIUS_TYPE_MESSAGE_AUTHENTICATOR, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 'h', 'o', 'g', 'e', 'f', 'u', 'g', 'a', }; uint8_t responsedata[] = { RADIUS_CODE_ACCESS_ACCEPT, 0x7f, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* auth */ - 10, 11, 'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z', RADIUS_TYPE_MESSAGE_AUTHENTICATOR, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 11, 'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z', }; packet = radius_new_request_packet(RADIUS_CODE_ACCESS_REQUEST); @@ -31,7 +31,7 @@ void test23(void) radius_put_message_authenticator(packet, "sharedsecret"); radius_get_authenticator(packet, packetdata + 4); - HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + sizeof(packetdata) - 16, NULL); + HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + 22, NULL); CHECK(radius_get_length(packet) == sizeof(packetdata)); CHECK(memcmp(radius_get_data(packet), packetdata, sizeof(packetdata)) == 0); @@ -47,7 +47,7 @@ void test23(void) 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_Final(ctx, responsedata + 22, NULL); HMAC_CTX_free(ctx); CHECK(radius_get_length(response) == sizeof(responsedata)); @@ -63,8 +63,8 @@ void test23(void) radius_set_id(packet, 0xff); radius_set_message_authenticator(packet, "sharedsecret"); packetdata[1] = 0xff; - memset(packetdata + sizeof(packetdata) - 16, 0, 16); - HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + sizeof(packetdata) - 16, NULL); + memset(packetdata + 22, 0, 16); + HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + 22, NULL); CHECK(memcmp(radius_get_data(packet), packetdata, sizeof(packetdata)) == 0); } |