summaryrefslogtreecommitdiffstats
path: root/vendor/elliptic-curve/src/public_key.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/elliptic-curve/src/public_key.rs')
-rw-r--r--vendor/elliptic-curve/src/public_key.rs12
1 files changed, 6 insertions, 6 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)
})
}