@@ -143,8 +143,6 @@ abstract contract PcsDao is DaoBase, SigVerifyBase {
143
143
function _upsertPcsCrl (CA ca , bytes calldata crl ) private returns (bytes32 attestationId ) {
144
144
(bytes32 hash , bytes32 key ) = _validatePcsCrl (ca, crl);
145
145
146
- _checkCollateralDuplicate (key, hash);
147
-
148
146
attestationId = _attestPcs (crl, hash, key);
149
147
150
148
emit UpsertedPCSCollateral (ca, true );
@@ -173,7 +171,7 @@ abstract contract PcsDao is DaoBase, SigVerifyBase {
173
171
bytes memory existingData = _fetchDataFromResolver (key, false );
174
172
if (existingData.length > 0 ) {
175
173
(uint256 existingCertNotValidBefore , ) = x509Lib.getCertValidity (existingData);
176
- bool outOfDate = existingCertNotValidBefore > currentCert.validityNotBefore;
174
+ bool outOfDate = existingCertNotValidBefore >= currentCert.validityNotBefore;
177
175
if (outOfDate) {
178
176
revert Certificate_Out_Of_Date ();
179
177
}
@@ -234,6 +232,11 @@ abstract contract PcsDao is DaoBase, SigVerifyBase {
234
232
235
233
function _validatePcsCrl (CA ca , bytes calldata crl ) private view returns (bytes32 hash , bytes32 key ) {
236
234
X509CRLObj memory currentCrl = crlLib.parseCRLDER (crl);
235
+
236
+ key = PCS_KEY (ca, true );
237
+ hash = keccak256 (currentCrl.tbs);
238
+
239
+ _checkCollateralDuplicate (key, hash);
237
240
238
241
// Step 1: Check whether CRL has expired
239
242
bool validTimestamp =
@@ -245,11 +248,10 @@ abstract contract PcsDao is DaoBase, SigVerifyBase {
245
248
246
249
// Step 2: Rollback prevention: new CRL should not have an issued date
247
250
// that is older than the existing CRL
248
- key = PCS_KEY (ca, true );
249
251
bytes memory existingData = _fetchDataFromResolver (key, false );
250
252
if (existingData.length > 0 ) {
251
253
(uint256 existingCrlNotValidBefore , ) = crlLib.getCrlValidity (existingData);
252
- bool outOfDate = existingCrlNotValidBefore > currentCrl.validityNotBefore;
254
+ bool outOfDate = existingCrlNotValidBefore >= currentCrl.validityNotBefore;
253
255
if (outOfDate) {
254
256
revert Certificate_Out_Of_Date ();
255
257
}
@@ -272,8 +274,6 @@ abstract contract PcsDao is DaoBase, SigVerifyBase {
272
274
if (! sigVerified) {
273
275
revert Invalid_Signature ();
274
276
}
275
-
276
- hash = keccak256 (currentCrl.tbs);
277
277
}
278
278
279
279
function _getIssuer (CA ca ) private view returns (bytes memory issuerCert ) {
0 commit comments