diff --git a/src/cose/sign1.rs b/src/cose/sign1.rs index 36da7da3..79c144c4 100644 --- a/src/cose/sign1.rs +++ b/src/cose/sign1.rs @@ -141,15 +141,12 @@ impl PreparedCoseSign1 { // Check if the payload is present and if it is attached or detached. // Needs to be exclusively attached or detached. - let payload = match (cose_sign1.payload.as_ref(), detached_payload) { + let payload = match (cose_sign1.payload.as_ref(), detached_payload.as_ref()) { (Some(_), Some(_)) => return Err(Error::DoublePayload), (None, None) => return Err(Error::NoPayload), - (Some(payload), None) => Some(payload.clone()), - (None, Some(payload)) => Some(payload), + (Some(payload), None) => payload, + (None, Some(payload)) => payload, }; - let payload = payload - // If payload is None, use cbor null as payload. - .unwrap_or_else(|| vec![246u8]); // Create the signature payload ot be used later on signing. let signature_payload = sig_structure_data( SignatureContext::CoseSign1,