OpenCoverage

b_dump.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/b_dump.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u),-
8 void *u, const char *s, int len)-
9{-
10 return
never executed: return BIO_dump_indent_cb(cb, u, s, len, 0);
BIO_dump_indent_cb(cb, u, s, len, 0);
never executed: return BIO_dump_indent_cb(cb, u, s, len, 0);
0
11}-
12-
13int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),-
14 void *u, const char *s, int len, int indent)-
15{-
16 int ret = 0;-
17 char buf[288 + 1];-
18 int i, j, rows, n;-
19 unsigned char ch;-
20 int dump_width;-
21-
22 if (indent < 0
indent < 0Description
TRUEnever evaluated
FALSEevaluated 4950 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4950
23 indent = 0;
never executed: indent = 0;
0
24 else if (indent > 128
indent > 128Description
TRUEnever evaluated
FALSEevaluated 4950 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4950
25 indent = 128;
never executed: indent = 128;
0
26-
27 dump_width = (16 - ((indent - (indent > 6
indent > 6Description
TRUEevaluated 4404 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 546 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 6 : indent) + 3) / 4));
546-4404
28 rows = len / dump_width;-
29 if ((
(rows * dump_width) < lenDescription
TRUEevaluated 4374 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 576 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
rows * dump_width) < len
(rows * dump_width) < lenDescription
TRUEevaluated 4374 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 576 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
576-4374
30 rows++;
executed 4374 times by 1 test: rows++;
Executed by:
  • libcrypto.so.1.1
4374
31 for (i = 0; i < rows
i < rowsDescription
TRUEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4950 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
4950-8186
32 n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "",-
33 i * dump_width);-
34 for (j = 0; j < dump_width
j < dump_widthDescription
TRUEevaluated 119998 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j++) {
8186-119998
35 if ((
(sizeof(buf) - (n) > (3))Description
TRUEevaluated 119998 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
sizeof(buf) - (n) > (3))
(sizeof(buf) - (n) > (3))Description
TRUEevaluated 119998 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-119998
36 if (((
((i * dump_width) + j) >= lenDescription
TRUEevaluated 44565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i * dump_width) + j) >= len
((i * dump_width) + j) >= lenDescription
TRUEevaluated 44565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
44565-75433
37 strcpy(buf + n, " ");-
38 }
executed 44565 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
44565
39 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;-
40 BIO_snprintf(buf + n, 4, "%02x%c", ch,-
41 j == 7 ? '-' : ' ');-
42 }
executed 75433 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
75433
43 n += 3;-
44 }
executed 119998 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
119998
45 }
executed 119998 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
119998
46 if ((
(sizeof(buf) - (n) > (2))Description
TRUEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
sizeof(buf) - (n) > (2))
(sizeof(buf) - (n) > (2))Description
TRUEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-8186
47 strcpy(buf + n, " ");-
48 n += 2;-
49 }
executed 8186 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8186
50 for (j = 0; j < dump_width
j < dump_widthDescription
TRUEevaluated 79807 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3812 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j++) {
3812-79807
51 if (((
((i * dump_width) + j) >= lenDescription
TRUEevaluated 4374 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i * dump_width) + j) >= len
((i * dump_width) + j) >= lenDescription
TRUEevaluated 4374 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4374-75433
52 break;
executed 4374 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
4374
53 if ((
(sizeof(buf) - (n) > (1))Description
TRUEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
sizeof(buf) - (n) > (1))
(sizeof(buf) - (n) > (1))Description
TRUEevaluated 75433 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-75433
54 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;-
55-
56 buf[n++] = ((
(ch >= ' ')Description
TRUEevaluated 40868 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 34565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ch >= ' ')
(ch >= ' ')Description
TRUEevaluated 40868 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 34565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(ch <= '~')Description
TRUEevaluated 18648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 22220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ch <= '~')
(ch <= '~')Description
TRUEevaluated 18648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 22220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) ? ch : '.';
18648-40868
57-
58-
59-
60-
61-
62 buf[n] = '\0';-
63 }
executed 75433 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
75433
64 }
executed 75433 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
75433
65 if ((
(sizeof(buf) - (n) > (1))Description
TRUEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
sizeof(buf) - (n) > (1))
(sizeof(buf) - (n) > (1))Description
TRUEevaluated 8186 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-8186
66 buf[n++] = '\n';-
67 buf[n] = '\0';-
68 }
executed 8186 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8186
69-
70-
71-
72-
73 ret += cb((void *)buf, n, u);-
74 }
executed 8186 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8186
75 return
executed 4950 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 4950 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4950
76}-
77-
78-
79static int write_fp(const void *data, size_t len, void *fp)-
80{-
81 return
never executed: return fwrite(data, len, 1, fp);
fwrite(data, len, 1, fp);
never executed: return fwrite(data, len, 1, fp);
0
82}-
83-
84int BIO_dump_fp(FILE *fp, const char *s, int len)-
85{-
86 return
never executed: return BIO_dump_cb(write_fp, fp, s, len);
BIO_dump_cb(write_fp, fp, s, len);
never executed: return BIO_dump_cb(write_fp, fp, s, len);
0
87}-
88-
89int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent)-
90{-
91 return
never executed: return BIO_dump_indent_cb(write_fp, fp, s, len, indent);
BIO_dump_indent_cb(write_fp, fp, s, len, indent);
never executed: return BIO_dump_indent_cb(write_fp, fp, s, len, indent);
0
92}-
93-
94-
95static int write_bio(const void *data, size_t len, void *bp)-
96{-
97 return
executed 8186 times by 1 test: return BIO_write((BIO *)bp, (const char *)data, len);
Executed by:
  • libcrypto.so.1.1
BIO_write((BIO *)bp, (const char *)data, len);
executed 8186 times by 1 test: return BIO_write((BIO *)bp, (const char *)data, len);
Executed by:
  • libcrypto.so.1.1
8186
98}-
99-
100int BIO_dump(BIO *bp, const char *s, int len)-
101{-
102 return
never executed: return BIO_dump_cb(write_bio, bp, s, len);
BIO_dump_cb(write_bio, bp, s, len);
never executed: return BIO_dump_cb(write_bio, bp, s, len);
0
103}-
104-
105int BIO_dump_indent(BIO *bp, const char *s, int len, int indent)-
106{-
107 return
executed 4950 times by 1 test: return BIO_dump_indent_cb(write_bio, bp, s, len, indent);
Executed by:
  • libcrypto.so.1.1
BIO_dump_indent_cb(write_bio, bp, s, len, indent);
executed 4950 times by 1 test: return BIO_dump_indent_cb(write_bio, bp, s, len, indent);
Executed by:
  • libcrypto.so.1.1
4950
108}-
109-
110int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,-
111 int datalen)-
112{-
113 int i, j = 0;-
114-
115 if (datalen < 1
datalen < 1Description
TRUEevaluated 1599 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11530 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1599-11530
116 return
executed 1599 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1599 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1599
117-
118 for (i = 0; i < datalen - 1
i < datalen - 1Description
TRUEevaluated 127234 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11530 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
11530-127234
119 if (i
iDescription
TRUEevaluated 123086 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !j
!jDescription
TRUEevaluated 4870 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 118216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4148-123086
120 BIO_printf(out, "%*s", indent, "");
executed 4870 times by 1 test: BIO_printf(out, "%*s", indent, "");
Executed by:
  • libcrypto.so.1.1
4870
121-
122 BIO_printf(out, "%02X:", data[i]);-
123-
124 j = (j + 1) % width;-
125 if (!j
!jDescription
TRUEevaluated 5305 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 121929 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
5305-121929
126 BIO_printf(out, "\n");
executed 5305 times by 1 test: BIO_printf(out, "\n");
Executed by:
  • libcrypto.so.1.1
5305
127 }
executed 127234 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
127234
128-
129 if (i
iDescription
TRUEevaluated 4148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !j
!jDescription
TRUEevaluated 435 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3713 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
435-7382
130 BIO_printf(out, "%*s", indent, "");
executed 435 times by 1 test: BIO_printf(out, "%*s", indent, "");
Executed by:
  • libcrypto.so.1.1
435
131 BIO_printf(out, "%02X", data[datalen - 1]);-
132 return
executed 11530 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 11530 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
11530
133}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2