Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from wireapp/feat/build-libcryptobox-with-stac…
Browse files Browse the repository at this point in the history
…k-protector-flag

feat: build libcryptobox with stack protector flag [WPB-1797]
  • Loading branch information
MohamadJaara authored Aug 31, 2023
2 parents 117244c + 6690788 commit 009a206
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust
FROM rust:bullseye

USER root

Expand Down
16 changes: 12 additions & 4 deletions android/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ jni/armeabi-v7a/libcryptobox.so: libsodium-armeabi-v7a | build/src/$(CRYPTOBOX_N
-L ../../libsodium-android-arm-v7a/lib \
-C ar=arm-linux-androideabi-ar \
-C linker=armv7a-linux-androideabi16-clang \
-C link_args="-Wl,-soname,libcryptobox.so"
-C link_args="-Wl,-soname,libcryptobox.so" \
-C link_arg=-fstack-protector-strong \
-C target_feature=+crt-static
mkdir -p jni/armeabi-v7a
cp build/src/$(CRYPTOBOX_NAME)/target/armv7-linux-androideabi/release/libcryptobox.so jni/armeabi-v7a/libcryptobox.so

Expand All @@ -118,7 +120,9 @@ jni/x86/libcryptobox.so: libsodium-x86 | build/src/$(CRYPTOBOX_NAME)
-L ../../libsodium-android-x86/lib \
-C ar=i686-linux-android-ar \
-C linker=i686-linux-android16-clang \
-C link_args="-Wl,-soname,libcryptobox.so"
-C link_args="-Wl,-soname,libcryptobox.so" \
-C link_arg=-fstack-protector-strong \
-C target_feature=+crt-static
mkdir -p jni/x86
cp build/src/$(CRYPTOBOX_NAME)/target/i686-linux-android/release/libcryptobox.so jni/x86/libcryptobox.so

Expand All @@ -131,7 +135,9 @@ jni/x86_64/libcryptobox.so: libsodium-x86_64 | build/src/$(CRYPTOBOX_NAME)
-L ../../libsodium-android-x86_64/lib \
-C ar=x86_64-linux-android-ar \
-C linker=x86_64-linux-android21-clang \
-C link_args="-Wl,-soname,libcryptobox.so"
-C link_args="-Wl,-soname,libcryptobox.so" \
-C link_arg=-fstack-protector-strong \
-C target_feature=+crt-static
mkdir -p jni/x86_64
cp build/src/$(CRYPTOBOX_NAME)/target/x86_64-linux-android/release/libcryptobox.so jni/x86_64/libcryptobox.so

Expand All @@ -144,7 +150,9 @@ jni/arm64-v8a/libcryptobox.so: libsodium-aarch64 | build/src/$(CRYPTOBOX_NAME)
-L ../../libsodium-android-armv8-a/lib \
-C ar=aarch64-linux-android-ar \
-C linker=aarch64-linux-android21-clang \
-C link_args="-Wl,-soname,libcryptobox.so"
-C link_args="-Wl,-soname,libcryptobox.so" \
-C link_arg=-fstack-protector-strong \
-C target_feature=+crt-static
mkdir -p jni/arm64-v8a
cp build/src/$(CRYPTOBOX_NAME)/target/aarch64-linux-android/release/libcryptobox.so jni/arm64-v8a/libcryptobox.so

Expand Down
2 changes: 1 addition & 1 deletion android/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ LOCAL_MODULE := cryptobox-jni
LOCAL_SRC_FILES := ../../src/cryptobox-jni.c
LOCAL_SHARED_LIBRARIES := libsodium-prebuilt libcryptobox-prebuilt
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS += -std=c99 -Wall
LOCAL_CFLAGS += -std=c99 -Wall -fstack-protector-strong
include $(BUILD_SHARED_LIBRARY)

0 comments on commit 009a206

Please sign in to comment.