curve: Undeprecate Scalar::from_bits (#780)

This commit is contained in:
Michael Rosenberg 2025-07-07 17:15:06 -04:00 committed by GitHub
parent 9e4ec01fa2
commit 86832640ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 6 deletions

View file

@ -271,10 +271,6 @@ impl Scalar {
/// `EdwardsPoint::vartime_double_scalar_mul_basepoint`. **Do not use this function** unless
/// you absolutely have to.
#[cfg(feature = "legacy_compatibility")]
#[deprecated(
since = "4.0.0",
note = "This constructor outputs scalars with undefined scalar-scalar arithmetic. See docs."
)]
pub const fn from_bits(bytes: [u8; 32]) -> Scalar {
let mut s = Scalar { bytes };
// Ensure invariant #1 holds. That is, make s < 2^255 by masking the high bit.

View file

@ -80,8 +80,6 @@ fn check_scalar(bytes: [u8; 32]) -> Result<Scalar, SignatureError> {
// You cannot do arithmetic with scalars construct with Scalar::from_bits. We only use this
// scalar for EdwardsPoint::vartime_double_scalar_mul_basepoint, which is an accepted usecase.
// The `from_bits` method is deprecated because it's unsafe. We know this.
#[allow(deprecated)]
Ok(Scalar::from_bits(bytes))
}