diff --git a/parsec-fix-old-rust.patch b/parsec-fix-old-rust.patch new file mode 100644 index 0000000..46b9265 --- /dev/null +++ b/parsec-fix-old-rust.patch @@ -0,0 +1,53 @@ +From f9688c44319c1733586d6fbc3b3c24a403deaed8 Mon Sep 17 00:00:00 2001 +From: Hugues de Valon +Date: Fri, 30 Apr 2021 10:48:37 +0100 +Subject: [PATCH] Make it compile for Rust 1.43.1 + +The From trait was not implemented for that version of Rust. Uses the +to_vec method which achieves the same thing. + +Signed-off-by: Hugues de Valon +--- + src/providers/pkcs11/key_management.rs | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/providers/pkcs11/key_management.rs b/src/providers/pkcs11/key_management.rs +index 6bc5e06..73ce607 100644 +--- a/src/providers/pkcs11/key_management.rs ++++ b/src/providers/pkcs11/key_management.rs +@@ -27,7 +27,7 @@ impl Provider { + key_id: u32, + key_type: KeyPairType, + ) -> Result { +- let mut template = vec![Attribute::Id(key_id.to_be_bytes().into())]; ++ let mut template = vec![Attribute::Id(key_id.to_be_bytes().to_vec())]; + + match key_type { + KeyPairType::PublicKey => template.push(Attribute::Class(ObjectClass::PUBLIC_KEY)), +@@ -103,7 +103,7 @@ impl Provider { + let key_id = self.create_key_id(); + + let mut pub_template = vec![ +- Attribute::Id(key_id.to_be_bytes().into()), ++ Attribute::Id(key_id.to_be_bytes().to_vec()), + Attribute::Token(true.into()), + Attribute::AllowedMechanisms(vec![Mechanism::try_from( + key_attributes.policy.permitted_algorithms, +@@ -122,7 +122,7 @@ impl Provider { + let mech = match key_attributes.key_type { + Type::RsaKeyPair => { + pub_template.push(Attribute::Private(false.into())); +- pub_template.push(Attribute::PublicExponent(utils::PUBLIC_EXPONENT.into())); ++ pub_template.push(Attribute::PublicExponent(utils::PUBLIC_EXPONENT.to_vec())); + pub_template.push(Attribute::ModulusBits( + key_attributes.bits.try_into().map_err(to_response_status)?, + )); +@@ -225,7 +225,7 @@ impl Provider { + template.push(Attribute::PublicExponent(exponent_object.into())); + template.push(Attribute::Verify(true.into())); + template.push(Attribute::Encrypt(true.into())); +- template.push(Attribute::Id(key_id.to_be_bytes().into())); ++ template.push(Attribute::Id(key_id.to_be_bytes().to_vec())); + template.push(Attribute::Private(false.into())); + template.push(Attribute::AllowedMechanisms(vec![MechanismType::RSA_PKCS])); + diff --git a/parsec.changes b/parsec.changes index 72a7ecf..831196a 100644 --- a/parsec.changes +++ b/parsec.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Apr 30 11:36:56 UTC 2021 - Guillaume GARDET + +- Fix build with old rust used in Leap 15.3/SLE15-SP3. + * parsec-fix-old-rust.patch + ------------------------------------------------------------------- Wed Apr 14 14:54:32 UTC 2021 - Guillaume GARDET diff --git a/parsec.spec b/parsec.spec index a0b4cb3..4932685 100644 --- a/parsec.spec +++ b/parsec.spec @@ -35,6 +35,8 @@ Source3: parsec.service Source4: config.toml Source5: parsec.conf Source6: system-user-parsec.conf +# Fix build with old rust used in Leap 15.3/SLE15-SP3 - https://github.com/parallaxsecond/parsec/issues/409 +Patch1: parsec-fix-old-rust.patch BuildRequires: cargo BuildRequires: clang-devel BuildRequires: cmake