Coding Enthusiast
3928b7c383
doc: improve secp256k1_fe_set_b32_mod doc
2023-12-08 14:58:38 +03:30
Sebastian Falbesoner
cf25c86d05
introduce and use SECP256K1_{FE,GE,GEJ}_VERIFY macros
...
By providing an uppercase variant of these verification functions, it is
better visible that it is test code and surrounding `#ifdef VERIFY`
blocks can be removed (if there is no other code around that could
remain in production mode), as they don't serve their purpose any more.
At some places intentional blank lines are inserted for grouping and
better readadbility.
2023-12-01 00:54:58 +01:00
siv2r
54058d16fe
field: remove secp256k1_fe_equal_var
...
`fe_equal_var` hits a fast path only when the inputs are unequal, which is
uncommon among its callers (public key parsing, ECDSA verify).
2023-08-16 17:39:25 +05:30
Peter Dettman
4e9661fc42
Add _fe_verify_magnitude (no-op unless VERIFY is enabled)
...
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-07-22 01:52:06 +02:00
Alejandro
b6b9834e8d
small fixes
...
restoring wycheproof files
restoring wycheproof files2
2023-07-03 17:05:55 +02:00
Tim Ruffing
3aef6ab8e1
Merge bitcoin-core/secp256k1#1345 : field: Static-assert that int args affecting magnitude are constant
...
be8ff3a02aeff87c60d49883a1b2afa8b2999bbe field: Static-assert that int args affecting magnitude are constant (Tim Ruffing)
Pull request description:
See #1001 .
Try to revert the lines in `tests.c` to see the error message in action.
ACKs for top commit:
sipa:
ACK be8ff3a02aeff87c60d49883a1b2afa8b2999bbe. Verified by introducing some non-constant expressions and seeing compilation fail.
theStack:
ACK be8ff3a02aeff87c60d49883a1b2afa8b2999bbe
Tree-SHA512: 8befec6ee64959cdc7f3e29b4b622410794cfaf69e9df8df17600390a93bc787dba5cf86239de6eb2e99c038b9aca5461e4b3c82f0e0c4cf066ad7c689941b19
2023-06-27 09:39:10 +02:00
Tim Ruffing
5779137457
field: Document return value of fe_sqrt()
...
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2023-06-21 00:18:24 +02:00
Tim Ruffing
be8ff3a02a
field: Static-assert that int args affecting magnitude are constant
...
See #1001 .
2023-06-13 13:34:49 +02:00
Sebastian Falbesoner
605e07e365
fix input range comment for secp256k1_fe_add_int
...
This seems to be a typo that was introduced with commit
4371f98346b0a50c0a77e93948fe5e21d9346d06 (PR #1066 ).
2023-06-01 02:55:12 +02:00
Pieter Wuille
31b4bbee1e
Make fe_cmov take max of magnitudes
2023-05-15 09:36:55 -04:00
Pieter Wuille
5b32602295
Split fe_set_b32 into reducing and normalizing variants
2023-05-11 13:49:33 -04:00
Pieter Wuille
4e176ad5b9
Abstract out verify logic for fe_is_square_var
2023-05-11 06:25:56 -04:00
Pieter Wuille
4371f98346
Abstract out verify logic for fe_add_int
2023-05-11 06:25:19 -04:00
Pieter Wuille
89e324c6b9
Abstract out verify logic for fe_half
2023-05-11 06:25:15 -04:00
Pieter Wuille
283cd80ab4
Abstract out verify logic for fe_get_bounds
2023-05-11 06:24:26 -04:00
Pieter Wuille
d5aa2f0358
Abstract out verify logic for fe_inv{,_var}
2023-05-11 06:24:26 -04:00
Pieter Wuille
3167646072
Abstract out verify logic for fe_from_storage
2023-05-11 06:24:26 -04:00
Pieter Wuille
76d31e5047
Abstract out verify logic for fe_to_storage
2023-05-11 06:24:26 -04:00
Pieter Wuille
1e6894bdd7
Abstract out verify logic for fe_cmov
2023-05-11 06:24:26 -04:00
Pieter Wuille
be82bd8e03
Improve comments/checks for fe_sqrt
2023-05-11 06:24:22 -04:00
Pieter Wuille
6ab35082ef
Abstract out verify logic for fe_sqr
2023-05-11 06:18:40 -04:00
Pieter Wuille
4c25f6efbd
Abstract out verify logic for fe_mul
2023-05-11 06:18:40 -04:00
Pieter Wuille
e179e651cb
Abstract out verify logic for fe_add
2023-05-11 06:18:40 -04:00
Pieter Wuille
7e7ad7ff57
Abstract out verify logic for fe_mul_int
2023-05-11 06:18:40 -04:00
Pieter Wuille
65d82a3445
Abstract out verify logic for fe_negate
2023-05-11 06:18:40 -04:00
Pieter Wuille
144670893e
Abstract out verify logic for fe_get_b32
2023-05-11 06:18:40 -04:00
Pieter Wuille
f7a7666aeb
Abstract out verify logic for fe_set_b32
2023-05-11 06:18:40 -04:00
Pieter Wuille
ce4d2093e8
Abstract out verify logic for fe_cmp_var
2023-05-11 06:18:40 -04:00
Pieter Wuille
7d7d43c6dd
Improve comments/check for fe_equal{,_var}
2023-05-11 06:18:40 -04:00
Pieter Wuille
c5e788d672
Abstract out verify logic for fe_is_odd
2023-05-11 06:18:40 -04:00
Pieter Wuille
d3f3fe8616
Abstract out verify logic for fe_is_zero
2023-05-11 06:18:40 -04:00
Pieter Wuille
c701d9a471
Abstract out verify logic for fe_clear
2023-05-11 06:18:40 -04:00
Pieter Wuille
19a2bfeeea
Abstract out verify logic for fe_set_int
2023-05-11 06:18:40 -04:00
Pieter Wuille
864f9db491
Abstract out verify logic for fe_normalizes_to_zero{,_var}
2023-05-11 06:18:40 -04:00
Pieter Wuille
6c31371120
Abstract out verify logic for fe_normalize_var
2023-05-11 06:18:40 -04:00
Pieter Wuille
e28b51f522
Abstract out verify logic for fe_normalize_weak
2023-05-11 06:18:40 -04:00
Pieter Wuille
b6b6f9cb97
Abstract out verify logic for fe_normalize
2023-05-11 06:18:40 -04:00
Pieter Wuille
7fa5195559
Bugfix: correct SECP256K1_FE_CONST mag/norm fields
2023-05-11 06:18:37 -04:00
Pieter Wuille
b29566c51b
Merge magnitude/normalized fields, move/improve comments
...
Also split secp256k1_fe_verify into a generic and an implementation
specific part.
2023-05-11 04:25:19 -04:00
Pieter Wuille
0a2e0b2ae4
Make secp256k1_{fe,ge,gej}_verify work as no-op if non-VERIFY
2023-05-10 09:25:09 -04:00
Pieter Wuille
3086cb90ac
Expose secp256k1_fe_verify to other modules
2023-05-10 09:06:02 -04:00
Jonas Nick
1f33bb2b1c
Merge bitcoin-core/secp256k1#1205 : field: Improve docs +tests of secp256k1_fe_set_b32
...
162da73e9a48875aab1ee6ca1c14f86ca4646946 tests: Add debug helper for printing buffers (Tim Ruffing)
e9fd3dff76e30fcd83d060ad9195cadae9cdc9a2 field: Improve docs and tests of secp256k1_fe_set_b32 (Tim Ruffing)
ca92a35d019730aec9d3ec8097dcbb9633a69874 field: Simplify code in secp256k1_fe_set_b32 (Tim Ruffing)
d93f62e3693d6763891edcad11472f9d475177e5 field: Verify field element even after secp256k1_fe_set_b32 fails (Tim Ruffing)
Pull request description:
ACKs for top commit:
jonasnick:
ACK 162da73e9a48875aab1ee6ca1c14f86ca4646946
Tree-SHA512: b3ed8e45c969d0420275ff154462f3820b72b57832ccba1f6f427e0cfd9cff3e27440c20994f69ea33a576b1903eb7f04a989f0dbd574bbd96ee56c6dd4500f7
2023-04-21 16:23:59 +00:00
Tim Ruffing
e9fd3dff76
field: Improve docs and tests of secp256k1_fe_set_b32
2023-04-21 17:20:37 +02:00
Pieter Wuille
b081f7e4cb
Add secp256k1_fe_add_int function
2023-03-02 17:09:25 -05:00
Pieter Wuille
6be01036c8
Add secp256k1_fe_is_square_var function
...
The implementation calls the secp256k1_modinvNN_jacobi_var code, falling back
to computing a square root in the (extremely rare) case it failed converge.
2023-02-28 15:57:32 -05:00
Hennadii Stepanov
b627ba7050
Remove dependency on src/libsecp256k1-config.h
...
This change eases the use of alternate build systems by moving
the variables in `src/libsecp256k1-config.h` to compiler macros
for each invocation, preventing duplication of these variables
for each build system.
Co-authored-by: Ali Sherief <ali@notatether.com>
2022-12-15 10:56:16 +00:00
Peter Dettman
d64bb5d4f3
Add fe_half tests for worst-case inputs
...
- Add field method _fe_get_bounds
2022-02-01 17:51:05 +07:00
Peter Dettman
925f78d55e
Add _fe_half and use in _gej_add_ge
...
- Trades 1 _half for 3 _mul_int and 2 _normalize_weak
- Updated formula and comments in _gej_add_ge
- Added internal benchmark for _fe_half
2022-01-31 19:41:01 +07:00
Russell O'Connor
b3b57ad6ee
Eliminate the pre_a_lam array from ecmult_strauss_wnaf.
2022-01-19 11:51:43 -05:00
Russell O'Connor
c9da1baad1
Move secp256k1_fe_one to field.h
...
This makes secp256k1_fe_one part of field.h's interface, and allows other modules to appropriately access the constant.
2022-01-19 09:53:02 -05:00