Merge branch 'next' into for-linus
James Morris [Mon, 9 Jan 2012 01:16:48 +0000 (12:16 +1100)]
Conflicts:
security/integrity/evm/evm_crypto.c

Resolved upstream fix vs. next conflict manually.

Signed-off-by: James Morris <jmorris@namei.org>

1  2 
include/linux/security.h
security/integrity/evm/evm_crypto.c

Simple merge
@@@ -29,21 -30,30 +30,30 @@@ struct crypto_shash *hash_tfm
  
  static DEFINE_MUTEX(mutex);
  
- static struct shash_desc *init_desc(void)
 -static struct shash_desc *init_desc(const char type)
++static struct shash_desc *init_desc(char type)
  {
-       int rc;
+       long rc;
+       char *algo;
+       struct crypto_shash **tfm;
        struct shash_desc *desc;
  
-       if (hmac_tfm == NULL) {
+       if (type == EVM_XATTR_HMAC) {
+               tfm = &hmac_tfm;
+               algo = evm_hmac;
+       } else {
+               tfm = &hash_tfm;
+               algo = evm_hash;
+       }
+       if (*tfm == NULL) {
                mutex_lock(&mutex);
-               if (hmac_tfm)
+               if (*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;
+               *tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC);
+               if (IS_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);
                }