Lines Matching refs:a

61 static int test_binary_op(unsigned int (*op) (unsigned int a, unsigned int b),  in test_binary_op()  argument
62 const char *op_name, unsigned int a, unsigned int b, in test_binary_op()
65 if (is_true && !TEST_uint_eq(op(a, b), CONSTTIME_TRUE)) in test_binary_op()
67 if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE)) in test_binary_op()
73 char (*op) (unsigned int a, unsigned int b), in test_binary_op_8() argument
74 const char *op_name, unsigned int a, in test_binary_op_8()
77 if (is_true && !TEST_uint_eq(op(a, b), CONSTTIME_TRUE_8)) in test_binary_op_8()
79 if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE_8)) in test_binary_op_8()
84 static int test_binary_op_s(size_t (*op) (size_t a, size_t b), in test_binary_op_s() argument
85 const char *op_name, size_t a, size_t b, in test_binary_op_s()
88 if (is_true && !TEST_size_t_eq(op(a, b), CONSTTIME_TRUE_S)) in test_binary_op_s()
90 if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE_S)) in test_binary_op_s()
95 static int test_binary_op_64(uint64_t (*op)(uint64_t a, uint64_t b), in test_binary_op_64() argument
96 const char *op_name, uint64_t a, uint64_t b, in test_binary_op_64()
99 uint64_t c = op(a, b); in test_binary_op_64()
103 BIO_printf(bio_err, "a=%jx b=%jx\n", a, b); in test_binary_op_64()
107 BIO_printf(bio_err, "a=%jx b=%jx\n", a, b); in test_binary_op_64()
115 unsigned int a = test_values[i]; in test_is_zero() local
117 if (a == 0 && !TEST_uint_eq(constant_time_is_zero(a), CONSTTIME_TRUE)) in test_is_zero()
119 if (a != 0 && !TEST_uint_eq(constant_time_is_zero(a), CONSTTIME_FALSE)) in test_is_zero()
126 unsigned int a = test_values_8[i]; in test_is_zero_8() local
128 if (a == 0 && !TEST_uint_eq(constant_time_is_zero_8(a), CONSTTIME_TRUE_8)) in test_is_zero_8()
130 if (a != 0 && !TEST_uint_eq(constant_time_is_zero_8(a), CONSTTIME_FALSE_8)) in test_is_zero_8()
137 uint32_t a = test_values_32[i]; in test_is_zero_32() local
139 if (a == 0 && !TEST_true(constant_time_is_zero_32(a) == CONSTTIME_TRUE_32)) in test_is_zero_32()
141 if (a != 0 && !TEST_true(constant_time_is_zero_32(a) == CONSTTIME_FALSE_32)) in test_is_zero_32()
148 size_t a = test_values_s[i]; in test_is_zero_s() local
150 if (a == 0 && !TEST_size_t_eq(constant_time_is_zero_s(a), CONSTTIME_TRUE_S)) in test_is_zero_s()
152 if (a != 0 && !TEST_uint_eq(constant_time_is_zero_s(a), CONSTTIME_FALSE_S)) in test_is_zero_s()
157 static int test_select(unsigned int a, unsigned int b) in test_select() argument
159 if (!TEST_uint_eq(constant_time_select(CONSTTIME_TRUE, a, b), a)) in test_select()
161 if (!TEST_uint_eq(constant_time_select(CONSTTIME_FALSE, a, b), b)) in test_select()
166 static int test_select_8(unsigned char a, unsigned char b) in test_select_8() argument
168 if (!TEST_uint_eq(constant_time_select_8(CONSTTIME_TRUE_8, a, b), a)) in test_select_8()
170 if (!TEST_uint_eq(constant_time_select_8(CONSTTIME_FALSE_8, a, b), b)) in test_select_8()
175 static int test_select_32(uint32_t a, uint32_t b) in test_select_32() argument
177 if (!TEST_true(constant_time_select_32(CONSTTIME_TRUE_32, a, b) == a)) in test_select_32()
179 if (!TEST_true(constant_time_select_32(CONSTTIME_FALSE_32, a, b) == b)) in test_select_32()
184 static int test_select_s(size_t a, size_t b) in test_select_s() argument
186 if (!TEST_uint_eq(constant_time_select_s(CONSTTIME_TRUE_S, a, b), a)) in test_select_s()
188 if (!TEST_uint_eq(constant_time_select_s(CONSTTIME_FALSE_S, a, b), b)) in test_select_s()
193 static int test_select_64(uint64_t a, uint64_t b) in test_select_64() argument
195 uint64_t selected = constant_time_select_64(CONSTTIME_TRUE_64, a, b); in test_select_64()
197 if (selected != a) { in test_select_64()
199 BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted a\n", a, b, selected); in test_select_64()
202 selected = constant_time_select_64(CONSTTIME_FALSE_64, a, b); in test_select_64()
204 BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted b\n", a, b, selected); in test_select_64()
210 static int test_select_int(int a, int b) in test_select_int() argument
212 if (!TEST_int_eq(constant_time_select_int(CONSTTIME_TRUE, a, b), a)) in test_select_int()
214 if (!TEST_int_eq(constant_time_select_int(CONSTTIME_FALSE, a, b), b)) in test_select_int()
219 static int test_eq_int_8(int a, int b) in test_eq_int_8() argument
221 if (a == b && !TEST_int_eq(constant_time_eq_int_8(a, b), CONSTTIME_TRUE_8)) in test_eq_int_8()
223 if (a != b && !TEST_int_eq(constant_time_eq_int_8(a, b), CONSTTIME_FALSE_8)) in test_eq_int_8()
228 static int test_eq_s(size_t a, size_t b) in test_eq_s() argument
230 if (a == b && !TEST_size_t_eq(constant_time_eq_s(a, b), CONSTTIME_TRUE_S)) in test_eq_s()
232 if (a != b && !TEST_int_eq(constant_time_eq_s(a, b), CONSTTIME_FALSE_S)) in test_eq_s()
237 static int test_eq_int(int a, int b) in test_eq_int() argument
239 if (a == b && !TEST_uint_eq(constant_time_eq_int(a, b), CONSTTIME_TRUE)) in test_eq_int()
241 if (a != b && !TEST_uint_eq(constant_time_eq_int(a, b), CONSTTIME_FALSE)) in test_eq_int()
255 unsigned int a = test_values[i]; in test_binops() local
262 if (!test_select(a, b) in test_binops()
264 a, b, a < b) in test_binops()
266 b, a, b < a) in test_binops()
268 a, b, a >= b) in test_binops()
270 b, a, b >= a) in test_binops()
272 a, b, a == b) in test_binops()
274 b, a, b == a)) in test_binops()
282 unsigned int a = test_values_8[i]; in test_binops_8() local
290 a, b, a < b) in test_binops_8()
292 b, a, b < a) in test_binops_8()
294 a, b, a >= b) in test_binops_8()
296 b, a, b >= a) in test_binops_8()
298 a, b, a == b) in test_binops_8()
300 b, a, b == a)) in test_binops_8()
308 size_t a = test_values_s[i]; in test_binops_s() local
315 if (!test_select_s(a, b) in test_binops_s()
316 || !test_eq_s(a, b) in test_binops_s()
318 a, b, a < b) in test_binops_s()
320 b, a, b < a) in test_binops_s()
322 a, b, a >= b) in test_binops_s()
324 b, a, b >= a) in test_binops_s()
326 a, b, a == b) in test_binops_s()
328 b, a, b == a)) in test_binops_s()