libtpms/tests/base64decode.sh
Stefan Berger b888045f4f Add a test case for the TPMLIB_DecodeBlob API
Add a test case testing the TPMLIB_DecodeBlob function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
2014-01-08 11:43:37 -05:00

19 lines
361 B
Bash
Executable File

#!/bin/bash
input=$(mktemp)
binary=$(mktemp)
trap "rm -f $input $binary" EXIT
for i in $(seq 1 1024) 2048 10240;
do
dd if=/dev/urandom of=$binary bs=1 count=$i &>/dev/null
echo "-----BEGIN INITSTATE-----" > $input
base64 < $binary >> $input
echo "-----END INITSTATE-----" >> $input
./base64decode $input $binary
if [ $? -ne 0 ]; then
exit 1
fi
done