Lines Matching refs:radix

407 static int mpi_get_digit( mbedtls_mpi_uint *d, int radix, char c )  in mpi_get_digit()  argument
415 if( *d >= (mbedtls_mpi_uint) radix ) in mpi_get_digit()
424 int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s ) in mbedtls_mpi_read_string() argument
431 if( radix < 2 || radix > 16 ) in mbedtls_mpi_read_string()
438 if( radix == 16 ) in mbedtls_mpi_read_string()
456 MBEDTLS_MPI_CHK( mpi_get_digit( &d, radix, s[i - 1] ) ); in mbedtls_mpi_read_string()
472 MBEDTLS_MPI_CHK( mpi_get_digit( &d, radix, s[i] ) ); in mbedtls_mpi_read_string()
473 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_int( &T, X, radix ) ); in mbedtls_mpi_read_string()
496 static int mpi_write_hlp( mbedtls_mpi *X, int radix, char **p ) in mpi_write_hlp() argument
501 if( radix < 2 || radix > 16 ) in mpi_write_hlp()
504 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_int( &r, X, radix ) ); in mpi_write_hlp()
505 MBEDTLS_MPI_CHK( mbedtls_mpi_div_int( X, NULL, X, radix ) ); in mpi_write_hlp()
508 MBEDTLS_MPI_CHK( mpi_write_hlp( X, radix, p ) ); in mpi_write_hlp()
523 int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix, in mbedtls_mpi_write_string() argument
531 if( radix < 2 || radix > 16 ) 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()
551 if( radix == 16 ) in mbedtls_mpi_write_string()
578 MBEDTLS_MPI_CHK( mpi_write_hlp( &T, radix, &p ) ); in mbedtls_mpi_write_string()
595 int mbedtls_mpi_read_file( mbedtls_mpi *X, int radix, FILE *fin ) in mbedtls_mpi_read_file() argument
619 if( mpi_get_digit( &d, radix, *p ) != 0 ) in mbedtls_mpi_read_file()
622 return( mbedtls_mpi_read_string( X, radix, p + 1 ) ); in mbedtls_mpi_read_file()
628 int mbedtls_mpi_write_file( const char *p, const mbedtls_mpi *X, int radix, FILE *fout ) in mbedtls_mpi_write_file() argument
640 MBEDTLS_MPI_CHK( mbedtls_mpi_write_string( X, radix, s, sizeof( s ) - 2, &n ) ); in mbedtls_mpi_write_file()
1228 const mbedtls_mpi_uint radix = (mbedtls_mpi_uint) 1 << biH; in mbedtls_int_div_int()
1285 while( q1 >= radix || ( q1 * d0 > radix * r0 + u0_msw ) ) in mbedtls_int_div_int()
1290 if ( r0 >= radix ) break; in mbedtls_int_div_int()
1293 rAX = ( u1 * radix ) + ( u0_msw - q1 * d ); in mbedtls_int_div_int()
1297 while( q0 >= radix || ( q0 * d0 > radix * r0 + u0_lsw ) ) in mbedtls_int_div_int()
1302 if ( r0 >= radix ) break; in mbedtls_int_div_int()
1306 *r = ( rAX * radix + u0_lsw - q0 * d ) >> s; in mbedtls_int_div_int()
1308 quotient = q1 * radix + q0; in mbedtls_int_div_int()