All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: [PATCH 2/2] ima-evm-utils: try to load digest by its alias
Date: Sat, 23 Mar 2019 04:41:52 +0300	[thread overview]
Message-ID: <20190323014152.14701-3-vt@altlinux.org> (raw)
In-Reply-To: <20190323014152.14701-1-vt@altlinux.org>

Primary names of the algorithms are different for OpenSSL and Kernel.
Allow to use both of them.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 src/libimaevm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/libimaevm.c b/src/libimaevm.c
index bc7be1e..6783110 100644
--- a/src/libimaevm.c
+++ b/src/libimaevm.c
@@ -61,6 +61,7 @@
 #include "imaevm.h"
 #include "hash_info.h"
 
+/* Names that are primary for OpenSSL. */
 const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
 	[PKEY_HASH_MD4]		= "md4",
 	[PKEY_HASH_MD5]		= "md5",
@@ -70,6 +71,12 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
 	[PKEY_HASH_SHA384]	= "sha384",
 	[PKEY_HASH_SHA512]	= "sha512",
 	[PKEY_HASH_SHA224]	= "sha224",
+	[PKEY_HASH_STREEBOG_256] = "md_gost12_256",
+	[PKEY_HASH_STREEBOG_512] = "md_gost12_512",
+};
+
+/* Names that are primary for the kernel. */
+const char *const pkey_hash_algo_kern[PKEY_HASH__LAST] = {
 	[PKEY_HASH_STREEBOG_256] = "streebog256",
 	[PKEY_HASH_STREEBOG_512] = "streebog512",
 };
@@ -551,6 +558,11 @@ int get_hash_algo(const char *algo)
 		    !strcmp(algo, pkey_hash_algo[i]))
 			return i;
 
+	for (i = 0; i < PKEY_HASH__LAST; i++)
+		if (pkey_hash_algo_kern[i] &&
+		    !strcmp(algo, pkey_hash_algo_kern[i]))
+			return i;
+
 	/* iterate over algorithms provided by kernel-headers */
 	for (i = 0; i < HASH_ALGO__LAST; i++)
 		if (hash_algo_name[i] &&
-- 
2.11.0


  parent reply	other threads:[~2019-03-23  1:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23  1:41 [PATCH 0/2] ima-evm-utils: rebase of digest algo resolving Vitaly Chikunov
2019-03-23  1:41 ` [PATCH 1/2] ima-evm-utils: Extract digest algorithms from hash_info.h Vitaly Chikunov
2019-03-23  1:41 ` Vitaly Chikunov [this message]
2019-04-03 20:41   ` [PATCH 2/2] ima-evm-utils: try to load digest by its alias Mimi Zohar
2019-04-03 21:04     ` Vitaly Chikunov
2019-04-03 21:10       ` Mimi Zohar
2019-04-03 21:37         ` Vitaly Chikunov
2019-04-03 21:40           ` Mimi Zohar
2019-04-03 21:57             ` Vitaly Chikunov
2019-04-03 21:59               ` Mimi Zohar

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=20190323014152.14701-3-vt@altlinux.org \
    --to=vt@altlinux.org \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.