diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/CA.com | 4 | ||||
-rw-r--r-- | apps/apps.c | 6 | ||||
-rw-r--r-- | apps/enc.c | 4 | ||||
-rwxr-xr-x | apps/install-apps.com | 107 | ||||
-rw-r--r-- | apps/install.com | 65 | ||||
-rw-r--r-- | apps/makeapps.com | 285 | ||||
-rw-r--r-- | apps/openssl.c | 26 | ||||
-rwxr-xr-x | apps/vms_decc_init.c | 188 |
8 files changed, 511 insertions, 174 deletions
diff --git a/apps/CA.com b/apps/CA.com index 02682e424a..00266db521 100644 --- a/apps/CA.com +++ b/apps/CA.com @@ -114,8 +114,8 @@ $! $ IF F$SEARCH(CATOP+".private"+CAKEY) .EQS. "" $ THEN $ READ '__INPUT' FILE - - /PROMT="CA certificate filename (or enter to create)" -$ IF F$SEARCH(FILE) .NES. "" + /PROMPT="CA certificate filename (or enter to create): " +$ IF (FILE .NES. "") .AND. (F$SEARCH(FILE) .NES. "") $ THEN $ COPY 'FILE' 'CATOP'.private'CAKEY' $ RET=$STATUS diff --git a/apps/apps.c b/apps/apps.c index 57390d37cc..fdfa362f7c 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -798,7 +798,9 @@ X509 *load_cert(BIO *err, const char *file, int format, if (file == NULL) { #ifdef _IONBF +# ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); +# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(cert,stdin,BIO_NOCLOSE); } @@ -899,7 +901,9 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, if (file == NULL && maybe_stdin) { #ifdef _IONBF +# ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); +# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(key,stdin,BIO_NOCLOSE); } @@ -988,7 +992,9 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, if (file == NULL && maybe_stdin) { #ifdef _IONBF +# ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); +# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(key,stdin,BIO_NOCLOSE); } diff --git a/apps/enc.c b/apps/enc.c index c28d8b1948..076225c4cb 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -393,8 +393,10 @@ bad: if (inf == NULL) { +#ifndef OPENSSL_NO_SETVBUF_IONBF if (bufsize != NULL) setvbuf(stdin, (char *)NULL, _IONBF, 0); +#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ BIO_set_fp(in,stdin,BIO_NOCLOSE); } else @@ -447,8 +449,10 @@ bad: if (outf == NULL) { BIO_set_fp(out,stdout,BIO_NOCLOSE); +#ifndef OPENSSL_NO_SETVBUF_IONBF if (bufsize != NULL) setvbuf(stdout, (char *)NULL, _IONBF, 0); +#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); diff --git a/apps/install-apps.com b/apps/install-apps.com new file mode 100755 index 0000000000..7a553aa12e --- /dev/null +++ b/apps/install-apps.com @@ -0,0 +1,107 @@ +$! INSTALL.COM -- Installs the files in a given directory tree +$! +$! Author: Richard Levitte <richard@levitte.org> +$! Time of creation: 22-MAY-1998 10:13 +$! +$! P1 root of the directory tree +$! P2 "64" for 64-bit pointers. +$! +$! +$! Announce/identify. +$! +$ proc = f$environment( "procedure") +$ write sys$output "@@@ "+ - + f$parse( proc, , , "name")+ f$parse( proc, , , "type") +$! +$ on error then goto tidy +$ on control_c then goto tidy +$! +$ if (p1 .eqs. "") +$ then +$ write sys$output "First argument missing." +$ write sys$output - + "It should be the directory where you want things installed." +$ exit +$ endif +$! +$ if (f$getsyi("cpu") .lt. 128) +$ then +$ arch = "VAX" +$ else +$ arch = f$edit( f$getsyi( "arch_name"), "upcase") +$ if (arch .eqs. "") then arch = "UNK" +$ endif +$! +$ archd = arch +$! +$ if (p2 .nes. "") +$ then +$ if (p2 .eqs. "64") +$ then +$ archd = arch+ "_64" +$ else +$ if (p2 .nes. "32") +$ then +$ write sys$output "Second argument invalid." +$ write sys$output "It should be "32", "64", or nothing." +$ exit +$ endif +$ endif +$ endif +$! +$ root = f$parse( p1, "[]A.;0", , , "syntax_only, no_conceal") - "A.;0" +$ root_dev = f$parse(root,,,"device","syntax_only") +$ root_dir = f$parse(root,,,"directory","syntax_only") - - + "[000000." - "][" - "[" - "]" +$ root = root_dev + "[" + root_dir +$! +$ define /nolog wrk_sslroot 'root'.] /trans=conc +$ define /nolog wrk_sslxexe wrk_sslroot:['archd'_exe] +$! +$ if f$parse("wrk_sslroot:[000000]") .eqs. "" then - + create /directory /log wrk_sslroot:[000000] +$ if f$parse("wrk_sslxexe:") .eqs. "" then - + create /directory /log wrk_sslxexe: +$! +$ exe := openssl +$! +$ exe_dir := [-.'archd'.exe.apps] +$! +$! Executables. +$! +$ i = 0 +$ loop_exe: +$ e = f$edit(f$element( i, ",", exe), "trim") +$ i = i + 1 +$ if e .eqs. "," then goto loop_exe_end +$ set noon +$ file = exe_dir+ e+ ".exe" +$ if f$search( file) .nes. "" +$ then +$ copy /protection = w:re 'file' wrk_sslxexe: /log +$ endif +$ set on +$ goto loop_exe +$ loop_exe_end: +$! +$! Miscellaneous. +$! +$ set noon +$ copy /protection = w:re ca.com wrk_sslxexe:ca.com /log +$ copy /protection = w:re openssl-vms.cnf wrk_sslroot:[000000]openssl.cnf /log +$ set on +$! +$ tidy: +$! +$ call deass wrk_sslroot +$ call deass wrk_sslxexe +$! +$ exit +$! +$ deass: subroutine +$ if (f$trnlnm( p1, "LNM$PROCESS") .nes. "") +$ then +$ deassign /process 'p1' +$ endif +$ endsubroutine +$! diff --git a/apps/install.com b/apps/install.com deleted file mode 100644 index c5821b40e3..0000000000 --- a/apps/install.com +++ /dev/null @@ -1,65 +0,0 @@ -$! INSTALL.COM -- Installs the files in a given directory tree -$! -$! Author: Richard Levitte <richard@levitte.org> -$! Time of creation: 22-MAY-1998 10:13 -$! -$! P1 root of the directory tree -$! -$ -$ IF P1 .EQS. "" -$ THEN -$ WRITE SYS$OUTPUT "First argument missing." -$ WRITE SYS$OUTPUT - - "Should be the directory where you want things installed." -$ EXIT -$ ENDIF -$ -$ IF (F$GETSYI("CPU").LT.128) -$ THEN -$ ARCH := VAX -$ ELSE -$ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") -$ IF (ARCH .EQS. "") THEN ARCH = "UNK" -$ ENDIF -$ -$ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0" -$ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY") -$ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - - - "[000000." - "][" - "[" - "]" -$ ROOT = ROOT_DEV + "[" + ROOT_DIR -$ -$ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC -$ DEFINE/NOLOG WRK_SSLEXE WRK_SSLROOT:['ARCH'_EXE] -$ -$ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN - - CREATE/DIR/LOG WRK_SSLROOT:[000000] -$ IF F$PARSE("WRK_SSLEXE:") .EQS. "" THEN - - CREATE/DIR/LOG WRK_SSLEXE: -$ -$ EXE := openssl -$ -$ EXE_DIR := [-.'ARCH'.EXE.APPS] -$ -$ I = 0 -$ LOOP_EXE: -$ E = F$EDIT(F$ELEMENT(I, ",", EXE),"TRIM") -$ I = I + 1 -$ IF E .EQS. "," THEN GOTO LOOP_EXE_END -$ SET NOON -$ IF F$SEARCH(EXE_DIR+E+".EXE") .NES. "" -$ THEN -$ COPY 'EXE_DIR''E'.EXE WRK_SSLEXE:'E'.EXE/log -$ SET FILE/PROT=W:RE WRK_SSLEXE:'E'.EXE -$ ENDIF -$ SET ON -$ GOTO LOOP_EXE -$ LOOP_EXE_END: -$ -$ SET NOON -$ COPY CA.COM WRK_SSLEXE:CA.COM/LOG -$ SET FILE/PROT=W:RE WRK_SSLEXE:CA.COM -$ COPY OPENSSL-VMS.CNF WRK_SSLROOT:[000000]OPENSSL.CNF/LOG -$ SET FILE/PROT=W:R WRK_SSLROOT:[000000]OPENSSL.CNF -$ SET ON -$ -$ EXIT diff --git a/apps/makeapps.com b/apps/makeapps.com index 280acfd348..4b33f68af0 100644 --- a/apps/makeapps.com +++ b/apps/makeapps.com @@ -25,7 +25,7 @@ $! VAXC For VAX C. $! DECC For DEC C. $! GNUC For GNU C. $! -$! If you don't speficy a compiler, it will try to determine which +$! If you don't specify a compiler, it will try to determine which $! "C" compiler to use. $! $! P3, if defined, sets a TCP/IP library to use, through one of the following @@ -39,18 +39,31 @@ $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) $! $! P5, if defined, sets a choice of programs to compile. $! -$! For 64 bit architectures (Alpha and IA64), specify the pointer size as P6. -$! For 32 bit architectures (VAX), P6 is ignored. -$! Currently supported values are: +$! P6, if defined, specifies the C pointer size. Ignored on VAX. +$! Supported values are: $! -$! 32 To ge a library compiled with /POINTER_SIZE=32 -$! 64 To ge a library compiled with /POINTER_SIZE=64 +$! "" Compile with default (/NOPOINTER_SIZE) +$! 32 Compile with /POINTER_SIZE=32 (SHORT) +$! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV]) $! +$! P7, if defined, specifies a directory where ZLIB files (zlib.h, +$! libz.olb) may be found. Optionally, a non-default object library +$! name may be included ("dev:[dir]libz_64.olb", for example). +$! +$! +$! Announce/identify. +$! +$ proc = f$environment( "procedure") +$ write sys$output "@@@ "+ - + f$parse( proc, , , "name")+ f$parse( proc, , , "type") +$! +$ on control_c then goto exit $! $! Define A TCP/IP Library That We Will Need To Link To. $! (That Is, If We Need To Link To One.) $! $ TCPIP_LIB = "" +$ ZLIB_LIB = "" $! $! Check What Architecture We Are Using. $! @@ -59,7 +72,7 @@ $ THEN $! $! The Architecture Is VAX. $! -$ ARCH := VAX +$ ARCH = "VAX" $! $! Else... $! @@ -74,29 +87,45 @@ $! End The Architecture Check. $! $ ENDIF $! +$ ARCHD = ARCH +$ LIB32 = "32" +$ OPT_FILE = "" +$ POINTER_SIZE = "" +$! $! Define what programs should be compiled $! $ PROGRAMS := OPENSSL $! +$! Check To Make Sure We Have Valid Command Line Parameters. +$! +$ GOSUB CHECK_OPTIONS +$! $! Define The CRYPTO Library. $! -$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO'LIB32'.OLB +$ CRYPTO_LIB := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO'LIB32'.OLB $! $! Define The SSL Library. $! -$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL'LIB32'.OLB +$ SSL_LIB := SYS$DISK:[-.'ARCHD'.EXE.SSL]SSL_LIBSSL'LIB32'.OLB $! -$! Define The OBJ Directory. +$! Define The OBJ and EXE Directories. $! -$ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.APPS] +$ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.APPS] +$ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.APPS] $! -$! Define The EXE Directory. +$! Specify the destination directory in any /MAP option. $! -$ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.APPS] +$ if (LINKMAP .eqs. "MAP") +$ then +$ LINKMAP = LINKMAP+ "=''EXE_DIR'" +$ endif $! -$! Check To Make Sure We Have Valid Command Line Parameters. +$! Add the location prefix to the linker options file name. $! -$ GOSUB CHECK_OPTIONS +$ if (OPT_FILE .nes. "") +$ then +$ OPT_FILE = EXE_DIR+ OPT_FILE +$ endif $! $! Initialise logical names and such $! @@ -104,7 +133,7 @@ $ GOSUB INITIALISE $! $! Tell The User What Kind of Machine We Run On. $! -$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." +$ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'" $! $! Check To See If The OBJ Directory Exists. $! @@ -152,6 +181,9 @@ $ LIB_OPENSSL = "VERIFY,ASN1PARS,REQ,DGST,DH,DHPARAM,ENC,PASSWD,GENDH,ERRSTR,"+- "S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+- "CIPHERS,NSEQ,PKCS12,PKCS8,PKEY,PKEYPARAM,PKEYUTL,"+ - "SPKAC,SMIME,CMS,RAND,ENGINE,OCSP,PRIME,TS" +$! +$ LIB_OPENSSL = LIB_OPENSSL+ ",VMS_DECC_INIT" +$! $ TCPIP_PROGRAMS = ",," $ IF COMPILER .EQS. "VAXC" THEN - TCPIP_PROGRAMS = ",OPENSSL," @@ -209,7 +241,7 @@ $ LIB_COUNTER = -1 $! $! Create a .OPT file for the object files $! -$ OPEN/WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT +$ OPEN /WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT $! $! Top Of The File Loop. $! @@ -296,34 +328,18 @@ $ GOTO NEXT_APP $ ENDIF $! $! Link The Program. -$! Check To See If We Are To Link With A Specific TCP/IP Library. $! $ ON WARNING THEN GOTO NEXT_APP $! -$ IF (TCPIP_LIB.NES."") -$ THEN -$! $! Don't Link With The RSAREF Routines And TCP/IP Library. $! -$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' - - 'EXE_DIR''CURRENT_APP'.OPT/OPTION, - - 'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, - - 'TCPIP_LIB','OPT_FILE'/OPTION -$! -$! Else... -$! -$ ELSE -$! -$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library. -$! -$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' - - 'EXE_DIR''CURRENT_APP'.OPT/OPTION, - - 'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, - - 'OPT_FILE'/OPTION -$! -$! End The TCP/IP Library Check. -$! -$ ENDIF +$ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' /EXE='EXE_FILE' - + 'EXE_DIR''CURRENT_APP'.OPT /OPTIONS, - + 'SSL_LIB' /LIBRARY, - + 'CRYPTO_LIB' /LIBRARY - + 'TCPIP_LIB' - + 'ZLIB_LIB' - + ,'OPT_FILE' /OPTIONS $! $! Go Back And Do It Again. $! @@ -358,7 +374,7 @@ $! $ CREATE 'OPT_FILE' $DECK ! -! Default System Options File To Link Agianst +! Default System Options File To Link Against ! The Sharable VAX C Runtime Library. ! SYS$SHARE:VAXCRTL.EXE/SHARE @@ -387,7 +403,7 @@ $! $ CREATE 'OPT_FILE' $DECK ! -! Default System Options File To Link Agianst +! Default System Options File To Link Against ! The Sharable C Runtime Library. ! GNU_CC:[000000]GCCLIB/LIBRARY @@ -422,7 +438,7 @@ $! $ CREATE 'OPT_FILE' $DECK ! -! Default System Options File To Link Agianst +! Default System Options File To Link Against ! The Sharable DEC C Runtime Library. ! SYS$SHARE:DECC$SHR.EXE/SHARE @@ -437,7 +453,7 @@ $! $ CREATE 'OPT_FILE' $DECK ! -! Default System Options File For non-VAX To Link Agianst +! Default System Options File For non-VAX To Link Against ! The Sharable C Runtime Library. ! SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE @@ -521,14 +537,15 @@ $! $ IF (P1.EQS."NODEBUG") $ THEN $! -$! P1 Is NODEBUG, So Compile Without Debugger Information. +$! P1 Is NODEBUG, So Compile Without Debugger Information. $! -$ DEBUGGER = "NODEBUG" -$ TRACEBACK = "NOTRACEBACK" -$ GCC_OPTIMIZE = "OPTIMIZE" -$ CC_OPTIMIZE = "OPTIMIZE" -$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." -$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." +$ DEBUGGER = "NODEBUG" +$ LINKMAP = "NOMAP" +$ TRACEBACK = "NOTRACEBACK" +$ GCC_OPTIMIZE = "OPTIMIZE" +$ CC_OPTIMIZE = "OPTIMIZE" +$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." +$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." $! $! Else... $! @@ -542,6 +559,7 @@ $! $! Compile With Debugger Information. $! $ DEBUGGER = "DEBUG" +$ LINKMAP = "MAP" $ TRACEBACK = "TRACEBACK" $ GCC_OPTIMIZE = "NOOPTIMIZE" $ CC_OPTIMIZE = "NOOPTIMIZE" @@ -549,7 +567,7 @@ $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." $ ELSE $! -$! Tell The User Entered An Invalid Option.. +$! Tell The User Entered An Invalid Option. $! $ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" @@ -562,7 +580,7 @@ $! Time To EXIT. $! $ EXIT $! -$! End The Valid Arguement Check. +$! End The Valid Argument Check. $! $ ENDIF $! @@ -570,58 +588,49 @@ $! End The P1 Check. $! $ ENDIF $! -$! Check To See If P6 Is Blank. +$! Check P6 (POINTER_SIZE). $! -$ IF (P6.EQS."") +$ IF (P6 .NES. "") .AND. (ARCH .NES. "VAX") $ THEN -$ POINTER_SIZE = "" -$ ELSE -$! -$! Check is P6 Is Valid $! -$ IF (P6.EQS."32") +$ IF (P6 .EQS. "32") $ THEN $ POINTER_SIZE = "/POINTER_SIZE=32" -$ IF ARCH .EQS. "VAX" -$ THEN -$ LIB32 = "" -$ ELSE -$ LIB32 = "32" -$ ENDIF $ ELSE -$ IF (P6.EQS."64") +$ IF (P6 .EQS. "64") $ THEN +$ POINTER_SIZE = "/POINTER_SIZE=64=ARGV" +$ ARCHD = ARCH+ "_64" $ LIB32 = "" -$ IF ARCH .EQS. "VAX" -$ THEN -$ POINTER_SIZE = "/POINTER_SIZE=32" -$ ELSE -$ POINTER_SIZE = "/POINTER_SIZE=64" -$ ENDIF $ ELSE $! -$! Tell The User Entered An Invalid Option.. +$! Tell The User Entered An Invalid Option. $! $ WRITE SYS$OUTPUT "" -$ WRITE SYS$OUTPUT "The Option ",P6," Is Invalid. The Valid Options Are:" +$ WRITE SYS$OUTPUT "The Option ", P6, - + " Is Invalid. The Valid Options Are:" $ WRITE SYS$OUTPUT "" -$ WRITE SYS$OUTPUT " 32 : Compile with 32 bit pointer size" -$ WRITE SYS$OUTPUT " 64 : Compile with 64 bit pointer size" +$ WRITE SYS$OUTPUT " """" : Compile with default (short) pointers." +$ WRITE SYS$OUTPUT " 32 : Compile with 32-bit (short) pointers." +$ WRITE SYS$OUTPUT " 64 : Compile with 64-bit (long) pointers." $ WRITE SYS$OUTPUT "" -$! +$! $! Time To EXIT. $! -$ GOTO TIDY -$! -$! End The Valid Arguement Check. +$ EXIT $! $ ENDIF +$! $ ENDIF $! -$! End The P6 Check. +$! End The P6 (POINTER_SIZE) Check. $! $ ENDIF $! +$! Set basic C compiler /INCLUDE directories. +$! +$ CC_INCLUDES = "SYS$DISK:[-],SYS$DISK:[-.CRYPTO]" +$! $! Check To See If P2 Is Blank. $! $ IF (P2.EQS."") @@ -726,7 +735,60 @@ $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR" $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS $! -$! Check To See If The User Entered A Valid Paramter. +$! Check To See If We Have A ZLIB Option. +$! +$ ZLIB = P7 +$ IF (ZLIB .NES. "") +$ THEN +$! +$! Check for expected ZLIB files. +$! +$ err = 0 +$ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY") +$ if (f$search( file1) .eqs. "") +$ then +$ WRITE SYS$OUTPUT "" +$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." +$ WRITE SYS$OUTPUT " Can't find header: ''file1'" +$ err = 1 +$ endif +$ file1 = f$parse( "A.;", ZLIB)- "A.;" +$! +$ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY") +$ if (f$search( file2) .eqs. "") +$ then +$ if (err .eq. 0) +$ then +$ WRITE SYS$OUTPUT "" +$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." +$ endif +$ WRITE SYS$OUTPUT " Can't find library: ''file2'" +$ WRITE SYS$OUTPUT "" +$ err = err+ 2 +$ endif +$ if (err .eq. 1) +$ then +$ WRITE SYS$OUTPUT "" +$ endif +$! +$ if (err .ne. 0) +$ then +$ EXIT +$ endif +$! +$ CCDEFS = """ZLIB=1"", "+ CCDEFS +$ CC_INCLUDES = CC_INCLUDES+ ", "+ file1 +$ ZLIB_LIB = ", ''file2' /library" +$! +$! Print info +$! +$ WRITE SYS$OUTPUT "ZLIB library spec: ", file2 +$! +$! End The ZLIB Check. +$! +$ ENDIF +$! +$! Check To See If The User Entered A Valid Parameter. $! $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC") $ THEN @@ -749,13 +811,13 @@ $! $ CC = "CC" $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - THEN CC = "CC/DECC" -$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + - - "/NOLIST/PREFIX=ALL" + - - "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS +$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=RELAXED"+ - + "''POINTER_SIZE'/NOLIST/PREFIX=ALL" + - + "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS $! $! Define The Linker Options File Name. $! -$ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" +$ OPT_FILE = "VAX_DECC_OPTIONS.OPT" $! $! End DECC Check. $! @@ -783,7 +845,7 @@ $ EXIT $ ENDIF $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - - "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS + "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS $ CCDEFS = CCDEFS + ",""VAXC""" $! $! Define <sys> As SYS$COMMON:[SYSLIB] @@ -792,7 +854,7 @@ $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] $! $! Define The Linker Options File Name. $! -$ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" +$ OPT_FILE = "VAX_VAXC_OPTIONS.OPT" $! $! End VAXC Check $! @@ -815,11 +877,11 @@ $! Use GNU C... $! $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - - "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS + "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS $! $! Define The Linker Options File Name. $! -$ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" +$ OPT_FILE = "VAX_GNUC_OPTIONS.OPT" $! $! End The GNU C Check. $! @@ -829,7 +891,7 @@ $! Set up default defines $! $ CCDEFS = """FLAT_INC=1""," + CCDEFS $! -$! Else The User Entered An Invalid Arguement. +$! Else The User Entered An Invalid Argument. $! $ ELSE $! @@ -861,7 +923,7 @@ $ THEN $! $! Set the library to use SOCKETSHR $! -$ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT" +$ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS" $! $! Done with SOCKETSHR $! @@ -887,13 +949,13 @@ $ THEN $! $! Set the library to use UCX. $! -$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT" +$ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS" $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" $ THEN -$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT" +$ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS" $ ELSE $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN - - TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT" + TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS" $ ENDIF $! $! Done with UCX @@ -907,7 +969,7 @@ $ THEN $! $! Set the library to use TCPIP. $! -$ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT" +$ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS" $! $! Done with TCPIP $! @@ -932,9 +994,9 @@ $ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'" $! $! Print info $! -$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB +$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- "," $! -$! Else The User Entered An Invalid Arguement. +$! Else The User Entered An Invalid Argument. $! $ ELSE $! @@ -1034,7 +1096,7 @@ $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]" $! $! Set up the logical name OPENSSL to point at the include directory $! -$ DEFINE OPENSSL/NOLOG '__INCLUDE' +$ DEFINE OPENSSL /NOLOG '__INCLUDE' $! $! Done $! @@ -1042,15 +1104,24 @@ $ RETURN $! $ CLEANUP: $! -$! Restore the logical name OPENSSL if it had a value +$! Restore the saved logical name OPENSSL, if it had a value. $! -$ IF __SAVE_OPENSSL .EQS. "" -$ THEN -$ DEASSIGN OPENSSL -$ ELSE -$ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL' -$ ENDIF +$ if (f$type( __SAVE_OPENSSL) .nes. "") +$ then +$ IF __SAVE_OPENSSL .EQS. "" +$ THEN +$ DEASSIGN OPENSSL +$ ELSE +$ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL' +$ ENDIF +$ endif +$! +$! Close any open files. +$! +$ if (f$trnlnm( "objects", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then - + close objects $! $! Done $! $ RETURN +$! diff --git a/apps/openssl.c b/apps/openssl.c index 851e639735..7dbb7ac32a 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -410,7 +410,33 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]) } if (fp != NULL) { +#if defined( OPENSSL_SYS_VMS) && !defined( VMS_TRUST_ARGV) + /* 2011-03-08 SMS. + * "HP C V7.3-009 on OpenVMS Alpha V8.3" with 64-bit + * pointers (at least) may not NULL-terminate argv[] + * as expected. If necessary, use a (properly) + * NULL-terminated duplicate of argv[]. + */ + char **argv2 = NULL; + + if (argv[ argc] != NULL) + { + argv2 = OPENSSL_malloc( (argc+ 1)* sizeof( char *)); + if (argv2 == NULL) + { ret = -1; goto end; } + memcpy( argv2, argv, (argc* sizeof( char *))); + argv2[ argc] = NULL; + argv = argv2; + } +#endif ret=fp->func(argc,argv); +#if defined( OPENSSL_SYS_VMS) && !defined( VMS_TRUST_ARGV) + /* Free any duplicate argv[] storage. */ + if (argv2 != NULL) + { + OPENSSL_free( argv2); + } +#endif } else if ((strncmp(argv[0],"no-",3)) == 0) { diff --git a/apps/vms_decc_init.c b/apps/vms_decc_init.c new file mode 100755 index 0000000000..f512c8f1bc --- /dev/null +++ b/apps/vms_decc_init.c @@ -0,0 +1,188 @@ +#if defined( __VMS) && !defined( OPENSSL_NO_DECC_INIT) && \ + defined( __DECC) && !defined( __VAX) && (__CRTL_VER >= 70301000) +# define USE_DECC_INIT 1 +#endif + +#ifdef USE_DECC_INIT + +/* + * 2010-04-26 SMS. + * + *---------------------------------------------------------------------- + * + * decc_init() + * + * On non-VAX systems, uses LIB$INITIALIZE to set a collection of C + * RTL features without using the DECC$* logical name method. + * + *---------------------------------------------------------------------- + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unixlib.h> + + +/* Global storage. */ + +/* Flag to sense if decc_init() was called. */ + +int decc_init_done = -1; + + +/* Structure to hold a DECC$* feature name and its desired value. */ + +typedef struct +{ + char *name; + int value; +} decc_feat_t; + + +/* Array of DECC$* feature names and their desired values. + * Note: DECC$ARGV_PARSE_STYLE is the urgent one. + */ + +decc_feat_t decc_feat_array[] = +{ + /* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */ + { "DECC$ARGV_PARSE_STYLE", 1 }, + + /* Preserve case for file names on ODS5 disks. */ + { "DECC$EFS_CASE_PRESERVE", 1 }, + + /* Enable multiple dots (and most characters) in ODS5 file names, + * while preserving VMS-ness of ";version". + */ + { "DECC$EFS_CHARSET", 1 }, + + /* List terminator. */ + { (char *)NULL, 0 } +}; + + +/* LIB$INITIALIZE initialization function. */ + +static void decc_init( void) +{ + char *openssl_debug_decc_init; + int verbose = 0; + int feat_index; + int feat_value; + int feat_value_max; + int feat_value_min; + int i; + int sts; + + /* Get debug option. */ + openssl_debug_decc_init = getenv( "OPENSSL_DEBUG_DECC_INIT"); + if (openssl_debug_decc_init != NULL) + { + verbose = strtol( openssl_debug_decc_init, NULL, 10); + if (verbose <= 0) + { + verbose = 1; + } + } + + /* Set the global flag to indicate that LIB$INITIALIZE worked. */ + decc_init_done = 1; + + /* Loop through all items in the decc_feat_array[]. */ + + for (i = 0; decc_feat_array[ i].name != NULL; i++) + { + /* Get the feature index. */ + feat_index = decc$feature_get_index( decc_feat_array[ i].name); + if (feat_index >= 0) + { + /* Valid item. Collect its properties. */ + feat_value = decc$feature_get_value( feat_index, 1); + feat_value_min = decc$feature_get_value( feat_index, 2); + feat_value_max = decc$feature_get_value( feat_index, 3); + + /* Check the validity of our desired value. */ + if ((decc_feat_array[ i].value >= feat_value_min) && + (decc_feat_array[ i].value <= feat_value_max)) + { + /* Valid value. Set it if necessary. */ + if (feat_value != decc_feat_array[ i].value) + { + sts = decc$feature_set_value( feat_index, + 1, + decc_feat_array[ i].value); + + if (verbose > 1) + { + fprintf( stderr, " %s = %d, sts = %d.\n", + decc_feat_array[ i].name, + decc_feat_array[ i].value, + sts); + } + } + } + else + { + /* Invalid DECC feature value. */ + fprintf( stderr, + " INVALID DECC$FEATURE VALUE, %d: %d <= %s <= %d.\n", + feat_value, + feat_value_min, decc_feat_array[ i].name, feat_value_max); + } + } + else + { + /* Invalid DECC feature name. */ + fprintf( stderr, + " UNKNOWN DECC$FEATURE: %s.\n", decc_feat_array[ i].name); + } + } + + if (verbose > 0) + { + fprintf( stderr, " DECC_INIT complete.\n"); + } +} + +/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */ + +#pragma nostandard + +/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and + * other attributes. Note that "nopic" is significant only on VAX. + */ +#pragma extern_model save + +#if __INITIAL_POINTER_SIZE == 64 +# define PSECT_ALIGN 3 +#else +# define PSECT_ALIGN 2 +#endif + +#pragma extern_model strict_refdef "LIB$INITIALIZ" PSECT_ALIGN, nopic, nowrt +const int spare[ 8] = { 0 }; + +#pragma extern_model strict_refdef "LIB$INITIALIZE" PSECT_ALIGN, nopic, nowrt +void (*const x_decc_init)() = decc_init; + +#pragma extern_model restore + +/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */ + +#pragma extern_model save + +int LIB$INITIALIZE( void); + +#pragma extern_model strict_refdef +int dmy_lib$initialize = (int) LIB$INITIALIZE; + +#pragma extern_model restore + +#pragma standard + +#else /* def USE_DECC_INIT */ + +/* Dummy code to avoid a %CC-W-EMPTYFILE complaint. */ +int decc_init_dummy( void); + +#endif /* def USE_DECC_INIT */ |