summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2019-05-20 15:47:41 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2019-05-20 21:37:05 +0200
commit45e2c62020c272ec9ef44057edcc4261969b5256 (patch)
treef64bf135ab56d8722fe2c098704a0e48af92c2e3 /lib
parent51c16c255b9153ffc8e22d23616456fa269b5e98 (diff)
downloadgnutls-45e2c62020c272ec9ef44057edcc4261969b5256.tar.gz
tests: added unit tests of utc and generalTime convertor
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libgnutls.map3
-rw-r--r--lib/x509/time.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index ec8aadf558..2ed202e279 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -1336,6 +1336,9 @@ GNUTLS_PRIVATE_3_4 {
_gnutls_mpi_ops;
_gnutls_mpi_log;
_gnutls_mpi_release;
+ # tests/time.c
+ _gnutls_utcTime2gtime;
+ _gnutls_x509_generalTime2gtime;
# Internal symbols needed by tests/:
_gnutls_default_priority_string;
diff --git a/lib/x509/time.c b/lib/x509/time.c
index 0b3e78b090..daaac7687b 100644
--- a/lib/x509/time.c
+++ b/lib/x509/time.c
@@ -34,6 +34,8 @@
#include "extras/hex.h"
#include <common.h>
+time_t _gnutls_utcTime2gtime(const char *ttime);
+
/* TIME functions
* Conversions between generalized or UTC time to time_t
*
@@ -171,7 +173,7 @@ static time_t time2gtime(const char *ttime, int year)
*
* (seconds are optional)
*/
-static time_t utcTime2gtime(const char *ttime)
+time_t _gnutls_utcTime2gtime(const char *ttime)
{
char xx[3];
int year;
@@ -345,7 +347,7 @@ time_t _gnutls_x509_get_time(ASN1_TYPE c2, const char *where, int force_general)
len = sizeof(ttime) - 1;
result = asn1_read_value(c2, name, ttime, &len);
if (result == ASN1_SUCCESS)
- c_time = utcTime2gtime(ttime);
+ c_time = _gnutls_utcTime2gtime(ttime);
}
/* We cannot handle dates after 2031 in 32 bit machines.