aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509cset.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-08-19 16:12:31 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-08-19 16:52:58 +0100
commit3a60d6fa2f8a908d972f8787dc137acb7b8b26e3 (patch)
tree205b7c7cd105bebd7c6f90d8af192ff47d0182a9 /crypto/x509/x509cset.c
parent2a9afa4046592d44af84644cd89fe1a0d6d46889 (diff)
downloadopenssl-3a60d6fa2f8a908d972f8787dc137acb7b8b26e3.tar.gz
Avoid duplicated code.
The certificate and CRL time setting functions used similar code, combine into a single utility function. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/x509/x509cset.c')
-rw-r--r--crypto/x509/x509cset.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c
index fedb2c58e6..681c43812a 100644
--- a/crypto/x509/x509cset.c
+++ b/crypto/x509/x509cset.c
@@ -35,36 +35,16 @@ int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name)
int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm)
{
- ASN1_TIME *in;
-
if (x == NULL)
- return (0);
- in = x->crl.lastUpdate;
- if (in != tm) {
- in = ASN1_STRING_dup(tm);
- if (in != NULL) {
- ASN1_TIME_free(x->crl.lastUpdate);
- x->crl.lastUpdate = in;
- }
- }
- return (in != NULL);
+ return 0;
+ return x509_set1_time(&x->crl.lastUpdate, tm);
}
int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm)
{
- ASN1_TIME *in;
-
if (x == NULL)
- return (0);
- in = x->crl.nextUpdate;
- if (in != tm) {
- in = ASN1_STRING_dup(tm);
- if (in != NULL) {
- ASN1_TIME_free(x->crl.nextUpdate);
- x->crl.nextUpdate = in;
- }
- }
- return (in != NULL);
+ return 0;
+ return x509_set1_time(&x->crl.nextUpdate, tm);
}
int X509_CRL_sort(X509_CRL *c)