MCPcopy Create free account
hub / github.com/apache/httpd / test_nonzero_timingsafe

Function test_nonzero_timingsafe

server/util.c:3820–3833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3818 */
3819#if __has_attribute(always_inline)
3820__attribute__((always_inline))
3821#endif
3822static 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
3835AP_DECLARE(int) ap_memeq_timingsafe(const void *buf1, const void *buf2,
3836 apr_size_t n)

Callers 3

ap_memeq_timingsafeFunction · 0.85
ap_streq_timingsafeFunction · 0.85
ap_strneq_timingsafeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected