Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/constant_time_locl.h |
Switch to Source code | Preprocessed file |
Line | Source | Count |
---|---|---|
1 | - | |
2 | static inline unsigned int constant_time_msb(unsigned int a); | - |
3 | - | |
4 | - | |
5 | - | |
6 | - | |
7 | static inline unsigned int constant_time_lt(unsigned int a, unsigned int b); | - |
8 | - | |
9 | static inline unsigned char constant_time_lt_8(unsigned int a, | - |
10 | unsigned int b); | - |
11 | - | |
12 | - | |
13 | - | |
14 | - | |
15 | static inline unsigned int constant_time_ge(unsigned int a, unsigned int b); | - |
16 | - | |
17 | static inline unsigned char constant_time_ge_8(unsigned int a, | - |
18 | unsigned int b); | - |
19 | - | |
20 | - | |
21 | - | |
22 | - | |
23 | static inline unsigned int constant_time_is_zero(unsigned int a); | - |
24 | - | |
25 | static inline unsigned char constant_time_is_zero_8(unsigned int a); | - |
26 | - | |
27 | - | |
28 | - | |
29 | - | |
30 | static inline unsigned int constant_time_eq(unsigned int a, unsigned int b); | - |
31 | - | |
32 | static inline unsigned char constant_time_eq_8(unsigned int a, | - |
33 | unsigned int b); | - |
34 | - | |
35 | static inline unsigned int constant_time_eq_int(int a, int b); | - |
36 | - | |
37 | static inline unsigned char constant_time_eq_int_8(int a, int b); | - |
38 | static inline unsigned int constant_time_select(unsigned int mask, | - |
39 | unsigned int a, | - |
40 | unsigned int b); | - |
41 | - | |
42 | static inline unsigned char constant_time_select_8(unsigned char mask, | - |
43 | unsigned char a, | - |
44 | unsigned char b); | - |
45 | - | |
46 | static inline int constant_time_select_int(unsigned int mask, int a, int b); | - |
47 | - | |
48 | static inline unsigned int constant_time_msb(unsigned int a) | - |
49 | { | - |
50 | return executed 2657590 times by 12 tests: 0 - (a >> (sizeof(a) * 8 - 1));return 0 - (a >> (sizeof(a) * 8 - 1)); Executed by:
executed 2657590 times by 12 tests: return 0 - (a >> (sizeof(a) * 8 - 1)); Executed by:
| 2657590 |
51 | } | - |
52 | - | |
53 | static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) | - |
54 | { | - |
55 | return never executed: constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b)));return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); never executed: return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); | 0 |
56 | } | - |
57 | - | |
58 | static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b) | - |
59 | { | - |
60 | return never executed: (unsigned char)(constant_time_lt(a, b));return (unsigned char)(constant_time_lt(a, b)); never executed: return (unsigned char)(constant_time_lt(a, b)); | 0 |
61 | } | - |
62 | - | |
63 | static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) | - |
64 | { | - |
65 | return never executed: ~constant_time_lt(a, b);return ~constant_time_lt(a, b); never executed: return ~constant_time_lt(a, b); | 0 |
66 | } | - |
67 | - | |
68 | static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) | - |
69 | { | - |
70 | return never executed: (unsigned char)(constant_time_ge(a, b));return (unsigned char)(constant_time_ge(a, b)); never executed: return (unsigned char)(constant_time_ge(a, b)); | 0 |
71 | } | - |
72 | - | |
73 | static inline unsigned int constant_time_is_zero(unsigned int a) | - |
74 | { | - |
75 | return executed 2657590 times by 12 tests: constant_time_msb(~a & (a - 1));return constant_time_msb(~a & (a - 1)); Executed by:
executed 2657590 times by 12 tests: return constant_time_msb(~a & (a - 1)); Executed by:
| 2657590 |
76 | } | - |
77 | - | |
78 | static inline unsigned char constant_time_is_zero_8(unsigned int a) | - |
79 | { | - |
80 | return never executed: (unsigned char)(constant_time_is_zero(a));return (unsigned char)(constant_time_is_zero(a)); never executed: return (unsigned char)(constant_time_is_zero(a)); | 0 |
81 | } | - |
82 | - | |
83 | static inline unsigned int constant_time_eq(unsigned int a, unsigned int b) | - |
84 | { | - |
85 | return executed 2657590 times by 12 tests: constant_time_is_zero(a ^ b);return constant_time_is_zero(a ^ b); Executed by:
executed 2657590 times by 12 tests: return constant_time_is_zero(a ^ b); Executed by:
| 2657590 |
86 | } | - |
87 | - | |
88 | static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b) | - |
89 | { | - |
90 | return never executed: (unsigned char)(constant_time_eq(a, b));return (unsigned char)(constant_time_eq(a, b)); never executed: return (unsigned char)(constant_time_eq(a, b)); | 0 |
91 | } | - |
92 | - | |
93 | static inline unsigned int constant_time_eq_int(int a, int b) | - |
94 | { | - |
95 | return executed 2657590 times by 12 tests: constant_time_eq((unsigned)(a), (unsigned)(b));return constant_time_eq((unsigned)(a), (unsigned)(b)); Executed by:
executed 2657590 times by 12 tests: return constant_time_eq((unsigned)(a), (unsigned)(b)); Executed by:
| 2657590 |
96 | } | - |
97 | - | |
98 | static inline unsigned char constant_time_eq_int_8(int a, int b) | - |
99 | { | - |
100 | return never executed: constant_time_eq_8((unsigned)(a), (unsigned)(b));return constant_time_eq_8((unsigned)(a), (unsigned)(b)); never executed: return constant_time_eq_8((unsigned)(a), (unsigned)(b)); | 0 |
101 | } | - |
102 | - | |
103 | static inline unsigned int constant_time_select(unsigned int mask, | - |
104 | unsigned int a, | - |
105 | unsigned int b) | - |
106 | { | - |
107 | return never executed: (mask & a) | (~mask & b);return (mask & a) | (~mask & b); never executed: return (mask & a) | (~mask & b); | 0 |
108 | } | - |
109 | - | |
110 | static inline unsigned char constant_time_select_8(unsigned char mask, | - |
111 | unsigned char a, | - |
112 | unsigned char b) | - |
113 | { | - |
114 | return never executed: (unsigned char)(constant_time_select(mask, a, b));return (unsigned char)(constant_time_select(mask, a, b)); never executed: return (unsigned char)(constant_time_select(mask, a, b)); | 0 |
115 | } | - |
116 | - | |
117 | static inline int constant_time_select_int(unsigned int mask, int a, int b) | - |
118 | { | - |
119 | return never executed: (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b)));return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b))); never executed: return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b))); | 0 |
120 | } | - |
121 | - | |
122 | - | |
Switch to Source code | Preprocessed file |