diff mbox

[4/6] uefi: uefidump: Add support for dumping MemoryOverwriteRequestControl.

Message ID 1346687565-32320-5-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Sept. 3, 2012, 3:52 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The MemoryOverwriteRequestControl variable is defined in section 5.0
of the TCG Platform Reset Attack Mitigation Specification and it is
being used on various platforms.  Add it to uefidump.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/uefi/uefidump/uefidump.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

ivanhu Sept. 5, 2012, 7:22 a.m. UTC | #1
On 09/03/2012 11:52 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The MemoryOverwriteRequestControl variable is defined in section 5.0
> of the TCG Platform Reset Attack Mitigation Specification and it is
> being used on various platforms.  Add it to uefidump.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/uefi/uefidump/uefidump.c |   29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 96d294c..8f4c788 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -573,6 +573,34 @@ static void uefidump_info_setup_mode(fwts_framework *fw, fwts_uefi_var *var)
>   	}
>   }
>
> +/*
> + *  See TCG Platform Reset Attack Mitigation Specification, Revision 1.0,
> + *  section 5.
> + */
> +static void uefidump_info_morc(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +	if (var->datalen != 1) {
> +		/* Should be 1 byte, of not, dump it out as a hex dump */
> +		uefidump_var_hexdump(fw, var);
> +	} else {
> +		char *mode;
> +		uint8_t value = (uint8_t)var->data[0];
> +
> +		switch (value & 1) {
> +		case 0:
> +			mode = " (Firmware should not clear memory on reboot)";
> +			break;
> +		case 1:
> +			mode = " (Firmware should clear memory on reboot)";
> +			break;
> +		default:
> +			mode = "";
> +			break;
> +		}
> +		fwts_log_info_verbatum(fw, "  Value: 0x%2.2x%s.", value, mode);
> +	}
> +}
> +
>   static uefidump_info uefidump_info_table[] = {
>   	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>   	{ "PlatformLang",	uefidump_info_platform_lang },
> @@ -594,6 +622,7 @@ static uefidump_info uefidump_info_table[] = {
>   	{ "dump-type0-",	uefidump_info_dump_type0 },
>   	{ "SecureBoot",		uefidump_info_secure_boot },
>   	{ "SetupMode",		uefidump_info_setup_mode },
> +	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
>   	{ NULL, NULL }
>   };
>
>


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin Sept. 11, 2012, 5:55 a.m. UTC | #2
On Mon, Sep 3, 2012 at 11:52 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The MemoryOverwriteRequestControl variable is defined in section 5.0
> of the TCG Platform Reset Attack Mitigation Specification and it is
> being used on various platforms.  Add it to uefidump.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefidump/uefidump.c |   29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 96d294c..8f4c788 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -573,6 +573,34 @@ static void uefidump_info_setup_mode(fwts_framework *fw, fwts_uefi_var *var)
>         }
>  }
>
> +/*
> + *  See TCG Platform Reset Attack Mitigation Specification, Revision 1.0,
> + *  section 5.
> + */
> +static void uefidump_info_morc(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +       if (var->datalen != 1) {
> +               /* Should be 1 byte, of not, dump it out as a hex dump */
> +               uefidump_var_hexdump(fw, var);
> +       } else {
> +               char *mode;
> +               uint8_t value = (uint8_t)var->data[0];
> +
> +               switch (value & 1) {
> +               case 0:
> +                       mode = " (Firmware should not clear memory on reboot)";
> +                       break;
> +               case 1:
> +                       mode = " (Firmware should clear memory on reboot)";
> +                       break;
> +               default:
> +                       mode = "";
> +                       break;
> +               }
> +               fwts_log_info_verbatum(fw, "  Value: 0x%2.2x%s.", value, mode);
> +       }
> +}
> +
>  static uefidump_info uefidump_info_table[] = {
>         { "PlatformLangCodes",  uefidump_info_platform_langcodes },
>         { "PlatformLang",       uefidump_info_platform_lang },
> @@ -594,6 +622,7 @@ static uefidump_info uefidump_info_table[] = {
>         { "dump-type0-",        uefidump_info_dump_type0 },
>         { "SecureBoot",         uefidump_info_secure_boot },
>         { "SetupMode",          uefidump_info_setup_mode },
> +       { "MemoryOverwriteRequestControl",      uefidump_info_morc },
>         { NULL, NULL }
>  };
>
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 96d294c..8f4c788 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -573,6 +573,34 @@  static void uefidump_info_setup_mode(fwts_framework *fw, fwts_uefi_var *var)
 	}
 }
 
+/*
+ *  See TCG Platform Reset Attack Mitigation Specification, Revision 1.0,
+ *  section 5.
+ */
+static void uefidump_info_morc(fwts_framework *fw, fwts_uefi_var *var)
+{
+	if (var->datalen != 1) {
+		/* Should be 1 byte, of not, dump it out as a hex dump */
+		uefidump_var_hexdump(fw, var);
+	} else {
+		char *mode;
+		uint8_t value = (uint8_t)var->data[0];
+
+		switch (value & 1) {
+		case 0:
+			mode = " (Firmware should not clear memory on reboot)";
+			break;
+		case 1:
+			mode = " (Firmware should clear memory on reboot)";
+			break;
+		default:
+			mode = "";
+			break;
+		}
+		fwts_log_info_verbatum(fw, "  Value: 0x%2.2x%s.", value, mode);
+	}
+}
+
 static uefidump_info uefidump_info_table[] = {
 	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
 	{ "PlatformLang",	uefidump_info_platform_lang },
@@ -594,6 +622,7 @@  static uefidump_info uefidump_info_table[] = {
 	{ "dump-type0-",	uefidump_info_dump_type0 },
 	{ "SecureBoot",		uefidump_info_secure_boot },
 	{ "SetupMode",		uefidump_info_setup_mode },
+	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
 	{ NULL, NULL }
 };