• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! Implements safe wrappers around the public API of libopen-dice for
16 //! both std and nostd usages.
17 
18 #![cfg_attr(not(feature = "std"), no_std)]
19 
20 #[cfg(not(feature = "std"))]
21 extern crate core as std;
22 
23 mod bcc;
24 mod dice;
25 mod error;
26 mod ops;
27 #[cfg(feature = "std")]
28 mod retry;
29 
30 pub use bcc::{
31     bcc_format_config_descriptor, bcc_handover_main_flow, bcc_handover_parse, bcc_main_flow,
32     BccHandover,
33 };
34 pub use dice::{
35     derive_cdi_certificate_id, derive_cdi_private_key_seed, dice_main_flow, Cdi, CdiValues, Config,
36     DiceArtifacts, DiceMode, Hash, Hidden, InlineConfig, InputValues, PrivateKey, PrivateKeySeed,
37     PublicKey, Signature, CDI_SIZE, HASH_SIZE, HIDDEN_SIZE, ID_SIZE, PRIVATE_KEY_SEED_SIZE,
38 };
39 pub use error::{check_result, DiceError, Result};
40 pub use ops::{generate_certificate, hash, kdf, keypair_from_seed, sign, verify};
41 #[cfg(feature = "std")]
42 pub use retry::{
43     retry_bcc_format_config_descriptor, retry_bcc_main_flow, retry_dice_main_flow,
44     retry_generate_certificate, OwnedDiceArtifacts,
45 };
46