trousers: copy memory in secure way (part 2)

Create tpm_rqu_build_checked to check the size of buffer not to
overflow.

And replace all tpm_rqu_build with this regex rule:
replace this:
tpm_rqu_build\((TPM_ORD([^,)]|\n)*),(([^,)]|\n)*),(([^,)]|\n)*),(([^)]|\n)*)\)
to this:
tpm_rqu_build_checked($1,$3, TSS_TPM_TXBLOB_SIZE,$5,$7)

BUG=chromium:1020667
TEST=Build ok.
TEST=CQ
TEST=manually enroll and login on chell
TEST=run trousers testsuite and had same result before/after this CL.

Change-Id: I2355989b25fb3eeef79f131b1be987d039d5c013
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/trousers/+/2407933
Tested-by: joe Chou <yich@google.com>
Commit-Queue: joe Chou <yich@google.com>
Reviewed-by: Leo Lai <cylai@google.com>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
32 files changed