Shouldn’t the call to secp256k1_fe_verify
come after the else block?
call fe_verfiy
for not normalized field element in fe_set_b32
#1061
issue
siv2r
openend this issue on
January 3, 2022
-
siv2r commented at 10:27 pm on January 3, 2022: contributor
-
real-or-random commented at 10:05 am on January 4, 2022: contributorThis was changed in https://github.com/bitcoin-core/secp256k1/commit/34a67c773b0871e5797c7ab506d004e80911f120. I believe this is this intentionally to optimize the tests. Can you check if the tests take noticeably longer if the fe_verify is moved after the else block?
-
siv2r commented at 3:20 am on January 11, 2022: contributor
build commands:
./autogen.sh && ./configure && make -j13
Execution time (in seconds) oftests.c
for three iterations (on 64-bit, i7-8750H). I usedgettime_i64
function to measure the execution time. You can find my complete code here.branch min avg max master ( fe_verify
inside if block)145.94 146.26 146.72 bench-tests ( fe_verify
after else block)145.74 146.04 146.27 There isn’t much difference in the execution time.
-
real-or-random commented at 10:57 am on January 12, 2022: contributor
Oh I think the
time
command would have been fine-grained enough for the tests. :)Yeah, I mean if the difference is below a second, I’d say it’s reasonable to always do the verify.
-
siv2r commented at 12:05 pm on January 12, 2022: contributorMakes sense. The change required here is relatively small. I will check other parts of the code for similar issues and bundle them up in a PR.
-
siv2r commented at 12:20 pm on January 12, 2022: contributor
Oh I think the
time
command would have been fine-grained enough for the tests. :)I didn’t know such a command existed. I initially tried to use
clock_gettime()
for nanosecond precision..xD. It didn’t work sincec89
does not seem to support it. -
real-or-random commented at 6:03 pm on January 18, 2022: contributorMaybe this could be solved in #1062 ? I think it will be similar to some changes proposed there.
-
siv2r cross-referenced this on Jan 26, 2022 from issue Removes `_fe_equal_var`, and unwanted `_fe_normalize_weak` calls (in tests) by siv2r
-
real-or-random referenced this in commit de657c2044 on Aug 17, 2023
-
real-or-random commented at 9:02 am on March 5, 2024: contributorThis has been resolved by #1062.
-
real-or-random closed this on Mar 5, 2024
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-24 00:15 UTC
This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-24 00:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me