]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Fix margin of error for OCSP checks
authorMichael Brown <mcb30@ipxe.org>
Mon, 21 May 2012 22:00:46 +0000 (23:00 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 21 May 2012 22:21:37 +0000 (23:21 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/ocsp.c

index 58b987d429c22f3dff197350df00fe8eaaac0017..02edd9d38ea8b10fe811853bdc8fc10a41be31e8 100644 (file)
@@ -720,12 +720,12 @@ int ocsp_validate ( struct ocsp_check *ocsp, time_t time ) {
        /* Check OCSP response is valid at the specified time
         * (allowing for some margin of error).
         */
-       if ( response->this_update > ( time - OCSP_ERROR_MARGIN_TIME ) ) {
+       if ( response->this_update > ( time + OCSP_ERROR_MARGIN_TIME ) ) {
                DBGC ( ocsp, "OCSP %p \"%s\" response is not yet valid (at "
                       "time %lld)\n", ocsp, ocsp->cert->subject.name, time );
                return -EACCES_STALE;
        }
-       if ( response->next_update < ( time + OCSP_ERROR_MARGIN_TIME ) ) {
+       if ( response->next_update < ( time - OCSP_ERROR_MARGIN_TIME ) ) {
                DBGC ( ocsp, "OCSP %p \"%s\" response is stale (at time "
                       "%lld)\n", ocsp, ocsp->cert->subject.name, time );
                return -EACCES_STALE;