X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=apps%2Focsp.c;h=92922bc8ad6f0568bac17dd4eb969cef316407b7;hb=08cb96bba2831a8fc3dbda697ab65d64bb05a371;hp=50af2a56f1fd479ffc66775aa8d1df826e95dff4;hpb=99889b46c95711397389959a093f5556ebb39e4b;p=openssl.git diff --git a/apps/ocsp.c b/apps/ocsp.c index 50af2a56f1..92922bc8ad 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -58,11 +58,11 @@ #include #include +#include "apps.h" #include #include #include #include -#include "apps.h" /* Maximum leeway in validity period: default 5 minutes */ #define MAX_VALIDITY_PERIOD (5 * 60) @@ -613,11 +613,11 @@ int MAIN(int argc, char **argv) NULL, e, "CA certificate"); if (rcertfile) { - rother = load_certs(bio_err, sign_certfile, FORMAT_PEM, + rother = load_certs(bio_err, rcertfile, FORMAT_PEM, NULL, e, "responder other certificates"); - if (!sign_other) goto end; + if (!rother) goto end; } - rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, NULL, NULL, + rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, 0, NULL, NULL, "responder private key"); if (!rkey) goto end; @@ -663,7 +663,7 @@ int MAIN(int argc, char **argv) NULL, e, "signer certificates"); if (!sign_other) goto end; } - key = load_key(bio_err, keyfile, FORMAT_PEM, NULL, NULL, + key = load_key(bio_err, keyfile, FORMAT_PEM, 0, NULL, NULL, "signer private key"); if (!key) goto end; @@ -899,7 +899,7 @@ end: SSL_CTX_free(ctx); } - EXIT(ret); + OPENSSL_EXIT(ret); } static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer, @@ -1120,7 +1120,10 @@ static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser) char *itmp, *row[DB_NUMBER],**rrow; for (i = 0; i < DB_NUMBER; i++) row[i] = NULL; bn = ASN1_INTEGER_to_BN(ser,NULL); - itmp = BN_bn2hex(bn); + if (BN_is_zero(bn)) + itmp = BUF_strdup("00"); + else + itmp = BN_bn2hex(bn); row[DB_serial] = itmp; BN_free(bn); rrow=TXT_DB_get_by_index(db,DB_serial,row); @@ -1176,7 +1179,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port for(;;) { - len = BIO_gets(cbio, inbuf, 1024); + len = BIO_gets(cbio, inbuf, sizeof inbuf); if (len <= 0) return 1; /* Look for "POST" signalling start of query */