diff --git a/README.md b/README.md index 23d383e..529ec24 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/src/Asn1Decode.sol b/src/Asn1Decode.sol index 056064e..adfc2f0 100644 --- a/src/Asn1Decode.sol +++ b/src/Asn1Decode.sol @@ -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; diff --git a/src/CertManager.sol b/src/CertManager.sol index 650e618..6cf51bd 100644 --- a/src/CertManager.sol +++ b/src/CertManager.sol @@ -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); @@ -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 }); } } diff --git a/src/ECDSA384Curve.sol b/src/ECDSA384Curve.sol index c99115c..948792d 100644 --- a/src/ECDSA384Curve.sol +++ b/src/ECDSA384Curve.sol @@ -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 }); } }