| line |
true |
false |
branch |
|
11
|
0 |
285 |
if (!RETVAL) croak("FATAL: Newz failed"); |
|
15
|
0 |
285 |
if (RETVAL->pindex == -1) { |
|
21
|
0 |
285 |
if (rv != CRYPT_OK) { |
|
38
|
0 |
12 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
41
|
0 |
12 |
if (rv != CRYPT_OK) croak("FATAL: ecc_generate_key failed: %s", error_to_string(rv)); |
|
42
|
0 |
12 |
XPUSHs(ST(0)); /* return self */ |
|
54
|
3 |
41 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
56
|
10 |
34 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_openssl failed: %s", error_to_string(rv)); |
|
57
|
0 |
34 |
XPUSHs(ST(0)); /* return self */ |
|
69
|
0 |
19 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
71
|
11 |
8 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import failed: %s", error_to_string(rv)); |
|
72
|
0 |
8 |
XPUSHs(ST(0)); /* return self */ |
|
85
|
0 |
6 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
86
|
2 |
4 |
if (SvOK(passwd)) { |
|
92
|
1 |
5 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_pkcs8 failed: %s", error_to_string(rv)); |
|
93
|
0 |
5 |
XPUSHs(ST(0)); /* return self */ |
|
107
|
18 |
47 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
108
|
17 |
48 |
if (SvOK(passwd)) { |
|
114
|
9 |
56 |
if (rv != CRYPT_OK) croak("FATAL: pem_decode_pkcs failed: %s", error_to_string(rv)); |
|
115
|
0 |
56 |
if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_pkcs decoded non-ECC key"); |
|
117
|
0 |
56 |
XPUSHs(ST(0)); /* return self */ |
|
131
|
9 |
0 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
132
|
3 |
6 |
if (SvOK(passwd)) { |
|
138
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: pem_decode_openssh failed: %s", error_to_string(rv)); |
|
139
|
0 |
9 |
if (key_from_pem.id != LTC_PKA_EC) croak("FATAL: pem_decode_openssh decoded non-ECC key"); |
|
141
|
0 |
9 |
XPUSHs(ST(0)); /* return self */ |
|
153
|
0 |
1 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
155
|
1 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_x509 failed: %s", error_to_string(rv)); |
|
156
|
0 |
0 |
XPUSHs(ST(0)); /* return self */ |
|
168
|
3 |
184 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
171
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
175
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_key failed: %s", error_to_string(rv)); |
|
176
|
0 |
187 |
XPUSHs(ST(0)); /* return self */ |
|
182
|
0 |
80 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
183
|
57 |
23 |
RETVAL = (self->key.type == PK_PRIVATE) ? 1 : 0; |
|
190
|
0 |
5 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
204
|
0 |
45 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
208
|
45 |
0 |
siz = (self->key.k) ? mp_ubin_size(self->key.k) : 0; |
|
209
|
0 |
45 |
if (siz>10000) { |
|
212
|
32 |
13 |
if (siz>0) { |
|
220
|
45 |
0 |
siz = (self->key.pubkey.x) ? mp_ubin_size(self->key.pubkey.x) : 0; |
|
221
|
0 |
45 |
if (siz>10000) { |
|
224
|
45 |
0 |
if (siz>0) { |
|
232
|
45 |
0 |
siz = (self->key.pubkey.y) ? mp_ubin_size(self->key.pubkey.y) : 0; |
|
233
|
0 |
45 |
if (siz>10000) { |
|
236
|
45 |
0 |
if (siz>0) { |
|
261
|
43 |
2 |
if (self->key.dp.oidlen > 0) { |
|
270
|
210 |
43 |
for(i = 0; i < self->key.dp.oidlen - 1; i++) sv_catpvf(oid, "%lu.", self->key.dp.oid[i]); |
|
276
|
43 |
0 |
if ((h = get_hv("Crypt::PK::ECC::curve_oid2name", 0)) != NULL) { |
|
278
|
43 |
0 |
if (pref) { |
|
304
|
1 |
27 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
305
|
5 |
22 |
if (strEQ(type, "private_short")) { |
|
307
|
1 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
310
|
0 |
22 |
else if (strEQ(type, "private_compressed")) { |
|
312
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
315
|
10 |
12 |
else if (strEQ(type, "private")) { |
|
317
|
0 |
10 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE) failed: %s", error_to_string(rv)); |
|
320
|
0 |
12 |
else if (strEQ(type, "public_compressed")) { |
|
322
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
325
|
3 |
9 |
else if (strEQ(type, "public_short")) { |
|
327
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
330
|
9 |
0 |
else if (strEQ(type, "public")) { |
|
332
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC) failed: %s", error_to_string(rv)); |
|
351
|
0 |
428 |
if (self->key.type == -1) croak("FATAL: export_key_raw no key"); |
|
352
|
60 |
368 |
if (strEQ(type, "private")) { |
|
354
|
0 |
60 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(private) failed: %s", error_to_string(rv)); |
|
357
|
180 |
188 |
else if (strEQ(type, "public_compressed")) { |
|
359
|
0 |
180 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public_compressed) failed: %s", error_to_string(rv)); |
|
362
|
188 |
0 |
else if (strEQ(type, "public")) { |
|
364
|
0 |
188 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public) failed: %s", error_to_string(rv)); |
|
389
|
0 |
3 |
if (hash_id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
393
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_encrypt_key failed: %s", error_to_string(rv)); |
|
413
|
0 |
2 |
if (rv != CRYPT_OK) croak("FATAL: ecc_decrypt_key failed: %s", error_to_string(rv)); |
|
443
|
25 |
7 |
if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) { |
|
|
20 |
5 |
if ((ix == 0 || ix == 3 || ix == 4) && hash_name != NULL && hash_rfc6979_name == NULL) { |
|
|
6 |
14 |
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) { |
|
449
|
23 |
9 |
if (ix == 1 || ix == 2) { |
|
|
5 |
18 |
if (ix == 1 || ix == 2) { |
|
451
|
7 |
7 |
if (hash_name == NULL) { |
|
455
|
0 |
14 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
457
|
0 |
14 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
462
|
21 |
11 |
if (hash_rfc6979_name != NULL) { |
|
465
|
0 |
21 |
if (hash_rfc6979_id == -1) croak("FATAL: find_hash failed for rfc6979 hash '%s'", hash_rfc6979_name); |
|
469
|
27 |
5 |
if (ix == 2 || ix == 3) { |
|
|
5 |
22 |
if (ix == 2 || ix == 3) { |
|
473
|
6 |
16 |
else if (ix == 4) { |
|
482
|
0 |
32 |
if (rv != CRYPT_OK) croak("FATAL: ecc_sign_hash_v2 failed: %s", error_to_string(rv)); |
|
515
|
15 |
128 |
if (ix == 1 || ix == 2) { |
|
|
3 |
12 |
if (ix == 1 || ix == 2) { |
|
517
|
0 |
131 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
519
|
0 |
131 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
525
|
140 |
3 |
if (ix == 2 || ix == 3) { |
|
|
3 |
137 |
if (ix == 2 || ix == 3) { |
|
529
|
4 |
133 |
else if (ix == 4) { |
|
538
|
143 |
0 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
|
2 |
141 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
552
|
4 |
5 |
if (rv != CRYPT_OK) croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv)); |
|
578
|
5 |
1 |
if (recid != NULL) { |
|
582
|
0 |
1 |
else if (ix != 2) { |
|
583
|
0 |
0 |
if (ix == 1) { |
|
593
|
2 |
4 |
if (ix == 1) { |
|
596
|
2 |
2 |
else if (ix == 2) { |
|
603
|
0 |
6 |
if (rv != CRYPT_OK) croak("FATAL: ecc_recover_key failed: %s", error_to_string(rv)); |
|
604
|
0 |
6 |
RETVAL = 1; |
|
612
|
278 |
7 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
613
|
285 |
0 |
if (self->pindex >= 0 && prng_is_valid(self->pindex) == CRYPT_OK && prng_descriptor[self->pindex].done) { |
|
|
285 |
0 |
if (self->pindex >= 0 && prng_is_valid(self->pindex) == CRYPT_OK && prng_descriptor[self->pindex].done) { |
|
|
285 |
0 |
if (self->pindex >= 0 && prng_is_valid(self->pindex) == CRYPT_OK && prng_descriptor[self->pindex].done) { |