@@ -166,6 +166,17 @@ void decaf_scalar_mul ( | |||||
const decaf_scalar_t b | const decaf_scalar_t b | ||||
) API_VIS NONNULL3; | ) API_VIS NONNULL3; | ||||
/** | |||||
* @brief Copy a scalar. The scalars may use the same memory, in which | |||||
* case this function does nothing. | |||||
* @param [in] a A scalar. | |||||
* @param [out] out Will become a copy of a. | |||||
*/ | |||||
void decaf_scalar_copy ( | |||||
decaf_scalar_t out, | |||||
const decaf_scalar_t a | |||||
) API_VIS NONNULL2; | |||||
/** | /** | ||||
* @brief Encode a point as a sequence of bytes. | * @brief Encode a point as a sequence of bytes. | ||||
* | * | ||||
@@ -316,6 +316,16 @@ void decaf_scalar_add ( | |||||
decaf_subx(out, out->limb, decaf_scalar_p, decaf_scalar_p, chain); | decaf_subx(out, out->limb, decaf_scalar_p, decaf_scalar_p, chain); | ||||
} | } | ||||
void decaf_scalar_copy ( | |||||
decaf_scalar_t out, | |||||
const decaf_scalar_t a | |||||
) { | |||||
unsigned int i; | |||||
for (i=0; i<DECAF_SCALAR_LIMBS; i++) { | |||||
out->limb[i] = a->limb[i]; | |||||
} | |||||
} | |||||
decaf_bool_t decaf_scalar_eq ( | decaf_bool_t decaf_scalar_eq ( | ||||
const decaf_scalar_t a, | const decaf_scalar_t a, | ||||
const decaf_scalar_t b | const decaf_scalar_t b | ||||