summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortedu <>2014-04-16 02:14:27 +0000
committertedu <>2014-04-16 02:14:27 +0000
commita34460e8d0ec911b448ef9f8078200b1c65ab271 (patch)
tree1199b9584bfd97f993fb3a74769edf685b95c6a9 /src
parentdfe5dbddd74c9bf529f6d716558f2640be992799 (diff)
downloadopenbsd-a34460e8d0ec911b448ef9f8078200b1c65ab271.tar.gz
openbsd-a34460e8d0ec911b448ef9f8078200b1c65ab271.tar.bz2
openbsd-a34460e8d0ec911b448ef9f8078200b1c65ab271.zip
spray the apps directory with anti-VMS napalm.
so that its lovecraftian horror is not forever lost, i reproduce below a comment from the deleted code. /* 2011-03-22 SMS. * If we have 32-bit pointers everywhere, then we're safe, and * we bypass this mess, as on non-VMS systems. (See ARGV, * above.) * Problem 1: Compaq/HP C before V7.3 always used 32-bit * pointers for argv[]. * Fix 1: For a 32-bit argv[], when we're using 64-bit pointers * everywhere else, we always allocate and use a 64-bit * duplicate of argv[]. * Problem 2: Compaq/HP C V7.3 (Alpha, IA64) before ECO1 failed * to NULL-terminate a 64-bit argv[]. (As this was written, the * compiler ECO was available only on IA64.) * Fix 2: Unless advised not to (VMS_TRUST_ARGV), we test a * 64-bit argv[argc] for NULL, and, if necessary, use a * (properly) NULL-terminated (64-bit) duplicate of argv[]. * The same code is used in either case to duplicate argv[]. * Some of these decisions could be handled in preprocessing, * but the code tends to get even uglier, and the penalty for * deciding at compile- or run-time is tiny. */
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/src/apps/apps.c37
-rw-r--r--src/lib/libssl/src/apps/asn1pars.c6
-rw-r--r--src/lib/libssl/src/apps/ca.c30
-rw-r--r--src/lib/libssl/src/apps/ciphers.c6
-rw-r--r--src/lib/libssl/src/apps/cms.c6
-rw-r--r--src/lib/libssl/src/apps/crl.c12
-rw-r--r--src/lib/libssl/src/apps/crl2p7.c6
-rw-r--r--src/lib/libssl/src/apps/dgst.c6
-rw-r--r--src/lib/libssl/src/apps/dh.c6
-rw-r--r--src/lib/libssl/src/apps/dhparam.c6
-rw-r--r--src/lib/libssl/src/apps/dsa.c6
-rw-r--r--src/lib/libssl/src/apps/dsaparam.c6
-rw-r--r--src/lib/libssl/src/apps/ec.c6
-rw-r--r--src/lib/libssl/src/apps/ecparam.c6
-rw-r--r--src/lib/libssl/src/apps/enc.c6
-rw-r--r--src/lib/libssl/src/apps/engine.c6
-rw-r--r--src/lib/libssl/src/apps/errstr.c6
-rw-r--r--src/lib/libssl/src/apps/gendh.c6
-rw-r--r--src/lib/libssl/src/apps/gendsa.c6
-rw-r--r--src/lib/libssl/src/apps/genpkey.c6
-rw-r--r--src/lib/libssl/src/apps/genrsa.c6
-rw-r--r--src/lib/libssl/src/apps/nseq.c6
-rw-r--r--src/lib/libssl/src/apps/ocsp.c5
-rw-r--r--src/lib/libssl/src/apps/openssl.c71
-rw-r--r--src/lib/libssl/src/apps/passwd.c6
-rw-r--r--src/lib/libssl/src/apps/pkcs12.c6
-rw-r--r--src/lib/libssl/src/apps/pkcs7.c6
-rw-r--r--src/lib/libssl/src/apps/pkcs8.c6
-rw-r--r--src/lib/libssl/src/apps/pkey.c6
-rw-r--r--src/lib/libssl/src/apps/pkeyparam.c6
-rw-r--r--src/lib/libssl/src/apps/pkeyutl.c6
-rw-r--r--src/lib/libssl/src/apps/prime.c6
-rw-r--r--src/lib/libssl/src/apps/rand.c6
-rw-r--r--src/lib/libssl/src/apps/req.c12
-rw-r--r--src/lib/libssl/src/apps/rsa.c6
-rw-r--r--src/lib/libssl/src/apps/rsautl.c6
-rw-r--r--src/lib/libssl/src/apps/s_apps.h23
-rw-r--r--src/lib/libssl/src/apps/s_client.c10
-rw-r--r--src/lib/libssl/src/apps/s_server.c14
-rw-r--r--src/lib/libssl/src/apps/s_socket.c9
-rw-r--r--src/lib/libssl/src/apps/sess_id.c6
-rw-r--r--src/lib/libssl/src/apps/smime.c6
-rw-r--r--src/lib/libssl/src/apps/speed.c4
-rw-r--r--src/lib/libssl/src/apps/spkac.c12
-rw-r--r--src/lib/libssl/src/apps/srp.c6
-rw-r--r--src/lib/libssl/src/apps/x509.c12
46 files changed, 0 insertions, 449 deletions
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c
index 4ec99601cf..5162c0179a 100644
--- a/src/lib/libssl/src/apps/apps.c
+++ b/src/lib/libssl/src/apps/apps.c
@@ -109,12 +109,6 @@
109 * 109 *
110 */ 110 */
111 111
112#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
113#define _POSIX_C_SOURCE 2 /* On VMS, you need to define this to get
114 the declaration of fileno(). The value
115 2 is to make sure no function defined
116 in POSIX-2 is left undefined. */
117#endif
118#include <stdio.h> 112#include <stdio.h>
119#include <stdlib.h> 113#include <stdlib.h>
120#include <string.h> 114#include <string.h>
@@ -335,34 +329,6 @@ void program_name(char *in, char *out, int size)
335 out[n]='\0'; 329 out[n]='\0';
336 } 330 }
337#else 331#else
338#ifdef OPENSSL_SYS_VMS
339void program_name(char *in, char *out, int size)
340 {
341 char *p=in, *q;
342 char *chars=":]>";
343
344 while(*chars != '\0')
345 {
346 q=strrchr(p,*chars);
347 if (q > p)
348 p = q + 1;
349 chars++;
350 }
351
352 q=strrchr(p,'.');
353 if (q == NULL)
354 q = p + strlen(p);
355 strncpy(out,p,size-1);
356 if (q-p >= size)
357 {
358 out[size-1]='\0';
359 }
360 else
361 {
362 out[q-p]='\0';
363 }
364 }
365#else
366void program_name(char *in, char *out, int size) 332void program_name(char *in, char *out, int size)
367 { 333 {
368 char *p; 334 char *p;
@@ -375,7 +341,6 @@ void program_name(char *in, char *out, int size)
375 BUF_strlcpy(out,p,size); 341 BUF_strlcpy(out,p,size);
376 } 342 }
377#endif 343#endif
378#endif
379 344
380int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) 345int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
381 { 346 {
@@ -1543,9 +1508,7 @@ char *make_config_name()
1543 len=strlen(t)+strlen(OPENSSL_CONF)+2; 1508 len=strlen(t)+strlen(OPENSSL_CONF)+2;
1544 p=OPENSSL_malloc(len); 1509 p=OPENSSL_malloc(len);
1545 BUF_strlcpy(p,t,len); 1510 BUF_strlcpy(p,t,len);
1546#ifndef OPENSSL_SYS_VMS
1547 BUF_strlcat(p,"/",len); 1511 BUF_strlcat(p,"/",len);
1548#endif
1549 BUF_strlcat(p,OPENSSL_CONF,len); 1512 BUF_strlcat(p,OPENSSL_CONF,len);
1550 1513
1551 return p; 1514 return p;
diff --git a/src/lib/libssl/src/apps/asn1pars.c b/src/lib/libssl/src/apps/asn1pars.c
index 0d6607071f..0ff3cdf3a0 100644
--- a/src/lib/libssl/src/apps/asn1pars.c
+++ b/src/lib/libssl/src/apps/asn1pars.c
@@ -224,12 +224,6 @@ bad:
224 goto end; 224 goto end;
225 } 225 }
226 BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); 226 BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
227#ifdef OPENSSL_SYS_VMS
228 {
229 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
230 out = BIO_push(tmpbio, out);
231 }
232#endif
233 227
234 if (oidfile != NULL) 228 if (oidfile != NULL)
235 { 229 {
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c
index 6f37e029ac..4c71aa2a75 100644
--- a/src/lib/libssl/src/apps/ca.c
+++ b/src/lib/libssl/src/apps/ca.c
@@ -76,15 +76,7 @@
76#include <openssl/pem.h> 76#include <openssl/pem.h>
77 77
78#ifndef W_OK 78#ifndef W_OK
79# ifdef OPENSSL_SYS_VMS
80# if defined(__DECC)
81# include <unistd.h>
82# else
83# include <unixlib.h>
84# endif
85# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_NETWARE)
86# include <sys/file.h> 79# include <sys/file.h>
87# endif
88#endif 80#endif
89 81
90#include "apps.h" 82#include "apps.h"
@@ -587,16 +579,10 @@ bad:
587 const char *s=X509_get_default_cert_area(); 579 const char *s=X509_get_default_cert_area();
588 size_t len; 580 size_t len;
589 581
590#ifdef OPENSSL_SYS_VMS
591 len = strlen(s)+sizeof(CONFIG_FILE);
592 tofree=OPENSSL_malloc(len);
593 strcpy(tofree,s);
594#else
595 len = strlen(s)+sizeof(CONFIG_FILE)+1; 582 len = strlen(s)+sizeof(CONFIG_FILE)+1;
596 tofree=OPENSSL_malloc(len); 583 tofree=OPENSSL_malloc(len);
597 BUF_strlcpy(tofree,s,len); 584 BUF_strlcpy(tofree,s,len);
598 BUF_strlcat(tofree,"/",len); 585 BUF_strlcat(tofree,"/",len);
599#endif
600 BUF_strlcat(tofree,CONFIG_FILE,len); 586 BUF_strlcat(tofree,CONFIG_FILE,len);
601 configfile=tofree; 587 configfile=tofree;
602 } 588 }
@@ -854,7 +840,6 @@ bad:
854 BIO_printf(bio_err,"there needs to be defined a directory for new certificate to be placed in\n"); 840 BIO_printf(bio_err,"there needs to be defined a directory for new certificate to be placed in\n");
855 goto err; 841 goto err;
856 } 842 }
857#ifndef OPENSSL_SYS_VMS
858 /* outdir is a directory spec, but access() for VMS demands a 843 /* outdir is a directory spec, but access() for VMS demands a
859 filename. In any case, stat(), below, will catch the problem 844 filename. In any case, stat(), below, will catch the problem
860 if outdir is not a directory spec, and the fopen() or open() 845 if outdir is not a directory spec, and the fopen() or open()
@@ -882,7 +867,6 @@ bad:
882 perror(outdir); 867 perror(outdir);
883 goto err; 868 goto err;
884 } 869 }
885#endif
886 } 870 }
887 871
888 /*****************************************************************/ 872 /*****************************************************************/
@@ -943,12 +927,6 @@ bad:
943 if (verbose) 927 if (verbose)
944 { 928 {
945 BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */ 929 BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */
946#ifdef OPENSSL_SYS_VMS
947 {
948 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
949 out = BIO_push(tmpbio, out);
950 }
951#endif
952 TXT_DB_write(out,db->db); 930 TXT_DB_write(out,db->db);
953 BIO_printf(bio_err,"%d entries loaded from the database\n", 931 BIO_printf(bio_err,"%d entries loaded from the database\n",
954 sk_OPENSSL_PSTRING_num(db->db->data)); 932 sk_OPENSSL_PSTRING_num(db->db->data));
@@ -1026,12 +1004,6 @@ bad:
1026 else 1004 else
1027 { 1005 {
1028 BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT); 1006 BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
1029#ifdef OPENSSL_SYS_VMS
1030 {
1031 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
1032 Sout = BIO_push(tmpbio, Sout);
1033 }
1034#endif
1035 } 1007 }
1036 } 1008 }
1037 1009
@@ -1319,9 +1291,7 @@ bad:
1319 1291
1320 strlcpy(buf[2],outdir,sizeof(buf[2])); 1292 strlcpy(buf[2],outdir,sizeof(buf[2]));
1321 1293
1322#ifndef OPENSSL_SYS_VMS
1323 BUF_strlcat(buf[2],"/",sizeof(buf[2])); 1294 BUF_strlcat(buf[2],"/",sizeof(buf[2]));
1324#endif
1325 1295
1326 n=(char *)&(buf[2][strlen(buf[2])]); 1296 n=(char *)&(buf[2][strlen(buf[2])]);
1327 if (j > 0) 1297 if (j > 0)
diff --git a/src/lib/libssl/src/apps/ciphers.c b/src/lib/libssl/src/apps/ciphers.c
index 1906ca85a2..b5ab166bc5 100644
--- a/src/lib/libssl/src/apps/ciphers.c
+++ b/src/lib/libssl/src/apps/ciphers.c
@@ -103,12 +103,6 @@ int MAIN(int argc, char **argv)
103 if (bio_err == NULL) 103 if (bio_err == NULL)
104 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 104 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
105 STDout=BIO_new_fp(stdout,BIO_NOCLOSE); 105 STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
106#ifdef OPENSSL_SYS_VMS
107 {
108 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
109 STDout = BIO_push(tmpbio, STDout);
110 }
111#endif
112 if (!load_config(bio_err, NULL)) 106 if (!load_config(bio_err, NULL))
113 goto end; 107 goto end;
114 108
diff --git a/src/lib/libssl/src/apps/cms.c b/src/lib/libssl/src/apps/cms.c
index 5f77f8fbb0..801d523caf 100644
--- a/src/lib/libssl/src/apps/cms.c
+++ b/src/lib/libssl/src/apps/cms.c
@@ -878,12 +878,6 @@ int MAIN(int argc, char **argv)
878 else 878 else
879 { 879 {
880 out = BIO_new_fp(stdout, BIO_NOCLOSE); 880 out = BIO_new_fp(stdout, BIO_NOCLOSE);
881#ifdef OPENSSL_SYS_VMS
882 {
883 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
884 out = BIO_push(tmpbio, out);
885 }
886#endif
887 } 881 }
888 882
889 if ((operation == SMIME_VERIFY) || (operation == SMIME_VERIFY_RECEIPT)) 883 if ((operation == SMIME_VERIFY) || (operation == SMIME_VERIFY_RECEIPT))
diff --git a/src/lib/libssl/src/apps/crl.c b/src/lib/libssl/src/apps/crl.c
index 8797d300cf..88e606554a 100644
--- a/src/lib/libssl/src/apps/crl.c
+++ b/src/lib/libssl/src/apps/crl.c
@@ -137,12 +137,6 @@ int MAIN(int argc, char **argv)
137 if ((bio_out=BIO_new(BIO_s_file())) != NULL) 137 if ((bio_out=BIO_new(BIO_s_file())) != NULL)
138 { 138 {
139 BIO_set_fp(bio_out,stdout,BIO_NOCLOSE); 139 BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
140#ifdef OPENSSL_SYS_VMS
141 {
142 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
143 bio_out = BIO_push(tmpbio, bio_out);
144 }
145#endif
146 } 140 }
147 141
148 informat=FORMAT_PEM; 142 informat=FORMAT_PEM;
@@ -372,12 +366,6 @@ bad:
372 if (outfile == NULL) 366 if (outfile == NULL)
373 { 367 {
374 BIO_set_fp(out,stdout,BIO_NOCLOSE); 368 BIO_set_fp(out,stdout,BIO_NOCLOSE);
375#ifdef OPENSSL_SYS_VMS
376 {
377 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
378 out = BIO_push(tmpbio, out);
379 }
380#endif
381 } 369 }
382 else 370 else
383 { 371 {
diff --git a/src/lib/libssl/src/apps/crl2p7.c b/src/lib/libssl/src/apps/crl2p7.c
index bbc83774db..20207091a9 100644
--- a/src/lib/libssl/src/apps/crl2p7.c
+++ b/src/lib/libssl/src/apps/crl2p7.c
@@ -241,12 +241,6 @@ bad:
241 if (outfile == NULL) 241 if (outfile == NULL)
242 { 242 {
243 BIO_set_fp(out,stdout,BIO_NOCLOSE); 243 BIO_set_fp(out,stdout,BIO_NOCLOSE);
244#ifdef OPENSSL_SYS_VMS
245 {
246 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
247 out = BIO_push(tmpbio, out);
248 }
249#endif
250 } 244 }
251 else 245 else
252 { 246 {
diff --git a/src/lib/libssl/src/apps/dgst.c b/src/lib/libssl/src/apps/dgst.c
index f4aec779c1..0615fa837b 100644
--- a/src/lib/libssl/src/apps/dgst.c
+++ b/src/lib/libssl/src/apps/dgst.c
@@ -328,12 +328,6 @@ int MAIN(int argc, char **argv)
328 else out = BIO_new_file(outfile, "w"); 328 else out = BIO_new_file(outfile, "w");
329 } else { 329 } else {
330 out = BIO_new_fp(stdout, BIO_NOCLOSE); 330 out = BIO_new_fp(stdout, BIO_NOCLOSE);
331#ifdef OPENSSL_SYS_VMS
332 {
333 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
334 out = BIO_push(tmpbio, out);
335 }
336#endif
337 } 331 }
338 332
339 if(!out) { 333 if(!out) {
diff --git a/src/lib/libssl/src/apps/dh.c b/src/lib/libssl/src/apps/dh.c
index dee9c01fce..5f534261ed 100644
--- a/src/lib/libssl/src/apps/dh.c
+++ b/src/lib/libssl/src/apps/dh.c
@@ -210,12 +210,6 @@ bad:
210 if (outfile == NULL) 210 if (outfile == NULL)
211 { 211 {
212 BIO_set_fp(out,stdout,BIO_NOCLOSE); 212 BIO_set_fp(out,stdout,BIO_NOCLOSE);
213#ifdef OPENSSL_SYS_VMS
214 {
215 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
216 out = BIO_push(tmpbio, out);
217 }
218#endif
219 } 213 }
220 else 214 else
221 { 215 {
diff --git a/src/lib/libssl/src/apps/dhparam.c b/src/lib/libssl/src/apps/dhparam.c
index 93bab90b72..193e59bd01 100644
--- a/src/lib/libssl/src/apps/dhparam.c
+++ b/src/lib/libssl/src/apps/dhparam.c
@@ -416,12 +416,6 @@ bad:
416 if (outfile == NULL) 416 if (outfile == NULL)
417 { 417 {
418 BIO_set_fp(out,stdout,BIO_NOCLOSE); 418 BIO_set_fp(out,stdout,BIO_NOCLOSE);
419#ifdef OPENSSL_SYS_VMS
420 {
421 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
422 out = BIO_push(tmpbio, out);
423 }
424#endif
425 } 419 }
426 else 420 else
427 { 421 {
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c
index 5222487ab9..45bac4a9d1 100644
--- a/src/lib/libssl/src/apps/dsa.c
+++ b/src/lib/libssl/src/apps/dsa.c
@@ -293,12 +293,6 @@ bad:
293 if (outfile == NULL) 293 if (outfile == NULL)
294 { 294 {
295 BIO_set_fp(out,stdout,BIO_NOCLOSE); 295 BIO_set_fp(out,stdout,BIO_NOCLOSE);
296#ifdef OPENSSL_SYS_VMS
297 {
298 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
299 out = BIO_push(tmpbio, out);
300 }
301#endif
302 } 296 }
303 else 297 else
304 { 298 {
diff --git a/src/lib/libssl/src/apps/dsaparam.c b/src/lib/libssl/src/apps/dsaparam.c
index ad609fd6c0..47f8c83702 100644
--- a/src/lib/libssl/src/apps/dsaparam.c
+++ b/src/lib/libssl/src/apps/dsaparam.c
@@ -258,12 +258,6 @@ bad:
258 if (outfile == NULL) 258 if (outfile == NULL)
259 { 259 {
260 BIO_set_fp(out,stdout,BIO_NOCLOSE); 260 BIO_set_fp(out,stdout,BIO_NOCLOSE);
261#ifdef OPENSSL_SYS_VMS
262 {
263 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
264 out = BIO_push(tmpbio, out);
265 }
266#endif
267 } 261 }
268 else 262 else
269 { 263 {
diff --git a/src/lib/libssl/src/apps/ec.c b/src/lib/libssl/src/apps/ec.c
index 896eabc13f..dd3bb9d4a1 100644
--- a/src/lib/libssl/src/apps/ec.c
+++ b/src/lib/libssl/src/apps/ec.c
@@ -311,12 +311,6 @@ bad:
311 if (outfile == NULL) 311 if (outfile == NULL)
312 { 312 {
313 BIO_set_fp(out, stdout, BIO_NOCLOSE); 313 BIO_set_fp(out, stdout, BIO_NOCLOSE);
314#ifdef OPENSSL_SYS_VMS
315 {
316 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
317 out = BIO_push(tmpbio, out);
318 }
319#endif
320 } 314 }
321 else 315 else
322 { 316 {
diff --git a/src/lib/libssl/src/apps/ecparam.c b/src/lib/libssl/src/apps/ecparam.c
index 976ebef12b..17e28cf1d6 100644
--- a/src/lib/libssl/src/apps/ecparam.c
+++ b/src/lib/libssl/src/apps/ecparam.c
@@ -320,12 +320,6 @@ bad:
320 if (outfile == NULL) 320 if (outfile == NULL)
321 { 321 {
322 BIO_set_fp(out,stdout,BIO_NOCLOSE); 322 BIO_set_fp(out,stdout,BIO_NOCLOSE);
323#ifdef OPENSSL_SYS_VMS
324 {
325 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
326 out = BIO_push(tmpbio, out);
327 }
328#endif
329 } 323 }
330 else 324 else
331 { 325 {
diff --git a/src/lib/libssl/src/apps/enc.c b/src/lib/libssl/src/apps/enc.c
index ab974893be..16e98b8e53 100644
--- a/src/lib/libssl/src/apps/enc.c
+++ b/src/lib/libssl/src/apps/enc.c
@@ -456,12 +456,6 @@ bad:
456 if (bufsize != NULL) 456 if (bufsize != NULL)
457 setvbuf(stdout, (char *)NULL, _IONBF, 0); 457 setvbuf(stdout, (char *)NULL, _IONBF, 0);
458#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ 458#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
459#ifdef OPENSSL_SYS_VMS
460 {
461 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
462 out = BIO_push(tmpbio, out);
463 }
464#endif
465 } 459 }
466 else 460 else
467 { 461 {
diff --git a/src/lib/libssl/src/apps/engine.c b/src/lib/libssl/src/apps/engine.c
index 9a0294398e..33eeaf9f59 100644
--- a/src/lib/libssl/src/apps/engine.c
+++ b/src/lib/libssl/src/apps/engine.c
@@ -360,12 +360,6 @@ int MAIN(int argc, char **argv)
360 if (!load_config(bio_err, NULL)) 360 if (!load_config(bio_err, NULL))
361 goto end; 361 goto end;
362 bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); 362 bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
363#ifdef OPENSSL_SYS_VMS
364 {
365 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
366 bio_out = BIO_push(tmpbio, bio_out);
367 }
368#endif
369 363
370 argc--; 364 argc--;
371 argv++; 365 argv++;
diff --git a/src/lib/libssl/src/apps/errstr.c b/src/lib/libssl/src/apps/errstr.c
index fe3b98077e..f9b4a4f093 100644
--- a/src/lib/libssl/src/apps/errstr.c
+++ b/src/lib/libssl/src/apps/errstr.c
@@ -91,12 +91,6 @@ int MAIN(int argc, char **argv)
91 out=BIO_new(BIO_s_file()); 91 out=BIO_new(BIO_s_file());
92 if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE)) 92 if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE))
93 { 93 {
94#ifdef OPENSSL_SYS_VMS
95 {
96 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
97 out = BIO_push(tmpbio, out);
98 }
99#endif
100 lh_ERR_STRING_DATA_node_stats_bio( 94 lh_ERR_STRING_DATA_node_stats_bio(
101 ERR_get_string_table(), out); 95 ERR_get_string_table(), out);
102 lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), 96 lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(),
diff --git a/src/lib/libssl/src/apps/gendh.c b/src/lib/libssl/src/apps/gendh.c
index 6ef7eb9493..c80fc0c21c 100644
--- a/src/lib/libssl/src/apps/gendh.c
+++ b/src/lib/libssl/src/apps/gendh.c
@@ -173,12 +173,6 @@ bad:
173 if (outfile == NULL) 173 if (outfile == NULL)
174 { 174 {
175 BIO_set_fp(out,stdout,BIO_NOCLOSE); 175 BIO_set_fp(out,stdout,BIO_NOCLOSE);
176#ifdef OPENSSL_SYS_VMS
177 {
178 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
179 out = BIO_push(tmpbio, out);
180 }
181#endif
182 } 176 }
183 else 177 else
184 { 178 {
diff --git a/src/lib/libssl/src/apps/gendsa.c b/src/lib/libssl/src/apps/gendsa.c
index 62ea977905..612bdfbc1d 100644
--- a/src/lib/libssl/src/apps/gendsa.c
+++ b/src/lib/libssl/src/apps/gendsa.c
@@ -233,12 +233,6 @@ bad:
233 if (outfile == NULL) 233 if (outfile == NULL)
234 { 234 {
235 BIO_set_fp(out,stdout,BIO_NOCLOSE); 235 BIO_set_fp(out,stdout,BIO_NOCLOSE);
236#ifdef OPENSSL_SYS_VMS
237 {
238 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
239 out = BIO_push(tmpbio, out);
240 }
241#endif
242 } 236 }
243 else 237 else
244 { 238 {
diff --git a/src/lib/libssl/src/apps/genpkey.c b/src/lib/libssl/src/apps/genpkey.c
index 6dfda08b9e..24b623a1bb 100644
--- a/src/lib/libssl/src/apps/genpkey.c
+++ b/src/lib/libssl/src/apps/genpkey.c
@@ -233,12 +233,6 @@ int MAIN(int argc, char **argv)
233 else 233 else
234 { 234 {
235 out = BIO_new_fp (stdout, BIO_NOCLOSE); 235 out = BIO_new_fp (stdout, BIO_NOCLOSE);
236#ifdef OPENSSL_SYS_VMS
237 {
238 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
239 out = BIO_push(tmpbio, out);
240 }
241#endif
242 } 236 }
243 237
244 EVP_PKEY_CTX_set_cb(ctx, genpkey_cb); 238 EVP_PKEY_CTX_set_cb(ctx, genpkey_cb);
diff --git a/src/lib/libssl/src/apps/genrsa.c b/src/lib/libssl/src/apps/genrsa.c
index d3064b663a..bdc8778b1d 100644
--- a/src/lib/libssl/src/apps/genrsa.c
+++ b/src/lib/libssl/src/apps/genrsa.c
@@ -238,12 +238,6 @@ bad:
238 if (outfile == NULL) 238 if (outfile == NULL)
239 { 239 {
240 BIO_set_fp(out,stdout,BIO_NOCLOSE); 240 BIO_set_fp(out,stdout,BIO_NOCLOSE);
241#ifdef OPENSSL_SYS_VMS
242 {
243 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
244 out = BIO_push(tmpbio, out);
245 }
246#endif
247 } 241 }
248 else 242 else
249 { 243 {
diff --git a/src/lib/libssl/src/apps/nseq.c b/src/lib/libssl/src/apps/nseq.c
index e3c4dba547..4abb436f5d 100644
--- a/src/lib/libssl/src/apps/nseq.c
+++ b/src/lib/libssl/src/apps/nseq.c
@@ -121,12 +121,6 @@ int MAIN(int argc, char **argv)
121 } 121 }
122 } else { 122 } else {
123 out = BIO_new_fp(stdout, BIO_NOCLOSE); 123 out = BIO_new_fp(stdout, BIO_NOCLOSE);
124#ifdef OPENSSL_SYS_VMS
125 {
126 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
127 out = BIO_push(tmpbio, out);
128 }
129#endif
130 } 124 }
131 if (toseq) { 125 if (toseq) {
132 seq = NETSCAPE_CERT_SEQUENCE_new(); 126 seq = NETSCAPE_CERT_SEQUENCE_new();
diff --git a/src/lib/libssl/src/apps/ocsp.c b/src/lib/libssl/src/apps/ocsp.c
index b0ec7cdb19..1713467c08 100644
--- a/src/lib/libssl/src/apps/ocsp.c
+++ b/src/lib/libssl/src/apps/ocsp.c
@@ -57,11 +57,6 @@
57 */ 57 */
58#ifndef OPENSSL_NO_OCSP 58#ifndef OPENSSL_NO_OCSP
59 59
60#ifdef OPENSSL_SYS_VMS
61#define _XOPEN_SOURCE_EXTENDED /* So fd_set and friends get properly defined
62 on OpenVMS */
63#endif
64
65#define USE_SOCKETS 60#define USE_SOCKETS
66 61
67#include <stdio.h> 62#include <stdio.h>
diff --git a/src/lib/libssl/src/apps/openssl.c b/src/lib/libssl/src/apps/openssl.c
index e40be80db3..8bd7108222 100644
--- a/src/lib/libssl/src/apps/openssl.c
+++ b/src/lib/libssl/src/apps/openssl.c
@@ -216,11 +216,7 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)
216 } 216 }
217 } 217 }
218 218
219#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
220# define ARGV _Argv
221#else
222# define ARGV Argv 219# define ARGV Argv
223#endif
224 220
225int main(int Argc, char *ARGV[]) 221int main(int Argc, char *ARGV[])
226 { 222 {
@@ -237,54 +233,6 @@ int main(int Argc, char *ARGV[])
237 LHASH_OF(FUNCTION) *prog=NULL; 233 LHASH_OF(FUNCTION) *prog=NULL;
238 long errline; 234 long errline;
239 235
240#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
241 /* 2011-03-22 SMS.
242 * If we have 32-bit pointers everywhere, then we're safe, and
243 * we bypass this mess, as on non-VMS systems. (See ARGV,
244 * above.)
245 * Problem 1: Compaq/HP C before V7.3 always used 32-bit
246 * pointers for argv[].
247 * Fix 1: For a 32-bit argv[], when we're using 64-bit pointers
248 * everywhere else, we always allocate and use a 64-bit
249 * duplicate of argv[].
250 * Problem 2: Compaq/HP C V7.3 (Alpha, IA64) before ECO1 failed
251 * to NULL-terminate a 64-bit argv[]. (As this was written, the
252 * compiler ECO was available only on IA64.)
253 * Fix 2: Unless advised not to (VMS_TRUST_ARGV), we test a
254 * 64-bit argv[argc] for NULL, and, if necessary, use a
255 * (properly) NULL-terminated (64-bit) duplicate of argv[].
256 * The same code is used in either case to duplicate argv[].
257 * Some of these decisions could be handled in preprocessing,
258 * but the code tends to get even uglier, and the penalty for
259 * deciding at compile- or run-time is tiny.
260 */
261 char **Argv = NULL;
262 int free_Argv = 0;
263
264 if ((sizeof( _Argv) < 8) /* 32-bit argv[]. */
265# if !defined( VMS_TRUST_ARGV)
266 || (_Argv[ Argc] != NULL) /* Untrusted argv[argc] not NULL. */
267# endif
268 )
269 {
270 int i;
271 Argv = OPENSSL_malloc( (Argc+ 1)* sizeof( char *));
272 if (Argv == NULL)
273 { ret = -1; goto end; }
274 for(i = 0; i < Argc; i++)
275 Argv[i] = _Argv[i];
276 Argv[ Argc] = NULL; /* Certain NULL termination. */
277 free_Argv = 1;
278 }
279 else
280 {
281 /* Use the known-good 32-bit argv[] (which needs the
282 * type cast to satisfy the compiler), or the trusted or
283 * tested-good 64-bit argv[] as-is. */
284 Argv = (char **)_Argv;
285 }
286#endif /* defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64) */
287
288 arg.data=NULL; 236 arg.data=NULL;
289 arg.count=0; 237 arg.count=0;
290 238
@@ -443,13 +391,6 @@ end:
443 BIO_free(bio_err); 391 BIO_free(bio_err);
444 bio_err=NULL; 392 bio_err=NULL;
445 } 393 }
446#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
447 /* Free any duplicate Argv[] storage. */
448 if (free_Argv)
449 {
450 OPENSSL_free(Argv);
451 }
452#endif
453 OPENSSL_EXIT(ret); 394 OPENSSL_EXIT(ret);
454 } 395 }
455 396
@@ -492,12 +433,6 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
492 else if ((strncmp(argv[0],"no-",3)) == 0) 433 else if ((strncmp(argv[0],"no-",3)) == 0)
493 { 434 {
494 BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE); 435 BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
495#ifdef OPENSSL_SYS_VMS
496 {
497 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
498 bio_stdout = BIO_push(tmpbio, bio_stdout);
499 }
500#endif
501 f.name=argv[0]+3; 436 f.name=argv[0]+3;
502 ret = (lh_FUNCTION_retrieve(prog,&f) != NULL); 437 ret = (lh_FUNCTION_retrieve(prog,&f) != NULL);
503 if (!ret) 438 if (!ret)
@@ -538,12 +473,6 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
538 else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */ 473 else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
539 list_type = FUNC_TYPE_CIPHER; 474 list_type = FUNC_TYPE_CIPHER;
540 bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE); 475 bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
541#ifdef OPENSSL_SYS_VMS
542 {
543 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
544 bio_stdout = BIO_push(tmpbio, bio_stdout);
545 }
546#endif
547 476
548 if (!load_config(bio_err, NULL)) 477 if (!load_config(bio_err, NULL))
549 goto end; 478 goto end;
diff --git a/src/lib/libssl/src/apps/passwd.c b/src/lib/libssl/src/apps/passwd.c
index 9eabeb488c..cb30f810c8 100644
--- a/src/lib/libssl/src/apps/passwd.c
+++ b/src/lib/libssl/src/apps/passwd.c
@@ -85,12 +85,6 @@ int MAIN(int argc, char **argv)
85 if (out == NULL) 85 if (out == NULL)
86 goto err; 86 goto err;
87 BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); 87 BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
88#ifdef OPENSSL_SYS_VMS
89 {
90 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
91 out = BIO_push(tmpbio, out);
92 }
93#endif
94 88
95 badopt = 0, opt_done = 0; 89 badopt = 0, opt_done = 0;
96 i = 0; 90 i = 0;
diff --git a/src/lib/libssl/src/apps/pkcs12.c b/src/lib/libssl/src/apps/pkcs12.c
index 4d62a7b8ca..f099e8f618 100644
--- a/src/lib/libssl/src/apps/pkcs12.c
+++ b/src/lib/libssl/src/apps/pkcs12.c
@@ -398,12 +398,6 @@ int MAIN(int argc, char **argv)
398 398
399 if (!outfile) { 399 if (!outfile) {
400 out = BIO_new_fp(stdout, BIO_NOCLOSE); 400 out = BIO_new_fp(stdout, BIO_NOCLOSE);
401#ifdef OPENSSL_SYS_VMS
402 {
403 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
404 out = BIO_push(tmpbio, out);
405 }
406#endif
407 } else out = BIO_new_file(outfile, "wb"); 401 } else out = BIO_new_file(outfile, "wb");
408 if (!out) { 402 if (!out) {
409 BIO_printf(bio_err, "Error opening output file %s\n", 403 BIO_printf(bio_err, "Error opening output file %s\n",
diff --git a/src/lib/libssl/src/apps/pkcs7.c b/src/lib/libssl/src/apps/pkcs7.c
index ae6cd33f73..272bf11f24 100644
--- a/src/lib/libssl/src/apps/pkcs7.c
+++ b/src/lib/libssl/src/apps/pkcs7.c
@@ -221,12 +221,6 @@ bad:
221 if (outfile == NULL) 221 if (outfile == NULL)
222 { 222 {
223 BIO_set_fp(out,stdout,BIO_NOCLOSE); 223 BIO_set_fp(out,stdout,BIO_NOCLOSE);
224#ifdef OPENSSL_SYS_VMS
225 {
226 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
227 out = BIO_push(tmpbio, out);
228 }
229#endif
230 } 224 }
231 else 225 else
232 { 226 {
diff --git a/src/lib/libssl/src/apps/pkcs8.c b/src/lib/libssl/src/apps/pkcs8.c
index 7edeb179dd..90b2ebe3ef 100644
--- a/src/lib/libssl/src/apps/pkcs8.c
+++ b/src/lib/libssl/src/apps/pkcs8.c
@@ -266,12 +266,6 @@ int MAIN(int argc, char **argv)
266 else 266 else
267 { 267 {
268 out = BIO_new_fp (stdout, BIO_NOCLOSE); 268 out = BIO_new_fp (stdout, BIO_NOCLOSE);
269#ifdef OPENSSL_SYS_VMS
270 {
271 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
272 out = BIO_push(tmpbio, out);
273 }
274#endif
275 } 269 }
276 if (topk8) 270 if (topk8)
277 { 271 {
diff --git a/src/lib/libssl/src/apps/pkey.c b/src/lib/libssl/src/apps/pkey.c
index 17e6702fb1..a55714d0ce 100644
--- a/src/lib/libssl/src/apps/pkey.c
+++ b/src/lib/libssl/src/apps/pkey.c
@@ -219,12 +219,6 @@ int MAIN(int argc, char **argv)
219 else 219 else
220 { 220 {
221 out = BIO_new_fp (stdout, BIO_NOCLOSE); 221 out = BIO_new_fp (stdout, BIO_NOCLOSE);
222#ifdef OPENSSL_SYS_VMS
223 {
224 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
225 out = BIO_push(tmpbio, out);
226 }
227#endif
228 } 222 }
229 223
230 if (pubin) 224 if (pubin)
diff --git a/src/lib/libssl/src/apps/pkeyparam.c b/src/lib/libssl/src/apps/pkeyparam.c
index 6f7a357a36..6a46c8ac49 100644
--- a/src/lib/libssl/src/apps/pkeyparam.c
+++ b/src/lib/libssl/src/apps/pkeyparam.c
@@ -167,12 +167,6 @@ int MAIN(int argc, char **argv)
167 else 167 else
168 { 168 {
169 out = BIO_new_fp (stdout, BIO_NOCLOSE); 169 out = BIO_new_fp (stdout, BIO_NOCLOSE);
170#ifdef OPENSSL_SYS_VMS
171 {
172 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
173 out = BIO_push(tmpbio, out);
174 }
175#endif
176 } 170 }
177 171
178 pkey = PEM_read_bio_Parameters(in, NULL); 172 pkey = PEM_read_bio_Parameters(in, NULL);
diff --git a/src/lib/libssl/src/apps/pkeyutl.c b/src/lib/libssl/src/apps/pkeyutl.c
index 7eb3f5c544..8b260caae0 100644
--- a/src/lib/libssl/src/apps/pkeyutl.c
+++ b/src/lib/libssl/src/apps/pkeyutl.c
@@ -278,12 +278,6 @@ int MAIN(int argc, char **argv)
278 else 278 else
279 { 279 {
280 out = BIO_new_fp(stdout, BIO_NOCLOSE); 280 out = BIO_new_fp(stdout, BIO_NOCLOSE);
281#ifdef OPENSSL_SYS_VMS
282 {
283 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
284 out = BIO_push(tmpbio, out);
285 }
286#endif
287 } 281 }
288 282
289 if (sigfile) 283 if (sigfile)
diff --git a/src/lib/libssl/src/apps/prime.c b/src/lib/libssl/src/apps/prime.c
index f1aaef8725..031906a792 100644
--- a/src/lib/libssl/src/apps/prime.c
+++ b/src/lib/libssl/src/apps/prime.c
@@ -112,12 +112,6 @@ int MAIN(int argc, char **argv)
112 if ((bio_out=BIO_new(BIO_s_file())) != NULL) 112 if ((bio_out=BIO_new(BIO_s_file())) != NULL)
113 { 113 {
114 BIO_set_fp(bio_out,stdout,BIO_NOCLOSE); 114 BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
115#ifdef OPENSSL_SYS_VMS
116 {
117 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
118 bio_out = BIO_push(tmpbio, bio_out);
119 }
120#endif
121 } 115 }
122 116
123 if(generate) 117 if(generate)
diff --git a/src/lib/libssl/src/apps/rand.c b/src/lib/libssl/src/apps/rand.c
index 790e79592c..884c244486 100644
--- a/src/lib/libssl/src/apps/rand.c
+++ b/src/lib/libssl/src/apps/rand.c
@@ -191,12 +191,6 @@ int MAIN(int argc, char **argv)
191 else 191 else
192 { 192 {
193 r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT); 193 r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
194#ifdef OPENSSL_SYS_VMS
195 {
196 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
197 out = BIO_push(tmpbio, out);
198 }
199#endif
200 } 194 }
201 if (r <= 0) 195 if (r <= 0)
202 goto err; 196 goto err;
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c
index ede69ed5d8..66038905a2 100644
--- a/src/lib/libssl/src/apps/req.c
+++ b/src/lib/libssl/src/apps/req.c
@@ -717,12 +717,6 @@ bad:
717 { 717 {
718 BIO_printf(bio_err,"writing new private key to stdout\n"); 718 BIO_printf(bio_err,"writing new private key to stdout\n");
719 BIO_set_fp(out,stdout,BIO_NOCLOSE); 719 BIO_set_fp(out,stdout,BIO_NOCLOSE);
720#ifdef OPENSSL_SYS_VMS
721 {
722 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
723 out = BIO_push(tmpbio, out);
724 }
725#endif
726 } 720 }
727 else 721 else
728 { 722 {
@@ -969,12 +963,6 @@ loop:
969 if (outfile == NULL) 963 if (outfile == NULL)
970 { 964 {
971 BIO_set_fp(out,stdout,BIO_NOCLOSE); 965 BIO_set_fp(out,stdout,BIO_NOCLOSE);
972#ifdef OPENSSL_SYS_VMS
973 {
974 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
975 out = BIO_push(tmpbio, out);
976 }
977#endif
978 } 966 }
979 else 967 else
980 { 968 {
diff --git a/src/lib/libssl/src/apps/rsa.c b/src/lib/libssl/src/apps/rsa.c
index a17708fe9c..579c2e276a 100644
--- a/src/lib/libssl/src/apps/rsa.c
+++ b/src/lib/libssl/src/apps/rsa.c
@@ -306,12 +306,6 @@ bad:
306 if (outfile == NULL) 306 if (outfile == NULL)
307 { 307 {
308 BIO_set_fp(out,stdout,BIO_NOCLOSE); 308 BIO_set_fp(out,stdout,BIO_NOCLOSE);
309#ifdef OPENSSL_SYS_VMS
310 {
311 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
312 out = BIO_push(tmpbio, out);
313 }
314#endif
315 } 309 }
316 else 310 else
317 { 311 {
diff --git a/src/lib/libssl/src/apps/rsautl.c b/src/lib/libssl/src/apps/rsautl.c
index b01f004eb3..49903496f5 100644
--- a/src/lib/libssl/src/apps/rsautl.c
+++ b/src/lib/libssl/src/apps/rsautl.c
@@ -247,12 +247,6 @@ int MAIN(int argc, char **argv)
247 } 247 }
248 } else { 248 } else {
249 out = BIO_new_fp(stdout, BIO_NOCLOSE); 249 out = BIO_new_fp(stdout, BIO_NOCLOSE);
250#ifdef OPENSSL_SYS_VMS
251 {
252 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
253 out = BIO_push(tmpbio, out);
254 }
255#endif
256 } 250 }
257 251
258 keysize = RSA_size(rsa); 252 keysize = RSA_size(rsa);
diff --git a/src/lib/libssl/src/apps/s_apps.h b/src/lib/libssl/src/apps/s_apps.h
index 08f55d53d3..95a13119cb 100644
--- a/src/lib/libssl/src/apps/s_apps.h
+++ b/src/lib/libssl/src/apps/s_apps.h
@@ -121,29 +121,6 @@
121#define _kbhit kbhit 121#define _kbhit kbhit
122#endif 122#endif
123 123
124#if defined(OPENSSL_SYS_VMS) && !defined(FD_SET)
125/* VAX C does not defined fd_set and friends, but it's actually quite simple */
126/* These definitions are borrowed from SOCKETSHR. /Richard Levitte */
127#define MAX_NOFILE 32
128#define NBBY 8 /* number of bits in a byte */
129
130#ifndef FD_SETSIZE
131#define FD_SETSIZE MAX_NOFILE
132#endif /* FD_SETSIZE */
133
134/* How many things we'll allow select to use. 0 if unlimited */
135#define MAXSELFD MAX_NOFILE
136typedef int fd_mask; /* int here! VMS prototypes int, not long */
137#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask (power of 2!)*/
138#define NFDSHIFT 5 /* Shift based on above */
139
140typedef fd_mask fd_set;
141#define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS)))
142#define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS)))
143#define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS)))
144#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
145#endif
146
147#define PORT 4433 124#define PORT 4433
148#define PORT_STR "4433" 125#define PORT_STR "4433"
149#define PROTOCOL "tcp" 126#define PROTOCOL "tcp"
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c
index 7bea7204c1..cb0a7688c8 100644
--- a/src/lib/libssl/src/apps/s_client.c
+++ b/src/lib/libssl/src/apps/s_client.c
@@ -151,11 +151,6 @@
151 recursive header file inclusion, resulting in the compiler complaining 151 recursive header file inclusion, resulting in the compiler complaining
152 that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which 152 that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
153 is needed to have fileno() declared correctly... So let's define u_int */ 153 is needed to have fileno() declared correctly... So let's define u_int */
154#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT)
155#define __U_INT
156typedef unsigned int u_int;
157#endif
158
159#define USE_SOCKETS 154#define USE_SOCKETS
160#include "apps.h" 155#include "apps.h"
161#include <openssl/x509.h> 156#include <openssl/x509.h>
@@ -171,11 +166,6 @@ typedef unsigned int u_int;
171#include "s_apps.h" 166#include "s_apps.h"
172#include "timeouts.h" 167#include "timeouts.h"
173 168
174#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
175/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
176#undef FIONBIO
177#endif
178
179#if defined(OPENSSL_SYS_BEOS_R5) 169#if defined(OPENSSL_SYS_BEOS_R5)
180#include <fcntl.h> 170#include <fcntl.h>
181#endif 171#endif
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c
index 26e1fe9505..4ad535b9ee 100644
--- a/src/lib/libssl/src/apps/s_server.c
+++ b/src/lib/libssl/src/apps/s_server.c
@@ -161,15 +161,6 @@
161#include <sys/types.h> 161#include <sys/types.h>
162#endif 162#endif
163 163
164/* With IPv6, it looks like Digital has mixed up the proper order of
165 recursive header file inclusion, resulting in the compiler complaining
166 that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
167 is needed to have fileno() declared correctly... So let's define u_int */
168#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT)
169#define __U_INT
170typedef unsigned int u_int;
171#endif
172
173#include <openssl/lhash.h> 164#include <openssl/lhash.h>
174#include <openssl/bn.h> 165#include <openssl/bn.h>
175#define USE_SOCKETS 166#define USE_SOCKETS
@@ -192,11 +183,6 @@ typedef unsigned int u_int;
192#include "s_apps.h" 183#include "s_apps.h"
193#include "timeouts.h" 184#include "timeouts.h"
194 185
195#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
196/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
197#undef FIONBIO
198#endif
199
200#if defined(OPENSSL_SYS_BEOS_R5) 186#if defined(OPENSSL_SYS_BEOS_R5)
201#include <fcntl.h> 187#include <fcntl.h>
202#endif 188#endif
diff --git a/src/lib/libssl/src/apps/s_socket.c b/src/lib/libssl/src/apps/s_socket.c
index 8c4421a930..a301567668 100644
--- a/src/lib/libssl/src/apps/s_socket.c
+++ b/src/lib/libssl/src/apps/s_socket.c
@@ -68,15 +68,6 @@
68#include "../e_os2.h" 68#include "../e_os2.h"
69#endif 69#endif
70 70
71/* With IPv6, it looks like Digital has mixed up the proper order of
72 recursive header file inclusion, resulting in the compiler complaining
73 that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
74 is needed to have fileno() declared correctly... So let's define u_int */
75#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT)
76#define __U_INT
77typedef unsigned int u_int;
78#endif
79
80#define USE_SOCKETS 71#define USE_SOCKETS
81#define NON_MAIN 72#define NON_MAIN
82#include "apps.h" 73#include "apps.h"
diff --git a/src/lib/libssl/src/apps/sess_id.c b/src/lib/libssl/src/apps/sess_id.c
index b16686c26d..8fab8c0b9a 100644
--- a/src/lib/libssl/src/apps/sess_id.c
+++ b/src/lib/libssl/src/apps/sess_id.c
@@ -210,12 +210,6 @@ bad:
210 if (outfile == NULL) 210 if (outfile == NULL)
211 { 211 {
212 BIO_set_fp(out,stdout,BIO_NOCLOSE); 212 BIO_set_fp(out,stdout,BIO_NOCLOSE);
213#ifdef OPENSSL_SYS_VMS
214 {
215 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
216 out = BIO_push(tmpbio, out);
217 }
218#endif
219 } 213 }
220 else 214 else
221 { 215 {
diff --git a/src/lib/libssl/src/apps/smime.c b/src/lib/libssl/src/apps/smime.c
index c583f8a0e1..cd08fe4464 100644
--- a/src/lib/libssl/src/apps/smime.c
+++ b/src/lib/libssl/src/apps/smime.c
@@ -659,12 +659,6 @@ int MAIN(int argc, char **argv)
659 else 659 else
660 { 660 {
661 out = BIO_new_fp(stdout, BIO_NOCLOSE); 661 out = BIO_new_fp(stdout, BIO_NOCLOSE);
662#ifdef OPENSSL_SYS_VMS
663 {
664 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
665 out = BIO_push(tmpbio, out);
666 }
667#endif
668 } 662 }
669 663
670 if (operation == SMIME_VERIFY) 664 if (operation == SMIME_VERIFY)
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c
index 9886ca3766..1b94d19f9d 100644
--- a/src/lib/libssl/src/apps/speed.c
+++ b/src/lib/libssl/src/apps/speed.c
@@ -210,11 +210,7 @@
210#endif 210#endif
211 211
212#ifndef HAVE_FORK 212#ifndef HAVE_FORK
213# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE)
214# define HAVE_FORK 0
215# else
216# define HAVE_FORK 1 213# define HAVE_FORK 1
217# endif
218#endif 214#endif
219 215
220#if HAVE_FORK 216#if HAVE_FORK
diff --git a/src/lib/libssl/src/apps/spkac.c b/src/lib/libssl/src/apps/spkac.c
index 0e01ea9947..7b90825b21 100644
--- a/src/lib/libssl/src/apps/spkac.c
+++ b/src/lib/libssl/src/apps/spkac.c
@@ -209,12 +209,6 @@ bad:
209 if (outfile) out = BIO_new_file(outfile, "w"); 209 if (outfile) out = BIO_new_file(outfile, "w");
210 else { 210 else {
211 out = BIO_new_fp(stdout, BIO_NOCLOSE); 211 out = BIO_new_fp(stdout, BIO_NOCLOSE);
212#ifdef OPENSSL_SYS_VMS
213 {
214 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
215 out = BIO_push(tmpbio, out);
216 }
217#endif
218 } 212 }
219 213
220 if(!out) { 214 if(!out) {
@@ -267,12 +261,6 @@ bad:
267 if (outfile) out = BIO_new_file(outfile, "w"); 261 if (outfile) out = BIO_new_file(outfile, "w");
268 else { 262 else {
269 out = BIO_new_fp(stdout, BIO_NOCLOSE); 263 out = BIO_new_fp(stdout, BIO_NOCLOSE);
270#ifdef OPENSSL_SYS_VMS
271 {
272 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
273 out = BIO_push(tmpbio, out);
274 }
275#endif
276 } 264 }
277 265
278 if(!out) { 266 if(!out) {
diff --git a/src/lib/libssl/src/apps/srp.c b/src/lib/libssl/src/apps/srp.c
index 9c7ae184db..7004fea7ff 100644
--- a/src/lib/libssl/src/apps/srp.c
+++ b/src/lib/libssl/src/apps/srp.c
@@ -443,16 +443,10 @@ bad:
443 const char *s=X509_get_default_cert_area(); 443 const char *s=X509_get_default_cert_area();
444 size_t len; 444 size_t len;
445 445
446#ifdef OPENSSL_SYS_VMS
447 len = strlen(s)+sizeof(CONFIG_FILE);
448 tofree=OPENSSL_malloc(len);
449 strcpy(tofree,s);
450#else
451 len = strlen(s)+sizeof(CONFIG_FILE)+1; 446 len = strlen(s)+sizeof(CONFIG_FILE)+1;
452 tofree=OPENSSL_malloc(len); 447 tofree=OPENSSL_malloc(len);
453 BUF_strlcpy(tofree,s,len); 448 BUF_strlcpy(tofree,s,len);
454 BUF_strlcat(tofree,"/",len); 449 BUF_strlcat(tofree,"/",len);
455#endif
456 BUF_strlcat(tofree,CONFIG_FILE,len); 450 BUF_strlcat(tofree,CONFIG_FILE,len);
457 configfile=tofree; 451 configfile=tofree;
458 } 452 }
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c
index 0cee89eea1..2ed3f13327 100644
--- a/src/lib/libssl/src/apps/x509.c
+++ b/src/lib/libssl/src/apps/x509.c
@@ -221,12 +221,6 @@ int MAIN(int argc, char **argv)
221 if (!load_config(bio_err, NULL)) 221 if (!load_config(bio_err, NULL))
222 goto end; 222 goto end;
223 STDout=BIO_new_fp(stdout,BIO_NOCLOSE); 223 STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
224#ifdef OPENSSL_SYS_VMS
225 {
226 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
227 STDout = BIO_push(tmpbio, STDout);
228 }
229#endif
230 224
231 informat=FORMAT_PEM; 225 informat=FORMAT_PEM;
232 outformat=FORMAT_PEM; 226 outformat=FORMAT_PEM;
@@ -682,12 +676,6 @@ bad:
682 if (outfile == NULL) 676 if (outfile == NULL)
683 { 677 {
684 BIO_set_fp(out,stdout,BIO_NOCLOSE); 678 BIO_set_fp(out,stdout,BIO_NOCLOSE);
685#ifdef OPENSSL_SYS_VMS
686 {
687 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
688 out = BIO_push(tmpbio, out);
689 }
690#endif
691 } 679 }
692 else 680 else
693 { 681 {