Branch Coverage

SignCSR.xs
Criterion Covered Total %
branch 102 228 44.7


line true false branch
43 2 0 if (!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV)
0 2 if (!SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV)
54 2 0 btmp = b == NULL ? BN_new() : b;
55 0 2 if (btmp == NULL)
59 0 2 if (!BN_rand(btmp, SERIAL_RAND_BITS, 0, 0))
64 2 0 if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
0 2 if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
71 2 0 if (btmp != b)
80 0 2 if (startdate == NULL || strcmp(startdate, "today") == 0) {
0 0 if (startdate == NULL || strcmp(startdate, "today") == 0) {
82 0 2 if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL)
89 0 0 if (!ASN1_TIME_set_string(X509_get_notBefore(x), startdate))
95 2 0 if (enddate == NULL) {
97 0 2 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 2 0 if (x == NULL || req == NULL)
0 2 if (x == NULL || req == NULL)
120 0 2 if (copy_type == EXT_COPY_NONE)
124 7 2 for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
130 0 7 if (idx != -1) {
132 0 0 if (copy_type == EXT_COPY_ADD)
138 0 0 } while (idx != -1);
140 0 7 if (!X509_add_ext(x, ext, -1))
165 2 0 if (opts == NULL)
189 2 0 if (do_x509_req_init(x, vfyopts) > 0){
215 0 2 CHECK_OPEN_SSL(BIO_flush(p_stringBio) == 1);
219 0 2 CHECK_OPEN_SSL(BIO_set_close(p_stringBio, BIO_CLOSE) == 1);
230 0 0 if (stmp == NULL)
233 0 0 if (vtmp == NULL)
249 2 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 2 if (ctx == NULL)
294 0 2 if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) == 2
295 0 0 && def_nid == NID_undef) {
308 2 0 && do_pkey_ctx_init(pkctx, sigopts);
2 0 && do_pkey_ctx_init(pkctx, sigopts);
315 0 2 if (!key)
355 2 0 if (items > 1) {
356 2 0 if (ST(1) != NULL) {
359 2 0 if (strlen(SvPV_nolen(private_key)) == 0) {
0 2 if (strlen(SvPV_nolen(private_key)) == 0) {
364 2 0 if (items > 2)
369 2 0 if (hv_exists(options, "days", strlen("days"))) {
371 2 0 if (SvIOKp(*svp)) {
372 2 0 days = SvIV(*svp);
377 2 0 if (hv_exists(options, "digest", strlen("digest"))) {
379 2 0 if (SvPOKp(*svp)) {
385 2 0 if (hv_exists(options, "format", strlen("format"))) {
387 2 0 if (SvPOKp(*svp)) {
393 2 0 keyString = SvPV(private_key, keyStringLength);
395 0 2 if (bio == NULL) {
401 0 2 if (pkey == NULL) {
412 0 2 if((hv_store(attributes, "privkey", 7, key, 0)) == NULL)
415 2 0 if (format != NULL)
416 0 2 if((hv_store(attributes, "format", 6, newRV_inc(format), 0)) == NULL)
419 2 0 if (digest != NULL)
420 0 2 if((hv_store(attributes, "digest", 6, newRV_inc(digest), 0)) == NULL)
423 0 2 if((hv_store(attributes, "days", 4, newSViv(days), 0)) == NULL)
441 2 0 if (hv_exists(self, "digest", strlen("digest"))) {
443 2 0 if (SvROK(*svp)) {
444 2 0 RETVAL = SvPV_nolen(SvRV(*svp));
450 0 0 RETVAL = SvPV_nolen(newSVpv("",0));
471 1 0 if (digest != NULL) {
472 1 0 digestname = (const char*) SvPV(digest, digestname_length);
477 1 0 if (md != NULL) {
478 0 1 if((hv_store(self, "digest", 6, newRV_inc(digest), 0)) == NULL)
497 2 0 if (hv_exists(self, "format", strlen("format"))) {
499 2 0 if (SvROK(*svp)) {
500 2 0 RETVAL = SvPV_nolen(SvRV(*svp));
504 0 0 RETVAL = SvPV_nolen(newSVpv("",0));
520 0 1 if((hv_store(self, "format", 6, newRV_inc(format), 0)) == NULL)
539 2 0 if (hv_exists(self, "days", strlen("days"))) {
541 2 0 if (SvIOKp(*svp)) {
542 2 0 RETVAL = SvIV(*svp);
555 0 1 if((hv_store(self, "days", 4, newSViv(days), 0)) == NULL)
587 0 2 if (!hv_exists(self, "privkey", strlen("privkey")))
592 2 0 if (!SvMAGICAL(*svp) || (mg = mg_findext(*svp, PERL_MAGIC_ext, &key_magic)) == NULL)
0 2 if (!SvMAGICAL(*svp) || (mg = mg_findext(*svp, PERL_MAGIC_ext, &key_magic)) == NULL)
595 0 2 if (!hv_exists(self, "days", strlen("days")))
599 2 0 if (SvIOKp(*svp)) {
600 2 0 days = SvIV(*svp);
606 2 0 if (hv_exists(self, "digest", strlen("digest"))) {
608 2 0 if (SvROK(*svp)) {
615 0 2 if (!hv_exists(self, "format", strlen("format")))
619 2 0 if (SvROK(*svp)) {
626 2 0 request = (unsigned char*) SvPV(request_SV, request_length);
630 0 2 if (csrbio == NULL) {
635 0 2 if (csr == NULL) {
641 2 0 if (csr != NULL) {
647 0 2 if (pkey == NULL)
651 0 2 if (ret == 0)
653 0 2 if ( ret < 0)
664 0 2 if ((x = X509_new()) == NULL)
670 0 2 if (!copy_extensions(x, csr, ext_copy))
674 0 2 if (!X509_set_subject_name(x, X509_REQ_get_subject_name(csr)))
679 0 2 if (!X509_set_pubkey(x, X509_REQ_get_pubkey(csr)))
695 2 0 if (private_key != NULL && !cert_matches_key(x, private_key))
0 2 if (private_key != NULL && !cert_matches_key(x, private_key))
700 2 0 if (sno == NULL || !rand_serial(NULL, sno))
0 2 if (sno == NULL || !rand_serial(NULL, sno))
703 2 0 if (sno != NULL && !X509_set_serialNumber(x, sno))
0 2 if (sno != NULL && !X509_set_serialNumber(x, sno))
712 0 2 if (!X509_set_issuer_name(x, X509_get_subject_name(issuer_cert)))
732 0 2 #else
742 2 0 #endif
743 2 0 if (digest != NULL) {
746 2 0 }
764 2 0 #else
2 0 #else
768 0 2
775 2 0 int i;
782 0 2