scalar: correct `_scalar_get_bits_{limb32,var}` input condition docs
What changed, and why it matters
This commit only fixes two mistakes in the documentation comments above two internal helper functions. It changes the stated allowed ranges for the number of bits that can be read and the allowed sum of offset plus count. No actual code logic is modified, so there is no security-relevant behavior change in the program itself.
No action required. Treat as a non-security documentation correction.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates Doxygen-style comments in src/scalar.h for secp256k1_scalar_get_bits_limb32 and secp256k1_scalar_get_bits_var. The first function’s doc now says 1 <= count <= 32 instead of 1 < count <= 32; the second function’s doc now says offset + count must be <= 256 instead of < 256. The function signatures and implementations are untouched.
Changed components
src/scalar.h (documentation comments only)Inspect captured patch +2 / −2
diff --git a/src/scalar.h b/src/scalar.h
index 40d6719..2a5842b 100644
--- a/src/scalar.h
+++ b/src/scalar.h
@@ -22,10 +22,10 @@
/** Clear a scalar to prevent the leak of sensitive data. */
static void secp256k1_scalar_clear(secp256k1_scalar *r);
-/** Access bits (1 < count <= 32) from a scalar. All requested bits must belong to the same 32-bit limb. */
+/** Access bits (1 <= count <= 32) from a scalar. All requested bits must belong to the same 32-bit limb. */
static uint32_t secp256k1_scalar_get_bits_limb32(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
-/** Access bits (1 < count <= 32) from a scalar. offset + count must be < 256. Not constant time in offset and count. */
+/** Access bits (1 <= count <= 32) from a scalar. offset + count must be <= 256. Not constant time in offset and count. */
static uint32_t secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`.
Why this scored 15/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.