Skip to content

Commit

Permalink
Correct math typos in field_*.h
Browse files Browse the repository at this point in the history
  • Loading branch information
roconnor-blockstream committed Jul 6, 2018
1 parent 4efb3f8 commit deff5ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/field_10x26.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <stdint.h>

typedef struct {
/* X = sum(i=0..9, elem[i]*2^26) mod n */
/* X = sum(i=0..9, n[i]*2^(i*26)) mod p
* where p = 2^256 - 0x1000003D1
*/
uint32_t n[10];
#ifdef VERIFY
int magnitude;
Expand Down
3 changes: 2 additions & 1 deletion src/field_10x26_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t
VERIFY_BITS(b[9], 26);

/** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n.
* px is a shorthand for sum(a[i]*b[x-i], i=0..x).
* for 0 <= x <= 9, px is a shorthand for sum(a[i]*b[x-i], i=0..x).
* for 9 <= x <= 18, px is a shorthand for sum(a[i]*b[x-i], i=(x-9)..9)
* Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0].
*/

Expand Down
4 changes: 3 additions & 1 deletion src/field_5x52.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <stdint.h>

typedef struct {
/* X = sum(i=0..4, elem[i]*2^52) mod n */
/* X = sum(i=0..4, n[i]*2^(i*52)) mod p
* where p = 2^256 - 0x1000003D1
*/
uint64_t n[5];
#ifdef VERIFY
int magnitude;
Expand Down
3 changes: 2 additions & 1 deletion src/field_5x52_int128_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t
VERIFY_CHECK(a != b);

/* [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n.
* px is a shorthand for sum(a[i]*b[x-i], i=0..x).
* for 0 <= x <= 4, px is a shorthand for sum(a[i]*b[x-i], i=0..x).
* for 4 <= x <= 8, px is a shorthand for sum(a[i]*b[x-i], i=(x-4)..4)
* Note that [x 0 0 0 0 0] = [x*R].
*/

Expand Down

0 comments on commit deff5ed

Please sign in to comment.