Skip to content

Commit 3f97361

Browse files
committed
use constant time comparisons
1 parent 224aaa1 commit 3f97361

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/modules/rlm_digest/rlm_digest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, REQU
573573
/*
574574
* And finally, compare the digest in the packet with KD.
575575
*/
576-
if (memcmp(&kd[0], &hash[0], 16) == 0) {
576+
if (rad_digest_cmp(&kd[0], &hash[0], 16) == 0) {
577577
return RLM_MODULE_OK;
578578
}
579579

src/modules/rlm_mschap/rlm_mschap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ static int CC_HINT(nonnull (1, 2, 4, 5)) do_mschap_cpw(rlm_mschap_t *inst,
10831083
*/
10841084
smbhash(old_nt_hash_expected, nt_password->vp_octets, q);
10851085
smbhash(old_nt_hash_expected+8, nt_password->vp_octets+8, q + 7);
1086-
if (memcmp(old_nt_hash_expected, old_nt_hash, NT_DIGEST_LENGTH)!=0) {
1086+
if (rad_digest_cmp(old_nt_hash_expected, old_nt_hash, NT_DIGEST_LENGTH)!=0) {
10871087
REDEBUG("Old NT hash value from client does not match our value");
10881088
return -1;
10891089
}

0 commit comments

Comments
 (0)