Skip to content

Commit

Permalink
impl default
Browse files Browse the repository at this point in the history
  • Loading branch information
Kailai-Wang committed Jun 15, 2024
1 parent 2d383fe commit 72ad32d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tee-worker/core-primitives/sgx/crypto/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ use sgx_crypto::rsa::Rsa3072KeyPair;
#[derive(Default)]
pub struct KeyRepositoryMock<KeyType>
where
KeyType: Clone,
KeyType: Clone + Default,
{
key: RwLock<KeyType>,
}

impl<KeyType> KeyRepositoryMock<KeyType>
where
KeyType: Clone,
KeyType: Clone + Default,
{
pub fn new(key: KeyType) -> Self {
KeyRepositoryMock { key: RwLock::new(key) }
Expand All @@ -43,7 +43,7 @@ where

impl<KeyType> AccessKey for KeyRepositoryMock<KeyType>
where
KeyType: Clone,
KeyType: Clone + Default,
{
type KeyType = KeyType;

Expand All @@ -54,7 +54,7 @@ where

impl<KeyType> MutateKey<KeyType> for KeyRepositoryMock<KeyType>
where
KeyType: Clone,
KeyType: Clone + Default,
{
fn update_key(&self, key: KeyType) -> Result<()> {
let mut lock = self.key.write().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ pub struct ShieldingCryptoMock {
use_dummy_enc_dec: bool,
}

impl Default for ShieldingCryptoMock {
fn default() -> Self {
Self::new(false)
}
}

impl ShieldingCryptoMock {
pub fn new(use_dummy_enc_dec: bool) -> Self {
ShieldingCryptoMock {
Expand Down

0 comments on commit 72ad32d

Please sign in to comment.