Branch Coverage

inc/CryptX_AuthEnc_GCM.xs.inc
Criterion Covered Total %
branch 54 132 40.9


line true false branch
13 0 15 if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar");
14 15 0 k = (unsigned char *) SvPVbyte(key, k_len);
15 0 15 if (nonce) {
16 0 0 if (!SvPOK(nonce)) croak("FATAL: nonce must be string/buffer scalar");
17 0 0 iv = (unsigned char *)SvPVbyte(nonce, iv_len);
21 0 15 if (id == -1) croak("FATAL: find_cipfer failed for '%s'", cipher_name);
24 0 15 if (!RETVAL) croak("FATAL: Newz failed");
27 0 15 if (rv != CRYPT_OK) {
32 0 15 if (iv && iv_len > 0) {
0 0 if (iv && iv_len > 0) {
34 0 0 if (rv != CRYPT_OK) {
52 0 0 if (!RETVAL) croak("FATAL: Newz failed");
63 0 0 if (rv != CRYPT_OK) croak("FATAL: gcm_reset failed: %s", error_to_string(rv));
64 0 0 XPUSHs(ST(0)); /* return self */
75 8 0 in_data = (unsigned char *)SvPVbyte(data, in_data_len);
76 0 8 if (in_data_len == 0) {
86 0 8 if (rv != CRYPT_OK) {
103 15 0 in_data = (unsigned char *)SvPVbyte(data, in_data_len);
105 0 15 if (rv != CRYPT_OK) croak("FATAL: gcm_add_iv failed: %s", error_to_string(rv));
106 0 15 XPUSHs(ST(0)); /* return self */
117 15 0 in_data = (unsigned char *)SvPVbyte(data, in_data_len);
119 0 15 if (rv != CRYPT_OK) croak("FATAL: gcm_add_aad failed: %s", error_to_string(rv));
120 0 15 XPUSHs(ST(0)); /* return self */
131 7 20 in_data = (unsigned char *)SvPVbyte(data, in_data_len);
132 0 27 if (in_data_len == 0) {
141 0 27 if (rv != CRYPT_OK) {
160 0 7 if (rv != CRYPT_OK) croak("FATAL: gcm_done failed: %s", error_to_string(rv));
161 0 7 XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len)));
175 0 8 if (rv != CRYPT_OK) croak("FATAL: gcm_done failed: %s", error_to_string(rv));
176 8 0 if (items == 1) {
177 0 8 XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len)));
180 0 0 if (!SvPOK(ST(1))) croak("FATAL: expected_tag must be string/buffer scalar");
181 0 0 expected_tag = (unsigned char *) SvPVbyte(ST(1), expected_tag_len);
182 0 0 if (expected_tag_len!=tag_len) {
183 0 0 XPUSHs(sv_2mortal(newSViv(0))); /* false */
185 0 0 else if (memNE(expected_tag, tag, tag_len)) {
186 0 0 XPUSHs(sv_2mortal(newSViv(0))); /* false */
189 0 0 XPUSHs(sv_2mortal(newSViv(1))); /* true */
205 8 0 if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len);
8 0 if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len);
206 8 0 if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len);
8 0 if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len);
207 8 0 if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len);
8 0 if (SvPOK(plaintext)) pt = (unsigned char *) SvPVbyte(plaintext, pt_len);
208 8 0 if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len);
8 0 if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len);
211 0 8 if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name);
212 8 0 output = NEWSV(0, pt_len > 0 ? pt_len : 1); /* avoid zero! */
219 0 8 if (rv != CRYPT_OK) {
223 0 8 XPUSHs(sv_2mortal(output));
224 0 8 XPUSHs(sv_2mortal(newSVpvn((char*)tag, tag_len)));
238 10 0 if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len);
10 0 if (SvPOK(key)) k = (unsigned char *) SvPVbyte(key, k_len);
239 10 0 if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len);
10 0 if (SvPOK(nonce)) n = (unsigned char *) SvPVbyte(nonce, n_len);
240 10 0 if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len);
10 0 if (SvPOK(ciphertext)) ct = (unsigned char *) SvPVbyte(ciphertext, ct_len);
241 10 0 if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len);
10 0 if (SvPOK(tagsv)) t = (unsigned char *) SvPVbyte(tagsv, t_len);
242 10 0 if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len);
10 0 if (SvPOK(header)) h = (unsigned char *) SvPVbyte(header, h_len);
245 0 10 if(id==-1) croak("FATAL: find_cipfer failed for '%s'", cipher_name);
246 10 0 output = NEWSV(0, ct_len > 0 ? ct_len : 1); /* avoid zero! */
255 2 8 if (rv != CRYPT_OK) {
257 0 2 XPUSHs(sv_2mortal(newSVpvn(NULL,0))); /* undef */
260 0 8 XPUSHs(sv_2mortal(output));