Repository navigation
Move SHA256 self-test into hash module and remove selftest.h - #1987
Closed
amartya1523 wants to merge 2 commits into
Closed
amartya1523 wants to merge 2 commits into
amartya1523 wants to merge 2 commits into
Conversation
secp256k1_selftest_sha256 only exercises the hash module and is also used to validate a caller-supplied compression function in secp256k1_context_set_sha256_compression. Move it next to secp256k1_sha256_smoke_test and rename it to secp256k1_sha256_selftest to match the naming of the module it lives in. No functional change.
After moving the SHA256 check into the hash module, selftest.h only had a one-line wrapper left. Drop it and call secp256k1_sha256_selftest from secp256k1_selftest directly, with a comment explaining why it always uses the built-in implementation: the API function is meant to catch a broken build of the library (e.g., wrong endianness), and a compression override is already checked when it is set on a context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses the "Reorganize self-test" item in #1835.
The SHA256 check used by
secp256k1_selftestandsecp256k1_context_set_sha256_compressiononly exercises the hash module, so the first commit moves it next tosecp256k1_sha256_smoke_testand renames it tosecp256k1_sha256_selftest. No functional change.After that,
selftest.honly held a one-line wrapper, so the second commit removes the file and hassecp256k1_selftestcall the hash self-test directly. A comment there explains why it always uses the built-in implementation: the API function is meant to catch a broken build of the library (e.g. wrong endianness), and a compression override is already checked when it is set on a context.I kept the move and the removal as separate commits so the first one is easy to review as a pure move.