Skip to content

Conversation

@carl-wallace
Copy link
Contributor

make adjusts to some prior structure definitions to work around macro-related issues. Notes on non-use of macros

In trust_anchor_format.rs

  • Choice was not used on TrustAnchorChoice owing to types not available in Asn1Type enum
  • Sequence was not used on TrustAnchorInfo owing to lack of DecodeValue required by context_specific

error[E0277]: the trait bound TrustAnchorInfo<'a>: DecodeValue<'_> is not satisfied
--> x509/src/trust_anchor_format.rs:295:22
|
295 | .context_specific::<TrustAnchorInfo<'a>>(TAC_TA_INFO_TAG, TagMode::Explicit)?;
| ^^^^^^^^^^^^^^^^ the trait DecodeValue<'_> is not implemented for TrustAnchorInfo<'a>
|
note: required by a bound in Decoder::<'a>::context_specific
--> der/src/decoder.rs:172:12
|
172 | T: DecodeValue<'a> + FixedTag,
| ^^^^^^^^^^^^^^^ required by this bound in Decoder::<'a>::context_specific

  • Sequence was not used on CertPathControls to use decode_implicit for each field (trailing bits were left using the default decoder even with mods to Certificate and NameConstraints)

In certificate.rs

  • Sequence was not used on Certificate due to same issue as described above for TrustAnchorInfo (i.e., tension between use of DecodeValue and Decodable)
  • Sequence was not used on NameConstraints for the same DecodeValue vs Decodable issue.

… definitions to work around macro-related issues. Notes on non-use of macros

In trust_anchor_format.rs
- Choice was not used on TrustAnchorChoice owing to types not available in Asn1Type enum
- Sequence was not used on TrustAnchorInfo owing to lack of DecodeValue required by context_specific

error[E0277]: the trait bound `TrustAnchorInfo<'a>: DecodeValue<'_>` is not satisfied
   --> x509/src/trust_anchor_format.rs:295:22
    |
295 |                     .context_specific::<TrustAnchorInfo<'a>>(TAC_TA_INFO_TAG, TagMode::Explicit)?;
    |                      ^^^^^^^^^^^^^^^^ the trait `DecodeValue<'_>` is not implemented for `TrustAnchorInfo<'a>`
    |
note: required by a bound in `Decoder::<'a>::context_specific`
   --> der/src/decoder.rs:172:12
    |
172 |         T: DecodeValue<'a> + FixedTag,
    |            ^^^^^^^^^^^^^^^ required by this bound in `Decoder::<'a>::context_specific`

- Sequence was not used on CertPathControls to use decode_implicit for each field (trailing bits were left using the default decoder even with mods to Certificate and NameConstraints)

In certificate.rs
- Sequence was not used on Certificate due to same issue as described above for TrustAnchorInfo (i.e., tension between use of DecodeValue and Decodable)
- Sequence was not used on NameConstraints for the same DecodeValue vs Decodable issue.
@tarcieri
Copy link
Member

tarcieri commented Feb 2, 2022

@carl-wallace can you rebase? I just want to make sure #377 didn't cause any breakages

@carl-wallace
Copy link
Contributor Author

I pushed changes to use x501 in the trust_anchor_format file.

Comment on lines +50 to +77
impl<'a> DecodeValue<'a> for TrustAnchorInfo<'a> {
fn decode_value(decoder: &mut Decoder<'a>, _length: Length) -> der::Result<Self> {
let version = match decoder.decode()? {
Some(v) => Some(v),
_ => Some(1),
};

let pub_key = decoder.decode()?;
let key_id = decoder.decode()?;
let ta_title = decoder.decode()?;
let cert_path = decoder.decode()?;
let extensions =
::der::asn1::ContextSpecific::decode_explicit(decoder, ::der::TagNumber::N1)?
.map(|cs| cs.value);
let ta_title_lang_tag =
::der::asn1::ContextSpecific::decode_explicit(decoder, ::der::TagNumber::N2)?
.map(|cs| cs.value);
Ok(Self {
version,
pub_key,
key_id,
ta_title,
cert_path,
extensions,
ta_title_lang_tag,
})
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this one use the proc macro now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you left a note here:

Sequence was not used on TrustAnchorInfo owing to lack of DecodeValue required by context_specific

It should probably work now.

@tarcieri
Copy link
Member

tarcieri commented Feb 2, 2022

In the interest of moving things along I'm going to go ahead and merge this.

Perhaps @npmccallum can take a look at converting them to a proc macro in #363.

@tarcieri tarcieri merged commit d4f9f00 into RustCrypto:master Feb 2, 2022
@carl-wallace carl-wallace deleted the rfc5914_and_related_mods branch March 21, 2022 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants