swtpm: Return error if more bytes received than user wanted to send

Return an error code if HASH_DATA received more bytes from the user than
what the user indicated in the length field that he wanted to send. This
avoids an integer underrun of the 'remain' variable in the loop that would
then cause the loop to wanting to receive around 4GB of data.

Also fix some indentation issues.
Use be32toh instead of (the equivalent) htobe32 when reading from the
packet.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
1 file changed