Branch Coverage

inc/CryptX_PK_DH.xs.inc
Criterion Covered Total %
branch 65 140 46.4


line true false branch
11 0 35 if (!RETVAL) croak("FATAL: Newz failed");
14 0 35 if (RETVAL->pindex == -1) {
19 0 35 if (rv != CRYPT_OK) {
33 0 1 if (rv != CRYPT_OK) croak("FATAL: dh_set_pg_groupsize failed: %s", error_to_string(rv));
35 0 1 if (rv != CRYPT_OK) croak("FATAL: dh_generate_key failed: %s", error_to_string(rv));
36 0 1 XPUSHs(ST(0)); /* return self */
47 4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
49 0 4 if (rv != CRYPT_OK) croak("FATAL: radix_to_bin(p) failed: %s", error_to_string(rv));
51 0 4 if (rv != CRYPT_OK) croak("FATAL: radix_to_bin(g) failed: %s", error_to_string(rv));
54 0 4 if (rv != CRYPT_OK) croak("FATAL: dh_set_pg failed: %s", error_to_string(rv));
56 0 4 if (rv != CRYPT_OK) croak("FATAL: dh_generate_key failed: %s", error_to_string(rv));
59 0 4 XPUSHs(ST(0)); /* return self */
69 2 0 data = (unsigned char *)SvPVbyte(dhparam, data_len);
72 0 2 if (rv != CRYPT_OK) croak("FATAL: dh_set_pg_dhparam failed: %s", error_to_string(rv));
75 0 2 if (rv != CRYPT_OK) croak("FATAL: dh_generate_key failed: %s", error_to_string(rv));
76 0 2 XPUSHs(ST(0)); /* return self */
87 24 0 data = (unsigned char *)SvPVbyte(key_data, data_len);
88 0 24 if (self->key.type != -1) { dh_free(&self->key); self->key.type = -1; }
90 0 24 if (rv != CRYPT_OK) croak("FATAL: dh_import failed: %s", error_to_string(rv));
91 0 24 XPUSHs(ST(0)); /* return self */
104 4 0 data = (unsigned char *)SvPVbyte(raw_key, data_len);
105 0 4 if (self->key.type != -1) { dh_free(&self->key); self->key.type = -1; }
107 4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
4 0 if (p && strlen(p) > 0 && g && strlen(g) > 0) {
109 0 4 if (rv != CRYPT_OK) croak("FATAL: radix_to_bin(p) failed: %s", error_to_string(rv));
111 0 4 if (rv != CRYPT_OK) croak("FATAL: radix_to_bin(g) failed: %s", error_to_string(rv));
114 0 4 if (rv != CRYPT_OK) croak("FATAL: dh_set_pg failed: %s", error_to_string(rv));
116 2 2 if (type == 0) {
119 0 2 if (rv != CRYPT_OK) croak("FATAL: dh_set_key failed: %s", error_to_string(rv));
121 2 0 else if (type == 1) {
124 0 2 if (rv != CRYPT_OK) croak("FATAL: dh_set_key failed: %s", error_to_string(rv));
131 0 4 XPUSHs(ST(0)); /* return self */
137 0 21 if (self->key.type == -1) XSRETURN_UNDEF;
145 0 2 if (self->key.type == -1) XSRETURN_UNDEF;
158 0 2 if (self->key.type == -1) XSRETURN_UNDEF;
161 2 0 siz = (self->key.x) ? mp_unsigned_bin_size(self->key.x) : 0;
162 0 2 if (siz>10000) {
165 2 0 if (siz>0) {
173 2 0 siz = (self->key.y) ? mp_unsigned_bin_size(self->key.y) : 0;
174 0 2 if (siz>10000) {
177 2 0 if (siz>0) {
185 2 0 siz = (self->key.prime) ? mp_unsigned_bin_size(self->key.prime) : 0;
186 0 2 if (siz>10000) {
189 2 0 if (siz>0) {
198 2 0 siz = (self->key.base) ? mp_unsigned_bin_size(self->key.base) : 0;
199 0 2 if (siz>10000) {
202 2 0 if (siz>0) {
226 0 0 if (self->key.type == -1) XSRETURN_UNDEF;
229 0 0 siz = (self->key.prime) ? mp_unsigned_bin_size(self->key.prime) : 0;
230 0 0 if (siz>10000) {
233 0 0 if (siz>0) {
242 0 0 siz = (self->key.base) ? mp_unsigned_bin_size(self->key.base) : 0;
243 0 0 if (siz>10000) {
246 0 0 if (siz>0) {
253 0 0 if (not_used) not_used = NULL; /* just silence the warning: variable 'not_used' set but not used */
267 7 7 if (strnEQ(type, "private", 7)) {
269 0 7 if (rv != CRYPT_OK) croak("FATAL: dh_export(PK_PRIVATE) failed: %s", error_to_string(rv));
272 7 0 else if (strnEQ(type, "public", 6)) {
274 0 7 if (rv != CRYPT_OK) croak("FATAL: dh_export(PK_PUBLIC) failed: %s", error_to_string(rv));
293 0 10 if (rv != CRYPT_OK) croak("FATAL: dh_shared_secret failed: %s", error_to_string(rv));
308 1 2 if (strnEQ(type, "private", 7)) {
310 0 1 if (rv != CRYPT_OK) croak("FATAL: dh_export_key(PK_PRIVATE) failed: %s", error_to_string(rv));
313 2 0 else if (strnEQ(type, "public", 6)) {
315 0 2 if (rv != CRYPT_OK) croak("FATAL: dh_export_key(PK_PUBLIC) failed: %s", error_to_string(rv));
328 35 0 if (self->key.type != -1) { dh_free(&self->key); self->key.type = -1; }