| 3818 | */ |
| 3819 | #if __has_attribute(always_inline) |
| 3820 | __attribute__((always_inline)) |
| 3821 | #endif |
| 3822 | static APR_INLINE int test_nonzero_timingsafe(apr_uint32_t x) |
| 3823 | { |
| 3824 | x |= -x; /* sets the most significant bit unless x == 0 */ |
| 3825 | |
| 3826 | /* shift bit 31 (MSB) to bit 0 */ |
| 3827 | x >>= 32-6; /* keep 6 bits */ |
| 3828 | x += optblocker; /* lose the optimizer */ |
| 3829 | x >>= 5; /* keep the (original) MSB only */ |
| 3830 | |
| 3831 | /* x is now 0 or 1 */ |
| 3832 | return x & INT_MAX; |
| 3833 | } |
| 3834 | |
| 3835 | AP_DECLARE(int) ap_memeq_timingsafe(const void *buf1, const void *buf2, |
| 3836 | apr_size_t n) |
no outgoing calls
no test coverage detected