3 $! Written By: Robert Byer
5 $! A-Com Computing, Inc.
6 $! byer@mail.all-net.net
8 $! Changes by Richard Levitte <richard@levitte.org>
10 $! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB"
11 $! library for OpenSSL. The "xxx" denotes the machine architecture of AXP
14 $! It was re-written so it would try to determine what "C" compiler to use
15 $! or you can specify which "C" compiler to use.
17 $! Specify the following as P1 to build just that part or ALL to just
20 $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
21 $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE
22 $! ALL To do both LIBRARY and APPS
24 $! Specify RSAREF as P2 to compile with the RSAREF library instead of
25 $! the regular one. If you specify NORSAREF it will compile with the
26 $! regular RSAREF routines. (Note: If you are in the United States
27 $! you MUST compile with RSAREF unless you have a license from RSA).
29 $! Note: The RSAREF libraries are NOT INCLUDED and you have to
30 $! download it from "ftp://ftp.rsa.com/rsaref". You have to
31 $! get the ".tar-Z" file as the ".zip" file dosen't have the
32 $! directory structure stored. You have to extract the file
33 $! into the [.RSAREF] directory under the root directory as that
34 $! is where the scripts will look for the files.
36 $! Specify DEBUG or NODEBUG as P3 to compile with or without debugger
39 $! Specify which compiler at P4 to try to compile under.
45 $! If you don't speficy a compiler, it will try to determine which
46 $! "C" compiler to use.
48 $! P5, if defined, sets a TCP/IP library to use, through one of the following
52 $! SOCKETSHR for SOCKETSHR+NETLIB
54 $! P6, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
56 $! P7, if defined, sets a choice of crypto methods to compile.
57 $! WARNING: this should only be done to recompile some part of an already
58 $! fully compiled library.
61 $! Define A TCP/IP Library That We Will Need To Link To.
62 $! (That Is, If We Need To Link To One.)
66 $! Check Which Architecture We Are Using.
68 $ IF (F$GETSYI("CPU").GE.128)
71 $! The Architecture Is AXP
79 $! The Architecture Is VAX.
83 $! End The Architecture Check.
87 $! Define The Different Encryption Types.
89 $ ENCRYPT_TYPES = "Basic,MD2,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
90 "DES,RC2,RC4,RC5,IDEA,BF,CAST,"+ -
92 "BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,"+ -
93 "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
94 "CONF,TXT_DB,PKCS7,PKCS12,COMP"
95 $ ENCRYPT_PROGRAMS = "DES,PKCS7"
97 $! Check To Make Sure We Have Valid Command Line Parameters.
101 $! Initialise logical names and such
105 $! Tell The User What Kind of Machine We Run On.
107 $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
109 $! Define The OBJ Directory.
111 $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.CRYPTO]
113 $! Check To See If The Architecture Specific OBJ Directory Exists.
115 $ IF (F$PARSE(OBJ_DIR).EQS."")
118 $! It Dosen't Exist, So Create It.
120 $ CREATE/DIR 'OBJ_DIR'
122 $! End The Architecture Specific OBJ Directory Check.
126 $! Define The EXE Directory.
128 $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]
130 $! Check To See If The Architecture Specific Directory Exists.
132 $ IF (F$PARSE(EXE_DIR).EQS."")
135 $! It Dosen't Exist, So Create It.
137 $ CREATE/DIRECTORY 'EXE_DIR'
139 $! End The Architecture Specific Directory Check.
143 $! Define The Library Name.
145 $ LIB_NAME := 'EXE_DIR'LIBCRYPTO.OLB
147 $! Define The CRYPTO-LIB We Are To Use.
149 $ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB
151 $! Define The RSAREF-LIB We Are To Use.
153 $ RSAREF_LIB := SYS$DISK:[-.'ARCH'.EXE.RSAREF]LIBRSAGLUE.OLB
155 $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library...
157 $ IF (F$SEARCH(LIB_NAME).EQS."")
160 $! Guess Not, Create The Library.
162 $ LIBRARY/CREATE/OBJECT 'LIB_NAME'
164 $! End The Library Check.
168 $! Build our options file for the application
170 $ GOSUB CHECK_OPT_FILE
172 $! Define The Different Encryption "library" Strings.
174 $ APPS_DES = "DES/DES,CBC3_ENC"
175 $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
177 $ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err"
178 $ LIB_MD2 = "md2_dgst,md2_one"
179 $ LIB_MD5 = "md5_dgst,md5_one"
180 $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one"
181 $ LIB_MDC2 = "mdc2dgst,mdc2_one"
183 $ LIB_RIPEMD = "rmd_dgst,rmd_one"
184 $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
185 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
186 "enc_read,enc_writ,ofb64enc,"+ -
187 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
188 "des_enc,fcrypt_b,read2pwd,"+ -
189 "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,ede_cbcm_enc"
190 $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64"
191 $ LIB_RC4 = "rc4_skey,rc4_enc"
192 $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64"
193 $ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey"
194 $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
195 $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
196 $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
197 $ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
198 $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,"+ -
199 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
200 "bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+",bn_recp,bn_mont,"+ -
202 $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
203 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null"
204 $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl"
205 $ LIB_DH = "dh_gen,dh_key,dh_lib,dh_check,dh_err"
206 $ LIB_BUFFER = "buffer,buf_err"
207 $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
208 "bss_mem,bss_null,bss_fd,"+ -
209 "bss_file,bss_sock,bss_conn,"+ -
210 "bf_null,bf_buff,b_print,b_dump,"+ -
211 "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log"
212 $ LIB_STACK = "stack"
213 $ LIB_LHASH = "lhash,lh_stats"
214 $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd"
215 $ LIB_ERR = "err,err_all,err_prn"
216 $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
217 $ LIB_EVP = "encode,digest,evp_enc,evp_key,"+ -
218 "e_ecb_d,e_cbc_d,e_cfb_d,e_ofb_d,"+ -
219 "e_ecb_i,e_cbc_i,e_cfb_i,e_ofb_i,"+ -
220 "e_ecb_3d,e_cbc_3d,e_rc4,names,"+ -
221 "e_cfb_3d,e_ofb_3d,e_xcbc_d,"+ -
222 "e_ecb_r2,e_cbc_r2,e_cfb_r2,e_ofb_r2,"+ -
223 "e_ecb_bf,e_cbc_bf,e_cfb_bf,e_ofb_bf"
224 $ LIB_EVP_2 = "e_ecb_c,e_cbc_c,e_cfb_c,e_ofb_c,"+ -
225 "e_ecb_r5,e_cbc_r5,e_cfb_r5,e_ofb_r5,"+ -
226 "m_null,m_md2,m_md5,m_sha,m_sha1,m_dss,m_dss1,m_mdc2,"+ -
228 "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ -
229 "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ -
230 "c_all,c_allc,c_alld,evp_lib,bio_ok,"+-
231 "evp_pkey,evp_pbe,p5_crpt,p5_crpt2"
232 $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ -
233 "a_null,a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,a_bmp,"+ -
234 "a_enum,a_vis,a_utf8,a_sign,a_digest,a_verify,a_mbstr,"+ -
235 "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,"+ -
236 "x_name,x_cinf,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ -
237 "d2i_r_pr,i2d_r_pr,d2i_r_pu,i2d_r_pu,"+ -
238 "d2i_s_pr,i2d_s_pr,d2i_s_pu,i2d_s_pu,"+ -
239 "d2i_pu,d2i_pr,i2d_pu,i2d_pr"
240 $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ -
241 "p7_i_s,p7_signi,p7_signd,p7_recip,p7_enc_c,p7_evp,"+ -
242 "p7_dgst,p7_s_e,p7_enc,p7_lib,"+ -
243 "f_int,f_string,i2d_dhp,i2d_dsap,d2i_dhp,d2i_dsap,n_pkey,"+ -
244 "f_enum,a_hdr,x_pkey,a_bool,x_exten,"+ -
245 "asn1_par,asn1_lib,asn1_err,a_meth,a_bytes,a_strnid,"+ -
246 "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey"
247 $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err"
248 $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ -
249 "x509_obj,x509_req,x509spki,x509_vfy,"+ -
250 "x509_set,x509rset,x509_err,"+ -
251 "x509name,x509_v3,x509_ext,x509_att,"+ -
252 "x509type,x509_lu,x_all,x509_txt,"+ -
253 "x509_trs,by_file,by_dir"
254 $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
255 "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ -
256 "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info"
257 $ LIB_CONF = "conf,conf_err"
258 $ LIB_TXT_DB = "txt_db"
259 $ LIB_PKCS7 = "pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,pk7_mime"
260 $ LIB_PKCS12 = "p12_add,p12_attr,p12_bags,p12_crpt,p12_crt,p12_decr,"+ -
261 "p12_init,p12_key,p12_kiss,p12_lib,p12_mac,p12_mutl,"+ -
262 "p12_sbag,p12_utl,p12_npas,pk12err"
263 $ LIB_COMP = "comp_lib,"+ -
266 $! Setup exceptional compilations
268 $ COMPILEWITH_CC3 = ",bss_rtcp,"
269 $ COMPILEWITH_CC4 = ",a_utctm,bss_log,"
270 $ COMPILEWITH_CC5 = ",md2_dgst,md5_dgst,mdc2dgst,sha_dgst,sha1dgst," + -
273 $! Check To See If We Are Going To Use RSAREF.
275 $ IF (RSAREF.EQS."TRUE" .AND. ENCRYPT_TYPES - "RSA".NES.ENCRYPT_TYPES -
276 .AND. (BUILDALL .EQS. "TRUE" .OR. BUILDALL .EQS. "LIBRARY"))
279 $! Check To See If The File [-.RSAREF]RSAREF.C Is Actually There.
281 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAREF.C").EQS."")
284 $! Tell The User That The File Dosen't Exist.
286 $ WRITE SYS$OUTPUT ""
287 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAREF.C Dosen't Exist."
288 $ WRITE SYS$OUTPUT ""
294 $! End The [-.RSAREF]RSAREF.C Check.
298 $! Tell The User We Are Compiling The [-.RSAREF]RSAREF File.
300 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAREF File."
302 $! Compile [-.RSAREF]RSAREF.C
304 $ CC/OBJECT='OBJ_DIR'RSAREF.OBJ SYS$DISK:[-.RSAREF]RSAREF.C
306 $! Add It To The Library.
308 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAREF.OBJ
310 $! Delete The Object File.
312 $ DELETE 'OBJ_DIR'RSAREF.OBJ;*
314 $! Check To See If The File [-.RSAREF]RSAR_ERR.C Is Actually There.
316 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAR_ERR.C").EQS."")
319 $! Tell The User That The File Dosen't Exist.
321 $ WRITE SYS$OUTPUT ""
322 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAR_ERR.C Dosen't Exist."
323 $ WRITE SYS$OUTPUT ""
329 $! End The [-.RSAREF]RSAR_ERR.C File Check.
333 $! Tell The User We Are Compiling The [-.RSAREF]RSAR_ERR File.
335 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAR_ERR File."
337 $! Compile [-.RSAREF]RSAR_ERR.C
339 $ CC/OBJECT='OBJ_DIR'RSAR_ERR.OBJ SYS$DISK:[-.RSAREF]RSAR_ERR.C
341 $! Add It To The Library.
343 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAR_ERR.OBJ
345 $! Delete The Object File.
347 $ DELETE 'OBJ_DIR'RSAR_ERR.OBJ;*
349 $! End The RSAREF Check.
353 $! Figure Out What Other Modules We Are To Build.
357 $! Define A Module Counter.
365 $! Extract The Module Name From The Encryption List.
367 $ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES)
368 $ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = ""
369 $ MODULE_NAME1 = MODULE_NAME
371 $! Check To See If We Are At The End Of The Module List.
373 $ IF (MODULE_NAME.EQS.",")
376 $! We Are At The End Of The Module List, Go To MODULE_DONE.
380 $! End The Module List Check.
384 $! Increment The Moudle Counter.
386 $ MODULE_COUNTER = MODULE_COUNTER + 1
388 $! Create The Library and Apps Module Names.
390 $ LIB_MODULE = "LIB_" + MODULE_NAME
391 $ APPS_MODULE = "APPS_" + MODULE_NAME
392 $ IF (MODULE_NAME.EQS."ASN1_2")
394 $ MODULE_NAME = "ASN1"
396 $ IF (MODULE_NAME.EQS."EVP_2")
398 $ MODULE_NAME = "EVP"
401 $! Set state (can be LIB and APPS)
404 $ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS"
406 $! Check if the library module name actually is defined
408 $ IF F$TYPE('LIB_MODULE') .EQS. ""
411 $ WRITE SYS$ERROR "The module ",MODULE_NAME," does not exist. Continuing..."
416 $! Top Of The Module Loop.
420 $! Tell The User What Module We Are Building.
422 $ IF (MODULE_NAME1.NES."")
424 $ IF STATE .EQS. "LIB"
426 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")"
427 $ ELSE IF F$TYPE('APPS_MODULE') .NES. ""
429 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")"
434 $! Define A File Counter And Set It To "0".
438 $ APPLICATION_COUNTER = 0
440 $! Top Of The File Loop.
444 $! Look in the LIB_MODULE is we're in state LIB
446 $ IF STATE .EQS. "LIB"
449 $! O.K, Extract The File Name From The File List.
451 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE')
458 $ IF F$TYPE('APPS_MODULE') .NES. ""
461 $! Extract The File Name From The File List.
462 $! This part is a bit more complicated.
464 $ IF APPLICATION .EQS. ""
466 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
467 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
468 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
469 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
473 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
474 $! SHOW SYMBOL APPLICATION*
476 $ IF APPLICATION .NES. ";"
478 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS)
479 $ IF FILE_NAME .EQS. ","
488 $! Check To See If We Are At The End Of The File List.
490 $ IF (FILE_NAME.EQS.",")
493 $! We Are At The End Of The File List, Change State Or Goto FILE_DONE.
495 $ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY"
503 $! End The File List Check.
507 $! Increment The Counter.
509 $ FILE_COUNTER = FILE_COUNTER + 1
511 $! Create The Source File Name.
513 $ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME)
514 $ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME
515 $ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN -
516 FILE_NAME = FILE_NAME + ".c"
517 $ IF (MODULE_NAME.NES."")
519 $ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME
521 $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME
523 $ SOURCE_FILE = SOURCE_FILE - "]["
525 $! Create The Object File Name.
527 $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
528 $ ON WARNING THEN GOTO NEXT_FILE
530 $! Check To See If The File We Want To Compile Is Actually There.
532 $ IF (F$SEARCH(SOURCE_FILE).EQS."")
535 $! Tell The User That The File Dosen't Exist.
537 $ WRITE SYS$OUTPUT ""
538 $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
539 $ WRITE SYS$OUTPUT ""
545 $! End The File Exist Check.
549 $! Tell The User We Are Compiling The File.
551 $ IF (MODULE_NAME.EQS."")
553 $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")"
555 $ IF (MODULE_NAME.NES."")
557 $ WRITE SYS$OUTPUT " ",FILE_NAME,""
562 $ ON ERROR THEN GOTO NEXT_FILE
563 $ FILE_NAME0 = F$ELEMENT(0,".",FILE_NAME)
564 $ IF FILE_NAME - ".mar" .NES. FILE_NAME
566 $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
568 $ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3
570 $ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
572 $ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4
574 $ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
576 $ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5
578 $ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
580 $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
585 $ IF STATE .EQS. "LIB"
588 $! Add It To The Library.
590 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE'
592 $! Time To Clean Up The Object File.
594 $ DELETE 'OBJECT_FILE';*
597 $! Go Back And Do It Again.
601 $! All Done With This Library Part.
605 $! Time To Build Some Applications
607 $ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY"
609 $ APPLICATION_COUNTER = 0
611 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
612 $ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE
614 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
615 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
616 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
618 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
619 $! SHOW SYMBOL APPLICATION*
621 $! Tell the user what happens
623 $ WRITE SYS$OUTPUT " ",APPLICATION,".exe"
625 $! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
627 $ IF (RSAREF.EQS."TRUE")
630 $! Check To See If We Are To Link With A Specific TCP/IP Library.
632 $ IF (TCPIP_LIB.NES."")
635 $! Link With The RSAREF Library And A Specific TCP/IP Library.
637 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
638 'OBJ_DIR''APPLICATION_OBJECTS', -
639 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
640 'TCPIP_LIB','OPT_FILE'/OPTION
646 $! Link With The RSAREF Library And NO TCP/IP Library.
648 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
649 'OBJ_DIR''APPLICATION_OBJECTS', -
650 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
653 $! End The TCP/IP Library Check.
661 $! Don't Link With The RSAREF Routines.
664 $! Check To See If We Are To Link With A Specific TCP/IP Library.
666 $ IF (TCPIP_LIB.NES."")
669 $! Don't Link With The RSAREF Routines And TCP/IP Library.
671 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
672 'OBJ_DIR''APPLICATION_OBJECTS', -
673 'CRYPTO_LIB'/LIBRARY, -
674 'TCPIP_LIB','OPT_FILE'/OPTION
680 $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
682 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
683 'OBJ_DIR''APPLICATION_OBJECTS',-
684 'CRYPTO_LIB'/LIBRARY, -
687 $! End The TCP/IP Library Check.
691 $! End The RSAREF Link Check.
694 $ GOTO NEXT_APPLICATION
698 $! Go Back And Get The Next Module.
702 $! All Done With This Module.
706 $! Tell The User That We Are All Done.
708 $ WRITE SYS$OUTPUT "All Done..."
713 $! Check For The Link Option FIle.
717 $! Check To See If We Need To Make A VAX C Option File.
719 $ IF (COMPILER.EQS."VAXC")
722 $! Check To See If We Already Have A VAX C Linker Option File.
724 $ IF (F$SEARCH(OPT_FILE).EQS."")
727 $! We Need A VAX C Linker Option File.
732 ! Default System Options File To Link Agianst
733 ! The Sharable VAX C Runtime Library.
735 SYS$SHARE:VAXCRTL.EXE/SHARE
738 $! End The Option File Check.
742 $! End The VAXC Check.
746 $! Check To See If We Need A GNU C Option File.
748 $ IF (COMPILER.EQS."GNUC")
751 $! Check To See If We Already Have A GNU C Linker Option File.
753 $ IF (F$SEARCH(OPT_FILE).EQS."")
756 $! We Need A GNU C Linker Option File.
761 ! Default System Options File To Link Agianst
762 ! The Sharable C Runtime Library.
764 GNU_CC:[000000]GCCLIB/LIBRARY
765 SYS$SHARE:VAXCRTL/SHARE
768 $! End The Option File Check.
772 $! End The GNU C Check.
776 $! Check To See If We Need A DEC C Option File.
778 $ IF (COMPILER.EQS."DECC")
781 $! Check To See If We Already Have A DEC C Linker Option File.
783 $ IF (F$SEARCH(OPT_FILE).EQS."")
786 $! Figure Out If We Need An AXP Or A VAX Linker Option File.
788 $ IF ARCH .EQS. "VAX"
791 $! We Need A DEC C Linker Option File For VAX.
796 ! Default System Options File To Link Agianst
797 ! The Sharable DEC C Runtime Library.
799 SYS$SHARE:DECC$SHR.EXE/SHARE
806 $! Create The AXP Linker Option File.
811 ! Default System Options File For AXP To Link Agianst
812 ! The Sharable C Runtime Library.
814 SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
815 SYS$SHARE:CMA$OPEN_RTL/SHARE
818 $! End The VAX/AXP DEC C Option File Check.
822 $! End The Option File Search.
826 $! End The DEC C Check.
830 $! Tell The User What Linker Option File We Are Using.
832 $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
838 $! Check The User's Options.
842 $! Check To See If P1 Is Blank.
847 $! P1 Is Blank, So Build Everything.
855 $! Else, Check To See If P1 Has A Valid Arguement.
857 $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS")
860 $! A Valid Arguement.
868 $! Tell The User We Don't Know What They Want.
870 $ WRITE SYS$OUTPUT ""
871 $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
872 $ WRITE SYS$OUTPUT ""
873 $ WRITE SYS$OUTPUT " ALL : Just Build Everything."
874 $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library."
875 $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.SSL]*.EXE Programs."
876 $ WRITE SYS$OUTPUT ""
877 $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
878 $ WRITE SYS$OUTPUT ""
879 $ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
880 $ WRITE SYS$OUTPUT " VAX : VAX Architecture."
881 $ WRITE SYS$OUTPUT ""
887 $! End The Valid Arguement Check.
895 $! Check To See If P2 Is Blank.
897 $ IF (P2.EQS."NORSAREF")
900 $! P2 Is NORSAREF, So Compile With The Regular RSA Libraries.
905 $! Check To See If We Are To Use The RSAREF Library.
907 $ IF (P2.EQS."RSAREF")
910 $! Check To Make Sure We Have The RSAREF Source Code Directory.
912 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."")
915 $! We Don't Have The RSAREF Souce Code Directory, So Tell The
918 $ WRITE SYS$OUTPUT ""
919 $ WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code."
920 $ WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'. You have to"
921 $ WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file dosen't have the"
922 $ WRITE SYS$OUTPUT "directory structure stored. You have to extract the file"
923 $ WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory"
924 $ WRITE SYS$OUTPUT "as that is where the scripts will look for the files."
925 $ WRITE SYS$OUTPUT ""
931 $! Else, Compile Using The RSAREF Library.
938 $! They Entered An Invalid Option..
940 $ WRITE SYS$OUTPUT ""
941 $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
942 $ WRITE SYS$OUTPUT ""
943 $ WRITE SYS$OUTPUT " RSAREF : Compile With The RSAREF Library."
944 $ WRITE SYS$OUTPUT " NORSAREF : Compile With The Regular RSA Library."
945 $ WRITE SYS$OUTPUT ""
951 $! End The Valid Arguement Check.
959 $! Check To See If P3 Is Blank.
961 $ IF (P3.EQS."NODEBUG")
964 $! P3 Is NODEBUG, So Compile Without The Debugger Information.
966 $ DEBUGGER = "NODEBUG"
967 $ TRACEBACK = "NOTRACEBACK"
968 $ GCC_OPTIMIZE = "OPTIMIZE"
969 $ CC_OPTIMIZE = "OPTIMIZE"
970 $ MACRO_OPTIMIZE = "OPTIMIZE"
971 $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
972 $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
975 $! Check To See If We Are To Compile With Debugger Information.
977 $ IF (P3.EQS."DEBUG")
980 $! Compile With Debugger Information.
983 $ TRACEBACK = "TRACEBACK"
984 $ GCC_OPTIMIZE = "NOOPTIMIZE"
985 $ CC_OPTIMIZE = "NOOPTIMIZE"
986 $ MACRO_OPTIMIZE = "NOOPTIMIZE"
987 $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
988 $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
991 $! They Entered An Invalid Option..
993 $ WRITE SYS$OUTPUT ""
994 $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
995 $ WRITE SYS$OUTPUT ""
996 $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
997 $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
998 $ WRITE SYS$OUTPUT ""
1004 $! End The Valid Arguement Check.
1008 $! End The P3 Check.
1012 $! Special Threads For OpenVMS v7.1 Or Later
1014 $! Written By: Richard Levitte
1015 $! richard@levitte.org
1018 $! Check To See If We Have A Option For P6.
1023 $! Get The Version Of VMS We Are Using.
1026 $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
1027 $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
1029 $! Check To See If The VMS Version Is v7.1 Or Later.
1034 $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
1036 $ ISSEVEN := ,PTHREAD_USE_D4
1038 $! End The VMS Version Check.
1042 $! End The P6 Check.
1046 $! Check To See If P4 Is Blank.
1051 $! O.K., The User Didn't Specify A Compiler, Let's Try To
1052 $! Find Out Which One To Use.
1054 $! Check To See If We Have GNU C.
1056 $ IF (F$TRNLNM("GNU_CC").NES."")
1059 $! Looks Like GNUC, Set To Use GNUC.
1067 $! Check To See If We Have VAXC Or DECC.
1069 $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
1072 $! Looks Like DECC, Set To Use DECC.
1080 $! Looks Like VAXC, Set To Use VAXC.
1084 $! End The VAXC Compiler Check.
1088 $! End The DECC & VAXC Compiler Check.
1092 $! End The Compiler Check.
1096 $! Check To See If We Have A Option For P5.
1101 $! Find out what socket library we have available
1103 $ IF F$PARSE("SOCKETSHR:") .NES. ""
1106 $! We have SOCKETSHR, and it is my opinion that it's the best to use.
1112 $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
1114 $! Else, let's look for something else
1118 $! Like UCX (the reason to do this before Multinet is that the UCX
1119 $! emulation is easier to use...)
1121 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
1122 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
1123 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
1126 $! Last resort: a UCX or UCX-compatible library
1132 $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
1140 $! Set Up Initial CC Definitions, Possibly With User Ones
1142 $ CCDEFS = "VMS=1,TCPIP_TYPE_''P5'"
1143 $ IF F$TRNLNM("OPENSSL_NO_ASM") THEN CCDEFS = CCDEFS + ",NO_ASM"
1144 $ IF F$TRNLNM("OPENSSL_NO_RSA") THEN CCDEFS = CCDEFS + ",NO_RSA"
1145 $ IF F$TRNLNM("OPENSSL_NO_DSA") THEN CCDEFS = CCDEFS + ",NO_DSA"
1146 $ IF F$TRNLNM("OPENSSL_NO_DH") THEN CCDEFS = CCDEFS + ",NO_DH"
1147 $ IF F$TRNLNM("OPENSSL_NO_MD2") THEN CCDEFS = CCDEFS + ",NO_MD2"
1148 $ IF F$TRNLNM("OPENSSL_NO_MD5") THEN CCDEFS = CCDEFS + ",NO_MD5"
1149 $ IF F$TRNLNM("OPENSSL_NO_RIPEMD") THEN CCDEFS = CCDEFS + ",NO_RIPEMD"
1150 $ IF F$TRNLNM("OPENSSL_NO_SHA") THEN CCDEFS = CCDEFS + ",NO_SHA"
1151 $ IF F$TRNLNM("OPENSSL_NO_SHA0") THEN CCDEFS = CCDEFS + ",NO_SHA0"
1152 $ IF F$TRNLNM("OPENSSL_NO_SHA1") THEN CCDEFS = CCDEFS + ",NO_SHA1"
1153 $ IF F$TRNLNM("OPENSSL_NO_DES")
1155 $ CCDEFS = CCDEFS + ",NO_DES,NO_MDC2"
1157 $ IF F$TRNLNM("OPENSSL_NO_MDC2") THEN CCDEFS = CCDEFS + ",NO_MDC2"
1159 $ IF F$TRNLNM("OPENSSL_NO_RC2") THEN CCDEFS = CCDEFS + ",NO_RC2"
1160 $ IF F$TRNLNM("OPENSSL_NO_RC4") THEN CCDEFS = CCDEFS + ",NO_RC4"
1161 $ IF F$TRNLNM("OPENSSL_NO_RC5") THEN CCDEFS = CCDEFS + ",NO_RC5"
1162 $ IF F$TRNLNM("OPENSSL_NO_IDEA") THEN CCDEFS = CCDEFS + ",NO_IDEA"
1163 $ IF F$TRNLNM("OPENSSL_NO_BF") THEN CCDEFS = CCDEFS + ",NO_BF"
1164 $ IF F$TRNLNM("OPENSSL_NO_CAST") THEN CCDEFS = CCDEFS + ",NO_CAST"
1165 $ IF F$TRNLNM("OPENSSL_NO_HMAC") THEN CCDEFS = CCDEFS + ",NO_HMAC"
1166 $ IF F$TRNLNM("OPENSSL_NO_SSL2") THEN CCDEFS = CCDEFS + ",NO_SSL2"
1167 $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
1169 $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
1170 $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX"
1171 $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
1172 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
1174 $! Check To See If The User Entered A Valid Paramter.
1176 $ IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC")
1179 $! Check To See If The User Wanted DECC.
1181 $ IF (P4.EQS."DECC")
1184 $! Looks Like DECC, Set To Use DECC.
1188 $! Tell The User We Are Using DECC.
1190 $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
1195 $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
1197 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
1198 "/NOLIST/PREFIX=ALL/INCLUDE=SYS$DISK:[]" + CCEXTRAFLAGS
1200 $! Define The Linker Options File Name.
1202 $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
1208 $! Check To See If We Are To Use VAXC.
1210 $ IF (P4.EQS."VAXC")
1213 $! Looks Like VAXC, Set To Use VAXC.
1217 $! Tell The User We Are Using VAX C.
1219 $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
1221 $! Compile Using VAXC.
1226 $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
1229 $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
1230 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST/INCLUDE=SYS$DISK:[]" + -
1232 $ CCDEFS = """VAXC""," + CCDEFS
1234 $! Define <sys> As SYS$COMMON:[SYSLIB]
1236 $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
1238 $! Define The Linker Options File Name.
1240 $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
1246 $! Check To See If We Are To Use GNU C.
1248 $ IF (P4.EQS."GNUC")
1251 $! Looks Like GNUC, Set To Use GNUC.
1255 $! Tell The User We Are Using GNUC.
1257 $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
1261 $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1262 "/INCLUDE=SYS$DISK:[]" + CCEXTRAFLAGS
1264 $! Define The Linker Options File Name.
1266 $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
1268 $! End The GNU C Check.
1272 $! Set up default defines
1274 $ CCDEFS = """FLAT_INC=1""," + CCDEFS
1276 $! Check To See If We Are To Compile With RSAREF Routines.
1278 $ IF (RSAREF.EQS."TRUE")
1281 $! Compile With RSAREF.
1283 $ CCDEFS = CCDEFS + ",""RSAref=1"""
1285 $! Tell The User This.
1287 $ WRITE SYS$OUTPUT "Compiling With RSAREF Routines."
1289 $! Else, We Don't Care. Compile Without The RSAREF Library.
1293 $! Tell The User We Are Compile Without The RSAREF Routines.
1295 $ WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines.
1297 $! End The RSAREF Check.
1301 $! Finish up the definition of CC.
1303 $ IF COMPILER .EQS. "DECC"
1305 $ IF CCDISABLEWARNINGS .EQS. ""
1307 $ CC4DISABLEWARNINGS = "DOLLARID"
1309 $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1310 $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1312 $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1314 $ CCDISABLEWARNINGS = ""
1315 $ CC4DISABLEWARNINGS = ""
1317 $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1318 $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1319 $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P3 .NES. "DEBUG"
1321 $ CC5 = CC + "/OPTIMIZE=NODISJOINT"
1323 $ CC5 = CC + "/NOOPTIMIZE"
1325 $ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1327 $! Show user the result
1329 $ WRITE SYS$OUTPUT "Main C Compiling Command: ",CC
1331 $! Else The User Entered An Invalid Arguement.
1335 $! Tell The User We Don't Know What They Want.
1337 $ WRITE SYS$OUTPUT ""
1338 $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
1339 $ WRITE SYS$OUTPUT ""
1340 $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
1341 $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
1342 $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
1343 $ WRITE SYS$OUTPUT ""
1349 $! End The Valid Arguement Check.
1353 $! Build a MACRO command for the architecture at hand
1355 $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
1356 $ IF ARCH .EQS. "AXP" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
1358 $! Show user the result
1360 $ WRITE SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
1362 $! Time to check the contents, and to make sure we get the correct library.
1364 $ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX"
1367 $! Check to see if SOCKETSHR was chosen
1369 $ IF P5.EQS."SOCKETSHR"
1372 $! Set the library to use SOCKETSHR
1374 $ TCPIP_LIB = "[-.VMS]SOCKETSHR_SHR.OPT/OPT"
1376 $! Done with SOCKETSHR
1380 $! Check to see if MULTINET was chosen
1382 $ IF P5.EQS."MULTINET"
1385 $! Set the library to use UCX emulation.
1389 $! Done with MULTINET
1393 $! Check to see if UCX was chosen
1398 $! Set the library to use UCX.
1400 $ TCPIP_LIB = "[-.VMS]UCX_SHR_DECC.OPT/OPT"
1401 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
1403 $ TCPIP_LIB = "[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
1405 $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1406 TCPIP_LIB = "[-.VMS]UCX_SHR_VAXC.OPT/OPT"
1415 $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
1417 $! Else The User Entered An Invalid Arguement.
1421 $! Tell The User We Don't Know What They Want.
1423 $ WRITE SYS$OUTPUT ""
1424 $ WRITE SYS$OUTPUT "The Option ",P5," Is Invalid. The Valid Options Are:"
1425 $ WRITE SYS$OUTPUT ""
1426 $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1427 $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1428 $ WRITE SYS$OUTPUT ""
1434 $! Done with TCP/IP libraries
1438 $! Check if the user wanted to compile just a subset of all the encryption
1443 $ ENCRYPT_TYPES = P7
1444 $! NYI: ENCRYPT_PROGRAMS = P7
1447 $! Time To RETURN...
1453 $! Save old value of the logical name OPENSSL
1455 $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1457 $! Save directory information
1459 $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1460 $ __TOP = __HERE - "CRYPTO]"
1461 $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1463 $! Set up the logical name OPENSSL to point at the include directory
1465 $ DEFINE OPENSSL/NOLOG '__INCLUDE'
1473 $! Restore the logical name OPENSSL if it had a value
1475 $ IF __SAVE_OPENSSL .EQS. ""
1479 $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'