Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar.h
Show All 33 Lines | |||||
/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`. | /** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`. | ||||
* In: bin: pointer to a 32-byte array. | * In: bin: pointer to a 32-byte array. | ||||
* Out: r: scalar to be set. | * Out: r: scalar to be set. | ||||
* overflow: non-zero if the scalar was bigger or equal to `n` before reduction, zero otherwise (can be NULL). | * overflow: non-zero if the scalar was bigger or equal to `n` before reduction, zero otherwise (can be NULL). | ||||
*/ | */ | ||||
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow); | static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow); | ||||
/** Set a scalar from a big endian byte array and returns 1 if it is a valid | |||||
* seckey and 0 otherwise. */ | |||||
static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned char *bin); | |||||
/** Set a scalar to an unsigned integer. */ | /** Set a scalar to an unsigned integer. */ | ||||
static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v); | static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v); | ||||
/** Convert a scalar to a byte array. */ | /** Convert a scalar to a byte array. */ | ||||
static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a); | static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a); | ||||
/** Add two scalars together (modulo the group order). Returns whether it overflowed. */ | /** Add two scalars together (modulo the group order). Returns whether it overflowed. */ | ||||
static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); | static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |