Lines Matching refs:x
240 mbedtls_mpi_mod_residue x = { NULL, 0 };
264 x.p = X_raw;
265 x.limbs = limbs + 1;
267 mbedtls_mpi_mod_sub(&x, &a, &b, &m));
276 x.p = X_raw;
277 x.limbs = limbs - 1;
279 mbedtls_mpi_mod_sub(&x, &a, &b, &m));
291 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &m, X_raw, limbs));
294 TEST_EQUAL(expected_ret, mbedtls_mpi_mod_sub(&x, &a, &b, &m));
299 TEST_COMPARE_MPI_RESIDUES(x, d);
301 /* a - b: alias x to a => Correct result */
302 memcpy(x.p, a.p, bytes);
303 TEST_EQUAL(0, mbedtls_mpi_mod_sub(&x, &x, &b, &m));
304 TEST_COMPARE_MPI_RESIDUES(x, d);
306 /* a - b: alias x to b => Correct result */
307 memcpy(x.p, b.p, bytes);
308 TEST_EQUAL(0, mbedtls_mpi_mod_sub(&x, &a, &x, &m));
309 TEST_COMPARE_MPI_RESIDUES(x, d);
315 TEST_EQUAL(0, mbedtls_mpi_mod_sub(&x, &a, &a, &m));
316 TEST_COMPARE_MPI_RESIDUES(x, d);
318 /* a - a: x, a, b all aliased together => Correct result */
319 memcpy(x.p, a.p, bytes);
320 TEST_EQUAL(0, mbedtls_mpi_mod_sub(&x, &x, &x, &m));
321 TEST_COMPARE_MPI_RESIDUES(x, d);
342 mbedtls_mpi_mod_residue x = { NULL, 0 }; /* output */
363 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &N, X_raw, limbs));
365 TEST_EQUAL(expected_ret, mbedtls_mpi_mod_inv(&x, &a, &N));
367 TEST_COMPARE_MPI_RESIDUES(x, i);
369 /* a^-1: alias x to a => Correct result */
370 memcpy(x.p, a.p, bytes);
371 TEST_EQUAL(0, mbedtls_mpi_mod_inv(&x, &x, &N));
372 TEST_COMPARE_MPI_RESIDUES(x, i);
392 mbedtls_mpi_mod_residue x = { NULL, 0 }; /* output */
413 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &N, X_raw, limbs));
415 TEST_EQUAL(expected_ret, mbedtls_mpi_mod_inv(&x, &a, &N));
417 TEST_COMPARE_MPI_RESIDUES(x, i);
419 /* a^-1: alias x to a => Correct result */
420 memcpy(x.p, a.p, bytes);
421 TEST_EQUAL(0, mbedtls_mpi_mod_inv(&x, &x, &N));
422 TEST_COMPARE_MPI_RESIDUES(x, i);
443 mbedtls_mpi_mod_residue x = { NULL, 0 };
467 x.p = X_raw;
468 x.limbs = limbs + 1;
470 mbedtls_mpi_mod_add(&x, &a, &b, &m));
479 x.p = X_raw;
480 x.limbs = limbs - 1;
482 mbedtls_mpi_mod_add(&x, &a, &b, &m));
495 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &m, X_raw, limbs));
498 TEST_EQUAL(expected_ret, mbedtls_mpi_mod_add(&x, &a, &b, &m));
503 TEST_COMPARE_MPI_RESIDUES(x, s);
505 /* a + b: alias x to a => Correct result */
506 memcpy(x.p, a.p, bytes);
507 TEST_EQUAL(0, mbedtls_mpi_mod_add(&x, &x, &b, &m));
508 TEST_COMPARE_MPI_RESIDUES(x, s);
510 /* a + b: alias x to b => Correct result */
511 memcpy(x.p, b.p, bytes);
512 TEST_EQUAL(0, mbedtls_mpi_mod_add(&x, &a, &x, &m));
513 TEST_COMPARE_MPI_RESIDUES(x, s);
519 TEST_EQUAL(0, mbedtls_mpi_mod_add(&x, &a, &a, &m));
520 TEST_COMPARE_MPI_RESIDUES(x, s);
522 /* a + a: x, a, b all aliased together => Correct result */
523 memcpy(x.p, a.p, bytes);
524 TEST_EQUAL(0, mbedtls_mpi_mod_add(&x, &x, &x, &m));
525 TEST_COMPARE_MPI_RESIDUES(x, s);
589 mbedtls_mpi_mod_read(&r, &m, buf->x, buf->len, endian));
592 mbedtls_mpi_mod_write(&r, &m, buf->x, buf->len, endian));
598 mbedtls_mpi_mod_read(&r, &m, buf->x, buf->len, endian));
600 mbedtls_mpi_mod_write(&r, &m, buf->x, buf->len, endian));
609 mbedtls_mpi_mod_read(&r, &m, buf->x, buf->len, endian));
611 mbedtls_mpi_mod_write(&r, &m, buf->x, buf->len, endian));
618 mbedtls_mpi_mod_read(&r, &m, buf->x, buf->len, endian));
620 mbedtls_mpi_mod_write(&r, &m, buf->x, buf->len, endian));
624 TEST_EQUAL(ret, mbedtls_mpi_mod_read(&r, &m, buf->x, buf->len, endian));
629 mbedtls_mpi_mod_write(&r, &m, buf->x, 1, endian));
673 TEST_EQUAL(0, mbedtls_mpi_mod_read(&r, &m, input_A->x, input_A->len,
679 TEST_EQUAL(0, mbedtls_mpi_mod_read(&r_copy, &m, input_A->x, input_A->len,
711 memcpy(ref_buf, input_A->x, a_bytes_trimmed);
717 memcpy(ref_buf + ref_offset, input_A->x + a_offset,