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: Sat, 23 May 2015 07:20:15 -0700 [thread overview]
Message-ID: <55608C9F.7040500@intel.com> (raw)
In-Reply-To: <20150523054734.GA14239@gondor.apana.org.au>
On 05/22/2015 10:47 PM, Herbert Xu wrote:
>> struct akcipher_request {
>> > struct crypto_async_request base;
>> > struct scatterlist *inparams;
>> > struct scatterlist *outparams;
>> > void *__ctx[] CRYPTO_MINALIGN_ATTR;
>> > };
> I think you should rename them to src/dst and add a length argument.
> Limiting them to one entry also seems strange. When do you need more
> one parameter?
The length would be redundant. It can be obtained by sg_nents(reg->inparams)
I don't limit the number of parameters. You can pass as many as you want. For instance to pass 3 in and 2 out you do:
struct scatterlist in[3];
struct scatterlist out[2];
sg_init_table(in, 3);
sg_init_table(out, 2);
sg_set_buf(in, first_in_param, len_of_first_in_param);
sg_set_buf(in + 1, second_in_param, len_of_second_in_param);
sg_set_buf(in + 2, third_in_param, len_of_third_in_param);
sg_set_buf(out, first_out_param, len_of_first_out_param);
sg_set_buf(out + 1, second_out_param, len_of_second_out_param);
akcipher_request_set_crypt(req, &in, &out);
The limitation here is that one parameter can not span multiple sgs. This should be ok as they will never be bigger than one page.
In fact MPI limits it to 2K max with #define MAX_EXTERN_MPI_BITS 16384.
I'm ok to rename it to src and dst.
>
>> 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);
> Looks good. You'll also need a setkey (or perhaps two) function.
I have these two:
/**
* crypto_akcipher_setkey() -- assign a public key to an AKCIPHER tfm handle
*
* @tfm: AKCIPHER tfm handle allocated with crypto_alloc_akcipher()
* @pkey: public key
*/
static inline void crypto_akcipher_setkey(struct crypto_akcipher *tfm,
const struct public_key *pkey);
/**
* crypto_akcipher_getkey() -- obtain a public key from an AKCIPHER tfm handle
*
* @tfm: AKCIPHER tfm handle allocated with crypto_alloc_akcipher()
*
* Return: public key
*/
static inline const struct public_key *crypto_akcipher_getkey(
struct crypto_akcipher *tfm);
next prev parent reply other threads:[~2015-05-23 14:23 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
2015-05-23 5:47 ` Herbert Xu
2015-05-23 14:20 ` Tadeusz Struk [this message]
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=55608C9F.7040500@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).