Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401035 > unrolled thread

Re: [PATCH RESEND v5 6/6] crypto: AF_ALG - add support for key_id

Started byMat Martineau <mathew.j.martineau@linux.intel.com>
First post2016-05-14 01:40 +0200
Last post2016-05-16 16:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RESEND v5 6/6] crypto: AF_ALG - add support for key_id Mat Martineau <mathew.j.martineau@linux.intel.com> - 2016-05-14 01:40 +0200
    Re: [PATCH RESEND v5 6/6] crypto: AF_ALG - add support for key_id Tadeusz Struk <tadeusz.struk@intel.com> - 2016-05-16 16:30 +0200

#1401035 — Re: [PATCH RESEND v5 6/6] crypto: AF_ALG - add support for key_id

FromMat Martineau <mathew.j.martineau@linux.intel.com>
Date2016-05-14 01:40 +0200
SubjectRe: [PATCH RESEND v5 6/6] crypto: AF_ALG - add support for key_id
Message-ID<ryuQy-59K-11@gated-at.bofh.it>
Tadeusz -

David updated the keys-asym-keyctl branch, and this patch set won't build 
any more.

On Thu, 5 May 2016, Tadeusz Struk wrote:

> diff --git a/crypto/algif_akcipher.c b/crypto/algif_akcipher.c
> index e00793d..f486b6d 100644
> --- a/crypto/algif_akcipher.c
> +++ b/crypto/algif_akcipher.c
> +static int asym_key_encrypt(const struct key *key, struct akcipher_request *req)
...
> +	params.data_len = req->src_len;
> +	params.enc_len = req->dst_len;

The params member names have changed (now in_len and out_len).

> +	ret = encrypt_blob(&params, in, out);

The encrypt function for the key can now be called with 
params.key->type->asym_eds_op(). This also allows you to factor out the 
duplication in asym_key_encrypt, asym_key_decrypt, and asym_key_sign. See 
keyctl_pkey_e_d_s() in keyctl_pkey.c

> +static int asym_key_verify(const struct key *key, struct akcipher_request *req)
...
> +	ret = verify_signature(key, NULL, &sig);

key->type->asym_verify_signature() is available as well.


Regards,

--
Mat Martineau
Intel OTC

[toc] | [next] | [standalone]


#1401533

FromTadeusz Struk <tadeusz.struk@intel.com>
Date2016-05-16 16:30 +0200
Message-ID<rzrGX-892-23@gated-at.bofh.it>
In reply to#1401035
Hi Mat,
On 05/13/2016 04:32 PM, Mat Martineau wrote:
> 
>> +    params.data_len = req->src_len;
>> +    params.enc_len = req->dst_len;

Thanks for info. I have sent an update for this.

> 
> The params member names have changed (now in_len and out_len).
>> +    ret = encrypt_blob(&params, in, out);
> 
> The encrypt function for the key can now be called with params.key->type->asym_eds_op(). This also allows you to factor out the duplication in asym_key_encrypt, asym_key_decrypt, and asym_key_sign. See keyctl_pkey_e_d_s() in keyctl_pkey.c
> 
>> +static int asym_key_verify(const struct key *key, struct akcipher_request *req)
> ...
>> +    ret = verify_signature(key, NULL, &sig);
> 
> key->type->asym_verify_signature() is available as well.

Since these operation will be triggered from userspace I think it's better to use the
official interface as defined in crypto/public_key.h instead of direct calls.
Some operation may not be implemented for a given key type and the official interface
performs necessary checks.
Thanks,
-- 
TS

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web