Lines Matching refs:X

45     mbedtls_mpi_uint X[sizeof(buf) / sizeof(mbedtls_mpi_uint)];
46 TEST_LE_U(nx, sizeof(X) / sizeof(X[0]));
55 mbedtls_mpi_uint init[sizeof(X) / sizeof(X[0])];
64 ret = mbedtls_mpi_mod_raw_read(X, &m, input->x, input->len, endian);
72 ret = mbedtls_mpi_mod_raw_write(X, &m, buf, nb, endian);
116 mbedtls_mpi_uint *X = NULL;
125 TEST_EQUAL(mbedtls_test_read_mpi_core(&X, &limbs_X, input_X), 0);
142 TEST_CF_SECRET(X, bytes);
145 mbedtls_mpi_mod_raw_cond_assign(X, Y, &m, 0);
147 TEST_CF_PUBLIC(X, bytes);
150 TEST_ASSERT(memcmp(X, Y, bytes) != 0);
153 TEST_CF_SECRET(X, bytes);
156 mbedtls_mpi_mod_raw_cond_assign(X, Y, &m, 1);
158 TEST_CF_PUBLIC(X, bytes);
164 TEST_MEMORY_COMPARE(X, copy_bytes, Y, copy_bytes);
165 TEST_ASSERT(memcmp(X, Y, bytes) != 0);
167 TEST_MEMORY_COMPARE(X, bytes, Y, bytes);
171 mbedtls_free(X);
186 mbedtls_mpi_uint *X = NULL;
211 TEST_CALLOC(X, limbs);
212 memcpy(X, tmp_X, bytes);
218 TEST_CF_SECRET(X, bytes);
221 mbedtls_mpi_mod_raw_cond_swap(X, Y, &m, 0);
223 TEST_CF_PUBLIC(X, bytes);
226 TEST_MEMORY_COMPARE(X, bytes, tmp_X, bytes);
230 TEST_CF_SECRET(X, bytes);
233 mbedtls_mpi_mod_raw_cond_swap(X, Y, &m, 1);
235 TEST_CF_PUBLIC(X, bytes);
241 TEST_MEMORY_COMPARE(X, copy_bytes, tmp_Y, copy_bytes);
243 TEST_ASSERT(memcmp(X, tmp_X, bytes) != 0);
244 TEST_ASSERT(memcmp(X, tmp_Y, bytes) != 0);
248 TEST_MEMORY_COMPARE(X, bytes, tmp_Y, bytes);
255 mbedtls_free(X);
272 mbedtls_mpi_uint *X = NULL;
294 TEST_CALLOC(X, limbs);
299 mbedtls_mpi_mod_raw_sub(X, A, B, &m);
300 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
302 /* alias X to A */
303 memcpy(X, A, bytes);
304 mbedtls_mpi_mod_raw_sub(X, X, B, &m);
305 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
307 /* alias X to B */
308 memcpy(X, B, bytes);
309 mbedtls_mpi_mod_raw_sub(X, A, X, &m);
310 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
314 mbedtls_mpi_mod_raw_sub(X, A, A, &m);
315 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
317 /* X, A, B all aliased together */
318 memcpy(X, A, bytes);
319 mbedtls_mpi_mod_raw_sub(X, X, X, &m);
320 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
325 mbedtls_free(X);
338 mbedtls_mpi_uint *X = NULL;
349 TEST_EQUAL(mbedtls_test_read_mpi_core(&X, &limbs_X, input_X), 0);
360 memcpy(tmp, X, bytes);
362 /* Check that 0 <= X < 2N */
363 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(tmp, X, N, limbs);
369 mbedtls_mpi_mod_raw_fix_quasi_reduction(X, &m);
370 TEST_MEMORY_COMPARE(X, bytes, res, bytes);
373 mbedtls_free(X);
391 mbedtls_mpi_uint *X = NULL;
414 TEST_CALLOC(X, limbs);
422 mbedtls_mpi_mod_raw_mul(X, A, B, &m, T);
423 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
425 /* alias X to A */
426 memcpy(X, A, bytes);
427 mbedtls_mpi_mod_raw_mul(X, X, B, &m, T);
428 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
430 /* alias X to B */
431 memcpy(X, B, bytes);
432 mbedtls_mpi_mod_raw_mul(X, A, X, &m, T);
433 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
437 mbedtls_mpi_mod_raw_mul(X, A, A, &m, T);
438 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
440 /* X, A, B all aliased together */
441 memcpy(X, A, bytes);
442 mbedtls_mpi_mod_raw_mul(X, X, X, &m, T);
443 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
447 mbedtls_mpi_mod_raw_mul(X, B, A, &m, T);
448 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
450 /* B * A: alias X to A */
451 memcpy(X, A, bytes);
452 mbedtls_mpi_mod_raw_mul(X, B, X, &m, T);
453 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
455 /* B + A: alias X to B */
456 memcpy(X, B, bytes);
457 mbedtls_mpi_mod_raw_mul(X, X, A, &m, T);
458 TEST_MEMORY_COMPARE(X, bytes, R, bytes);
464 mbedtls_free(X);
478 mbedtls_mpi_uint *X = NULL;
491 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &X_limbs, input_X));
526 TEST_EQUAL(0, memcmp(X, Y, N_limbs * sizeof(mbedtls_mpi_uint)));
532 TEST_EQUAL(0, memcmp(X, A, N_limbs * sizeof(mbedtls_mpi_uint)));
538 mbedtls_free(X);
555 mbedtls_mpi_uint *X = NULL;
574 TEST_CALLOC(X, limbs);
580 mbedtls_mpi_mod_raw_add(X, A, B, &m);
581 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
583 /* A + B: alias X to A => Correct result */
584 memcpy(X, A, bytes);
585 mbedtls_mpi_mod_raw_add(X, X, B, &m);
586 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
588 /* A + B: alias X to B => Correct result */
589 memcpy(X, B, bytes);
590 mbedtls_mpi_mod_raw_add(X, A, X, &m);
591 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
597 mbedtls_mpi_mod_raw_add(X, A, A, &m);
598 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
600 /* A + A: X, A, B all aliased together => Correct result */
601 memcpy(X, A, bytes);
602 mbedtls_mpi_mod_raw_add(X, X, X, &m);
603 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
608 mbedtls_mpi_mod_raw_add(X, B, A, &m);
609 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
611 /* B + A: alias X to A => Correct result */
612 memcpy(X, A, bytes);
613 mbedtls_mpi_mod_raw_add(X, B, X, &m);
614 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
616 /* B + A: alias X to B => Correct result */
617 memcpy(X, B, bytes);
618 mbedtls_mpi_mod_raw_add(X, X, A, &m);
619 TEST_MEMORY_COMPARE(X, bytes, S, bytes);
629 mbedtls_free(X);
642 mbedtls_mpi_uint *X = NULL;
647 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &X_limbs, input_X));
651 X, X_limbs * sizeof(mbedtls_mpi_uint));
656 mbedtls_free(X);
669 mbedtls_mpi_uint *X = NULL;
674 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &X_limbs, input_X));
678 X, X_limbs * sizeof(mbedtls_mpi_uint));
683 mbedtls_free(X);
693 mbedtls_mpi_uint *X = NULL;
703 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &x_limbs, input_X));
726 TEST_MEMORY_COMPARE(R, bytes, X, bytes);
732 TEST_MEMORY_COMPARE(R, bytes, X, bytes);
739 TEST_MEMORY_COMPARE(A, bytes, X, bytes);
747 mbedtls_free(X);
757 mbedtls_mpi_uint *X = NULL;
767 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &x_limbs, input_X));
790 TEST_MEMORY_COMPARE(R, bytes, X, bytes);
796 TEST_MEMORY_COMPARE(R, bytes, X, bytes);
803 TEST_MEMORY_COMPARE(A, bytes, X, bytes);
811 mbedtls_free(X);
820 mbedtls_mpi_uint *X = NULL;
831 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&X, &x_limbs, input_X));
852 TEST_MEMORY_COMPARE(R, bytes, X, bytes);
856 TEST_MEMORY_COMPARE(A, bytes, X, bytes);
861 mbedtls_free(X);