tpm_lite: Add function to retrieve the STCLEAR flags

Change-Id: I0845a909616bed0e7289971ae2941562d1a8c85f
diff --git a/common/tlcl.c b/common/tlcl.c
index ead5256..999a99f 100644
--- a/common/tlcl.c
+++ b/common/tlcl.c
@@ -307,6 +307,21 @@
 	return result;
 }
 
+uint32_t tlcl_get_stclear_flags(TPM_STCLEAR_FLAGS *sflags)
+{
+	uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
+	uint32_t size;
+	uint32_t result = tlcl_send_receive(tpm_getstclearflags_cmd.buffer, response,
+	                                    sizeof(response));
+	if (result != TPM_SUCCESS)
+		return result;
+	from_tpm_uint32(response + kTpmResponseHeaderLength, &size);
+	assert(size == sizeof(TPM_STCLEAR_FLAGS));
+	memcpy(sflags, response + kTpmResponseHeaderLength + sizeof(size),
+	       sizeof(TPM_STCLEAR_FLAGS));
+	return result;
+}
+
 uint32_t tlcl_set_global_lock(void)
 {
 	uint32_t x;
diff --git a/include/tpm_lite/tlcl.h b/include/tpm_lite/tlcl.h
index 47fc76b..7e7bbf9 100644
--- a/include/tpm_lite/tlcl.h
+++ b/include/tpm_lite/tlcl.h
@@ -135,6 +135,11 @@
 uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags);
 
 /**
+ * Get the entire set of stclear flags.
+ */
+uint32_t tlcl_get_stclear_flags(TPM_STCLEAR_FLAGS *sflags);
+
+/**
  * Read a PCR
  */
 uint32_t tlcl_read_pcr(int pcr_num, uint8_t* out_digest);