utils: Use memeq_const() for all cryptographic purposes
This commit is contained in:
@@ -87,7 +87,7 @@ METHOD(simaka_card_t, get_quintuplet, status_t,
|
||||
{
|
||||
return FAILED;
|
||||
}
|
||||
if (!memeq(mac, xmac, AKA_MAC_LEN))
|
||||
if (!memeq_const(mac, xmac, AKA_MAC_LEN))
|
||||
{
|
||||
DBG1(DBG_IKE, "received MAC does not match XMAC");
|
||||
DBG3(DBG_IKE, "MAC %b\nXMAC %b", mac, AKA_MAC_LEN, xmac, AKA_MAC_LEN);
|
||||
@@ -184,4 +184,3 @@ eap_aka_3gpp2_card_t *eap_aka_3gpp2_card_create(eap_aka_3gpp2_functions_t *f)
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ METHOD(simaka_provider_t, resync, bool,
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!memeq(macs, xmacs, AKA_MAC_LEN))
|
||||
if (!memeq_const(macs, xmacs, AKA_MAC_LEN))
|
||||
{
|
||||
DBG1(DBG_IKE, "received MACS does not match XMACS");
|
||||
DBG3(DBG_IKE, "MACS %b XMACS %b",
|
||||
@@ -205,4 +205,3 @@ eap_aka_3gpp2_provider_t *eap_aka_3gpp2_provider_create(
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ METHOD(eap_method_t, process_server, status_t,
|
||||
}
|
||||
response = chunk_create(data.ptr + 6, data.ptr[5]);
|
||||
if (response.len < expected.len ||
|
||||
!memeq(response.ptr, expected.ptr, expected.len))
|
||||
!memeq_const(response.ptr, expected.ptr, expected.len))
|
||||
{
|
||||
chunk_free(&expected);
|
||||
DBG1(DBG_IKE, "EAP-MD5 verification failed");
|
||||
@@ -299,4 +299,3 @@ eap_md5_t *eap_md5_create_peer(identification_t *server, identification_t *peer)
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,8 +1087,8 @@ static status_t process_server_response(private_eap_mschapv2_t *this,
|
||||
userid->destroy(userid);
|
||||
chunk_clear(&nt_hash);
|
||||
|
||||
if (memeq(res->response.nt_response, this->nt_response.ptr,
|
||||
this->nt_response.len))
|
||||
if (memeq_const(res->response.nt_response, this->nt_response.ptr,
|
||||
this->nt_response.len))
|
||||
{
|
||||
chunk_t hex;
|
||||
char msg[AUTH_RESPONSE_LEN + sizeof(SUCCESS_MESSAGE)];
|
||||
@@ -1267,4 +1267,3 @@ eap_mschapv2_t *eap_mschapv2_create_peer(identification_t *server, identificatio
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ static status_t process_challenge(private_eap_sim_peer_t *this,
|
||||
/* excepting two or three RAND, each 16 bytes. We require two valid
|
||||
* and different RANDs */
|
||||
if ((rands.len != 2 * SIM_RAND_LEN && rands.len != 3 * SIM_RAND_LEN) ||
|
||||
memeq(rands.ptr, rands.ptr + SIM_RAND_LEN, SIM_RAND_LEN))
|
||||
memeq_const(rands.ptr, rands.ptr + SIM_RAND_LEN, SIM_RAND_LEN))
|
||||
{
|
||||
DBG1(DBG_IKE, "no valid AT_RAND received");
|
||||
if (!create_client_error(this, SIM_INSUFFICIENT_CHALLENGES, out))
|
||||
@@ -734,4 +734,3 @@ eap_sim_peer_t *eap_sim_peer_create(identification_t *server,
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
c_rand, SIM_RAND_LEN, c_sres, SIM_SRES_LEN, c_kc, SIM_KC_LEN);
|
||||
if (id->matches(id, cand))
|
||||
{
|
||||
if (memeq(c_rand, rand, SIM_RAND_LEN))
|
||||
if (memeq_const(c_rand, rand, SIM_RAND_LEN))
|
||||
{
|
||||
DBG2(DBG_CFG, " => triplet matches");
|
||||
memcpy(sres, c_sres, SIM_SRES_LEN);
|
||||
@@ -105,4 +105,3 @@ eap_sim_file_card_t *eap_sim_file_card_create(eap_sim_file_triplets_t *triplets)
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user