Branch Coverage

RSA.xs
Criterion Covered Total %
branch 95 160 59.3


line true false branch
68 0 20 CHECK_NEW(rsa, 1, rsaData);
72 0 20 return sv_bless(
120 49 0 text = (unsigned char*) SvPV(text_SV, text_length);
162 41 23 : &PL_sv_undef;
170 0 17 CHECK_OPEN_SSL(BIO_flush(p_stringBio) == 1);
174 0 17 CHECK_OPEN_SSL(BIO_set_close(p_stringBio, BIO_CLOSE) == 1);
190 11 0 keyString = SvPV(p_keyStringSv, keyStringLength);
192 4 7 if (SvPOK(p_passphaseSv)) {
193 4 0 passphase = SvPV_nolen(p_passphaseSv);
196 0 11 CHECK_OPEN_SSL(stringBIO = BIO_new_mem_buf(keyString, keyStringLength));
200 0 11 CHECK_OPEN_SSL(BIO_set_close(stringBIO, BIO_CLOSE) == 1);
203 0 11 CHECK_OPEN_SSL(rsa);
217 19 0 from = (unsigned char*) SvPV(p_from, from_length);
219 0 19 CHECK_NEW(to, size, char);
224 0 19 if (to_length < 0)
298 2 7 if (SvPOK(cipher_name_SV) && !SvPOK(passphase_SV)) {
0 2 if (SvPOK(cipher_name_SV) && !SvPOK(passphase_SV)) {
301 3 6 if (SvPOK(passphase_SV)) {
302 3 0 passphase = SvPV(passphase_SV, passphaseLength);
303 2 1 if (SvPOK(cipher_name_SV)) {
304 2 0 cipher_name = SvPV_nolen(cipher_name_SV);
310 0 3 if (enc == NULL) {
315 0 9 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
329 0 5 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
342 0 3 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
363 3 0 rc = RSA_generate_key_ex(rsa, SvIV(bitsSV), e, NULL);
366 0 3 CHECK_OPEN_SSL(rc != -1);
370 0 3 CHECK_OPEN_SSL(rsa);
395 8 0 if (!(n && e))
0 8 if (!(n && e))
399 0 8 CHECK_OPEN_SSL(rsa = RSA_new());
404 5 3 if (p || q)
3 2 if (p || q)
407 0 6 THROW(ctx = BN_CTX_new());
408 3 3 if (!p)
410 0 3 THROW(p = BN_new());
411 0 3 THROW(BN_div(p, NULL, n, q, ctx));
413 2 1 else if (!q)
416 0 2 THROW(BN_div(q, NULL, n, p, ctx));
424 0 6 THROW(p_minus_1 = BN_new());
425 0 6 THROW(BN_sub(p_minus_1, p, BN_value_one()));
426 0 6 THROW(q_minus_1 = BN_new());
427 0 6 THROW(BN_sub(q_minus_1, q, BN_value_one()));
428 1 5 if (!d)
430 0 1 THROW(d = BN_new());
431 0 1 THROW(BN_mul(d, p_minus_1, q_minus_1, ctx));
432 0 1 THROW(BN_mod_inverse(d, e, d, ctx));
439 0 6 THROW(dmp1 = BN_new());
440 0 6 THROW(BN_mod(dmp1, d, p_minus_1, ctx));
441 0 6 THROW(dmq1 = BN_new());
442 0 6 THROW(BN_mod(dmq1, d, q_minus_1, ctx));
443 0 6 THROW(iqmp = BN_new());
444 0 6 THROW(BN_mod_inverse(iqmp, q, p, ctx));
453 2 4 THROW(RSA_check_key(rsa) == 1);
455 6 0 if (p_minus_1) BN_clear_free(p_minus_1);
456 6 0 if (q_minus_1) BN_clear_free(q_minus_1);
457 0 6 if (dmp1) BN_clear_free(dmp1);
458 0 6 if (dmq1) BN_clear_free(dmq1);
459 0 6 if (iqmp) BN_clear_free(iqmp);
460 6 0 if (ctx) BN_CTX_free(ctx);
461 2 4 if (error)
510 0 8 XPUSHs(cor_bn2sv(n));
511 0 8 XPUSHs(cor_bn2sv(e));
512 0 8 XPUSHs(cor_bn2sv(d));
513 0 8 XPUSHs(cor_bn2sv(p));
514 0 8 XPUSHs(cor_bn2sv(q));
515 0 8 XPUSHs(cor_bn2sv(dmp1));
516 0 8 XPUSHs(cor_bn2sv(dmq1));
517 0 8 XPUSHs(cor_bn2sv(iqmp));
534 1 6 if (!_is_private(p_rsa))
547 1 3 if (!_is_private(p_rsa))
576 1 1 if (!_is_private(p_rsa))
594 0 0 random_bytes = SvPV(random_bytes_SV, random_bytes_length);
705 1 14 if (!_is_private(p_rsa))
710 0 14 CHECK_NEW(signature, RSA_size(p_rsa->rsa), char);
712 0 14 CHECK_OPEN_SSL(digest = get_message_digest(text_SV, p_rsa->hashMode));
713 0 14 CHECK_OPEN_SSL(RSA_sign(p_rsa->hashMode,
738 35 0 sig = (unsigned char*) SvPV(sig_SV, sig_length);
739 0 35 if (RSA_size(p_rsa->rsa) < sig_length)
744 0 35 CHECK_OPEN_SSL(digest = get_message_digest(text_SV, p_rsa->hashMode));