Branch Coverage

RSA.xs
Criterion Covered Total %
branch 83 144 57.6


line true false branch
65 0 15 CHECK_NEW(rsa, 1, rsaData);
69 0 15 return sv_bless(
117 49 0 text = (unsigned char*) SvPV(text_SV, text_length);
159 41 23 : &PL_sv_undef;
167 0 10 CHECK_OPEN_SSL(BIO_flush(p_stringBio) == 1);
171 0 10 CHECK_OPEN_SSL(BIO_set_close(p_stringBio, BIO_CLOSE) == 1);
185 6 0 keyString = SvPV(p_keyStringSv, keyStringLength);
187 0 6 CHECK_OPEN_SSL(stringBIO = BIO_new_mem_buf(keyString, keyStringLength));
191 0 6 CHECK_OPEN_SSL(BIO_set_close(stringBIO, BIO_CLOSE) == 1);
194 0 6 CHECK_OPEN_SSL(rsa);
208 19 0 from = (unsigned char*) SvPV(p_from, from_length);
210 0 19 CHECK_NEW(to, size, char);
215 0 19 if (to_length < 0)
275 0 2 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
289 0 5 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
302 0 3 CHECK_OPEN_SSL(stringBIO = BIO_new(BIO_s_mem()));
323 3 0 rc = RSA_generate_key_ex(rsa, SvIV(bitsSV), e, NULL);
326 0 3 CHECK_OPEN_SSL(rc != -1);
330 0 3 CHECK_OPEN_SSL(rsa);
355 8 0 if (!(n && e))
0 8 if (!(n && e))
359 0 8 CHECK_OPEN_SSL(rsa = RSA_new());
364 5 3 if (p || q)
3 2 if (p || q)
367 0 6 THROW(ctx = BN_CTX_new());
368 3 3 if (!p)
370 0 3 THROW(p = BN_new());
371 0 3 THROW(BN_div(p, NULL, n, q, ctx));
373 2 1 else if (!q)
376 0 2 THROW(BN_div(q, NULL, n, p, ctx));
384 0 6 THROW(p_minus_1 = BN_new());
385 0 6 THROW(BN_sub(p_minus_1, p, BN_value_one()));
386 0 6 THROW(q_minus_1 = BN_new());
387 0 6 THROW(BN_sub(q_minus_1, q, BN_value_one()));
388 1 5 if (!d)
390 0 1 THROW(d = BN_new());
391 0 1 THROW(BN_mul(d, p_minus_1, q_minus_1, ctx));
392 0 1 THROW(BN_mod_inverse(d, e, d, ctx));
399 0 6 THROW(dmp1 = BN_new());
400 0 6 THROW(BN_mod(dmp1, d, p_minus_1, ctx));
401 0 6 THROW(dmq1 = BN_new());
402 0 6 THROW(BN_mod(dmq1, d, q_minus_1, ctx));
403 0 6 THROW(iqmp = BN_new());
404 0 6 THROW(BN_mod_inverse(iqmp, q, p, ctx));
413 2 4 THROW(RSA_check_key(rsa) == 1);
415 6 0 if (p_minus_1) BN_clear_free(p_minus_1);
416 6 0 if (q_minus_1) BN_clear_free(q_minus_1);
417 0 6 if (dmp1) BN_clear_free(dmp1);
418 0 6 if (dmq1) BN_clear_free(dmq1);
419 0 6 if (iqmp) BN_clear_free(iqmp);
420 6 0 if (ctx) BN_CTX_free(ctx);
421 2 4 if (error)
470 0 8 XPUSHs(bn2sv(n));
471 0 8 XPUSHs(bn2sv(e));
472 0 8 XPUSHs(bn2sv(d));
473 0 8 XPUSHs(bn2sv(p));
474 0 8 XPUSHs(bn2sv(q));
475 0 8 XPUSHs(bn2sv(dmp1));
476 0 8 XPUSHs(bn2sv(dmq1));
477 0 8 XPUSHs(bn2sv(iqmp));
494 1 6 if (!_is_private(p_rsa))
507 1 3 if (!_is_private(p_rsa))
536 1 1 if (!_is_private(p_rsa))
554 0 0 random_bytes = SvPV(random_bytes_SV, random_bytes_length);
661 1 14 if (!_is_private(p_rsa))
666 0 14 CHECK_NEW(signature, RSA_size(p_rsa->rsa), char);
668 0 14 CHECK_OPEN_SSL(digest = get_message_digest(text_SV, p_rsa->hashMode));
669 0 14 CHECK_OPEN_SSL(RSA_sign(p_rsa->hashMode,
694 35 0 sig = (unsigned char*) SvPV(sig_SV, sig_length);
695 0 35 if (RSA_size(p_rsa->rsa) < sig_length)
700 0 35 CHECK_OPEN_SSL(digest = get_message_digest(text_SV, p_rsa->hashMode));
709 0 28 CHECK_OPEN_SSL(ERR_peek_error());