Skip to content

Conversation

@tarcieri
Copy link
Member

While this trait is useful for defining the ValueOrd impl for various ASN.1 universal types within the der crate itself, it is easily abused outside the context of the der crate.

ValueOrd handles comparing DER serializations for ordering. The OrdIsValueOrd is tempting in that it makes it appear that Ord can be used instead, but this only works in hyper-specific cases where Ord is identical to ValueOrd, which is primarily the ASN.1 universal types.

To prevent misuse, this commit seals the trait to force downstream users to impl ValueOrd.

While this trait is useful for defining the `ValueOrd` impl for various
ASN.1 universal types within the `der` crate itself, it is easily abused
outside the context of the `der` crate.

`ValueOrd` handles comparing DER serializations for ordering. The
`OrdIsValueOrd` is tempting in that it makes it appear that `Ord` can be
used instead, but this only works in hyper-specific cases where `Ord` is
identical to `ValueOrd`, which is primarily the ASN.1 universal types.

To prevent misuse, this commit seals the trait to force downstream users
to impl `ValueOrd`.
@tarcieri tarcieri merged commit 976881e into master Jan 28, 2022
@tarcieri tarcieri deleted the der/seal-ordisvalueord-trait branch January 28, 2022 14:11
@tarcieri tarcieri mentioned this pull request May 8, 2022
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