Skip to content

x509-cert: impl hash for name #1764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion der/src/arrayvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::{ErrorKind, Result};

/// Array-backed append-only vector type.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub(crate) struct ArrayVec<T, const N: usize> {
/// Elements of the set.
elements: [Option<T>; N],
Expand Down
4 changes: 2 additions & 2 deletions der/src/asn1/set_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use {alloc::vec::Vec, core::slice};
/// and does not depend on `alloc` support.
// TODO(tarcieri): use `ArrayVec` when/if it's merged into `core`
// See: https://github.com/rust-lang/rfcs/pull/2990
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct SetOf<T, const N: usize>
where
T: DerOrd,
Expand Down Expand Up @@ -200,7 +200,7 @@ impl<T> ExactSizeIterator for SetOfIter<'_, T> {}
/// This type implements an append-only `SET OF` type which is heap-backed
/// and depends on `alloc` support.
#[cfg(feature = "alloc")]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct SetOfVec<T>
where
T: DerOrd,
Expand Down
2 changes: 1 addition & 1 deletion x509-cert/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub type Attributes = SetOfVec<Attribute>;
///
/// [RFC 5280 Appendix A.1]: https://datatracker.ietf.org/doc/html/rfc5280#appendix-A.1
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Sequence, ValueOrd)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Sequence, ValueOrd, Hash)]
#[allow(missing_docs)]
pub struct AttributeTypeAndValue {
pub oid: AttributeType,
Expand Down
6 changes: 3 additions & 3 deletions x509-cert/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use der::{
/// [RFC 4514 Section 3]: https://www.rfc-editor.org/rfc/rfc4514#section-3
/// [RFC 5280 Section 4.1.2.4]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.4
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct Name(pub(crate) RdnSequence);

impl Name {
Expand Down Expand Up @@ -307,7 +307,7 @@ impl fmt::Display for Name {
///
/// [RFC 5280 Section 4.1.2.4]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.4
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct RdnSequence(Vec<RelativeDistinguishedName>);

impl RdnSequence {
Expand Down Expand Up @@ -437,7 +437,7 @@ pub type DistinguishedName = RdnSequence;
///
/// [RFC 5280 Section 4.1.2.4]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.4
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct RelativeDistinguishedName(pub(crate) SetOfVec<AttributeTypeAndValue>);

impl RelativeDistinguishedName {
Expand Down