Commit c08c4f48 authored by Michael Hamburg's avatar Michael Hamburg

scalar_copy

parent 5622eb97
......@@ -166,6 +166,17 @@ void decaf_scalar_mul (
const decaf_scalar_t b
) 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.
*
......
......@@ -316,6 +316,16 @@ void decaf_scalar_add (
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 (
const decaf_scalar_t a,
const decaf_scalar_t b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment