diff options
author | Logan Chien <loganchien@google.com> | 2017-09-13 23:35:21 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-09-13 23:35:21 +0000 |
commit | c187a38651aa7921033e001cf0d7240488142990 (patch) | |
tree | 0a03e1518de9f84f486003a4888f2b7561cd8019 | |
parent | da42ed72b295a0e1cd170b78c0ae484a7172131c (diff) | |
parent | c40aced8638d66d651bc860e236aa68282711be0 (diff) | |
download | scrypt-c187a38651aa7921033e001cf0d7240488142990.tar.gz |
Merge changes If40a3037,I06bcc80c,I8e901b0b,I843a2144 am: 0b06038e14 am: 62f9d716cd
am: c40aced863
Change-Id: Id3ed659a318b0e319f47588c8b16eae00bff4cee
-rw-r--r-- | Android.bp | 33 | ||||
-rw-r--r-- | Android.mk | 13 | ||||
-rw-r--r-- | Scrypt-config.mk | 105 | ||||
-rw-r--r-- | Scrypt.mk | 46 | ||||
-rw-r--r-- | android-config.mk | 16 | ||||
-rw-r--r-- | build-config.mk | 6 | ||||
-rwxr-xr-x | import_scrypt.sh | 268 | ||||
-rw-r--r-- | patches/README | 2 | ||||
-rw-r--r-- | patches/arm_neon.patch (renamed from patches/arm-neon.patch) | 0 | ||||
-rw-r--r-- | scrypt.config | 25 | ||||
-rw-r--r-- | sources.bp | 78 | ||||
-rw-r--r-- | tests/Android.mk | 23 |
12 files changed, 252 insertions, 363 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..ef9b8a0 --- /dev/null +++ b/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2017 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +build = ["sources.bp"] + +cc_library_static { + name: "libscrypt_static", + defaults: ["libscrypt_sources"], + shared_libs: ["libcrypto"], + sdk_version: "9", + host_supported: true, + vendor_available: true, +} + +cc_test { + name: "scrypt_test", + srcs: ["tests/scrypt_test.cpp"], + shared_libs: ["libcrypto"], + static_libs: ["libscrypt_static"], +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 4514f94..0000000 --- a/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -# Enable to be able to use ALOG* with #include "cutils/log.h" -#log_c_includes += system/core/include -#log_shared_libraries := liblog - -# These makefiles are here instead of being Android.mk files in the -# respective crypto, ssl, and apps directories so -# that import_openssl.sh import won't remove them. -include $(LOCAL_PATH)/build-config.mk -include $(LOCAL_PATH)/Scrypt.mk - -include $(LOCAL_PATH)/tests/Android.mk diff --git a/Scrypt-config.mk b/Scrypt-config.mk deleted file mode 100644 index bbe1063..0000000 --- a/Scrypt-config.mk +++ /dev/null @@ -1,105 +0,0 @@ -# Auto-generated - DO NOT EDIT! -# To regenerate, edit scrypt.config, then run: -# ./import_scrypt.sh import /path/to/scrypt-1.1.6.tar.gz -# -# Before including this file, the local Android.mk must define the following -# variables: -# -# local_c_flags -# local_c_includes -# local_additional_dependencies -# -# This script will define the following variables: -# -# target_c_flags -# target_c_includes -# target_src_files -# -# host_c_flags -# host_c_includes -# host_src_files -# - -# Ensure these are empty. -unknown_arch_c_flags := -unknown_arch_src_files := -unknown_arch_exclude_files := - - -common_c_flags := - -common_src_files := \ - lib/crypto/crypto_scrypt-ref.c \ - -common_c_includes := \ - lib/crypto \ - lib/util \ - -arm_c_flags := - -arm_src_files := - -arm_exclude_files := - -arm_neon_c_flags := - -arm_neon_src_files := \ - lib/crypto/crypto_scrypt-neon.c \ - -arm_neon_exclude_files := \ - lib/crypto/crypto_scrypt-ref.c \ - -x86_c_flags := - -x86_src_files := \ - lib/crypto/crypto_scrypt-sse.c \ - -x86_exclude_files := \ - lib/crypto/crypto_scrypt-ref.c \ - -x86_64_c_flags := - -x86_64_src_files := \ - lib/crypto/crypto_scrypt-sse.c \ - -x86_64_exclude_files := \ - lib/crypto/crypto_scrypt-ref.c \ - -mips_c_flags := - -mips_src_files := - -mips_exclude_files := - -target_arch := $(TARGET_ARCH) -ifeq ($(target_arch)-$(TARGET_HAS_BIGENDIAN),mips-true) -target_arch := unknown_arch -endif - -target_c_flags := $(common_c_flags) $($(target_arch)_c_flags) $(local_c_flags) -target_c_includes := $(addprefix external/scrypt/,$(common_c_includes)) $(local_c_includes) -target_src_files := $(common_src_files) $($(target_arch)_src_files) -target_src_files := $(filter-out $($(target_arch)_exclude_files), $(target_src_files)) - -# Hacks for ARM NEON support -ifeq ($(target_arch),arm) -ifeq ($(ARCH_ARM_HAVE_NEON),true) -target_c_flags += $(arm_neon_c_flags) -target_src_files += $(arm_neon_src_files) -target_src_files := $(filter-out $(arm_neon_exclude_files), $(target_src_files)) -endif -endif - -ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) -host_arch := x86 -else -host_arch := unknown_arch -endif - -host_c_flags := $(common_c_flags) $($(host_arch)_c_flags) $(local_c_flags) -host_c_includes := $(addprefix external/scrypt/,$(common_c_includes)) $(local_c_includes) -host_src_files := $(common_src_files) $($(host_arch)_src_files) -host_src_files := $(filter-out $($(host_arch)_exclude_files), $(host_src_files)) - -local_additional_dependencies += $(LOCAL_PATH)/Scrypt-config.mk - diff --git a/Scrypt.mk b/Scrypt.mk deleted file mode 100644 index 3fca7aa..0000000 --- a/Scrypt.mk +++ /dev/null @@ -1,46 +0,0 @@ -local_c_flags := -DUSE_OPENSSL_PBKDF2 - -local_c_includes := $(log_c_includes) - -local_additional_dependencies := $(LOCAL_PATH)/android-config.mk $(LOCAL_PATH)/Scrypt.mk - -include $(LOCAL_PATH)/Scrypt-config.mk - -####################################### -# target static library -include $(CLEAR_VARS) -include $(LOCAL_PATH)/android-config.mk - -LOCAL_SHARED_LIBRARIES := $(log_shared_libraries) libcrypto - -# If we're building an unbundled build, don't try to use clang since it's not -# in the NDK yet. This can be removed when a clang version that is fast enough -# in the NDK. -ifeq (,$(TARGET_BUILD_APPS)) -LOCAL_CLANG := true -else -LOCAL_SDK_VERSION := 9 -endif - -LOCAL_SRC_FILES += $(target_src_files) -LOCAL_CFLAGS += $(target_c_flags) -LOCAL_C_INCLUDES += $(target_c_includes) -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE:= libscrypt_static -LOCAL_ADDITIONAL_DEPENDENCIES := $(local_additional_dependencies) -include $(BUILD_STATIC_LIBRARY) - -######################################## -# host static library - -include $(CLEAR_VARS) -include $(LOCAL_PATH)/android-config.mk -LOCAL_SHARED_LIBRARIES := $(log_shared_libraries) libcrypto -LOCAL_SRC_FILES += $(host_src_files) -LOCAL_CFLAGS += $(host_c_flags) -LOCAL_C_INCLUDES += $(host_c_includes) -LOCAL_LDLIBS += -ldl -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE:= libscrypt_static -LOCAL_ADDITIONAL_DEPENDENCIES := $(local_additional_dependencies) -include $(BUILD_HOST_STATIC_LIBRARY) diff --git a/android-config.mk b/android-config.mk deleted file mode 100644 index 326e113..0000000 --- a/android-config.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# These flags represent the build-time configuration of scrypt for Android -# -# The value of $(scrypt_cflags) was pruned from the Makefile generated -# by running ./configure from import_scrypt.sh. -# -# This script performs minor but required patching for the Android build. -# - -LOCAL_CFLAGS += $(scrypt_cflags) - -# Add in flags to let config.h be read properly -LOCAL_CFLAGS += "-DHAVE_CONFIG_H" - -# Add clang here when it works on host -# LOCAL_CLANG := true diff --git a/build-config.mk b/build-config.mk deleted file mode 100644 index 3d2ab91..0000000 --- a/build-config.mk +++ /dev/null @@ -1,6 +0,0 @@ -# Auto-generated - DO NOT EDIT! -# To regenerate, edit scrypt.config, then run: -# ./import_scrypt.sh import /path/to/scrypt-1.1.6.tar.gz -# -scrypt_cflags := \ - diff --git a/import_scrypt.sh b/import_scrypt.sh index 324eae6..0aa5168 100755 --- a/import_scrypt.sh +++ b/import_scrypt.sh @@ -90,7 +90,7 @@ function main() { declare -r patch=$1 shift || usage "No patch file specified." [ -d $SCRYPT_DIR ] || usage "$SCRYPT_DIR not found, did you mean to use generate?" - [ -d $SCRYPT_DIR_ORIG_ORIG ] || usage "$SCRYPT_DIR_ORIG not found, did you mean to use generate?" + [ -d $SCRYPT_DIR_ORIG ] || usage "$SCRYPT_DIR_ORIG not found, did you mean to use generate?" regenerate $patch elif [ "$command" = "generate" ]; then declare -r patch=$1 @@ -166,37 +166,15 @@ function filter_by_egrep() { # $1: space-separated list # Out: new space-separated list function uniq_sort () { - echo "$@" | tr ' ' '\n' | sort -u | tr '\n' ' ' + echo "$@" | tr ' ' '\n' | sort -u | tr '\n' ' ' | \ + sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' } function print_autogenerated_header() { - echo "# Auto-generated - DO NOT EDIT!" - echo "# To regenerate, edit scrypt.config, then run:" - echo "# ./import_scrypt.sh import /path/to/scrypt-$SCRYPT_VERSION.tar.gz" - echo "#" -} - -function generate_build_config_mk() { - ./configure $CONFIGURE_ARGS - #rm -f apps/CA.pl.bak crypto/scryptconf.h.bak - - declare -r tmpfile=$(mktemp) - (grep -e -D Makefile | grep -v CONFIGURE_ARGS= | grep -v OPTIONS=) > $tmpfile - - declare -r cflags=$(filter_by_egrep "^-D" $(grep -e "^CFLAG=" $tmpfile)) - declare -r depflags=$(filter_by_egrep "^-D" $(grep -e "^DEPFLAG=" $tmpfile)) - rm -f $tmpfile - - echo "Generating $(basename $1)" - ( - print_autogenerated_header - - echo "scrypt_cflags := \\" - for cflag in $cflags $depflags; do - echo " $cflag \\" - done - echo "" - ) > $1 + echo "// Auto-generated - DO NOT EDIT!" + echo "// To regenerate, edit scrypt.config, then run:" + echo "// ./import_scrypt.sh import /path/to/scrypt-$SCRYPT_VERSION.tar.gz" + echo "//" } # Return the value of a computed variable name. @@ -219,134 +197,130 @@ var_sorted_value() { uniq_sort $(var_value $1) } -# Print the definition of a given variable in a GNU Make build file. -# $1: Variable name (e.g. common_src_files) -# $2+: Variable value (e.g. list of sources) -print_vardef_in_mk() { - declare -r varname=$1 +# $1: Property name +# $2: Indent +# $3: Values +print_list_in_bp() { + declare -r indent="$1" shift - if [ -z "$1" ]; then - echo "$varname :=" - else - echo "$varname := \\" - for src; do - echo " $src \\" - done - fi - echo "" -} - -# Same as print_vardef_in_mk, but print a CFLAGS definition from -# a list of compiler defines. -# $1: Variable name (e.g. common_c_flags) -# $2: List of defines (e.g. SCRYPT_NO_DONKEYS ...) -print_defines_in_mk() { - declare -r varname=$1 + declare -r name="$1" shift - if [ -z "$1" ]; then - echo "$varname :=" - else - echo "$varname := \\" - for def; do - echo " -D$def \\" + + if [ -n "$*" ]; then + echo "${indent}${name}: [" + for value in "$@"; do + echo "${indent} \"${value}\"," done + echo "${indent}]," fi - echo "" } -# Generate a configuration file like Scrypt-config.mk -# This uses variable definitions from scrypt.config to build a config -# file that can compute the list of target- and host-specific sources / -# compiler flags for a given component. -# -# $1: Target file name. (e.g. Scrypt-config.mk) -function generate_config_mk() { - declare -r output="$1" - declare -r all_archs="arm arm_neon x86 x86_64 mips" +# Print an architecture-specific section +# $1: Arch +# $2: Arch variant +print_arch_section_in_bp() { + declare -r arch="$1" + declare -r variant="$2" - echo "Generating $(basename $output)" - ( - print_autogenerated_header - echo \ -"# Before including this file, the local Android.mk must define the following -# variables: -# -# local_c_flags -# local_c_includes -# local_additional_dependencies -# -# This script will define the following variables: -# -# target_c_flags -# target_c_includes -# target_src_files -# -# host_c_flags -# host_c_includes -# host_src_files -# + declare -r srcs="$(var_sorted_value SCRYPT_SOURCES_${arch})" + declare -r exclude_srcs="$(var_sorted_value SCRYPT_SOURCES_EXCLUDES_${arch})" -# Ensure these are empty. -unknown_arch_c_flags := -unknown_arch_src_files := -unknown_arch_exclude_files := + declare -r srcs_variant="$(var_sorted_value SCRYPT_SOURCES_${arch}_${variant})" + declare -r exclude_srcs_variant="$(var_sorted_value SCRYPT_SOURCES_EXCLUDES_${arch}_${variant})" -" - common_defines=$(var_sorted_value SCRYPT_DEFINES) - print_defines_in_mk common_c_flags $common_defines + if [ -n "${srcs}${exclude_srcs}${srcs_variant}${exclude_srcs_variant}" ]; then + echo " ${arch}: {" - common_sources=$(var_sorted_value SCRYPT_SOURCES) - print_vardef_in_mk common_src_files $common_sources + print_list_in_bp " " "srcs" ${srcs} + print_list_in_bp " " "exclude_srcs" ${exclude_srcs} - common_includes=$(var_sorted_value SCRYPT_INCLUDES) - print_vardef_in_mk common_c_includes $common_includes + if [ -n "${src_variant}${exclude_srcs_variant}" ]; then + echo " ${variant}: {" + print_list_in_bp " " "srcs" ${srcs_variant} + print_list_in_bp " " "exclude_srcs" ${exclude_srcs_variant} + echo " }," + fi - for arch in $all_archs; do - arch_defines=$(var_sorted_value SCRYPT_DEFINES_${arch}) - print_defines_in_mk ${arch}_c_flags $arch_defines + echo " }," + fi +} - arch_sources=$(var_sorted_value SCRYPT_SOURCES_${arch}) - print_vardef_in_mk ${arch}_src_files $arch_sources +# Generate sources.bp from scrypt.config +# +# $1: Target file name. (e.g. sources.bp) +function generate_android_bp() { + declare -r output="$1" - arch_exclude_sources=$(var_sorted_value SCRYPT_SOURCES_EXCLUDES_${arch}) - print_vardef_in_mk ${arch}_exclude_files $arch_exclude_sources + # Extract cflags from upstream `./configure` script + cd $SCRYPT_DIR - done + ./configure $CONFIGURE_ARGS + + declare -r tmpfile=$(mktemp) + (grep -e -D Makefile | grep -v CONFIGURE_ARGS= | grep -v OPTIONS=) > $tmpfile + + declare -r ac_cflags=$(filter_by_egrep "^-D" $(grep -e "^CFLAG=" $tmpfile)) + declare -r ac_depflags=$(filter_by_egrep "^-D" $(grep -e "^DEPFLAG=" $tmpfile)) + rm -f $tmpfile - echo "\ -target_arch := \$(TARGET_ARCH) -ifeq (\$(target_arch)-\$(TARGET_HAS_BIGENDIAN),mips-true) -target_arch := unknown_arch -endif - -target_c_flags := \$(common_c_flags) \$(\$(target_arch)_c_flags) \$(local_c_flags) -target_c_includes := \$(addprefix external/scrypt/,\$(common_c_includes)) \$(local_c_includes) -target_src_files := \$(common_src_files) \$(\$(target_arch)_src_files) -target_src_files := \$(filter-out \$(\$(target_arch)_exclude_files), \$(target_src_files)) - -# Hacks for ARM NEON support -ifeq (\$(target_arch),arm) -ifeq (\$(ARCH_ARM_HAVE_NEON),true) -target_c_flags += \$(arm_neon_c_flags) -target_src_files += \$(arm_neon_src_files) -target_src_files := \$(filter-out \$(arm_neon_exclude_files), \$(target_src_files)) -endif -endif - -ifeq (\$(HOST_OS)-\$(HOST_ARCH),linux-x86) -host_arch := x86 -else -host_arch := unknown_arch -endif - -host_c_flags := \$(common_c_flags) \$(\$(host_arch)_c_flags) \$(local_c_flags) -host_c_includes := \$(addprefix external/scrypt/,\$(common_c_includes)) \$(local_c_includes) -host_src_files := \$(common_src_files) \$(\$(host_arch)_src_files) -host_src_files := \$(filter-out \$(\$(host_arch)_exclude_files), \$(host_src_files)) - -local_additional_dependencies += \$(LOCAL_PATH)/$(basename $output) -" + cd .. + # Generate sources.bp + echo "Generating $(basename $output)" + ( + print_autogenerated_header + + cat <<__EOF__ + +// +// Copyright (C) 2017 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_defaults { + name: "libscrypt_sources", + +__EOF__ + + print_list_in_bp " " "cflags" \ + $(var_sorted_value SCRYPT_CFLAGS) ${ac_cflags} ${ac_depflags} + echo + + print_list_in_bp " " "export_include_dirs" \ + $(var_sorted_value SCRYPT_EXPORT_C_INCLUDE_DIRS) + echo + + print_list_in_bp " " "local_include_dirs" \ + $(var_sorted_value SCRYPT_INCLUDES) + echo + + print_list_in_bp " " "srcs" $(var_sorted_value SCRYPT_SOURCES) + echo + + echo " arch: {" + + print_arch_section_in_bp "arm" "neon" + print_arch_section_in_bp "arm64" + print_arch_section_in_bp "x86" + print_arch_section_in_bp "x86_64" + print_arch_section_in_bp "mips" + print_arch_section_in_bp "mips64" + + cat <<__EOF__ + }, +} +__EOF__ ) > "$output" } @@ -356,15 +330,11 @@ function import() { untar $SCRYPT_SOURCE readonly applypatches $SCRYPT_DIR - cd $SCRYPT_DIR - - generate_build_config_mk ../build-config.mk - - touch ../MODULE_LICENSE_BSD_LIKE + cd $SCRYPT_DIR/.. - cd .. + touch MODULE_LICENSE_BSD_LIKE - generate_config_mk Scrypt-config.mk + generate_android_bp "sources.bp" # Prune unnecessary sources prune @@ -395,7 +365,7 @@ function generate() { for i in $NEEDED_SOURCES; do echo "Restoring $i" - rm -r $SCRYPT_DIR/$i + rm -rf $SCRYPT_DIR/$i cp -rf $i $SCRYPT_DIR/$i done @@ -484,7 +454,7 @@ function generatepatch() { rm -f $patch touch $patch for i in $sources; do - LC_ALL=C TZ=UTC0 diff -aup $SCRYPT_DIR_ORIG/$i $SCRYPT_DIR/$i >> $patch && die "ERROR: No diff for patch $path in file $i" + LC_ALL=C TZ=UTC0 diff -aupN $SCRYPT_DIR_ORIG/$i $SCRYPT_DIR/$i >> $patch && die "ERROR: No diff for patch $path in file $i" done echo "Generated patch $patch" echo "NOTE To make sure there are not unwanted changes from conflicting patches, be sure to review the generated patch." diff --git a/patches/README b/patches/README index 353ddbb..018cac5 100644 --- a/patches/README +++ b/patches/README @@ -6,6 +6,6 @@ use_openssl_pbkdf2.patch: Uses the PBKDF2 function from OpenSSL (it uses accelerated SHA256) -arm-neon.patch: +arm_neon.patch: Adds NEON acceleration for the Salsa20/8 mixing function. diff --git a/patches/arm-neon.patch b/patches/arm_neon.patch index 02ff357..02ff357 100644 --- a/patches/arm-neon.patch +++ b/patches/arm_neon.patch diff --git a/scrypt.config b/scrypt.config index 3ccb4d0..f00a3f6 100644 --- a/scrypt.config +++ b/scrypt.config @@ -34,8 +34,16 @@ lib \ scrypt_platform.h \ " -SCRYPT_INCLUDES="\ +SCRYPT_CFLAGS="\ +-DHAVE_CONFIG_H \ +-DUSE_OPENSSL_PBKDF2 \ +" + +SCRYPT_EXPORT_C_INCLUDE_DIRS="\ lib/crypto \ +" + +SCRYPT_INCLUDES="\ lib/util \ " @@ -57,6 +65,14 @@ SCRYPT_SOURCES_EXCLUDES_arm_neon="\ lib/crypto/crypto_scrypt-ref.c \ " +SCRYPT_SOURCES_arm64="\ +lib/crypto/crypto_scrypt-neon.c \ +" + +SCRYPT_SOURCES_EXCLUDES_arm64="\ +lib/crypto/crypto_scrypt-ref.c \ +" + SCRYPT_SOURCES_mips="\ " @@ -81,14 +97,15 @@ lib/crypto/crypto_scrypt-ref.c \ SCRYPT_PATCHES="\ use_openssl_pbkdf2.patch \ -arm-neon.patch \ +arm_neon.patch \ " SCRYPT_PATCHES_use_openssl_pbkdf2_SOURCES="\ lib/crypto/crypto_scrypt-ref.c \ +lib/crypto/crypto_scrypt-sse.c \ " -SCRYPT_PATCHES_bionic_SOURCES="\ -lib/crypto/crypto_scrypt-neon.c \ +SCRYPT_PATCHES_arm_neon_SOURCES="\ lib/crypto/crypto_scrypt-neon-salsa208.h \ +lib/crypto/crypto_scrypt-neon.c \ " diff --git a/sources.bp b/sources.bp new file mode 100644 index 0000000..a2ba3f4 --- /dev/null +++ b/sources.bp @@ -0,0 +1,78 @@ +// Auto-generated - DO NOT EDIT! +// To regenerate, edit scrypt.config, then run: +// ./import_scrypt.sh import /path/to/scrypt-1.1.6.tar.gz +// + +// +// Copyright (C) 2017 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_defaults { + name: "libscrypt_sources", + + cflags: [ + "-DHAVE_CONFIG_H", + "-DUSE_OPENSSL_PBKDF2", + ], + + export_include_dirs: [ + "lib/crypto", + ], + + local_include_dirs: [ + "lib/util", + ], + + srcs: [ + "lib/crypto/crypto_scrypt-ref.c", + ], + + arch: { + arm: { + neon: { + srcs: [ + "lib/crypto/crypto_scrypt-neon.c", + ], + exclude_srcs: [ + "lib/crypto/crypto_scrypt-ref.c", + ], + }, + }, + arm64: { + srcs: [ + "lib/crypto/crypto_scrypt-neon.c", + ], + exclude_srcs: [ + "lib/crypto/crypto_scrypt-ref.c", + ], + }, + x86: { + srcs: [ + "lib/crypto/crypto_scrypt-sse.c", + ], + exclude_srcs: [ + "lib/crypto/crypto_scrypt-ref.c", + ], + }, + x86_64: { + srcs: [ + "lib/crypto/crypto_scrypt-sse.c", + ], + exclude_srcs: [ + "lib/crypto/crypto_scrypt-ref.c", + ], + }, + }, +} diff --git a/tests/Android.mk b/tests/Android.mk deleted file mode 100644 index cfec2d6..0000000 --- a/tests/Android.mk +++ /dev/null @@ -1,23 +0,0 @@ -# Build the scrypt unit tests - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -LOCAL_CLANG := true - -LOCAL_SRC_FILES:= \ - scrypt_test.cpp - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../lib/crypto - -LOCAL_SHARED_LIBRARIES := \ - libcrypto - -LOCAL_STATIC_LIBRARIES := \ - libscrypt_static \ - -LOCAL_MODULE := scrypt_test - -include $(BUILD_NATIVE_TEST) |