Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: "safegcd" field and scalar inversion #767

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9fbe485
"safegcd" field and scalar inversion
peterdettman Jul 15, 2020
4fab082
Fix secp256k1_scalar_is_even/scalar_low issue
peterdettman Jul 15, 2020
0b90a57
TODOs and comments
peterdettman Jul 16, 2020
0c3869a
VERIFY_CHECK _divsteps_62 loop invariant
peterdettman Jul 18, 2020
11b525c
More checks and comments
peterdettman Jul 21, 2020
3ae7179
Update f,g at full length until proper analysis
peterdettman Jul 21, 2020
2f643ad
Initial 32bit safegcd
peterdettman Jul 21, 2020
b29e51e
Minor cleanup
peterdettman Jul 27, 2020
3519dcc
Initial _inv_var implementations
peterdettman Jul 27, 2020
bd18471
Simplify type of 'eta'
peterdettman Jul 31, 2020
b8c7390
field_5x52: update Bézout coefficients on-the-fly
peterdettman Aug 8, 2020
64a4912
field_10x26: update Bézout coefficients on-the-fly
peterdettman Aug 8, 2020
e5f2d29
scalar_4x64: update Bézout coefficients on-the-fly
peterdettman Aug 8, 2020
34bec40
scalar_8x32: update Bézout coefficients on-the-fly
peterdettman Aug 8, 2020
bfd7a0f
Alternate var-time divsteps code
peterdettman Aug 9, 2020
f873c3b
Add comments regarding small inputs
peterdettman Aug 9, 2020
17982d8
Avoid left shift of signed values
peterdettman Aug 9, 2020
06d568a
Add alternative to __builtin_ctz intrinsics
peterdettman Aug 9, 2020
16509ca
Write primes in signed-digit form
peterdettman Aug 9, 2020
40c815e
Unify _update_de_ methods
peterdettman Aug 9, 2020
dc58f4f
Redo update_de methods
peterdettman Aug 10, 2020
132c76d
Faster 64bit _inv_var, why not?
peterdettman Aug 11, 2020
2f6dfa2
Get better control over the range of d, e
peterdettman Aug 12, 2020
90743d2
Verify the expected zeros are produced
peterdettman Aug 13, 2020
5de2c83
_inv_var conditional negations
peterdettman Aug 13, 2020
308fd32
Experiment with f,g shortening in inv_var
peterdettman Aug 15, 2020
ff0cf11
f,g shortening for 64bit field
peterdettman Aug 15, 2020
b51a1b5
THIS_IS_FASTER
peterdettman Aug 16, 2020
1baff2c
Accentuate the positive
peterdettman Aug 16, 2020
65550c1
Try 128 byte table of inverses
peterdettman Aug 17, 2020
5ccfc30
Avoid redundant calculation
peterdettman Aug 25, 2020
cbd2d57
Faster const-time divsteps
peterdettman Sep 9, 2020
85da7a9
Rework _update_de I/O bounds
peterdettman Nov 10, 2020
c9b7717
Rework _update_de for 32bit
peterdettman Nov 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
482 changes: 482 additions & 0 deletions src/field_10x26_impl.h

Large diffs are not rendered by default.

456 changes: 456 additions & 0 deletions src/field_5x52_impl.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/field_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a) {
return secp256k1_fe_equal(&t1, a);
}

#if defined(SECP256K1_FE_INV_DEFAULT)
static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a) {
secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1;
int j;
Expand Down Expand Up @@ -225,7 +226,9 @@ static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a) {
}
secp256k1_fe_mul(r, a, &t1);
}
#endif

#if defined(SECP256K1_FE_INV_VAR_DEFAULT)
static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a) {
#if defined(USE_FIELD_INV_BUILTIN)
secp256k1_fe_inv(r, a);
Expand Down Expand Up @@ -262,6 +265,7 @@ static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a) {
#error "Please select field inverse implementation"
#endif
}
#endif

static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len) {
secp256k1_fe u;
Expand Down
Loading