| line |
true |
false |
branch |
|
11
|
0 |
274 |
if (!RETVAL) croak("FATAL: Newz failed"); |
|
15
|
0 |
274 |
if (RETVAL->pindex == -1) { |
|
20
|
0 |
274 |
if (rv != CRYPT_OK) { |
|
36
|
0 |
11 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
39
|
0 |
11 |
if (rv != CRYPT_OK) croak("FATAL: ecc_generate_key failed: %s", error_to_string(rv)); |
|
40
|
0 |
11 |
XPUSHs(ST(0)); /* return self */ |
|
52
|
3 |
38 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
54
|
9 |
32 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_openssl failed: %s", error_to_string(rv)); |
|
55
|
0 |
32 |
XPUSHs(ST(0)); /* return self */ |
|
67
|
0 |
18 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
69
|
10 |
8 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import failed: %s", error_to_string(rv)); |
|
70
|
0 |
8 |
XPUSHs(ST(0)); /* return self */ |
|
83
|
0 |
5 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
84
|
2 |
3 |
if (SvOK(passwd)) { |
|
90
|
0 |
5 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_pkcs8 failed: %s", error_to_string(rv)); |
|
91
|
0 |
5 |
XPUSHs(ST(0)); /* return self */ |
|
105
|
18 |
43 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
106
|
17 |
44 |
if (SvOK(passwd)) { |
|
112
|
9 |
52 |
if (rv != CRYPT_OK) croak("FATAL: pem_decode_pkcs failed: %s", error_to_string(rv)); |
|
113
|
0 |
52 |
if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_pkcs decoded non-ECC key"); |
|
115
|
0 |
52 |
XPUSHs(ST(0)); /* return self */ |
|
129
|
9 |
0 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
130
|
3 |
6 |
if (SvOK(passwd)) { |
|
136
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: pem_decode_openssh failed: %s", error_to_string(rv)); |
|
137
|
0 |
9 |
if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_openssh decoded non-ECC key"); |
|
139
|
0 |
9 |
XPUSHs(ST(0)); /* return self */ |
|
151
|
0 |
0 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
153
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_x509 failed: %s", error_to_string(rv)); |
|
154
|
0 |
0 |
XPUSHs(ST(0)); /* return self */ |
|
166
|
3 |
181 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
169
|
0 |
184 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
173
|
0 |
184 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_key failed: %s", error_to_string(rv)); |
|
174
|
0 |
184 |
XPUSHs(ST(0)); /* return self */ |
|
180
|
0 |
79 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
181
|
57 |
22 |
RETVAL = (self->key.type == PK_PRIVATE) ? 1 : 0; |
|
188
|
0 |
5 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
202
|
0 |
45 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
206
|
45 |
0 |
siz = (self->key.k) ? mp_ubin_size(self->key.k) : 0; |
|
207
|
0 |
45 |
if (siz>10000) { |
|
210
|
32 |
13 |
if (siz>0) { |
|
218
|
45 |
0 |
siz = (self->key.pubkey.x) ? mp_ubin_size(self->key.pubkey.x) : 0; |
|
219
|
0 |
45 |
if (siz>10000) { |
|
222
|
45 |
0 |
if (siz>0) { |
|
230
|
45 |
0 |
siz = (self->key.pubkey.y) ? mp_ubin_size(self->key.pubkey.y) : 0; |
|
231
|
0 |
45 |
if (siz>10000) { |
|
234
|
45 |
0 |
if (siz>0) { |
|
259
|
43 |
2 |
if (self->key.dp.oidlen > 0) { |
|
268
|
210 |
43 |
for(i = 0; i < self->key.dp.oidlen - 1; i++) sv_catpvf(oid, "%lu.", self->key.dp.oid[i]); |
|
274
|
43 |
0 |
if ((h = get_hv("Crypt::PK::ECC::curve_oid2name", 0)) != NULL) { |
|
276
|
43 |
0 |
if (pref) { |
|
302
|
1 |
26 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
303
|
5 |
21 |
if (strnEQ(type, "private_short", 16)) { |
|
305
|
1 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
308
|
0 |
21 |
else if (strnEQ(type, "private_compressed", 16)) { |
|
310
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
313
|
10 |
11 |
else if (strnEQ(type, "private", 7)) { |
|
315
|
0 |
10 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE) failed: %s", error_to_string(rv)); |
|
318
|
0 |
11 |
else if (strnEQ(type, "public_compressed", 15)) { |
|
320
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
323
|
3 |
8 |
else if (strnEQ(type, "public_short", 15)) { |
|
325
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
328
|
8 |
0 |
else if (strnEQ(type, "public", 6)) { |
|
330
|
0 |
8 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC) failed: %s", error_to_string(rv)); |
|
348
|
0 |
428 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
349
|
60 |
368 |
if (strnEQ(type, "private", 7)) { |
|
351
|
0 |
60 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(private) failed: %s", error_to_string(rv)); |
|
354
|
180 |
188 |
else if (strnEQ(type, "public_compressed", 17)) { |
|
356
|
0 |
180 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public_compressed) failed: %s", error_to_string(rv)); |
|
359
|
188 |
0 |
else if (strnEQ(type, "public", 6)) { |
|
361
|
0 |
188 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public) failed: %s", error_to_string(rv)); |
|
385
|
0 |
3 |
if (hash_id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
389
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_encrypt_key failed: %s", error_to_string(rv)); |
|
408
|
0 |
2 |
if (rv != CRYPT_OK) croak("FATAL: ecc_decrypt_key_ex failed: %s", error_to_string(rv)); |
|
430
|
23 |
7 |
if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) { |
|
|
18 |
5 |
if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) { |
|
|
6 |
12 |
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) { |
|
436
|
23 |
7 |
if (ix == 1 || ix == 2) { |
|
|
5 |
18 |
if (ix == 1 || ix == 2) { |
|
438
|
7 |
5 |
if (hash_name == NULL) { |
|
442
|
0 |
12 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
444
|
0 |
12 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
449
|
21 |
9 |
if (hash_rfc6979_name != NULL) { |
|
452
|
0 |
21 |
if (hash_rfc6979_id == -1) croak("FATAL: find_hash failed for rfc6979 hash '%s'", hash_rfc6979_name); |
|
456
|
25 |
5 |
if (ix == 2 || ix == 3) { |
|
|
5 |
20 |
if (ix == 2 || ix == 3) { |
|
460
|
6 |
14 |
else if (ix == 4) { |
|
469
|
0 |
30 |
if (rv != CRYPT_OK) croak("FATAL: ecc_sign_hash_v2 failed: %s", error_to_string(rv)); |
|
493
|
15 |
124 |
if (ix == 1 || ix == 2) { |
|
|
3 |
12 |
if (ix == 1 || ix == 2) { |
|
495
|
0 |
127 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
497
|
0 |
127 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
503
|
136 |
3 |
if (ix == 2 || ix == 3) { |
|
|
3 |
133 |
if (ix == 2 || ix == 3) { |
|
507
|
4 |
129 |
else if (ix == 4) { |
|
516
|
139 |
0 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
|
0 |
139 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
530
|
0 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv)); |
|
548
|
5 |
1 |
if (recid != NULL) { |
|
551
|
0 |
1 |
else if (ix != 2) { |
|
552
|
0 |
0 |
if (ix == 1) { |
|
562
|
2 |
4 |
if (ix == 1) { |
|
565
|
2 |
2 |
else if (ix == 2) { |
|
572
|
0 |
6 |
if (rv != CRYPT_OK) croak("FATAL: ecc_recover_key failed: %s", error_to_string(rv)); |
|
573
|
0 |
6 |
RETVAL = 1; |
|
581
|
268 |
6 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |