Skip to content

Commit 0bff7cc

Browse files
author
Andras Fekete
committed
Add in ability to use FIPS-ready code
1 parent 8460ea6 commit 0bff7cc

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
/wolfssl*
5858

5959
IDE/Android/android-ndk-r26b/
60-
IDE/Android/openssl/
60+
IDE/Android/openssl-source/
6161
IDE/Android/openssl-install/
62-
IDE/Android/wolfssl/
62+
IDE/Android/wolfssl-source/
6363
IDE/Android/wolfssl-install/
64-
IDE/Android/wolfProvider/
64+
IDE/Android/wolfProvider/

IDE/Android/build.sh

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"
1818

1919
# Compile OpenSSL
2020
export OPENSSL_ALL_CIPHERS="-cipher ALL -ciphersuites TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256:TLS_AES_128_CCM_8_SHA256"
21-
if [ ! -e ${WORKSPACE}/openssl ]; then
22-
git clone https://github.com/openssl/openssl.git ${WORKSPACE}/openssl
23-
cd ${WORKSPACE}/openssl && \
21+
if [ ! -e ${WORKSPACE}/openssl-install ]; then
22+
git clone https://github.com/openssl/openssl.git ${WORKSPACE}/openssl-source
23+
cd ${WORKSPACE}/openssl-source && \
2424
./Configure android-x86_64 --prefix=${WORKSPACE}/openssl-install && \
2525
sed -i 's/-ldl//g' Makefile && \
2626
sed -i 's/-pie//g' Makefile && \
@@ -34,18 +34,26 @@ export WOLFSSL_CONFIG_OPTS='--enable-debug --enable-opensslcoexist --enable-cmac
3434
export WOLFSSL_CONFIG_CPPFLAGS=CPPFLAGS="-I${WORKSPACE}/openssl-install -DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT -DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP -DECC_MIN_KEY_SZ=192 -DHAVE_PUBLIC_FFDHE -DHAVE_FFDHE_6144 -DHAVE_FFDHE_8192 -DFP_MAX_BITS=16384 -DWOLFSSL_DH_EXTRA -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_PSS_SALT_LEN_DISCOVER"
3535
export UNAME=Android
3636
export CROSS_COMPILE=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android34-
37-
#export CC=x86_64-linux-android34-clang
38-
if [ ! -e ${WORKSPACE}/wolfssl ]; then
39-
git clone https://github.com/wolfssl/wolfssl ${WORKSPACE}/wolfssl
40-
cd ${WORKSPACE}/wolfssl && ./fips-check.sh fips-ready keep
41-
cd ${WORKSPACE}/wolfssl/XXX-fips-test && \
42-
./autogen.sh && \
43-
CC=x86_64-linux-android34-clang ./configure ${WOLFSSL_CONFIG_OPTS} "${WOLFSSL_CONFIG_CPPFLAGS}" -prefix=${WORKSPACE}/wolfssl-install --host=x86_64-linux-android --disable-asm CFLAGS=-fPIC && \
44-
make && \
45-
adb push --sync src/.libs/libwolfssl.so ./wolfcrypt/test/.libs/testwolfcrypt /data/local/tmp/ && \
46-
NEWHASH=$(adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/testwolfcrypt 2>&1 | sed -n 's/hash = \(.*\)/\1/p'") && \
47-
sed -i "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c && \
48-
make -j install
37+
if [ ! -e ${WORKSPACE}/wolfssl-install ]; then
38+
if [ ${USE_FIPS_CHECK} = "true" ]; then
39+
git clone https://github.com/wolfssl/wolfssl ${WORKSPACE}/wolfssl
40+
cd ${WORKSPACE}/wolfssl && ./fips-check.sh fips-ready keep
41+
mv ${WORKSPACE}/wolfssl/XXX-fips-test ${WORKSPACE}/wolfssl-source
42+
rm -rf ${WORKSPACE}/wolfssl
43+
cd ${WORKSPACE}/wolfssl-source && ./autogen.sh
44+
else
45+
wget -O ${WORKSPACE}/wolfssl-fips.zip https://www.wolfssl.com/wolfssl-5.6.4-gplv3-fips-ready.zip && \
46+
cd ${WORKSPACE} && unzip wolfssl-fips.zip && \
47+
mv ${WORKSPACE}/wolfssl-5.6.4-gplv3-fips-ready ${WORKSPACE}/wolfssl-source && \
48+
rm ${WORKSPACE}/wolfssl-fips.zip
49+
fi
50+
cd ${WORKSPACE}/wolfssl-source
51+
CC=x86_64-linux-android34-clang ./configure ${WOLFSSL_CONFIG_OPTS} "${WOLFSSL_CONFIG_CPPFLAGS}" -prefix=${WORKSPACE}/wolfssl-install --host=x86_64-linux-android --disable-asm CFLAGS=-fPIC && \
52+
make && \
53+
adb push --sync src/.libs/libwolfssl.so ./wolfcrypt/test/.libs/testwolfcrypt /data/local/tmp/ && \
54+
NEWHASH=$(adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/testwolfcrypt 2>&1 | sed -n 's/hash = \(.*\)/\1/p'") && \
55+
sed -i "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c && \
56+
make -j install
4957
fi
5058
export LD_LIBRARY_PATH="${WORKSPACE}/wolfssl-install/lib:$LD_LIBRARY_PATH"
5159
export LIBRARY_PATH="${WORKSPACE}/wolfssl-install/lib:$LIBRARY_PATH"

0 commit comments

Comments
 (0)