All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH 3/3] ima-evm-utils: Allow to use Streebog hash function
Date: Tue, 27 Nov 2018 16:08:12 +0300	[thread overview]
Message-ID: <20181127130812.ad3t3uflxkagttuf@sole.flsd.net> (raw)
In-Reply-To: <1543319811.3902.134.camel@linux.ibm.com>

Mimi,

On Tue, Nov 27, 2018 at 06:56:51AM -0500, Mimi Zohar wrote:
> On Mon, 2018-11-26 at 07:39 +0300, Vitaly Chikunov wrote:
> <snip>
> > diff --git a/src/imaevm.h b/src/imaevm.h
> > index 1bafaad..1a5ebbe 100644
> > --- a/src/imaevm.h
> > +++ b/src/imaevm.h
> > @@ -149,6 +149,7 @@ struct signature_hdr {
> >  	char mpi[0];
> >  } __packed;
> > 
> > +/* reflect enum hash_algo from include/uapi/linux/hash_info.h */
> >  enum pkey_hash_algo {
> >  	PKEY_HASH_MD4,
> >  	PKEY_HASH_MD5,
> > @@ -158,6 +159,18 @@ enum pkey_hash_algo {
> >  	PKEY_HASH_SHA384,
> >  	PKEY_HASH_SHA512,
> >  	PKEY_HASH_SHA224,
> > +	PKEY_HASH_RIPE_MD_128,
> > +	PKEY_HASH_RIPE_MD_256,
> > +	PKEY_HASH_RIPE_MD_320,
> > +	PKEY_HASH_WP_256,
> > +	PKEY_HASH_WP_384,
> > +	PKEY_HASH_WP_512,
> > +	PKEY_HASH_TGR_128,
> > +	PKEY_HASH_TGR_160,
> > +	PKEY_HASH_TGR_192,
> > +	PKEY_HASH_SM3_256,
> > +	PKEY_HASH_STREEBOG_256,
> > +	PKEY_HASH_STREEBOG_512,
> >  	PKEY_HASH__LAST
> >  };
> > 
> > diff --git a/src/libimaevm.c b/src/libimaevm.c
> > index 714f1ac..8f74660 100644
> > --- a/src/libimaevm.c
> > +++ b/src/libimaevm.c
> > @@ -50,6 +50,7 @@
> >  #include <string.h>
> >  #include <stdio.h>
> > 
> > +#include <openssl/crypto.h>
> >  #include <openssl/pem.h>
> >  #include <openssl/evp.h>
> >  #include <openssl/x509.h>
> > @@ -66,6 +67,8 @@ 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] = "streebog256",
> > +	[PKEY_HASH_STREEBOG_512] = "streebog512",
> >  };
> 
> hash_info.h is now included in kernel-headers package.

I think, first it should not be coincided with the new algo adding and
being follow-up patch (if any).

> Anyone using the hash_algo enumeration defined in hash_info.h, will
> probably also want to use an associated algorithm name.  It would make
> more sense to keep the hash_algo enumeration, hash_algo_name[], and
> perhaps the hash_digest_size[] together.  Maybe using macros to keep
> them in sync (eg. kernel_read_file_id/kernel_read_file_str).

On the first sight this sounds good, but...

It sounds like it will require patching kernel's hash_info.h, so it will
be not possible to transfer smoothly on the new scheme without breaking
some compatibility (of the newer ima-evm-utils with older kernels). Also,
it is possible that ima-evm-utils is used on the older stable box (where some
reliable and stable build system run) which does not have such modification
and/or new algorithms in the kernel but willing to generate signatures.

So, I think code duplication between projects is good in this case.

Some hash algorithms may be wished to be compatible with rsa pkcs1
signature scheme, which is also defined in kernel in
crypto/rsa-pkcs1pad.c and in ima-evm-utils in src/libimaevm.c so code
duplication and adding algorithms in both sources will happen anyway.

Thanks,


> As new algorithms are added to hash_info.h, nothing would need to be
> done here in ima-evm-utils, other than updating the maximum digest
> size.
> 
> What do you think?
> 
> Mimi

  reply	other threads:[~2018-11-27 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26  4:39 [PATCH 1/3] ima-avm-utils: Fix hash buffer overflow in verify_evm Vitaly Chikunov
2018-11-26  4:39 ` [PATCH 2/3] ima-evm-utils: Add --xattr-user option for testing Vitaly Chikunov
2018-11-27 11:55   ` Mimi Zohar
2018-11-26  4:39 ` [PATCH 3/3] ima-evm-utils: Allow to use Streebog hash function Vitaly Chikunov
2018-11-27 11:56   ` Mimi Zohar
2018-11-27 13:08     ` Vitaly Chikunov [this message]
2018-11-27 13:33       ` Mimi Zohar
2018-11-26 13:45 ` [PATCH 1/3] ima-avm-utils: Fix hash buffer overflow in verify_evm Vitaly Chikunov
2018-11-27 11:52 ` 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=20181127130812.ad3t3uflxkagttuf@sole.flsd.net \
    --to=vt@altlinux.org \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.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.