Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | #include <limits.h> | - |
19 | #include <string.h> | - |
20 | | - |
21 | int | - |
22 | timingsafe_memcmp(const void *b1, const void *b2, size_t len) | - |
23 | { | - |
24 | const unsigned char *p1 = b1, *p2 = b2; | - |
25 | size_t i; | - |
26 | int res = 0, done = 0; | - |
27 | | - |
28 | for (i = 0; i < len; i++) {TRUE | evaluated 2929930 times by 8 testsEvaluated by:- aeadtest
- bytestringtest
- rsa_test
- ssltest
- timingsafe
- tlsexttest
- tlstest
- x25519test
| FALSE | evaluated 362069 times by 8 testsEvaluated by:- aeadtest
- bytestringtest
- rsa_test
- ssltest
- timingsafe
- tlsexttest
- tlstest
- x25519test
|
| 362069-2929930 |
29 | | - |
30 | int lt = (p1[i] - p2[i]) >> CHAR_BIT; | - |
31 | | - |
32 | | - |
33 | int gt = (p2[i] - p1[i]) >> CHAR_BIT; | - |
34 | | - |
35 | | - |
36 | int cmp = lt - gt; | - |
37 | | - |
38 | | - |
39 | res |= cmp & ~done; | - |
40 | | - |
41 | | - |
42 | done |= lt | gt; | - |
43 | }executed 2929930 times by 8 tests: end of block Executed by:- aeadtest
- bytestringtest
- rsa_test
- ssltest
- timingsafe
- tlsexttest
- tlstest
- x25519test
| 2929930 |
44 | | - |
45 | return (res);executed 362069 times by 8 tests: return (res); Executed by:- aeadtest
- bytestringtest
- rsa_test
- ssltest
- timingsafe
- tlsexttest
- tlstest
- x25519test
| 362069 |
46 | } | - |
| | |