pub fn normalize_p256_s(s_bytes: &[u8]) -> Result<B256, &'static str>Expand description
Normalize P256 signature s value to low-s form.
For any ECDSA signature (r, s), both (r, s) and (r, n-s) are valid. To prevent signature malleability, we require s <= n/2. If s > n/2, we replace it with n - s.
Returns an error if s is zero or s >= P256_ORDER (out of range for a
valid scalar). This function should be called by all P256 signing code
before creating a signature, as the p256 crate does not guarantee low-s
signatures.