From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752356AbbFLC74 (ORCPT ); Thu, 11 Jun 2015 22:59:56 -0400 Received: from helcar.hengli.com.au ([209.40.204.226]:38205 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbbFLC7y (ORCPT ); Thu, 11 Jun 2015 22:59:54 -0400 Date: Fri, 12 Jun 2015 10:59:40 +0800 From: Herbert Xu To: Tadeusz Struk Cc: linux-kernel@vger.kernel.org, keescook@chromium.org, jwboyer@redhat.com, richard@nod.at, steved@redhat.com, qat-linux@intel.com, dhowells@redhat.com, linux-crypto@vger.kernel.org, james.l.morris@oracle.com, jkosina@suse.cz, zohar@linux.vnet.ibm.com, davem@davemloft.net, vgoyal@redhat.com Subject: Re: [PATCH RFC v4 2/4] crypto: add PKE API Message-ID: <20150612025940.GC30982@gondor.apana.org.au> References: <20150611190533.31826.13956.stgit@tstruk-mobl1> <20150611190543.31826.357.stgit@tstruk-mobl1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150611190543.31826.357.stgit@tstruk-mobl1> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2015 at 12:05:44PM -0700, Tadeusz Struk wrote: > > +int crypto_akcipher_setkey(struct crypto_akcipher *tfm, > + const struct public_key *pkey) > +{ > + if (tfm->pkey) > + akcipher_free_key(tfm->pkey); > + > + return akcipher_clone_key(tfm, pkey); > +} No please do not expose the struct public_key crap to the new API. The key should be completely opaque to entities outside of the algorithm. So make it raw and read out the MPIs from it. The contents of the function must go into the algorithm setkey function, not the crypto API. So RSA would read out however many MPIs it needs and verify it, and so on. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt