diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-08-19 16:21:21 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-08-19 16:52:58 +0100 |
commit | dc047d31fa0c31872db8601a1b9fcd35f24d8589 (patch) | |
tree | 751aa4ab6e7c2344281f6f9f73130d07f650cee6 /apps/x509.c | |
parent | 3a60d6fa2f8a908d972f8787dc137acb7b8b26e3 (diff) | |
download | openssl-dc047d31fa0c31872db8601a1b9fcd35f24d8589.tar.gz |
Set certificate times in one function.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/x509.c')
-rw-r--r-- | apps/x509.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/apps/x509.c b/apps/x509.c index ca9a09f222..0cb38b796a 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -554,9 +554,9 @@ int x509_main(int argc, char **argv) goto end; if (!X509_set_subject_name(x, X509_REQ_get_subject_name(req))) goto end; + if (!set_cert_times(x, NULL, NULL, days)) + goto end; - X509_gmtime_adj(X509_get_notBefore(x), 0); - X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL); if (fkey) X509_set_pubkey(x, fkey); else { @@ -983,11 +983,7 @@ static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *diges if (!X509_set_serialNumber(x, bs)) goto end; - if (X509_gmtime_adj(X509_get_notBefore(x), 0L) == NULL) - goto end; - - /* hardwired expired */ - if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL) == NULL) + if (!set_cert_times(x, NULL, NULL, days)) goto end; if (clrext) { @@ -1056,12 +1052,8 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, if (!X509_set_issuer_name(x, X509_get_subject_name(x))) goto err; - if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL) + if (!set_cert_times(x, NULL, NULL, days)) goto err; - - if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL) == NULL) - goto err; - if (!X509_set_pubkey(x, pkey)) goto err; if (clrext) { |