OpenCoverage

cryptlib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/cryptlib.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7extern unsigned int OPENSSL_ia32cap_P[4];-
8typedef char variant_char;-
9-
10-
11-
12-
13static int todigit(variant_char c)-
14{-
15 if ((
(ossl_ctype_check((c), 0x4))Description
TRUEevaluated 5505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ossl_ctype_check((c), 0x4))
(ossl_ctype_check((c), 0x4))Description
TRUEevaluated 5505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
367-5505
16 return
executed 5505 times by 1 test: return c - '0';
Executed by:
  • libcrypto.so.1.1
c - '0';
executed 5505 times by 1 test: return c - '0';
Executed by:
  • libcrypto.so.1.1
5505
17 else if ((
(ossl_ctype_check((c), 0x10))Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ossl_ctype_check((c), 0x10))
(ossl_ctype_check((c), 0x10))Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-367
18 return
never executed: return ossl_tolower(c) - 'a' + 10;
ossl_tolower(c) - 'a' + 10;
never executed: return ossl_tolower(c) - 'a' + 10;
0
19-
20-
21 return
executed 367 times by 1 test: return 16;
Executed by:
  • libcrypto.so.1.1
16;
executed 367 times by 1 test: return 16;
Executed by:
  • libcrypto.so.1.1
367
22}-
23-
24static uint64_t ossl_strtouint64(const variant_char *str)-
25{-
26 uint64_t ret = 0;-
27 unsigned int digit, base = 10;-
28-
29 if (*
*str == '0'Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
str == '0'
*str == '0'Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-367
30 base = 8, str++;-
31 if (ossl_tolower(*str) == 'x'
ossl_tolower(*str) == 'x'Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-367
32 base = 16, str++;
executed 367 times by 1 test: base = 16, str++;
Executed by:
  • libcrypto.so.1.1
367
33 }
executed 367 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
367
34-
35 while((
(digit = todig...str++)) < baseDescription
TRUEevaluated 5505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
digit = todigit(*str++)) < base
(digit = todig...str++)) < baseDescription
TRUEevaluated 5505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
367-5505
36 ret = ret * base + digit;
executed 5505 times by 1 test: ret = ret * base + digit;
Executed by:
  • libcrypto.so.1.1
5505
37-
38 return
executed 367 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 367 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
367
39}-
40-
41static variant_char *ossl_strchr(const variant_char *str, char srch)-
42{ variant_char c;-
43-
44 while((
(c = *str)Description
TRUEevaluated 6606 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
c = *str)
(c = *str)Description
TRUEevaluated 6606 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
367-6606
45 if (c == srch
c == srchDescription
TRUEnever evaluated
FALSEevaluated 6606 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-6606
46 return
never executed: return (variant_char *)str;
(variant_char *)str;
never executed: return (variant_char *)str;
0
47 str++;-
48 }
executed 6606 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6606
49-
50 return
executed 367 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
executed 367 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
367
51 ((void *)0)
executed 367 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
367
52 ;
executed 367 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
367
53}-
54-
55-
56typedef uint64_t IA32CAP;-
57-
58void 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
triggerDescription
TRUEevaluated 4035 times by 12 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
FALSEevaluated 2079 times by 12 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
)
2079-4035
66 return;
executed 4035 times by 12 tests: return;
Executed by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
4035
67-
68 trigger = 1;-
69 if ((
(env = getenv(...!= ((void *)0)Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1712 times by 12 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
env = getenv("OPENSSL_ia32cap")) !=
(env = getenv(...!= ((void *)0)Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1712 times by 12 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
367-1712
70 ((void *)0)
(env = getenv(...!= ((void *)0)Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1712 times by 12 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
367-1712
71 ) {-
72 int off = (
(env[0] == '~')Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
env[0] == '~')
(env[0] == '~')Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
? 1 : 0;
0-367
73-
74 vec = ossl_strtouint64(env + off);-
75-
76 if (off
offDescription
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-367
77 IA32CAP mask = vec;-
78 vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~mask;-
79 if (mask & (1<<24)
mask & (1<<24)Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
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: end of block
Executed by:
  • libcrypto.so.1.1
else if (env[0] == ':'
env[0] == ':'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-367
83 vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);-
84 }
never executed: end of block
0
85-
86 if ((
(env = ossl_st...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
env = ossl_strchr(env, ':')) !=
(env = ossl_st...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-367
87 ((void *)0)
(env = ossl_st...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-367
88 ) {-
89 IA32CAP vecx;-
90-
91 env++;-
92 off = (
(env[0] == '~')Description
TRUEnever evaluated
FALSEnever evaluated
env[0] == '~')
(env[0] == '~')Description
TRUEnever evaluated
FALSEnever evaluated
? 1 : 0;
0
93 vecx = ossl_strtouint64(env + off);-
94 if (off
offDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
95 OPENSSL_ia32cap_P[2] &= ~(unsigned int)vecx;-
96 OPENSSL_ia32cap_P[3] &= ~(unsigned int)(vecx >> 32);-
97 }
never executed: end of block
else {
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:
  • libcrypto.so.1.1
367
105 } else {-
106 vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);-
107 }
executed 1712 times by 12 tests: end of block
Executed by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
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:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
2079
117void 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-
140int OPENSSL_isservice(void)-
141{-
142 return
never executed: return 0;
0;
never executed: return 0;
0
143}-
144-
145-
146void 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 codePreprocessed file

Generated by Squish Coco 4.2.2