diff options
author | Wan-Teh Chang <wtc@google.com> | 2013-04-02 14:49:51 -0700 |
---|---|---|
committer | Wan-Teh Chang <wtc@google.com> | 2013-04-02 14:49:51 -0700 |
commit | ab36d6229ffdee734c8e7190aea04444f6d64f3f (patch) | |
tree | 274055ce615fb8b93bf4d6b29a50cae90c95ac9f /tests | |
parent | c27d424f0bd6370998e9432ad91d68acdbd654da (diff) | |
download | nss-hg-ab36d6229ffdee734c8e7190aea04444f6d64f3f.tar.gz |
Bug 854063: Add an AES GCM test program (pk11gcmtest) that calls
PK11_Decrypt and PK11_Encrypt. Add AES GCM test vectors downloaded
from NIST, and test them in tests/cipher/cipher.sh. r=sleevi.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/cipher/cipher.sh | 20 | ||||
-rw-r--r-- | tests/cipher/gcm.txt | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/cipher/cipher.sh b/tests/cipher/cipher.sh index 4cd33c856..1eb4a3f0a 100755 --- a/tests/cipher/cipher.sh +++ b/tests/cipher/cipher.sh @@ -37,9 +37,11 @@ cipher_init() CIPHERDIR=${HOSTDIR}/cipher CIPHERTESTDIR=${QADIR}/../cmd/bltest + GCMTESTDIR=${QADIR}/../cmd/pk11gcmtest D_CIPHER="Cipher.$version" CIPHER_TXT=${QADIR}/cipher/cipher.txt + GCM_TXT=${QADIR}/cipher/gcm.txt mkdir -p ${CIPHERDIR} @@ -88,6 +90,23 @@ cipher_main() done < ${CIPHER_TXT} } +############################## cipher_gcm ############################# +# local shell function to test NSS AES GCM +######################################################################## +cipher_gcm() +{ + while read EXP_RET INPUT_FILE TESTNAME + do + if [ -n "$EXP_RET" -a "$EXP_RET" != "#" ] ; then + TESTNAME=`echo $TESTNAME | sed -e "s/_/ /g"` + echo "$SCRIPTNAME: $TESTNAME --------------------------------" + echo "pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE" + ${PROFTOOL} ${BINDIR}/pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE + html_msg $? $EXP_RET "$TESTNAME" + fi + done < ${GCM_TXT} +} + ############################## cipher_cleanup ############################ # local shell function to finish this script (no exit since it might be # sourced) @@ -103,4 +122,5 @@ cipher_cleanup() cipher_init cipher_main +cipher_gcm cipher_cleanup diff --git a/tests/cipher/gcm.txt b/tests/cipher/gcm.txt new file mode 100644 index 000000000..4550faf49 --- /dev/null +++ b/tests/cipher/gcm.txt @@ -0,0 +1,16 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file defines the AES GCM tests +# +# expected +# return pk11gcmtest Test Case name +# value input file +# ------- ---------------------- ----------------------- + 0 gcmDecrypt128.rsp NIST_AES128_GCM_Decrypt + 0 gcmDecrypt192.rsp NIST_AES192_GCM_Decrypt + 0 gcmDecrypt256.rsp NIST_AES256_GCM_Decrypt + 0 gcmEncryptExtIV128.rsp NIST_AES128_GCM_Encrypt + 0 gcmEncryptExtIV192.rsp NIST_AES192_GCM_Encrypt + 0 gcmEncryptExtIV256.rsp NIST_AES256_GCM_Encrypt |