Home
last modified time | relevance | path

Searched refs:limbs (Results 1 – 25 of 40) sorted by relevance

12

/third_party/mbedtls/library/
Dbignum_mod.c42 if (p_limbs != N->limbs || !mbedtls_mpi_core_lt_ct(p, N->p, N->limbs)) { in mbedtls_mpi_mod_residue_setup()
46 r->limbs = N->limbs; in mbedtls_mpi_mod_residue_setup()
58 r->limbs = 0; in mbedtls_mpi_mod_residue_release()
69 N->limbs = 0; in mbedtls_mpi_mod_modulus_init()
84 N->limbs * sizeof(mbedtls_mpi_uint)); in mbedtls_mpi_mod_modulus_free()
98 N->limbs = 0; in mbedtls_mpi_mod_modulus_free()
105 size_t limbs) in set_mont_const_square() argument
115 if (A == NULL || limbs == 0 || limbs >= (MBEDTLS_MPI_MAX_LIMBS / 2) - 2) { in set_mont_const_square()
119 if (mbedtls_mpi_grow(&N, limbs)) { in set_mont_const_square()
123 memcpy(N.p, A, sizeof(mbedtls_mpi_uint) * limbs); in set_mont_const_square()
[all …]
Dbignum_mod_raw.c43 mbedtls_mpi_core_cond_assign(X, A, N->limbs, assign); in mbedtls_mpi_mod_raw_cond_assign()
51 mbedtls_mpi_core_cond_swap(X, Y, N->limbs, swap); in mbedtls_mpi_mod_raw_cond_swap()
64 ret = mbedtls_mpi_core_read_le(X, N->limbs, in mbedtls_mpi_mod_raw_read()
68 ret = mbedtls_mpi_core_read_be(X, N->limbs, in mbedtls_mpi_mod_raw_read()
79 if (!mbedtls_mpi_core_lt_ct(X, N->p, N->limbs)) { in mbedtls_mpi_mod_raw_read()
97 return mbedtls_mpi_core_write_le(A, N->limbs, in mbedtls_mpi_mod_raw_write()
100 return mbedtls_mpi_core_write_be(A, N->limbs, in mbedtls_mpi_mod_raw_write()
118 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(X, A, B, N->limbs); in mbedtls_mpi_mod_raw_sub()
120 (void) mbedtls_mpi_core_add_if(X, N->p, N->limbs, (unsigned) c); in mbedtls_mpi_mod_raw_sub()
129 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(X, X, N->p, N->limbs); in mbedtls_mpi_mod_raw_fix_quasi_reduction()
[all …]
Dbignum_core.c160 size_t limbs, in mbedtls_mpi_core_cond_assign() argument
167 mbedtls_ct_mpi_uint_cond_assign(limbs, X, A, assign); in mbedtls_mpi_core_cond_assign()
172 size_t limbs, in mbedtls_mpi_core_cond_swap() argument
182 for (size_t i = 0; i < limbs; i++) { in mbedtls_mpi_core_cond_swap()
194 const size_t limbs = CHARS_TO_LIMBS(input_length); in mbedtls_mpi_core_read_le() local
196 if (X_limbs < limbs) { in mbedtls_mpi_core_read_le()
217 const size_t limbs = CHARS_TO_LIMBS(input_length); in mbedtls_mpi_core_read_be() local
219 if (X_limbs < limbs) { in mbedtls_mpi_core_read_be()
316 void mbedtls_mpi_core_shift_r(mbedtls_mpi_uint *X, size_t limbs, in mbedtls_mpi_core_shift_r() argument
325 if (v0 > limbs || (v0 == limbs && v1 > 0)) { in mbedtls_mpi_core_shift_r()
[all …]
Dbignum_core.h171 size_t limbs,
197 size_t limbs,
293 void mbedtls_mpi_core_shift_r(mbedtls_mpi_uint *X, size_t limbs,
316 size_t limbs);
350 size_t limbs,
374 size_t limbs);
486 size_t limbs,
548 size_t limbs,
630 size_t limbs);
643 size_t limbs);
Dbignum_mod.h118 size_t limbs; member
130 size_t limbs; // number of limbs member
Dbignum.c174 static int mbedtls_mpi_resize_clear(mbedtls_mpi *X, size_t limbs) in mbedtls_mpi_resize_clear() argument
176 if (limbs == 0) { in mbedtls_mpi_resize_clear()
179 } else if (X->n == limbs) { in mbedtls_mpi_resize_clear()
180 memset(X->p, 0, limbs * ciL); in mbedtls_mpi_resize_clear()
185 return mbedtls_mpi_grow(X, limbs); in mbedtls_mpi_resize_clear()
683 const size_t limbs = CHARS_TO_LIMBS(buflen); in mbedtls_mpi_read_binary_le() local
686 MBEDTLS_MPI_CHK(mbedtls_mpi_resize_clear(X, limbs)); in mbedtls_mpi_read_binary_le()
709 const size_t limbs = CHARS_TO_LIMBS(buflen); in mbedtls_mpi_read_binary() local
715 MBEDTLS_MPI_CHK(mbedtls_mpi_resize_clear(X, limbs)); in mbedtls_mpi_read_binary()
2071 const size_t limbs = CHARS_TO_LIMBS(size); in mbedtls_mpi_fill_random() local
[all …]
Dconstant_time_internal.h149 size_t limbs);
Dconstant_time.c806 size_t limbs) in mbedtls_mpi_core_lt_ct() argument
814 for (size_t i = limbs; i > 0; i--) { in mbedtls_mpi_core_lt_ct()
/third_party/mbedtls/tests/suites/
Dtest_suite_bignum_mod_raw.data1 Test mbedtls_mpi_mod_raw_io #1 BE (Buffer and limbs just fit, input limb-aligned)
4 Test mbedtls_mpi_mod_raw_io #1 LE (Buffer and limbs just fit, input limb-aligned)
7 Test mbedtls_mpi_mod_raw_io #2 BE (Buffer and limbs just fit, input unaligned)
10 Test mbedtls_mpi_mod_raw_io #2 LE (Buffer and limbs just fit, input unaligned)
13 Test mbedtls_mpi_mod_raw_io #3 BE (Buffer just fits, extra limbs, input limb-aligned)
16 Test mbedtls_mpi_mod_raw_io #3 LE (Buffer just fits, extra limbs, input limb-aligned)
19 Test mbedtls_mpi_mod_raw_io #4 BE (Buffer just fits, extra limbs, input unaligned)
22 Test mbedtls_mpi_mod_raw_io #4 LE (Buffer just fits, extra limbs, input unaligned)
25 Test mbedtls_mpi_mod_raw_io #5 BE (Extra limbs, buffer aligned to extra limbs, input limb-aligned)
28 Test mbedtls_mpi_mod_raw_io #5 LE (Extra limbs, buffer aligned to extra limbs, input limb-aligned)
[all …]
Dtest_suite_bignum_mod.function10 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);
[all …]
Dtest_suite_bignum_core.misc.data4 Test mbedtls_mpi_core_io_be #1 (Buffer and limbs just fit, input limb-aligned)
7 Test mbedtls_mpi_core_io_be #2 (Buffer and limbs just fit, input unaligned)
10 Test mbedtls_mpi_core_io_be #3 (Buffer just fits, extra limbs, input limb-aligned)
13 Test mbedtls_mpi_core_io_be #4 (Buffer just fits, extra limbs, input unaligned)
16 Test mbedtls_mpi_core_io_be #5 (Extra limbs, buffer aligned to extra limbs, input limb-aligned)
19 Test mbedtls_mpi_core_io_be #6 (Extra limbs, buffer aligned to extra limbs, input unaligned)
22 Test mbedtls_mpi_core_io_be #7 (Buffer and limbs just fit, input limb-aligned with leading zeroes)
25 Test mbedtls_mpi_core_io_be #8 (Buffer and limbs just fit, input unaligned with leading zeroes)
28 Test mbedtls_mpi_core_io_be #9 (Buffer just fits, extra limbs, input limb-aligned with leading zero…
31 Test mbedtls_mpi_core_io_be #10 (Buffer just fits, extra limbs, input unaligned with leading zeroes)
[all …]
Dtest_suite_bignum_core.function12 * \param limbs Number of limbs in each MPI (\p A, \p B, \p S and \p X).
21 size_t limbs,
28 size_t bytes = limbs * sizeof(*A);
36 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, A, B, limbs));
41 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, X, B, limbs));
46 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, A, X, limbs));
53 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, A, A, limbs));
58 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, X, X, limbs));
64 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, B, A, limbs));
69 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, X, A, limbs));
[all …]
Dtest_suite_bignum_mod_raw.function35 /* nx_32_int is the number of 32 bit limbs, if we have 64 bit limbs we need
36 * to halve the number of limbs to have the same size. */
129 size_t limbs = limbs_X;
131 size_t bytes = limbs * sizeof(mbedtls_mpi_uint);
135 TEST_ASSERT(copy_limbs <= limbs);
165 if (copy_limbs < limbs) {
200 size_t limbs = limbs_X;
202 size_t bytes = limbs * sizeof(mbedtls_mpi_uint);
206 TEST_ASSERT(copy_limbs <= limbs);
214 ASSERT_ALLOC(X, limbs);
[all …]
Dtest_suite_bignum_random.function120 size_t limbs;
125 TEST_EQUAL(0, mbedtls_test_read_mpi_core(&upper_bound, &limbs,
127 ASSERT_ALLOC(lower_bound, limbs);
129 ASSERT_ALLOC(result, limbs);
132 mbedtls_mpi_core_random(result, min, upper_bound, limbs,
136 TEST_EQUAL(0, mbedtls_mpi_core_lt_ct(result, lower_bound, limbs));
137 TEST_EQUAL(1, mbedtls_mpi_core_lt_ct(result, upper_bound, limbs));
161 size_t limbs = max_legacy.n;
162 ASSERT_ALLOC(R_core, limbs);
166 int core_ret = mbedtls_mpi_core_random(R_core, min, max_legacy.p, limbs,
[all …]
Dtest_suite_bignum_mod.misc.data15 Test mpi_mod_mul #1 N->limbs != A->limbs
18 Test mpi_mod_mul #2 N->limbs != B->limbs
21 Test mpi_mod_mul #3 N->limbs != X->limbs
132 Test mbedtls_mpi_residue_setup #3 m->limbs = r-> limbs && m > r
135 Test mbedtls_mpi_residue_setup #4 m->limbs = r-> limbs && m > r
138 Test mbedtls_mpi_residue_setup #5 m->limbs > r-> limbs && m > r
141 Test mbedtls_mpi_residue_setup #6 m->limbs < r-> limbs && m > r
Dtest_suite_bignum.misc.data373 Multi-limb mbedtls_mpi_lt_mpi_ct (X>Y, equal MS limbs)
382 Multi-limb mbedtls_mpi_lt_mpi_ct (Alternating limbs) #1
385 Multi-limb mbedtls_mpi_lt_mpi_ct (Alternating limbs) #2
388 Multi-limb mbedtls_mpi_lt_mpi_ct (Alternating limbs) #3
391 Multi-limb mbedtls_mpi_lt_mpi_ct (Alternating limbs) #4
685 Shrink 0 limbs in a buffer of size 0 to 0
688 Shrink 2 limbs in a buffer of size 2 to 4
691 Shrink 2 limbs in a buffer of size 4 to 4
694 Shrink 2 limbs in a buffer of size 8 to 4
697 Shrink 4 limbs in a buffer of size 8 to 4
[all …]
Dtest_suite_ecp.function1323 size_t limbs = limbs_N;
1324 size_t bytes = limbs * sizeof(mbedtls_mpi_uint);
1326 TEST_EQUAL(limbs_X, 2 * limbs);
1327 TEST_EQUAL(limbs_res, limbs);
1330 &m, N, limbs,
1366 size_t limbs = limbs_N;
1367 size_t bytes = limbs * sizeof(mbedtls_mpi_uint);
1370 TEST_EQUAL(limbs_res, limbs);
1373 &m, N, limbs,
1409 size_t limbs = limbs_N;
[all …]
Dtest_suite_bignum_random.data181 MPI random in range: same size result (32-bit limbs)
184 MPI random in range: same size result (64-bit limbs)
321 MPI random mod validation: 2+ limbs, good
330 MPI random mod validation: 2+ limbs, output too small
333 MPI random mod validation: 2+ limbs, output too large
Dtest_suite_ecp.data679 ECP mod p192 small (more than 192 bits, less limbs than 2 * 192 bits)
Dtest_suite_bignum.function1259 * - biL = number of bits in limbs
/third_party/mbedtls/tests/src/
Dbignum_helpers.c94 size_t limbs = 0; in mbedtls_test_read_mpi_modulus() local
95 if (N->limbs != 0) { in mbedtls_test_read_mpi_modulus()
98 int ret = mbedtls_test_read_mpi_core(&p, &limbs, s); in mbedtls_test_read_mpi_modulus()
102 ret = mbedtls_mpi_mod_modulus_setup(N, p, limbs, int_rep); in mbedtls_test_read_mpi_modulus()
/third_party/mbedtls/scripts/mbedtls_dev/
Dbignum_common.py64 def bound_mpi_limbs(limbs: int, bits_in_limb: int) -> int:
66 bits = bits_in_limb * limbs
77 def hex_digits_for_limb(limbs: int, bits_in_limb: int) -> int:
79 return 2 * (limbs * bits_in_limb // 8)
140 def limbs(self) -> int: member in OperationCommon
145 return hex_digits_for_limb(self.limbs, self.bits_in_limb)
/third_party/node/deps/openssl/openssl/Configurations/
DREADME.md218 THIRTY_TWO_BIT bignum limbs are 32 bits,
225 BN_LLONG bignum limbs are 32 bits,
229 SIXTY_FOUR_BIT_LONG bignum limbs are 64 bits
231 SIXTY_FOUR_BIT bignums limbs are 64 bits,
/third_party/openssl/Configurations/
DREADME.md218 THIRTY_TWO_BIT bignum limbs are 32 bits,
225 BN_LLONG bignum limbs are 32 bits,
229 SIXTY_FOUR_BIT_LONG bignum limbs are 64 bits
231 SIXTY_FOUR_BIT bignums limbs are 64 bits,
/third_party/mbedtls/
DChangeLog408 when both operands are 0 and the left operand is represented with 0 limbs.
659 represented with 0 limbs (specifically mbedtls_mpi_mod_int() dividing
1265 * Fix a crash in mbedtls_mpi_debug_mpi on a bignum having 0 limbs. This
1276 A=0 represented with 0 limbs. Up to and including Mbed TLS 2.26, this bug
1319 mbedtls_mpi_read_string() now construct an mbedtls_mpi object with 0 limbs
1406 |A| - |B| where |B| is larger than |A| and has more limbs (so the
4283 big-endian platform when size was not an integer number of limbs
4713 big-endian platform when size was not an integer number of limbs

12