| line |
true |
false |
branch |
|
11
|
0 |
270 |
if (!RETVAL) croak("FATAL: Newz failed"); |
|
14
|
0 |
270 |
if (RETVAL->pindex == -1) { |
|
19
|
0 |
270 |
if (rv != CRYPT_OK) { |
|
34
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
37
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: ecc_generate_key failed: %s", error_to_string(rv)); |
|
38
|
0 |
9 |
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)); |
|
426
|
7 |
2 |
if (ix == 1 || ix == 2) { |
|
|
1 |
6 |
if (ix == 1 || ix == 2) { |
|
428
|
0 |
3 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
430
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
434
|
8 |
1 |
if (ix == 2 || ix == 3) { |
|
|
1 |
7 |
if (ix == 2 || ix == 3) { |
|
439
|
2 |
5 |
else if (ix == 4) { |
|
449
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: ecc_sign_hash_ex failed: %s", error_to_string(rv)); |
|
471
|
4 |
122 |
if (ix == 1 || ix == 2) { |
|
|
1 |
3 |
if (ix == 1 || ix == 2) { |
|
473
|
0 |
123 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
475
|
0 |
123 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
481
|
125 |
1 |
if (ix == 2 || ix == 3) { |
|
|
0 |
125 |
if (ix == 2 || ix == 3) { |
|
484
|
1 |
124 |
else if (ix == 4) { |
|
490
|
126 |
0 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
|
0 |
126 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
504
|
0 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv)); |
|
522
|
5 |
1 |
if (recid != NULL) { |
|
524
|
0 |
1 |
} else if (ix != 2) { |
|
525
|
0 |
0 |
if (ix == 1) { |
|
534
|
2 |
4 |
if (ix == 1) { |
|
538
|
2 |
2 |
else if (ix == 2) { |
|
549
|
0 |
6 |
if (rv != CRYPT_OK) croak("FATAL: ecc_recover_key failed: %s", error_to_string(rv)); |
|
550
|
0 |
6 |
RETVAL = 1; |
|
558
|
264 |
6 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |