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 $! TCPIP for TCPIP (post UCX)
53 $! SOCKETSHR for SOCKETSHR+NETLIB
55 $! P6, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
57 $! P7, if defined, sets a choice of crypto methods to compile.
58 $! WARNING: this should only be done to recompile some part of an already
59 $! fully compiled library.
62 $! Define A TCP/IP Library That We Will Need To Link To.
63 $! (That Is, If We Need To Link To One.)
67 $! Check Which Architecture We Are Using.
69 $ IF (F$GETSYI("CPU").GE.128)
72 $! The Architecture Is AXP
80 $! The Architecture Is VAX.
84 $! End The Architecture Check.
88 $! Define The Different Encryption Types.
90 $ ENCRYPT_TYPES = "Basic,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
91 "DES,RC2,RC4,RC5,IDEA,BF,CAST,"+ -
92 "BN,EC,RSA,DSA,DH,DSO,ENGINE,AES,"+ -
93 "BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,"+ -
94 "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
95 "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5"
96 $ ENCRYPT_PROGRAMS = "DES,PKCS7"
98 $! Check To Make Sure We Have Valid Command Line Parameters.
100 $ GOSUB CHECK_OPTIONS
102 $! Initialise logical names and such
106 $! Tell The User What Kind of Machine We Run On.
108 $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
110 $! Define The OBJ Directory.
112 $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.CRYPTO]
114 $! Check To See If The Architecture Specific OBJ Directory Exists.
116 $ IF (F$PARSE(OBJ_DIR).EQS."")
119 $! It Dosen't Exist, So Create It.
121 $ CREATE/DIR 'OBJ_DIR'
123 $! End The Architecture Specific OBJ Directory Check.
127 $! Define The EXE Directory.
129 $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]
131 $! Check To See If The Architecture Specific Directory Exists.
133 $ IF (F$PARSE(EXE_DIR).EQS."")
136 $! It Dosen't Exist, So Create It.
138 $ CREATE/DIRECTORY 'EXE_DIR'
140 $! End The Architecture Specific Directory Check.
144 $! Define The Library Name.
146 $ LIB_NAME := 'EXE_DIR'LIBCRYPTO.OLB
148 $! Define The CRYPTO-LIB We Are To Use.
150 $ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB
152 $! Define The RSAREF-LIB We Are To Use.
154 $ RSAREF_LIB := SYS$DISK:[-.'ARCH'.EXE.RSAREF]LIBRSAGLUE.OLB
156 $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library...
158 $ IF (F$SEARCH(LIB_NAME).EQS."")
161 $! Guess Not, Create The Library.
163 $ LIBRARY/CREATE/OBJECT 'LIB_NAME'
165 $! End The Library Check.
169 $! Build our options file for the application
171 $ GOSUB CHECK_OPT_FILE
173 $! Define The Different Encryption "library" Strings.
175 $ APPS_DES = "DES/DES,CBC3_ENC"
176 $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
178 $ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
179 $ LIB_MD2 = "md2_dgst,md2_one"
180 $ LIB_MD4 = "md4_dgst,md4_one"
181 $ LIB_MD5 = "md5_dgst,md5_one"
182 $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one"
183 $ LIB_MDC2 = "mdc2dgst,mdc2_one"
185 $ LIB_RIPEMD = "rmd_dgst,rmd_one"
186 $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
187 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
188 "enc_read,enc_writ,ofb64enc,"+ -
189 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
190 "des_enc,fcrypt_b,"+ -
191 "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,"+ -
192 "ede_cbcm_enc,des_old,des_old2,read2pwd"
193 $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64"
194 $ LIB_RC4 = "rc4_skey,rc4_enc"
195 $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64"
196 $ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey"
197 $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
198 $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
199 $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
200 $ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
201 $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
202 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
203 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ -
204 "bn_recp,bn_mont,bn_mpi,bn_exp2"
205 $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
206 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ -
208 $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_recp,ecp_nist,ec_cvt,ec_mult,"+ -
210 $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl"
211 $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err"
212 $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ -
213 "dso_openssl,dso_win32,dso_vms"
214 $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ -
215 "eng_table,eng_pkey,eng_fat,eng_all,"+ -
216 "tb_rsa,tb_dsa,tb_dh,tb_rand,tb_cipher,tb_digest,"+ -
217 "eng_openssl,eng_dyn,eng_cnf,"+ -
218 "hw_atalla,hw_cswift,hw_ncipher,hw_nuron,hw_ubsec,"+ -
219 "hw_openbsd_dev_crypto,hw_aep,hw_sureware,hw_4758_cca"
220 $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr"
221 $ LIB_BUFFER = "buffer,buf_err"
222 $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
223 "bss_mem,bss_null,bss_fd,"+ -
224 "bss_file,bss_sock,bss_conn,"+ -
225 "bf_null,bf_buff,b_print,b_dump,"+ -
226 "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ -
228 $ LIB_STACK = "stack"
229 $ LIB_LHASH = "lhash,lh_stats"
230 $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
232 $ LIB_ERR = "err,err_all,err_prn"
233 $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
234 $ LIB_EVP = "encode,digest,evp_enc,evp_key,"+ -
235 "e_des,e_bf,e_idea,e_des3,"+ -
236 "e_rc4,e_aes,names,"+ -
237 "e_xcbc_d,e_rc2,e_cast,e_rc5"
238 $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + -
239 "m_dss,m_dss1,m_mdc2,m_ripemd,"+ -
240 "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ -
241 "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ -
242 "c_all,c_allc,c_alld,evp_lib,bio_ok,"+-
243 "evp_pkey,evp_pbe,p5_crpt,p5_crpt2"
244 $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ -
245 "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ -
246 "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ -
247 "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ -
248 "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ -
249 "d2i_pu,d2i_pr,i2d_pu,i2d_pr"
250 $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ -
251 "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ -
252 "f_int,f_string,n_pkey,"+ -
253 "f_enum,a_hdr,x_pkey,a_bool,x_exten,"+ -
254 "asn1_par,asn1_lib,asn1_err,a_meth,a_bytes,a_strnid,"+ -
255 "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid"
256 $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ -
257 "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey"
258 $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ -
259 "x509_obj,x509_req,x509spki,x509_vfy,"+ -
260 "x509_set,x509cset,x509rset,x509_err,"+ -
261 "x509name,x509_v3,x509_ext,x509_att,"+ -
262 "x509type,x509_lu,x_all,x509_txt,"+ -
263 "x509_trs,by_file,by_dir"
264 $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
265 "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ -
266 "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ -
268 $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap"
269 $ LIB_TXT_DB = "txt_db"
270 $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ -
272 $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ -
273 "p12_init,p12_key,p12_kiss,p12_mutl,"+ -
274 "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e"
275 $ LIB_COMP = "comp_lib,comp_err,"+ -
277 $ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ -
278 "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err"
279 $ LIB_UI_COMPAT = ",ui_compat"
280 $ LIB_UI = "ui_err,ui_lib,ui_openssl,ui_util"+LIB_UI_COMPAT
281 $ LIB_KRB5 = "krb5_asn"
283 $! Setup exceptional compilations
285 $ COMPILEWITH_CC3 = ",bss_rtcp,"
286 $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,"
287 $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + -
288 "sha_dgst,sha1dgst,rmd_dgst,bf_enc,"
290 $! Check To See If We Are Going To Use RSAREF.
292 $ IF (RSAREF.EQS."TRUE" .AND. ENCRYPT_TYPES - "RSA".NES.ENCRYPT_TYPES -
293 .AND. (BUILDALL .EQS. "TRUE" .OR. BUILDALL .EQS. "LIBRARY"))
296 $! Check To See If The File [-.RSAREF]RSAREF.C Is Actually There.
298 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAREF.C").EQS."")
301 $! Tell The User That The File Doesn't Exist.
303 $ WRITE SYS$OUTPUT ""
304 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAREF.C Doesn't Exist."
305 $ WRITE SYS$OUTPUT ""
311 $! End The [-.RSAREF]RSAREF.C Check.
315 $! Tell The User We Are Compiling The [-.RSAREF]RSAREF File.
317 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAREF File."
319 $! Compile [-.RSAREF]RSAREF.C
321 $ CC/OBJECT='OBJ_DIR'RSAREF.OBJ SYS$DISK:[-.RSAREF]RSAREF.C
323 $! Add It To The Library.
325 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAREF.OBJ
327 $! Delete The Object File.
329 $ DELETE 'OBJ_DIR'RSAREF.OBJ;*
331 $! Check To See If The File [-.RSAREF]RSAR_ERR.C Is Actually There.
333 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAR_ERR.C").EQS."")
336 $! Tell The User That The File Doesn't Exist.
338 $ WRITE SYS$OUTPUT ""
339 $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAR_ERR.C Doesn't Exist."
340 $ WRITE SYS$OUTPUT ""
346 $! End The [-.RSAREF]RSAR_ERR.C File Check.
350 $! Tell The User We Are Compiling The [-.RSAREF]RSAR_ERR File.
352 $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAR_ERR File."
354 $! Compile [-.RSAREF]RSAR_ERR.C
356 $ CC/OBJECT='OBJ_DIR'RSAR_ERR.OBJ SYS$DISK:[-.RSAREF]RSAR_ERR.C
358 $! Add It To The Library.
360 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAR_ERR.OBJ
362 $! Delete The Object File.
364 $ DELETE 'OBJ_DIR'RSAR_ERR.OBJ;*
366 $! End The RSAREF Check.
370 $! Figure Out What Other Modules We Are To Build.
374 $! Define A Module Counter.
382 $! Extract The Module Name From The Encryption List.
384 $ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES)
385 $ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = ""
386 $ MODULE_NAME1 = MODULE_NAME
388 $! Check To See If We Are At The End Of The Module List.
390 $ IF (MODULE_NAME.EQS.",")
393 $! We Are At The End Of The Module List, Go To MODULE_DONE.
397 $! End The Module List Check.
401 $! Increment The Moudle Counter.
403 $ MODULE_COUNTER = MODULE_COUNTER + 1
405 $! Create The Library and Apps Module Names.
407 $ LIB_MODULE = "LIB_" + MODULE_NAME
408 $ APPS_MODULE = "APPS_" + MODULE_NAME
409 $ IF (MODULE_NAME.EQS."ASN1_2")
411 $ MODULE_NAME = "ASN1"
413 $ IF (MODULE_NAME.EQS."EVP_2")
415 $ MODULE_NAME = "EVP"
418 $! Set state (can be LIB and APPS)
421 $ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS"
423 $! Check if the library module name actually is defined
425 $ IF F$TYPE('LIB_MODULE') .EQS. ""
428 $ WRITE SYS$ERROR "The module ",MODULE_NAME," does not exist. Continuing..."
433 $! Top Of The Module Loop.
437 $! Tell The User What Module We Are Building.
439 $ IF (MODULE_NAME1.NES."")
441 $ IF STATE .EQS. "LIB"
443 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")"
444 $ ELSE IF F$TYPE('APPS_MODULE') .NES. ""
446 $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")"
451 $! Define A File Counter And Set It To "0".
455 $ APPLICATION_COUNTER = 0
457 $! Top Of The File Loop.
461 $! Look in the LIB_MODULE is we're in state LIB
463 $ IF STATE .EQS. "LIB"
466 $! O.K, Extract The File Name From The File List.
468 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE')
475 $ IF F$TYPE('APPS_MODULE') .NES. ""
478 $! Extract The File Name From The File List.
479 $! This part is a bit more complicated.
481 $ IF APPLICATION .EQS. ""
483 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
484 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
485 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
486 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
490 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
491 $! SHOW SYMBOL APPLICATION*
493 $ IF APPLICATION .NES. ";"
495 $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS)
496 $ IF FILE_NAME .EQS. ","
505 $! Check To See If We Are At The End Of The File List.
507 $ IF (FILE_NAME.EQS.",")
510 $! We Are At The End Of The File List, Change State Or Goto FILE_DONE.
512 $ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY"
520 $! End The File List Check.
524 $! Increment The Counter.
526 $ FILE_COUNTER = FILE_COUNTER + 1
528 $! Create The Source File Name.
530 $ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME)
531 $ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME
532 $ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN -
533 FILE_NAME = FILE_NAME + ".c"
534 $ IF (MODULE_NAME.NES."")
536 $ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME
538 $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME
540 $ SOURCE_FILE = SOURCE_FILE - "]["
542 $! Create The Object File Name.
544 $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
545 $ ON WARNING THEN GOTO NEXT_FILE
547 $! Check To See If The File We Want To Compile Is Actually There.
549 $ IF (F$SEARCH(SOURCE_FILE).EQS."")
552 $! Tell The User That The File Doesn't Exist.
554 $ WRITE SYS$OUTPUT ""
555 $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist."
556 $ WRITE SYS$OUTPUT ""
562 $! End The File Exist Check.
566 $! Tell The User We Are Compiling The File.
568 $ IF (MODULE_NAME.EQS."")
570 $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")"
572 $ IF (MODULE_NAME.NES."")
574 $ WRITE SYS$OUTPUT " ",FILE_NAME,""
579 $ ON ERROR THEN GOTO NEXT_FILE
580 $ FILE_NAME0 = F$ELEMENT(0,".",FILE_NAME)
581 $ IF FILE_NAME - ".mar" .NES. FILE_NAME
583 $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
585 $ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3
587 $ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
589 $ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4
591 $ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
593 $ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5
595 $ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
597 $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
602 $ IF STATE .EQS. "LIB"
605 $! Add It To The Library.
607 $ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE'
609 $! Time To Clean Up The Object File.
611 $ DELETE 'OBJECT_FILE';*
614 $! Go Back And Do It Again.
618 $! All Done With This Library Part.
622 $! Time To Build Some Applications
624 $ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY"
626 $ APPLICATION_COUNTER = 0
628 $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
629 $ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE
631 $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
632 $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
633 $ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
635 $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
636 $! SHOW SYMBOL APPLICATION*
638 $! Tell the user what happens
640 $ WRITE SYS$OUTPUT " ",APPLICATION,".exe"
642 $! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
644 $ ON ERROR THEN GOTO NEXT_APPLICATION
645 $ IF (RSAREF.EQS."TRUE")
648 $! Check To See If We Are To Link With A Specific TCP/IP Library.
650 $ IF (TCPIP_LIB.NES."")
653 $! Link With The RSAREF Library And A Specific TCP/IP Library.
655 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
656 'OBJ_DIR''APPLICATION_OBJECTS', -
657 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
658 'TCPIP_LIB','OPT_FILE'/OPTION
664 $! Link With The RSAREF Library And NO TCP/IP Library.
666 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
667 'OBJ_DIR''APPLICATION_OBJECTS', -
668 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
671 $! End The TCP/IP Library Check.
679 $! Don't Link With The RSAREF Routines.
682 $! Check To See If We Are To Link With A Specific TCP/IP Library.
684 $ IF (TCPIP_LIB.NES."")
687 $! Don't Link With The RSAREF Routines And TCP/IP Library.
689 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
690 'OBJ_DIR''APPLICATION_OBJECTS', -
691 'CRYPTO_LIB'/LIBRARY, -
692 'TCPIP_LIB','OPT_FILE'/OPTION
698 $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
700 $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
701 'OBJ_DIR''APPLICATION_OBJECTS',-
702 'CRYPTO_LIB'/LIBRARY, -
705 $! End The TCP/IP Library Check.
709 $! End The RSAREF Link Check.
712 $ GOTO NEXT_APPLICATION
716 $! Go Back And Get The Next Module.
720 $! All Done With This Module.
724 $! Tell The User That We Are All Done.
726 $ WRITE SYS$OUTPUT "All Done..."
731 $! Check For The Link Option FIle.
735 $! Check To See If We Need To Make A VAX C Option File.
737 $ IF (COMPILER.EQS."VAXC")
740 $! Check To See If We Already Have A VAX C Linker Option File.
742 $ IF (F$SEARCH(OPT_FILE).EQS."")
745 $! We Need A VAX C Linker Option File.
750 ! Default System Options File To Link Agianst
751 ! The Sharable VAX C Runtime Library.
753 SYS$SHARE:VAXCRTL.EXE/SHARE
756 $! End The Option File Check.
760 $! End The VAXC Check.
764 $! Check To See If We Need A GNU C Option File.
766 $ IF (COMPILER.EQS."GNUC")
769 $! Check To See If We Already Have A GNU C Linker Option File.
771 $ IF (F$SEARCH(OPT_FILE).EQS."")
774 $! We Need A GNU C Linker Option File.
779 ! Default System Options File To Link Agianst
780 ! The Sharable C Runtime Library.
782 GNU_CC:[000000]GCCLIB/LIBRARY
783 SYS$SHARE:VAXCRTL/SHARE
786 $! End The Option File Check.
790 $! End The GNU C Check.
794 $! Check To See If We Need A DEC C Option File.
796 $ IF (COMPILER.EQS."DECC")
799 $! Check To See If We Already Have A DEC C Linker Option File.
801 $ IF (F$SEARCH(OPT_FILE).EQS."")
804 $! Figure Out If We Need An AXP Or A VAX Linker Option File.
806 $ IF ARCH .EQS. "VAX"
809 $! We Need A DEC C Linker Option File For VAX.
814 ! Default System Options File To Link Agianst
815 ! The Sharable DEC C Runtime Library.
817 SYS$SHARE:DECC$SHR.EXE/SHARE
824 $! Create The AXP Linker Option File.
829 ! Default System Options File For AXP To Link Agianst
830 ! The Sharable C Runtime Library.
832 SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
833 SYS$SHARE:CMA$OPEN_RTL/SHARE
836 $! End The VAX/AXP DEC C Option File Check.
840 $! End The Option File Search.
844 $! End The DEC C Check.
848 $! Tell The User What Linker Option File We Are Using.
850 $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
856 $! Check The User's Options.
860 $! Check To See If P1 Is Blank.
865 $! P1 Is Blank, So Build Everything.
873 $! Else, Check To See If P1 Has A Valid Arguement.
875 $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS")
878 $! A Valid Arguement.
886 $! Tell The User We Don't Know What They Want.
888 $ WRITE SYS$OUTPUT ""
889 $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
890 $ WRITE SYS$OUTPUT ""
891 $ WRITE SYS$OUTPUT " ALL : Just Build Everything."
892 $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library."
893 $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.SSL]*.EXE Programs."
894 $ WRITE SYS$OUTPUT ""
895 $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
896 $ WRITE SYS$OUTPUT ""
897 $ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
898 $ WRITE SYS$OUTPUT " VAX : VAX Architecture."
899 $ WRITE SYS$OUTPUT ""
905 $! End The Valid Arguement Check.
913 $! Check To See If P2 Is Blank.
916 $ IF (P2.EQS."NORSAREF")
919 $! P2 Is NORSAREF, So Compile With The Regular RSA Libraries.
924 $! Check To See If We Are To Use The RSAREF Library.
926 $ IF (P2.EQS."RSAREF")
929 $! Check To Make Sure We Have The RSAREF Source Code Directory.
931 $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."")
934 $! We Don't Have The RSAREF Souce Code Directory, So Tell The
937 $ WRITE SYS$OUTPUT ""
938 $ WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code."
939 $ WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'. You have to"
940 $ WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file doesn't have the"
941 $ WRITE SYS$OUTPUT "directory structure stored. You have to extract the file"
942 $ WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory"
943 $ WRITE SYS$OUTPUT "as that is where the scripts will look for the files."
944 $ WRITE SYS$OUTPUT ""
950 $! Else, Compile Using The RSAREF Library.
957 $! They Entered An Invalid Option..
959 $ WRITE SYS$OUTPUT ""
960 $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
961 $ WRITE SYS$OUTPUT ""
962 $ WRITE SYS$OUTPUT " RSAREF : Compile With The RSAREF Library."
963 $ WRITE SYS$OUTPUT " NORSAREF : Compile With The Regular RSA Library."
964 $ WRITE SYS$OUTPUT ""
970 $! End The Valid Arguement Check.
978 $! Check To See If P3 Is Blank.
980 $ IF (P3.EQS."NODEBUG")
983 $! P3 Is NODEBUG, So Compile Without The Debugger Information.
985 $ DEBUGGER = "NODEBUG"
986 $ TRACEBACK = "NOTRACEBACK"
987 $ GCC_OPTIMIZE = "OPTIMIZE"
988 $ CC_OPTIMIZE = "OPTIMIZE"
989 $ MACRO_OPTIMIZE = "OPTIMIZE"
990 $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
991 $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
994 $! Check To See If We Are To Compile With Debugger Information.
996 $ IF (P3.EQS."DEBUG")
999 $! Compile With Debugger Information.
1001 $ DEBUGGER = "DEBUG"
1002 $ TRACEBACK = "TRACEBACK"
1003 $ GCC_OPTIMIZE = "NOOPTIMIZE"
1004 $ CC_OPTIMIZE = "NOOPTIMIZE"
1005 $ MACRO_OPTIMIZE = "NOOPTIMIZE"
1006 $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
1007 $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
1010 $! They Entered An Invalid Option..
1012 $ WRITE SYS$OUTPUT ""
1013 $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
1014 $ WRITE SYS$OUTPUT ""
1015 $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
1016 $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
1017 $ WRITE SYS$OUTPUT ""
1023 $! End The Valid Arguement Check.
1027 $! End The P3 Check.
1031 $! Special Threads For OpenVMS v7.1 Or Later
1033 $! Written By: Richard Levitte
1034 $! richard@levitte.org
1037 $! Check To See If We Have A Option For P6.
1042 $! Get The Version Of VMS We Are Using.
1045 $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
1046 $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
1048 $! Check To See If The VMS Version Is v7.1 Or Later.
1053 $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
1055 $ ISSEVEN := ,PTHREAD_USE_D4
1057 $! End The VMS Version Check.
1061 $! End The P6 Check.
1065 $! Check To See If P4 Is Blank.
1070 $! O.K., The User Didn't Specify A Compiler, Let's Try To
1071 $! Find Out Which One To Use.
1073 $! Check To See If We Have GNU C.
1075 $ IF (F$TRNLNM("GNU_CC").NES."")
1078 $! Looks Like GNUC, Set To Use GNUC.
1086 $! Check To See If We Have VAXC Or DECC.
1088 $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
1091 $! Looks Like DECC, Set To Use DECC.
1099 $! Looks Like VAXC, Set To Use VAXC.
1103 $! End The VAXC Compiler Check.
1107 $! End The DECC & VAXC Compiler Check.
1111 $! End The Compiler Check.
1115 $! Check To See If We Have A Option For P5.
1120 $! Find out what socket library we have available
1122 $ IF F$PARSE("SOCKETSHR:") .NES. ""
1125 $! We have SOCKETSHR, and it is my opinion that it's the best to use.
1131 $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
1133 $! Else, let's look for something else
1137 $! Like UCX (the reason to do this before Multinet is that the UCX
1138 $! emulation is easier to use...)
1140 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
1141 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
1142 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
1145 $! Last resort: a UCX or UCX-compatible library
1151 $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
1159 $! Set Up Initial CC Definitions, Possibly With User Ones
1161 $ CCDEFS = "TCPIP_TYPE_''P5',DSO_VMS"
1162 $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
1164 $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
1165 $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX"
1166 $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
1167 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
1169 $! Check To See If The User Entered A Valid Paramter.
1171 $ IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC")
1174 $! Check To See If The User Wanted DECC.
1176 $ IF (P4.EQS."DECC")
1179 $! Looks Like DECC, Set To Use DECC.
1183 $! Tell The User We Are Using DECC.
1185 $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
1190 $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
1192 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
1193 "/NOLIST/PREFIX=ALL" + -
1194 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP])" + -
1197 $! Define The Linker Options File Name.
1199 $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
1205 $! Check To See If We Are To Use VAXC.
1207 $ IF (P4.EQS."VAXC")
1210 $! Looks Like VAXC, Set To Use VAXC.
1214 $! Tell The User We Are Using VAX C.
1216 $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
1218 $! Compile Using VAXC.
1223 $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
1226 $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
1227 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1228 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1230 $ CCDEFS = """VAXC""," + CCDEFS
1232 $! Define <sys> As SYS$COMMON:[SYSLIB]
1234 $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
1236 $! Define The Linker Options File Name.
1238 $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
1244 $! Check To See If We Are To Use GNU C.
1246 $ IF (P4.EQS."GNUC")
1249 $! Looks Like GNUC, Set To Use GNUC.
1253 $! Tell The User We Are Using GNUC.
1255 $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
1259 $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1260 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1263 $! Define The Linker Options File Name.
1265 $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
1267 $! End The GNU C Check.
1271 $! Set up default defines
1273 $ CCDEFS = """FLAT_INC=1""," + CCDEFS
1275 $! Check To See If We Are To Compile With RSAREF Routines.
1277 $ IF (RSAREF.EQS."TRUE")
1280 $! Compile With RSAREF.
1282 $ CCDEFS = CCDEFS + ",""RSAref=1"""
1284 $! Tell The User This.
1286 $ WRITE SYS$OUTPUT "Compiling With RSAREF Routines."
1288 $! Else, We Don't Care. Compile Without The RSAREF Library.
1292 $! Tell The User We Are Compile Without The RSAREF Routines.
1294 $ WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines.
1296 $! End The RSAREF Check.
1300 $! Finish up the definition of CC.
1302 $ IF COMPILER .EQS. "DECC"
1304 $ IF CCDISABLEWARNINGS .EQS. ""
1306 $ CC4DISABLEWARNINGS = "DOLLARID"
1308 $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1309 $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1311 $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1313 $ CCDISABLEWARNINGS = ""
1314 $ CC4DISABLEWARNINGS = ""
1316 $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1317 $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1318 $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P3 .NES. "DEBUG"
1320 $ CC5 = CC + "/OPTIMIZE=NODISJOINT"
1322 $ CC5 = CC + "/NOOPTIMIZE"
1324 $ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1326 $! Show user the result
1328 $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC
1330 $! Else The User Entered An Invalid Arguement.
1334 $! Tell The User We Don't Know What They Want.
1336 $ WRITE SYS$OUTPUT ""
1337 $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
1338 $ WRITE SYS$OUTPUT ""
1339 $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
1340 $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
1341 $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
1342 $ WRITE SYS$OUTPUT ""
1348 $! End The Valid Arguement Check.
1352 $! Build a MACRO command for the architecture at hand
1354 $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
1355 $ IF ARCH .EQS. "AXP" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
1357 $! Show user the result
1359 $ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
1361 $! Time to check the contents, and to make sure we get the correct library.
1363 $ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX" -
1364 .OR. P5.EQS."TCPIP" .OR. P5.EQS."NONE"
1367 $! Check to see if SOCKETSHR was chosen
1369 $ IF P5.EQS."SOCKETSHR"
1372 $! Set the library to use SOCKETSHR
1374 $ TCPIP_LIB = "SYS$DISK:[-.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 = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT"
1401 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
1403 $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
1405 $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1406 TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT"
1413 $! Check to see if TCPIP was chosen
1418 $! Set the library to use TCPIP (post UCX).
1420 $ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT"
1426 $! Check to see if NONE was chosen
1431 $! Do not use a TCPIP library.
1441 $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
1443 $! Else The User Entered An Invalid Arguement.
1447 $! Tell The User We Don't Know What They Want.
1449 $ WRITE SYS$OUTPUT ""
1450 $ WRITE SYS$OUTPUT "The Option ",P5," Is Invalid. The Valid Options Are:"
1451 $ WRITE SYS$OUTPUT ""
1452 $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1453 $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1454 $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
1455 $ WRITE SYS$OUTPUT ""
1461 $! Done with TCP/IP libraries
1465 $! Check if the user wanted to compile just a subset of all the encryption
1470 $ ENCRYPT_TYPES = P7
1471 $! NYI: ENCRYPT_PROGRAMS = P7
1474 $! Time To RETURN...
1480 $! Save old value of the logical name OPENSSL
1482 $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1484 $! Save directory information
1486 $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1487 $ __HERE = F$EDIT(__HERE,"UPCASE")
1488 $ __TOP = __HERE - "CRYPTO]"
1489 $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1491 $! Set up the logical name OPENSSL to point at the include directory
1493 $ DEFINE OPENSSL/NOLOG '__INCLUDE'
1501 $! Restore the logical name OPENSSL if it had a value
1503 $ IF __SAVE_OPENSSL .EQS. ""
1507 $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'