Lines Matching refs:n

62 static void mbedtls_mpi_zeroize( mbedtls_mpi_uint *v, size_t n ) {  in mbedtls_mpi_zeroize()  argument
63 volatile mbedtls_mpi_uint *p = v; while( n-- ) *p++ = 0; in mbedtls_mpi_zeroize()
88 X->n = 0; in mbedtls_mpi_init()
102 mbedtls_mpi_zeroize( X->p, X->n ); in mbedtls_mpi_free()
107 X->n = 0; in mbedtls_mpi_free()
121 if( X->n < nblimbs ) in mbedtls_mpi_grow()
128 memcpy( p, X->p, X->n * ciL ); in mbedtls_mpi_grow()
129 mbedtls_mpi_zeroize( X->p, X->n ); in mbedtls_mpi_grow()
133 X->n = nblimbs; in mbedtls_mpi_grow()
150 if( X->n <= nblimbs ) in mbedtls_mpi_shrink()
153 for( i = X->n - 1; i > 0; i-- ) in mbedtls_mpi_shrink()
167 mbedtls_mpi_zeroize( X->p, X->n ); in mbedtls_mpi_shrink()
171 X->n = i; in mbedtls_mpi_shrink()
194 for( i = Y->n - 1; i > 0; i-- ) in mbedtls_mpi_copy()
203 memset( X->p, 0, X->n * ciL ); in mbedtls_mpi_copy()
236 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( X, Y->n ) ); in mbedtls_mpi_safe_cond_assign()
240 for( i = 0; i < Y->n; i++ ) in mbedtls_mpi_safe_cond_assign()
243 for( ; i < X->n; i++ ) in mbedtls_mpi_safe_cond_assign()
268 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( X, Y->n ) ); in mbedtls_mpi_safe_cond_swap()
269 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( Y, X->n ) ); in mbedtls_mpi_safe_cond_swap()
276 for( i = 0; i < X->n; i++ ) in mbedtls_mpi_safe_cond_swap()
295 memset( X->p, 0, X->n * ciL ); in mbedtls_mpi_lset()
310 if( X->n * biL <= pos ) in mbedtls_mpi_get_bit()
328 if( X->n * biL <= pos ) in mbedtls_mpi_set_bit()
351 for( i = 0; i < X->n; i++ ) in mbedtls_mpi_lsb()
384 if( X->n == 0 ) in mbedtls_mpi_bitlen()
387 for( i = X->n - 1; i > 0; i-- ) in mbedtls_mpi_bitlen()
427 size_t i, j, slen, n; in mbedtls_mpi_read_string() local
443 n = BITS_TO_LIMBS( slen << 2 ); in mbedtls_mpi_read_string()
445 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( X, n ) ); in mbedtls_mpi_read_string()
527 size_t n; in mbedtls_mpi_write_string() local
534 n = mbedtls_mpi_bitlen( X ); in mbedtls_mpi_write_string()
535 if( radix >= 4 ) n >>= 1; in mbedtls_mpi_write_string()
536 if( radix >= 16 ) n >>= 1; in mbedtls_mpi_write_string()
537 n += 3; in mbedtls_mpi_write_string()
539 if( buflen < n ) in mbedtls_mpi_write_string()
541 *olen = n; in mbedtls_mpi_write_string()
556 for( i = X->n, k = 0; i > 0; i-- ) in mbedtls_mpi_write_string()
631 size_t n, slen, plen; in mbedtls_mpi_write_file() local
640 MBEDTLS_MPI_CHK( mbedtls_mpi_write_string( X, radix, s, sizeof( s ) - 2, &n ) ); in mbedtls_mpi_write_file()
670 size_t i, j, n; in mbedtls_mpi_read_binary() local
672 for( n = 0; n < buflen; n++ ) in mbedtls_mpi_read_binary()
673 if( buf[n] != 0 ) in mbedtls_mpi_read_binary()
676 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( X, CHARS_TO_LIMBS( buflen - n ) ) ); in mbedtls_mpi_read_binary()
679 for( i = buflen, j = 0; i > n; i--, j++ ) in mbedtls_mpi_read_binary()
692 size_t i, j, n; in mbedtls_mpi_write_binary() local
694 n = mbedtls_mpi_size( X ); in mbedtls_mpi_write_binary()
696 if( buflen < n ) in mbedtls_mpi_write_binary()
701 for( i = buflen - 1, j = 0; n > 0; i--, j++, n-- ) in mbedtls_mpi_write_binary()
721 if( X->n * biL < i ) in mbedtls_mpi_shift_l()
731 for( i = X->n; i > v0; i-- ) in mbedtls_mpi_shift_l()
743 for( i = v0; i < X->n; i++ ) in mbedtls_mpi_shift_l()
768 if( v0 > X->n || ( v0 == X->n && v1 > 0 ) ) in mbedtls_mpi_shift_r()
776 for( i = 0; i < X->n - v0; i++ ) in mbedtls_mpi_shift_r()
779 for( ; i < X->n; i++ ) in mbedtls_mpi_shift_r()
788 for( i = X->n; i > 0; i-- ) in mbedtls_mpi_shift_r()
807 for( i = X->n; i > 0; i-- ) in mbedtls_mpi_cmp_abs()
811 for( j = Y->n; j > 0; j-- ) in mbedtls_mpi_cmp_abs()
837 for( i = X->n; i > 0; i-- ) in mbedtls_mpi_cmp_mpi()
841 for( j = Y->n; j > 0; j-- ) in mbedtls_mpi_cmp_mpi()
873 Y.n = 1; in mbedtls_mpi_cmp_int()
901 for( j = B->n; j > 0; j-- ) in mbedtls_mpi_add_abs()
921 if( i >= X->n ) in mbedtls_mpi_add_abs()
938 static void mpi_sub_hlp( size_t n, mbedtls_mpi_uint *s, mbedtls_mpi_uint *d ) in mpi_sub_hlp() argument
943 for( i = c = 0; i < n; i++, s++, d++ ) in mpi_sub_hlp()
963 size_t n; in mbedtls_mpi_sub_abs() local
986 for( n = B->n; n > 0; n-- ) in mbedtls_mpi_sub_abs()
987 if( B->p[n - 1] != 0 ) in mbedtls_mpi_sub_abs()
990 mpi_sub_hlp( n, B->p, X->p ); in mbedtls_mpi_sub_abs()
1071 _B.n = 1; in mbedtls_mpi_add_int()
1087 _B.n = 1; in mbedtls_mpi_sub_int()
1179 for( i = A->n; i > 0; i-- ) in mbedtls_mpi_mul_mpi()
1183 for( j = B->n; j > 0; j-- ) in mbedtls_mpi_mul_mpi()
1211 _B.n = 1; in mbedtls_mpi_mul_int()
1320 size_t i, n, t, k; in mbedtls_mpi_div_mpi() local
1340 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( &Z, A->n + 2 ) ); in mbedtls_mpi_div_mpi()
1354 n = X.n - 1; in mbedtls_mpi_div_mpi()
1355 t = Y.n - 1; in mbedtls_mpi_div_mpi()
1356 MBEDTLS_MPI_CHK( mbedtls_mpi_shift_l( &Y, biL * ( n - t ) ) ); in mbedtls_mpi_div_mpi()
1360 Z.p[n - t]++; in mbedtls_mpi_div_mpi()
1363 MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &Y, biL * ( n - t ) ) ); in mbedtls_mpi_div_mpi()
1365 for( i = n; i > t ; i-- ) in mbedtls_mpi_div_mpi()
1439 _B.n = 1; in mbedtls_mpi_div_int()
1500 for( i = A->n, y = 0; i > 0; i-- ) in mbedtls_mpi_mod_int()
1548 size_t i, n, m; in mpi_montmul() local
1551 if( T->n < N->n + 1 || T->p == NULL ) in mpi_montmul()
1554 memset( T->p, 0, T->n * ciL ); in mpi_montmul()
1557 n = N->n; in mpi_montmul()
1558 m = ( B->n < n ) ? B->n : n; in mpi_montmul()
1560 for( i = 0; i < n; i++ ) in mpi_montmul()
1569 mpi_mul_hlp( n, N->p, d, u1 ); in mpi_montmul()
1571 *d++ = u0; d[n + 1] = 0; in mpi_montmul()
1574 memcpy( A->p, d, ( n + 1 ) * ciL ); in mpi_montmul()
1577 mpi_sub_hlp( n, N->p, A->p ); in mpi_montmul()
1580 mpi_sub_hlp( n, A->p, T->p ); in mpi_montmul()
1593 U.n = U.s = (int) z; in mpi_montred()
1634 j = N->n + 1; in mbedtls_mpi_exp_mod()
1656 MBEDTLS_MPI_CHK( mbedtls_mpi_shift_l( &RR, N->n * 2 * biL ) ); in mbedtls_mpi_exp_mod()
1688 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( &W[j], N->n + 1 ) ); in mbedtls_mpi_exp_mod()
1699 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( &W[i], N->n + 1 ) ); in mbedtls_mpi_exp_mod()
1706 nblimbs = E->n; in mbedtls_mpi_exp_mod()
2046 size_t i, j, k, n, s; in mpi_miller_rabin() local
2065 n = ( ( i >= 1300 ) ? 2 : ( i >= 850 ) ? 3 : in mpi_miller_rabin()
2069 for( i = 0; i < n; i++ ) in mpi_miller_rabin()
2074 MBEDTLS_MPI_CHK( mbedtls_mpi_fill_random( &A, X->n * ciL, f_rng, p_rng ) ); in mpi_miller_rabin()
2085 MBEDTLS_MPI_CHK( mbedtls_mpi_fill_random( &A, X->n * ciL, f_rng, p_rng ) ); in mpi_miller_rabin()
2153 XX.n = X->n; in mbedtls_mpi_is_prime()
2182 size_t k, n; in mbedtls_mpi_gen_prime() local
2191 n = BITS_TO_LIMBS( nbits ); in mbedtls_mpi_gen_prime()
2193 MBEDTLS_MPI_CHK( mbedtls_mpi_fill_random( X, n * ciL, f_rng, p_rng ) ); in mbedtls_mpi_gen_prime()