Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  [CRYPTO] api: Select cryptomgr where needed
  [CRYPTO] api: fix crypto_alloc_base() return value
  • Loading branch information
Linus Torvalds committed Oct 20, 2006
2 parents adfefb5 + 4351840 commit 7c2aed4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion crypto/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ config CRYPTO_HASH
config CRYPTO_MANAGER
tristate "Cryptographic algorithm manager"
select CRYPTO_ALGAPI
default m
help
Create default cryptographic template instantiations such as
cbc(aes).

config CRYPTO_HMAC
tristate "HMAC support"
select CRYPTO_HASH
select CRYPTO_MANAGER
help
HMAC: Keyed-Hashing for Message Authentication (RFC2104).
This is required for IPSec.
Expand Down Expand Up @@ -131,6 +131,7 @@ config CRYPTO_TGR192
config CRYPTO_ECB
tristate "ECB support"
select CRYPTO_BLKCIPHER
select CRYPTO_MANAGER
default m
help
ECB: Electronic CodeBook mode
Expand All @@ -140,6 +141,7 @@ config CRYPTO_ECB
config CRYPTO_CBC
tristate "CBC support"
select CRYPTO_BLKCIPHER
select CRYPTO_MANAGER
default m
help
CBC: Cipher Block Chaining mode
Expand Down
15 changes: 8 additions & 7 deletions crypto/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags)
tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
tfm = kzalloc(tfm_size, GFP_KERNEL);
if (tfm == NULL)
goto out;
goto out_err;

tfm->__crt_alg = alg;

Expand All @@ -355,6 +355,7 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags)
crypto_exit_ops(tfm);
out_free_tfm:
kfree(tfm);
out_err:
tfm = ERR_PTR(err);
out:
return tfm;
Expand Down Expand Up @@ -414,14 +415,14 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
struct crypto_alg *alg;

alg = crypto_alg_mod_lookup(alg_name, type, mask);
err = PTR_ERR(alg);
tfm = ERR_PTR(err);
if (IS_ERR(alg))
if (IS_ERR(alg)) {
err = PTR_ERR(alg);
goto err;
}

tfm = __crypto_alloc_tfm(alg, 0);
if (!IS_ERR(tfm))
break;
return tfm;

crypto_mod_put(alg);
err = PTR_ERR(tfm);
Expand All @@ -433,9 +434,9 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
err = -EINTR;
break;
}
};
}

return tfm;
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(crypto_alloc_base);

Expand Down

0 comments on commit 7c2aed4

Please sign in to comment.