Lines Matching refs:pt
271 void mbedtls_ecp_point_init( mbedtls_ecp_point *pt ) in mbedtls_ecp_point_init() argument
273 if( pt == NULL ) in mbedtls_ecp_point_init()
276 mbedtls_mpi_init( &pt->X ); in mbedtls_ecp_point_init()
277 mbedtls_mpi_init( &pt->Y ); in mbedtls_ecp_point_init()
278 mbedtls_mpi_init( &pt->Z ); in mbedtls_ecp_point_init()
308 void mbedtls_ecp_point_free( mbedtls_ecp_point *pt ) in mbedtls_ecp_point_free() argument
310 if( pt == NULL ) in mbedtls_ecp_point_free()
313 mbedtls_mpi_free( &( pt->X ) ); in mbedtls_ecp_point_free()
314 mbedtls_mpi_free( &( pt->Y ) ); in mbedtls_ecp_point_free()
315 mbedtls_mpi_free( &( pt->Z ) ); in mbedtls_ecp_point_free()
386 int mbedtls_ecp_set_zero( mbedtls_ecp_point *pt ) in mbedtls_ecp_set_zero() argument
390 MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &pt->X , 1 ) ); in mbedtls_ecp_set_zero()
391 MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &pt->Y , 1 ) ); in mbedtls_ecp_set_zero()
392 MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &pt->Z , 0 ) ); in mbedtls_ecp_set_zero()
401 int mbedtls_ecp_is_zero( mbedtls_ecp_point *pt ) in mbedtls_ecp_is_zero() argument
403 return( mbedtls_mpi_cmp_int( &pt->Z, 0 ) == 0 ); in mbedtls_ecp_is_zero()
497 int mbedtls_ecp_point_read_binary( const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt, in mbedtls_ecp_point_read_binary() argument
509 return( mbedtls_ecp_set_zero( pt ) ); in mbedtls_ecp_point_read_binary()
522 MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &pt->X, buf + 1, plen ) ); in mbedtls_ecp_point_read_binary()
523 MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &pt->Y, buf + 1 + plen, plen ) ); in mbedtls_ecp_point_read_binary()
524 MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &pt->Z, 1 ) ); in mbedtls_ecp_point_read_binary()
536 int mbedtls_ecp_tls_read_point( const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt, in mbedtls_ecp_tls_read_point() argument
558 return mbedtls_ecp_point_read_binary( grp, pt, buf_start, data_len ); in mbedtls_ecp_tls_read_point()
567 int mbedtls_ecp_tls_write_point( const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt, in mbedtls_ecp_tls_write_point() argument
579 if( ( ret = mbedtls_ecp_point_write_binary( grp, pt, format, in mbedtls_ecp_tls_write_point()
743 static int ecp_normalize_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt ) in ecp_normalize_jac() argument
748 if( mbedtls_mpi_cmp_int( &pt->Z, 0 ) == 0 ) in ecp_normalize_jac()
756 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &Zi, &pt->Z, &grp->P ) ); in ecp_normalize_jac()
758 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->X, &pt->X, &ZZi ) ); MOD_MUL( pt->X ); in ecp_normalize_jac()
763 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->Y, &pt->Y, &ZZi ) ); MOD_MUL( pt->Y ); in ecp_normalize_jac()
764 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->Y, &pt->Y, &Zi ) ); MOD_MUL( pt->Y ); in ecp_normalize_jac()
769 MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &pt->Z, 1 ) ); in ecp_normalize_jac()
1078 static int ecp_randomize_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt, in ecp_randomize_jac() argument
1102 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->Z, &pt->Z, &l ) ); MOD_MUL( pt->Z ); in ecp_randomize_jac()
1106 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->X, &pt->X, &ll ) ); MOD_MUL( pt->X ); in ecp_randomize_jac()
1110 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &pt->Y, &pt->Y, &ll ) ); MOD_MUL( pt->Y ); in ecp_randomize_jac()
1641 static int ecp_check_pubkey_sw( const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt ) in ecp_check_pubkey_sw() argument
1647 if( mbedtls_mpi_cmp_int( &pt->X, 0 ) < 0 || in ecp_check_pubkey_sw()
1648 mbedtls_mpi_cmp_int( &pt->Y, 0 ) < 0 || in ecp_check_pubkey_sw()
1649 mbedtls_mpi_cmp_mpi( &pt->X, &grp->P ) >= 0 || in ecp_check_pubkey_sw()
1650 mbedtls_mpi_cmp_mpi( &pt->Y, &grp->P ) >= 0 ) in ecp_check_pubkey_sw()
1659 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &YY, &pt->Y, &pt->Y ) ); MOD_MUL( YY ); in ecp_check_pubkey_sw()
1660 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &RHS, &pt->X, &pt->X ) ); MOD_MUL( RHS ); in ecp_check_pubkey_sw()
1672 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &RHS, &RHS, &pt->X ) ); MOD_MUL( RHS ); in ecp_check_pubkey_sw()
1749 static int ecp_check_pubkey_mx( const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt ) in ecp_check_pubkey_mx() argument
1752 if( mbedtls_mpi_size( &pt->X ) > ( grp->nbits + 7 ) / 8 ) in ecp_check_pubkey_mx()
1762 int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt ) in mbedtls_ecp_check_pubkey() argument
1765 if( mbedtls_mpi_cmp_int( &pt->Z, 1 ) != 0 ) in mbedtls_ecp_check_pubkey()
1770 return( ecp_check_pubkey_mx( grp, pt ) ); in mbedtls_ecp_check_pubkey()
1774 return( ecp_check_pubkey_sw( grp, pt ) ); in mbedtls_ecp_check_pubkey()