doc: say the sha256 compression callback processes secrets
What changed, and why it matters
This is a documentation-only change. It adds a warning to the public header file telling developers that the optional SHA256 compression callback may receive secret key material, and therefore any custom implementation must run in constant time and must not retain or log its input. The change itself does not alter any code behavior, fix a bug, or add a security control. It only clarifies a security requirement that was already implicit in the API design.
No immediate action is required. Developers who provide a custom SHA256 compression callback should review their implementation to confirm it already runs in constant time and does not retain or log inputs. Downstream consumers do not need to upgrade for security reasons, but may wish to incorporate the documentation clarification in their own API bindings or documentation.
Security signals we found
Documentation clarifies that a pluggable cryptographic callback receives secret material
Documentation imposes constant-time and no-logging requirements on callback implementers
References RFC 6979 nonce derivation as an example of secret-key processing
No functional code change; no patch to an implementation flaw
Evidence from the diff
The commit modifies include/secp256k1.h to add a paragraph to the documentation for secp256k1_context_set_sha256_compression. The new text states that the callback processes secrets (e.g., secret keys during RFC 6979 nonce derivation), must be constant-time with respect to its input, and must not keep or log the input. There are no functional code changes, no algorithmic modifications, and no new checks. The change is purely a documentation clarification of a security contract for a pluggable callback used in cryptographic operations.
Changed components
include/secp256k1.hsecp256k1_context_set_sha256_compression API documentationInspect captured patch +3 / −0
### include/secp256k1.h
@@ -418,6 +418,9 @@ typedef void (*secp256k1_sha256_compression_function)(
* The provided callback must exactly implement the effect of n_blocks
* repeated applications of the SHA256 compression function.
*
+ * The callback processes secrets such as secret keys, so it must run in
+ * constant time with respect to its input and must not keep or log it.
+ *
* This API exists to support environments that wish to route the
* SHA256 compression step through a hardware-accelerated or otherwise
* specialized implementation. It is NOT meant for replacing SHA256Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.