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::{OwnerBlock, OwnerConfigItem, SramExecMode};
24pub use rescue::{CommandTag, OwnerRescueConfig, RescueProtocol};
25pub use signature::DetachedSignature;
26
27pub struct GlobalFlags;
28
29static DEBUG: AtomicBool = AtomicBool::new(false);
30
31impl GlobalFlags {
32    /// Set the value of the ownership debug flag.  This controls the serialization
33    /// of header and reserved fields in the ownership structs.
34    pub fn set_debug(v: bool) {
35        DEBUG.store(v, Ordering::Relaxed);
36    }
37
38    // Used by the serde serializer to query whether or not a field should be serialized.
39    pub fn not_debug<T>(_: &T) -> bool {
40        !DEBUG.load(Ordering::Relaxed)
41    }
42}