Branch Coverage

inc/CryptX_PK_ECC.xs.inc
Criterion Covered Total %
branch 141 214 65.8


line true false branch
11 0 271 if (!RETVAL) croak("FATAL: Newz failed");
14 0 271 if (RETVAL->pindex == -1) {
19 0 271 if (rv != CRYPT_OK) {
34 0 10 if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv));
37 0 10 if (rv != CRYPT_OK) croak("FATAL: ecc_generate_key failed: %s", error_to_string(rv));
38 0 10 XPUSHs(ST(0)); /* return self */
50 3 36 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
52 9 30 if (rv != CRYPT_OK) croak("FATAL: ecc_import_openssl failed: %s", error_to_string(rv));
53 0 30 XPUSHs(ST(0)); /* return self */
65 0 18 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
67 10 8 if (rv != CRYPT_OK) croak("FATAL: ecc_import failed: %s", error_to_string(rv));
68 0 8 XPUSHs(ST(0)); /* return self */
81 0 5 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
82 2 3 if (SvOK(passwd)) {
88 0 5 if (rv != CRYPT_OK) croak("FATAL: ecc_import_pkcs8 failed: %s", error_to_string(rv));
89 0 5 XPUSHs(ST(0)); /* return self */
103 18 43 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
104 17 44 if (SvOK(passwd)) {
110 9 52 if (rv != CRYPT_OK) croak("FATAL: pem_decode_pkcs failed: %s", error_to_string(rv));
111 0 52 if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_pkcs decoded non-ECC key");
113 0 52 XPUSHs(ST(0)); /* return self */
127 9 0 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
128 3 6 if (SvOK(passwd)) {
134 0 9 if (rv != CRYPT_OK) croak("FATAL: pem_decode_openssh failed: %s", error_to_string(rv));
135 0 9 if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_openssh decoded non-ECC key");
137 0 9 XPUSHs(ST(0)); /* return self */
149 0 0 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
151 0 0 if (rv != CRYPT_OK) croak("FATAL: ecc_import_x509 failed: %s", error_to_string(rv));
152 0 0 XPUSHs(ST(0)); /* return self */
164 3 181 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
167 0 184 if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv));
171 0 184 if (rv != CRYPT_OK) croak("FATAL: ecc_set_key failed: %s", error_to_string(rv));
172 0 184 XPUSHs(ST(0)); /* return self */
178 0 79 if (self->key.type == -1) XSRETURN_UNDEF;
179 57 22 RETVAL = (self->key.type == PK_PRIVATE) ? 1 : 0;
186 0 5 if (self->key.type == -1) XSRETURN_UNDEF;
200 0 44 if (self->key.type == -1) XSRETURN_UNDEF;
204 44 0 siz = (self->key.k) ? mp_ubin_size(self->key.k) : 0;
205 0 44 if (siz>10000) {
208 31 13 if (siz>0) {
216 44 0 siz = (self->key.pubkey.x) ? mp_ubin_size(self->key.pubkey.x) : 0;
217 0 44 if (siz>10000) {
220 44 0 if (siz>0) {
228 44 0 siz = (self->key.pubkey.y) ? mp_ubin_size(self->key.pubkey.y) : 0;
229 0 44 if (siz>10000) {
232 44 0 if (siz>0) {
257 42 2 if (self->key.dp.oidlen > 0) {
266 206 42 for(i = 0; i < self->key.dp.oidlen - 1; i++) sv_catpvf(oid, "%lu.", self->key.dp.oid[i]);
272 42 0 if ((h = get_hv("Crypt::PK::ECC::curve_oid2name", 0)) != NULL) {
274 42 0 if (pref) {
300 1 26 if (self->key.type == -1) croak("FATAL: export_key_der no key");
301 5 21 if (strnEQ(type, "private_short", 16)) {
303 1 4 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID) failed: %s", error_to_string(rv));
306 0 21 else if (strnEQ(type, "private_compressed", 16)) {
308 0 0 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv));
311 10 11 else if (strnEQ(type, "private", 7)) {
313 0 10 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE) failed: %s", error_to_string(rv));
316 0 11 else if (strnEQ(type, "public_compressed", 15)) {
318 0 0 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv));
321 3 8 else if (strnEQ(type, "public_short", 15)) {
323 0 3 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID) failed: %s", error_to_string(rv));
326 8 0 else if (strnEQ(type, "public", 6)) {
328 0 8 if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC) failed: %s", error_to_string(rv));
346 0 428 if (self->key.type == -1) croak("FATAL: export_key_der no key");
347 60 368 if (strnEQ(type, "private", 7)) {
349 0 60 if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(private) failed: %s", error_to_string(rv));
352 180 188 else if (strnEQ(type, "public_compressed", 17)) {
354 0 180 if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public_compressed) failed: %s", error_to_string(rv));
357 188 0 else if (strnEQ(type, "public", 6)) {
359 0 188 if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public) failed: %s", error_to_string(rv));
382 0 2 if (hash_id == -1) croak("FATAL: find_hash failed for '%s'", hash_name);
386 0 2 if (rv != CRYPT_OK) croak("FATAL: ecc_encrypt_key failed: %s", error_to_string(rv));
405 0 2 if (rv != CRYPT_OK) croak("FATAL: ecc_decrypt_key_ex failed: %s", error_to_string(rv));
427 22 7 if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) {
17 5 if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) {
6 11 if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) {
12 6 if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) {
12 0 if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) {
432 23 6 if (ix == 1 || ix == 2) {
5 18 if (ix == 1 || ix == 2) {
434 7 4 if (hash_name == NULL) {
438 0 11 if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name);
440 0 11 if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv));
445 21 8 if (hash_rfc6979_name != NULL) {
448 0 21 if (hash_rfc6979_id == -1) croak("FATAL: find_hash failed for rfc6979 hash '%s'", hash_rfc6979_name);
452 24 5 if (ix == 2 || ix == 3) {
5 19 if (ix == 2 || ix == 3) {
456 6 13 else if (ix == 4) {
465 0 29 if (rv != CRYPT_OK) croak("FATAL: ecc_sign_hash_v2 failed: %s", error_to_string(rv));
488 15 124 if (ix == 1 || ix == 2) {
3 12 if (ix == 1 || ix == 2) {
490 0 127 if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name);
492 0 127 if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv));
498 136 3 if (ix == 2 || ix == 3) {
3 133 if (ix == 2 || ix == 3) {
502 4 129 else if (ix == 4) {
511 139 0 if (rv != CRYPT_OK || stat != 1) RETVAL = 0;
0 139 if (rv != CRYPT_OK || stat != 1) RETVAL = 0;
525 0 4 if (rv != CRYPT_OK) croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv));
543 5 1 if (recid != NULL) {
546 0 1 else if (ix != 2) {
547 0 0 if (ix == 1) {
556 2 4 if (ix == 1) {
559 2 2 else if (ix == 2) {
566 0 6 if (rv != CRYPT_OK) croak("FATAL: ecc_recover_key failed: %s", error_to_string(rv));
567 0 6 RETVAL = 1;
575 265 6 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }