The unified diff between revisions [92f17752..] and [11a5f681..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'src/asn1_tm.cpp'

#
#
# patch "src/asn1_tm.cpp"
#  from [00d95aeaebc9c9ec683d6d5ceaabc4b8e0d3719e]
#    to [0bbcca672756ac38f3d44eb8416a007d36009dc4]
#
============================================================
--- src/asn1_tm.cpp	00d95aeaebc9c9ec683d6d5ceaabc4b8e0d3719e
+++ src/asn1_tm.cpp	0bbcca672756ac38f3d44eb8416a007d36009dc4
@@ -1,6 +1,6 @@
 /*************************************************
 * X.509 Time Types Source File                   *
-* (C) 1999-2006 The Botan Project                *
+* (C) 1999-2007 Jack Lloyd                       *
 *************************************************/

 #include <botan/asn1_obj.h>
@@ -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 {
@@ -20,12 +19,8 @@ std::tm get_tm(u64bit timer)
 *************************************************/
 std::tm get_tm(u64bit timer)
    {
-   std::time_t time_val = (std::time_t)timer;
+   std::time_t time_val = static_cast<std::time_t>(timer);

-   if((u64bit)time_val != timer)
-      throw Encoding_Error("X509_Time: time_t overflow with time value " +
-                           to_string(timer));
-
    std::tm* tm_p = std::gmtime(&time_val);
    if(tm_p == 0)
       throw Encoding_Error("X509_Time: gmtime could not encode " +
@@ -182,6 +177,17 @@ void X509_Time::encode_into(DER_Encoder&
    }

 /*************************************************
+* 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
@@ -286,33 +292,4 @@ bool operator>=(const X509_Time& t1, con
 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);
-   }
-
 }