[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4182.1291383725@redhat.com>
Date: Fri, 03 Dec 2010 13:42:05 +0000
From: David Howells <dhowells@...hat.com>
To: Mimi Zohar <zohar@...ux.vnet.ibm.com>
Cc: dhowells@...hat.com, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, keyrings@...ux-nfs.org,
linux-crypto@...r.kernel.org,
Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
James Morris <jmorris@...ei.org>,
David Safford <safford@...son.ibm.com>,
Rajiv Andrade <srajiv@...ux.vnet.ibm.com>
Subject: Re: [PATCH v1.5 5/5] keys: add new key-type encrypted
Mimi Zohar <zohar@...ux.vnet.ibm.com> wrote:
> +#define KEY_TRUSTED_PREFIX "trusted:"
> +#define KEY_TRUSTED_PREFIX_LEN (sizeof (KEY_TRUSTED_PREFIX) - 1)
> +#define KEY_USER_PREFIX "user:"
> +#define KEY_USER_PREFIX_LEN (sizeof (KEY_USER_PREFIX) - 1)
I'd recommend using static const char arrays.
> +static int datablob_parse(char *datablob, char **master_desc,
> ...
> + *hex_encoded_data = *hex_encoded_iv + (2 * ivsize) + 2;
Do you need to validate the length of the string here?
> +static struct key *request_trusted_key(const char *trusted_desc,
> + u8 **master_key,
> + unsigned int *master_keylen)
You need to annotate the function with an __acquires() to indicate that it
returns with a lock held for Sparse checking. I think you should be able to
do:
__acquires(tkey->sem)
on the line before the '{'.
> +static struct key *request_user_key(const char *master_desc, u8 **master_key,
> + unsigned int *master_keylen)
Ditto.
> +static struct sdesc *init_sdesc(struct crypto_shash *alg)
> +{
> + struct sdesc *sdesc;
> + int size;
> +
> + size = sizeof(struct shash_desc) + crypto_shash_descsize(alg);
> + sdesc = kmalloc(size, GFP_KERNEL);
I think I'd call it alloc_sdesc() rather than init_sdesc().
> +static int calc_hmac(u8 *digest, const u8 *key, const unsigned int keylen,
> + const u8 *buf, const unsigned int buflen)
size_t not 'const unsigned int' please. There are multiple of these within
the patch.
> + sg_set_buf(&sg_out[0], epayload->decrypted_data,
> + (unsigned int)epayload->decrypted_datalen);
Superfluous cast.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists