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