about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-27 23:32:01 -0400
committerJune McEnroe <june@causal.agency>2020-07-31 12:12:53 -0400
commit0a3851217784485092e3eea0c33a2dd61c5c1b93 (patch)
tree6571664fc4047a8ab41a7839c44c9853b06cd588
parenttls_conninfo: Implement time_tm_clamp_notafter (diff)
downloadlibretls-0a3851217784485092e3eea0c33a2dd61c5c1b93.tar.gz
libretls-0a3851217784485092e3eea0c33a2dd61c5c1b93.zip
tls_ocsp: Use ASN1_TIME_to_tm
-rw-r--r--tls_ocsp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tls_ocsp.c b/tls_ocsp.c
index 32c372e..d85d79c 100644
--- a/tls_ocsp.c
+++ b/tls_ocsp.c
@@ -17,6 +17,7 @@
  */
 
 #include <sys/types.h>
+#include <string.h>
 
 #include <arpa/inet.h>
 #include <netinet/in.h>
@@ -62,8 +63,9 @@ tls_ocsp_asn1_parse_time(struct tls *ctx, ASN1_GENERALIZEDTIME *gt, time_t *gt_t
 	if (gt == NULL)
 		return -1;
 	/* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */
-	if (ASN1_time_parse(gt->data, gt->length, &tm,
-		V_ASN1_GENERALIZEDTIME) == -1)
+	if (ASN1_GENERALIZEDTIME_check(gt) == 0)
+		return -1;
+	if (ASN1_TIME_to_tm(gt, &tm) == 0)
 		return -1;
 	if ((*gt_time = timegm(&tm)) == -1)
 		return -1;