Fix performance of ec_mul and ec_simul_gen