summaryrefslogtreecommitdiffstats
path: root/apps/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/lib')
-rw-r--r--apps/lib/apps.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index d3f3f6d2b6..f2c384494f 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -2704,6 +2704,57 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
return 1;
}
+int set_crl_lastupdate(X509_CRL *crl, const char *lastupdate)
+{
+ int ret = 0;
+ ASN1_TIME *tm = ASN1_TIME_new();
+
+ if (tm == NULL)
+ goto end;
+
+ if (lastupdate == NULL) {
+ if (X509_gmtime_adj(tm, 0) == NULL)
+ goto end;
+ } else {
+ if (!ASN1_TIME_set_string_X509(tm, lastupdate))
+ goto end;
+ }
+
+ if (!X509_CRL_set1_lastUpdate(crl, tm))
+ goto end;
+
+ ret = 1;
+end:
+ ASN1_TIME_free(tm);
+ return ret;
+}
+
+int set_crl_nextupdate(X509_CRL *crl, const char *nextupdate,
+ long days, long hours, long secs)
+{
+ int ret = 0;
+ ASN1_TIME *tm = ASN1_TIME_new();
+
+ if (tm == NULL)
+ goto end;
+
+ if (nextupdate == NULL) {
+ if (X509_time_adj_ex(tm, days, hours * 60 * 60 + secs, NULL) == NULL)
+ goto end;
+ } else {
+ if (!ASN1_TIME_set_string_X509(tm, nextupdate))
+ goto end;
+ }
+
+ if (!X509_CRL_set1_nextUpdate(crl, tm))
+ goto end;
+
+ ret = 1;
+end:
+ ASN1_TIME_free(tm);
+ return ret;
+}
+
void make_uppercase(char *string)
{
int i;