1@echo off
2
3SET ASM=%1
4
5if NOT X%PROCESSOR_ARCHITECTURE% == X goto defined 
6
7echo Processor Architecture Undefined: defaulting to X86
8
9goto X86
10
11:defined
12
13if %PROCESSOR_ARCHITECTURE% == x86 goto X86
14
15if %PROCESSOR_ARCHITECTURE% == IA64 goto IA64
16
17if %PROCESSOR_ARCHITECTURE% == AMD64 goto AMD64
18
19echo Processor Architecture Unrecognized: defaulting to X86
20
21:X86
22echo Auto Configuring for X86
23
24SET TARGET=VC-WIN32
25
26if x%ASM% == xno-asm goto compile
27echo Generating x86 for NASM assember
28SET ASM=nasm
29SET ASMOPTS=-DOPENSSL_IA32_SSE2
30
31echo Bignum
32cd crypto\bn\asm
33perl bn-586.pl win32n %ASMOPTS% > bn_win32.asm
34if ERRORLEVEL 1 goto error
35perl co-586.pl win32n %ASMOPTS% > co_win32.asm
36if ERRORLEVEL 1 goto error
37perl mo-586.pl win32n %ASMOPTS% > mt_win32.asm
38if ERRORLEVEL 1 goto error
39cd ..\..\..
40
41echo AES
42cd crypto\aes\asm
43perl aes-586.pl win32n %ASMOPTS% > a_win32.asm
44if ERRORLEVEL 1 goto error
45cd ..\..\..
46
47echo DES
48cd crypto\des\asm
49perl des-586.pl win32n %ASMOPTS% > d_win32.asm
50if ERRORLEVEL 1 goto error
51cd ..\..\..
52
53echo "crypt(3)"
54
55cd crypto\des\asm
56perl crypt586.pl win32n %ASMOPTS% > y_win32.asm
57if ERRORLEVEL 1 goto error
58cd ..\..\..
59
60echo Blowfish
61
62cd crypto\bf\asm
63perl bf-586.pl win32n %ASMOPTS% > b_win32.asm
64if ERRORLEVEL 1 goto error
65cd ..\..\..
66
67echo CAST5
68cd crypto\cast\asm
69perl cast-586.pl win32n %ASMOPTS% > c_win32.asm
70if ERRORLEVEL 1 goto error
71cd ..\..\..
72
73echo RC4
74cd crypto\rc4\asm
75perl rc4-586.pl win32n %ASMOPTS% > r4_win32.asm
76if ERRORLEVEL 1 goto error
77cd ..\..\..
78
79echo MD5
80cd crypto\md5\asm
81perl md5-586.pl win32n %ASMOPTS% > m5_win32.asm
82if ERRORLEVEL 1 goto error
83cd ..\..\..
84
85echo SHA1
86cd crypto\sha\asm
87perl sha1-586.pl win32n %ASMOPTS% > s1_win32.asm
88if ERRORLEVEL 1 goto error
89perl sha512-sse2.pl win32n %ASMOPTS% > sha512-sse2.asm
90if ERRORLEVEL 1 goto error
91cd ..\..\..
92
93echo RIPEMD160
94cd crypto\ripemd\asm
95perl rmd-586.pl win32n %ASMOPTS% > rm_win32.asm
96if ERRORLEVEL 1 goto error
97cd ..\..\..
98
99echo RC5\32
100cd crypto\rc5\asm
101perl rc5-586.pl win32n %ASMOPTS% > r5_win32.asm
102if ERRORLEVEL 1 goto error
103cd ..\..\..
104
105echo CPU-ID
106cd crypto
107perl x86cpuid.pl win32n %ASMOPTS% > cpu_win32.asm
108if ERRORLEVEL 1 goto error
109cd ..
110
111goto compile
112
113:IA64
114
115echo Auto Configuring for IA64
116SET TARGET=VC-WIN64I
117perl ms\uplink.pl win64i > ms\uptable.asm
118if ERRORLEVEL 1 goto error
119ias -o ms\uptable.obj ms\uptable.asm
120if ERRORLEVEL 1 goto error
121
122goto compile
123
124:AMD64
125
126echo Auto Configuring for AMD64
127SET TARGET=VC-WIN64A
128perl ms\uplink.pl win64a > ms\uptable.asm
129if ERRORLEVEL 1 goto error
130ml64 -c -Foms\uptable.obj ms\uptable.asm
131if ERRORLEVEL 1 goto error
132
133if x%ASM% == xno-asm goto compile
134echo Generating x86_64 for ML64 assember
135SET ASM=ml64
136
137echo Bignum
138cd crypto\bn\asm
139perl x86_64-mont.pl x86_64-mont.asm
140if ERRORLEVEL 1 goto error
141cd ..\..\..
142
143echo AES
144cd crypto\aes\asm
145perl aes-x86_64.pl aes-x86_64.asm
146if ERRORLEVEL 1 goto error
147cd ..\..\..
148
149echo SHA
150cd crypto\sha\asm
151perl sha1-x86_64.pl sha1-x86_64.asm
152if ERRORLEVEL 1 goto error
153perl sha512-x86_64.pl sha256-x86_64.asm
154if ERRORLEVEL 1 goto error
155perl sha512-x86_64.pl sha512-x86_64.asm
156if ERRORLEVEL 1 goto error
157cd ..\..\..
158
159echo CPU-ID
160cd crypto
161perl x86_64cpuid.pl cpuid-x86_64.asm
162if ERRORLEVEL 1 goto error
163cd ..
164
165:compile
166
167perl Configure %TARGET% fipscanisterbuild
168pause
169
170echo on
171
172perl util\mkfiles.pl >MINFO
173@if ERRORLEVEL 1 goto error
174perl util\mk1mf.pl dll %ASM% %TARGET% >ms\ntdll.mak
175@if ERRORLEVEL 1 goto error
176
177perl util\mkdef.pl 32 libeay > ms\libeay32.def
178@if ERRORLEVEL 1 goto error
179perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
180@if ERRORLEVEL 1 goto error
181
182nmake -f ms\ntdll.mak clean
183nmake -f ms\ntdll.mak
184@if ERRORLEVEL 1 goto error
185
186@echo.
187@echo.
188@echo.
189@echo ***************************
190@echo ****FIPS BUILD SUCCESS*****
191@echo ***************************
192
193@goto end
194
195:error
196
197@echo.
198@echo.
199@echo.
200@echo ***************************
201@echo ****FIPS BUILD FAILURE*****
202@echo ***************************
203
204:end
205