CHERRY-PICK: mount-encrypted: report numeric results on TPM failure

To help identify the specific failure conditions encountered when the
TPM goes weird, report them any time they are encountered.

BUG=chrome-os-partner:15960
TEST=daisy build, manual testing
BRANCH=none

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38468
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
(cherry picked from commit b08c46a0dad2c0eb2f8590a896bd09d3c01d43c6)

Change-Id: I197fd069ac9dfd30fb7516712a1216c7e2800099
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38873
Reviewed-by: Elly Jones <ellyjones@chromium.org>
diff --git a/utility/mount-encrypted.c b/utility/mount-encrypted.c
index 10263b7..7622cb4 100644
--- a/utility/mount-encrypted.c
+++ b/utility/mount-encrypted.c
@@ -291,7 +291,8 @@
 	/* Ignore unowned TPM's NVRAM area. */
 	result = tpm_owned(&owned);
 	if (result != TPM_SUCCESS) {
-		INFO("Could not read TPM Permanent Flags.");
+		INFO("Could not read TPM Permanent Flags: error 0x%02x.",
+		     result);
 		return 0;
 	}
 	if (!owned) {
@@ -314,7 +315,7 @@
 		result = _read_nvram(value, sizeof(value), kLockboxIndex, size);
 		if (result != TPM_SUCCESS) {
 			/* No NVRAM area at all. */
-			INFO("No NVRAM area defined.");
+			INFO("No NVRAM area defined: error 0x%02x", result);
 			return 0;
 		}
 		/* Legacy NVRAM area. */
@@ -430,7 +431,7 @@
 		result = TlclGetRandom(buffer + (wanted - remaining),
 				       remaining, &size);
 		if (result != TPM_SUCCESS || size > remaining) {
-			ERROR("TPM GetRandom failed.");
+			ERROR("TPM GetRandom failed: error 0x%02x.", result);
 			return 0;
 		}
 		remaining -= size;