2013-06-07 18:03:56 +00:00
|
|
|
From 232b501f28ef5a2b6c67a73a4b3babe8a3457330 Mon Sep 17 00:00:00 2001
|
2013-05-02 20:54:52 +00:00
|
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
|
Date: Sun, 13 Jan 2013 17:49:05 +0100
|
2013-06-12 19:24:37 +00:00
|
|
|
Subject: [PATCH 104/482] New command list_trusted.
|
2013-05-02 20:54:52 +00:00
|
|
|
|
|
|
|
* grub-core/commands/verify.c (grub_cmd_list): New function.
|
|
|
|
---
|
|
|
|
ChangeLog | 6 ++++++
|
|
|
|
grub-core/commands/verify.c | 31 ++++++++++++++++++++++++++-----
|
|
|
|
2 files changed, 32 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
|
|
index 784d737..6bb855b 100644
|
|
|
|
--- a/ChangeLog
|
|
|
|
+++ b/ChangeLog
|
|
|
|
@@ -1,3 +1,9 @@
|
|
|
|
+2013-01-13 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
+
|
|
|
|
+ New command list_trusted.
|
|
|
|
+
|
|
|
|
+ * grub-core/commands/verify.c (grub_cmd_list): New function.
|
|
|
|
+
|
|
|
|
2013-01-13 Colin Watson <cjwatson@ubuntu.com>
|
|
|
|
|
|
|
|
* util/grub-mkimage.c (generate_image): Fix "size of public key"
|
|
|
|
diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c
|
|
|
|
index 66a027f..d399d0f 100644
|
|
|
|
--- a/grub-core/commands/verify.c
|
|
|
|
+++ b/grub-core/commands/verify.c
|
|
|
|
@@ -298,10 +298,6 @@ grub_load_public_key (grub_file_t f)
|
|
|
|
*last = sk;
|
|
|
|
last = &sk->next;
|
|
|
|
|
|
|
|
- for (i = 0; i < 20; i += 2)
|
|
|
|
- grub_printf ("%02x%02x ", ((grub_uint8_t *) sk->fingerprint)[i], ((grub_uint8_t *) sk->fingerprint)[i + 1]);
|
|
|
|
- grub_printf ("\n");
|
|
|
|
-
|
|
|
|
grub_dprintf ("crypt", "actual pos: %x, expected: %x\n", (int)grub_file_tell (f), (int)pend);
|
|
|
|
|
|
|
|
grub_file_seek (f, pend);
|
|
|
|
@@ -557,6 +553,27 @@ grub_cmd_trust (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
}
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
+grub_cmd_list (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
+ int argc __attribute__ ((unused)),
|
|
|
|
+ char **args __attribute__ ((unused)))
|
|
|
|
+{
|
|
|
|
+ struct grub_public_key *pk = NULL;
|
|
|
|
+ struct grub_public_subkey *sk = NULL;
|
|
|
|
+
|
|
|
|
+ for (pk = grub_pk_trusted; pk; pk = pk->next)
|
|
|
|
+ for (sk = pk->subkeys; sk; sk = sk->next)
|
|
|
|
+ {
|
|
|
|
+ unsigned i;
|
|
|
|
+ for (i = 0; i < 20; i += 2)
|
|
|
|
+ grub_printf ("%02x%02x ", ((grub_uint8_t *) sk->fingerprint)[i],
|
|
|
|
+ ((grub_uint8_t *) sk->fingerprint)[i + 1]);
|
|
|
|
+ grub_printf ("\n");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return GRUB_ERR_NONE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static grub_err_t
|
|
|
|
grub_cmd_distrust (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
int argc, char **args)
|
|
|
|
{
|
|
|
|
@@ -701,7 +718,7 @@ struct gcry_pk_spec *grub_crypto_pk_dsa;
|
|
|
|
struct gcry_pk_spec *grub_crypto_pk_ecdsa;
|
|
|
|
struct gcry_pk_spec *grub_crypto_pk_rsa;
|
|
|
|
|
|
|
|
-static grub_command_t cmd, cmd_trust, cmd_distrust;
|
|
|
|
+static grub_command_t cmd, cmd_trust, cmd_distrust, cmd_list;
|
|
|
|
|
|
|
|
GRUB_MOD_INIT(verify)
|
|
|
|
{
|
|
|
|
@@ -752,6 +769,9 @@ GRUB_MOD_INIT(verify)
|
|
|
|
cmd_trust = grub_register_command ("trust", grub_cmd_trust,
|
|
|
|
N_("PUBKEY_FILE"),
|
|
|
|
N_("Add PKFILE to trusted keys."));
|
|
|
|
+ cmd_list = grub_register_command ("list_trusted", grub_cmd_list,
|
|
|
|
+ 0,
|
|
|
|
+ N_("List trusted keys."));
|
|
|
|
cmd_distrust = grub_register_command ("distrust", grub_cmd_distrust,
|
|
|
|
N_("PUBKEY_ID"),
|
|
|
|
N_("Remove KEYID from trusted keys."));
|
|
|
|
@@ -762,5 +782,6 @@ GRUB_MOD_FINI(verify)
|
|
|
|
grub_file_filter_unregister (GRUB_FILE_FILTER_PUBKEY);
|
|
|
|
grub_unregister_command (cmd);
|
|
|
|
grub_unregister_command (cmd_trust);
|
|
|
|
+ grub_unregister_command (cmd_list);
|
|
|
|
grub_unregister_command (cmd_distrust);
|
|
|
|
}
|
|
|
|
--
|
2013-06-07 18:03:56 +00:00
|
|
|
1.8.2.1
|
2013-05-02 20:54:52 +00:00
|
|
|
|