Merge of main trunk, all conflicts resolved.
authorRichard Levitte <levitte@openssl.org>
Wed, 20 Sep 2000 14:44:44 +0000 (14:44 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 20 Sep 2000 14:44:44 +0000 (14:44 +0000)
36 files changed:
CHANGES
apps/asn1pars.c
apps/ca.c
apps/ciphers.c
apps/crl.c
apps/crl2p7.c
apps/dgst.c
apps/dh.c
apps/dhparam.c
apps/dsa.c
apps/dsaparam.c
apps/enc.c
apps/errstr.c
apps/gendh.c
apps/gendsa.c
apps/genrsa.c
apps/nseq.c
apps/openssl.c
apps/passwd.c
apps/pkcs12.c
apps/pkcs7.c
apps/pkcs8.c
apps/rand.c
apps/req.c
apps/rsa.c
apps/rsautl.c
apps/sess_id.c
apps/smime.c
apps/spkac.c
apps/x509.c
crypto/bio/Makefile.ssl
crypto/bio/bio.h
crypto/bio/bio_err.c
crypto/crypto-lib.com
crypto/symhacks.h
util/libeay.num

diff --git a/CHANGES b/CHANGES
index af491c8f71c8ac6a5574340b876321f04f880499..786ab5064c4fea90b3b0652fcafc9add2ca88017 100644 (file)
--- 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,
index 30e1da443a7be0f62629ea041e54bf5b76b06bed..f25c9f84e81c23ee920803c1807eb59a724c48b1 100644 (file)
@@ -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);
index b6f2f51afefa14fb0b1cabccf9f0b2424efa2fe8..2ab0c4db5128ee394a84cfba644c011c7b7e8356 100644 (file)
--- 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);
        }
index 72b2009e1874e70d33223bb836888e54e4ec8212..b6e2f966d86e78d7b01c097ea655fc4932920156 100644 (file)
@@ -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);
        }
 
index b1c3325f21ec8e2d322d01c656765e8140bcb653..3b5725f23f2c4335aed373140bd8ed991009e4f4 100644 (file)
@@ -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) {
index d02862710de66389abdc59b26272d3a00309e791..7f853b65ab2b13bb2cba055bbce53503965970ef 100644 (file)
@@ -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);
 
index 590f8dc4eeb6684039caf9579ae01aa74c068591..ab3e2dbb02486e6afedd00ffd8e92c2499e70998 100644 (file)
@@ -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);
index e8c9b4c9f4434d1529a00c404a5a8cb9e20073aa..229ba2f63a2d5797ea37d595de32655c1423a47c 100644 (file)
--- 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);
        }
index 8bc686d7d3f3136d6ccb51cda5ebe9f398f42229..9d5705f8bfb27a93fd32d1a19807bd805cedee5b 100644 (file)
@@ -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);
        }
index c65e0ececc1d6d88cb954f9bb986a2d1454c2dcb..49ca9003acff3246d6c4afd797a506d229f0677e 100644 (file)
@@ -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);
index bfaa9f780c4e103115598bd011319143abeed511..67f054c6455d57c9c23522e4af633acc6eb6e9a7 100644 (file)
@@ -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);
        }
index e1e37c03101f8f717b2db54c3e8b1c947c95e779..b9190ef53f26755547441bc8718adef29c2bc3ca 100644 (file)
@@ -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);
index 2c6204647692bf5150db3104958ec22c8987f290..e392328f93d2656f84653e53c68de5f37495538f 100644 (file)
@@ -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++;
                }
index 73d0fe0d06474a2795a3e1d9509d39cbd8bccf7e..e81109eaac2780de64478f6892a0e6dd3969d0f2 100644 (file)
@@ -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);
        }
index f0b84a2355c605b6814708b714c0159d2329425c..1c0ec371d272941d03ea8ab3c046f8f4d8fa4b6f 100644 (file)
@@ -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);
index 1ab0d84b3a7f1c5b0a8d810966cac1eb64326881..e7445e6a499bd55ebaf102d73022bed79ff6d72e 100644 (file)
@@ -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);
index 7210fbdb5ec2b82b04e64442b5654feb90e16057..1d73d1ad5231e2e6cdfa5e0a991e0bd019c4276c 100644 (file)
@@ -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);
index c3680c5e711661b15c4edbacda642cf7c04adc13..4f61006b73bf95bf0bbb11f4709980fd44d044c6 100644 (file)
@@ -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;
                }
index 6c1aed0f0b4910b4163dbce704fe3368bb3c5bc2..6851a9927d310a53d4ef06bbd61eb44a30688377 100644 (file)
@@ -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);
        }
 
index 95b2c65e2ff05120c7ba7a9b5b6454a228bdce75..365a8ada937d10a199894f350a8a425726d55533 100644 (file)
@@ -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 : "<stdout>");
@@ -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);
index 520e399b67fc34fdcea16c3e81ea7f6b671ba366..b348da220383961650c6179e6b35696bd9ef3088 100644 (file)
@@ -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);
        }
index d2ad13928c4802f8a2a2fdb8ce537cbd08cafeb9..bd1697a325bcd7b78d2b2274e1fb42ec2fa3a085 100644 (file)
@@ -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);
index 236d4a23fef12a3a73cefd55f08dcd87fac920de..6add7bbd6cafac4a50ce56bb825407b7f0b9fa9d 100644 (file)
@@ -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;
 
index 691c2b0f05ff119a7f5c537b9f468c8f68566653..0751d92201de5fde9b634a882ecc9022a210bb5d 100644 (file)
@@ -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);
index 52b3ad7438d963dda88dc5bcec7f80dc5ca15698..7e9e5e2c38f454c1abb36b5641f8802087cc5e66 100644 (file)
@@ -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);
index 3d87423da30a532e8cdfeef330a1707a2330adb6..2ef75649dd7cd8f6f25e0d690b2bce15b8c59712 100644 (file)
@@ -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;
index 71d5aa0b7c6cde62d68759445f954d696df9716e..60cc3f1e496a3d524e9c408f7c9aa99251e76473 100644 (file)
@@ -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);
        }
index 8d5fbbb76abfdc3f186a5a1814b6b4d546a1b83d..16b940084bc30cca390803a954deb0c8eb3308bd 100644 (file)
@@ -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);
 }
index 152f6bf464278e96bc52940deca65b8c77afdb3d..d7e46782f79e238365af53d12f22be53a66f5508 100644 (file)
@@ -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);
index 5700b09d7a086e29b943e5d1e99c666a926407ea..0c0d42a0ac41ae5e490b9b06976cadf14d2cf753 100644 (file)
@@ -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);
index 17d2314398c6394d5232598a88e7217fcf9af9f7..af5998b102c4bfb2551ec40e663c07d81efb55d5 100644 (file)
@@ -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)
 
index b7ab20677766f2a45a93afe8d8f16db29eb1b9ed..97003b503c6669e5241c830e76e007c9990f7841 100644 (file)
@@ -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
index fb99195471241b551edceaa58e44f3941bacf90a..bb815fb1e60dbe695e0e6890a691d3a9d3bc3dee 100644 (file)
@@ -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"},
index 8db8832365677bb8bf977e5f29a7485908eb0c2c..21d56a4b50da95b48817f47700f4d22d1933fd50 100644 (file)
@@ -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"
index 6b472b2f4cafda505bb6a75bf3a283348c389a8d..358ad355bb4a62e8fb1347a4f61ddc8f8041abd4 100644 (file)
 #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 */
 
index e9ce9941b01d2d5e76ebb9ff3441887c80505683..e8eebbf50c438773fc2ffb10393e1859648df47f 100755 (executable)
@@ -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: