1313FAILED=0
1414
1515if [ -z " ${WOLFSSL_DIR} " ] && [ ! -z " ${WOLFSSL_INSTALL} " ]; then
16- printf " WOLFSSL_DIR env needs set to location of wolfSSL\n"
16+ printf " WOLFSSL_DIR environment variable needs to be set to location of\n"
17+ printf " wolfSSL source code.\n"
1718 exit 1
1819fi
1920
20- printf " Running wolfEngine cipher suite tests against OpenSSL version 1.1.1b\n"
21- printf " and OpenSSL version 1.0.2h.\n\n"
22-
21+ printf " Running wolfSSL + OpenSSL (w/ wolfEngine) interoperability tests using\n"
22+ printf " OpenSSL versions 1.1.1 and 1.0.2.\n\n"
2323
2424PWD=` pwd`
25- if [ -z ${LOGILE } ]; then
25+ if [ -z ${LOGFILE } ]; then
2626 LOGFILE=${PWD} /log.txt
27+ printf " Using default log file: $LOGFILE .\n\n"
2728fi
2829OPENSSL_1_0_2_RES=${PWD} /openssl_1_0_2.res
2930OPENSSL_1_1_1_RES=${PWD} /openssl_1_1_1.res
3031
31-
32-
33- printf " Setting up ...\n"
32+ printf " Setting up...\n"
3433if [ -z " ${OPENSSL_1_1_1_INSTALL} " ]; then
35- printf " \tOPENSSL_1_1_1_INSTALL not set, cloning it ..."
34+ printf " \tOPENSSL_1_1_1_INSTALL not set, installing OpenSSL 1.1.1b ..."
3635 git clone --depth=1 -b OpenSSL_1_1_1b
[email protected] :openssl/openssl.git openssl-1_1_1b
& > $LOGFILE 3736 OPENSSL_1_1_1_INSTALL=$PWD /openssl-1_1_1b-install
3837
39- # Build the library
40- printf " Building OpenSSL 1.1.1b..."
4138 cd openssl-1_1_1b
4239 ./config shared --prefix=$OPENSSL_1_1_1_INSTALL & > $LOGFILE
4340 if [ $? != 0 ]; then
44- printf " config failed\n"
41+ printf " config failed. \n"
4542 exit 1
4643 fi
4744
4845 make install & > $LOGFILE
4946 if [ $? != 0 ]; then
50- printf " make failed\n"
47+ printf " make install failed. \n"
5148 exit 1
5249 fi
53- printf " done \n"
50+ printf " installed. \n"
5451 cd ..
5552else
56- printf " \tUsing OpenSSL 1.1.1 installed at $OPENSSL_1_1_1_INSTALL \n"
53+ printf " \tUsing OpenSSL 1.1.1 installed at $OPENSSL_1_1_1_INSTALL . \n"
5754fi
5855
5956if [ -z " ${OPENSSL_1_0_2_INSTALL} " ]; then
60- printf " \tOPENSSL_1_0_2_INSTALL not set, cloning it ..."
57+ printf " \tOPENSSL_1_0_2_INSTALL not set, installing OpenSSSL 1.0.2h ..."
6158 git clone --depth=1 -b OpenSSL_1_0_2h
[email protected] :openssl/openssl.git openssl-1_0_2h
& > $LOGFILE 6259 OPENSSL_1_0_2_INSTALL=${PWD} /openssl-1_0_2h-install
6360
64- # Build the library
65- printf " Building OpenSSL 1.0.2h..."
6661 cd openssl-1_0_2h
6762 ./config shared --prefix=$OPENSSL_1_0_2_INSTALL & > $LOGFILE
6863 if [ $? != 0 ]; then
69- printf " config failed\n"
64+ printf " config failed. \n"
7065 exit 1
7166 fi
7267
7368 make install & > $LOGFILE
7469 if [ $? != 0 ]; then
75- printf " make failed\n"
70+ printf " make install failed. \n"
7671 exit 1
7772 fi
78- printf " done \n"
73+ printf " installed. \n"
7974 cd ..
8075else
81- printf " \tUsing OpenSSL 1.0.2 installed at $OPENSSL_1_0_2_INSTALL \n"
76+ printf " \tUsing OpenSSL 1.0.2 installed at $OPENSSL_1_0_2_INSTALL . \n"
8277fi
8378
84-
8579if [ -z " ${WOLFSSL_INSTALL} " ]; then
86- printf " \tWOLFSSL_INSTALL not set, cloning it ..."
80+ printf " \tWOLFSSL_INSTALL not set, installing wolfSSL ..."
8781 git clone --depth=1
[email protected] :wolfssl/wolfssl.git
& > $LOGFILE 8882 WOLFSSL_INSTALL=$PWD /wolfssl-install
8983
90- # Build the library
91- printf " Building wolfSSL..."
9284 cd wolfssl
9385 ./autogen.sh & > /dev/null
94- ./configure --enable-cmac --enable-keygen --enable-sha --enable-des3 --enable-aesctr --enable-aesccm CPPFLAGS=' -DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT -DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP -DECC_MIN_KEY_SZ=192' --prefix=$WOLFSSL_INSTALL ${EXTRA_WOLFSSL_OPTIONS} & > $LOGFILE
86+ ./configure --enable-cmac --enable-keygen --enable-sha --enable-des3 --enable-aesctr --enable-aesccm --enable-x963kdf CPPFLAGS=" -DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT -DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP -DECC_MIN_KEY_SZ=192 -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_PSS_SALT_LEN_DISCOVER " --prefix=$WOLFSSL_INSTALL ${EXTRA_WOLFSSL_OPTIONS} & > $LOGFILE
9587 if [ $? != 0 ]; then
96- printf " config failed\n"
88+ printf " config failed. \n"
9789 exit 1
9890 fi
9991
10092 make install & > $LOGFILE
10193 if [ $? != 0 ]; then
102- printf " make failed\n"
94+ printf " make install failed. \n"
10395 exit 1
10496 fi
10597
10698 cd ..
10799 WOLFSSL_DIR=${PWD} /wolfssl
108- printf " done \n"
100+ printf " installed. \n"
109101
110102else
111- printf " \tUsing wolfSSL installed at $WOLFSSL_INSTALL \n"
103+ printf " \tUsing wolfSSL installed at $WOLFSSL_INSTALL . \n"
112104fi
113105export LD_LIBRARY_PATH=" $WOLFSSL_INSTALL /lib:$LD_LIBRARY_PATH "
114106
115-
116107if [ -z " ${WOLFENGINE_1_1_1_INSTALL} " ]; then
117- printf " \tWOLENGINE_1_1_1_INSTALL not set, cloning it ..."
108+ printf " \tWOLFENGINE_1_1_1_INSTALL not set, installing wolfEngine with OpenSSL 1.1.1 ..."
118109 git clone --depth=1
[email protected] :wolfssl/wolfEngine.git
& > $LOGFILE 119110 WOLFENGINE_1_1_1_INSTALL=$PWD /wolfengine-1_1_1-install
120111
121- # Build the library
122- printf " Building wolfEngine..."
123112 cd wolfEngine
124113 ./autogen.sh & > /dev/null
125- ./configure CPPFLAGS=-I ${ WOLFSSL_INSTALL} /include --with-openssl=$OPENSSL_1_1_1_INSTALL --prefix=$WOLFENGINE_1_1_1_INSTALL & > $LOGFILE
114+ ./configure --with-wolfssl= $ WOLFSSL_INSTALL --with-openssl=$OPENSSL_1_1_1_INSTALL --prefix=$WOLFENGINE_1_1_1_INSTALL & > $LOGFILE
126115 if [ $? != 0 ]; then
127- printf " config failed\n"
116+ printf " config failed. \n"
128117 exit 1
129118 fi
130119
131120 make install & > $LOGFILE
132121 if [ $? != 0 ]; then
133- printf " make failed\n"
122+ printf " make install failed. \n"
134123 exit 1
135124 fi
136- printf " done \n"
125+ printf " installed. \n"
137126 cd ..
138-
139127else
140- printf " \tUsing wolfEngine 1.1.1 installed at $WOLFENGINE_1_1_1_INSTALL \n"
128+ printf " \tUsing wolfEngine with OpenSSL 1.1.1 installed at $WOLFENGINE_1_1_1_INSTALL . \n"
141129fi
142130
143-
144131if [ -z " ${WOLFENGINE_1_0_2_INSTALL} " ]; then
145- printf " \tWOLENGINE_1_0_2_INSTALL not set, cloning it..."
146- git clone --depth=1
[email protected] :wolfssl/wolfEngine.git
& > $LOGFILE 132+ printf " \tWOLFENGINE_1_0_2_INSTALL not set, installing wolfEngine with OpenSSL 1.0.2..."
133+ # We only need to clone the wolfEngine repo if it wasn't previously cloned
134+ # in the step above.
135+ if [ ! -d " wolfEngine" ]; then
136+ git clone --depth=1
[email protected] :wolfssl/wolfEngine.git
& > $LOGFILE 137+ fi
147138 WOLFENGINE_1_0_2_INSTALL=$PWD /wolfengine-1_0_2-install
148139
149- # Build the library
150- printf " Building wolfEngine..."
151140 cd wolfEngine
152141 ./autogen.sh & > /dev/null
153- ./configure CPPFLAGS=-I ${ WOLFSSL_INSTALL} /include --with-openssl=$OPENSSL_1_0_2_INSTALL --prefix=$WOLFENGINE_1_0_2_INSTALL & > $LOGFILE
142+ ./configure --with-wolfssl= $ WOLFSSL_INSTALL --with-openssl=$OPENSSL_1_0_2_INSTALL --prefix=$WOLFENGINE_1_0_2_INSTALL & > $LOGFILE
154143 if [ $? != 0 ]; then
155- printf " config failed\n"
144+ printf " config failed. \n"
156145 exit 1
157146 fi
158147
159148 make install & > $LOGFILE
160149 if [ $? != 0 ]; then
161- printf " make failed\n"
150+ printf " make install failed. \n"
162151 exit 1
163152 fi
164- printf " done \n"
153+ printf " installed. \n"
165154 cd ..
166155
167156else
168- printf " \tUsing wolfEngine 1.0.2 installed at $WOLFENGINE_1_0_2_INSTALL \n"
157+ printf " \tUsing wolfEngine with OpenSSL 1.0.2 installed at $WOLFENGINE_1_0_2_INSTALL . \n"
169158fi
170159
171- printf " Done with setup\n\n"
160+ printf " Done with setup. \n\n"
172161
173162printf " Running interop tests...\n"
174163
175- # run the existing wolfSSL openssl interop tests using wolfEngine
164+ # Run the existing wolfSSL OpenSSL interop tests using wolfEngine.
176165cd $WOLFSSL_DIR
177166export WOLFSSL_OPENSSL_TEST=1
178167printf " \tTesting with OpenSSL version 1.1.1..."
179168export OPENSSL_ENGINES=${WOLFENGINE_1_1_1_INSTALL} /lib
180- export OPENSSL_ENGINE_ID=" libwolfengine"
181169export LD_LIBRARY_PATH=${OPENSSL_1_1_1_INSTALL} /lib
182170export OPENSSL=${OPENSSL_1_1_1_INSTALL} /bin/openssl
183171
184172# check the engine can be found and used before running tests
185173$OPENSSL engine -tt libwolfengine & > $LOGFILE
186174if [ $? != 0 ]; then
187- printf " not able to load engine\n"
175+ printf " not able to load engine. \n"
188176 printf " $OPENSSL engine -tt libwolfengine\n"
189177 FAILED=1
190178else
191- grep " available" $LOGFILE
179+ grep " available" $LOGFILE & > /dev/null
192180 if [ $? != 0 ]; then
193- printf " engine not available\n"
181+ printf " engine not available. \n"
194182 else
195183 ./scripts/openssl.test & > ${OPENSSL_1_1_1_RES}
196184 grep " Success\!" ${OPENSSL_1_1_1_RES} & > /dev/null
197185 if [ $? == 0 ]; then
198- printf " ok\n"
186+ printf " ok. \n"
199187 else
200- printf " failed\n"
188+ printf " failed. \n"
201189 cat ${OPENSSL_1_1_1_RES}
202190 FAILED=1
203191 fi
@@ -208,39 +196,38 @@ printf "\tTesting with OpenSSL version 1.0.2..."
208196export OPENSSL_ENGINES=${WOLFENGINE_1_0_2_INSTALL} /lib
209197export LD_LIBRARY_PATH=${OPENSSL_1_0_2_INSTALL} /lib
210198export OPENSSL=${OPENSSL_1_0_2_INSTALL} /bin/openssl
211- export OPENSSL_ENGINE_ID=" wolfengine"
212199
213200# check the engine can be found and used before running tests
214201$OPENSSL engine -tt wolfengine & > $LOGFILE
215202if [ $? != 0 ]; then
216- printf " not able to load engine\n"
203+ printf " not able to load engine. \n"
217204 printf " $OPENSSL engine -tt wolfengine\n"
218205 FAILED=1
219206else
220- grep " available" $LOGFILE
207+ grep " available" $LOGFILE & > /dev/null
221208 if [ $? != 0 ]; then
222- printf " engine not available\n"
209+ printf " engine not available. \n"
223210 else
224211 ./scripts/openssl.test & > ${OPENSSL_1_0_2_RES}
225212 grep " Success\!" ${OPENSSL_1_0_2_RES} & > /dev/null
226213 if [ $? == 0 ]; then
227- printf " ok\n"
214+ printf " ok. \n"
228215 else
229- printf " failed\n"
216+ printf " failed. \n"
230217 cat ${OPENSSL_1_0_2_RES}
231218 FAILED=1
232219 fi
233220 fi
234221fi
235222
236- printf " Finished\n"
237- printf " Results stored in the files:\n\t${OPENSL_1_1_1_RES } \n"
223+ printf " Finished tests. \n"
224+ printf " Results stored in the files:\n\t${OPENSSL_1_1_1_RES } \n"
238225printf " \t${OPENSSL_1_0_2_RES} \n"
239226
240-
241227if [ $FAILED == 1 ]; then
242- printf " Fail.. .\n"
228+ printf " Failed .\n"
243229 exit 1
244230fi
245- printf " Success\n"
231+
232+ printf " Succeeded.\n"
246233exit 0
0 commit comments