Use constant-time memcmp when comparing sensitive buffers
This helps to avoid timing attacks. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:

committed by
Jeffrey Altman

parent
20f038f4f0
commit
b19633f9b9
@@ -179,7 +179,7 @@ ntlm_service(void *ctx, const heim_idata *req,
|
||||
goto failed;
|
||||
|
||||
if (ntq.ntChallengeResponce.length != answer.length ||
|
||||
memcmp(ntq.ntChallengeResponce.data, answer.data, answer.length) != 0) {
|
||||
ct_memcmp(ntq.ntChallengeResponce.data, answer.data, answer.length) != 0) {
|
||||
free(answer.data);
|
||||
ret = EINVAL;
|
||||
goto failed;
|
||||
|
@@ -1314,7 +1314,7 @@ _kdc_do_digest(krb5_context context,
|
||||
}
|
||||
|
||||
if (ireq.u.ntlmRequest.ntlm.length != answer.length ||
|
||||
memcmp(ireq.u.ntlmRequest.ntlm.data, answer.data, answer.length) != 0)
|
||||
ct_memcmp(ireq.u.ntlmRequest.ntlm.data, answer.data, answer.length) != 0)
|
||||
{
|
||||
free(answer.data);
|
||||
ret = EINVAL;
|
||||
|
Reference in New Issue
Block a user