Skip to content

Commit

Permalink
Constant time memory comparison.
Browse files Browse the repository at this point in the history
CVE-2014-4731.

Non-constant time comparisons usually require millions of packets
in order to get enough statistics.  This is VERY hard to do with
WiFi or wired 802.1X.  The delays on switch port open / close
are on the order of seconds.
  • Loading branch information
jvoisin authored and alandekok committed Jul 14, 2014
1 parent 22297d7 commit d0e01ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/rlm_eap/types/rlm_eap_pwd/rlm_eap_pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int mod_authenticate (void *arg, eap_handler_t *handler)
if ((id->prf != EAP_PWD_DEF_PRF) ||
(id->random_function != EAP_PWD_DEF_RAND_FUN) ||
(id->prep != EAP_PWD_PREP_NONE) ||
(memcmp(id->token, (char *)&pwd_session->token, 4)) ||
(CRYPTO_memcmp(id->token, (char *)&pwd_session->token, 4)) ||
(id->group_num != ntohs(pwd_session->group_num))) {
RDEBUG2("pwd id response is invalid");
return 0;
Expand Down Expand Up @@ -561,7 +561,7 @@ static int mod_authenticate (void *arg, eap_handler_t *handler)
RDEBUG2("pwd exchange cannot compute peer's confirm");
return 0;
}
if (memcmp(peer_confirm, buf, SHA256_DIGEST_LENGTH)) {
if (CRYPTO_memcmp(peer_confirm, buf, SHA256_DIGEST_LENGTH)) {
RDEBUG2("pwd exchange fails: peer confirm is incorrect!");
return 0;
}
Expand Down

0 comments on commit d0e01ff

Please sign in to comment.