| 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) { |
|
120
|
0 |
56 |
XPUSHs(ST(0)); /* return self */ |
|
134
|
9 |
0 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
135
|
3 |
6 |
if (SvOK(passwd)) { |
|
141
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: pem_decode_openssh failed: %s", error_to_string(rv)); |
|
142
|
0 |
9 |
if (key_from_pem.id != LTC_PKA_EC) { |
|
147
|
0 |
9 |
XPUSHs(ST(0)); /* return self */ |
|
159
|
0 |
1 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
161
|
1 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_x509 failed: %s", error_to_string(rv)); |
|
162
|
0 |
0 |
XPUSHs(ST(0)); /* return self */ |
|
174
|
3 |
184 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
177
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
181
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_key failed: %s", error_to_string(rv)); |
|
182
|
0 |
187 |
XPUSHs(ST(0)); /* return self */ |
|
188
|
0 |
80 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
189
|
57 |
23 |
RETVAL = (self->key.type == PK_PRIVATE) ? 1 : 0; |
|
196
|
0 |
5 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
210
|
0 |
45 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
214
|
45 |
0 |
siz = (self->key.k) ? mp_ubin_size(self->key.k) : 0; |
|
215
|
0 |
45 |
if (siz>10000) { |
|
219
|
32 |
13 |
if (siz>0) { |
|
227
|
45 |
0 |
siz = (self->key.pubkey.x) ? mp_ubin_size(self->key.pubkey.x) : 0; |
|
228
|
0 |
45 |
if (siz>10000) { |
|
232
|
45 |
0 |
if (siz>0) { |
|
240
|
45 |
0 |
siz = (self->key.pubkey.y) ? mp_ubin_size(self->key.pubkey.y) : 0; |
|
241
|
0 |
45 |
if (siz>10000) { |
|
245
|
45 |
0 |
if (siz>0) { |
|
270
|
43 |
2 |
if (self->key.dp.oidlen > 0) { |
|
279
|
210 |
43 |
for(i = 0; i < self->key.dp.oidlen - 1; i++) sv_catpvf(oid, "%lu.", self->key.dp.oid[i]); |
|
285
|
43 |
0 |
if ((h = get_hv("Crypt::PK::ECC::curve_oid2name", 0)) != NULL) { |
|
287
|
43 |
0 |
if (pref) { |
|
314
|
1 |
27 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
315
|
5 |
22 |
if (strEQ(type, "private_short")) { |
|
317
|
1 |
4 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID) failed: %s", error_to_string(rv)); } |
|
320
|
0 |
22 |
else if (strEQ(type, "private_compressed")) { |
|
322
|
0 |
0 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); } |
|
325
|
10 |
12 |
else if (strEQ(type, "private")) { |
|
327
|
0 |
10 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PRIVATE) failed: %s", error_to_string(rv)); } |
|
330
|
0 |
12 |
else if (strEQ(type, "public_compressed")) { |
|
332
|
0 |
0 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); } |
|
335
|
3 |
9 |
else if (strEQ(type, "public_short")) { |
|
337
|
0 |
3 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID) failed: %s", error_to_string(rv)); } |
|
340
|
9 |
0 |
else if (strEQ(type, "public")) { |
|
342
|
0 |
9 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_export_openssl(PK_PUBLIC) failed: %s", error_to_string(rv)); } |
|
361
|
0 |
428 |
if (self->key.type == -1) croak("FATAL: export_key_raw no key"); |
|
362
|
60 |
368 |
if (strEQ(type, "private")) { |
|
364
|
0 |
60 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_get_key(private) failed: %s", error_to_string(rv)); } |
|
367
|
180 |
188 |
else if (strEQ(type, "public_compressed")) { |
|
369
|
0 |
180 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_get_key(public_compressed) failed: %s", error_to_string(rv)); } |
|
372
|
188 |
0 |
else if (strEQ(type, "public")) { |
|
374
|
0 |
188 |
if (rv != CRYPT_OK) { zeromem(out, sizeof(out)); croak("FATAL: ecc_get_key(public) failed: %s", error_to_string(rv)); } |
|
399
|
0 |
3 |
if (hash_id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
403
|
0 |
3 |
if (rv != CRYPT_OK) { zeromem(buffer, sizeof(buffer)); croak("FATAL: ecc_encrypt_key failed: %s", error_to_string(rv)); } |
|
423
|
0 |
2 |
if (rv != CRYPT_OK) { zeromem(buffer, sizeof(buffer)); croak("FATAL: ecc_decrypt_key failed: %s", error_to_string(rv)); } |
|
453
|
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) { |
|
459
|
23 |
9 |
if (ix == 1 || ix == 2) { |
|
|
5 |
18 |
if (ix == 1 || ix == 2) { |
|
461
|
7 |
7 |
if (hash_name == NULL) { |
|
465
|
0 |
14 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
467
|
0 |
14 |
if (rv != CRYPT_OK) { zeromem(tmp, sizeof(tmp)); croak("FATAL: hash_memory failed: %s", error_to_string(rv)); } |
|
472
|
21 |
11 |
if (hash_rfc6979_name != NULL) { |
|
475
|
0 |
21 |
if (hash_rfc6979_id == -1) croak("FATAL: find_hash failed for rfc6979 hash '%s'", hash_rfc6979_name); |
|
479
|
27 |
5 |
if (ix == 2 || ix == 3) { |
|
|
5 |
22 |
if (ix == 2 || ix == 3) { |
|
483
|
6 |
16 |
else if (ix == 4) { |
|
492
|
0 |
32 |
if (rv != CRYPT_OK) { |
|
529
|
15 |
128 |
if (ix == 1 || ix == 2) { |
|
|
3 |
12 |
if (ix == 1 || ix == 2) { |
|
531
|
0 |
131 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
533
|
0 |
131 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
539
|
140 |
3 |
if (ix == 2 || ix == 3) { |
|
|
3 |
137 |
if (ix == 2 || ix == 3) { |
|
543
|
4 |
133 |
else if (ix == 4) { |
|
552
|
143 |
0 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
|
2 |
141 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
566
|
4 |
5 |
if (rv != CRYPT_OK) { zeromem(buffer, sizeof(buffer)); croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv)); } |
|
592
|
5 |
1 |
if (recid != NULL) { |
|
596
|
0 |
1 |
else if (ix != 2) { |
|
597
|
0 |
0 |
if (ix == 1) { |
|
607
|
2 |
4 |
if (ix == 1) { |
|
610
|
2 |
2 |
else if (ix == 2) { |
|
617
|
0 |
6 |
if (rv != CRYPT_OK) croak("FATAL: ecc_recover_key failed: %s", error_to_string(rv)); |
|
618
|
0 |
6 |
RETVAL = 1; |
|
626
|
278 |
7 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
627
|
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) { |