[dice] Move CDI_SIZE to upstream library libdiced_open_dice
This is part of the project of merging the two existing dice
wrapper libraries into one library. The upstream library
libdiced_open_dice will be the merged library.
Test: atest diced_utils_test diced_sample_inputs_test \
diced_test diced_vendor_test
Test: m pvmfw_img microdroid_manager && atest \
microdroid_manager_test
Bug: 267575445
Change-Id: Ie1ff0ce80b2db053085a269db3501b807fa54cdf
diff --git a/diced/open_dice/src/dice.rs b/diced/open_dice/src/dice.rs
index 187075a..93d9617 100644
--- a/diced/open_dice/src/dice.rs
+++ b/diced/open_dice/src/dice.rs
@@ -16,7 +16,7 @@
//! This module mirrors the content in open-dice/include/dice/dice.h
use open_dice_cbor_bindgen::{
- DiceConfigType, DiceInputValues, DiceMode, DICE_HASH_SIZE, DICE_HIDDEN_SIZE,
+ DiceConfigType, DiceInputValues, DiceMode, DICE_CDI_SIZE, DICE_HASH_SIZE, DICE_HIDDEN_SIZE,
DICE_INLINE_CONFIG_SIZE,
};
use std::ptr;
@@ -27,6 +27,8 @@
pub const HIDDEN_SIZE: usize = DICE_HIDDEN_SIZE as usize;
/// The size of a DICE inline config.
const INLINE_CONFIG_SIZE: usize = DICE_INLINE_CONFIG_SIZE as usize;
+/// The size of a CDI.
+pub const CDI_SIZE: usize = DICE_CDI_SIZE as usize;
/// Array type of hashes used by DICE.
pub type Hash = [u8; HASH_SIZE];
@@ -34,6 +36,8 @@
pub type Hidden = [u8; HIDDEN_SIZE];
/// Array type of inline configuration values.
pub type InlineConfig = [u8; INLINE_CONFIG_SIZE];
+/// Array type of CDIs.
+pub type Cdi = [u8; CDI_SIZE];
/// Configuration descriptor for DICE input values.
#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/diced/open_dice/src/lib.rs b/diced/open_dice/src/lib.rs
index f6f1781..4cdd5c9 100644
--- a/diced/open_dice/src/lib.rs
+++ b/diced/open_dice/src/lib.rs
@@ -23,5 +23,7 @@
mod dice;
mod error;
-pub use dice::{Config, Hash, Hidden, InlineConfig, InputValues, HASH_SIZE, HIDDEN_SIZE};
+pub use dice::{
+ Cdi, Config, Hash, Hidden, InlineConfig, InputValues, CDI_SIZE, HASH_SIZE, HIDDEN_SIZE,
+};
pub use error::{check_result, DiceError, Result};
diff --git a/diced/open_dice_cbor/lib.rs b/diced/open_dice_cbor/lib.rs
index d92fecf..feb6eb6 100644
--- a/diced/open_dice_cbor/lib.rs
+++ b/diced/open_dice_cbor/lib.rs
@@ -32,22 +32,21 @@
//! ```
pub use diced_open_dice::{
- check_result, Config, DiceError, Hash, Hidden, InputValues, Result, HASH_SIZE, HIDDEN_SIZE,
+ check_result, Config, DiceError, Hash, Hidden, InputValues, Result, CDI_SIZE, HASH_SIZE,
+ HIDDEN_SIZE,
};
use keystore2_crypto::ZVec;
use open_dice_bcc_bindgen::BccMainFlow;
pub use open_dice_cbor_bindgen::DiceMode;
use open_dice_cbor_bindgen::{
DiceDeriveCdiCertificateId, DiceDeriveCdiPrivateKeySeed, DiceGenerateCertificate, DiceHash,
- DiceKdf, DiceKeypairFromSeed, DiceMainFlow, DiceSign, DiceVerify, DICE_CDI_SIZE, DICE_ID_SIZE,
+ DiceKdf, DiceKeypairFromSeed, DiceMainFlow, DiceSign, DiceVerify, DICE_ID_SIZE,
DICE_PRIVATE_KEY_SEED_SIZE, DICE_PRIVATE_KEY_SIZE, DICE_PUBLIC_KEY_SIZE, DICE_SIGNATURE_SIZE,
};
use std::ffi::c_void;
/// The size of a private key seed.
pub const PRIVATE_KEY_SEED_SIZE: usize = DICE_PRIVATE_KEY_SEED_SIZE as usize;
-/// The size of a CDI.
-pub const CDI_SIZE: usize = DICE_CDI_SIZE as usize;
/// The size of an ID.
pub const ID_SIZE: usize = DICE_ID_SIZE as usize;
/// The size of a private key.