summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2017-08-31 19:15:50 +0800
committerLogan Chien <loganchien@google.com>2017-09-12 14:34:44 +0800
commit629ed239a9d27f2b58697ef48d7a12c81e5d74cf (patch)
tree114f68e6444a78a0cb4dd6f432593a538210e59b
parent581021037c04fb2cd8dcbfd643cd9b9545f6a2b2 (diff)
downloadscrypt-629ed239a9d27f2b58697ef48d7a12c81e5d74cf.tar.gz
Fix import_scrypt.sh
This commit fixes various issues in import_scrypt.sh: * Add `-N` option to `diff` command so that arm_neon.diff can be generated by import_scrypt.sh * Rename SCRYPT_PATCHES_bionic_SOURCES to SCRYPT_PATCHES_arm_neon_SOURCES * Reorder SCRYPT_PATCHES_arm_neon_SOURCES to mimic git-diff output * Add missing `lib/crypto/crypto_scrypt-sse.c` file for use_openssl_pbkdf2.patch * Add `-f` to `rm` command in the `generate` command because `config.h` is not in the upstream release tarball * Replace typo `$SCRYPT_DIR_ORIG_ORIG` with `$SCRYPT_DIR_ORIG` * Rename arm-neon.patch to arm_neon.patch (for consistency) Bug: 65425184 Test: ./import_scrypt.sh import upstream/scrypt-1.1.6.tgz Test: ./import_scrypt.sh generate patches/arm_neon.patch \ upstream/scrypt-1.1.6.tgz Test: ./import_scrypt.sh generate patches/use_openssl_pbkdf2.patch \ upstream/scrypt-1.1.6.tgz Change-Id: I843a21440527ed4037525468e9f66630f24b4cee
-rwxr-xr-ximport_scrypt.sh6
-rw-r--r--patches/README2
-rw-r--r--patches/arm_neon.patch (renamed from patches/arm-neon.patch)0
-rw-r--r--scrypt.config7
4 files changed, 8 insertions, 7 deletions
diff --git a/import_scrypt.sh b/import_scrypt.sh
index 324eae6..d85d763 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
@@ -395,7 +395,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 +484,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..bcb158d 100644
--- a/scrypt.config
+++ b/scrypt.config
@@ -81,14 +81,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 \
"