Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/cryptlib.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | extern unsigned int OPENSSL_ia32cap_P[4]; | - | ||||||||||||
8 | typedef char variant_char; | - | ||||||||||||
9 | - | |||||||||||||
10 | - | |||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | static int todigit(variant_char c) | - | ||||||||||||
14 | { | - | ||||||||||||
15 | if ((
| 367-5505 | ||||||||||||
16 | return executed 5505 times by 1 test: c - '0';return c - '0'; Executed by:
executed 5505 times by 1 test: return c - '0'; Executed by:
| 5505 | ||||||||||||
17 | else if ((
| 0-367 | ||||||||||||
18 | return never executed: ossl_tolower(c) - 'a' + 10;return ossl_tolower(c) - 'a' + 10; never executed: return ossl_tolower(c) - 'a' + 10; | 0 | ||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | return executed 367 times by 1 test: 16;return 16; Executed by:
executed 367 times by 1 test: return 16; Executed by:
| 367 | ||||||||||||
22 | } | - | ||||||||||||
23 | - | |||||||||||||
24 | static uint64_t ossl_strtouint64(const variant_char *str) | - | ||||||||||||
25 | { | - | ||||||||||||
26 | uint64_t ret = 0; | - | ||||||||||||
27 | unsigned int digit, base = 10; | - | ||||||||||||
28 | - | |||||||||||||
29 | if (*
| 0-367 | ||||||||||||
30 | base = 8, str++; | - | ||||||||||||
31 | if (ossl_tolower(*str) == 'x'
| 0-367 | ||||||||||||
32 | base = 16, str++; executed 367 times by 1 test: base = 16, str++; Executed by:
| 367 | ||||||||||||
33 | } executed 367 times by 1 test: end of block Executed by:
| 367 | ||||||||||||
34 | - | |||||||||||||
35 | while((
| 367-5505 | ||||||||||||
36 | ret = ret * base + digit; executed 5505 times by 1 test: ret = ret * base + digit; Executed by:
| 5505 | ||||||||||||
37 | - | |||||||||||||
38 | return executed 367 times by 1 test: ret;return ret; Executed by:
executed 367 times by 1 test: return ret; Executed by:
| 367 | ||||||||||||
39 | } | - | ||||||||||||
40 | - | |||||||||||||
41 | static variant_char *ossl_strchr(const variant_char *str, char srch) | - | ||||||||||||
42 | { variant_char c; | - | ||||||||||||
43 | - | |||||||||||||
44 | while((
| 367-6606 | ||||||||||||
45 | if (c == srch
| 0-6606 | ||||||||||||
46 | return never executed: (variant_char *)str;return (variant_char *)str; never executed: return (variant_char *)str; | 0 | ||||||||||||
47 | str++; | - | ||||||||||||
48 | } executed 6606 times by 1 test: end of block Executed by:
| 6606 | ||||||||||||
49 | - | |||||||||||||
50 | return executed 367 times by 1 test: return ((void *)0) ; Executed by:
executed 367 times by 1 test: return ((void *)0) ; Executed by:
| 367 | ||||||||||||
51 | ((void *)0) executed 367 times by 1 test: return ((void *)0) ; Executed by:
| 367 | ||||||||||||
52 | ; executed 367 times by 1 test: return ((void *)0) ; Executed by:
| 367 | ||||||||||||
53 | } | - | ||||||||||||
54 | - | |||||||||||||
55 | - | |||||||||||||
56 | typedef uint64_t IA32CAP; | - | ||||||||||||
57 | - | |||||||||||||
58 | void OPENSSL_cpuid_setup(void) | - | ||||||||||||
59 | { | - | ||||||||||||
60 | static int trigger = 0; | - | ||||||||||||
61 | IA32CAP OPENSSL_ia32_cpuid(unsigned int *); | - | ||||||||||||
62 | IA32CAP vec; | - | ||||||||||||
63 | const variant_char *env; | - | ||||||||||||
64 | - | |||||||||||||
65 | if (trigger
| 2079-4035 | ||||||||||||
66 | return; executed 4035 times by 12 tests: return; Executed by:
| 4035 | ||||||||||||
67 | - | |||||||||||||
68 | trigger = 1; | - | ||||||||||||
69 | if ((
| 367-1712 | ||||||||||||
70 | ((void *)0)
| 367-1712 | ||||||||||||
71 | ) { | - | ||||||||||||
72 | int off = (
| 0-367 | ||||||||||||
73 | - | |||||||||||||
74 | vec = ossl_strtouint64(env + off); | - | ||||||||||||
75 | - | |||||||||||||
76 | if (off
| 0-367 | ||||||||||||
77 | IA32CAP mask = vec; | - | ||||||||||||
78 | vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~mask; | - | ||||||||||||
79 | if (mask & (1<<24)
| 0-367 | ||||||||||||
80 | vec &= ~((IA32CAP)(1<<1|1<<11|1<<25|1<<28) << 32); | - | ||||||||||||
81 | } never executed: end of block | 0 | ||||||||||||
82 | } executed 367 times by 1 test: else if (env[0] == ':'end of block Executed by:
| 0-367 | ||||||||||||
83 | vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P); | - | ||||||||||||
84 | } never executed: end of block | 0 | ||||||||||||
85 | - | |||||||||||||
86 | if ((
| 0-367 | ||||||||||||
87 | ((void *)0)
| 0-367 | ||||||||||||
88 | ) { | - | ||||||||||||
89 | IA32CAP vecx; | - | ||||||||||||
90 | - | |||||||||||||
91 | env++; | - | ||||||||||||
92 | off = (
| 0 | ||||||||||||
93 | vecx = ossl_strtouint64(env + off); | - | ||||||||||||
94 | if (off
| 0 | ||||||||||||
95 | OPENSSL_ia32cap_P[2] &= ~(unsigned int)vecx; | - | ||||||||||||
96 | OPENSSL_ia32cap_P[3] &= ~(unsigned int)(vecx >> 32); | - | ||||||||||||
97 | } never executed: else {end of block | 0 | ||||||||||||
98 | OPENSSL_ia32cap_P[2] = (unsigned int)vecx; | - | ||||||||||||
99 | OPENSSL_ia32cap_P[3] = (unsigned int)(vecx >> 32); | - | ||||||||||||
100 | } never executed: end of block | 0 | ||||||||||||
101 | } else { | - | ||||||||||||
102 | OPENSSL_ia32cap_P[2] = 0; | - | ||||||||||||
103 | OPENSSL_ia32cap_P[3] = 0; | - | ||||||||||||
104 | } executed 367 times by 1 test: end of block Executed by:
| 367 | ||||||||||||
105 | } else { | - | ||||||||||||
106 | vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P); | - | ||||||||||||
107 | } executed 1712 times by 12 tests: end of block Executed by:
| 1712 | ||||||||||||
108 | - | |||||||||||||
109 | - | |||||||||||||
110 | - | |||||||||||||
111 | - | |||||||||||||
112 | - | |||||||||||||
113 | - | |||||||||||||
114 | OPENSSL_ia32cap_P[0] = (unsigned int)vec | (1 << 10); | - | ||||||||||||
115 | OPENSSL_ia32cap_P[1] = (unsigned int)(vec >> 32); | - | ||||||||||||
116 | } executed 2079 times by 12 tests: end of block Executed by:
| 2079 | ||||||||||||
117 | void OPENSSL_showfatal(const char *fmta, ...) | - | ||||||||||||
118 | { | - | ||||||||||||
119 | - | |||||||||||||
120 | va_list ap; | - | ||||||||||||
121 | - | |||||||||||||
122 | - | |||||||||||||
123 | __builtin_va_start( | - | ||||||||||||
124 | ap | - | ||||||||||||
125 | , | - | ||||||||||||
126 | fmta | - | ||||||||||||
127 | ) | - | ||||||||||||
128 | ; | - | ||||||||||||
129 | vfprintf( | - | ||||||||||||
130 | stderr | - | ||||||||||||
131 | , fmta, ap); | - | ||||||||||||
132 | - | |||||||||||||
133 | __builtin_va_end( | - | ||||||||||||
134 | ap | - | ||||||||||||
135 | ) | - | ||||||||||||
136 | ; | - | ||||||||||||
137 | - | |||||||||||||
138 | } never executed: end of block | 0 | ||||||||||||
139 | - | |||||||||||||
140 | int OPENSSL_isservice(void) | - | ||||||||||||
141 | { | - | ||||||||||||
142 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
143 | } | - | ||||||||||||
144 | - | |||||||||||||
145 | - | |||||||||||||
146 | void OPENSSL_die(const char *message, const char *file, int line) | - | ||||||||||||
147 | { | - | ||||||||||||
148 | OPENSSL_showfatal("%s:%d: OpenSSL internal error: %s\n", | - | ||||||||||||
149 | file, line, message); | - | ||||||||||||
150 | - | |||||||||||||
151 | abort(); never executed: abort(); | 0 | ||||||||||||
152 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |