linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
To: linux-modules <linux-modules@vger.kernel.org>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>,
	Mark van Dijk <linux-modules@z.dvxs.net>
Subject: [PATCH 4/4] libkmod: modinfo: implement signature output
Date: Tue, 11 Apr 2017 15:15:03 +0300	[thread overview]
Message-ID: <20170411121503.26181-5-yauheni.kaliuta@redhat.com> (raw)
In-Reply-To: <20170411121503.26181-1-yauheni.kaliuta@redhat.com>

Signature was ignored from the modinfo. Implement its parsing
from the module data and add its output to the modinfo utility.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
---
 libkmod/libkmod-internal.h  | 2 ++
 libkmod/libkmod-module.c    | 9 +++++++++
 libkmod/libkmod-signature.c | 6 +++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
index 4d9db6bc7845..346579c71aab 100644
--- a/libkmod/libkmod-internal.h
+++ b/libkmod/libkmod-internal.h
@@ -186,5 +186,7 @@ struct kmod_signature_info {
 	const char *key_id;
 	size_t key_id_len;
 	const char *algo, *hash_algo, *id_type;
+	const char *sig;
+	size_t sig_len;
 };
 bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signature_info *sig_info) _must_check_ __attribute__((nonnull(1, 2)));
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 9e155f080277..0a3ef11c860f 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -2344,6 +2344,15 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_
 		 * Omit sig_info.algo for now, as these
 		 * are currently constant.
 		 */
+		n = kmod_module_info_append_hex(list, "signature",
+						strlen("signature"),
+						sig_info.sig,
+						sig_info.sig_len);
+
+		if (n == NULL)
+			goto list_error;
+		count++;
+
 	}
 	ret = count;
 
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index ef5fe6e7bb7f..1f3e26dea203 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -134,7 +134,11 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
 	    size < (int64_t)(modsig->signer_len + modsig->key_id_len + sig_len))
 		return false;
 
-	size -= modsig->key_id_len + sig_len;
+	size -= sig_len;
+	sig_info->sig = mem + size;
+	sig_info->sig_len = sig_len;
+
+	size -= modsig->key_id_len;
 	sig_info->key_id = mem + size;
 	sig_info->key_id_len = modsig->key_id_len;
 
-- 
2.9.2.368.g08bb350

  parent reply	other threads:[~2017-04-11 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 12:14 [PATCH 0/4] modinfo: fix sig_id key and add signature output Yauheni Kaliuta
2017-04-11 12:15 ` [PATCH 1/4] libkmod: modinfo: fix sig_id output Yauheni Kaliuta
2017-04-11 12:15 ` [PATCH 2/4] libkmod: modinfo: use own function for sig_key hex output Yauheni Kaliuta
2017-04-11 12:15 ` [PATCH 3/4] libkmod: modinfo: implement line splitting in hex_to_str Yauheni Kaliuta
2017-04-11 12:15 ` Yauheni Kaliuta [this message]
2017-04-11 16:10 ` [PATCH 0/4] modinfo: fix sig_id key and add signature output Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170411121503.26181-5-yauheni.kaliuta@redhat.com \
    --to=yauheni.kaliuta@redhat.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-modules@z.dvxs.net \
    --cc=lucas.de.marchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).