From 1c1b20518d9785374dd249052a69f9e337609dd3 Mon Sep 17 00:00:00 2001 From: jsing Date: Tue, 20 Feb 2018 17:04:58 +0000 Subject: [PATCH] Provide X509_CRL_get0_{last,next}Update() and X509_CRL_get0_signature(). --- lib/libcrypto/Symbols.list | 3 +++ lib/libcrypto/asn1/x_crl.c | 24 +++++++++++++++++++++++- lib/libcrypto/x509/x509.h | 7 ++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index a2957cf4ac0..f57513291e5 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -2620,6 +2620,9 @@ X509_CRL_dup X509_CRL_free X509_CRL_get0_by_cert X509_CRL_get0_by_serial +X509_CRL_get0_lastUpdate +X509_CRL_get0_nextUpdate +X509_CRL_get0_signature X509_CRL_get_ext X509_CRL_get_ext_by_NID X509_CRL_get_ext_by_OBJ diff --git a/lib/libcrypto/asn1/x_crl.c b/lib/libcrypto/asn1/x_crl.c index d8f24ca10ba..0da2e9572b3 100644 --- a/lib/libcrypto/asn1/x_crl.c +++ b/lib/libcrypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.27 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: x_crl.c,v 1.28 2018/02/20 17:04:58 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -685,3 +685,25 @@ X509_CRL_get_meth_data(X509_CRL *crl) { return crl->meth_data; } + +const ASN1_TIME * +X509_CRL_get0_lastUpdate(const X509_CRL *crl) +{ + return crl->crl->lastUpdate; +} + +const ASN1_TIME * +X509_CRL_get0_nextUpdate(const X509_CRL *crl) +{ + return crl->crl->nextUpdate; +} + +void +X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg) +{ + if (psig != NULL) + *psig = crl->signature; + if (palg != NULL) + *palg = crl->sig_alg; +} diff --git a/lib/libcrypto/x509/x509.h b/lib/libcrypto/x509/x509.h index 6d6451171cf..9d02e319aa0 100644 --- a/lib/libcrypto/x509/x509.h +++ b/lib/libcrypto/x509/x509.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.h,v 1.29 2018/02/17 15:50:42 jsing Exp $ */ +/* $OpenBSD: x509.h,v 1.30 2018/02/20 17:04:58 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -606,6 +606,11 @@ extern "C" { #define X509_CRL_get_issuer(x) ((x)->crl->issuer) #define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) +const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); +void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); + void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); X509_CRL_METHOD *X509_CRL_METHOD_new( int (*crl_init)(X509_CRL *crl), -- 2.20.1