opentitanlib/ownership/
mod.rs

1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5use std::sync::atomic::{AtomicBool, Ordering};
6
7mod application_key;
8mod flash;
9mod flash_info;
10mod isfb;
11mod misc;
12pub mod owner;
13mod rescue;
14mod signature;
15
16pub use application_key::{ApplicationKeyDomain, OwnerApplicationKey};
17pub use flash::{FlashFlags, OwnerFlashConfig, OwnerFlashRegion};
18pub use flash_info::{OwnerFlashInfoConfig, OwnerInfoPage};
19pub use isfb::OwnerIsfbConfig;
20pub use misc::{
21    DetachedSignatureCommand, HybridRawPublicKey, KeyMaterial, OwnershipKeyAlg, TlvHeader, TlvTag,
22};
23pub use owner::{
24    MinSecurityVersion, OwnerBlock, OwnerConfigItem, OwnershipUpdateMode, SramExecMode,
25};
26pub use rescue::{CommandTag, OwnerRescueConfig, RescueProtocol};
27pub use signature::DetachedSignature;
28
29pub struct GlobalFlags;
30
31static DEBUG: AtomicBool = AtomicBool::new(false);
32
33impl GlobalFlags {
34    /// Set the value of the ownership debug flag.  This controls the serialization
35    /// of header and reserved fields in the ownership structs.
36    pub fn set_debug(v: bool) {
37        DEBUG.store(v, Ordering::Relaxed);
38    }
39
40    // Used by the serde serializer to query whether or not a field should be serialized.
41    pub fn not_debug<T>(_: &T) -> bool {
42        !DEBUG.load(Ordering::Relaxed)
43    }
44}