Branch Coverage

inc/matrixssl-3-9-3-open/crypto/pubkey/dh.c
Criterion Covered Total %
branch 1 108 0.9


line true false branch
43 0 0 psAssert(key);
79 0 0 if (!params || !dhBin)
0 0 if (!params || !dhBin)
86 0 0 if (getAsnSequence(&c, (uint16_t) (end - c), &baseLen) < 0)
91 0 0 if (pstm_read_asn(pool, &c, (uint16_t) (end - c), ¶ms->p) < 0)
96 0 0 if (params->size < (MIN_DH_BITS / 8))
103 0 0 if (pstm_read_asn(pool, &c, (uint16_t) (end - c), ¶ms->g) < 0)
107 0 0 if (end != c)
131 0 100808 if (params == NULL)
167 0 0 if ((p = psMalloc(pool, pl)) == NULL)
172 0 0 if ((g = psMalloc(pool, gl)) == NULL)
211 0 0 if ((rc = pstm_init_for_read_unsigned_bin(pool, &key->pub, inlen)) < 0)
215 0 0 if ((rc = pstm_read_unsigned_bin(&key->pub, in, inlen)) < 0)
242 0 0 if (*outlen < key->size)
248 0 0 if (pad > 0)
253 0 0 else if (pad < 0)
257 0 0 if ((rc = pstm_to_unsigned_bin(pool, &key->pub, c)) < 0)
279 0 0 if (keysize > pLen)
284 0 0 switch (pLen)
297 0 0 if ((rc = pstm_init_for_read_unsigned_bin(pool, &p, pLen)) != PS_SUCCESS)
301 0 0 if ((rc = pstm_init_for_read_unsigned_bin(pool, &g, gLen)) != PS_SUCCESS)
307 0 0 if ((rc = pstm_read_unsigned_bin(&p, pBin, pLen)) != PS_SUCCESS)
311 0 0 if ((rc = pstm_read_unsigned_bin(&g, gBin, gLen)) != PS_SUCCESS)
338 0 0 if (key == NULL)
344 0 0 if (pstm_count_bits(g) < 2)
357 0 0 if (keysize >= 160 / 8 && keysize <= 1024 / 8)
0 0 if (keysize >= 160 / 8 && keysize <= 1024 / 8)
361 0 0 else if (keysize > 1024 / 8 && keysize <= 2048 / 8)
0 0 else if (keysize > 1024 / 8 && keysize <= 2048 / 8)
365 0 0 else if (keysize > 2048 / 8 && keysize <= 3072 / 8)
0 0 else if (keysize > 2048 / 8 && keysize <= 3072 / 8)
369 0 0 else if (keysize > 3072 / 8 && keysize <= 7680 / 8)
0 0 else if (keysize > 3072 / 8 && keysize <= 7680 / 8)
373 0 0 else if (keysize > 7680 / 8 && keysize <= 15360 / 8)
0 0 else if (keysize > 7680 / 8 && keysize <= 15360 / 8)
382 0 0 if (buf == NULL)
387 0 0 if ((err = pstm_init_for_read_unsigned_bin(pool, &key->priv, privsize))
393 0 0 for (i = 0; i < DH_KEYGEN_SANITY; i++)
395 0 0 if ((err = psGetPrngLocked(buf, privsize, usrData)) < 0)
400 0 0 if ((err = pstm_read_unsigned_bin(&key->priv, buf, privsize))
412 0 0 if (i == DH_KEYGEN_SANITY)
419 0 0 if ((err = pstm_init_size(pool, &key->pub, (p->used * 2) + 1))
425 0 0 if ((err = pstm_exptmod(pool, g, &key->priv, p, &key->pub)) !=
437 0 0 if (buf)
466 0 0 if (privKey->type != PS_PRIVKEY)
473 0 0 if ((err = pstm_init(pool, &tmp)) != PS_SUCCESS)
477 0 0 if ((err = pstm_init_for_read_unsigned_bin(pool, &p, pBinLen)) != PS_SUCCESS)
482 0 0 if ((err = pstm_read_unsigned_bin(&p, pBin, pBinLen)) != PS_SUCCESS)
488 0 0 if (pstm_count_bits(&pubKey->pub) < 2)
493 0 0 if ((err = pstm_add_d(pool, &pubKey->pub, 1, &tmp)) != PSTM_OKAY)
497 0 0 if (pstm_cmp(&p, &tmp) != PSTM_GT)
503 0 0 if ((err = pstm_exptmod(pool, &pubKey->pub, &privKey->priv, &p,
511 0 0 if (*outlen < x)
520 0 0 if ((err = pstm_to_unsigned_bin(pool, &tmp, out)) < 0)