Skip to content

Commit

Permalink
Allow anyone to register a signer attestation
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Dec 12, 2024
1 parent 4f247ba commit 3b1c4eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contracts/src/SystemConfigGlobal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ contract SystemConfigGlobal is OwnableUpgradeable, ISemver, NitroValidator {
delete validPCR0s[keccak256(pcr0)];
}

function registerSigner(bytes calldata attestationTbs, bytes calldata signature) external onlyOwner {
function registerSigner(bytes calldata attestationTbs, bytes calldata signature) external {
Ptrs memory ptrs = validateAttestation(attestationTbs, signature);
bytes32 pcr0 = attestationTbs.keccak(ptrs.pcrs[0]);
require(validPCR0s[pcr0], "invalid pcr0 in attestation");

require(ptrs.timestamp + MAX_AGE > block.timestamp, "attestation too old");

// The publicKey is encoded in the form specified in section 4.3.6 of ANSI X9.62, which is a
// 0x04 byte followed by the x and y coordinates of the public key. We ignore the first byte.
bytes32 publicKeyHash = attestationTbs.keccak(ptrs.publicKey.start() + 1, ptrs.publicKey.length() - 1);
address enclaveAddress = address(uint160(uint256(publicKeyHash)));
validSigners[enclaveAddress] = true;
Expand Down

0 comments on commit 3b1c4eb

Please sign in to comment.