blob: 83ae07fbd8acb8e79ef400a8efaf62ceb9cfd9bb [file] [log] [blame]
Alice Wang0b9e1102023-02-02 09:57:06 +00001// 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
Alice Wangdb748d22023-09-19 11:18:29 +000020#[cfg(feature = "alloc")]
21extern crate alloc;
22
Alice Wang856d6562023-02-03 13:51:08 +000023#[cfg(not(feature = "std"))]
24extern crate core as std;
25
Alice Wang9c40eca2023-02-03 13:10:24 +000026mod bcc;
Alice Wang0b9e1102023-02-02 09:57:06 +000027mod dice;
Alice Wang856d6562023-02-03 13:51:08 +000028mod error;
Alice Wang24954b42023-02-06 10:03:45 +000029mod ops;
Alice Wangdb748d22023-09-19 11:18:29 +000030#[cfg(feature = "alloc")]
Alice Wang9c40eca2023-02-03 13:10:24 +000031mod retry;
Alice Wang0b9e1102023-02-02 09:57:06 +000032
Alice Wang1a933a82023-02-14 11:02:51 +000033pub use bcc::{
34 bcc_format_config_descriptor, bcc_handover_main_flow, bcc_handover_parse, bcc_main_flow,
Alan Stokes82b12392023-08-22 14:39:29 +010035 BccHandover, DiceConfigValues,
Alice Wang1a933a82023-02-14 11:02:51 +000036};
Alice Wang3213d492023-02-03 15:52:18 +000037pub use dice::{
Alice Wang44f48b22023-02-09 09:51:22 +000038 derive_cdi_certificate_id, derive_cdi_private_key_seed, dice_main_flow, Cdi, CdiValues, Config,
Alice Wangf59662d2023-02-10 16:07:56 +000039 DiceArtifacts, DiceMode, Hash, Hidden, InlineConfig, InputValues, PrivateKey, PrivateKeySeed,
40 PublicKey, Signature, CDI_SIZE, HASH_SIZE, HIDDEN_SIZE, ID_SIZE, PRIVATE_KEY_SEED_SIZE,
Alice Wang3213d492023-02-03 15:52:18 +000041};
Alice Wangef999242023-05-22 11:14:59 +000042pub use error::{DiceError, Result};
Alice Wangf59662d2023-02-10 16:07:56 +000043pub use ops::{generate_certificate, hash, kdf, keypair_from_seed, sign, verify};
Alice Wangdb748d22023-09-19 11:18:29 +000044#[cfg(feature = "alloc")]
Alice Wang44f48b22023-02-09 09:51:22 +000045pub use retry::{
46 retry_bcc_format_config_descriptor, retry_bcc_main_flow, retry_dice_main_flow,
Alice Wang4d611772023-02-13 09:45:21 +000047 retry_generate_certificate, OwnedDiceArtifacts,
Alice Wang44f48b22023-02-09 09:51:22 +000048};