swtpm/tests/test_setbuffersize
Stefan Berger 688c8e2400 swtpm: Implemented support for PTM_SET_BUFFERSIZE command
Implement a command for setting and querying the buffer size the
TPM implementation (libtpms) is using. The setting of the
buffersize allows to reduce the size of the buffer to a size
that the interface can support so that these two sizes match
and the TPM will not produce larger responses than what the
interface can support.

Extend swtpm_ioctl with an option to set the buffersize.

Adapt the existing tests to reflect the newly supported command.
Implement a new test for getting/setting of the buffer size.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-05 14:53:00 -05:00

38 lines
838 B
Bash
Executable File

#!/bin/bash
cd "$(dirname "$0")"
export SWTPM_IOCTL_BUFFERSIZE=100
export SWTPM_INTERFACE=cuse
bash _test_setbuffersize
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_IOCTL_BUFFERSIZE=4096
export SWTPM_INTERFACE=cuse
bash _test_setbuffersize
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_INTERFACE=socket+socket
export SWTPM_SERVER_NAME=localhost
export SWTPM_SERVER_PORT=65432
export SWTPM_CTRL_PORT=65433
bash _test_setbuffersize
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_INTERFACE=socket+unix
export SWTPM_SERVER_NAME=localhost
export SWTPM_SERVER_PORT=65432
bash _test_setbuffersize
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_INTERFACE=unix+unix
bash _test_setbuffersize
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
exit 0