Branch Coverage

inc/matrixssl-3-9-3-open/crypto/keyformat/pkcs.c
Criterion Covered Total %
branch 217 760 28.5


line true false branch
58 0 1147 if (randomLen < 8)
68 1146 1 if (cryptType == PS_PUBKEY)
70 231492 1146 while (randomLen > 0)
78 0 1 if (psGetPrngLocked(c, randomLen, userPtr) < 0)
86 205 1 while (randomLen > 0)
88 1 204 if (*c == 0x0)
120 0 3354 if (inlen < outlen + 10)
129 3354 0 if (*c++ != 0x00 || *c != decryptType)
0 3354 if (*c++ != 0x00 || *c != decryptType)
137 680865 0 while (c < end && *c != 0x0)
677511 3354 while (c < end && *c != 0x0)
139 677306 205 if (decryptType == PS_PUBKEY)
141 0 677306 if (*c != 0xFF)
155 0 3354 if ((uint32) (end - c) != outlen)
162 171051 3354 while (c < end)
221 0 142 if (size > 65535)
229 4 138 if (pass)
237 2 2 if (getAsnSequence(&p, (int32) (end - p), &seqlen) < 0)
241 2 0 if (getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi, &plen) < 0)
246 0 0 if (oi != OID_PKCS_PBES2 || plen != 53)
0 0 if (oi != OID_PKCS_PBES2 || plen != 53)
251 0 0 if (getAsnSequence(&p, (int32) (end - p), &seqlen) < 0)
255 0 0 if (getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi, &plen) < 0)
260 0 0 if (oi != OID_PKCS_PBKDF2 || plen != 16)
0 0 if (oi != OID_PKCS_PBKDF2 || plen != 16)
265 0 0 if (getAsnSequence(&p, (int32) (end - p), &seqlen) < 0)
270 0 0 getAsnLength(&p, (int32) (end - p), &len) < 0 ||
271 0 0 (uint32) (end - p) < len ||
281 0 0 if (getAsnInteger(&p, (int32) (end - p), &icount) < 0)
287 0 0 if (getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi, &plen)
293 0 0 if (oi != OID_DES_EDE3_CBC || plen != 10)
0 0 if (oi != OID_DES_EDE3_CBC || plen != 10)
298 0 0 if ((uint32) (end - p) < 1)
304 0 0 getAsnLength(&p, (int32) (end - p), &len) < 0 ||
305 0 0 (uint32) (end - p) < len ||
316 0 0 if ((uint32) (end - p) < 1)
322 0 0 getAsnLength(&p, (int32) (end - p), &len) < 0 ||
323 0 0 (uint32) (end - p) < len ||
353 0 0 if (len < 1)
360 0 0 if (plen < 1 || plen > 16)
0 0 if (plen < 1 || plen > 16)
369 0 0 if (len < plen)
375 0 0 for(i = 0; i < plen; i++)
377 0 0 if (p[len - i - 1] != (unsigned char) plen)
398 0 138 if (getAsnSequence(&p, (int32) (end - p), &seqlen) < 0)
410 138 0 if (getAsnInteger(&p, (int32) (end - p), &version) < 0 || version != 0)
0 138 if (getAsnInteger(&p, (int32) (end - p), &version) < 0 || version != 0)
416 0 138 if (getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi, &plen) < 0)
422 138 0 if (oi != OID_ECDSA_KEY_ALG && oi != OID_RSA_KEY_ALG)
0 138 if (oi != OID_ECDSA_KEY_ALG && oi != OID_RSA_KEY_ALG)
426 0 138 if (oi == OID_ECDSA_KEY_ALG)
429 0 0 if ((uint32) (end - p) < 1 || *p++ != ASN_OID)
0 0 if ((uint32) (end - p) < 1 || *p++ != ASN_OID)
434 0 0 if (getAsnLength(&p, (uint32) (end - p), &len) < 0 ||
0 0 if (getAsnLength(&p, (uint32) (end - p), &len) < 0 ||
441 0 0 while (len > 0)
446 0 0 if (getEccParamByOid(coi, &eccSet) < 0)
459 0 138 if ((uint32) (end - p) < 1)
465 0 138 getAsnLength(&p, (int32) (end - p), &len) < 0 ||
473 138 0 if (oi == OID_RSA_KEY_ALG)
477 0 138 if (psRsaParsePkcs1PrivKey(pool, p, len, &key->key.rsa) < 0)
487 0 138 if (oi == OID_ECDSA_KEY_ALG)
490 0 0 if (psEccParsePrivKey(pool, p, len, &key->key.ecc, eccSet) < 0)
501 10 128 if (plen > 0)
504 0 10 if (*p == (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
507 0 0 if (getAsnLength(&p, (int32) (end - p), &len) < 0 ||
0 0 if (getAsnLength(&p, (int32) (end - p), &len) < 0 ||
555 0 14 if ((rc = getAsnAlgorithmIdentifier(&p, totLen, &oi, &oiLen)) < 0)
561 14 0 if (oi == OID_PKCS7_DATA)
564 0 14 if (*p++ != (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
568 0 14 if ((rc = getAsnLength(&p, (int32) (end - p), &len)) < 0)
580 0 0 else if (oi == OID_PKCS7_SIGNED_DATA)
618 464 58 for (i = 0; i < 64; )
620 0 464 if ((64 - i) < saltLen)
633 0 58 if (plen + 64 > 192)
637 3712 58 for (i = 0; i < plen; i++)
642 10 48 if (*outlen == SHA1_HASH_SIZE)
653 0 58 if (front == NULL)
658 68 58 while (count)
664 139196 68 for (j = 1; j < iter; j++)
677 10 58 if (cpyLen > 0)
680 640 10 for (j = 0; j < 64; j++)
684 0 10 if (pstm_init_for_read_unsigned_bin(pool, &bigb, 64) < 0)
689 0 10 if (pstm_read_unsigned_bin(&bigb, B, 64) < 0)
695 0 10 if (pstm_init_for_read_unsigned_bin(pool, &bigone, 1) < 0)
702 0 10 if (pstm_add(&bigb, &bigone, &bigb) < 0)
710 20 10 for (j = 0; j < 64 + plen; j += 64)
712 0 20 if (pstm_init_for_read_unsigned_bin(pool, &bigtmp, 64) < 0)
719 0 20 if (pstm_read_unsigned_bin(&bigtmp, saltpass + j, 64) < 0)
727 0 20 if (pstm_add(&bigb, &bigtmp, &bigtmp) < 0)
736 1 19 if (binsize > 64)
738 0 1 psAssert(binsize == 65);
739 0 1 if (pstm_to_unsigned_bin(pool, &bigtmp, B) < 0)
749 0 19 else if (binsize < 64)
751 0 0 psAssert(binsize == 63);
753 0 0 if (pstm_to_unsigned_bin(pool, &bigtmp, saltpass + j + 1) < 0)
764 0 19 if (pstm_to_unsigned_bin(pool, &bigtmp, saltpass + j) < 0)
810 0 24 if ((rc = getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi,
817 14 10 if (oi == OID_PKCS_PBESHA40RC2)
827 10 0 else if (oi == OID_PKCS_PBESHA3DES3)
838 24 0 if (armor == PBE12)
846 0 24 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
852 24 0 if ((uint32) (end - p) < 1 || (*p++ != ASN_OCTET_STRING) ||
853 24 0 getAsnLength(&p, (int32) (end - p), &tmplen) < 0 ||
854 0 24 (uint32) (end - p) < tmplen ||
864 0 24 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0)
868 0 24 if (pkcs12pbe(pool, password, passLen, salt, 8, asnint,
875 0 24 if (pkcs12pbe(pool, password, passLen, salt, 8, asnint,
879 0 0 if (decryptKey)
892 0 24 if ((uint32) (end - p) < 1)
896 14 10 if (*p == (ASN_CONTEXT_SPECIFIC | ASN_PRIMITIVE))
899 0 14 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
901 0 0 if (decryptKey)
910 0 10 else if (*p == (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
913 0 0 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
915 0 0 if (decryptKey)
923 0 0 if ((uint32) (end - p) < 1 ||
0 0 if ((uint32) (end - p) < 1 ||
924 0 0 *p++ != ASN_OCTET_STRING ||
927 0 0 if (decryptKey)
936 10 0 else if (*p == ASN_OCTET_STRING)
939 0 10 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
941 0 0 if (decryptKey)
953 0 0 if (decryptKey)
962 24 0 if (tmplen < 1 || (uint32) (end - p) < tmplen)
0 24 if (tmplen < 1 || (uint32) (end - p) < tmplen)
968 0 24 if ((pt = psMalloc(pool, tmplen)) == NULL)
971 0 0 if (decryptKey)
979 10 14 if (cipher == AUTH_SAFE_3DES)
981 0 10 if ((rc = psDes3Init(&ctx.des3, iv, decryptKey)) < 0)
984 0 0 if (decryptKey)
996 14 10 if (cipher == AUTH_SAFE_RC2)
1000 0 14 if ((rc = psRc2Init(&ctx.rc2, iv, decryptKey, 5)) < 0)
1003 0 0 if (decryptKey)
1012 0 14 if ((rc = psRc2Decrypt(&ctx.rc2, p, pt, tmplen)) < 0)
1015 0 0 if (decryptKey)
1027 24 0 if (decryptKey)
1069 4 20 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1077 21 20 while (p < end)
1097 0 21 if ((rc = getAsnAlgorithmIdentifier(&p, (int32) (end - p), &bagoi,
1104 0 21 if (*p++ != (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
1108 0 21 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
1134 0 11 if ((rc = getAsnAlgorithmIdentifier(&p, (int32) (end - p),
1140 0 11 if (certoi != OID_PKCS9_CERT_TYPE_X509)
1145 0 11 if (*p++ != (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
1149 0 11 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
1161 1 11 while (currCert != NULL)
1165 0 11 if ((rc = psX509ParseCert(pool, p, tmplen, &currCert,
1173 10 1 if (*cert == NULL)
1179 0 1 while (frontCert->next != NULL)
1192 0 10 if (getAsnSequence(&p, (int32) (end - p), &tmplen) < 0)
1197 0 10 if ((rc = pkcs12import(pool, &p,
1205 0 10 if ((rc = psPkcs8ParsePrivBin(pool, pt, cryptlen, NULL, privKey))
1216 0 0 if ((rc = psPkcs8ParsePrivBin(pool, (unsigned char *) p, tmplen,
1230 20 21 while (p != safeLen)
1281 0 14 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1289 24 10 while (p < end)
1291 0 24 if ((rc = getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi,
1297 14 10 if (oi == OID_PKCS7_ENCRYPTED_DATA)
1300 0 14 if (*p++ != (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
1305 0 14 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
1312 0 14 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1317 14 0 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0 ||
0 14 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0 ||
1335 0 14 if ((rc = getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi,
1341 0 14 psAssert(oi == OID_PKCS7_DATA);
1343 0 14 if ((rc = pkcs12import(pool, &p, (int32) (end - p), importPass,
1352 4 10 if ((rc = parseSafeContents(pool, importPass, ipassLen, cert,
1363 10 0 else if (oi == OID_PKCS7_DATA)
1366 0 10 if (*p++ != (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED))
1371 0 10 if ((rc = getAsnLength(&p, (int32) (end - p), &tmplen)) < 0)
1375 10 0 if (*p++ != ASN_OCTET_STRING || getAsnLength(&p,
0 10 if (*p++ != ASN_OCTET_STRING || getAsnLength(&p,
1380 0 10 if ((rc = parseSafeContents(pool, importPass, ipassLen, cert,
1425 1 14 if ((rc = psGetFileBuf(pool, (char *) file, &fileBuf, &fsize)) < PS_SUCCESS)
1438 0 14 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1444 14 0 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0 || asnint != 3)
0 14 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0 || asnint != 3)
1453 0 14 if ((integrity = psParseIntegrityMode(&p, (int32) (end - p)))
1466 34 14 for (i = 1, j = 0; i < ipassLen - 1; i += 2, j++)
1473 4 10 if ((rc = psParseAuthenticatedSafe(pool, cert, privKey, iwidePass, ipassLen,
1482 10 0 if (integrity == PASSWORD_INTEGRITY)
1486 26 10 for (i = 1, j = 0; i < mpassLen - 1; i += 2, j++)
1496 0 10 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1504 0 10 if ((rc = getAsnSequence(&p, (int32) (end - p), &tmplen)) < 0)
1509 0 10 if ((rc = getAsnAlgorithmIdentifier(&p, (uint32) (end - p),
1531 0 10 if (tmplen > 20)
1540 10 0 if (p != end)
1542 0 10 if (getAsnInteger(&p, (int32) (end - p), &asnint) < 0)
1553 0 10 psAssert(p == end); /* That's all folks */
1555 10 0 if (oi == OID_SHA1_ALG)
1561 0 10 if (pkcs12pbe(pool, mwidePass, mpassLen, macSalt, tmplen,
1615 48 3 for (end = hex + binlen * 2; hex < end; hex++)
1618 48 0 if ('0' <= c && c <= '9')
36 12 if ('0' <= c && c <= '9')
1622 0 12 else if ('a' <= c && c <= 'f')
0 0 else if ('a' <= c && c <= 'f')
1626 12 0 else if ('A' <= c && c <= 'F')
12 0 else if ('A' <= c && c <= 'F')
1635 24 24 if (highOrder++ & 0x1)
1659 0 0 if ((rc = psPkcs1DecodePrivFile(pool, fileName, NULL, &DERout, &DERlen))
1668 0 0 if (getAsnSequence(&p, (int32) (end - p), &seqlen) < 0)
1673 0 0 if (getAsnAlgorithmIdentifier(&p, (int32) (end - p), &oi, &plen) < 0)
1678 0 0 if (oi != OID_RSA_KEY_ALG)
1683 0 0 if (psRsaParseAsnPubKey(pool, &p, (int32) (end - p), key, sha1KeyHash) < 0)
1714 1 133 if ((rc = psPkcs1DecodePrivFile(pool, fileName, password, &DERout, &DERlen))
1720 132 1 if ((rc = psRsaParsePkcs1PrivKey(pool, DERout, DERlen, key)) < 0)
1726 4 128 if ((rc = psPkcs8ParsePrivBin(pool, DERout, DERlen, (char *) password,
1771 0 134 if (fileName == NULL)
1776 0 134 if ((rc = psGetFileBuf(pool, fileName, &keyBuf, &keyBufLen)) < PS_SUCCESS)
1783 134 0 if (((start = strstr((char *) keyBuf, "-----BEGIN")) != NULL) &&
134 0 if (((start = strstr((char *) keyBuf, "-----BEGIN")) != NULL) &&
1784 134 0 ((start = strstr((char *) keyBuf, "PRIVATE KEY-----")) != NULL) &&
1785 134 0 ((end = strstr(start, "-----END")) != NULL) &&
1789 0 268 while (*start == '\x0d' || *start == '\x0a')
134 134 while (*start == '\x0d' || *start == '\x0a')
1795 0 0 else if (((start = strstr((char *) keyBuf, "-----BEGIN")) != NULL) &&
0 0 else if (((start = strstr((char *) keyBuf, "-----BEGIN")) != NULL) &&
1796 0 0 ((start = strstr((char *) keyBuf, "PUBLIC KEY-----")) != NULL) &&
1797 0 0 ((end = strstr(start, "-----END")) != NULL) &&
1801 0 0 while (*start == '\x0d' || *start == '\x0a')
0 0 while (*start == '\x0d' || *start == '\x0a')
1814 4 130 if (strstr((char *) keyBuf, "Proc-Type:") &&
4 0 if (strstr((char *) keyBuf, "Proc-Type:") &&
1818 1 3 if (password == NULL)
1824 3 0 if ((start = strstr((char *) keyBuf, des3encryptHeader)) != NULL)
1831 0 0 else if ((start = strstr((char *) keyBuf, aes128encryptHeader))
1846 0 3 if (tmp < 0)
1853 0 3 if (psPkcs5Pbkdf1((unsigned char *) password, strlen(password),
1876 0 133 if (dout == NULL)
1883 0 133 if ((rc = psBase64decode((unsigned char *) start, PEMlen, dout,
1898 3 130 if (encrypted == 1 && password)
3 0 if (encrypted == 1 && password)
1904 0 133 if (encrypted == 2 && password)
0 0 if (encrypted == 2 && password)
1954 0 3 psAssert(iter == 1);
1957 0 3 if (rc != PS_SUCCESS)
1968 0 3 if (rc != PS_SUCCESS)
2007 0 0 psAssert(password && salt && key && kLen);
0 0 psAssert(password && salt && key && kLen);
0 0 psAssert(password && salt && key && kLen);
0 0 psAssert(password && salt && key && kLen);
2012 0 0 while (left != 0)
2029 0 0 for (itts = 1; itts < rounds; ++itts)
2034 0 0 for (i = 0; i < SHA1_HASH_SIZE; i++)
2040 0 0 for (i = 0; i < SHA1_HASH_SIZE && left != 0; ++i)
0 0 for (i = 0; i < SHA1_HASH_SIZE && left != 0; ++i)
2074 0 0 if (!params || !fileName)
0 0 if (!params || !fileName)
2079 0 0 if ((rc = psGetFileBuf(pool, fileName,
2087 0 0 if ((start = strstr(dhFileBuf, "-----BEGIN DH PARAMETERS-----")) == NULL)
2095 0 0 while (start < end && (*start == '\x0d' || *start == '\x0a'))
0 0 while (start < end && (*start == '\x0d' || *start == '\x0a'))
0 0 while (start < end && (*start == '\x0d' || *start == '\x0a'))
2100 0 0 if ((end = strstr(start, "-----END DH PARAMETERS-----")) == NULL)
2110 0 0 if (p == NULL)
2118 0 0 if (psBase64decode((unsigned char *) start, baseLen, p, &pemOutLen) != 0)
2126 0 0 if ((rc = psPkcs3ParseDhParamBin(pool, p, pemOutLen, params)) < 0)
2165 0 0 if ((seed == NULL) || (mask == NULL))
0 0 if ((seed == NULL) || (mask == NULL))
2174 0 0 if (hash_idx == PKCS1_SHA1_ID)
2178 0 0 else if (hash_idx == PKCS1_MD5_ID)
2183 0 0 else if (hash_idx == PKCS1_SHA256_ID)
2189 0 0 else if (hash_idx == PKCS1_SHA384_ID)
2195 0 0 else if (hash_idx == PKCS1_SHA512_ID)
2206 0 0 if (buf == NULL)
2216 0 0 while (masklen > 0)
2225 0 0 if (hash_idx == PKCS1_SHA1_ID)
2233 0 0 else if (hash_idx == PKCS1_MD5_ID)
2242 0 0 else if (hash_idx == PKCS1_SHA256_ID)
2251 0 0 else if (hash_idx == PKCS1_SHA384_ID)
2260 0 0 else if (hash_idx == PKCS1_SHA512_ID)
2270 0 0 for (x = 0; x < hLen && masklen > 0; x++, masklen--)
0 0 for (x = 0; x < hLen && masklen > 0; x++, masklen--)
2311 0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
2319 0 0 if (hash_idx == PKCS1_SHA1_ID)
2323 0 0 else if (hash_idx == PKCS1_MD5_ID)
2341 0 0 if (seed != NULL && seedLen != hLen)
0 0 if (seed != NULL && seedLen != hLen)
2347 0 0 modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
2352 0 0 if ((2 * hLen >= (modulus_len - 2)) || (msglen > (modulus_len - 2 * hLen - 2)))
0 0 if ((2 * hLen >= (modulus_len - 2)) || (msglen > (modulus_len - 2 * hLen - 2)))
2364 0 0 if (DB == NULL || mask == NULL)
0 0 if (DB == NULL || mask == NULL)
2366 0 0 if (DB != NULL)
2370 0 0 if (mask != NULL)
2385 0 0 if (lparam != NULL)
2387 0 0 if (hash_idx == PKCS1_SHA1_ID)
2405 0 0 if (hash_idx == PKCS1_SHA1_ID)
2440 0 0 if (seed != NULL)
2447 0 0 if (lseed == NULL)
2452 0 0 if (psGetPrngLocked(lseed, hLen, NULL) != (int32) hLen)
2463 0 0 if ((err = pkcs_1_mgf1(pool, lseed, hLen, hash_idx, mask,
2473 0 0 for (y = 0; y < (modulus_len - hLen - 1); y++)
2481 0 0 if ((err = pkcs_1_mgf1(pool, DB, modulus_len - hLen - 1, hash_idx,
2491 0 0 for (y = 0; y < hLen; y++)
2499 0 0 if (*outlen < modulus_len)
2521 0 0 if (seed == NULL)
2556 0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
0 0 if ((msg == NULL) || (out == NULL) || (outlen == NULL) || (hash_idx < 0))
2564 0 0 if (hash_idx == PKCS1_SHA1_ID)
2568 0 0 else if (hash_idx == PKCS1_MD5_ID)
2584 0 0 modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
2589 0 0 if ((2 * hLen >= (modulus_len - 2)) || (msglen != modulus_len))
0 0 if ((2 * hLen >= (modulus_len - 2)) || (msglen != modulus_len))
2601 0 0 if (DB == NULL || mask == NULL || seed == NULL)
0 0 if (DB == NULL || mask == NULL || seed == NULL)
0 0 if (DB == NULL || mask == NULL || seed == NULL)
2603 0 0 if (DB != NULL)
2607 0 0 if (mask != NULL)
2611 0 0 if (seed != NULL)
2626 0 0 if (msg[0] != 0x00)
2649 0 0 if ((err = pkcs_1_mgf1(pool, DB, modulus_len - hLen - 1, hash_idx,
2659 0 0 for (y = 0; y < hLen; y++)
2667 0 0 if ((err = pkcs_1_mgf1(pool, seed, hLen, hash_idx, mask,
2677 0 0 for (y = 0; y < (modulus_len - hLen - 1); y++)
2689 0 0 if (lparam != NULL)
2691 0 0 if (hash_idx == PKCS1_SHA1_ID)
2709 0 0 if (hash_idx == PKCS1_SHA1_ID)
2728 0 0 if (memcmp(seed, DB, hLen) != 0)
2738 0 0 for (x = hLen; x < (modulus_len - hLen - 1) && DB[x] == 0x00; x++)
0 0 for (x = hLen; x < (modulus_len - hLen - 1) && DB[x] == 0x00; x++)
2746 0 0 if (x == (modulus_len - hLen - 1) || DB[x] != 0x01)
0 0 if (x == (modulus_len - hLen - 1) || DB[x] != 0x01)
2756 0 0 if ((modulus_len - hLen - 1) - ++x > *outlen)
2805 0 0 if ((msghash == NULL) || (out == NULL) || (outlen == NULL))
0 0 if ((msghash == NULL) || (out == NULL) || (outlen == NULL))
0 0 if ((msghash == NULL) || (out == NULL) || (outlen == NULL))
2811 0 0 if (hash_idx == PKCS1_SHA1_ID)
2815 0 0 else if (hash_idx == PKCS1_MD5_ID)
2826 0 0 else if (hash_idx == PKCS1_SHA256_ID)
2837 0 0 modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
2840 0 0 if ((saltlen > modulus_len) || (modulus_len < hLen + saltlen + 2))
0 0 if ((saltlen > modulus_len) || (modulus_len < hLen + saltlen + 2))
2848 0 0 if ((DB = psMalloc(pool, modulus_len)) == NULL)
2853 0 0 if ((mask = psMalloc(pool, modulus_len)) == NULL)
2858 0 0 if ((salt = psMalloc(pool, modulus_len)) == NULL)
2863 0 0 if ((hash = psMalloc(pool, modulus_len)) == NULL)
2870 0 0 if (saltlen > 0)
2872 0 0 if (tsalt != NULL)
2878 0 0 if (psGetPrngLocked(salt, saltlen, NULL) != (int32) saltlen)
2887 0 0 if (hash_idx == PKCS1_SHA1_ID)
2896 0 0 if (hash_idx == PKCS1_MD5_ID)
2906 0 0 if (hash_idx == PKCS1_SHA256_ID)
2926 0 0 if ((err = pkcs_1_mgf1(pool, hash, hLen, hash_idx, mask,
2933 0 0 for (y = 0; y < (modulus_len - hLen - 1); y++)
2939 0 0 if (*outlen < modulus_len)
2995 0 0 if ((msghash == NULL) || (res == NULL))
0 0 if ((msghash == NULL) || (res == NULL))
3004 0 0 if (hash_idx == PKCS1_SHA1_ID)
3008 0 0 else if (hash_idx == PKCS1_MD5_ID)
3019 0 0 else if (hash_idx == PKCS1_SHA256_ID)
3025 0 0 else if (hash_idx == PKCS1_SHA384_ID)
3031 0 0 else if (hash_idx == PKCS1_SHA512_ID)
3042 0 0 modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
3045 0 0 if ((saltlen > modulus_len) ||
0 0 if ((saltlen > modulus_len) ||
3046 0 0 (modulus_len < hLen + saltlen + 2) || (siglen != modulus_len))
3054 0 0 if ((DB = psMalloc(pool, modulus_len)) == NULL)
3059 0 0 if ((mask = psMalloc(pool, modulus_len)) == NULL)
3064 0 0 if ((salt = psMalloc(pool, modulus_len)) == NULL)
3069 0 0 if ((hash = psMalloc(pool, modulus_len)) == NULL)
3076 0 0 if (sig[siglen - 1] != 0xBC)
3092 0 0 if ((sig[0] & ~(0xFF >> ((modulus_len << 3) - (modulus_bitlen - 1)))) != 0)
3099 0 0 if ((err = pkcs_1_mgf1(pool, hash, hLen, hash_idx, mask,
3106 0 0 for (y = 0; y < (modulus_len - hLen - 1); y++)
3118 0 0 for (x = 0; x < modulus_len - saltlen - hLen - 2; x++)
3120 0 0 if (DB[x] != 0x00)
3128 0 0 if (DB[x++] != 0x01)
3135 0 0 if (hash_idx == PKCS1_SHA1_ID)
3145 0 0 if (hash_idx == PKCS1_MD5_ID)
3157 0 0 if (hash_idx == PKCS1_SHA256_ID)
3168 0 0 if (hash_idx == PKCS1_SHA384_ID)
3179 0 0 if (hash_idx == PKCS1_SHA512_ID)
3191 0 0 if (memcmp(mask, hash, hLen) == 0)