Branch Coverage

SignCSR.xs
Criterion Covered Total %
branch 95 210 45.2


line true false branch
43 3 0 if (!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV)
0 3 if (!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV)
54 3 0 btmp = b == NULL ? BN_new() : b;
55 0 3 if (btmp == NULL)
59 0 3 if (!BN_rand(btmp, SERIAL_RAND_BITS, 0, 0))
64 3 0 if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
0 3 if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
71 3 0 if (btmp != b)
80 0 3 if (startdate == NULL || strcmp(startdate, "today") == 0) {
0 0 if (startdate == NULL || strcmp(startdate, "today") == 0) {
82 0 3 if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL)
89 0 0 if (!ASN1_TIME_set_string(X509_get_notBefore(x), startdate))
95 3 0 if (enddate == NULL) {
97 0 3 if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL)
104 0 0 } else if (!ASN1_TIME_set_string(X509_get_notAfter(x), enddate)) {
118 3 0 if (x == NULL || req == NULL)
0 3 if (x == NULL || req == NULL)
120 0 3 if (copy_type == EXT_COPY_NONE)
124 10 3 for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
130 0 10 if (idx != -1) {
132 0 0 if (copy_type == EXT_COPY_ADD)
138 0 0 } while (idx != -1);
140 0 10 if (!X509_add_ext(x, ext, -1))
165 3 0 if (opts == NULL)
189 3 0 if (do_x509_req_init(x, vfyopts) > 0){
215 0 3 CHECK_OPEN_SSL(BIO_flush(p_stringBio) == 1);
219 0 3 CHECK_OPEN_SSL(BIO_set_close(p_stringBio, BIO_CLOSE) == 1);
230 0 0 if (stmp == NULL)
233 0 0 if (vtmp == NULL)
249 3 0 if (opts == NULL)
252 0 0 for (i = 0; i < sk_OPENSSL_STRING_num(opts); i++) {
255 0 0 if (pkey_ctrl_string(pkctx, opt) <= 0) {
268 0 0 nmflag_set ? nmflag : XN_FLAG_SEP_CPLUS_SPC | ASN1_STRFLGS_UTF8_CONVERT;
284 0 3 if (ctx == NULL)
294 0 3 if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) == 2
295 0 0 && def_nid == NID_undef) {
308 3 0 && do_pkey_ctx_init(pkctx, sigopts);
3 0 && do_pkey_ctx_init(pkctx, sigopts);
315 0 3 if (!key)
355 3 0 if (items > 1) {
356 3 0 if (ST(1) != NULL) {
359 0 3 if (strlen(SvPV_nolen(private_key)) == 0) {
364 3 0 if (items > 2)
369 3 0 if (hv_exists(options, "days", strlen("days"))) {
371 3 0 if (SvIOKp(*svp)) {
377 3 0 if (hv_exists(options, "digest", strlen("digest"))) {
379 3 0 if (SvPOKp(*svp)) {
385 3 0 if (hv_exists(options, "format", strlen("format"))) {
387 3 0 if (SvPOKp(*svp)) {
392 0 3 if (private_key == NULL)
398 0 3 if (bio == NULL) {
405 0 3 if (pkey == NULL) {
416 0 3 if((hv_store(attributes, "privkey", 7, key, 0)) == NULL)
419 3 0 if (format != NULL)
420 0 3 if((hv_store(attributes, "format", 6, newRV_inc(format), 0)) == NULL)
423 3 0 if (digest != NULL)
424 0 3 if((hv_store(attributes, "digest", 6, newRV_inc(digest), 0)) == NULL)
427 0 3 if((hv_store(attributes, "days", 4, newSViv(days), 0)) == NULL)
447 2 0 if (hv_exists(self, "digest", strlen("digest"))) {
449 2 0 if (SvROK(*svp)) {
468 1 0 if (digest != NULL) {
474 1 0 if (md != NULL) {
475 0 1 if((hv_store(self, "digest", 6, newRV_inc(digest), 0)) == NULL)
496 2 0 if (hv_exists(self, "format", strlen("format"))) {
498 2 0 if (SvROK(*svp)) {
514 0 0 sv_cmp(format, newSVpv("text", 0)) == 0 ||
518 0 1 if((hv_store(self, "format", 6, newRV_inc(format), 0)) == NULL)
538 2 0 if (hv_exists(self, "days", strlen("days"))) {
540 2 0 if (SvIOKp(*svp)) {
555 0 1 if((hv_store(self, "days", 4, newSViv(days), 0)) == NULL)
587 0 3 if (!hv_exists(self, "privkey", strlen("privkey")))
592 3 0 if (!SvMAGICAL(*svp) || (mg = mg_findext(*svp, PERL_MAGIC_ext, &key_magic)) == NULL)
0 3 if (!SvMAGICAL(*svp) || (mg = mg_findext(*svp, PERL_MAGIC_ext, &key_magic)) == NULL)
595 0 3 if (!hv_exists(self, "days", strlen("days")))
599 3 0 if (SvIOKp(*svp)) {
606 3 0 if (hv_exists(self, "digest", strlen("digest"))) {
608 3 0 if (SvROK(*svp)) {
615 0 3 if (!hv_exists(self, "format", strlen("format")))
619 3 0 if (SvROK(*svp)) {
630 0 3 if (csrbio == NULL) {
636 0 3 if (csr == NULL) {
642 3 0 if (csr != NULL) {
648 0 3 if (pkey == NULL)
652 0 3 if (ret == 0)
654 0 3 if ( ret < 0)
665 0 3 if ((x = X509_new()) == NULL)
671 0 3 if (!copy_extensions(x, csr, ext_copy))
675 0 3 if (!X509_set_subject_name(x, X509_REQ_get_subject_name(csr)))
680 0 3 if (!X509_set_pubkey(x, X509_REQ_get_pubkey(csr)))
696 3 0 if (private_key != NULL && !cert_matches_key(x, private_key))
0 3 if (private_key != NULL && !cert_matches_key(x, private_key))
701 3 0 if (sno == NULL || !rand_serial(NULL, sno))
0 3 if (sno == NULL || !rand_serial(NULL, sno))
704 3 0 if (sno != NULL && !X509_set_serialNumber(x, sno))
0 3 if (sno != NULL && !X509_set_serialNumber(x, sno))
715 0 3 if (!X509_set_issuer_name(x, X509_get_subject_name(issuer_cert)))
736 0 3 if (!X509_set_version(x, 2))
740 3 0 if (digest != NULL)
754 3 0 ? EVP_get_digestbyname(digestname) : NULL;
768 3 0 if (mctx != NULL && do_sign_init(mctx, private_key, md, NULL) > 0)
3 0 if (mctx != NULL && do_sign_init(mctx, private_key, md, NULL) > 0)
772 0 3 if (rv == 0)
779 2 1 if (sv_cmp(format, newSVpv("pem", 0)) == 0){
782 1 0 else if (sv_cmp(format, newSVpv("der", 0)) == 0){
788 0 3 if (!i)