1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
Description: Relax sec1 dependency for compatibility with 0.7.2
Remove Hash, Ord, and PartialOrd derives from types containing EncodedPoint
to work with sec1 0.7.2 in Debian. These traits were added in sec1 0.7.3.
Core functionality is unaffected.
.
This patch can be dropped when sec1 >= 0.7.3 is available in the archive.
Author: Nadzeya Hutsko <nadzya.info@gmail.com>
Forwarded: not-needed
Last-Update: 2025-11-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -159,7 +159,7 @@
default-features = false
[dependencies.sec1]
-version = "0.7.3"
+version = "0.7"
features = ["point"]
optional = true
default-features = false
--- a/src/public/ecdsa.rs
+++ b/src/public/ecdsa.rs
@@ -20,7 +20,7 @@
/// `sec1` feature of this crate is enabled (which it is by default).
///
/// Described in [FIPS 186-4](https://csrc.nist.gov/publications/detail/fips/186/4/final).
-#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum EcdsaPublicKey {
/// NIST P-256 ECDSA public key.
NistP256(EcdsaNistP256PublicKey),
--- a/src/public/sk.rs
+++ b/src/public/sk.rs
@@ -18,7 +18,7 @@
/// Security Key (FIDO/U2F) ECDSA/NIST P-256 public key as specified in
/// [PROTOCOL.u2f](https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.u2f?annotate=HEAD).
#[cfg(feature = "ecdsa")]
-#[derive(Clone, Debug, Eq, Ord, Hash, PartialEq, PartialOrd)]
+#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SkEcdsaSha2NistP256 {
/// Elliptic curve point representing a public key.
ec_point: EcdsaNistP256PublicKey,
--- a/src/private/sk.rs
+++ b/src/private/sk.rs
@@ -9,7 +9,7 @@
/// Security Key (FIDO/U2F) ECDSA/NIST P-256 private key as specified in
/// [PROTOCOL.u2f](https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.u2f?annotate=HEAD).
#[cfg(all(feature = "alloc", feature = "ecdsa"))]
-#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
+#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SkEcdsaSha2NistP256 {
/// Public key.
public: public::SkEcdsaSha2NistP256,
--- a/src/public/key_data.rs
+++ b/src/public/key_data.rs
@@ -11,7 +11,7 @@
use super::{EcdsaPublicKey, SkEcdsaSha2NistP256};
/// Public key data.
-#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
+#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum KeyData {
/// Digital Signature Algorithm (DSA) public key data.
--- a/src/certificate.rs
+++ b/src/certificate.rs
@@ -115,7 +115,7 @@
/// human-readable formats like JSON and TOML.
///
/// [PROTOCOL.certkeys]: https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD
-#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
+#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Certificate {
/// CA-provided random bitstring of arbitrary length
/// (but typically 16 or 32 bytes).
--- a/src/public.rs
+++ b/src/public.rs
@@ -81,7 +81,7 @@
/// The serialization uses a binary encoding with binary formats like bincode
/// and CBOR, and the OpenSSH string serialization when used with
/// human-readable formats like JSON and TOML.
-#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PublicKey {
/// Key data.
pub(crate) key_data: KeyData,
--- a/tests/public_key.rs
+++ b/tests/public_key.rs
@@ -430,11 +430,15 @@
assert_eq!(OPENSSH_RSA_4096_EXAMPLE.trim_end(), &key.to_string());
}
+// Test disabled: PublicKey is not hashable with sec1 0.7.2
+// because EncodedPoint doesn't implement Hash in that version.
#[test]
+#[ignore = "PublicKey is not hashable with sec1 0.7.2"]
fn public_keys_are_hashable() {
- let key = PublicKey::from_openssh(OPENSSH_ED25519_EXAMPLE).unwrap();
- let set = HashSet::from([&key]);
- assert_eq!(true, set.contains(&key));
+ // Commented out to avoid compilation errors with sec1 0.7.2
+ // let key = PublicKey::from_openssh(OPENSSH_ED25519_EXAMPLE).unwrap();
+ // let set = HashSet::from([&key]);
+ // assert_eq!(true, set.contains(&key));
}
#[cfg(feature = "std")]
|