From 2a16978854f2663b92ba8adc04e064e56c705e8f Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 1 Feb 2025 15:44:48 -0700 Subject: [PATCH] x509-cert: use `BTreeSet` instead of `HashSet` The former is available in liballoc. Closes #1641 --- x509-cert/src/builder/profile/cabf.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x509-cert/src/builder/profile/cabf.rs b/x509-cert/src/builder/profile/cabf.rs index ef30ed042..c8193d987 100644 --- a/x509-cert/src/builder/profile/cabf.rs +++ b/x509-cert/src/builder/profile/cabf.rs @@ -1,8 +1,8 @@ //! CA/Browser forum specific profiles //! //! -use alloc::vec; -use std::collections::HashSet; + +use alloc::{collections::BTreeSet, vec}; use crate::{ builder::{BuilderProfile, Error, Result}, @@ -41,7 +41,7 @@ pub fn check_names_encoding(name: &Name, multiple_allowed: bool) -> Result<()> { ]; let mut ordering = enforce_ordering.iter(); - let mut seen = HashSet::new(); + let mut seen = BTreeSet::new(); for rdn in name.iter_rdn() { if rdn.len() != 1 { @@ -70,12 +70,12 @@ pub fn check_names_encoding(name: &Name, multiple_allowed: bool) -> Result<()> { /// /// BR 7.1.2.10.2 CA Certificate Naming pub fn ca_certificate_naming(subject: &Name) -> Result<()> { - let mut required = HashSet::from([ + let mut required = BTreeSet::from([ rfc4519::COUNTRY_NAME, rfc4519::ORGANIZATION_NAME, rfc4519::COMMON_NAME, ]); - let mut allowed = HashSet::from([ + let mut allowed = BTreeSet::from([ rfc4519::COUNTRY_NAME, rfc2256::STATE_OR_PROVINCE_NAME, rfc4519::LOCALITY_NAME,