[gnutls-devel] [PATCH 1/4] tests: ecdsa: cleanup shell usage

Alon Bar-Lev alon.barlev at gmail.com
Thu Jun 18 08:41:52 CEST 2015


Add quotes for most usages of variables.

Added ${} for variables.

Cleanup trailing spaces.

Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 tests/ecdsa/ecdsa | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/ecdsa/ecdsa b/tests/ecdsa/ecdsa
index ddb9b60..90eead0 100755
--- a/tests/ecdsa/ecdsa
+++ b/tests/ecdsa/ecdsa
@@ -22,15 +22,15 @@
 
 #set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool$EXEEXT}"
 
 echo ca > template
 echo cn = "ECDSA SHA 256 CA" >> template
 
-$CERTTOOL --generate-privkey --ecc > key-ca-ecdsa.pem 2>/dev/null 
+"${CERTTOOL}" --generate-privkey --ecc > key-ca-ecdsa.pem 2>/dev/null
 
-$CERTTOOL -d 2 --generate-self-signed --template template \
+"${CERTTOOL}" -d 2 --generate-self-signed --template template \
     --load-privkey key-ca-ecdsa.pem \
     --outfile new-ca-ecdsa.pem \
     --hash sha256 >out 2>&1
@@ -41,10 +41,10 @@ if [ $? != 0 ];then
 fi
 
 echo ca > template
-$CERTTOOL --generate-privkey --ecc > key-subca-ecdsa.pem 2>/dev/null 
+"${CERTTOOL}" --generate-privkey --ecc > key-subca-ecdsa.pem 2>/dev/null
 echo cn = "ECDSA SHA 224 Mid CA" >> template
 
-$CERTTOOL -d 2 --generate-certificate --template template \
+"${CERTTOOL}" -d 2 --generate-certificate --template template \
     --load-ca-privkey key-ca-ecdsa.pem \
     --load-ca-certificate new-ca-ecdsa.pem \
     --load-privkey key-subca-ecdsa.pem \
@@ -58,9 +58,9 @@ fi
 
 echo cn = "End-user" > template
 
-$CERTTOOL --generate-privkey --ecc > key-ecdsa.pem 2>/dev/null 
+"${CERTTOOL}" --generate-privkey --ecc > key-ecdsa.pem 2>/dev/null
 
-$CERTTOOL -d 2 --generate-certificate --template template \
+"${CERTTOOL}" -d 2 --generate-certificate --template template \
     --load-ca-privkey key-subca-ecdsa.pem \
     --load-ca-certificate new-subca-ecdsa.pem \
     --load-privkey key-ecdsa.pem \
@@ -72,7 +72,7 @@ if [ $? != 0 ];then
 fi
 
 cat new-user.pem new-subca-ecdsa.pem new-ca-ecdsa.pem > out
-$CERTTOOL --verify-chain <out > verify
+"${CERTTOOL}" --verify-chain <out > verify
 
 if [ $? != 0 ];then
 	cat verify
@@ -82,7 +82,7 @@ fi
 rm -f verify new-user.pem new-ca-ecdsa.pem new-subca-ecdsa.pem template out
 rm -f key-subca-ecdsa.pem key-ca-ecdsa.pem key-ecdsa.pem
 
-$CERTTOOL -k < ${srcdir}/bad-key.pem | grep "validation failed" >/dev/null 2>&1
+"${CERTTOOL}" -k < "${srcdir}/bad-key.pem" | grep "validation failed" >/dev/null 2>&1
 if [ $? != 0 ];then
 	echo "certtool didn't detect a bad ECDSA key."
 	exit 1
-- 
2.3.6




More information about the Gnutls-devel mailing list