-/* $OpenBSD: x509.h,v 1.27 2018/02/14 16:18:10 jsing Exp $ */
+/* $OpenBSD: x509.h,v 1.28 2018/02/14 16:57:25 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
X509_NAME * X509_get_subject_name(X509 *a);
int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
+const ASN1_TIME *X509_get0_notBefore(const X509 *x);
+ASN1_TIME *X509_getm_notBefore(const X509 *x);
+const ASN1_TIME *X509_get0_notAfter(const X509 *x);
+ASN1_TIME *X509_getm_notAfter(const X509 *x);
int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
EVP_PKEY * X509_get_pubkey(X509 *x);
ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
-/* $OpenBSD: x509_set.c,v 1.12 2015/09/30 17:49:59 jsing Exp $ */
+/* $OpenBSD: x509_set.c,v 1.13 2018/02/14 16:57:25 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int
X509_set_subject_name(X509 *x, X509_NAME *name)
{
- if ((x == NULL) || (x->cert_info == NULL))
+ if (x == NULL || x->cert_info == NULL)
return (0);
return (X509_NAME_set(&x->cert_info->subject, name));
}
+const ASN1_TIME *
+X509_get0_notBefore(const X509 *x)
+{
+ return X509_getm_notBefore(x);
+}
+
+ASN1_TIME *
+X509_getm_notBefore(const X509 *x)
+{
+ if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL)
+ return (NULL);
+ return x->cert_info->validity->notBefore;
+}
+
int
X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
- if ((x == NULL) || (x->cert_info->validity == NULL))
+ if (x == NULL || x->cert_info->validity == NULL)
return (0);
in = x->cert_info->validity->notBefore;
if (in != tm) {
return (in != NULL);
}
+const ASN1_TIME *
+X509_get0_notAfter(const X509 *x)
+{
+ return X509_getm_notAfter(x);
+}
+
+ASN1_TIME *
+X509_getm_notAfter(const X509 *x)
+{
+ if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL)
+ return (NULL);
+ return x->cert_info->validity->notAfter;
+}
+
int
X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
{
ASN1_TIME *in;
- if ((x == NULL) || (x->cert_info->validity == NULL))
+ if (x == NULL || x->cert_info->validity == NULL)
return (0);
in = x->cert_info->validity->notAfter;
if (in != tm) {