From: Richard Levitte Date: Wed, 20 Sep 2000 14:44:44 +0000 (+0000) Subject: Merge of main trunk, all conflicts resolved. X-Git-Tag: OpenSSL-engine-0_9_6-beta3~8 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c200ff0446c2235d67cb62cfe6c8e3cfead956f2;p=oweals%2Fopenssl.git Merge of main trunk, all conflicts resolved. --- diff --git a/CHANGES b/CHANGES index af491c8f71..786ab5064c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,22 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] + *) On VMS, stdout may very well lead to a file that is written to + in a record-oriented fashion. That means that every write() will + write a separate record, which will be read separately by the + programs trying to read from it. This can be very confusing. + + The solution is to put a BIO filter in the way that will buffer + text until a linefeed is reached, and then write everything a + line at a time, so every record written will be an actual line, + not chunks of lines and not (usually doesn't happen, but I've + seen it once) several lines in one record. BIO_f_linebuffer() is + the answer. + + Currently, it's a VMS-only method, because that's where it has + been tested well enough. + [Richard Levitte] + *) Remove 'optimized' squaring variant in BN_mod_mul_montgomery, it can return incorrect results. (Note: The buggy variant was not enabled in OpenSSL 0.9.5a, diff --git a/apps/asn1pars.c b/apps/asn1pars.c index 30e1da443a..f25c9f84e8 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -206,6 +206,12 @@ bad: goto end; } BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif if (oidfile != NULL) { @@ -315,7 +321,7 @@ bad: end: BIO_free(derout); if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (b64 != NULL) BIO_free(b64); if (ret != 0) ERR_print_errors(bio_err); diff --git a/apps/ca.c b/apps/ca.c index b6f2f51afe..2ab0c4db51 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -717,6 +717,12 @@ bad: if (verbose) { BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */ +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif TXT_DB_write(out,db); BIO_printf(bio_err,"%d entries loaded from the database\n", db->data->num); @@ -751,7 +757,15 @@ bad: } } else + { BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + Sout = BIO_push(tmpbio, Sout); + } +#endif + } } if (req) @@ -1047,7 +1061,7 @@ bad: #endif BIO_free(in); - BIO_free(out); + BIO_free_all(out); in=NULL; out=NULL; if (rename(serialfile,buf[2]) < 0) @@ -1264,9 +1278,9 @@ bad: ret=0; err: BIO_free(hex); - BIO_free(Cout); - BIO_free(Sout); - BIO_free(out); + BIO_free_all(Cout); + BIO_free_all(Sout); + BIO_free_all(out); BIO_free(in); sk_X509_pop_free(cert_sk,X509_free); @@ -1381,7 +1395,7 @@ static int save_serial(char *serialfile, BIGNUM *serial) BIO_puts(out,"\n"); ret=1; err: - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (ai != NULL) ASN1_INTEGER_free(ai); return(ret); } diff --git a/apps/ciphers.c b/apps/ciphers.c index 72b2009e18..b6e2f966d8 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -108,6 +108,12 @@ int MAIN(int argc, char **argv) if (bio_err == NULL) bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); STDout=BIO_new_fp(stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + STDout = BIO_push(tmpbio, STDout); + } +#endif argc--; argv++; @@ -195,7 +201,7 @@ err: end: if (ctx != NULL) SSL_CTX_free(ctx); if (ssl != NULL) SSL_free(ssl); - if (STDout != NULL) BIO_free(STDout); + if (STDout != NULL) BIO_free_all(STDout); EXIT(ret); } diff --git a/apps/crl.c b/apps/crl.c index b1c3325f21..3b5725f23f 100644 --- a/apps/crl.c +++ b/apps/crl.c @@ -122,7 +122,15 @@ int MAIN(int argc, char **argv) if (bio_out == NULL) if ((bio_out=BIO_new(BIO_s_file())) != NULL) + { BIO_set_fp(bio_out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + bio_out = BIO_push(tmpbio, bio_out); + } +#endif + } informat=FORMAT_PEM; outformat=FORMAT_PEM; @@ -314,7 +322,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -340,8 +356,8 @@ bad: if (!i) { BIO_printf(bio_err,"unable to write CRL\n"); goto end; } ret=0; end: - BIO_free(out); - BIO_free(bio_out); + BIO_free_all(out); + BIO_free_all(bio_out); bio_out=NULL; X509_CRL_free(x); if(store) { diff --git a/apps/crl2p7.c b/apps/crl2p7.c index d02862710d..7f853b65ab 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -239,7 +239,15 @@ bad: sk_free(certflst); if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -266,7 +274,7 @@ bad: ret=0; end: if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (p7 != NULL) PKCS7_free(p7); if (crl != NULL) X509_CRL_free(crl); diff --git a/apps/dgst.c b/apps/dgst.c index 590f8dc4ee..ab3e2dbb02 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -263,7 +263,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", @@ -350,7 +358,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); diff --git a/apps/dh.c b/apps/dh.c index e8c9b4c9f4..229ba2f63a 100644 --- a/apps/dh.c +++ b/apps/dh.c @@ -211,7 +211,15 @@ bad: } } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -336,7 +344,7 @@ bad: ret=0; end: if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); EXIT(ret); } diff --git a/apps/dhparam.c b/apps/dhparam.c index 8bc686d7d3..9d5705f8bf 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -417,7 +417,15 @@ bad: goto end; } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -522,7 +530,7 @@ bad: ret=0; end: if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); EXIT(ret); } diff --git a/apps/dsa.c b/apps/dsa.c index c65e0ececc..49ca9003ac 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -260,7 +260,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -308,7 +316,7 @@ bad: ret=0; end: if(in != NULL) BIO_free(in); - if(out != NULL) BIO_free(out); + if(out != NULL) BIO_free_all(out); if(dsa != NULL) DSA_free(dsa); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); diff --git a/apps/dsaparam.c b/apps/dsaparam.c index bfaa9f780c..67f054c645 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -207,7 +207,15 @@ bad: } } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -349,7 +357,7 @@ bad: ret=0; end: if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); EXIT(ret); } diff --git a/apps/enc.c b/apps/enc.c index e1e37c0310..b9190ef53f 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -443,7 +443,15 @@ bad: if (outf == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outf) <= 0) @@ -611,7 +619,7 @@ end: if (strbuf != NULL) OPENSSL_free(strbuf); if (buff != NULL) OPENSSL_free(buff); if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (benc != NULL) BIO_free(benc); if (b64 != NULL) BIO_free(b64); if(pass) OPENSSL_free(pass); diff --git a/apps/errstr.c b/apps/errstr.c index 2c62046476..e392328f93 100644 --- a/apps/errstr.c +++ b/apps/errstr.c @@ -91,12 +91,18 @@ int MAIN(int argc, char **argv) out=BIO_new(BIO_s_file()); if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE)) { +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif lh_node_stats_bio((LHASH *)ERR_get_string_table(),out); lh_stats_bio((LHASH *)ERR_get_string_table(),out); lh_node_usage_stats_bio((LHASH *) ERR_get_string_table(),out); } - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); argc--; argv++; } diff --git a/apps/gendh.c b/apps/gendh.c index 73d0fe0d06..e81109eaac 100644 --- a/apps/gendh.c +++ b/apps/gendh.c @@ -169,7 +169,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -201,7 +209,7 @@ bad: end: if (ret != 0) ERR_print_errors(bio_err); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (dh != NULL) DH_free(dh); EXIT(ret); } diff --git a/apps/gendsa.c b/apps/gendsa.c index f0b84a2355..1c0ec371d2 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -205,7 +205,15 @@ bad: if (out == NULL) goto end; if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -236,7 +244,7 @@ end: if (ret != 0) ERR_print_errors(bio_err); if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); if(passout) OPENSSL_free(passout); EXIT(ret); diff --git a/apps/genrsa.c b/apps/genrsa.c index 1ab0d84b3a..e7445e6a49 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -195,7 +195,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -240,7 +248,7 @@ bad: ret=0; err: if (rsa != NULL) RSA_free(rsa); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if(passout) OPENSSL_free(passout); if (ret != 0) ERR_print_errors(bio_err); diff --git a/apps/nseq.c b/apps/nseq.c index 7210fbdb5e..1d73d1ad52 100644 --- a/apps/nseq.c +++ b/apps/nseq.c @@ -119,8 +119,15 @@ int MAIN(int argc, char **argv) "Can't open output file %s\n", outfile); goto end; } - } 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 (toseq) { seq = NETSCAPE_CERT_SEQUENCE_new(); seq->certs = sk_X509_new_null(); @@ -152,7 +159,7 @@ int MAIN(int argc, char **argv) ret = 0; end: BIO_free(in); - BIO_free(out); + BIO_free_all(out); NETSCAPE_CERT_SEQUENCE_free(seq); EXIT(ret); diff --git a/apps/openssl.c b/apps/openssl.c index c3680c5e71..4f61006b73 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -238,13 +238,19 @@ static int do_cmd(LHASH *prog, int argc, char *argv[]) else if ((strncmp(argv[0],"no-",3)) == 0) { BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + bio_stdout = BIO_push(tmpbio, bio_stdout); + } +#endif f.name=argv[0]+3; ret = (lh_retrieve(prog,&f) != NULL); if (!ret) BIO_printf(bio_stdout, "%s\n", argv[0]); else BIO_printf(bio_stdout, "%s\n", argv[0]+3); - BIO_free(bio_stdout); + BIO_free_all(bio_stdout); goto end; } else if ((strcmp(argv[0],"quit") == 0) || @@ -269,11 +275,17 @@ static int do_cmd(LHASH *prog, int argc, char *argv[]) else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */ list_type = FUNC_TYPE_CIPHER; bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + bio_stdout = BIO_push(tmpbio, bio_stdout); + } +#endif for (fp=functions; fp->name != NULL; fp++) if (fp->type == list_type) BIO_printf(bio_stdout, "%s\n", fp->name); - BIO_free(bio_stdout); + BIO_free_all(bio_stdout); ret=0; goto end; } diff --git a/apps/passwd.c b/apps/passwd.c index 6c1aed0f0b..6851a9927d 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -81,6 +81,12 @@ int MAIN(int argc, char **argv) if (out == NULL) goto err; BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif badopt = 0, opt_done = 0; i = 0; @@ -276,7 +282,7 @@ err: if (in) BIO_free(in); if (out) - BIO_free(out); + BIO_free_all(out); EXIT(ret); } diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 95b2c65e2f..365a8ada93 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -373,8 +373,15 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("write files"); #endif - if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE); - else out = BIO_new_file(outfile, "wb"); + if (!outfile) { + out = BIO_new_fp(stdout, BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else out = BIO_new_file(outfile, "wb"); if (!out) { BIO_printf(bio_err, "Error opening output file %s\n", outfile ? outfile : ""); @@ -680,7 +687,7 @@ int MAIN(int argc, char **argv) CRYPTO_remove_all_info(); #endif BIO_free(in); - BIO_free(out); + BIO_free_all(out); if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); diff --git a/apps/pkcs7.c b/apps/pkcs7.c index 520e399b67..b348da2203 100644 --- a/apps/pkcs7.c +++ b/apps/pkcs7.c @@ -223,7 +223,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -307,6 +315,6 @@ bad: end: if (p7 != NULL) PKCS7_free(p7); if (in != NULL) BIO_free(in); - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); EXIT(ret); } diff --git a/apps/pkcs8.c b/apps/pkcs8.c index d2ad13928c..bd1697a325 100644 --- a/apps/pkcs8.c +++ b/apps/pkcs8.c @@ -224,8 +224,15 @@ int MAIN(int argc, char **argv) "Can't open output file %s\n", outfile); return (1); } - } 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 (topk8) { if(informat == FORMAT_PEM) pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin); @@ -283,7 +290,7 @@ int MAIN(int argc, char **argv) } PKCS8_PRIV_KEY_INFO_free (p8inf); EVP_PKEY_free(pkey); - BIO_free(out); + BIO_free_all(out); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); return (0); @@ -366,7 +373,7 @@ int MAIN(int argc, char **argv) } EVP_PKEY_free(pkey); - BIO_free(out); + BIO_free_all(out); BIO_free(in); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); diff --git a/apps/rand.c b/apps/rand.c index 236d4a23fe..6add7bbd6c 100644 --- a/apps/rand.c +++ b/apps/rand.c @@ -130,7 +130,15 @@ int MAIN(int argc, char **argv) if (outfile != NULL) r = BIO_write_filename(out, outfile); else + { r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } if (r <= 0) goto err; diff --git a/apps/req.c b/apps/req.c index 691c2b0f05..0751d92201 100644 --- a/apps/req.c +++ b/apps/req.c @@ -649,6 +649,12 @@ bad: { BIO_printf(bio_err,"writing new private key to stdout\n"); BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif } else { @@ -844,7 +850,15 @@ loop: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if ((keyout != NULL) && (strcmp(outfile,keyout) == 0)) @@ -930,7 +944,7 @@ end: } if ((req_conf != NULL) && (req_conf != config)) CONF_free(req_conf); BIO_free(in); - BIO_free(out); + BIO_free_all(out); EVP_PKEY_free(pkey); X509_REQ_free(req); X509_free(x509ss); diff --git a/apps/rsa.c b/apps/rsa.c index 52b3ad7438..7e9e5e2c38 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -305,7 +305,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -404,7 +412,7 @@ bad: ret=0; end: if(in != NULL) BIO_free(in); - if(out != NULL) BIO_free(out); + if(out != NULL) BIO_free_all(out); if(rsa != NULL) RSA_free(rsa); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); diff --git a/apps/rsautl.c b/apps/rsautl.c index 3d87423da3..2ef75649dd 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -222,7 +222,15 @@ int MAIN(int argc, char **argv) ERR_print_errors(bio_err); goto end; } - } 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 + } keysize = RSA_size(rsa); @@ -279,7 +287,7 @@ int MAIN(int argc, char **argv) end: RSA_free(rsa); BIO_free(in); - BIO_free(out); + BIO_free_all(out); if(rsa_in) OPENSSL_free(rsa_in); if(rsa_out) OPENSSL_free(rsa_out); return ret; diff --git a/apps/sess_id.c b/apps/sess_id.c index 71d5aa0b7c..60cc3f1e49 100644 --- a/apps/sess_id.c +++ b/apps/sess_id.c @@ -206,7 +206,15 @@ bad: } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -262,7 +270,7 @@ bad: } ret=0; end: - if (out != NULL) BIO_free(out); + if (out != NULL) BIO_free_all(out); if (x != NULL) SSL_SESSION_free(x); EXIT(ret); } diff --git a/apps/smime.c b/apps/smime.c index 8d5fbbb76a..16b940084b 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -420,7 +420,15 @@ int MAIN(int argc, char **argv) "Can't open output file %s\n", outfile); goto end; } - } 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(operation == SMIME_VERIFY) { if(!(store = setup_verify(CAfile, CApath))) goto end; @@ -517,7 +525,7 @@ end: PKCS7_free(p7); BIO_free(in); BIO_free(indata); - BIO_free(out); + BIO_free_all(out); if(passin) OPENSSL_free(passin); return (ret); } diff --git a/apps/spkac.c b/apps/spkac.c index 152f6bf464..d7e46782f7 100644 --- a/apps/spkac.c +++ b/apps/spkac.c @@ -219,7 +219,15 @@ bad: spkstr = NETSCAPE_SPKI_b64_encode(spki); if (outfile) 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\n"); @@ -268,7 +276,15 @@ bad: } if (outfile) 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\n"); @@ -295,7 +311,7 @@ end: CONF_free(conf); NETSCAPE_SPKI_free(spki); BIO_free(in); - BIO_free(out); + BIO_free_all(out); BIO_free(key); EVP_PKEY_free(pkey); if(passin) OPENSSL_free(passin); diff --git a/apps/x509.c b/apps/x509.c index 5700b09d7a..0c0d42a0ac 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -187,6 +187,12 @@ int MAIN(int argc, char **argv) if (bio_err == NULL) bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); STDout=BIO_new_fp(stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + STDout = BIO_push(tmpbio, STDout); + } +#endif informat=FORMAT_PEM; outformat=FORMAT_PEM; @@ -603,7 +609,15 @@ bad: goto end; } if (outfile == NULL) + { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else { if (BIO_write_filename(out,outfile) <= 0) @@ -960,8 +974,8 @@ end: app_RAND_write_file(NULL, bio_err); OBJ_cleanup(); CONF_free(extconf); - BIO_free(out); - BIO_free(STDout); + BIO_free_all(out); + BIO_free_all(STDout); X509_STORE_free(ctx); X509_REQ_free(req); X509_free(x); diff --git a/crypto/bio/Makefile.ssl b/crypto/bio/Makefile.ssl index 17d2314398..af5998b102 100644 --- a/crypto/bio/Makefile.ssl +++ b/crypto/bio/Makefile.ssl @@ -27,11 +27,13 @@ LIBSRC= bio_lib.c bio_cb.c bio_err.c \ bss_file.c bss_sock.c bss_conn.c \ bf_null.c bf_buff.c b_print.c b_dump.c \ b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c +# bf_lbuf.c LIBOBJ= bio_lib.o bio_cb.o bio_err.o \ bss_mem.o bss_null.o bss_fd.o \ bss_file.o bss_sock.o bss_conn.o \ bf_null.o bf_buff.o b_print.o b_dump.o \ b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o +# bf_lbuf.o SRC= $(LIBSRC) diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index b7ab206777..97003b503c 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -91,6 +91,7 @@ extern "C" { #define BIO_TYPE_NULL_FILTER (17|0x0200) #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ +#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ #define BIO_TYPE_FILTER 0x0200 @@ -554,6 +555,9 @@ BIO_METHOD *BIO_s_bio(void); BIO_METHOD *BIO_s_null(void); BIO_METHOD *BIO_f_null(void); BIO_METHOD *BIO_f_buffer(void); +#ifdef VMS +BIO_METHOD *BIO_f_linebuffer(void); +#endif BIO_METHOD *BIO_f_nbio_test(void); /* BIO_METHOD *BIO_f_ber(void); */ @@ -640,6 +644,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); #define BIO_F_CONN_CTRL 127 #define BIO_F_CONN_STATE 115 #define BIO_F_FILE_CTRL 116 +#define BIO_F_LINEBUFFER_CTRL 129 #define BIO_F_MEM_READ 128 #define BIO_F_MEM_WRITE 117 #define BIO_F_SSL_NEW 118 diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index fb99195471..bb815fb1e6 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -91,6 +91,7 @@ static ERR_STRING_DATA BIO_str_functs[]= {ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"}, {ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"}, {ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"}, +{ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"}, {ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"}, {ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"}, {ERR_PACK(0,BIO_F_SSL_NEW,0), "SSL_new"}, diff --git a/crypto/crypto-lib.com b/crypto/crypto-lib.com index 8db8832365..21d56a4b50 100644 --- a/crypto/crypto-lib.com +++ b/crypto/crypto-lib.com @@ -213,7 +213,8 @@ $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - "bss_mem,bss_null,bss_fd,"+ - "bss_file,bss_sock,bss_conn,"+ - "bf_null,bf_buff,b_print,b_dump,"+ - - "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log" + "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ - + "bf_lbuf" $ LIB_STACK = "stack" $ LIB_LHASH = "lhash,lh_stats" $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,rand_win" diff --git a/crypto/symhacks.h b/crypto/symhacks.h index 6b472b2f4c..358ad355bb 100644 --- a/crypto/symhacks.h +++ b/crypto/symhacks.h @@ -138,8 +138,8 @@ #define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud /* Hack some long ENGINE names */ -#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt -#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt +#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt +#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt #endif /* defined VMS */ diff --git a/util/libeay.num b/util/libeay.num index e9ce9941b0..e8eebbf50c 100755 --- a/util/libeay.num +++ b/util/libeay.num @@ -1869,61 +1869,62 @@ RSA_PKCS1_RSAref 2459 EXIST:RSAREF:FUNCTION:RSA X509_keyid_set1 2460 EXIST::FUNCTION: BIO_next 2461 EXIST::FUNCTION: DSO_METHOD_vms 2462 EXIST::FUNCTION: -ERR_load_ENGINE_strings 2463 EXIST::FUNCTION: -ENGINE_set_DSA 2464 EXIST::FUNCTION: -ENGINE_get_finish_function 2465 EXIST::FUNCTION: -ENGINE_get_default_RSA 2466 EXIST::FUNCTION: -ENGINE_get_BN_mod_exp 2467 EXIST::FUNCTION: -DSA_get_default_openssl_method 2468 EXIST::FUNCTION:DSA -ENGINE_set_DH 2469 EXIST::FUNCTION: -ENGINE_set_default_BN_mod_exp_crt 2470 EXIST:!VMS:FUNCTION: -ENGINE_set_def_BN_mod_exp_crt 2470 EXIST:VMS:FUNCTION: -ENGINE_init 2471 EXIST::FUNCTION: -DH_get_default_openssl_method 2472 EXIST::FUNCTION:DH -RSA_set_default_openssl_method 2473 EXIST::FUNCTION:RSA -ENGINE_finish 2474 EXIST::FUNCTION: -ENGINE_load_public_key 2475 EXIST::FUNCTION: -ENGINE_get_DH 2476 EXIST::FUNCTION: -ENGINE_ctrl 2477 EXIST::FUNCTION: -ENGINE_get_init_function 2478 EXIST::FUNCTION: -ENGINE_set_init_function 2479 EXIST::FUNCTION: -ENGINE_set_default_DSA 2480 EXIST::FUNCTION: -ENGINE_get_name 2481 EXIST::FUNCTION: -ENGINE_get_last 2482 EXIST::FUNCTION: -ENGINE_get_prev 2483 EXIST::FUNCTION: -ENGINE_get_default_DH 2484 EXIST::FUNCTION: -ENGINE_get_RSA 2485 EXIST::FUNCTION: -ENGINE_set_default 2486 EXIST::FUNCTION: -ENGINE_get_RAND 2487 EXIST::FUNCTION: -ENGINE_get_first 2488 EXIST::FUNCTION: -ENGINE_by_id 2489 EXIST::FUNCTION: -ENGINE_set_finish_function 2490 EXIST::FUNCTION: -ENGINE_get_default_BN_mod_exp_crt 2491 EXIST:!VMS:FUNCTION: -ENGINE_get_def_BN_mod_exp_crt 2491 EXIST:VMS:FUNCTION: -RSA_get_default_openssl_method 2492 EXIST::FUNCTION:RSA -ENGINE_set_RSA 2493 EXIST::FUNCTION: -ENGINE_load_private_key 2494 EXIST::FUNCTION: -ENGINE_set_default_RAND 2495 EXIST::FUNCTION: -ENGINE_set_BN_mod_exp 2496 EXIST::FUNCTION: -ENGINE_remove 2497 EXIST::FUNCTION: -ENGINE_free 2498 EXIST::FUNCTION: -ENGINE_get_BN_mod_exp_crt 2499 EXIST::FUNCTION: -ENGINE_get_next 2500 EXIST::FUNCTION: -ENGINE_set_name 2501 EXIST::FUNCTION: -ENGINE_get_default_DSA 2502 EXIST::FUNCTION: -ENGINE_set_default_BN_mod_exp 2503 EXIST::FUNCTION: -ENGINE_set_default_RSA 2504 EXIST::FUNCTION: -ENGINE_get_default_RAND 2505 EXIST::FUNCTION: -ENGINE_get_default_BN_mod_exp 2506 EXIST::FUNCTION: -ENGINE_set_RAND 2507 EXIST::FUNCTION: -ENGINE_set_id 2508 EXIST::FUNCTION: -ENGINE_set_BN_mod_exp_crt 2509 EXIST::FUNCTION: -ENGINE_set_default_DH 2510 EXIST::FUNCTION: -ENGINE_new 2511 EXIST::FUNCTION: -ENGINE_get_id 2512 EXIST::FUNCTION: -DSA_set_default_openssl_method 2513 EXIST::FUNCTION:DSA -ENGINE_add 2514 EXIST::FUNCTION: -DH_set_default_openssl_method 2515 EXIST::FUNCTION:DH -ENGINE_get_DSA 2516 EXIST::FUNCTION: -ENGINE_get_ctrl_function 2517 EXIST::FUNCTION: -ENGINE_set_ctrl_function 2518 EXIST::FUNCTION: +BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: +ERR_load_ENGINE_strings 2464 EXIST::FUNCTION: +ENGINE_set_DSA 2465 EXIST::FUNCTION: +ENGINE_get_finish_function 2466 EXIST::FUNCTION: +ENGINE_get_default_RSA 2467 EXIST::FUNCTION: +ENGINE_get_BN_mod_exp 2468 EXIST::FUNCTION: +DSA_get_default_openssl_method 2469 EXIST::FUNCTION:DSA +ENGINE_set_DH 2470 EXIST::FUNCTION: +ENGINE_set_default_BN_mod_exp_crt 2471 EXIST:!VMS:FUNCTION: +ENGINE_set_def_BN_mod_exp_crt 2471 EXIST:VMS:FUNCTION: +ENGINE_init 2472 EXIST::FUNCTION: +DH_get_default_openssl_method 2473 EXIST::FUNCTION:DH +RSA_set_default_openssl_method 2474 EXIST::FUNCTION:RSA +ENGINE_finish 2475 EXIST::FUNCTION: +ENGINE_load_public_key 2476 EXIST::FUNCTION: +ENGINE_get_DH 2477 EXIST::FUNCTION: +ENGINE_ctrl 2478 EXIST::FUNCTION: +ENGINE_get_init_function 2479 EXIST::FUNCTION: +ENGINE_set_init_function 2480 EXIST::FUNCTION: +ENGINE_set_default_DSA 2481 EXIST::FUNCTION: +ENGINE_get_name 2482 EXIST::FUNCTION: +ENGINE_get_last 2483 EXIST::FUNCTION: +ENGINE_get_prev 2484 EXIST::FUNCTION: +ENGINE_get_default_DH 2485 EXIST::FUNCTION: +ENGINE_get_RSA 2486 EXIST::FUNCTION: +ENGINE_set_default 2487 EXIST::FUNCTION: +ENGINE_get_RAND 2488 EXIST::FUNCTION: +ENGINE_get_first 2489 EXIST::FUNCTION: +ENGINE_by_id 2490 EXIST::FUNCTION: +ENGINE_set_finish_function 2491 EXIST::FUNCTION: +ENGINE_get_default_BN_mod_exp_crt 2492 EXIST:!VMS:FUNCTION: +ENGINE_get_def_BN_mod_exp_crt 2492 EXIST:VMS:FUNCTION: +RSA_get_default_openssl_method 2493 EXIST::FUNCTION:RSA +ENGINE_set_RSA 2494 EXIST::FUNCTION: +ENGINE_load_private_key 2495 EXIST::FUNCTION: +ENGINE_set_default_RAND 2496 EXIST::FUNCTION: +ENGINE_set_BN_mod_exp 2497 EXIST::FUNCTION: +ENGINE_remove 2498 EXIST::FUNCTION: +ENGINE_free 2499 EXIST::FUNCTION: +ENGINE_get_BN_mod_exp_crt 2500 EXIST::FUNCTION: +ENGINE_get_next 2501 EXIST::FUNCTION: +ENGINE_set_name 2502 EXIST::FUNCTION: +ENGINE_get_default_DSA 2503 EXIST::FUNCTION: +ENGINE_set_default_BN_mod_exp 2504 EXIST::FUNCTION: +ENGINE_set_default_RSA 2505 EXIST::FUNCTION: +ENGINE_get_default_RAND 2506 EXIST::FUNCTION: +ENGINE_get_default_BN_mod_exp 2507 EXIST::FUNCTION: +ENGINE_set_RAND 2508 EXIST::FUNCTION: +ENGINE_set_id 2509 EXIST::FUNCTION: +ENGINE_set_BN_mod_exp_crt 2510 EXIST::FUNCTION: +ENGINE_set_default_DH 2511 EXIST::FUNCTION: +ENGINE_new 2512 EXIST::FUNCTION: +ENGINE_get_id 2513 EXIST::FUNCTION: +DSA_set_default_openssl_method 2514 EXIST::FUNCTION:DSA +ENGINE_add 2515 EXIST::FUNCTION: +DH_set_default_openssl_method 2516 EXIST::FUNCTION:DH +ENGINE_get_DSA 2517 EXIST::FUNCTION: +ENGINE_get_ctrl_function 2518 EXIST::FUNCTION: +ENGINE_set_ctrl_function 2519 EXIST::FUNCTION: