mozilla_root_ca/
rustls.rs1use crate::*;
2
3use rustls_pki_types::{CertificateDer, Der};
4
5pub const RUSTLS_CERTIFICATE_DER_LIST: [CertificateDer<'static>; DER_LIST_LEN] = {
6 let mut list = [const { CertificateDer::from_slice(b"") }; DER_LIST_LEN];
7
8 let mut i = 0;
9 while i < DER_LIST_LEN {
10 list[i] = CertificateDer::from_slice(DER_LIST[i]);
11 i += 1;
12 }
13
14 list
15};
16
17pub const RUSTLS_DER_LIST: [Der<'static>; DER_LIST_LEN] = {
18 let mut list = [const { Der::from_slice(b"") }; DER_LIST_LEN];
19
20 let mut i = 0;
21 while i < DER_LIST_LEN {
22 list[i] = Der::from_slice(DER_LIST[i]);
23 i += 1;
24 }
25
26 list
27};
28
29#[cfg(feature="rustls-trust-anchor")]
30use rustls_pki_types::TrustAnchor;
31
32#[cfg(feature="rustls-trust-anchor")]
33pub fn rustls_trust_anchor_list() -> &'static [TrustAnchor<'static>; DER_LIST_LEN] {
34 #[cfg(not(feature="std"))]
35 {
36 use lazy_static::lazy_static;
37
38 lazy_static! {
39 static ref LIST: [TrustAnchor<'static>; DER_LIST_LEN] = gen_anchor_list();
40 }
41
42 &*LIST
43 }
44
45 #[cfg(feature="std")]
46 {
47 use once_cell::sync::Lazy;
48
49 static LIST: Lazy<[TrustAnchor<'static>; DER_LIST_LEN]> = Lazy::new(gen_anchor_list);
50
51 &*LIST
52 }
53}
54
55#[cfg(feature="rustls-trust-anchor")]
56fn gen_anchor_list() -> [TrustAnchor<'static>; DER_LIST_LEN] {
57 core::array::from_fn(|i| {
58 webpki::anchor_from_trusted_cert(&RUSTLS_CERTIFICATE_DER_LIST[i]).unwrap()
59 })
60}
61