diff --git a/src/ec/suite_b/ecdsa/signing.rs b/src/ec/suite_b/ecdsa/signing.rs index e758a9f654..6aaf7c01ed 100644 --- a/src/ec/suite_b/ecdsa/signing.rs +++ b/src/ec/suite_b/ecdsa/signing.rs @@ -414,7 +414,7 @@ fn format_rs_asn1(ops: &'static ScalarOps, r: &Scalar, s: &Scalar, out: &mut [u8 }; let value = &fixed[first_index..]; - out[0] = der::Tag::Integer as u8; + out[0] = der::Tag::Integer.into(); // Lengths less than 128 are encoded in one byte. assert!(value.len() < 128); @@ -425,7 +425,7 @@ fn format_rs_asn1(ops: &'static ScalarOps, r: &Scalar, s: &Scalar, out: &mut [u8 2 + value.len() } - out[0] = der::Tag::Sequence as u8; + out[0] = der::Tag::Sequence.into(); let r_tlv_len = format_integer_tlv(ops, r, &mut out[2..]); let s_tlv_len = format_integer_tlv(ops, s, &mut out[2..][r_tlv_len..]); diff --git a/src/pkcs8.rs b/src/pkcs8.rs index 63787df092..1f15ce4089 100644 --- a/src/pkcs8.rs +++ b/src/pkcs8.rs @@ -142,7 +142,7 @@ fn unwrap_key__<'a>( .map_err(|error::Unspecified| error::KeyRejected::invalid_encoding())?; // Ignore any attributes that are present. - if input.peek(der::Tag::ContextSpecificConstructed0 as u8) { + if input.peek(der::Tag::ContextSpecificConstructed0.into()) { let _ = der::expect_tag_and_get_value(input, der::Tag::ContextSpecificConstructed0) .map_err(|error::Unspecified| error::KeyRejected::invalid_encoding())?; } @@ -153,17 +153,18 @@ fn unwrap_key__<'a>( } const INCORRECT_LEGACY: der::Tag = der::Tag::ContextSpecificConstructed1; - let result = - if options.accept_legacy_ed25519_public_key_tag && input.peek(INCORRECT_LEGACY as u8) { - der::nested( - input, - INCORRECT_LEGACY, - error::Unspecified, - der::bit_string_with_no_unused_bits, - ) - } else { - der::bit_string_tagged_with_no_unused_bits(der::Tag::ContextSpecific1, input) - }; + let result = if options.accept_legacy_ed25519_public_key_tag + && input.peek(INCORRECT_LEGACY.into()) + { + der::nested( + input, + INCORRECT_LEGACY, + error::Unspecified, + der::bit_string_with_no_unused_bits, + ) + } else { + der::bit_string_tagged_with_no_unused_bits(der::Tag::ContextSpecific1, input) + }; let public_key = result.map_err(|error::Unspecified| error::KeyRejected::invalid_encoding())?; Some(public_key)