Branch Coverage

inc/CryptX_PRNG.xs.inc
Criterion Covered Total %
branch 62 88 70.4


line true false branch
26 56 0 if (idx == 1 && idx + 1 <= items) {
51 5 if (idx == 1 && idx + 1 <= items) {
28 50 1 if (!SvPOK_spec(prng_name_sv)) croak("FATAL: invalid PRNG name");
2 48 if (!SvPOK_spec(prng_name_sv)) croak("FATAL: invalid PRNG name");
2 0 if (!SvPOK_spec(prng_name_sv)) croak("FATAL: invalid PRNG name");
1 1 if (!SvPOK_spec(prng_name_sv)) croak("FATAL: invalid PRNG name");
0 1 if (!SvPOK_spec(prng_name_sv)) croak("FATAL: invalid PRNG name");
31 0 5 else if (idx == 0) {
34 32 22 if (idx + 2 <= items) entropy = ST(idx + 1);
37 0 54 if (!RETVAL) croak("FATAL: Newz failed");
40 1 53 if (id == -1) {
48 0 53 if (rv != CRYPT_OK) {
53 32 21 if (SvOK(entropy)) {
56 5 27 if (rv != CRYPT_OK) {
63 0 21 if (rng_get_bytes(entropy_buf, 40, NULL) != 40) {
70 0 21 if (rv != CRYPT_OK) {
77 4 44 if (rv != CRYPT_OK) {
90 44 0 if (self != NULL) {
104 1 1 if (SvOK(entropy)) {
107 0 1 if (rv != CRYPT_OK) croak("FATAL: PRNG_add_entropy failed: %s", error_to_string(rv));
110 0 1 if (rng_get_bytes(entropy_buf, 40, NULL) != 40) croak("FATAL: rng_get_bytes failed");
113 0 1 if (rv != CRYPT_OK) croak("FATAL: PRNG_add_entropy failed: %s", error_to_string(rv));
116 0 2 if (rv != CRYPT_OK) croak("FATAL: PRNG_ready failed: %s", error_to_string(rv));
132 16 132 if (output_len > CRYPTX_PRNG_MAX_OUTPUT_LEN) croak("FATAL: output_len too large");
134 8 124 if (output_len == 0) {
139 18 106 if (ix == 1) {
142 0 18 if (tmp == NULL) croak("FATAL: Newz failed");
144 0 18 if ((UV)rv_len != output_len) {
156 0 18 if (rv != CRYPT_OK) {
161 88 18 else if (ix == 2 || ix == 3) {
18 70 else if (ix == 2 || ix == 3) {
165 0 36 if (tmp == NULL) croak("FATAL: Newz failed");
167 0 36 if ((UV)rv_len != output_len) {
176 18 18 rv = ix == 3 ? base64url_encode(tmp, output_len, rdata, &len) :
180 0 36 if (rv != CRYPT_OK) {
182 0 0 croak(ix == 3 ? "FATAL: base64url_encode failed" : "FATAL: base64_encode failed");
192 0 70 if ((UV)rv_len != output_len) {
212 0 12000 if (i != 4) croak("FATAL: PRNG_read failed");
213 11988 12 RETVAL = ((UV)(rdata[0])<<24) + ((UV)(rdata[1])<<16) + ((UV)(rdata[2])<<8) + ((UV)(rdata[3]));
229 0 24000 if (i != 7) croak("FATAL: PRNG_read failed");
233 18000 6000 if (limit_sv && SvOK(limit_sv)) {
18000 0 if (limit_sv && SvOK(limit_sv)) {
235 12000 6000 if (limit > 0 || limit < 0) RETVAL = RETVAL * limit;
12000 0 if (limit > 0 || limit < 0) RETVAL = RETVAL * limit;