Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Bruno Meneguele <bmeneg@redhat.com>
To: Vitaly Chikunov <vt@altlinux.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH ima-evm-utils v2] Use secure heap for private keys and passwords
Date: Fri, 20 Aug 2021 10:08:17 -0300	[thread overview]
Message-ID: <YR+pQabnJwsV9nUA@glitch> (raw)
In-Reply-To: <20210819220445.vbytidpcm7tiou5l@altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]

On Fri, Aug 20, 2021 at 01:04:45AM +0300, Vitaly Chikunov wrote:
> Bruno,
> 
> On Thu, Aug 19, 2021 at 03:28:17PM -0300, Bruno Meneguele wrote:
> > On Thu, Aug 19, 2021 at 05:11:36AM +0300, Vitaly Chikunov wrote:
> > > After CRYPTO_secure_malloc_init OpenSSL will store private keys in
> > > secure heap. This facility is only available since OpenSSL_1_1_0-pre1.
> > > 
> > > Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
> > > ---
> > > Change from v1:
> > > - Do not use setfbuf to disable buffering as this is not proven to be
> > >   meaningful.
> > > - Use secure heap for passwords too as suggested by Mimi Zohar.
> > > - Fallback to OPENSSL_malloc for old OpenSSL as suggested by Mimi Zohar.
> > > - Simplify logic of calling CRYPTO_secure_malloc_init (call it always on
> > >   OpenSSL init.)
> > > - Should be applied after Bruno Meneguele's "evmctl: fix memory leak in
> > >   get_password" patch v2.
> > > 
> > >  src/evmctl.c | 143 ++++++++++++++++++++++++++++++++++++++++++---------
> > >  1 file changed, 118 insertions(+), 25 deletions(-)
> > > 
> > > diff --git a/src/evmctl.c b/src/evmctl.c
> > > index 5f7c2b8..a27e0b9 100644
> > > --- a/src/evmctl.c
> > > +++ b/src/evmctl.c
> > > @@ -59,6 +59,7 @@
> > >  #include <assert.h>
> > >  
> > >  #include <openssl/asn1.h>
> > > +#include <openssl/crypto.h>
> > >  #include <openssl/sha.h>
> > >  #include <openssl/pem.h>
> > >  #include <openssl/hmac.h>
> > > @@ -165,6 +166,24 @@ struct tpm_bank_info {
> > >  static char *pcrfile[MAX_PCRFILE];
> > >  static unsigned npcrfile;
> > >  
> > > +#if OPENSSL_VERSION_NUMBER <= 0x10100000
> > > +#warning Your OpenSSL version is too old to have OPENSSL_secure_malloc, \
> > > +	falling back to use plain OPENSSL_malloc.
> > > +#define OPENSSL_secure_malloc	  OPENSSL_malloc
> > > +#define OPENSSL_secure_free	  OPENSSL_free
> > > +/*
> > > + * Secure heap memory automatically cleared on free, but
> > > + * OPENSSL_secure_clear_free will be used in case of fallback
> > 
> > Shouldn't it be OPENSSL_clear_free instead of OPENSLL_secure_clear_free
> > in the setence above?
> 
> No. I meant our code will use OPENSSL_secure_clear_free, so when there
> is no secure heap it will fallback to OPENSSL_clear_free (and not just
> to OPENSSL_free if we used OPENSSL_secure_free).
> 
> Thanks,
> 

Ah ok, I misread the sentence.
Thanks for the clarification.

It seems you'll send a new version of the patch, right?
Will review that as soon as it lands.

Many thanks.

-- 
bmeneg 
PGP Key: http://bmeneg.com/pubkey.txt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-08-20 13:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  2:11 [PATCH ima-evm-utils v2] Use secure heap for private keys and passwords Vitaly Chikunov
2021-08-19 18:06 ` Mimi Zohar
2021-08-19 18:12   ` Vitaly Chikunov
2021-08-19 18:27     ` Bruno Meneguele
2021-08-19 20:11       ` Mimi Zohar
2021-08-19 20:10     ` Mimi Zohar
2021-08-19 18:28 ` Bruno Meneguele
2021-08-19 22:04   ` Vitaly Chikunov
2021-08-20 13:08     ` Bruno Meneguele [this message]
2021-08-19 21:20 ` Vitaly Chikunov
2021-08-19 21:42 ` Vitaly Chikunov
2021-08-19 22:21   ` Vitaly Chikunov

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=YR+pQabnJwsV9nUA@glitch \
    --to=bmeneg@redhat.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=vt@altlinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox