mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Fix ECDH secret export for Mongomery curves
We only switched to little endian for Curve25519, but all Montgomery curves require little endian byte order.
This commit is contained in:
		
							parent
							
								
									bf42408528
								
							
						
					
					
						commit
						52ff8e9387
					
				@ -638,7 +638,7 @@ static int ecdh_calc_secret_internal( mbedtls_ecdh_context_mbed *ctx,
 | 
			
		||||
 | 
			
		||||
    *olen = ctx->grp.pbits / 8 + ( ( ctx->grp.pbits % 8 ) != 0 );
 | 
			
		||||
 | 
			
		||||
    if( ctx->grp.id == MBEDTLS_ECP_DP_CURVE25519 )
 | 
			
		||||
    if( mbedtls_ecp_get_type( &ctx->grp ) == MBEDTLS_ECP_TYPE_MONTGOMERY )
 | 
			
		||||
        return mbedtls_mpi_write_binary_le( &ctx->z, buf, *olen );
 | 
			
		||||
 | 
			
		||||
    return mbedtls_mpi_write_binary( &ctx->z, buf, *olen );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user