tpm_manager: add option to disable pre-initialization

Before this change, tpm_managerd always performed pre-initialization
if it found an unowned TPM upon start. That may not work for special
workflows like factory initialization.

This CL adds a check for a "no_preinit" flag file in /run/tpm_manager.
If that file exists, pre-initialization is not done.

Having this flag file in tpmfs allows for various control schemes,
including disabling pre-initialization for specific boots only and
copying this flag from stateful before starting tpm_managerd for
disabling for all boots at image level.

BUG=b:68671587
TEST=unit tests; check pre-init with and without the flag file

Change-Id: I69991896cc79977694bd328de1e716a54de7ab96
Reviewed-on: https://chromium-review.googlesource.com/756207
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
4 files changed