linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Tadeusz Struk <tstruk@gmail.com>, herbert@gondor.apana.org.au
Cc: tadeusz.struk@intel.com, smueller@chronox.de,
	linux-api@vger.kernel.org, marcel@holtmann.org,
	linux-kernel@vger.kernel.org, dhowells@redhat.com,
	keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
	zohar@linux.vnet.ibm.com
Subject: Re: [PATCH v2] crypto: AF_ALG - add support for keys/asymmetric-type
Date: Wed, 13 Jan 2016 12:27:42 +0000	[thread overview]
Message-ID: <1452688062.88154.32.camel@infradead.org> (raw)
In-Reply-To: <20151226155014.27615.14985.stgit@desktop.home>

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

On Sat, 2015-12-26 at 07:50 -0800, Tadeusz Struk wrote:
> +static int alg_setkey_id(void *private, const u8 *key, unsigned int keylen,
> +                        int (*setkey)(void *private, const u8 *key,
> +                                      unsigned int keylen))
> +{
> +       struct key *keyring;
> +       struct public_key *pkey;
> +       char key_name[12];
> +       u32 keyid = *((u32 *)key);
> +       int err;
> +
> +       sprintf(key_name, "id:%08x", keyid);
> +       keyring = request_key(&key_type_asymmetric, key_name, NULL);
> +
> +       err = -ENOKEY;
> +       if (IS_ERR(keyring))
> +               goto out;
> +
> +       pkey = keyring->payload.data[asym_crypto];
> +       if (!pkey) {
> +               key_put(keyring);
> +               goto out;
> +       }
> +
> +       err = setkey(private, pkey->key, pkey->keylen);
> +       key_put(keyring);
> +
> +out:
> +       return err;
> +}

This seems entirely wrong to me. You cannot just assume that the
private key data are available in software form to the kernel and can
be extracted.

Please ensure you test this with a key in a TPM, or in a SGX software
enclave or something like that.

David, is there a way to do that test purely in software without
needing hardware support? We know that the data might not actually be
present in all cases... is there an easy test for that case?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

  parent reply	other threads:[~2016-01-13 12:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-26 15:50 [PATCH v2] crypto: AF_ALG - add support for keys/asymmetric-type Tadeusz Struk
     [not found] ` <20151226155014.27615.14985.stgit-r49W/1Cwd2f9zxVx7UNMDg@public.gmane.org>
2016-01-12  5:56   ` Tadeusz Struk
2016-01-13 12:27 ` David Woodhouse [this message]
2016-01-13 13:31 ` David Howells
     [not found]   ` <10464.1452691882-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2016-01-13 14:05     ` Tadeusz Struk
     [not found]       ` <569659AC.9070506-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-01-13 15:06         ` David Woodhouse
     [not found]           ` <1452697593.88154.49.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-01-13 16:14             ` Tadeusz Struk
2016-01-16 10:51               ` David Howells
     [not found] ` <1452688062.88154.32.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-01-13 13:36   ` David Howells
2016-01-13 13:45     ` David Woodhouse
2016-01-13 13:52   ` Tadeusz Struk

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=1452688062.88154.32.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=smueller@chronox.de \
    --cc=tadeusz.struk@intel.com \
    --cc=tstruk@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).