fix a bug in handling clock skew

svn:r785
This commit is contained in:
Roger Dingledine 2003-11-11 04:08:30 +00:00
parent 7bde42676b
commit 3d19a9b514

View File

@ -518,12 +518,12 @@ tor_tls_verify(tor_tls *tls)
return NULL; return NULL;
now = time(NULL); now = time(NULL);
t = now - CERT_ALLOW_SKEW; t = now + CERT_ALLOW_SKEW;
if (X509_cmp_time(X509_get_notBefore(cert), &t) > 0) { if (X509_cmp_time(X509_get_notBefore(cert), &t) > 0) {
log_fn(LOG_WARN,"Certificate becomes valid in the future: possible clock skew."); log_fn(LOG_WARN,"Certificate becomes valid in the future: possible clock skew.");
goto done; goto done;
} }
t = now + CERT_ALLOW_SKEW; t = now - CERT_ALLOW_SKEW;
if (X509_cmp_time(X509_get_notAfter(cert), &t) < 0) { if (X509_cmp_time(X509_get_notAfter(cert), &t) < 0) {
log_fn(LOG_WARN,"Certificate already expired; possible clock skew."); log_fn(LOG_WARN,"Certificate already expired; possible clock skew.");
goto done; goto done;