line |
true |
false |
branch |
17
|
0 |
19 |
if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); |
18
|
19 |
0 |
k = (unsigned char *) SvPVbyte(key, k_len); |
19
|
0 |
19 |
if (!SvPOK(nonce)) croak("FATAL: nonce must be string/buffer scalar"); |
20
|
19 |
0 |
n = (unsigned char *) SvPVbyte(nonce, n_len); |
21
|
19 |
0 |
if (SvOK(adata)) { /* adata is optional param */ |
|
19 |
0 |
if (SvOK(adata)) { /* adata is optional param */ |
|
0 |
19 |
if (SvOK(adata)) { /* adata is optional param */ |
22
|
0 |
0 |
if (!SvPOK(adata)) croak("FATAL: adata must be string/buffer scalar"); |
23
|
0 |
0 |
h = (unsigned char *) SvPVbyte(adata, h_len); |
27
|
0 |
19 |
if (id == -1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
30
|
0 |
19 |
if (!RETVAL) croak("FATAL: Newz failed"); |
33
|
0 |
19 |
if (rv != CRYPT_OK) { |
50
|
0 |
0 |
if (!RETVAL) croak("FATAL: Newz failed"); |
63
|
10 |
0 |
in_data = (unsigned char *)SvPVbyte(data, in_data_len); |
64
|
4 |
6 |
if (in_data_len == 0) { |
73
|
0 |
6 |
if (rv != CRYPT_OK) { |
90
|
9 |
20 |
in_data = (unsigned char *)SvPVbyte(data, in_data_len); |
91
|
4 |
25 |
if (in_data_len == 0) { |
100
|
0 |
25 |
if (rv != CRYPT_OK) { |
118
|
0 |
9 |
if (rv != CRYPT_OK) croak("FATAL: eax_done failed: %s", error_to_string(rv)); |
119
|
0 |
9 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
133
|
0 |
10 |
if (rv != CRYPT_OK) croak("FATAL: eax_done failed: %s", error_to_string(rv)); |
134
|
10 |
0 |
if (items == 1) { |
135
|
0 |
10 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
138
|
0 |
0 |
if (!SvPOK(ST(1))) croak("FATAL: expected_tag must be string/buffer scalar"); |
139
|
0 |
0 |
expected_tag = (unsigned char *) SvPVbyte(ST(1), expected_tag_len); |
140
|
0 |
0 |
if (expected_tag_len!=tag_len) { |
141
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(0))); /* false */ |
143
|
0 |
0 |
else if (memNE(expected_tag, tag, tag_len)) { |
144
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(0))); /* false */ |
147
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(1))); /* true */ |
159
|
23 |
0 |
h = (unsigned char *)SvPVbyte(adata, h_len); |
161
|
0 |
23 |
if (rv != CRYPT_OK) croak("FATAL: eax_addheader failed: %s", error_to_string(rv)); |
162
|
0 |
23 |
XPUSHs(ST(0)); /* return self */ |
176
|
10 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
|
10 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
177
|
10 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
|
10 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
178
|
10 |
0 |
if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len); |
|
10 |
0 |
if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len); |
179
|
10 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
|
10 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
182
|
0 |
10 |
if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
183
|
6 |
4 |
output = NEWSV(0, pt_len > 0 ? pt_len : 1); /* avoid zero! */ |
191
|
0 |
10 |
if (rv != CRYPT_OK) { |
195
|
0 |
10 |
XPUSHs(sv_2mortal(output)); |
196
|
0 |
10 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
210
|
12 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
|
12 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
211
|
12 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
|
12 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
212
|
12 |
0 |
if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len); |
|
12 |
0 |
if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len); |
213
|
12 |
0 |
if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len); |
|
12 |
0 |
if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len); |
214
|
12 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
|
12 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
217
|
0 |
12 |
if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
218
|
8 |
4 |
output = NEWSV(0, ct_len > 0 ? ct_len : 1); /* avoid zero! */ |
227
|
12 |
0 |
if (rv != CRYPT_OK || stat != 1) { |
|
2 |
10 |
if (rv != CRYPT_OK || stat != 1) { |
229
|
0 |
2 |
XPUSHs(sv_2mortal(newSVpvn(NULL,0))); /* undef */ |
232
|
0 |
10 |
XPUSHs(sv_2mortal(output)); |