summaryrefslogtreecommitdiffstats
path: root/vendor/elliptic-curve/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/elliptic-curve/src
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/elliptic-curve/src')
-rw-r--r--vendor/elliptic-curve/src/public_key.rs12
-rw-r--r--vendor/elliptic-curve/src/secret_key.rs20
2 files changed, 15 insertions, 17 deletions
diff --git a/vendor/elliptic-curve/src/public_key.rs b/vendor/elliptic-curve/src/public_key.rs
index e2d71b3f0..485b0ecfd 100644
--- a/vendor/elliptic-curve/src/public_key.rs
+++ b/vendor/elliptic-curve/src/public_key.rs
@@ -6,9 +6,6 @@ use crate::{
use core::fmt::Debug;
use group::{Curve, Group};
-#[cfg(feature = "alloc")]
-use alloc::boxed::Box;
-
#[cfg(feature = "jwk")]
use crate::{JwkEcKey, JwkParameters};
@@ -26,12 +23,15 @@ use {
FieldBytesSize,
},
core::cmp::Ordering,
- subtle::CtOption,
+ subtle::{Choice, CtOption},
};
#[cfg(all(feature = "alloc", feature = "pkcs8"))]
use pkcs8::EncodePublicKey;
+#[cfg(all(feature = "alloc", feature = "sec1"))]
+use alloc::boxed::Box;
+
#[cfg(any(feature = "jwk", feature = "pem"))]
use alloc::string::{String, ToString};
@@ -138,7 +138,7 @@ where
/// (page 10).
///
/// <http://www.secg.org/sec1-v2.pdf>
- #[cfg(feature = "alloc")]
+ #[cfg(all(feature = "alloc", feature = "sec1"))]
pub fn to_sec1_bytes(&self) -> Box<[u8]>
where
C: PointCompression,
@@ -231,7 +231,7 @@ where
/// Initialize [`PublicKey`] from an [`EncodedPoint`]
fn from_encoded_point(encoded_point: &EncodedPoint<C>) -> CtOption<Self> {
AffinePoint::<C>::from_encoded_point(encoded_point).and_then(|point| {
- let is_identity = ProjectivePoint::<C>::from(point).is_identity();
+ let is_identity = Choice::from(encoded_point.is_identity() as u8);
CtOption::new(PublicKey { point }, !is_identity)
})
}
diff --git a/vendor/elliptic-curve/src/secret_key.rs b/vendor/elliptic-curve/src/secret_key.rs
index 97b3d58bd..a8da65ccd 100644
--- a/vendor/elliptic-curve/src/secret_key.rs
+++ b/vendor/elliptic-curve/src/secret_key.rs
@@ -14,16 +14,6 @@ use generic_array::typenum::Unsigned;
use subtle::{Choice, ConstantTimeEq};
use zeroize::{Zeroize, ZeroizeOnDrop};
-#[cfg(all(feature = "alloc", feature = "arithmetic"))]
-use {
- crate::{
- sec1::{FromEncodedPoint, ToEncodedPoint},
- AffinePoint,
- },
- alloc::vec::Vec,
- zeroize::Zeroizing,
-};
-
#[cfg(feature = "arithmetic")]
use crate::{rand_core::CryptoRngCore, CurveArithmetic, NonZeroScalar, PublicKey};
@@ -34,7 +24,15 @@ use crate::jwk::{JwkEcKey, JwkParameters};
use sec1::der;
#[cfg(all(feature = "alloc", feature = "arithmetic", feature = "sec1"))]
-use sec1::der::Encode;
+use {
+ crate::{
+ sec1::{FromEncodedPoint, ToEncodedPoint},
+ AffinePoint,
+ },
+ alloc::vec::Vec,
+ sec1::der::Encode,
+ zeroize::Zeroizing,
+};
#[cfg(all(feature = "arithmetic", any(feature = "jwk", feature = "pem")))]
use alloc::string::String;