Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283251
b: refs/heads/master
c: 143b01d
h: refs/heads/master
i:
  283249: 575ee1d
  283247: 7ece467
v: v3
  • Loading branch information
Dmitry Kasatkin authored and James Morris committed Dec 7, 2011
1 parent c042e09 commit 4f9c371
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 88d7ed35085184f15a2af3d9e88d775059b2f307
refs/heads/master: 143b01d33221e4937d3930e6bb2b63d70b7c7a65
14 changes: 11 additions & 3 deletions trunk/security/integrity/evm/evm_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ static int evmkey_len = MAX_KEY_SIZE;
struct crypto_shash *hmac_tfm;
struct crypto_shash *hash_tfm;

static DEFINE_MUTEX(mutex);

static struct shash_desc *init_desc(const char type)
{
int rc;
long rc;
char *algo;
struct crypto_shash **tfm;
struct shash_desc *desc;
Expand All @@ -44,22 +46,28 @@ static struct shash_desc *init_desc(const char type)
}

if (*tfm == NULL) {
mutex_lock(&mutex);
if (*tfm)
goto out;
*tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(*tfm)) {
pr_err("Can not allocate %s (reason: %ld)\n",
algo, PTR_ERR(*tfm));
rc = PTR_ERR(*tfm);
pr_err("Can not allocate %s (reason: %ld)\n", algo, rc);
*tfm = NULL;
mutex_unlock(&mutex);
return ERR_PTR(rc);
}
if (type == EVM_XATTR_HMAC) {
rc = crypto_shash_setkey(*tfm, evmkey, evmkey_len);
if (rc) {
crypto_free_shash(*tfm);
*tfm = NULL;
mutex_unlock(&mutex);
return ERR_PTR(rc);
}
}
out:
mutex_unlock(&mutex);
}

desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm),
Expand Down

0 comments on commit 4f9c371

Please sign in to comment.