summaryrefslogtreecommitdiff
path: root/ubuntu/scripts
diff options
context:
space:
mode:
authorBotao Sun <botao.sun@linaro.org>2014-10-19 23:30:38 +1100
committerBotao Sun <botao.sun@linaro.org>2014-10-21 20:35:08 +1100
commit9c3bcd13c31d4042b1768d8a66fef9324badba05 (patch)
treed7327abda1452074be7cf503f1139f609717940a /ubuntu/scripts
parent64954a510b3a62f03a181027e49dd881b7ab88f9 (diff)
openssl-bsaes.sh: POSIX Compliant Update.
This change is to make the test script to be POSIX compliant. Original patch comes from: Lucas Dutra Nunes <ldnunes@ossystems.com.br> Signed-off by: Botao Sun <botao.sun@linaro.org> Change-Id: I5386b921eadf5ba86e5160c6b81c0d0ce5718ae3
Diffstat (limited to 'ubuntu/scripts')
-rwxr-xr-xubuntu/scripts/openssl-bsaes.sh65
1 files changed, 43 insertions, 22 deletions
diff --git a/ubuntu/scripts/openssl-bsaes.sh b/ubuntu/scripts/openssl-bsaes.sh
index e6bd189..a735dcd 100755
--- a/ubuntu/scripts/openssl-bsaes.sh
+++ b/ubuntu/scripts/openssl-bsaes.sh
@@ -1,11 +1,24 @@
-#!/bin/bash
-
-##
-## openssl-bsaes.sh - test the NEON bit sliced AES implementation
-## in various sizes and modes
-##
-## 2013-07-09 Ard Biesheuvel <ard.biesheuvel@linaro.org>
-##
+#!/bin/sh
+#
+# openssl-bsaes.sh - test the NEON bit sliced AES implementation in various sizes and modes
+#
+# Copyright (C) 2010 - 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> 2013-07-09
set -u
@@ -21,9 +34,9 @@ NAME=neon-$ALG
# ctr mode is essentially a stream cipher, so instead of using it for both
# encrypt and decrypt (which both call encrypt() under the hood), disable NEON
# for the decrypt case by setting OPENSSL_armcap to zero in the environment
-if [ "$MODE" == "ctr" ]
+if [ "$MODE" = "ctr" ]
then
- ARMCAP="env OPENSSL_armcap=0"
+ ARMCAP="env OPENSSL_armcap=0"
fi
TMP=/tmp/bsaestest-$$.md5sum
@@ -33,18 +46,26 @@ export ARMCAP
for i in $(seq 100)
do
- OUT=$(dd if=/dev/urandom bs=65 count=$i |
- tee >(md5sum >$TMP) |
- openssl enc -$ALG -pass env:KEY |
- ${ARMCAP:-} openssl enc -d -$ALG -pass env:KEY |
- md5sum)
-
- if [ "$OUT" != "$(cat $TMP)" ]
- then
- echo ${NAME}: fail
- rm -f $TMP
- exit 1
- fi
+ TMPFIFO=mktemp
+ mkfifo $TMPFIFO
+ touch $TMP
+ md5sum $TMPFIFO | awk '{ print $1 }' > $TMP &
+ OUT=$(dd if=/dev/urandom bs=65 count=$i |
+ tee $TMPFIFO |
+ openssl enc -$ALG -pass env:KEY |
+ ${ARMCAP:-} openssl enc -d -$ALG -pass env:KEY |
+ md5sum | awk '{ print $1 }' )
+ while [ "x$OUT" = "x" ] || [ "x$(cat $TMP)" = "x" ]
+ do
+ :
+ done
+ rm $TMPFIFO
+ if [ "$OUT" != "$(cat $TMP)" ]
+ then
+ echo ${NAME}: fail
+ rm -f $TMP
+ exit 1
+ fi
done
rm -f $TMP