summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/mpi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/crypto/mpi.rs')
-rw-r--r--openpgp/src/crypto/mpi.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index d1249e73..25150a7e 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -92,19 +92,21 @@ impl MPI {
/// supported, `Error::MalformedMPI` if the point is formatted
/// incorrectly.
pub fn decode_point(&self, curve: &Curve) -> Result<(&[u8], &[u8])> {
- use nettle::{ed25519, curve25519};
+ const ED25519_KEY_SIZE: usize = 32;
+ const CURVE25519_SIZE: usize = 32;
use self::Curve::*;
match &curve {
Ed25519 | Cv25519 => {
- assert_eq!(curve25519::CURVE25519_SIZE,
- ed25519::ED25519_KEY_SIZE);
+ assert_eq!(CURVE25519_SIZE, ED25519_KEY_SIZE);
// This curve uses a custom compression format which
// only contains the X coordinate.
- if self.value().len() != 1 + curve25519::CURVE25519_SIZE {
+ if self.value().len() != 1 + CURVE25519_SIZE {
return Err(Error::MalformedMPI(
format!("Bad size of Curve25519 key: {} expected: {}",
self.value().len(),
- 1 + curve25519::CURVE25519_SIZE)).into());
+ 1 + CURVE25519_SIZE
+ )
+ ).into());
}
if self.value().get(0).map(|&b| b != 0x40).unwrap_or(true) {