Branch Coverage

xs/signature.xs
Criterion Covered Total %
branch 30 234 12.8


line true false branch
26 0 4 if (!arena)
33 4 0 if (result) {
41 0 4 if (result->signer_name)
43 0 4 if (result->signer_email)
45 0 4 if (result->signing_time > 0)
47 4 0 if (result->error)
92 0 0 if (digest_len == 0)
109 0 0 if (digest_len == 0)
126 0 0 if (digest_len == 0)
153 0 1 if (!arena)
157 0 1 if (!RETVAL) {
179 2 0 if (sv_isobject(self_sv) && SvROK(self_sv)) {
2 0 if (sv_isobject(self_sv) && SvROK(self_sv)) {
181 2 0 if (inner && SvTYPE(inner) < SVt_PVAV) {
1 1 if (inner && SvTYPE(inner) < SVt_PVAV) {
183 1 0 if (self) pdfmake_signing_identity_free(self);
191 1 0 RETVAL = (self && self->privkey != NULL);
1 0 RETVAL = (self && self->privkey != NULL);
0 1 RETVAL = (self && self->privkey != NULL);
199 1 0 RETVAL = (self && self->cert != NULL);
1 0 RETVAL = (self && self->cert != NULL);
0 1 RETVAL = (self && self->cert != NULL);
207 1 0 if (!self || !self->chain)
1 0 if (!self || !self->chain)
218 1 0 if (!self || !self->cert || !self->cert->subject.dn)
1 0 if (!self || !self->cert || !self->cert->subject.dn)
0 1 if (!self || !self->cert || !self->cert->subject.dn)
228 1 0 if (!self || !self->cert || !self->cert->issuer.dn)
1 0 if (!self || !self->cert || !self->cert->issuer.dn)
0 1 if (!self || !self->cert || !self->cert->issuer.dn)
238 0 0 if (!self || !self->cert || !self->cert->serial_hex)
0 0 if (!self || !self->cert || !self->cert->serial_hex)
0 0 if (!self || !self->cert || !self->cert->serial_hex)
248 0 0 if (!self || !self->cert)
0 0 if (!self || !self->cert)
259 0 0 if (!self || !self->cert)
0 0 if (!self || !self->cert)
272 0 0 if (items > 1)
277 0 0 if (!self || !self->cert)
0 0 if (!self || !self->cert)
288 1 0 if (!self || !self->cert)
0 1 if (!self || !self->cert)
299 0 0 if (!self || !self->privkey)
0 0 if (!self || !self->privkey)
317 0 0 if (!self || !self->subject.dn)
0 0 if (!self || !self->subject.dn)
327 0 0 if (!self || !self->issuer.dn)
0 0 if (!self || !self->issuer.dn)
337 0 0 RETVAL = self ? self->version : 0;
0 0 RETVAL = self ? self->version : 0;
345 0 0 RETVAL = self ? self->is_ca : 0;
0 0 RETVAL = self ? self->is_ca : 0;
353 0 0 RETVAL = self ? self->is_self_signed : 0;
0 0 RETVAL = self ? self->is_self_signed : 0;
361 0 0 RETVAL = self ? pdfmake_x509_can_sign_documents(self) : 0;
0 0 RETVAL = self ? pdfmake_x509_can_sign_documents(self) : 0;
371 0 0 if (items > 1)
375 0 0 RETVAL = self ? pdfmake_x509_is_valid(self, check_time) : 0;
0 0 RETVAL = self ? pdfmake_x509_is_valid(self, check_time) : 0;
414 0 0 if (SvOK(reason)) config.reason = SvPV_nolen(reason);
415 0 0 if (SvOK(location)) config.location = SvPV_nolen(location);
416 0 0 if (SvOK(contact)) config.contact_info = SvPV_nolen(contact);
417 0 0 if (SvOK(name)) config.name = SvPV_nolen(name);
418 0 0 if (SvOK(signing_time_sv)) config.signing_time = (int64_t)SvIV(signing_time_sv);
419 0 0 if (SvOK(tst_token_sv)) {
424 0 0 if (SvOK(placeholder_sv)) {
435 0 0 if (SvOK(appearance_sv) && SvROK(appearance_sv) &&
0 0 if (SvOK(appearance_sv) && SvROK(appearance_sv) &&
436 0 0 SvTYPE(SvRV(appearance_sv)) == SVt_PVHV) {
439 0 0 if ((v = hv_fetchs(ap, "visible", 0)) && SvTRUE(*v)) config.visible = 1;
0 0 if ((v = hv_fetchs(ap, "visible", 0)) && SvTRUE(*v)) config.visible = 1;
440 0 0 if ((v = hv_fetchs(ap, "page", 0)) && SvOK(*v)) config.page = SvIV(*v);
0 0 if ((v = hv_fetchs(ap, "page", 0)) && SvOK(*v)) config.page = SvIV(*v);
441 0 0 if ((v = hv_fetchs(ap, "rect", 0)) && SvROK(*v) &&
0 0 if ((v = hv_fetchs(ap, "rect", 0)) && SvROK(*v) &&
442 0 0 SvTYPE(SvRV(*v)) == SVt_PVAV) {
444 0 0 for (int i = 0; i < 4 && i <= av_len(r); i++) {
0 0 for (int i = 0; i < 4 && i <= av_len(r); i++) {
446 0 0 if (e && SvOK(*e)) config.rect[i] = SvNV(*e);
0 0 if (e && SvOK(*e)) config.rect[i] = SvNV(*e);
449 0 0 if ((v = hv_fetchs(ap, "stream", 0)) && SvOK(*v)) {
0 0 if ((v = hv_fetchs(ap, "stream", 0)) && SvOK(*v)) {
454 0 0 if ((v = hv_fetchs(ap, "show_name", 0)) && SvOK(*v)) config.ap_show_name = SvTRUE(*v) ? 1 : 0;
0 0 if ((v = hv_fetchs(ap, "show_name", 0)) && SvOK(*v)) config.ap_show_name = SvTRUE(*v) ? 1 : 0;
455 0 0 if ((v = hv_fetchs(ap, "show_date", 0)) && SvOK(*v)) config.ap_show_date = SvTRUE(*v) ? 1 : 0;
0 0 if ((v = hv_fetchs(ap, "show_date", 0)) && SvOK(*v)) config.ap_show_date = SvTRUE(*v) ? 1 : 0;
456 0 0 if ((v = hv_fetchs(ap, "show_reason", 0)) && SvOK(*v)) config.ap_show_reason = SvTRUE(*v) ? 1 : 0;
0 0 if ((v = hv_fetchs(ap, "show_reason", 0)) && SvOK(*v)) config.ap_show_reason = SvTRUE(*v) ? 1 : 0;
458 0 0 if ((v = hv_fetchs(ap, "fonts", 0)) && SvROK(*v) &&
0 0 if ((v = hv_fetchs(ap, "fonts", 0)) && SvROK(*v) &&
459 0 0 SvTYPE(SvRV(*v)) == SVt_PVHV) {
465 0 0 while ((val = hv_iternextsv(fh, &key, &keylen))) ap_font_count++;
466 0 0 if (ap_font_count > 0) {
471 0 0 while ((val = hv_iternextsv(fh, &key, &keylen))) {
472 0 0 if (!SvOK(val)) continue;
486 0 0 if ((v = hv_fetchs(ap, "xobjects", 0)) && SvROK(*v) &&
0 0 if ((v = hv_fetchs(ap, "xobjects", 0)) && SvROK(*v) &&
487 0 0 SvTYPE(SvRV(*v)) == SVt_PVHV) {
493 0 0 while ((val = hv_iternextsv(xh, &key, &keylen))) ap_xo_count++;
494 0 0 if (ap_xo_count > 0) {
499 0 0 while ((val = hv_iternextsv(xh, &key, &keylen))) {
500 0 0 if (!SvOK(val)) continue;
515 0 0 if (ap_xo_names) {
516 0 0 for (size_t i = 0; i < ap_xo_count; i++) free(ap_xo_names[i]);
520 0 0 if (ap_names) {
521 0 0 for (size_t i = 0; i < ap_font_count; i++) {
523 0 0 if (ap_bases) free(ap_bases[i]);
528 0 0 if (err != PDFMAKE_OK) {
551 0 0 if (!arena) croak("PDF::Make::Signature::_build_tsa_request: arena alloc failed");
556 0 0 if (err != PDFMAKE_OK) {
580 0 0 if (!arena) croak("PDF::Make::Signature::_parse_tsa_response: arena alloc failed");
583 0 0 if (rc == -2) {
587 0 0 if (rc != 0 || !token) {
0 0 if (rc != 0 || !token) {
608 0 0 if (!arena) croak("PDF::Make::Signature::_extract_cms_signature: arena alloc failed");
609 0 0 if (pdfmake_cms_extract_signature(arena, cbytes, (size_t)clen,
610 0 0 &sig, &sig_len) != 0 || !sig) {