summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_time.c
diff options
context:
space:
mode:
authorbeck <>2021-10-27 09:50:57 +0000
committerbeck <>2021-10-27 09:50:57 +0000
commit0ae58a9bef1c1b52fb6b5a0140d10edc4660bd48 (patch)
treee390498509bc0c0f8cb6b474d56f38580879b460 /src/lib/libcrypto/asn1/a_time.c
parentc355d8019b3aefa4c09059c9dc147e80d078ba54 (diff)
downloadopenbsd-0ae58a9bef1c1b52fb6b5a0140d10edc4660bd48.tar.gz
openbsd-0ae58a9bef1c1b52fb6b5a0140d10edc4660bd48.tar.bz2
openbsd-0ae58a9bef1c1b52fb6b5a0140d10edc4660bd48.zip
Add ASN1_TIME_diff from OpenSSL.
The symbol is not yet exposed and will show up with tb@'s forthcoming bump ok tb@ jsing@
Diffstat (limited to 'src/lib/libcrypto/asn1/a_time.c')
-rw-r--r--src/lib/libcrypto/asn1/a_time.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index 7a3742fd70..9cb41cf885 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_time.c,v 1.27 2015/10/19 16:32:37 beck Exp $ */ 1/* $OpenBSD: a_time.c,v 1.28 2021/10/27 09:50:57 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -105,3 +105,17 @@ ASN1_TIME_free(ASN1_TIME *a)
105{ 105{
106 ASN1_item_free((ASN1_VALUE *)a, &ASN1_TIME_it); 106 ASN1_item_free((ASN1_VALUE *)a, &ASN1_TIME_it);
107} 107}
108
109int
110ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,
111 const ASN1_TIME *to)
112{
113 struct tm tm_from, tm_to;
114
115 if (ASN1_time_parse(from->data, from->length, &tm_from, 0) == -1)
116 return 0;
117 if (ASN1_time_parse(from->data, from->length, &tm_to, 0) == -1)
118 return 0;
119
120 return OPENSSL_gmtime_diff(pday, psec, &tm_from, &tm_to);
121}