linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Kernel Developers List <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 v2 1/2] crypto: add PKE API
Date: Fri, 22 May 2015 11:37:49 -0700	[thread overview]
Message-ID: <555F777D.1030509@intel.com> (raw)
In-Reply-To: <20150511063222.GB2316@gondor.apana.org.au>

On 05/10/2015 11:32 PM, Herbert Xu wrote:
> On Wed, May 06, 2015 at 12:36:48PM -0700, Tadeusz Struk wrote:
>>
>> +	const struct public_key_signature *signature;
> 
> Doing this means that you aren't adding it to the crypto API
> properly.  You need to start from scratch and design a proper
> interface and not just wrap some existing opaque data strcture.
> 
> Cheers,
> 

Hi Herbert,
Thanks for your feedback.
How about this:

/**
 * struct akcipher_request - public key request
 *
 * @base:	Common attributes for async crypto requests
 * @inparams:	scatterlist of input parameters (one ent per parameter)
 *		for the operation as defined in RFC.
 *		For instance for rsa encrypt only one input param is required,
 *		(i.e. 'm' - message) as specified in RFC3447 sec 5.1.1
 *		(Note: the key belongs to the tfm)
 * @outparams:	scatterlist of output parameters (one ent per parameter)
 *		for the operation as defined in RFC.
 *		For instance for rsa encrypt only one output param will be
 *		produced (i.e. 'c' - cipher text) as specified in
 *		RFC3447 sec 5.1.1
 *
 * @__ctx:	Start of private context data
 */
struct akcipher_request {
	struct crypto_async_request base;
	struct scatterlist *inparams;
	struct scatterlist *outparams;
	void *__ctx[] CRYPTO_MINALIGN_ATTR;
};

/**
 * struct akcipher_alg - generic public key algorithm
 *
 * @sign:	Function performs a sign operation as defined by public key
 *		algorithm
 * @verify:	Function performs a sign operation as defined by public key
 *		algorithm
 * @encrypt:	Function performs an encrypt operation as defined by public key
 *		algorithm
 * @decrypt:	Function performs a decrypt operation as defined by public key
 *		algorithm
 * @reqsize:	Request context size required by algorithm implementation
 *
 * @base:	Common crypto API algorithm data structure
 */
struct akcipher_alg {
	int (*sign)(struct akcipher_request *req);
	int (*verify)(struct akcipher_request *req);
	int (*encrypt)(struct akcipher_request *req);
	int (*decrypt)(struct akcipher_request *req);

	unsigned int reqsize;
	struct crypto_alg base;
};

/**
 * struct crypto_akcipher - user-instantiated objects which encapsulate
 * algorithms and core processing logic
 *
 * @base:	Common crypto API algorithm data structure
 * @pkey:	Key representation. Note: this can be both public or private
 *		key, depending on the operation.
 * @__ctx:	Start of private context data
 */
struct crypto_akcipher {
	struct crypto_tfm base;
	const struct public_key *pkey;
	void *__ctx[] CRYPTO_MINALIGN_ATTR;
};


  reply	other threads:[~2015-05-22 18:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 19:36 [PATCH RFC v2 0/2] crypto: Introduce Public Key Encryption API Tadeusz Struk
2015-05-06 19:36 ` [PATCH RFC v2 1/2] crypto: add PKE API Tadeusz Struk
2015-05-11  6:03   ` Herbert Xu
2015-05-11  6:24   ` Herbert Xu
2015-05-11  6:27   ` Herbert Xu
2015-05-11  6:32   ` Herbert Xu
2015-05-22 18:37     ` Tadeusz Struk [this message]
2015-05-23  5:47       ` Herbert Xu
2015-05-23 14:20         ` Tadeusz Struk
2015-05-28  4:08           ` Herbert Xu
2015-05-28 16:54             ` Tadeusz Struk
2015-06-01  5:48               ` Herbert Xu
2015-06-01 17:52                 ` Tadeusz Struk
2015-05-11 13:45   ` David Howells
2015-05-12  1:21     ` Herbert Xu
2015-05-13 15:03     ` David Howells
2015-05-14  2:59       ` Herbert Xu
2015-06-08 19:34   ` Kees Cook
2015-05-06 19:36 ` [PATCH RFC v2 2/2] crypto: RSA: KEYS: convert rsa and public key to new " 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=555F777D.1030509@intel.com \
    --to=tadeusz.struk@intel.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=james.l.morris@oracle.com \
    --cc=jkosina@suse.cz \
    --cc=jwboyer@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=richard@nod.at \
    --cc=steved@redhat.com \
    --cc=vgoyal@redhat.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).