Преглед изворни кода

replace calls to standard memcmp with constant memcmp where necessary

Steffen Jaeckel пре 11 година
родитељ
комит
e57c92fd23

+ 1 - 1
src/pk/pkcs1/pkcs_1_oaep_decode.c

@@ -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;
    }

+ 1 - 1
src/pk/pkcs1/pkcs_1_pss_decode.c

@@ -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;
    }
 

+ 2 - 2
src/pk/rsa/rsa_verify_hash.c

@@ -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;
     }