ext/lib/crypto/tinycrypt/source/ecc.c
/*
 * Elliptic curve scalar multiplication with result in Jacobi coordinates:
 *
 * p_result = p_scalar * p_point.
 */
Elliptic curve scalar multiplication with result in Jacobi coordinates:
p_result = p_scalar * p_point.
Elliptic curve scalar multiplication with result in Jacobi coordinates : p_result = p_scalar * p_point .
void EccPoint_mult_safe(EccPointJacobi *p_result, EccPoint *p_point, uint32_t *p_scalar)
{
	int32_t i;
	uint32_t bit;
	EccPointJacobi p_point_jacobi, p_tmp;
	EccPoint_fromAffine(p_result, p_point);
	EccPoint_fromAffine(&p_point_jacobi, p_point);
	for (i = vli_numBits(p_scalar) - 2; i >= 0; i--) {
		EccPoint_double(p_result);
		EccPointJacobi_set(&p_tmp, p_result);
		EccPoint_add(&p_tmp, &p_point_jacobi);
		bit = vli_testBit(p_scalar, i);
		vli_cond_set(p_result->X, p_tmp.X, p_result->X, bit);
		vli_cond_set(p_result->Y, p_tmp.Y, p_result->Y, bit);
		vli_cond_set(p_result->Z, p_tmp.Z, p_result->Z, bit);
	}
}
void EccPoint_mult_safe ( EccPointJacobi * p_result , EccPoint * p_point , uint32_t * p_scalar ) { int32_t i ; uint32_t bit ; EccPointJacobi p_point_jacobi , p_tmp ; EccPoint_fromAffine ( p_result , p_point ) ; EccPoint_fromAffine ( & p_point_jacobi , p_point ) ; for ( i = vli_numBits ( p_scalar ) - 2 ; i >= 0 ; i -- ) { EccPoint_double ( p_result ) ; EccPointJacobi_set ( & p_tmp , p_result ) ; EccPoint_add ( & p_tmp , & p_point_jacobi ) ; bit = vli_testBit ( p_scalar , i ) ; vli_cond_set ( p_result -> X , p_tmp . X , p_result -> X , bit ) ; vli_cond_set ( p_result -> Y , p_tmp . Y , p_result -> Y , bit ) ; vli_cond_set ( p_result -> Z , p_tmp . Z , p_result -> Z , bit ) ; } }
Elliptic curve scalar multiplication with result in Jacobi coordinates:
 p_result = p_scalar * p_point.
Elliptic curve scalar multiplication with result in Jacobi coordinates : p_result = p_scalar * p_point .