| line |
true |
false |
branch |
|
11
|
0 |
253 |
if (!RETVAL) croak("FATAL: Newz failed"); |
|
14
|
0 |
253 |
if (RETVAL->pindex == -1) { |
|
19
|
0 |
253 |
if (rv != CRYPT_OK) { |
|
34
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
37
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_generate_key failed: %s", error_to_string(rv)); |
|
38
|
0 |
3 |
XPUSHs(ST(0)); /* return self */ |
|
49
|
76 |
0 |
data = (unsigned char *)SvPVbyte(key_data, data_len); |
|
50
|
8 |
68 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
52
|
13 |
63 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_openssl failed: %s", error_to_string(rv)); |
|
53
|
0 |
63 |
XPUSHs(ST(0)); /* return self */ |
|
64
|
13 |
0 |
data = (unsigned char *)SvPVbyte(key_data, data_len); |
|
65
|
0 |
13 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
67
|
5 |
8 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import failed: %s", error_to_string(rv)); |
|
68
|
0 |
8 |
XPUSHs(ST(0)); /* return self */ |
|
79
|
9 |
0 |
data = (unsigned char *)SvPVbyte(key_data, data_len); |
|
80
|
5 |
4 |
if (SvOK(passwd)) { |
|
|
5 |
0 |
if (SvOK(passwd)) { |
|
|
0 |
5 |
if (SvOK(passwd)) { |
|
81
|
4 |
0 |
pwd = (unsigned char *)SvPVbyte(passwd, pwd_len); |
|
83
|
4 |
5 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
85
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_pkcs8 failed: %s", error_to_string(rv)); |
|
86
|
0 |
9 |
XPUSHs(ST(0)); /* return self */ |
|
97
|
0 |
0 |
data = (unsigned char *)SvPVbyte(key_data, data_len); |
|
98
|
0 |
0 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
100
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_import_x509 failed: %s", error_to_string(rv)); |
|
101
|
0 |
0 |
XPUSHs(ST(0)); /* return self */ |
|
112
|
187 |
0 |
data = (unsigned char *)SvPVbyte(key_data, data_len); |
|
113
|
6 |
181 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |
|
116
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_curve failed: %s", error_to_string(rv)); |
|
120
|
0 |
187 |
if (rv != CRYPT_OK) croak("FATAL: ecc_set_key failed: %s", error_to_string(rv)); |
|
121
|
0 |
187 |
XPUSHs(ST(0)); /* return self */ |
|
127
|
0 |
64 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
135
|
0 |
5 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
148
|
0 |
29 |
if (self->key.type == -1) XSRETURN_UNDEF; |
|
152
|
29 |
0 |
siz = (self->key.k) ? mp_unsigned_bin_size(self->key.k) : 0; |
|
153
|
0 |
29 |
if (siz>10000) { |
|
156
|
16 |
13 |
if (siz>0) { |
|
164
|
29 |
0 |
siz = (self->key.pubkey.x) ? mp_unsigned_bin_size(self->key.pubkey.x) : 0; |
|
165
|
0 |
29 |
if (siz>10000) { |
|
168
|
29 |
0 |
if (siz>0) { |
|
176
|
29 |
0 |
siz = (self->key.pubkey.y) ? mp_unsigned_bin_size(self->key.pubkey.y) : 0; |
|
177
|
0 |
29 |
if (siz>10000) { |
|
180
|
29 |
0 |
if (siz>0) { |
|
205
|
27 |
2 |
if (self->key.dp.oidlen > 0) { |
|
214
|
136 |
27 |
for(i = 0; i < self->key.dp.oidlen - 1; i++) sv_catpvf(oid, "%lu.", self->key.dp.oid[i]); |
|
220
|
27 |
0 |
if ((h = get_hv("Crypt::PK::ECC::curve_oid2name", 0)) != NULL) { |
|
222
|
27 |
0 |
if (pref) { |
|
223
|
27 |
0 |
cname_ptr = SvPV(*pref, cname_len); |
|
248
|
1 |
26 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
249
|
5 |
21 |
if (strnEQ(type, "private_short", 16)) { |
|
251
|
1 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
254
|
0 |
21 |
else if (strnEQ(type, "private_compressed", 16)) { |
|
256
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
259
|
10 |
11 |
else if (strnEQ(type, "private", 7)) { |
|
261
|
0 |
10 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PRIVATE) failed: %s", error_to_string(rv)); |
|
264
|
0 |
11 |
else if (strnEQ(type, "public_compressed", 15)) { |
|
266
|
0 |
0 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED) failed: %s", error_to_string(rv)); |
|
269
|
3 |
8 |
else if (strnEQ(type, "public_short", 15)) { |
|
271
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC|PK_CURVEOID) failed: %s", error_to_string(rv)); |
|
274
|
8 |
0 |
else if (strnEQ(type, "public", 6)) { |
|
276
|
0 |
8 |
if (rv != CRYPT_OK) croak("FATAL: ecc_export_openssl(PK_PUBLIC) failed: %s", error_to_string(rv)); |
|
294
|
0 |
420 |
if (self->key.type == -1) croak("FATAL: export_key_der no key"); |
|
295
|
60 |
360 |
if (strnEQ(type, "private", 7)) { |
|
297
|
0 |
60 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(private) failed: %s", error_to_string(rv)); |
|
300
|
180 |
180 |
else if (strnEQ(type, "public_compressed", 17)) { |
|
302
|
0 |
180 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public_compressed) failed: %s", error_to_string(rv)); |
|
305
|
180 |
0 |
else if (strnEQ(type, "public", 6)) { |
|
307
|
0 |
180 |
if (rv != CRYPT_OK) croak("FATAL: ecc_get_key(public) failed: %s", error_to_string(rv)); |
|
327
|
2 |
0 |
data_ptr = (unsigned char *)SvPVbyte(data, data_len); |
|
330
|
0 |
2 |
if (hash_id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
334
|
0 |
2 |
if (rv != CRYPT_OK) croak("FATAL: ecc_encrypt_key failed: %s", error_to_string(rv)); |
|
350
|
2 |
0 |
data_ptr = (unsigned char *)SvPVbyte(data, data_len); |
|
353
|
0 |
2 |
if (rv != CRYPT_OK) croak("FATAL: ecc_decrypt_key_ex failed: %s", error_to_string(rv)); |
|
372
|
5 |
0 |
data_ptr = (unsigned char *)SvPVbyte(data, data_len); |
|
373
|
3 |
2 |
if (ix == 1 || ix == 2) { |
|
|
1 |
2 |
if (ix == 1 || ix == 2) { |
|
375
|
0 |
3 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
377
|
0 |
3 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
381
|
4 |
1 |
if (ix == 2 || ix == 3) { |
|
|
0 |
4 |
if (ix == 2 || ix == 3) { |
|
391
|
0 |
5 |
if (rv != CRYPT_OK) croak("FATAL: ecc_sign_hash_ex failed: %s", error_to_string(rv)); |
|
410
|
125 |
0 |
data_ptr = (unsigned char *)SvPVbyte(data, data_len); |
|
411
|
125 |
0 |
sig_ptr = (unsigned char *)SvPVbyte(sig, sig_len); |
|
412
|
3 |
122 |
if (ix == 1 || ix == 2) { |
|
|
1 |
2 |
if (ix == 1 || ix == 2) { |
|
414
|
0 |
123 |
if (id == -1) croak("FATAL: find_hash failed for '%s'", hash_name); |
|
416
|
0 |
123 |
if (rv != CRYPT_OK) croak("FATAL: hash_memory failed: %s", error_to_string(rv)); |
|
422
|
124 |
1 |
if (ix == 2 || ix == 3) { |
|
|
0 |
124 |
if (ix == 2 || ix == 3) { |
|
428
|
125 |
0 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
|
0 |
125 |
if (rv != CRYPT_OK || stat != 1) RETVAL = 0; |
|
442
|
0 |
4 |
if (rv != CRYPT_OK) croak("FATAL: ecc_shared_secret failed: %s", error_to_string(rv)); |
|
451
|
252 |
1 |
if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; } |