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


Groups > linux.kernel > #1429935

Re: [PATCH 5/8] KEYS: Provide software public key query function [ver #2]

From Mat Martineau <mathew.j.martineau@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/8] KEYS: Provide software public key query function [ver #2]
Date 2016-06-23 17:50 +0200
Message-ID <rNf3b-3EH-3@gated-at.bofh.it> (permalink)
References <rNdb3-2hy-3@gated-at.bofh.it> <rNdb3-2hy-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


David,

On Thu, 23 Jun 2016, David Howells wrote:

> Provide a query function for the software public key implementation.  This
> permits information about such a key to be obtained using
> query_asymmetric_key() or KEYCTL_PKEY_QUERY.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
> crypto/asymmetric_keys/public_key.c |   96 ++++++++++++++++++++++++++++++-----
> 1 file changed, 82 insertions(+), 14 deletions(-)
>
> diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
> index fd76b5fc3b3a..a48a47a1dff0 100644
> --- a/crypto/asymmetric_keys/public_key.c
> +++ b/crypto/asymmetric_keys/public_key.c
> @@ -57,6 +57,81 @@ static void public_key_destroy(void *payload0, void *payload3)
> 	public_key_signature_free(payload3);
> }
>
> +/*
> + * Determine the crypto algorithm name.
> + */
> +static
> +int software_key_determine_akcipher(const char *encoding,
> +				    const char *hash_algo,
> +				    const struct public_key *pkey,
> +				    char alg_name[CRYPTO_MAX_ALG_NAME])
> +{
> +	int n;
> +
> +	if (strcmp(encoding, "pkcs1") == 0) {
> +		/* The data wangled by the RSA algorithm is typically padded
> +		 * and encoded in some manner, such as EMSA-PKCS1-1_5 [RFC3447
> +		 * sec 8.2].
> +		 */
> +		if (!hash_algo)
> +			n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME,
> +				     "pkcs1pad(%s)",
> +				     pkey->pkey_algo);

Did you see Herbert's patch that strips out non-hash pkcs1pad capabilities 
(and the ensuing discussion)?

http://www.spinics.net/lists/linux-crypto/index.html#20432

I'm making use of pkcs1pad(rsa) with a TLS implementation, so it's good to 
see it supported here.

> +		else
> +			n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME,
> +				     "pkcs1pad(%s,%s)",
> +				     pkey->pkey_algo, hash_algo);
> +		return n >= CRYPTO_MAX_ALG_NAME ? -EINVAL : 0;
> +	}
> +
> +	if (strcmp(encoding, "raw") == 0) {
> +		strcpy(alg_name, pkey->pkey_algo);
> +		return 0;
> +	}
> +
> +	return -ENOPKG;
> +}


Regards,

--
Mat Martineau
Intel OTC

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 5/8] KEYS: Provide software public key query function [ver  #2] David Howells <dhowells@redhat.com> - 2016-06-23 15:50 +0200
  Re: [PATCH 5/8] KEYS: Provide software public key query function  [ver #2] Mat Martineau <mathew.j.martineau@linux.intel.com> - 2016-06-23 17:50 +0200
    Re: [PATCH 5/8] KEYS: Provide software public key query function  [ver #2] Herbert Xu <herbert@gondor.apana.org.au> - 2016-06-24 12:10 +0200
      Re: [PATCH 5/8] KEYS: Provide software public key query function [ver #2] David Howells <dhowells@redhat.com> - 2016-06-24 14:10 +0200
        Re: [PATCH 5/8] KEYS: Provide software public key query function  [ver #2] Herbert Xu <herbert@gondor.apana.org.au> - 2016-06-25 03:40 +0200
          Re: [PATCH 5/8] KEYS: Provide software public key query function [ver #2] David Howells <dhowells@redhat.com> - 2016-06-27 16:30 +0200
            Re: [PATCH 5/8] KEYS: Provide software public key query function  [ver #2] Herbert Xu <herbert@gondor.apana.org.au> - 2016-06-28 07:40 +0200

csiph-web