| 50 | } |
| 51 | |
| 52 | static struct timerel nonconst_time_test(struct secret *s1, |
| 53 | struct secret *s2, |
| 54 | size_t off) |
| 55 | { |
| 56 | struct timeabs start, end; |
| 57 | int result = 0; |
| 58 | |
| 59 | memset(s1, 0, RUNS * sizeof(*s1)); |
| 60 | memset(s2, 0, RUNS * sizeof(*s2)); |
| 61 | |
| 62 | for (size_t i = 0; i < RUNS; i++) |
| 63 | s2[i].data[off] = i; |
| 64 | |
| 65 | start = time_now(); |
| 66 | for (size_t i = 0; i < RUNS; i++) |
| 67 | result += secret_eq_nonconst(&s1[i], &s2[i]); |
| 68 | end = time_now(); |
| 69 | |
| 70 | if (result != RUNS / 256) |
| 71 | errx(1, "Expected %u successes at offset %zu, not %u!", |
| 72 | RUNS / 256, off, result); |
| 73 | |
| 74 | return time_between(end, start); |
| 75 | } |
| 76 | |
| 77 | static struct secret *s1, *s2; |
| 78 |
nothing calls this directly
no test coverage detected