line |
true |
false |
branch |
17
|
3 |
0 |
if (tag_len < 1 || tag_len > MAXBLOCKSIZE) croak("FATAL: invalid tag_len %d", tag_len); |
|
0 |
3 |
if (tag_len < 1 || tag_len > MAXBLOCKSIZE) croak("FATAL: invalid tag_len %d", tag_len); |
18
|
0 |
3 |
if (pt_len < 0) croak("FATAL: invalid pt_len"); |
19
|
0 |
3 |
if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); |
20
|
3 |
0 |
k = (unsigned char *) SvPVbyte(key, k_len); |
21
|
0 |
3 |
if (!SvPOK(nonce)) croak("FATAL: nonce must be string/buffer scalar"); |
22
|
3 |
0 |
n = (unsigned char *) SvPVbyte(nonce, n_len); |
23
|
0 |
3 |
if (!SvPOK(adata)) croak("FATAL: adata must be string/buffer scalar"); |
24
|
3 |
0 |
h = (unsigned char *) SvPVbyte(adata, h_len); |
27
|
0 |
3 |
if (id == -1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
30
|
0 |
3 |
if (!RETVAL) croak("FATAL: Newz failed"); |
33
|
0 |
3 |
if (rv != CRYPT_OK) { |
38
|
0 |
3 |
if (rv != CRYPT_OK) { |
43
|
0 |
3 |
if (rv != CRYPT_OK) { |
60
|
0 |
0 |
if (!RETVAL) croak("FATAL: Newz failed"); |
73
|
2 |
0 |
in_data = (unsigned char *)SvPVbyte(data, in_data_len); |
74
|
0 |
2 |
if (in_data_len == 0) { |
83
|
0 |
2 |
if (rv != CRYPT_OK) { |
100
|
1 |
20 |
in_data = (unsigned char *)SvPVbyte(data, in_data_len); |
101
|
0 |
21 |
if (in_data_len == 0) { |
110
|
0 |
21 |
if (rv != CRYPT_OK) { |
128
|
0 |
1 |
if (rv != CRYPT_OK) croak("FATAL: ccm_done failed: %s", error_to_string(rv)); |
129
|
0 |
1 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
143
|
0 |
2 |
if (rv != CRYPT_OK) croak("FATAL: ccm_done failed: %s", error_to_string(rv)); |
144
|
2 |
0 |
if (items == 1) { |
145
|
0 |
2 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
148
|
0 |
0 |
if (!SvPOK(ST(1))) croak("FATAL: expected_tag must be string/buffer scalar"); |
149
|
0 |
0 |
expected_tag = (unsigned char *) SvPVbyte(ST(1), expected_tag_len); |
150
|
0 |
0 |
if (expected_tag_len!=tag_len) { |
151
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(0))); /* false */ |
153
|
0 |
0 |
else if (memNE(expected_tag, tag, tag_len)) { |
154
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(0))); /* false */ |
157
|
0 |
0 |
XPUSHs(sv_2mortal(newSViv(1))); /* true */ |
172
|
7 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
|
7 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
173
|
7 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
|
7 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
174
|
7 |
0 |
if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len); |
|
7 |
0 |
if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len); |
175
|
6 |
1 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
|
6 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
178
|
0 |
7 |
if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
179
|
7 |
0 |
output = NEWSV(0, pt_len > 0 ? pt_len : 1); /* avoid zero! */ |
182
|
7 |
0 |
if(tag_len < 4 || tag_len > 16) tag_len = 16; |
|
0 |
7 |
if(tag_len < 4 || tag_len > 16) tag_len = 16; |
187
|
0 |
7 |
if (rv != CRYPT_OK) { |
191
|
0 |
7 |
XPUSHs(sv_2mortal(output)); |
192
|
0 |
7 |
XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len))); |
206
|
12 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
|
12 |
0 |
if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len); |
207
|
12 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
|
12 |
0 |
if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len); |
208
|
12 |
0 |
if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len); |
|
12 |
0 |
if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len); |
209
|
12 |
0 |
if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len); |
|
12 |
0 |
if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len); |
210
|
12 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
|
12 |
0 |
if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len); |
213
|
0 |
12 |
if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name); |
214
|
12 |
0 |
output = NEWSV(0, ct_len > 0 ? ct_len : 1); /* avoid zero! */ |
223
|
6 |
6 |
if (rv != CRYPT_OK) { |
225
|
0 |
6 |
XPUSHs(sv_2mortal(newSVpvn(NULL,0))); /* undef */ |
228
|
0 |
6 |
XPUSHs(sv_2mortal(output)); |