hash: remove redundant secp256k1_sha256_initialize in tagged hash midstate functions#1825
Open
w0xlt wants to merge 1 commit intobitcoin-core:masterfrom
Open
hash: remove redundant secp256k1_sha256_initialize in tagged hash midstate functions#1825w0xlt wants to merge 1 commit intobitcoin-core:masterfrom
secp256k1_sha256_initialize in tagged hash midstate functions#1825w0xlt wants to merge 1 commit intobitcoin-core:masterfrom
Conversation
…tions Each tagged hash midstate function (e.g., secp256k1_schnorrsig_sha256_tagged) calls secp256k1_sha256_initialize before immediately overwriting every field it sets: s[0] through s[7] and bytes. The buf[64] member does not need initialization either, because bytes is set to 64, which means the buffer position (bytes & 0x3F) is 0, so buf is always written before being read. Remove the 11 redundant secp256k1_sha256_initialize calls across the schnorrsig, ellswift, and musig modules.
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.
Each tagged hash midstate function (e.g.,
secp256k1_schnorrsig_sha256_tagged) callssecp256k1_sha256_initializebefore immediately overwriting every field it sets:s[0]throughs[7]andbytes. Thebuf[64]member does not need initialization either, becausebytesis set to 64, which means the buffer position (bytes & 0x3F) (= bytes % 64) is 0, so buf is always written before being read.Remove the 11 redundant
secp256k1_sha256_initializecalls across theschnorrsig,ellswift, andmusigmodules.