-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): put automata dcap v3 ra behind proxy (#16867)
Co-authored-by: Keszey Dániel <[email protected]> Co-authored-by: David <[email protected]> Co-authored-by: Daniel Wang <[email protected]>
- Loading branch information
1 parent
6f1194f
commit 1282113
Showing
4 changed files
with
62 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,13 @@ import { BytesUtils } from "./utils/BytesUtils.sol"; | |
// External Libraries | ||
import { ISigVerifyLib } from "./interfaces/ISigVerifyLib.sol"; | ||
|
||
import { EssentialContract } from "../common/EssentialContract.sol"; | ||
|
||
/// @title AutomataDcapV3Attestation | ||
/// @custom:security-contact [email protected] | ||
contract AutomataDcapV3Attestation is IAttestation { | ||
contract AutomataDcapV3Attestation is IAttestation, EssentialContract { | ||
using BytesUtils for bytes; | ||
|
||
ISigVerifyLib public immutable sigVerifyLib; | ||
IPEMCertChainLib public immutable pemCertLib; | ||
|
||
// https://github.com/intel/SGXDataCenterAttestationPrimitives/blob/e7604e02331b3377f3766ed3653250e03af72d45/QuoteVerification/QVL/Src/AttestationLibrary/src/CertVerification/X509Constants.h#L64 | ||
uint256 internal constant CPUSVN_LENGTH = 16; | ||
|
||
|
@@ -35,31 +34,40 @@ contract AutomataDcapV3Attestation is IAttestation { | |
|
||
uint8 internal constant INVALID_EXIT_CODE = 255; | ||
|
||
bool private _checkLocalEnclaveReport; | ||
mapping(bytes32 enclave => bool trusted) private _trustedUserMrEnclave; | ||
mapping(bytes32 signer => bool trusted) private _trustedUserMrSigner; | ||
ISigVerifyLib public sigVerifyLib; // slot 1 | ||
IPEMCertChainLib public pemCertLib; // slot 2 | ||
|
||
bool private _checkLocalEnclaveReport; // slot 3 | ||
mapping(bytes32 enclave => bool trusted) private _trustedUserMrEnclave; // slot 4 | ||
mapping(bytes32 signer => bool trusted) private _trustedUserMrSigner; // slot 5 | ||
|
||
// Quote Collateral Configuration | ||
|
||
// Index definition: | ||
// 0 = Quote PCKCrl | ||
// 1 = RootCrl | ||
mapping(uint256 idx => mapping(bytes serialNum => bool revoked)) private _serialNumIsRevoked; | ||
mapping(uint256 idx => mapping(bytes serialNum => bool revoked)) private _serialNumIsRevoked; // slot | ||
// 6 | ||
// fmspc => tcbInfo | ||
mapping(string fmspc => TCBInfoStruct.TCBInfo tcbInfo) public tcbInfo; | ||
EnclaveIdStruct.EnclaveId public qeIdentity; | ||
|
||
address public immutable owner; | ||
|
||
constructor(address sigVerifyLibAddr, address pemCertLibAddr) { | ||
mapping(string fmspc => TCBInfoStruct.TCBInfo tcbInfo) public tcbInfo; // slot 7 | ||
EnclaveIdStruct.EnclaveId public qeIdentity; // takes 4 slots, slot 8,9,10,11 | ||
|
||
uint256[39] __gap; | ||
|
||
// @notice Initializes the contract. | ||
/// @param sigVerifyLibAddr Address of the signature verification library. | ||
/// @param pemCertLibAddr Address of certificate library. | ||
function init( | ||
address owner, | ||
address sigVerifyLibAddr, | ||
address pemCertLibAddr | ||
) | ||
external | ||
initializer | ||
{ | ||
__Essential_init(owner); | ||
sigVerifyLib = ISigVerifyLib(sigVerifyLibAddr); | ||
pemCertLib = PEMCertChainLib(pemCertLibAddr); | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner, "onlyOwner"); | ||
_; | ||
} | ||
|
||
function setMrSigner(bytes32 _mrSigner, bool _trusted) external onlyOwner { | ||
|
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 |
---|---|---|
|
@@ -5,13 +5,13 @@ pragma solidity 0.8.24; | |
/// @custom:security-contact [email protected] | ||
library EnclaveIdStruct { | ||
struct EnclaveId { | ||
bytes4 miscselect; | ||
bytes4 miscselect; // Slot 1: | ||
bytes4 miscselectMask; | ||
uint16 isvprodid; | ||
bytes16 attributes; | ||
bytes16 attributes; // Slot 2 | ||
bytes16 attributesMask; | ||
bytes32 mrsigner; | ||
TcbLevel[] tcbLevels; | ||
bytes32 mrsigner; // Slot 3 | ||
TcbLevel[] tcbLevels; // Slot 4 | ||
} | ||
|
||
struct TcbLevel { | ||
|
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