-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cargo patch and decouple more deps (#3124)
* use patch * fix compile * fix lockfile * tabs * add dcap related primitives * fix ci
- Loading branch information
1 parent
1189d1a
commit b656376
Showing
93 changed files
with
2,351 additions
and
2,668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2020-2024 Trust Computing GmbH. | ||
// This file is part of Litentry. | ||
// | ||
// Litentry is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Litentry is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Litentry. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
mod types; | ||
pub use types::*; | ||
|
||
mod tcb; | ||
pub use tcb::*; | ||
|
||
mod sgx_verify; | ||
pub use sgx_verify::*; | ||
|
||
mod quoting_enclave; | ||
pub use quoting_enclave::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
Copyright 2021 Integritee AG and Supercomputing Systems AG | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// `QuotingEnclave` primitive part, copied from Integritee | ||
|
||
use crate::{MrSigner, QeTcb, Vec}; | ||
use parity_scale_codec::{Decode, Encode}; | ||
use scale_info::TypeInfo; | ||
use sp_core::RuntimeDebug; | ||
|
||
/// This represents all the collateral data that we need to store on chain in order to verify | ||
/// the quoting enclave validity of another enclave that wants to register itself on chain | ||
#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] | ||
pub struct QuotingEnclave { | ||
// Todo: make timestamp: Moment | ||
pub issue_date: u64, // unix epoch in milliseconds | ||
// Todo: make timestamp: Moment | ||
pub next_update: u64, // unix epoch in milliseconds | ||
pub miscselect: [u8; 4], | ||
pub miscselect_mask: [u8; 4], | ||
pub attributes: [u8; 16], | ||
pub attributes_mask: [u8; 16], | ||
pub mrsigner: MrSigner, | ||
pub isvprodid: u16, | ||
/// Contains only the TCB versions that are considered UpToDate | ||
pub tcb: Vec<QeTcb>, | ||
} | ||
|
||
impl QuotingEnclave { | ||
#[allow(clippy::too_many_arguments)] | ||
pub fn new( | ||
issue_date: u64, | ||
next_update: u64, | ||
miscselect: [u8; 4], | ||
miscselect_mask: [u8; 4], | ||
attributes: [u8; 16], | ||
attributes_mask: [u8; 16], | ||
mrsigner: MrSigner, | ||
isvprodid: u16, | ||
tcb: Vec<QeTcb>, | ||
) -> Self { | ||
Self { | ||
issue_date, | ||
next_update, | ||
miscselect, | ||
miscselect_mask, | ||
attributes, | ||
attributes_mask, | ||
mrsigner, | ||
isvprodid, | ||
tcb, | ||
} | ||
} | ||
|
||
pub fn attributes_flags_mask_as_u64(&self) -> u64 { | ||
let slice_as_array: [u8; 8] = self.attributes_mask[0..8].try_into().unwrap(); | ||
u64::from_le_bytes(slice_as_array) | ||
} | ||
|
||
pub fn attributes_flags_as_u64(&self) -> u64 { | ||
let slice_as_array: [u8; 8] = self.attributes[0..8].try_into().unwrap(); | ||
u64::from_le_bytes(slice_as_array) | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.