Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Solidity AWS Nitro Attestation validator

[![CI](https://github.com/base/nitro-validator/actions/workflows/test.yml/badge.svg)](https://github.com/base/nitro-validator/actions/workflows/test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This repo provides solidity contracts for the verification of attestations generated by AWS Nitro Enclaves, as outlined in
[this doc](https://github.com/aws/aws-nitro-enclaves-nsm-api/blob/4b851f3006c6fa98f23dcffb2cba03b39de9b8af/docs/attestation_process.md#3-attestation-document-validation).

Expand Down
4 changes: 2 additions & 2 deletions src/Asn1Decode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ library Asn1Decode {
int256 _month = int256(month);
int256 _day = int256(day);

int256 _days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4
+ 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4
int256 _days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367
* (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4
- 2440588;

return ((uint256(_days) * 24 + hour) * 60 + minute) * 60 + second;
Expand Down
11 changes: 4 additions & 7 deletions src/CertManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ contract CertManager is ICertManager {

_verifyCertSignature(certificate, tbsCertPtr, parent.pubKey);

cert =
VerifiedCert({ca: ca, notAfter: notAfter, maxPathLen: maxPathLen, subjectHash: subjectHash, pubKey: pubKey});
cert = VerifiedCert({
ca: ca, notAfter: notAfter, maxPathLen: maxPathLen, subjectHash: subjectHash, pubKey: pubKey
});
_saveVerified(certHash, cert);

emit CertVerified(certHash);
Expand Down Expand Up @@ -313,11 +314,7 @@ contract CertManager is ICertManager {
}
bytes memory pubKey = packed.slice(0x31, packed.length - 0x31);
return VerifiedCert({
ca: ca != 0,
notAfter: notAfter,
maxPathLen: maxPathLen,
subjectHash: subjectHash,
pubKey: pubKey
ca: ca != 0, notAfter: notAfter, maxPathLen: maxPathLen, subjectHash: subjectHash, pubKey: pubKey
});
}
}
8 changes: 1 addition & 7 deletions src/ECDSA384Curve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ library ECDSA384Curve {

function p384() internal pure returns (ECDSA384.Parameters memory) {
return ECDSA384.Parameters({
a: CURVE_A,
b: CURVE_B,
gx: CURVE_GX,
gy: CURVE_GY,
p: CURVE_P,
n: CURVE_N,
lowSmax: CURVE_LOW_S_MAX
a: CURVE_A, b: CURVE_B, gx: CURVE_GX, gy: CURVE_GY, p: CURVE_P, n: CURVE_N, lowSmax: CURVE_LOW_S_MAX
});
}
}