diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_time.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_time.c | 16 |
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 | |||
| 109 | int | ||
| 110 | ASN1_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 | } | ||
