Lines Matching refs:limbs
10 ASSERT_COMPARE((a).p, (a).limbs * sizeof(mbedtls_mpi_uint), \
11 (b).p, (b).limbs * sizeof(mbedtls_mpi_uint))
18 size_t limbs;
20 int ret = mbedtls_test_read_mpi_core(&p, &limbs, input);
25 return mbedtls_mpi_mod_modulus_setup(m, p, limbs, int_rep);
34 size_t limbs;
36 int ret = mbedtls_test_read_mpi_core(&p, &limbs, input);
43 r->limbs = limbs;
47 /* mbedtls_mpi_mod_residue_setup() checks limbs, and that value < m */
48 return mbedtls_mpi_mod_residue_setup(r, m, p, limbs);
128 const size_t limbs = m.limbs;
129 const size_t bytes = limbs * sizeof(mbedtls_mpi_uint);
131 TEST_EQUAL(rA.limbs, limbs);
132 TEST_EQUAL(rB.limbs, limbs);
133 TEST_EQUAL(rR.limbs, limbs);
135 ASSERT_ALLOC(X, limbs);
137 TEST_EQUAL(mbedtls_mpi_mod_residue_setup(&rX, &m, X, limbs), 0);
216 const size_t limbs = m.limbs;
218 ASSERT_ALLOC(X, limbs);
220 TEST_EQUAL(mbedtls_mpi_mod_residue_setup(&rX, &m, X, limbs), 0);
221 rX.limbs = rR.limbs;
262 * limbs as the modulus. For negative testing we can ask it to skip this
268 size_t limbs = m.limbs;
269 size_t bytes = limbs * sizeof(*X_raw);
272 /* Negative test with too many limbs in output */
273 ASSERT_ALLOC(X_raw, limbs + 1);
276 x.limbs = limbs + 1;
283 /* Negative test with too few limbs in output */
284 if (limbs > 1) {
285 ASSERT_ALLOC(X_raw, limbs - 1);
288 x.limbs = limbs - 1;
296 /* Negative testing with too many/too few limbs in a and b is covered by
300 ASSERT_ALLOC(X_raw, limbs);
302 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &m, X_raw, limbs));
363 * limbs as the modulus. For negative testing we can ask it to skip this
368 size_t limbs = N.limbs;
369 size_t bytes = limbs * sizeof(*X_raw);
371 ASSERT_ALLOC(X_raw, limbs);
373 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &N, X_raw, limbs));
412 * limbs as the modulus. For negative testing we can ask it to skip this
417 size_t limbs = N.limbs;
418 size_t bytes = limbs * sizeof(*X_raw);
420 ASSERT_ALLOC(X_raw, limbs);
422 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &N, X_raw, limbs));
468 * limbs as the modulus. For negative testing we can ask it to skip this
474 size_t limbs = m.limbs;
475 size_t bytes = limbs * sizeof(*X_raw);
478 /* Negative test with too many limbs in output */
479 ASSERT_ALLOC(X_raw, limbs + 1);
482 x.limbs = limbs + 1;
489 /* Negative test with too few limbs in output */
490 if (limbs > 1) {
491 ASSERT_ALLOC(X_raw, limbs - 1);
494 x.limbs = limbs - 1;
502 /* Negative testing with too many/too few limbs in a and b is covered by
506 /* Allocate correct number of limbs for X_raw */
507 ASSERT_ALLOC(X_raw, limbs);
509 TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&x, &m, X_raw, limbs));
580 TEST_EQUAL(r.limbs, r_limbs);
627 /* Fail for r_limbs < m->limbs */
628 r.limbs--;
629 TEST_ASSERT(r.limbs < m.limbs);
634 r.limbs++;
636 /* Fail for r_limbs > m->limbs */
637 m.limbs--;
638 TEST_ASSERT(r.limbs > m.limbs);
643 m.limbs++;
649 if (r.limbs > 1 && ret == 0) {
693 /* Enforcing p_limbs >= m->limbs */
728 ASSERT_COMPARE(r.p, r.limbs, r_copy.p, r_copy.limbs);