Skip to content

Commit 1b4d256

Browse files
committed
Merge bitcoin#713: Docstrings
dabfea7 field: extend docstring of secp256k1_fe_normalize (Marko Bencun) dc7d8fd scalar: extend docstring of secp256k1_scalar_set_b32 (Marko Bencun) Pull request description: ACKs for top commit: real-or-random: ACK dabfea7 jonasnick: ACK dabfea7 Tree-SHA512: aeed17dad281296e46d94007c864ba07f41a347525b049385a0a71640de84c3094bcc51d2fb4132b2a8f575acfe8ae53d7e28790bf328cac1892d040a9c50f70
2 parents 074ab58 + dabfea7 commit 1b4d256

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/field.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232

3333
#include "util.h"
3434

35-
/** Normalize a field element. */
35+
/** Normalize a field element. This brings the field element to a canonical representation, reduces
36+
* its magnitude to 1, and reduces it modulo field size `p`.
37+
*/
3638
static void secp256k1_fe_normalize(secp256k1_fe *r);
3739

38-
/** Weakly normalize a field element: reduce it magnitude to 1, but don't fully normalize. */
40+
/** Weakly normalize a field element: reduce its magnitude to 1, but don't fully normalize. */
3941
static void secp256k1_fe_normalize_weak(secp256k1_fe *r);
4042

4143
/** Normalize a field element, without constant-time guarantee. */

src/scalar.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigne
3232
/** Access bits from a scalar. Not constant time. */
3333
static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
3434

35-
/** Set a scalar from a big endian byte array. */
35+
/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`.
36+
* In: bin: pointer to a 32-byte array.
37+
* Out: r: scalar to be set.
38+
* overflow: non-zero if the scalar was bigger or equal to `n` before reduction, zero otherwise (can be NULL).
39+
*/
3640
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow);
3741

3842
/** Set a scalar to an unsigned integer. */

0 commit comments

Comments
 (0)