Make `cryptohome::Tpm` independent of Cryptohome.
1. Decouple `Tpm` from `TpmInit`.
2. Build TPM into libcrostpm.
3. Move initialization of the TPM from `Tpm` to `TpmInit`.
House keeping functions such as `LoadTpmStatus`, `StoreTpmStatus`, are
moved to `TpmInit`.
Functions related to owner passwords are also moved to `TpmInit`.
4. Move all key loading/saving out of `Tpm` into `TpmInit`.
`Tpm::Init` is removed. `Tpm` no longer depends on `Platform`.
`Tpm` instances now MUST be handed handles to context and key in order for
it to perform any cryptographic operations.
`TpmInit` can load the key blobs on disk. See
5. `CreateCryptohomeKey` is replaced with `CreateWrappedRsaKey`. The later
function uses OpenSSL to generate an RSA key and wraps it with SRK.
6. Add `MockTpmInit`.
7. Make dependency injection clearer in `Init` function. The idiom is:
construct an object with default constructor then call `Init` and
pass in necessary dependencies.
TEST=create an account on the device before applying this CL. download
some files to its home dir.
TEST=then apply this CL. do it in a way that does not wipe out stateful
TEST=do the combo (login, let it idle for a minute or two, reboot) a few
times. make sure that the existing accounts can still be used and
downloaded files are still there.
TEST=also make sure that new accounts and guests can login.
TEST=`stop cryptohomed`, then run `cryptohomed --noclose`, make sure
that there is no apparent problems or warnings related to TPM in the log.
Reviewed-by: Darren Krahn <firstname.lastname@example.org>
Tested-by: Nam Nguyen <email@example.com>
Commit-Queue: Nam Nguyen <firstname.lastname@example.org>
35 files changed