diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-08-20 13:02:09 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-08-21 18:25:23 +0100 |
commit | 0b7347effee58f5a19e4724c4b277635727c20d8 (patch) | |
tree | 42e1e32ddf704a4c196fccefa13e45db007bb975 /apps | |
parent | bf932fbd4a2385496fa5e9363bf9280fc6fba0ad (diff) |
Add X509_getm_notBefore, X509_getm_notAfter
Add mutable versions of X509_get0_notBefore and X509_get0_notAfter.
Rename X509_SIG_get0_mutable to X509_SIG_getm.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/apps/apps.c b/apps/apps.c index 23c65698ff..522db71322 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -2593,33 +2593,19 @@ void corrupt_signature(const ASN1_STRING *signature) int set_cert_times(X509 *x, const char *startdate, const char *enddate, int days) { - int rv = 0; - ASN1_TIME *tm = ASN1_TIME_new(); - if (tm == NULL) - goto err; if (startdate == NULL || strcmp(startdate, "today") == 0) { - if (!X509_gmtime_adj(tm, 0)) - goto err; - } else if (!ASN1_TIME_set_string(tm, startdate)) { - goto err; + if (X509_gmtime_adj(X509_getm_notBefore(x), 0) == NULL) + return 0; + } else { + if (!ASN1_TIME_set_string(X509_getm_notBefore(x), startdate)) + return 0; } - - if (!X509_set1_notBefore(x, tm)) - goto err; - if (enddate == NULL) { - if (!X509_time_adj_ex(tm, days, 0, NULL)) - goto err; - } else if (!ASN1_TIME_set_string(tm, enddate)) { - goto err; + if (X509_time_adj_ex(X509_getm_notAfter(x), days, 0, NULL) + == NULL) + return 0; + } else if (!ASN1_TIME_set_string(X509_getm_notAfter(x), enddate)) { + return 0; } - - if (!X509_set1_notAfter(x, tm)) - goto err; - - rv = 1; - - err: - ASN1_TIME_free(tm); - return rv; + return 1; } |