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,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
90 "DES,RC2,RC4,RC5,IDEA,BF,CAST,"+ -
91 "BN,EC,RSA,DSA,DH,DSO,ENGINE,RIJNDAEL,"+ -
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,OCSP,UI"
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,ebcdic,uid,o_time"
178 $ LIB_MD2 = "md2_dgst,md2_one"
179 $ LIB_MD4 = "md4_dgst,md4_one"
180 $ LIB_MD5 = "md5_dgst,md5_one"
181 $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one"
182 $ LIB_MDC2 = "mdc2dgst,mdc2_one"
184 $ LIB_RIPEMD = "rmd_dgst,rmd_one"
185 $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
186 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
187 "enc_read,enc_writ,ofb64enc,"+ -
188 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
189 "des_enc,fcrypt_b,"+ -
190 "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,ede_cbcm_enc"
191 $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64"
192 $ LIB_RC4 = "rc4_skey,rc4_enc"
193 $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64"
194 $ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey"
195 $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
196 $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
197 $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
198 $ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
199 $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
200 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
201 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ -
202 "bn_recp,bn_mont,bn_mpi,bn_exp2"
203 $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
204 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ -
206 $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_recp,ecp_nist,ec_cvt,ec_mult,"+ -
208 $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl"
209 $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err"
210 $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ -
211 "dso_openssl,dso_win32,dso_vms"
212 $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ -
213 "eng_table,eng_pkey,eng_fat,eng_all,"+ -
214 "tb_rsa,tb_dsa,tb_dh,tb_rand,tb_cipher,tb_digest,"+ -
215 "eng_openssl,eng_dyn,"+ -
216 "hw_atalla,hw_cswift,hw_ncipher,hw_nuron,hw_ubsec,"+ -
217 "hw_openbsd_dev_crypto"
218 $ LIB_RIJNDAEL = "rd_fst"
219 $ LIB_BUFFER = "buffer,buf_err"
220 $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
221 "bss_mem,bss_null,bss_fd,"+ -
222 "bss_file,bss_sock,bss_conn,"+ -
223 "bf_null,bf_buff,b_print,b_dump,"+ -
224 "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ -
226 $ LIB_STACK = "stack"
227 $ LIB_LHASH = "lhash,lh_stats"
228 $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
230 $ LIB_ERR = "err,err_all,err_prn"
231 $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
232 $ LIB_EVP = "encode,digest,evp_enc,evp_key,"+ -
233 "e_des,e_bf,e_idea,e_des3,"+ -
234 "e_rc4,e_aes,names,"+ -
235 "e_xcbc_d,e_rc2,e_cast,e_rc5"
236 $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + -
237 "m_dss,m_dss1,m_mdc2,m_ripemd,"+ -
238 "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ -
239 "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ -
240 "c_all,c_allc,c_alld,evp_lib,bio_ok,"+-
241 "evp_pkey,evp_pbe,p5_crpt,p5_crpt2"
242 $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ -
243 "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ -
244 "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ -
245 "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ -
246 "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ -
247 "d2i_pu,d2i_pr,i2d_pu,i2d_pr"
248 $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ -
249 "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ -
250 "f_int,f_string,n_pkey,"+ -
251 "f_enum,a_hdr,x_pkey,a_bool,x_exten,"+ -
252 "asn1_par,asn1_lib,asn1_err,a_meth,a_bytes,a_strnid,"+ -
253 "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey"
254 $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ -
255 "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey"
256 $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ -
257 "x509_obj,x509_req,x509spki,x509_vfy,"+ -
258 "x509_set,x509cset,x509rset,x509_err,"+ -
259 "x509name,x509_v3,x509_ext,x509_att,"+ -
260 "x509type,x509_lu,x_all,x509_txt,"+ -
261 "x509_trs,by_file,by_dir"
262 $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
263 "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ -
264 "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ -
266 $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def"
267 $ LIB_TXT_DB = "txt_db"
268 $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ -
270 $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ -
271 "p12_init,p12_key,p12_kiss,p12_mutl,"+ -
272 "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e"
273 $ LIB_COMP = "comp_lib,"+ -
275 $ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ -
276 "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err"
277 $ LIB_UI_COMPAT = "ui_compat"
278 $ LIB_UI = "ui_err,ui_lib,ui_openssl,"+LIB_UI_COMPAT
280 $! Setup exceptional compilations
282 $ COMPILEWITH_CC3 = ",bss_rtcp,"
283 $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,"
284 $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + -
285 "sha_dgst,sha1dgst,rmd_dgst,bf_enc,"
287 $! Check To See If We Are Going To Use RSAREF.
289 $ IF (RSAREF.EQS."TRUE" .AND. ENCRYPT_TYPES - "RSA".NES.ENCRYPT_TYPES -
290 .AND. (BUILDALL .EQS. "TRUE" .OR. BUILDALL .EQS. "LIBRARY"))
293 $! Check To See If The File [-.RSAREF]RSAREF.C Is Actually There.
295 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAREF.C").EQS."")
298 $! Tell The User That The File Doesn't Exist.
300 $ WRITE SYS$OUTPUT ""
301 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAREF.C Doesn't Exist."
302 $ WRITE SYS$OUTPUT ""
308 $! End The [-.RSAREF]RSAREF.C Check.
312 $! Tell The User We Are Compiling The [-.RSAREF]RSAREF File.
314 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAREF File."
316 $! Compile [-.RSAREF]RSAREF.C
318 $ CC/OBJECT='OBJ_DIR'RSAREF.OBJ SYS$DISK:[-.RSAREF]RSAREF.C
320 $! Add It To The Library.
322 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAREF.OBJ
324 $! Delete The Object File.
326 $ DELETE 'OBJ_DIR'RSAREF.OBJ;*
328 $! Check To See If The File [-.RSAREF]RSAR_ERR.C Is Actually There.
330 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAR_ERR.C").EQS."")
333 $! Tell The User That The File Doesn't Exist.
335 $ WRITE SYS$OUTPUT ""
336 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAR_ERR.C Doesn't Exist."
337 $ WRITE SYS$OUTPUT ""
343 $! End The [-.RSAREF]RSAR_ERR.C File Check.
347 $! Tell The User We Are Compiling The [-.RSAREF]RSAR_ERR File.
349 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAR_ERR File."
351 $! Compile [-.RSAREF]RSAR_ERR.C
353 $ CC/OBJECT='OBJ_DIR'RSAR_ERR.OBJ SYS$DISK:[-.RSAREF]RSAR_ERR.C
355 $! Add It To The Library.
357 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAR_ERR.OBJ
359 $! Delete The Object File.
361 $ DELETE 'OBJ_DIR'RSAR_ERR.OBJ;*
363 $! End The RSAREF Check.
367 $! Figure Out What Other Modules We Are To Build.
371 $! Define A Module Counter.
379 $! Extract The Module Name From The Encryption List.
381 $ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES)
382 $ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = ""
383 $ MODULE_NAME1 = MODULE_NAME
385 $! Check To See If We Are At The End Of The Module List.
387 $ IF (MODULE_NAME.EQS.",")
390 $! We Are At The End Of The Module List, Go To MODULE_DONE.
394 $! End The Module List Check.
398 $! Increment The Moudle Counter.
400 $ MODULE_COUNTER = MODULE_COUNTER + 1
402 $! Create The Library and Apps Module Names.
404 $ LIB_MODULE = "LIB_" + MODULE_NAME
405 $ APPS_MODULE = "APPS_" + MODULE_NAME
406 $ IF (MODULE_NAME.EQS."ASN1_2")
408 $ MODULE_NAME = "ASN1"
410 $ IF (MODULE_NAME.EQS."EVP_2")
412 $ MODULE_NAME = "EVP"
415 $! Set state (can be LIB and APPS)
418 $ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS"
420 $! Check if the library module name actually is defined
422 $ IF F$TYPE('LIB_MODULE') .EQS. ""
425 $ WRITE SYS$ERROR "The module ",MODULE_NAME," does not exist. Continuing..."
430 $! Top Of The Module Loop.
434 $! Tell The User What Module We Are Building.
436 $ IF (MODULE_NAME1.NES."")
438 $ IF STATE .EQS. "LIB"
440 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")"
441 $ ELSE IF F$TYPE('APPS_MODULE') .NES. ""
443 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")"
448 $! Define A File Counter And Set It To "0".
452 $ APPLICATION_COUNTER = 0
454 $! Top Of The File Loop.
458 $! Look in the LIB_MODULE is we're in state LIB
460 $ IF STATE .EQS. "LIB"
463 $! O.K, Extract The File Name From The File List.
465 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE')
472 $ IF F$TYPE('APPS_MODULE') .NES. ""
475 $! Extract The File Name From The File List.
476 $! This part is a bit more complicated.
478 $ IF APPLICATION .EQS. ""
480 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
481 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
482 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
483 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
487 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
488 $! SHOW SYMBOL APPLICATION*
490 $ IF APPLICATION .NES. ";"
492 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS)
493 $ IF FILE_NAME .EQS. ","
502 $! Check To See If We Are At The End Of The File List.
504 $ IF (FILE_NAME.EQS.",")
507 $! We Are At The End Of The File List, Change State Or Goto FILE_DONE.
509 $ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY"
517 $! End The File List Check.
521 $! Increment The Counter.
523 $ FILE_COUNTER = FILE_COUNTER + 1
525 $! Create The Source File Name.
527 $ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME)
528 $ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME
529 $ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN -
530 FILE_NAME = FILE_NAME + ".c"
531 $ IF (MODULE_NAME.NES."")
533 $ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME
535 $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME
537 $ SOURCE_FILE = SOURCE_FILE - "]["
539 $! Create The Object File Name.
541 $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
542 $ ON WARNING THEN GOTO NEXT_FILE
544 $! Check To See If The File We Want To Compile Is Actually There.
546 $ IF (F$SEARCH(SOURCE_FILE).EQS."")
549 $! Tell The User That The File Doesn't Exist.
551 $ WRITE SYS$OUTPUT ""
552 $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist."
553 $ WRITE SYS$OUTPUT ""
559 $! End The File Exist Check.
563 $! Tell The User We Are Compiling The File.
565 $ IF (MODULE_NAME.EQS."")
567 $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")"
569 $ IF (MODULE_NAME.NES."")
571 $ WRITE SYS$OUTPUT " ",FILE_NAME,""
576 $ ON ERROR THEN GOTO NEXT_FILE
577 $ FILE_NAME0 = F$ELEMENT(0,".",FILE_NAME)
578 $ IF FILE_NAME - ".mar" .NES. FILE_NAME
580 $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
582 $ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3
584 $ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
586 $ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4
588 $ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
590 $ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5
592 $ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
594 $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
599 $ IF STATE .EQS. "LIB"
602 $! Add It To The Library.
604 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE'
606 $! Time To Clean Up The Object File.
608 $ DELETE 'OBJECT_FILE';*
611 $! Go Back And Do It Again.
615 $! All Done With This Library Part.
619 $! Time To Build Some Applications
621 $ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY"
623 $ APPLICATION_COUNTER = 0
625 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
626 $ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE
628 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
629 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
630 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
632 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
633 $! SHOW SYMBOL APPLICATION*
635 $! Tell the user what happens
637 $ WRITE SYS$OUTPUT " ",APPLICATION,".exe"
639 $! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
641 $ IF (RSAREF.EQS."TRUE")
644 $! Check To See If We Are To Link With A Specific TCP/IP Library.
646 $ IF (TCPIP_LIB.NES."")
649 $! Link With The RSAREF Library And A Specific TCP/IP Library.
651 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
652 'OBJ_DIR''APPLICATION_OBJECTS', -
653 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
654 'TCPIP_LIB','OPT_FILE'/OPTION
660 $! Link With The RSAREF Library And NO TCP/IP Library.
662 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
663 'OBJ_DIR''APPLICATION_OBJECTS', -
664 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
667 $! End The TCP/IP Library Check.
675 $! Don't Link With The RSAREF Routines.
678 $! Check To See If We Are To Link With A Specific TCP/IP Library.
680 $ IF (TCPIP_LIB.NES."")
683 $! Don't Link With The RSAREF Routines And TCP/IP Library.
685 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
686 'OBJ_DIR''APPLICATION_OBJECTS', -
687 'CRYPTO_LIB'/LIBRARY, -
688 'TCPIP_LIB','OPT_FILE'/OPTION
694 $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
696 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
697 'OBJ_DIR''APPLICATION_OBJECTS',-
698 'CRYPTO_LIB'/LIBRARY, -
701 $! End The TCP/IP Library Check.
705 $! End The RSAREF Link Check.
708 $ GOTO NEXT_APPLICATION
712 $! Go Back And Get The Next Module.
716 $! All Done With This Module.
720 $! Tell The User That We Are All Done.
722 $ WRITE SYS$OUTPUT "All Done..."
727 $! Check For The Link Option FIle.
731 $! Check To See If We Need To Make A VAX C Option File.
733 $ IF (COMPILER.EQS."VAXC")
736 $! Check To See If We Already Have A VAX C Linker Option File.
738 $ IF (F$SEARCH(OPT_FILE).EQS."")
741 $! We Need A VAX C Linker Option File.
746 ! Default System Options File To Link Agianst
747 ! The Sharable VAX C Runtime Library.
749 SYS$SHARE:VAXCRTL.EXE/SHARE
752 $! End The Option File Check.
756 $! End The VAXC Check.
760 $! Check To See If We Need A GNU C Option File.
762 $ IF (COMPILER.EQS."GNUC")
765 $! Check To See If We Already Have A GNU C Linker Option File.
767 $ IF (F$SEARCH(OPT_FILE).EQS."")
770 $! We Need A GNU C Linker Option File.
775 ! Default System Options File To Link Agianst
776 ! The Sharable C Runtime Library.
778 GNU_CC:[000000]GCCLIB/LIBRARY
779 SYS$SHARE:VAXCRTL/SHARE
782 $! End The Option File Check.
786 $! End The GNU C Check.
790 $! Check To See If We Need A DEC C Option File.
792 $ IF (COMPILER.EQS."DECC")
795 $! Check To See If We Already Have A DEC C Linker Option File.
797 $ IF (F$SEARCH(OPT_FILE).EQS."")
800 $! Figure Out If We Need An AXP Or A VAX Linker Option File.
802 $ IF ARCH .EQS. "VAX"
805 $! We Need A DEC C Linker Option File For VAX.
810 ! Default System Options File To Link Agianst
811 ! The Sharable DEC C Runtime Library.
813 SYS$SHARE:DECC$SHR.EXE/SHARE
820 $! Create The AXP Linker Option File.
825 ! Default System Options File For AXP To Link Agianst
826 ! The Sharable C Runtime Library.
828 SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
829 SYS$SHARE:CMA$OPEN_RTL/SHARE
832 $! End The VAX/AXP DEC C Option File Check.
836 $! End The Option File Search.
840 $! End The DEC C Check.
844 $! Tell The User What Linker Option File We Are Using.
846 $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
852 $! Check The User's Options.
856 $! Check To See If P1 Is Blank.
861 $! P1 Is Blank, So Build Everything.
869 $! Else, Check To See If P1 Has A Valid Arguement.
871 $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS")
874 $! A Valid Arguement.
882 $! Tell The User We Don't Know What They Want.
884 $ WRITE SYS$OUTPUT ""
885 $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
886 $ WRITE SYS$OUTPUT ""
887 $ WRITE SYS$OUTPUT " ALL : Just Build Everything."
888 $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library."
889 $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.SSL]*.EXE Programs."
890 $ WRITE SYS$OUTPUT ""
891 $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
892 $ WRITE SYS$OUTPUT ""
893 $ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
894 $ WRITE SYS$OUTPUT " VAX : VAX Architecture."
895 $ WRITE SYS$OUTPUT ""
901 $! End The Valid Arguement Check.
909 $! Check To See If P2 Is Blank.
912 $ IF (P2.EQS."NORSAREF")
915 $! P2 Is NORSAREF, So Compile With The Regular RSA Libraries.
920 $! Check To See If We Are To Use The RSAREF Library.
922 $ IF (P2.EQS."RSAREF")
925 $! Check To Make Sure We Have The RSAREF Source Code Directory.
927 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."")
930 $! We Don't Have The RSAREF Souce Code Directory, So Tell The
933 $ WRITE SYS$OUTPUT ""
934 $ WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code."
935 $ WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'. You have to"
936 $ WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file doesn't have the"
937 $ WRITE SYS$OUTPUT "directory structure stored. You have to extract the file"
938 $ WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory"
939 $ WRITE SYS$OUTPUT "as that is where the scripts will look for the files."
940 $ WRITE SYS$OUTPUT ""
946 $! Else, Compile Using The RSAREF Library.
953 $! They Entered An Invalid Option..
955 $ WRITE SYS$OUTPUT ""
956 $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
957 $ WRITE SYS$OUTPUT ""
958 $ WRITE SYS$OUTPUT " RSAREF : Compile With The RSAREF Library."
959 $ WRITE SYS$OUTPUT " NORSAREF : Compile With The Regular RSA Library."
960 $ WRITE SYS$OUTPUT ""
966 $! End The Valid Arguement Check.
974 $! Check To See If P3 Is Blank.
976 $ IF (P3.EQS."NODEBUG")
979 $! P3 Is NODEBUG, So Compile Without The Debugger Information.
981 $ DEBUGGER = "NODEBUG"
982 $ TRACEBACK = "NOTRACEBACK"
983 $ GCC_OPTIMIZE = "OPTIMIZE"
984 $ CC_OPTIMIZE = "OPTIMIZE"
985 $ MACRO_OPTIMIZE = "OPTIMIZE"
986 $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
987 $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
990 $! Check To See If We Are To Compile With Debugger Information.
992 $ IF (P3.EQS."DEBUG")
995 $! Compile With Debugger Information.
998 $ TRACEBACK = "TRACEBACK"
999 $ GCC_OPTIMIZE = "NOOPTIMIZE"
1000 $ CC_OPTIMIZE = "NOOPTIMIZE"
1001 $ MACRO_OPTIMIZE = "NOOPTIMIZE"
1002 $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
1003 $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
1006 $! They Entered An Invalid Option..
1008 $ WRITE SYS$OUTPUT ""
1009 $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
1010 $ WRITE SYS$OUTPUT ""
1011 $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
1012 $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
1013 $ WRITE SYS$OUTPUT ""
1019 $! End The Valid Arguement Check.
1023 $! End The P3 Check.
1027 $! Special Threads For OpenVMS v7.1 Or Later
1029 $! Written By: Richard Levitte
1030 $! richard@levitte.org
1033 $! Check To See If We Have A Option For P6.
1038 $! Get The Version Of VMS We Are Using.
1041 $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
1042 $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
1044 $! Check To See If The VMS Version Is v7.1 Or Later.
1049 $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
1051 $ ISSEVEN := ,PTHREAD_USE_D4
1053 $! End The VMS Version Check.
1057 $! End The P6 Check.
1061 $! Check To See If P4 Is Blank.
1066 $! O.K., The User Didn't Specify A Compiler, Let's Try To
1067 $! Find Out Which One To Use.
1069 $! Check To See If We Have GNU C.
1071 $ IF (F$TRNLNM("GNU_CC").NES."")
1074 $! Looks Like GNUC, Set To Use GNUC.
1082 $! Check To See If We Have VAXC Or DECC.
1084 $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
1087 $! Looks Like DECC, Set To Use DECC.
1095 $! Looks Like VAXC, Set To Use VAXC.
1099 $! End The VAXC Compiler Check.
1103 $! End The DECC & VAXC Compiler Check.
1107 $! End The Compiler Check.
1111 $! Check To See If We Have A Option For P5.
1116 $! Find out what socket library we have available
1118 $ IF F$PARSE("SOCKETSHR:") .NES. ""
1121 $! We have SOCKETSHR, and it is my opinion that it's the best to use.
1127 $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
1129 $! Else, let's look for something else
1133 $! Like UCX (the reason to do this before Multinet is that the UCX
1134 $! emulation is easier to use...)
1136 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
1137 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
1138 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
1141 $! Last resort: a UCX or UCX-compatible library
1147 $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
1155 $! Set Up Initial CC Definitions, Possibly With User Ones
1157 $ CCDEFS = "TCPIP_TYPE_''P5',DSO_VMS"
1158 $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
1160 $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
1161 $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX"
1162 $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
1163 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
1165 $! Check To See If The User Entered A Valid Paramter.
1167 $ IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC")
1170 $! Check To See If The User Wanted DECC.
1172 $ IF (P4.EQS."DECC")
1175 $! Looks Like DECC, Set To Use DECC.
1179 $! Tell The User We Are Using DECC.
1181 $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
1186 $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
1188 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
1189 "/NOLIST/PREFIX=ALL" + -
1190 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1193 $! Define The Linker Options File Name.
1195 $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
1201 $! Check To See If We Are To Use VAXC.
1203 $ IF (P4.EQS."VAXC")
1206 $! Looks Like VAXC, Set To Use VAXC.
1210 $! Tell The User We Are Using VAX C.
1212 $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
1214 $! Compile Using VAXC.
1219 $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
1222 $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
1223 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1224 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1226 $ CCDEFS = """VAXC""," + CCDEFS
1228 $! Define <sys> As SYS$COMMON:[SYSLIB]
1230 $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
1232 $! Define The Linker Options File Name.
1234 $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
1240 $! Check To See If We Are To Use GNU C.
1242 $ IF (P4.EQS."GNUC")
1245 $! Looks Like GNUC, Set To Use GNUC.
1249 $! Tell The User We Are Using GNUC.
1251 $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
1255 $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1256 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1259 $! Define The Linker Options File Name.
1261 $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
1263 $! End The GNU C Check.
1267 $! Set up default defines
1269 $ CCDEFS = """FLAT_INC=1""," + CCDEFS
1271 $! Check To See If We Are To Compile With RSAREF Routines.
1273 $ IF (RSAREF.EQS."TRUE")
1276 $! Compile With RSAREF.
1278 $ CCDEFS = CCDEFS + ",""RSAref=1"""
1280 $! Tell The User This.
1282 $ WRITE SYS$OUTPUT "Compiling With RSAREF Routines."
1284 $! Else, We Don't Care. Compile Without The RSAREF Library.
1288 $! Tell The User We Are Compile Without The RSAREF Routines.
1290 $ WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines.
1292 $! End The RSAREF Check.
1296 $! Finish up the definition of CC.
1298 $ IF COMPILER .EQS. "DECC"
1300 $ IF CCDISABLEWARNINGS .EQS. ""
1302 $ CC4DISABLEWARNINGS = "DOLLARID"
1304 $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1305 $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1307 $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1309 $ CCDISABLEWARNINGS = ""
1310 $ CC4DISABLEWARNINGS = ""
1312 $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1313 $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1314 $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P3 .NES. "DEBUG"
1316 $ CC5 = CC + "/OPTIMIZE=NODISJOINT"
1318 $ CC5 = CC + "/NOOPTIMIZE"
1320 $ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1322 $! Show user the result
1324 $ WRITE SYS$OUTPUT "Main C Compiling Command: ",CC
1326 $! Else The User Entered An Invalid Arguement.
1330 $! Tell The User We Don't Know What They Want.
1332 $ WRITE SYS$OUTPUT ""
1333 $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
1334 $ WRITE SYS$OUTPUT ""
1335 $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
1336 $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
1337 $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
1338 $ WRITE SYS$OUTPUT ""
1344 $! End The Valid Arguement Check.
1348 $! Build a MACRO command for the architecture at hand
1350 $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
1351 $ IF ARCH .EQS. "AXP" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
1353 $! Show user the result
1355 $ WRITE SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
1357 $! Time to check the contents, and to make sure we get the correct library.
1359 $ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX"
1362 $! Check to see if SOCKETSHR was chosen
1364 $ IF P5.EQS."SOCKETSHR"
1367 $! Set the library to use SOCKETSHR
1369 $ TCPIP_LIB = "[-.VMS]SOCKETSHR_SHR.OPT/OPT"
1371 $! Done with SOCKETSHR
1375 $! Check to see if MULTINET was chosen
1377 $ IF P5.EQS."MULTINET"
1380 $! Set the library to use UCX emulation.
1384 $! Done with MULTINET
1388 $! Check to see if UCX was chosen
1393 $! Set the library to use UCX.
1395 $ TCPIP_LIB = "[-.VMS]UCX_SHR_DECC.OPT/OPT"
1396 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
1398 $ TCPIP_LIB = "[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
1400 $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1401 TCPIP_LIB = "[-.VMS]UCX_SHR_VAXC.OPT/OPT"
1410 $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
1412 $! Else The User Entered An Invalid Arguement.
1416 $! Tell The User We Don't Know What They Want.
1418 $ WRITE SYS$OUTPUT ""
1419 $ WRITE SYS$OUTPUT "The Option ",P5," Is Invalid. The Valid Options Are:"
1420 $ WRITE SYS$OUTPUT ""
1421 $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1422 $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1423 $ WRITE SYS$OUTPUT ""
1429 $! Done with TCP/IP libraries
1433 $! Check if the user wanted to compile just a subset of all the encryption
1438 $ ENCRYPT_TYPES = P7
1439 $! NYI: ENCRYPT_PROGRAMS = P7
1442 $! Time To RETURN...
1448 $! Save old value of the logical name OPENSSL
1450 $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1452 $! Save directory information
1454 $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1455 $ __TOP = __HERE - "CRYPTO]"
1456 $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1458 $! Set up the logical name OPENSSL to point at the include directory
1460 $ DEFINE OPENSSL/NOLOG '__INCLUDE'
1468 $! Restore the logical name OPENSSL if it had a value
1470 $ IF __SAVE_OPENSSL .EQS. ""
1474 $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'