Skip to content
Permalink
Browse files

Constant time memory comparison.

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 d0e01ff9a9df52ab027070e647b4f63f5819da8f
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/modules/rlm_eap/types/rlm_eap_pwd/rlm_eap_pwd.c
@@ -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;
@@ -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;
}

0 comments on commit d0e01ff

Please sign in to comment.
You can’t perform that action at this time.