Lines Matching refs:s
87 X->s = 1; in mbedtls_mpi_init()
106 X->s = 1; in mbedtls_mpi_free()
199 X->s = Y->s; in mbedtls_mpi_copy()
238 X->s = X->s * ( 1 - assign ) + Y->s * assign; in mbedtls_mpi_safe_cond_assign()
258 int ret, s; in mbedtls_mpi_safe_cond_swap() local
271 s = X->s; in mbedtls_mpi_safe_cond_swap()
272 X->s = X->s * ( 1 - swap ) + Y->s * swap; in mbedtls_mpi_safe_cond_swap()
273 Y->s = Y->s * ( 1 - swap ) + s * swap; in mbedtls_mpi_safe_cond_swap()
298 X->s = ( z < 0 ) ? -1 : 1; in mbedtls_mpi_lset()
424 int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s ) in mbedtls_mpi_read_string() argument
436 slen = strlen( s ); in mbedtls_mpi_read_string()
450 if( i == 1 && s[i - 1] == '-' ) in mbedtls_mpi_read_string()
452 X->s = -1; in mbedtls_mpi_read_string()
456 MBEDTLS_MPI_CHK( mpi_get_digit( &d, radix, s[i - 1] ) ); in mbedtls_mpi_read_string()
466 if( i == 0 && s[i] == '-' ) in mbedtls_mpi_read_string()
468 X->s = -1; in mbedtls_mpi_read_string()
472 MBEDTLS_MPI_CHK( mpi_get_digit( &d, radix, s[i] ) ); in mbedtls_mpi_read_string()
475 if( X->s == 1 ) in mbedtls_mpi_read_string()
548 if( X->s == -1 ) in mbedtls_mpi_write_string()
575 if( T.s == -1 ) in mbedtls_mpi_write_string()
576 T.s = 1; in mbedtls_mpi_write_string()
604 char s[ MBEDTLS_MPI_RW_BUFFER_SIZE ]; in mbedtls_mpi_read_file() local
606 memset( s, 0, sizeof( s ) ); in mbedtls_mpi_read_file()
607 if( fgets( s, sizeof( s ) - 1, fin ) == NULL ) in mbedtls_mpi_read_file()
610 slen = strlen( s ); in mbedtls_mpi_read_file()
611 if( slen == sizeof( s ) - 2 ) in mbedtls_mpi_read_file()
614 if( s[slen - 1] == '\n' ) { slen--; s[slen] = '\0'; } in mbedtls_mpi_read_file()
615 if( s[slen - 1] == '\r' ) { slen--; s[slen] = '\0'; } in mbedtls_mpi_read_file()
617 p = s + slen; in mbedtls_mpi_read_file()
618 while( --p >= s ) in mbedtls_mpi_read_file()
636 char s[ MBEDTLS_MPI_RW_BUFFER_SIZE ]; in mbedtls_mpi_write_file() local
638 memset( s, 0, sizeof( s ) ); in mbedtls_mpi_write_file()
640 MBEDTLS_MPI_CHK( mbedtls_mpi_write_string( X, radix, s, sizeof( s ) - 2, &n ) ); in mbedtls_mpi_write_file()
645 slen = strlen( s ); in mbedtls_mpi_write_file()
646 s[slen++] = '\r'; in mbedtls_mpi_write_file()
647 s[slen++] = '\n'; in mbedtls_mpi_write_file()
652 fwrite( s, 1, slen, fout ) != slen ) in mbedtls_mpi_write_file()
656 mbedtls_printf( "%s%s", p, s ); in mbedtls_mpi_write_file()
848 if( i > j ) return( X->s ); in mbedtls_mpi_cmp_mpi()
849 if( j > i ) return( -Y->s ); in mbedtls_mpi_cmp_mpi()
851 if( X->s > 0 && Y->s < 0 ) return( 1 ); in mbedtls_mpi_cmp_mpi()
852 if( Y->s > 0 && X->s < 0 ) return( -1 ); in mbedtls_mpi_cmp_mpi()
856 if( X->p[i - 1] > Y->p[i - 1] ) return( X->s ); in mbedtls_mpi_cmp_mpi()
857 if( X->p[i - 1] < Y->p[i - 1] ) return( -X->s ); in mbedtls_mpi_cmp_mpi()
872 Y.s = ( z < 0 ) ? -1 : 1; in mbedtls_mpi_cmp_int()
899 X->s = 1; 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()
946 c = ( *d < *s ) + z; *d -= *s; in mpi_sub_hlp()
982 X->s = 1; in mbedtls_mpi_sub_abs()
1004 int ret, s = A->s; in mbedtls_mpi_add_mpi() local
1006 if( A->s * B->s < 0 ) in mbedtls_mpi_add_mpi()
1011 X->s = s; in mbedtls_mpi_add_mpi()
1016 X->s = -s; in mbedtls_mpi_add_mpi()
1022 X->s = s; in mbedtls_mpi_add_mpi()
1035 int ret, s = A->s; in mbedtls_mpi_sub_mpi() local
1037 if( A->s * B->s > 0 ) in mbedtls_mpi_sub_mpi()
1042 X->s = s; in mbedtls_mpi_sub_mpi()
1047 X->s = -s; in mbedtls_mpi_sub_mpi()
1053 X->s = s; in mbedtls_mpi_sub_mpi()
1070 _B.s = ( b < 0 ) ? -1 : 1; in mbedtls_mpi_add_int()
1086 _B.s = ( b < 0 ) ? -1 : 1; in mbedtls_mpi_sub_int()
1104 void mpi_mul_hlp( size_t i, mbedtls_mpi_uint *s, mbedtls_mpi_uint *d, mbedtls_mpi_uint b ) in mpi_mul_hlp() argument
1193 X->s = A->s * B->s; in mbedtls_mpi_mul_mpi()
1210 _B.s = 1; in mbedtls_mpi_mul_int()
1232 size_t s; in mbedtls_int_div_int()
1266 s = mbedtls_clz( d ); in mbedtls_int_div_int()
1267 d = d << s; in mbedtls_int_div_int()
1269 u1 = u1 << s; in mbedtls_int_div_int()
1270 u1 |= ( u0 >> ( biL - s ) ) & ( -(mbedtls_mpi_sint)s >> ( biL - 1 ) ); in mbedtls_int_div_int()
1271 u0 = u0 << s; in mbedtls_int_div_int()
1306 *r = ( rAX * radix + u0_lsw - q0 * d ) >> s; in mbedtls_int_div_int()
1338 X.s = Y.s = 1; in mbedtls_mpi_div_mpi()
1408 Q->s = A->s * B->s; in mbedtls_mpi_div_mpi()
1414 X.s = A->s; in mbedtls_mpi_div_mpi()
1418 R->s = 1; in mbedtls_mpi_div_mpi()
1438 _B.s = ( b < 0 ) ? -1 : 1; in mbedtls_mpi_div_int()
1517 if( A->s < 0 && y != 0 ) in mbedtls_mpi_mod_int()
1593 U.n = U.s = (int) z; in mpi_montred()
1642 neg = ( A->s == -1 ); in mbedtls_mpi_exp_mod()
1646 Apos.s = 1; in mbedtls_mpi_exp_mod()
1790 X->s = -1; in mbedtls_mpi_exp_mod()
1830 TA.s = TB.s = 1; in mbedtls_mpi_gcd()
2046 size_t i, j, k, n, s; in mpi_miller_rabin() local
2057 s = mbedtls_mpi_lsb( &W ); in mpi_miller_rabin()
2059 MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &R, s ) ); in mpi_miller_rabin()
2110 while( j < s && mbedtls_mpi_cmp_mpi( &A, &W ) != 0 ) in mpi_miller_rabin()
2152 XX.s = 1; in mbedtls_mpi_is_prime()