aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert/x509/x509stor.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-12-01 14:58:22 +0000
committerlloyd <[email protected]>2009-12-01 14:58:22 +0000
commitf3c149bce5b5ddb527a072c2f34daaa993cdba94 (patch)
tree562346944c5864ddb1df1cbaac6f2f66f7951419 /src/cert/x509/x509stor.cpp
parentfe0276ee115bb367810ac2e06833fed297eb1715 (diff)
Use std::chrono::duration instead of untyped u32bit values for times in
X509_Store
Diffstat (limited to 'src/cert/x509/x509stor.cpp')
-rw-r--r--src/cert/x509/x509stor.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cert/x509/x509stor.cpp b/src/cert/x509/x509stor.cpp
index 336d155d3..a055602a8 100644
--- a/src/cert/x509/x509stor.cpp
+++ b/src/cert/x509/x509stor.cpp
@@ -23,13 +23,13 @@ namespace {
*/
s32bit validity_check(const X509_Time& start, const X509_Time& end,
const std::chrono::system_clock::time_point& now,
- u32bit slack)
+ std::chrono::seconds slack)
{
const s32bit NOT_YET_VALID = -1, VALID_TIME = 0, EXPIRED = 1;
- if(start.cmp(now + std::chrono::seconds(slack)) > 0)
+ if(start.cmp(now + slack) > 0)
return NOT_YET_VALID;
- if(end.cmp(now - std::chrono::seconds(slack)) < 0)
+ if(end.cmp(now - slack) < 0)
return EXPIRED;
return VALID_TIME;
}
@@ -170,7 +170,8 @@ bool X509_Store::CRL_Data::operator<(const X509_Store::CRL_Data& other) const
/*
* X509_Store Constructor
*/
-X509_Store::X509_Store(u32bit slack, u32bit cache_timeout)
+X509_Store::X509_Store(std::chrono::seconds slack,
+ std::chrono::seconds cache_timeout)
{
revoked_info_valid = true;
@@ -680,7 +681,7 @@ bool X509_Store::Cert_Info::is_trusted() const
/*
* Check if this certificate has been verified
*/
-bool X509_Store::Cert_Info::is_verified(u32bit timeout) const
+bool X509_Store::Cert_Info::is_verified(std::chrono::seconds timeout) const
{
if(!checked)
return false;
@@ -689,7 +690,7 @@ bool X509_Store::Cert_Info::is_verified(u32bit timeout) const
auto now = std::chrono::system_clock::now();
- if(now > last_checked + std::chrono::seconds(timeout))
+ if(now > last_checked + timeout)
checked = false;
return checked;