Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 276919
b: refs/heads/master
c: 97426f9
h: refs/heads/master
i:
  276917: 823b7e5
  276915: c77e6e8
  276911: 955913f
v: v3
  • Loading branch information
Dmitry Kasatkin committed Dec 20, 2011
1 parent 675659a commit 185d74a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d21b59451886cb82448302f8d6f9ac87c3bd56cf
refs/heads/master: 97426f985729573cea06e82e271cc3929f1f5f8e
9 changes: 9 additions & 0 deletions trunk/security/integrity/evm/evm_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,35 @@ static int evmkey_len = MAX_KEY_SIZE;

struct crypto_shash *hmac_tfm;

static DEFINE_MUTEX(mutex);

static struct shash_desc *init_desc(void)
{
int rc;
struct shash_desc *desc;

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

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

0 comments on commit 185d74a

Please sign in to comment.