mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Optimize some case of mbedtls_ecp_muladd()
Those are used by EC-JPAKE
This commit is contained in:
		
							parent
							
								
									cb7cd03412
								
							
						
					
					
						commit
						1a7c5ef42b
					
				@ -1697,8 +1697,17 @@ int mbedtls_ecp_muladd( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
 | 
			
		||||
 | 
			
		||||
    mbedtls_ecp_point_init( &mP );
 | 
			
		||||
 | 
			
		||||
    /* Optimize some simple special cases */
 | 
			
		||||
    if( mbedtls_mpi_cmp_int( m, 1 ) == 0 )
 | 
			
		||||
        MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &mP, P ) );
 | 
			
		||||
    else
 | 
			
		||||
        MBEDTLS_MPI_CHK( mbedtls_ecp_mul( grp, &mP, m, P, NULL, NULL ) );
 | 
			
		||||
 | 
			
		||||
    if( mbedtls_mpi_cmp_int( n, 1 ) == 0 )
 | 
			
		||||
        MBEDTLS_MPI_CHK( mbedtls_ecp_copy( R, Q ) );
 | 
			
		||||
    else
 | 
			
		||||
        MBEDTLS_MPI_CHK( mbedtls_ecp_mul( grp, R,   n, Q, NULL, NULL ) );
 | 
			
		||||
 | 
			
		||||
    MBEDTLS_MPI_CHK( ecp_add_mixed( grp, R, &mP, R ) );
 | 
			
		||||
    MBEDTLS_MPI_CHK( ecp_normalize_jac( grp, R ) );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user