1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

timingsafe_bcmp() is better than timingsafe_memcmp() for the purpose.

This commit is contained in:
yasuoka 2024-08-14 04:50:31 +00:00
parent 32ed937691
commit 9c3f005cd0
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: radius.c,v 1.5 2024/08/08 09:16:37 yasuoka Exp $ */
/* $OpenBSD: radius.c,v 1.6 2024/08/14 04:50:31 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@ -261,7 +261,7 @@ radius_check_response_authenticator(const RADIUS_PACKET * packet,
uint8_t authenticator[16];
radius_calc_response_authenticator(authenticator, packet, secret);
return (timingsafe_memcmp(authenticator, packet->pdata->authenticator,
return (timingsafe_bcmp(authenticator, packet->pdata->authenticator,
16));
}
@ -300,7 +300,7 @@ radius_check_accounting_request_authenticator(const RADIUS_PACKET * packet,
radius_calc_accounting_request_authenticator(authenticator, packet,
secret);
return (timingsafe_memcmp(authenticator, packet->pdata->authenticator,
return (timingsafe_bcmp(authenticator, packet->pdata->authenticator,
16));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: radius_msgauth.c,v 1.4 2024/08/08 09:16:37 yasuoka Exp $ */
/* $OpenBSD: radius_msgauth.c,v 1.5 2024/08/14 04:50:31 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@ -149,5 +149,5 @@ radius_check_message_authenticator(RADIUS_PACKET * packet, const char *secret)
if (len != sizeof(ma1))
return (-1);
return (timingsafe_memcmp(ma0, ma1, sizeof(ma1)));
return (timingsafe_bcmp(ma0, ma1, sizeof(ma1)));
}