if (!opt_md(digestname, &digest))
goto opthelp;
}
- x = load_crl(infile, "CRL");
+ x = load_crl(infile, 1, "CRL");
if (x == NULL)
goto end;
BIO_printf(bio_err, "verify OK\n");
}
- if (crldiff) {
+ if (crldiff != NULL) {
X509_CRL *newcrl, *delta;
if (!keyfile) {
BIO_puts(bio_err, "Missing CRL signing key\n");
goto end;
}
- newcrl = load_crl(crldiff, "other CRL");
+ newcrl = load_crl(crldiff, 0, "other CRL");
if (!newcrl)
goto end;
pkey = load_key(keyfile, keyformat, 0, NULL, NULL, "CRL signing key");
X509 *load_cert_pass(const char *uri, int maybe_stdin,
const char *pass, const char *desc);
#define load_cert(uri, desc) load_cert_pass(uri, 1, NULL, desc)
-X509_CRL *load_crl(const char *uri, const char *desc);
+X509_CRL *load_crl(const char *uri, int maybe_stdin, const char *desc);
void cleanse(char *str);
void clear_free(char *str);
EVP_PKEY *load_key(const char *uri, int format, int maybe_stdin,
return cert;
}
-X509_CRL *load_crl(const char *uri, const char *desc)
+X509_CRL *load_crl(const char *uri, int maybe_stdin, const char *desc)
{
X509_CRL *crl = NULL;
else if (IS_HTTP(uri))
crl = X509_CRL_load_http(uri, NULL, NULL, 0 /* timeout */);
else
- (void)load_key_certs_crls(uri, 0, NULL, desc,
+ (void)load_key_certs_crls(uri, maybe_stdin, NULL, desc,
NULL, NULL, NULL, NULL, NULL, &crl, NULL);
if (crl == NULL) {
BIO_printf(bio_err, "Unable to load %s\n", desc);
for (i = 0; i < sk_DIST_POINT_num(crldp); i++) {
DIST_POINT *dp = sk_DIST_POINT_value(crldp, i);
urlptr = get_dp_url(dp);
- if (urlptr)
- return load_crl(urlptr, "CRL via CDP");
+ if (urlptr != NULL)
+ return load_crl(urlptr, 0, "CRL via CDP");
}
return NULL;
}
if (crl_file != NULL) {
X509_CRL *crl;
- crl = load_crl(crl_file, "CRL");
+ crl = load_crl(crl_file, 0, "CRL");
if (crl == NULL)
goto end;
crls = sk_X509_CRL_new_null();
if (crl_file != NULL) {
X509_CRL *crl;
- crl = load_crl(crl_file, "CRL");
+ crl = load_crl(crl_file, 0, "CRL");
if (crl == NULL)
goto end;
crls = sk_X509_CRL_new_null();
setup("test_crl");
-plan tests => 8;
+plan tests => 9;
require_ok(srctop_file('test','recipes','tconversion.pl'));
srctop_file('test', 'testcrl.pem')],
'106cd822'));
+ok(compare1stline_stdin([qw{openssl crl -hash -noout}],
+ srctop_file("test","testcrl.pem"),
+ '106cd822'),
+ "crl piped input test");
+
ok(run(app(["openssl", "crl", "-text", "-in", $pem, "-out", $out,
"-nameopt", "utf8"])));
is(cmp_text($out, srctop_file("test/certs", "cyrillic_crl.utf8")),
note "Expected ", $str;
return 0;
}
+
+sub compare1stline_stdin {
+ my ($cmdarray, $infile, $str) = @_;
+ my @lines = run(app($cmdarray, stdin => $infile), capture => 1);
+
+ return 1 if $lines[0] =~ m|^\Q${str}\E\R$|;
+ note "Got ", $lines[0];
+ note "Expected ", $str;
+ return 0;
+}