diff mbox

[6/6] uefi: uefidump: Add support for SignatureSupport variable

Message ID 1346687565-32320-7-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>

SignatureSupport contains an array of GUIDs, so it is relatively
easy to dump out, so add it to uefidump.

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

Comments

ivanhu Sept. 5, 2012, 7:23 a.m. UTC | #1
On 09/03/2012 11:52 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> SignatureSupport contains an array of GUIDs, so it is relatively
> easy to dump out, so add it to uefidump.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index d7f4dd6..71c0cc5 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -617,6 +617,30 @@ static void uefidump_info_acpi_global_variable(fwts_framework *fw, fwts_uefi_var
>   	}
>   }
>
> +/*
> + *  Dump Supported Signature GUIDs
> + */
> +static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +	if (var->datalen % 16) {
> +		/* Should be multiple of 16 bytes, of not, dump it out as a hex dump */
> +		uefidump_var_hexdump(fw, var);
> +	} else {
> +		/* Signatures are an array of GUIDs */
> +		uint8_t *data = var->data;
> +		char guid_str[37];
> +
> +		if (var->datalen)
> +			fwts_log_info_verbatum(fw, "  Signature GUIDs:");
> +
> +		while (data - var->data < var->datalen) {
> +			fwts_guid_buf_to_str(data, guid_str, sizeof(guid_str));
> +			fwts_log_info_verbatum(fw, "    %s", guid_str);
> +			data += 16;
> +		}
> +	}
> +}
> +
>   static uefidump_info uefidump_info_table[] = {
>   	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
>   	{ "PlatformLang",	uefidump_info_platform_lang },
> @@ -640,6 +664,7 @@ static uefidump_info uefidump_info_table[] = {
>   	{ "SetupMode",		uefidump_info_setup_mode },
>   	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
>   	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
> +	{ "SignatureSupport",	uefidump_info_signature_support },
>   	{ NULL, NULL }
>   };
>
>


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin Sept. 11, 2012, 5:56 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>
>
> SignatureSupport contains an array of GUIDs, so it is relatively
> easy to dump out, so add it to uefidump.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefidump/uefidump.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index d7f4dd6..71c0cc5 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -617,6 +617,30 @@ static void uefidump_info_acpi_global_variable(fwts_framework *fw, fwts_uefi_var
>         }
>  }
>
> +/*
> + *  Dump Supported Signature GUIDs
> + */
> +static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *var)
> +{
> +       if (var->datalen % 16) {
> +               /* Should be multiple of 16 bytes, of not, dump it out as a hex dump */
> +               uefidump_var_hexdump(fw, var);
> +       } else {
> +               /* Signatures are an array of GUIDs */
> +               uint8_t *data = var->data;
> +               char guid_str[37];
> +
> +               if (var->datalen)
> +                       fwts_log_info_verbatum(fw, "  Signature GUIDs:");
> +
> +               while (data - var->data < var->datalen) {
> +                       fwts_guid_buf_to_str(data, guid_str, sizeof(guid_str));
> +                       fwts_log_info_verbatum(fw, "    %s", guid_str);
> +                       data += 16;
> +               }
> +       }
> +}
> +
>  static uefidump_info uefidump_info_table[] = {
>         { "PlatformLangCodes",  uefidump_info_platform_langcodes },
>         { "PlatformLang",       uefidump_info_platform_lang },
> @@ -640,6 +664,7 @@ static uefidump_info uefidump_info_table[] = {
>         { "SetupMode",          uefidump_info_setup_mode },
>         { "MemoryOverwriteRequestControl",      uefidump_info_morc },
>         { "AcpiGlobalVariable", uefidump_info_acpi_global_variable },
> +       { "SignatureSupport",   uefidump_info_signature_support },
>         { 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 d7f4dd6..71c0cc5 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -617,6 +617,30 @@  static void uefidump_info_acpi_global_variable(fwts_framework *fw, fwts_uefi_var
 	}
 }
 
+/*
+ *  Dump Supported Signature GUIDs
+ */
+static void uefidump_info_signature_support(fwts_framework *fw, fwts_uefi_var *var)
+{
+	if (var->datalen % 16) {
+		/* Should be multiple of 16 bytes, of not, dump it out as a hex dump */
+		uefidump_var_hexdump(fw, var);
+	} else {
+		/* Signatures are an array of GUIDs */
+		uint8_t *data = var->data;
+		char guid_str[37];
+
+		if (var->datalen)
+			fwts_log_info_verbatum(fw, "  Signature GUIDs:");
+
+		while (data - var->data < var->datalen) {
+			fwts_guid_buf_to_str(data, guid_str, sizeof(guid_str));
+			fwts_log_info_verbatum(fw, "    %s", guid_str);
+			data += 16;
+		}
+	}
+}
+
 static uefidump_info uefidump_info_table[] = {
 	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
 	{ "PlatformLang",	uefidump_info_platform_lang },
@@ -640,6 +664,7 @@  static uefidump_info uefidump_info_table[] = {
 	{ "SetupMode",		uefidump_info_setup_mode },
 	{ "MemoryOverwriteRequestControl",	uefidump_info_morc },
 	{ "AcpiGlobalVariable",	uefidump_info_acpi_global_variable },
+	{ "SignatureSupport",	uefidump_info_signature_support },
 	{ NULL, NULL }
 };