mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-09 21:10:44 +00:00
curve: Undeprecate Scalar::from_bits (#780)
This commit is contained in:
parent
9e4ec01fa2
commit
86832640ed
2 changed files with 0 additions and 6 deletions
|
|
@ -271,10 +271,6 @@ impl Scalar {
|
||||||
/// `EdwardsPoint::vartime_double_scalar_mul_basepoint`. **Do not use this function** unless
|
/// `EdwardsPoint::vartime_double_scalar_mul_basepoint`. **Do not use this function** unless
|
||||||
/// you absolutely have to.
|
/// you absolutely have to.
|
||||||
#[cfg(feature = "legacy_compatibility")]
|
#[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 {
|
pub const fn from_bits(bytes: [u8; 32]) -> Scalar {
|
||||||
let mut s = Scalar { bytes };
|
let mut s = Scalar { bytes };
|
||||||
// Ensure invariant #1 holds. That is, make s < 2^255 by masking the high bit.
|
// Ensure invariant #1 holds. That is, make s < 2^255 by masking the high bit.
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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.
|
// 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))
|
Ok(Scalar::from_bits(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue