xref: /minix3/crypto/external/bsd/openssl/dist/VMS/mkshared.com (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc$! MKSHARED.COM -- Create shareable images.
2*ebfedea0SLionel Sambuc$!
3*ebfedea0SLionel Sambuc$! P1: "64" for 64-bit pointers.
4*ebfedea0SLionel Sambuc$!
5*ebfedea0SLionel Sambuc$! P2: Zlib object library path (optional).
6*ebfedea0SLionel Sambuc$!
7*ebfedea0SLionel Sambuc$! Input:	[.UTIL]LIBEAY.NUM,[.xxx.EXE.CRYPTO]SSL_LIBCRYPTO[32].OLB
8*ebfedea0SLionel Sambuc$!		[.UTIL]SSLEAY.NUM,[.xxx.EXE.SSL]SSL_LIBSSL[32].OLB
9*ebfedea0SLionel Sambuc$!		[.CRYPTO.xxx]OPENSSLCONF.H
10*ebfedea0SLionel Sambuc$! Output:	[.xxx.EXE.CRYPTO]SSL_LIBCRYPTO_SHR[32].OPT,.MAP,.EXE
11*ebfedea0SLionel Sambuc$!		[.xxx.EXE.SSL]SSL_LIBSSL_SRH[32].OPT,.MAP,.EXE
12*ebfedea0SLionel Sambuc$!
13*ebfedea0SLionel Sambuc$! So far, tests have only been made on VMS for Alpha.  VAX will come in time.
14*ebfedea0SLionel Sambuc$! ===========================================================================
15*ebfedea0SLionel Sambuc$!
16*ebfedea0SLionel Sambuc$! Announce/identify.
17*ebfedea0SLionel Sambuc$!
18*ebfedea0SLionel Sambuc$ proc = f$environment( "procedure")
19*ebfedea0SLionel Sambuc$ write sys$output "@@@ "+ -
20*ebfedea0SLionel Sambuc   f$parse( proc, , , "name")+ f$parse( proc, , , "type")
21*ebfedea0SLionel Sambuc$!
22*ebfedea0SLionel Sambuc$! Save the original default device:[directory].
23*ebfedea0SLionel Sambuc$!
24*ebfedea0SLionel Sambuc$ def_orig = f$environment( "default")
25*ebfedea0SLionel Sambuc$ on error then goto tidy
26*ebfedea0SLionel Sambuc$ on control_c then goto tidy
27*ebfedea0SLionel Sambuc$!
28*ebfedea0SLionel Sambuc$! SET DEFAULT to the main kit directory.
29*ebfedea0SLionel Sambuc$!
30*ebfedea0SLionel Sambuc$ proc = f$environment("procedure")
31*ebfedea0SLionel Sambuc$ proc = f$parse( "A.;", proc)- "A.;"
32*ebfedea0SLionel Sambuc$ set default 'proc'
33*ebfedea0SLionel Sambuc$ set default [-]
34*ebfedea0SLionel Sambuc$!
35*ebfedea0SLionel Sambuc$! ----- Prepare info for processing: version number and file info
36*ebfedea0SLionel Sambuc$ gosub read_version_info
37*ebfedea0SLionel Sambuc$ if libver .eqs. ""
38*ebfedea0SLionel Sambuc$ then
39*ebfedea0SLionel Sambuc$   write sys$error "ERROR: Couldn't find any library version info..."
40*ebfedea0SLionel Sambuc$   go to tidy:
41*ebfedea0SLionel Sambuc$ endif
42*ebfedea0SLionel Sambuc$
43*ebfedea0SLionel Sambuc$ if (f$getsyi("cpu") .lt. 128)
44*ebfedea0SLionel Sambuc$ then
45*ebfedea0SLionel Sambuc$   arch_vax = 1
46*ebfedea0SLionel Sambuc$   arch = "VAX"
47*ebfedea0SLionel Sambuc$ else
48*ebfedea0SLionel Sambuc$   arch_vax = 0
49*ebfedea0SLionel Sambuc$   arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
50*ebfedea0SLionel Sambuc$   if (arch .eqs. "") then arch = "UNK"
51*ebfedea0SLionel Sambuc$ endif
52*ebfedea0SLionel Sambuc$!
53*ebfedea0SLionel Sambuc$ archd = arch
54*ebfedea0SLionel Sambuc$ lib32 = "32"
55*ebfedea0SLionel Sambuc$ shr = "SHR32"
56*ebfedea0SLionel Sambuc$!
57*ebfedea0SLionel Sambuc$ if (p1 .nes. "")
58*ebfedea0SLionel Sambuc$ then
59*ebfedea0SLionel Sambuc$   if (p1 .eqs. "64")
60*ebfedea0SLionel Sambuc$   then
61*ebfedea0SLionel Sambuc$     archd = arch+ "_64"
62*ebfedea0SLionel Sambuc$     lib32 = ""
63*ebfedea0SLionel Sambuc$     shr = "SHR"
64*ebfedea0SLionel Sambuc$   else
65*ebfedea0SLionel Sambuc$     if (p1 .nes. "32")
66*ebfedea0SLionel Sambuc$     then
67*ebfedea0SLionel Sambuc$       write sys$output "Second argument invalid."
68*ebfedea0SLionel Sambuc$       write sys$output "It should be "32", "64", or nothing."
69*ebfedea0SLionel Sambuc$       exit
70*ebfedea0SLionel Sambuc$     endif
71*ebfedea0SLionel Sambuc$   endif
72*ebfedea0SLionel Sambuc$ endif
73*ebfedea0SLionel Sambuc$!
74*ebfedea0SLionel Sambuc$! ----- Prepare info for processing: disabled algorithms info
75*ebfedea0SLionel Sambuc$ gosub read_disabled_algorithms_info
76*ebfedea0SLionel Sambuc$!
77*ebfedea0SLionel Sambuc$ ZLIB = p2
78*ebfedea0SLionel Sambuc$ zlib_lib = ""
79*ebfedea0SLionel Sambuc$ if (ZLIB .nes. "")
80*ebfedea0SLionel Sambuc$ then
81*ebfedea0SLionel Sambuc$   file2 = f$parse( ZLIB, "libz.olb", , , "syntax_only")
82*ebfedea0SLionel Sambuc$   if (f$search( file2) .eqs. "")
83*ebfedea0SLionel Sambuc$   then
84*ebfedea0SLionel Sambuc$     write sys$output ""
85*ebfedea0SLionel Sambuc$     write sys$output "The Option ", ZLIB, " Is Invalid."
86*ebfedea0SLionel Sambuc$     write sys$output "    Can't find library: ''file2'"
87*ebfedea0SLionel Sambuc$     write sys$output ""
88*ebfedea0SLionel Sambuc$     goto tidy
89*ebfedea0SLionel Sambuc$   endif
90*ebfedea0SLionel Sambuc$   zlib_lib = ", ''file2' /library"
91*ebfedea0SLionel Sambuc$ endif
92*ebfedea0SLionel Sambuc$!
93*ebfedea0SLionel Sambuc$ if (arch_vax)
94*ebfedea0SLionel Sambuc$ then
95*ebfedea0SLionel Sambuc$   libtit = "CRYPTO_TRANSFER_VECTOR"
96*ebfedea0SLionel Sambuc$   libid  = "Crypto"
97*ebfedea0SLionel Sambuc$   libnum = "[.UTIL]LIBEAY.NUM"
98*ebfedea0SLionel Sambuc$   libdir = "[.''ARCHD'.EXE.CRYPTO]"
99*ebfedea0SLionel Sambuc$   libmar = "''libdir'SSL_LIBCRYPTO_''shr'.MAR"
100*ebfedea0SLionel Sambuc$   libolb = "''libdir'SSL_LIBCRYPTO''lib32'.OLB"
101*ebfedea0SLionel Sambuc$   libopt = "''libdir'SSL_LIBCRYPTO_''shr'.OPT"
102*ebfedea0SLionel Sambuc$   libobj = "''libdir'SSL_LIBCRYPTO_''shr'.OBJ"
103*ebfedea0SLionel Sambuc$   libmap = "''libdir'SSL_LIBCRYPTO_''shr'.MAP"
104*ebfedea0SLionel Sambuc$   libgoal= "''libdir'SSL_LIBCRYPTO_''shr'.EXE"
105*ebfedea0SLionel Sambuc$   libref = ""
106*ebfedea0SLionel Sambuc$   libvec = "LIBCRYPTO"
107*ebfedea0SLionel Sambuc$   if f$search( libolb) .nes. "" then gosub create_vax_shr
108*ebfedea0SLionel Sambuc$   libtit = "SSL_TRANSFER_VECTOR"
109*ebfedea0SLionel Sambuc$   libid  = "SSL"
110*ebfedea0SLionel Sambuc$   libnum = "[.UTIL]SSLEAY.NUM"
111*ebfedea0SLionel Sambuc$   libdir = "[.''ARCHD'.EXE.SSL]"
112*ebfedea0SLionel Sambuc$   libmar = "''libdir'SSL_LIBSSL_''shr'.MAR"
113*ebfedea0SLionel Sambuc$   libolb = "''libdir'SSL_LIBSSL''lib32'.OLB"
114*ebfedea0SLionel Sambuc$   libopt = "''libdir'SSL_LIBSSL_''shr'.OPT"
115*ebfedea0SLionel Sambuc$   libobj = "''libdir'SSL_LIBSSL_''shr'.OBJ"
116*ebfedea0SLionel Sambuc$   libmap = "''libdir'SSL_LIBSSL_''shr'.MAP"
117*ebfedea0SLionel Sambuc$   libgoal= "''libdir'SSL_LIBSSL_''shr'.EXE"
118*ebfedea0SLionel Sambuc$   libref = "[.''ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO_''shr'.EXE"
119*ebfedea0SLionel Sambuc$   libvec = "LIBSSL"
120*ebfedea0SLionel Sambuc$   if f$search( libolb) .nes. "" then gosub create_vax_shr
121*ebfedea0SLionel Sambuc$ else
122*ebfedea0SLionel Sambuc$   libid  = "Crypto"
123*ebfedea0SLionel Sambuc$   libnum = "[.UTIL]LIBEAY.NUM"
124*ebfedea0SLionel Sambuc$   libdir = "[.''ARCHD'.EXE.CRYPTO]"
125*ebfedea0SLionel Sambuc$   libolb = "''libdir'SSL_LIBCRYPTO''lib32'.OLB"
126*ebfedea0SLionel Sambuc$   libopt = "''libdir'SSL_LIBCRYPTO_''shr'.OPT"
127*ebfedea0SLionel Sambuc$   libmap = "''libdir'SSL_LIBCRYPTO_''shr'.MAP"
128*ebfedea0SLionel Sambuc$   libgoal= "''libdir'SSL_LIBCRYPTO_''shr'.EXE"
129*ebfedea0SLionel Sambuc$   libref = ""
130*ebfedea0SLionel Sambuc$   if f$search( libolb) .nes. "" then gosub create_nonvax_shr
131*ebfedea0SLionel Sambuc$   libid  = "SSL"
132*ebfedea0SLionel Sambuc$   libnum = "[.UTIL]SSLEAY.NUM"
133*ebfedea0SLionel Sambuc$   libdir = "[.''ARCHD'.EXE.SSL]"
134*ebfedea0SLionel Sambuc$   libolb = "''libdir'SSL_LIBSSL''lib32'.OLB"
135*ebfedea0SLionel Sambuc$   libopt = "''libdir'SSL_LIBSSL_''shr'.OPT"
136*ebfedea0SLionel Sambuc$   libmap = "''libdir'SSL_LIBSSL_''shr'.MAP"
137*ebfedea0SLionel Sambuc$   libgoal= "''libdir'SSL_LIBSSL_''shr'.EXE"
138*ebfedea0SLionel Sambuc$   libref = "[.''ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO_''shr'.EXE"
139*ebfedea0SLionel Sambuc$   if f$search( libolb) .nes. "" then gosub create_nonvax_shr
140*ebfedea0SLionel Sambuc$ endif
141*ebfedea0SLionel Sambuc$!
142*ebfedea0SLionel Sambuc$ tidy:
143*ebfedea0SLionel Sambuc$!
144*ebfedea0SLionel Sambuc$! Close any open files.
145*ebfedea0SLionel Sambuc$!
146*ebfedea0SLionel Sambuc$ if (f$trnlnm( "libnum", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
147*ebfedea0SLionel Sambuc   close libnum
148*ebfedea0SLionel Sambuc$!
149*ebfedea0SLionel Sambuc$ if (f$trnlnm( "mar", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
150*ebfedea0SLionel Sambuc   close mar
151*ebfedea0SLionel Sambuc$!
152*ebfedea0SLionel Sambuc$ if (f$trnlnm( "opt", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
153*ebfedea0SLionel Sambuc   close opt
154*ebfedea0SLionel Sambuc$!
155*ebfedea0SLionel Sambuc$ if (f$trnlnm( "vf", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
156*ebfedea0SLionel Sambuc   close vf
157*ebfedea0SLionel Sambuc$!
158*ebfedea0SLionel Sambuc$! Restore the original default device:[directory].
159*ebfedea0SLionel Sambuc$!
160*ebfedea0SLionel Sambuc$ set default 'def_orig'
161*ebfedea0SLionel Sambuc$ exit
162*ebfedea0SLionel Sambuc$
163*ebfedea0SLionel Sambuc$! ----- Subroutines to build the shareable libraries
164*ebfedea0SLionel Sambuc$! For each supported architecture, there's a main shareable library
165*ebfedea0SLionel Sambuc$! creator, which is called from the main code above.
166*ebfedea0SLionel Sambuc$! The creator will define a number of variables to tell the next levels of
167*ebfedea0SLionel Sambuc$! subroutines what routines to use to write to the option files, call the
168*ebfedea0SLionel Sambuc$! main processor, read_func_num, and when that is done, it will write version
169*ebfedea0SLionel Sambuc$! data at the end of the .opt file, close it, and link the library.
170*ebfedea0SLionel Sambuc$!
171*ebfedea0SLionel Sambuc$! read_func_num reads through a .num file and calls the writer routine for
172*ebfedea0SLionel Sambuc$! each line.  It's also responsible for checking that order is properly kept
173*ebfedea0SLionel Sambuc$! in the .num file, check that each line applies to VMS and the architecture,
174*ebfedea0SLionel Sambuc$! and to fill in "holes" with dummy entries.
175*ebfedea0SLionel Sambuc$!
176*ebfedea0SLionel Sambuc$! The creator routines depend on the following variables:
177*ebfedea0SLionel Sambuc$! libnum	The name of the .num file to use as input
178*ebfedea0SLionel Sambuc$! libolb	The name of the object library to build from
179*ebfedea0SLionel Sambuc$! libid	The identification string of the shareable library
180*ebfedea0SLionel Sambuc$! libopt	The name of the .opt file to write
181*ebfedea0SLionel Sambuc$! libtit	The title of the assembler transfer vector file (VAX only)
182*ebfedea0SLionel Sambuc$! libmar	The name of the assembler transfer vector file (VAX only)
183*ebfedea0SLionel Sambuc$! libmap	The name of the map file to write
184*ebfedea0SLionel Sambuc$! libgoal	The name of the shareable library to write
185*ebfedea0SLionel Sambuc$! libref	The name of a shareable library to link in
186*ebfedea0SLionel Sambuc$!
187*ebfedea0SLionel Sambuc$! read_func_num depends on the following variables from the creator:
188*ebfedea0SLionel Sambuc$! libwriter	The name of the writer routine to call for each .num file line
189*ebfedea0SLionel Sambuc$! -----
190*ebfedea0SLionel Sambuc$
191*ebfedea0SLionel Sambuc$! ----- Subroutines for non-VAX
192*ebfedea0SLionel Sambuc$! -----
193*ebfedea0SLionel Sambuc$! The creator routine
194*ebfedea0SLionel Sambuc$ create_nonvax_shr:
195*ebfedea0SLionel Sambuc$   open /write opt 'libopt'
196*ebfedea0SLionel Sambuc$   write opt "identification=""",libid," ",libverstr,""""
197*ebfedea0SLionel Sambuc$   write opt libolb, " /library"
198*ebfedea0SLionel Sambuc$   if libref .nes. "" then write opt libref,"/SHARE"
199*ebfedea0SLionel Sambuc$   write opt "SYMBOL_VECTOR=(-"
200*ebfedea0SLionel Sambuc$   libfirstentry := true
201*ebfedea0SLionel Sambuc$   libwrch   := opt
202*ebfedea0SLionel Sambuc$   libwriter := write_nonvax_transfer_entry
203*ebfedea0SLionel Sambuc$   textcount = 0
204*ebfedea0SLionel Sambuc$   gosub read_func_num
205*ebfedea0SLionel Sambuc$   write opt ")"
206*ebfedea0SLionel Sambuc$   write opt "GSMATCH=",libvmatch,",",libver
207*ebfedea0SLionel Sambuc$   close opt
208*ebfedea0SLionel Sambuc$   link /map = 'libmap' /full /share = 'libgoal' 'libopt' /options -
209*ebfedea0SLionel Sambuc     'zlib_lib'
210*ebfedea0SLionel Sambuc$   return
211*ebfedea0SLionel Sambuc$
212*ebfedea0SLionel Sambuc$! The record writer routine
213*ebfedea0SLionel Sambuc$ write_nonvax_transfer_entry:
214*ebfedea0SLionel Sambuc$   if libentry .eqs. ".dummy" then return
215*ebfedea0SLionel Sambuc$   if info_kind .eqs. "VARIABLE"
216*ebfedea0SLionel Sambuc$   then
217*ebfedea0SLionel Sambuc$     pr:=DATA
218*ebfedea0SLionel Sambuc$   else
219*ebfedea0SLionel Sambuc$     pr:=PROCEDURE
220*ebfedea0SLionel Sambuc$   endif
221*ebfedea0SLionel Sambuc$   textcount_this = f$length(pr) + f$length(libentry) + 5
222*ebfedea0SLionel Sambuc$   if textcount + textcount_this .gt. 1024
223*ebfedea0SLionel Sambuc$   then
224*ebfedea0SLionel Sambuc$     write opt ")"
225*ebfedea0SLionel Sambuc$     write opt "SYMBOL_VECTOR=(-"
226*ebfedea0SLionel Sambuc$     textcount = 16
227*ebfedea0SLionel Sambuc$     libfirstentry := true
228*ebfedea0SLionel Sambuc$   endif
229*ebfedea0SLionel Sambuc$   if libfirstentry
230*ebfedea0SLionel Sambuc$   then
231*ebfedea0SLionel Sambuc$     write 'libwrch' "    ",libentry,"=",pr," -"
232*ebfedea0SLionel Sambuc$   else
233*ebfedea0SLionel Sambuc$     write 'libwrch' "    ,",libentry,"=",pr," -"
234*ebfedea0SLionel Sambuc$   endif
235*ebfedea0SLionel Sambuc$   libfirstentry := false
236*ebfedea0SLionel Sambuc$   textcount = textcount + textcount_this
237*ebfedea0SLionel Sambuc$   return
238*ebfedea0SLionel Sambuc$
239*ebfedea0SLionel Sambuc$! ----- Subroutines for VAX
240*ebfedea0SLionel Sambuc$! -----
241*ebfedea0SLionel Sambuc$! The creator routine
242*ebfedea0SLionel Sambuc$ create_vax_shr:
243*ebfedea0SLionel Sambuc$   open /write mar 'libmar'
244*ebfedea0SLionel Sambuc$   type sys$input:/out=mar:
245*ebfedea0SLionel Sambuc;
246*ebfedea0SLionel Sambuc; Transfer vector for VAX shareable image
247*ebfedea0SLionel Sambuc;
248*ebfedea0SLionel Sambuc$   write mar "	.TITLE ",libtit
249*ebfedea0SLionel Sambuc$   write mar "	.IDENT /",libid,"/"
250*ebfedea0SLionel Sambuc$   type sys$input:/out=mar:
251*ebfedea0SLionel Sambuc;
252*ebfedea0SLionel Sambuc; Define macro to assist in building transfer vector entries.  Each entry
253*ebfedea0SLionel Sambuc; should take no more than 8 bytes.
254*ebfedea0SLionel Sambuc;
255*ebfedea0SLionel Sambuc	.MACRO FTRANSFER_ENTRY routine
256*ebfedea0SLionel Sambuc	.ALIGN QUAD
257*ebfedea0SLionel Sambuc	.TRANSFER routine
258*ebfedea0SLionel Sambuc	.MASK	routine
259*ebfedea0SLionel Sambuc	JMP	routine+2
260*ebfedea0SLionel Sambuc	.ENDM FTRANSFER_ENTRY
261*ebfedea0SLionel Sambuc;
262*ebfedea0SLionel Sambuc; Place entries in own program section.
263*ebfedea0SLionel Sambuc;
264*ebfedea0SLionel Sambuc$   write mar "	.PSECT $$",libvec,",QUAD,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT"
265*ebfedea0SLionel Sambuc$   write mar libvec,"_xfer:"
266*ebfedea0SLionel Sambuc$   libwrch   := mar
267*ebfedea0SLionel Sambuc$   libwriter := write_vax_ftransfer_entry
268*ebfedea0SLionel Sambuc$   gosub read_func_num
269*ebfedea0SLionel Sambuc$   type sys$input:/out=mar:
270*ebfedea0SLionel Sambuc;
271*ebfedea0SLionel Sambuc; Allocate extra storage at end of vector to allow for expansion.
272*ebfedea0SLionel Sambuc;
273*ebfedea0SLionel Sambuc$   write mar "	.BLKB 32768-<.-",libvec,"_xfer>	; 64 pages total."
274*ebfedea0SLionel Sambuc$!   libwriter := write_vax_vtransfer_entry
275*ebfedea0SLionel Sambuc$!   gosub read_func_num
276*ebfedea0SLionel Sambuc$   write mar "	.END"
277*ebfedea0SLionel Sambuc$   close mar
278*ebfedea0SLionel Sambuc$   open /write opt 'libopt'
279*ebfedea0SLionel Sambuc$   write opt "identification=""",libid," ",libverstr,""""
280*ebfedea0SLionel Sambuc$   write opt libobj
281*ebfedea0SLionel Sambuc$   write opt libolb, " /library"
282*ebfedea0SLionel Sambuc$   if libref .nes. "" then write opt libref,"/SHARE"
283*ebfedea0SLionel Sambuc$   type sys$input:/out=opt:
284*ebfedea0SLionel Sambuc!
285*ebfedea0SLionel Sambuc! Ensure transfer vector is at beginning of image
286*ebfedea0SLionel Sambuc!
287*ebfedea0SLionel SambucCLUSTER=FIRST
288*ebfedea0SLionel Sambuc$   write opt "COLLECT=FIRST,$$",libvec
289*ebfedea0SLionel Sambuc$   write opt "GSMATCH=",libvmatch,",",libver
290*ebfedea0SLionel Sambuc$   type sys$input:/out=opt:
291*ebfedea0SLionel Sambuc!
292*ebfedea0SLionel Sambuc! make psects nonshareable so image can be installed.
293*ebfedea0SLionel Sambuc!
294*ebfedea0SLionel SambucPSECT_ATTR=$CHAR_STRING_CONSTANTS,NOWRT
295*ebfedea0SLionel Sambuc$   libwrch   := opt
296*ebfedea0SLionel Sambuc$   libwriter := write_vax_psect_attr
297*ebfedea0SLionel Sambuc$   gosub read_func_num
298*ebfedea0SLionel Sambuc$   close opt
299*ebfedea0SLionel Sambuc$   macro/obj='libobj' 'libmar'
300*ebfedea0SLionel Sambuc$   link /map = 'libmap' /full /share = 'libgoal' 'libopt' /options -
301*ebfedea0SLionel Sambuc     'zlib_lib'
302*ebfedea0SLionel Sambuc$   return
303*ebfedea0SLionel Sambuc$
304*ebfedea0SLionel Sambuc$! The record writer routine for VAX functions
305*ebfedea0SLionel Sambuc$ write_vax_ftransfer_entry:
306*ebfedea0SLionel Sambuc$   if info_kind .nes. "FUNCTION" then return
307*ebfedea0SLionel Sambuc$   if libentry .eqs ".dummy"
308*ebfedea0SLionel Sambuc$   then
309*ebfedea0SLionel Sambuc$     write 'libwrch' "	.BLKB 8" ! Dummy is zeroes...
310*ebfedea0SLionel Sambuc$   else
311*ebfedea0SLionel Sambuc$     write 'libwrch' "	FTRANSFER_ENTRY ",libentry
312*ebfedea0SLionel Sambuc$   endif
313*ebfedea0SLionel Sambuc$   return
314*ebfedea0SLionel Sambuc$! The record writer routine for VAX variables (should never happen!)
315*ebfedea0SLionel Sambuc$ write_vax_psect_attr:
316*ebfedea0SLionel Sambuc$   if info_kind .nes. "VARIABLE" then return
317*ebfedea0SLionel Sambuc$   if libentry .eqs ".dummy" then return
318*ebfedea0SLionel Sambuc$   write 'libwrch' "PSECT_ATTR=",libentry,",NOSHR"
319*ebfedea0SLionel Sambuc$   return
320*ebfedea0SLionel Sambuc$
321*ebfedea0SLionel Sambuc$! ----- Common subroutines
322*ebfedea0SLionel Sambuc$! -----
323*ebfedea0SLionel Sambuc$! The .num file reader.  This one has great responsibility.
324*ebfedea0SLionel Sambuc$ read_func_num:
325*ebfedea0SLionel Sambuc$   open /read libnum 'libnum'
326*ebfedea0SLionel Sambuc$   goto read_nums
327*ebfedea0SLionel Sambuc$
328*ebfedea0SLionel Sambuc$ read_nums:
329*ebfedea0SLionel Sambuc$   libentrynum=0
330*ebfedea0SLionel Sambuc$   liblastentry:=false
331*ebfedea0SLionel Sambuc$   entrycount=0
332*ebfedea0SLionel Sambuc$   loop:
333*ebfedea0SLionel Sambuc$     read /end=loop_end /err=loop_end libnum line
334*ebfedea0SLionel Sambuc$     lin = f$edit( line, "COMPRESS,TRIM")
335*ebfedea0SLionel Sambuc$!    Skip a "#" comment line.
336*ebfedea0SLionel Sambuc$     if (f$extract( 0, 1, lin) .eqs. "#") then goto loop
337*ebfedea0SLionel Sambuc$     entrynum = f$int(f$element( 1, " ", lin))
338*ebfedea0SLionel Sambuc$     entryinfo = f$element( 2, " ", lin)
339*ebfedea0SLionel Sambuc$     curentry = f$element( 0, " ", lin)
340*ebfedea0SLionel Sambuc$     info_exist = f$element( 0, ":", entryinfo)
341*ebfedea0SLionel Sambuc$     info_platforms = ","+ f$element(1, ":", entryinfo)+ ","
342*ebfedea0SLionel Sambuc$     info_kind = f$element( 2, ":", entryinfo)
343*ebfedea0SLionel Sambuc$     info_algorithms = ","+ f$element( 3, ":", entryinfo)+ ","
344*ebfedea0SLionel Sambuc$     if info_exist .eqs. "NOEXIST" then goto loop
345*ebfedea0SLionel Sambuc$     truesum = 0
346*ebfedea0SLionel Sambuc$     falsesum = 0
347*ebfedea0SLionel Sambuc$     negatives = 1
348*ebfedea0SLionel Sambuc$     plat_i = 0
349*ebfedea0SLionel Sambuc$     loop1:
350*ebfedea0SLionel Sambuc$       plat_entry = f$element( plat_i, ",", info_platforms)
351*ebfedea0SLionel Sambuc$       plat_i = plat_i + 1
352*ebfedea0SLionel Sambuc$       if plat_entry .eqs. "" then goto loop1
353*ebfedea0SLionel Sambuc$       if plat_entry .nes. ","
354*ebfedea0SLionel Sambuc$       then
355*ebfedea0SLionel Sambuc$         if f$extract(0,1,plat_entry) .nes. "!" then negatives = 0
356*ebfedea0SLionel Sambuc$         if (arch_vax)
357*ebfedea0SLionel Sambuc$         then
358*ebfedea0SLionel Sambuc$           if plat_entry .eqs. "EXPORT_VAR_AS_FUNCTION" then -
359*ebfedea0SLionel Sambuc$             truesum = truesum + 1
360*ebfedea0SLionel Sambuc$           if plat_entry .eqs. "!EXPORT_VAR_AS_FUNCTION" then -
361*ebfedea0SLionel Sambuc$             falsesum = falsesum + 1
362*ebfedea0SLionel Sambuc$         endif
363*ebfedea0SLionel Sambuc$!
364*ebfedea0SLionel Sambuc$         if ((plat_entry .eqs. "VMS") .or. -
365*ebfedea0SLionel Sambuc            ((plat_entry .eqs. "ZLIB") .and. (ZLIB .nes. "")) .or. -
366*ebfedea0SLionel Sambuc            (arch_vax .and. (plat_entry .eqs. "VMSVAX"))) then -
367*ebfedea0SLionel Sambuc            truesum = truesum + 1
368*ebfedea0SLionel Sambuc$!
369*ebfedea0SLionel Sambuc$         if ((plat_entry .eqs. "!VMS") .or. -
370*ebfedea0SLionel Sambuc            (arch_vax .and. (plat_entry .eqs. "!VMSVAX"))) then -
371*ebfedea0SLionel Sambuc            falsesum = falsesum + 1
372*ebfedea0SLionel Sambuc$!
373*ebfedea0SLionel Sambuc$	  goto loop1
374*ebfedea0SLionel Sambuc$       endif
375*ebfedea0SLionel Sambuc$     endloop1:
376*ebfedea0SLionel Sambuc$!DEBUG!$     if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
377*ebfedea0SLionel Sambuc$!DEBUG!$     then
378*ebfedea0SLionel Sambuc$!DEBUG!$       write sys$output line
379*ebfedea0SLionel Sambuc$!DEBUG!$       write sys$output "        truesum = ",truesum,-
380*ebfedea0SLionel Sambuc$!DEBUG!		", negatives = ",negatives,", falsesum = ",falsesum
381*ebfedea0SLionel Sambuc$!DEBUG!$     endif
382*ebfedea0SLionel Sambuc$     if falsesum .ne. 0 then goto loop
383*ebfedea0SLionel Sambuc$     if truesum+negatives .eq. 0 then goto loop
384*ebfedea0SLionel Sambuc$     alg_i = 0
385*ebfedea0SLionel Sambuc$     loop2:
386*ebfedea0SLionel Sambuc$       alg_entry = f$element(alg_i,",",info_algorithms)
387*ebfedea0SLionel Sambuc$	alg_i = alg_i + 1
388*ebfedea0SLionel Sambuc$       if alg_entry .eqs. "" then goto loop2
389*ebfedea0SLionel Sambuc$       if alg_entry .nes. ","
390*ebfedea0SLionel Sambuc$       then
391*ebfedea0SLionel Sambuc$	  if disabled_algorithms - ("," + alg_entry + ",") .nes disabled_algorithms then goto loop
392*ebfedea0SLionel Sambuc$         if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop
393*ebfedea0SLionel Sambuc$	  goto loop2
394*ebfedea0SLionel Sambuc$       endif
395*ebfedea0SLionel Sambuc$     endloop2:
396*ebfedea0SLionel Sambuc$     if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
397*ebfedea0SLionel Sambuc$     then
398*ebfedea0SLionel Sambuc$!DEBUG!$     write sys$output curentry," ; ",entrynum," ; ",entryinfo
399*ebfedea0SLionel Sambuc$     endif
400*ebfedea0SLionel Sambuc$   redo:
401*ebfedea0SLionel Sambuc$     next:=loop
402*ebfedea0SLionel Sambuc$     tolibentry=curentry
403*ebfedea0SLionel Sambuc$     if libentrynum .ne. entrynum
404*ebfedea0SLionel Sambuc$     then
405*ebfedea0SLionel Sambuc$       entrycount=entrycount+1
406*ebfedea0SLionel Sambuc$       if entrycount .lt. entrynum
407*ebfedea0SLionel Sambuc$       then
408*ebfedea0SLionel Sambuc$!DEBUG!$         write sys$output "Info: entrycount: ''entrycount', entrynum: ''entrynum' => 0"
409*ebfedea0SLionel Sambuc$         tolibentry=".dummy"
410*ebfedea0SLionel Sambuc$         next:=redo
411*ebfedea0SLionel Sambuc$       endif
412*ebfedea0SLionel Sambuc$       if entrycount .gt. entrynum
413*ebfedea0SLionel Sambuc$       then
414*ebfedea0SLionel Sambuc$         write sys$error "Decreasing library entry numbers!  Can't continue"
415*ebfedea0SLionel Sambuc$         write sys$error """",line,""""
416*ebfedea0SLionel Sambuc$         close libnum
417*ebfedea0SLionel Sambuc$         return
418*ebfedea0SLionel Sambuc$       endif
419*ebfedea0SLionel Sambuc$       libentry=tolibentry
420*ebfedea0SLionel Sambuc$!DEBUG!$       write sys$output entrycount," ",libentry," ",entryinfo
421*ebfedea0SLionel Sambuc$       if libentry .nes. "" .and. libwriter .nes. "" then gosub 'libwriter'
422*ebfedea0SLionel Sambuc$     else
423*ebfedea0SLionel Sambuc$       write sys$error "Info: ""''curentry'"" is an alias for ""''libentry'"".  Overriding..."
424*ebfedea0SLionel Sambuc$     endif
425*ebfedea0SLionel Sambuc$     libentrynum=entrycount
426*ebfedea0SLionel Sambuc$     goto 'next'
427*ebfedea0SLionel Sambuc$   loop_end:
428*ebfedea0SLionel Sambuc$   close libnum
429*ebfedea0SLionel Sambuc$   return
430*ebfedea0SLionel Sambuc$
431*ebfedea0SLionel Sambuc$! The version number reader
432*ebfedea0SLionel Sambuc$ read_version_info:
433*ebfedea0SLionel Sambuc$   libver = ""
434*ebfedea0SLionel Sambuc$   open /read vf [.CRYPTO]OPENSSLV.H
435*ebfedea0SLionel Sambuc$   loop_rvi:
436*ebfedea0SLionel Sambuc$     read/err=endloop_rvi/end=endloop_rvi vf rvi_line
437*ebfedea0SLionel Sambuc$     if rvi_line - "SHLIB_VERSION_NUMBER """ .eqs. rvi_line then -
438*ebfedea0SLionel Sambuc	goto loop_rvi
439*ebfedea0SLionel Sambuc$     libverstr = f$element(1,"""",rvi_line)
440*ebfedea0SLionel Sambuc$     libvmajor = f$element(0,".",libverstr)
441*ebfedea0SLionel Sambuc$     libvminor = f$element(1,".",libverstr)
442*ebfedea0SLionel Sambuc$     libvedit = f$element(2,".",libverstr)
443*ebfedea0SLionel Sambuc$     libvpatch = f$cvui(0,8,f$extract(1,1,libvedit)+"@")-f$cvui(0,8,"@")
444*ebfedea0SLionel Sambuc$     libvedit = f$extract(0,1,libvedit)
445*ebfedea0SLionel Sambuc$     libver = f$string(f$int(libvmajor)*100)+","+-
446*ebfedea0SLionel Sambuc	f$string(f$int(libvminor)*100+f$int(libvedit)*10+f$int(libvpatch))
447*ebfedea0SLionel Sambuc$     if libvmajor .eqs. "0"
448*ebfedea0SLionel Sambuc$     then
449*ebfedea0SLionel Sambuc$       libvmatch = "EQUAL"
450*ebfedea0SLionel Sambuc$     else
451*ebfedea0SLionel Sambuc$       ! Starting with the 1.0 release, backward compatibility should be
452*ebfedea0SLionel Sambuc$       ! kept, so switch over to the following
453*ebfedea0SLionel Sambuc$       libvmatch = "LEQUAL"
454*ebfedea0SLionel Sambuc$     endif
455*ebfedea0SLionel Sambuc$   endloop_rvi:
456*ebfedea0SLionel Sambuc$   close vf
457*ebfedea0SLionel Sambuc$   return
458*ebfedea0SLionel Sambuc$
459*ebfedea0SLionel Sambuc$! The disabled algorithms reader
460*ebfedea0SLionel Sambuc$ read_disabled_algorithms_info:
461*ebfedea0SLionel Sambuc$   disabled_algorithms = ","
462*ebfedea0SLionel Sambuc$   open /read cf [.CRYPTO.'ARCH']OPENSSLCONF.H
463*ebfedea0SLionel Sambuc$   loop_rci:
464*ebfedea0SLionel Sambuc$     read/err=endloop_rci/end=endloop_rci cf rci_line
465*ebfedea0SLionel Sambuc$     rci_line = f$edit(rci_line,"TRIM,COMPRESS")
466*ebfedea0SLionel Sambuc$     rci_ei = 0
467*ebfedea0SLionel Sambuc$     if f$extract(0,9,rci_line) .eqs. "# define " then rci_ei = 2
468*ebfedea0SLionel Sambuc$     if f$extract(0,8,rci_line) .eqs. "#define " then rci_ei = 1
469*ebfedea0SLionel Sambuc$     if rci_ei .eq. 0 then goto loop_rci
470*ebfedea0SLionel Sambuc$     rci_e = f$element(rci_ei," ",rci_line)
471*ebfedea0SLionel Sambuc$     if f$extract(0,11,rci_e) .nes. "OPENSSL_NO_" then goto loop_rci
472*ebfedea0SLionel Sambuc$     disabled_algorithms = disabled_algorithms + f$extract(11,999,rci_e) + ","
473*ebfedea0SLionel Sambuc$     goto loop_rci
474*ebfedea0SLionel Sambuc$   endloop_rci:
475*ebfedea0SLionel Sambuc$   close cf
476*ebfedea0SLionel Sambuc$   return
477