replace calls to standard memcmp with constant memcmp where necessary

This commit is contained in:
Steffen Jaeckel 2014-11-13 22:09:45 +01:00
parent d54425adb4
commit e57c92fd23
3 changed files with 4 additions and 4 deletions

View File

@ -136,7 +136,7 @@ int pkcs_1_oaep_decode(const unsigned char *msg, unsigned long msglen,
}
/* compare the lhash'es */
if (XMEMCMP(seed, DB, hLen) != 0) {
if (mem_neq(seed, DB, hLen) != 0) {
err = CRYPT_OK;
goto LBL_ERR;
}

View File

@ -151,7 +151,7 @@ int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen,
}
/* mask == hash means valid signature */
if (XMEMCMP(mask, hash, hLen) == 0) {
if (mem_neq(mask, hash, hLen) == 0) {
*res = 1;
}

View File

@ -153,9 +153,9 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen,
/* test OID */
if ((reallen == outlen) &&
(digestinfo[0].size == hash_descriptor[hash_idx].OIDlen) &&
(XMEMCMP(digestinfo[0].data, hash_descriptor[hash_idx].OID, sizeof(unsigned long) * hash_descriptor[hash_idx].OIDlen) == 0) &&
(mem_neq(digestinfo[0].data, hash_descriptor[hash_idx].OID, sizeof(unsigned long) * hash_descriptor[hash_idx].OIDlen) == 0) &&
(siginfo[1].size == hashlen) &&
(XMEMCMP(siginfo[1].data, hash, hashlen) == 0)) {
(mem_neq(siginfo[1].data, hash, hashlen) == 0)) {
*stat = 1;
}