aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-04-29 16:54:48 +0000
committerlloyd <[email protected]>2008-04-29 16:54:48 +0000
commit271c16e52014d20e347167c1d43ddeae0707c19b (patch)
treef9c424cbcc74b6bbda473cd2e5f25555b685c473 /src
parent3b86cc47adad5c0dfb792126042146a158f4f3f5 (diff)
Move validity_check() into an anonymous namespace inside x509stor.cpp,
as that was the only place it was called from.
Diffstat (limited to 'src')
-rw-r--r--src/asn1_tm.cpp41
-rw-r--r--src/x509stor.cpp18
2 files changed, 29 insertions, 30 deletions
diff --git a/src/asn1_tm.cpp b/src/asn1_tm.cpp
index ece8ccae4..7cd051af7 100644
--- a/src/asn1_tm.cpp
+++ b/src/asn1_tm.cpp
@@ -8,7 +8,6 @@
#include <botan/ber_dec.h>
#include <botan/charset.h>
#include <botan/parsing.h>
-#include <botan/config.h>
#include <ctime>
namespace Botan {
@@ -178,6 +177,17 @@ void X509_Time::encode_into(DER_Encoder& der) const
}
/*************************************************
+* Decode a BER encoded X509_Time *
+*************************************************/
+void X509_Time::decode_from(BER_Decoder& source)
+ {
+ BER_Object ber_time = source.get_next_object();
+ set_to(Charset::transcode(ASN1::to_string(ber_time),
+ LATIN1_CHARSET, LOCAL_CHARSET),
+ ber_time.type_tag);
+ }
+
+/*************************************************
* Return a string representation of the time *
*************************************************/
std::string X509_Time::as_string() const
@@ -282,33 +292,4 @@ bool operator<=(const X509_Time& t1, const X509_Time& t2)
bool operator>=(const X509_Time& t1, const X509_Time& t2)
{ return (t1.cmp(t2) >= 0); }
-/*************************************************
-* Do a validity check *
-*************************************************/
-s32bit validity_check(const X509_Time& start, const X509_Time& end,
- u64bit current_time)
- {
- const u32bit ALLOWABLE_SLIP =
- global_config().option_as_time("x509/validity_slack");
-
- const s32bit NOT_YET_VALID = -1, VALID_TIME = 0, EXPIRED = 1;
-
- if(start.cmp(current_time + ALLOWABLE_SLIP) > 0)
- return NOT_YET_VALID;
- if(end.cmp(current_time - ALLOWABLE_SLIP) < 0)
- return EXPIRED;
- return VALID_TIME;
- }
-
-/*************************************************
-* Decode a BER encoded X509_Time *
-*************************************************/
-void X509_Time::decode_from(BER_Decoder& source)
- {
- BER_Object ber_time = source.get_next_object();
- set_to(Charset::transcode(ASN1::to_string(ber_time),
- LATIN1_CHARSET, LOCAL_CHARSET),
- ber_time.type_tag);
- }
-
}
diff --git a/src/x509stor.cpp b/src/x509stor.cpp
index 9614af21a..e1b498590 100644
--- a/src/x509stor.cpp
+++ b/src/x509stor.cpp
@@ -18,6 +18,24 @@ namespace Botan {
namespace {
/*************************************************
+* Do a validity check *
+*************************************************/
+s32bit validity_check(const X509_Time& start, const X509_Time& end,
+ u64bit current_time)
+ {
+ const u32bit ALLOWABLE_SLIP =
+ global_config().option_as_time("x509/validity_slack");
+
+ const s32bit NOT_YET_VALID = -1, VALID_TIME = 0, EXPIRED = 1;
+
+ if(start.cmp(current_time + ALLOWABLE_SLIP) > 0)
+ return NOT_YET_VALID;
+ if(end.cmp(current_time - ALLOWABLE_SLIP) < 0)
+ return EXPIRED;
+ return VALID_TIME;
+ }
+
+/*************************************************
* Compare the value of unique ID fields *
*************************************************/
bool compare_ids(const MemoryVector<byte>& id1,