/* Encode a point. This method assumes that the point is correct and is not the point at infinity. Encoded size is always 1+2*plen, where plen is the field modulus length, in bytes.  */
static void point_encode(void *dst, const jacobian *P, const curve_params *cc)
/* Encode a point. This method assumes that the point is correct and is not the point at infinity. Encoded size is always 1+2*plen, where plen is the field modulus length, in bytes.  */
static void point_encode(void *dst, const jacobian *P, const curve_params *cc)
{
	unsigned char *buf;
	uint32_t xbl;
	size_t plen;
	jacobian Q, T;
	buf = dst;
	xbl = cc->p[0];
	xbl -= (xbl >> 5);
	plen = (xbl + 7) >> 3;
	buf[0] = 0x04;
	memcpy(&Q, P, sizeof *P);
	set_one(T.c[2], cc->p);
	run_code(&Q, &T, cc, code_affine);
	br_i31_encode(buf + 1, plen, Q.c[0]);
	br_i31_encode(buf + 1 + plen, plen, Q.c[1]);
}