summaryrefslogtreecommitdiffstats
path: root/security/keys
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2010-12-13 16:53:11 -0500
committerJames Morris <jmorris@namei.org>2010-12-15 12:14:27 +0530
commit1bdbb4024c309e470711b434a24fb356fc92edea (patch)
tree129f4136a53e0133fcdff81065f2e15fb4aac374 /security/keys
parentbc5e0af0b36b6cc9de301074426c279fc9b72675 (diff)
downloadop-kernel-dev-1bdbb4024c309e470711b434a24fb356fc92edea.zip
op-kernel-dev-1bdbb4024c309e470711b434a24fb356fc92edea.tar.gz
trusted-keys: kzalloc and other cleanup
Cleanup based on David Howells suggestions: - replace kzalloc, where possible, with kmalloc - revert 'const unsigned int' definitions to 'unsigned int' Signed-off-by: David Safford <safford@watson.ibm.com> Acked-by: Mimi Zohar <zohar@us.ibm.com> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/trusted_defined.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c
index 3dc3db1..975e9f2 100644
--- a/security/keys/trusted_defined.c
+++ b/security/keys/trusted_defined.c
@@ -56,7 +56,7 @@ static struct sdesc *init_sdesc(struct crypto_shash *alg)
return sdesc;
}
-static int TSS_sha1(const unsigned char *data, const unsigned int datalen,
+static int TSS_sha1(const unsigned char *data, unsigned int datalen,
unsigned char *digest)
{
struct sdesc *sdesc;
@@ -74,7 +74,7 @@ static int TSS_sha1(const unsigned char *data, const unsigned int datalen,
}
static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
- const unsigned int keylen, ...)
+ unsigned int keylen, ...)
{
struct sdesc *sdesc;
va_list argp;
@@ -119,7 +119,7 @@ out:
* calculate authorization info fields to send to TPM
*/
static int TSS_authhmac(unsigned char *digest, const unsigned char *key,
- const unsigned int keylen, unsigned char *h1,
+ unsigned int keylen, unsigned char *h1,
unsigned char *h2, unsigned char h3, ...)
{
unsigned char paramdigest[SHA1_DIGEST_SIZE];
@@ -170,7 +170,7 @@ static int TSS_checkhmac1(unsigned char *buffer,
const uint32_t command,
const unsigned char *ononce,
const unsigned char *key,
- const unsigned int keylen, ...)
+ unsigned int keylen, ...)
{
uint32_t bufsize;
uint16_t tag;
@@ -252,9 +252,9 @@ static int TSS_checkhmac2(unsigned char *buffer,
const uint32_t command,
const unsigned char *ononce,
const unsigned char *key1,
- const unsigned int keylen1,
+ unsigned int keylen1,
const unsigned char *key2,
- const unsigned int keylen2, ...)
+ unsigned int keylen2, ...)
{
uint32_t bufsize;
uint16_t tag;
@@ -388,7 +388,7 @@ static int my_get_random(unsigned char *buf, int len)
struct tpm_buf *tb;
int ret;
- tb = kzalloc(sizeof *tb, GFP_KERNEL);
+ tb = kmalloc(sizeof *tb, GFP_KERNEL);
if (!tb)
return -ENOMEM;
ret = tpm_get_random(tb, buf, len);
@@ -420,8 +420,7 @@ static int pcrlock(const int pcrnum)
* Create an object specific authorisation protocol (OSAP) session
*/
static int osap(struct tpm_buf *tb, struct osapsess *s,
- const unsigned char *key, const uint16_t type,
- const uint32_t handle)
+ const unsigned char *key, uint16_t type, uint32_t handle)
{
unsigned char enonce[TPM_NONCE_SIZE];
unsigned char ononce[TPM_NONCE_SIZE];
@@ -485,12 +484,12 @@ struct tpm_digests {
* Have the TPM seal(encrypt) the trusted key, possibly based on
* Platform Configuration Registers (PCRs). AUTH1 for sealing key.
*/
-static int tpm_seal(struct tpm_buf *tb, const uint16_t keytype,
- const uint32_t keyhandle, const unsigned char *keyauth,
- const unsigned char *data, const uint32_t datalen,
+static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
+ uint32_t keyhandle, const unsigned char *keyauth,
+ const unsigned char *data, uint32_t datalen,
unsigned char *blob, uint32_t *bloblen,
const unsigned char *blobauth,
- const unsigned char *pcrinfo, const uint32_t pcrinfosize)
+ const unsigned char *pcrinfo, uint32_t pcrinfosize)
{
struct osapsess sess;
struct tpm_digests *td;
@@ -599,8 +598,8 @@ static int tpm_seal(struct tpm_buf *tb, const uint16_t keytype,
* use the AUTH2_COMMAND form of unseal, to authorize both key and blob
*/
static int tpm_unseal(struct tpm_buf *tb,
- const uint32_t keyhandle, const unsigned char *keyauth,
- const unsigned char *blob, const int bloblen,
+ uint32_t keyhandle, const unsigned char *keyauth,
+ const unsigned char *blob, int bloblen,
const unsigned char *blobauth,
unsigned char *data, unsigned int *datalen)
{
@@ -913,7 +912,7 @@ static struct trusted_key_payload *trusted_payload_alloc(struct key *key)
* On success, return 0. Otherwise return errno.
*/
static int trusted_instantiate(struct key *key, const void *data,
- const size_t datalen)
+ size_t datalen)
{
struct trusted_key_payload *payload = NULL;
struct trusted_key_options *options = NULL;
@@ -996,8 +995,7 @@ static void trusted_rcu_free(struct rcu_head *rcu)
/*
* trusted_update - reseal an existing key with new PCR values
*/
-static int trusted_update(struct key *key, const void *data,
- const size_t datalen)
+static int trusted_update(struct key *key, const void *data, size_t datalen)
{
struct trusted_key_payload *p = key->payload.data;
struct trusted_key_payload *new_p;
OpenPOWER on IntegriCloud