diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_set.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_set.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c index aeaf161024..e60d6f967a 100644 --- a/src/lib/libcrypto/x509/x509_set.c +++ b/src/lib/libcrypto/x509/x509_set.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_set.c,v 1.12 2015/09/30 17:49:59 jsing Exp $ */ | 1 | /* $OpenBSD: x509_set.c,v 1.13 2018/02/14 16:57:25 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -104,17 +104,31 @@ X509_set_issuer_name(X509 *x, X509_NAME *name) | |||
104 | int | 104 | int |
105 | X509_set_subject_name(X509 *x, X509_NAME *name) | 105 | X509_set_subject_name(X509 *x, X509_NAME *name) |
106 | { | 106 | { |
107 | if ((x == NULL) || (x->cert_info == NULL)) | 107 | if (x == NULL || x->cert_info == NULL) |
108 | return (0); | 108 | return (0); |
109 | return (X509_NAME_set(&x->cert_info->subject, name)); | 109 | return (X509_NAME_set(&x->cert_info->subject, name)); |
110 | } | 110 | } |
111 | 111 | ||
112 | const ASN1_TIME * | ||
113 | X509_get0_notBefore(const X509 *x) | ||
114 | { | ||
115 | return X509_getm_notBefore(x); | ||
116 | } | ||
117 | |||
118 | ASN1_TIME * | ||
119 | X509_getm_notBefore(const X509 *x) | ||
120 | { | ||
121 | if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL) | ||
122 | return (NULL); | ||
123 | return x->cert_info->validity->notBefore; | ||
124 | } | ||
125 | |||
112 | int | 126 | int |
113 | X509_set_notBefore(X509 *x, const ASN1_TIME *tm) | 127 | X509_set_notBefore(X509 *x, const ASN1_TIME *tm) |
114 | { | 128 | { |
115 | ASN1_TIME *in; | 129 | ASN1_TIME *in; |
116 | 130 | ||
117 | if ((x == NULL) || (x->cert_info->validity == NULL)) | 131 | if (x == NULL || x->cert_info->validity == NULL) |
118 | return (0); | 132 | return (0); |
119 | in = x->cert_info->validity->notBefore; | 133 | in = x->cert_info->validity->notBefore; |
120 | if (in != tm) { | 134 | if (in != tm) { |
@@ -127,12 +141,26 @@ X509_set_notBefore(X509 *x, const ASN1_TIME *tm) | |||
127 | return (in != NULL); | 141 | return (in != NULL); |
128 | } | 142 | } |
129 | 143 | ||
144 | const ASN1_TIME * | ||
145 | X509_get0_notAfter(const X509 *x) | ||
146 | { | ||
147 | return X509_getm_notAfter(x); | ||
148 | } | ||
149 | |||
150 | ASN1_TIME * | ||
151 | X509_getm_notAfter(const X509 *x) | ||
152 | { | ||
153 | if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL) | ||
154 | return (NULL); | ||
155 | return x->cert_info->validity->notAfter; | ||
156 | } | ||
157 | |||
130 | int | 158 | int |
131 | X509_set_notAfter(X509 *x, const ASN1_TIME *tm) | 159 | X509_set_notAfter(X509 *x, const ASN1_TIME *tm) |
132 | { | 160 | { |
133 | ASN1_TIME *in; | 161 | ASN1_TIME *in; |
134 | 162 | ||
135 | if ((x == NULL) || (x->cert_info->validity == NULL)) | 163 | if (x == NULL || x->cert_info->validity == NULL) |
136 | return (0); | 164 | return (0); |
137 | in = x->cert_info->validity->notAfter; | 165 | in = x->cert_info->validity->notAfter; |
138 | if (in != tm) { | 166 | if (in != tm) { |