X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fdgst.c;h=0e93c97ca507659450d1d3e89def60ebec675738;hb=1bc5dd3efc7495b72f2780b4ef8d502bd899c783;hp=5d5ab94aea01ee5a1b7005d7be28ba0976ba27cb;hpb=623eea376a7bff6d50c88407c10f279e6f838de4;p=oweals%2Fopenssl.git diff --git a/apps/dgst.c b/apps/dgst.c index 5d5ab94aea..0e93c97ca5 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -74,7 +74,7 @@ #define PROG dgst_main void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, - EVP_PKEY *key, unsigned char *sigin, unsigned int siglen); + EVP_PKEY *key, unsigned char *sigin, int siglen); int MAIN(int, char **); @@ -96,7 +96,7 @@ int MAIN(int argc, char **argv) char out_bin = -1, want_pub = 0, do_verify = 0; EVP_PKEY *sigkey = NULL; unsigned char *sigbuf = NULL; - unsigned int siglen = 0; + int siglen = 0; apps_startup(); @@ -236,7 +236,15 @@ int MAIN(int argc, char **argv) if(out_bin) out = BIO_new_file(outfile, "wb"); else out = BIO_new_file(outfile, "w"); - } else out = BIO_new_fp(stdout, BIO_NOCLOSE); + } else { + out = BIO_new_fp(stdout, BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } if(!out) { BIO_printf(bio_err, "Error opening output file %s\n", @@ -280,7 +288,7 @@ int MAIN(int argc, char **argv) } siglen = BIO_read(sigbio, sigbuf, siglen); BIO_free(sigbio); - if(siglen == 0) { + if(siglen <= 0) { BIO_printf(bio_err, "Error reading signature file %s\n", sigfile); ERR_print_errors(bio_err); @@ -323,7 +331,7 @@ end: OPENSSL_free(buf); } if (in != NULL) BIO_free(in); - BIO_free(out); + BIO_free_all(out); EVP_PKEY_free(sigkey); if(sigbuf) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); @@ -331,7 +339,7 @@ end: } void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, - EVP_PKEY *key, unsigned char *sigin, unsigned int siglen) + EVP_PKEY *key, unsigned char *sigin, int siglen) { int len; int i; @@ -345,7 +353,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout, { EVP_MD_CTX *ctx; BIO_get_md_ctx(bp, &ctx); - i = EVP_VerifyFinal(ctx, sigin, siglen, key); + i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); if(i > 0) BIO_printf(out, "Verified OK\n"); else if(i == 0) BIO_printf(out, "Verification Failure\n"); else