diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 09:15:21 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 09:15:21 -0700 |
commit | 0d2ecee2bdb2a19d04bc5cefac0f86e790f1aad4 (patch) | |
tree | 2e0f08819a57e2c191f6e7fe2b2cd2f2415143bd /arch | |
parent | 3ae2a1ce2e7b70254e5c9e465adefac9cba191d6 (diff) | |
parent | f07ef1de9baeb2add514c51f59d4bc3c659c2ca4 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: tcrypt - do not attempt to write to readonly variable
random: update interface comments to reflect reality
crypto: picoxcell - add support for the picoxcell crypto engines
crypto: sha1 - Add test vector to test partial block processing
hwrng: omap - Convert release_resource to release_region/release_mem_region
crypto: aesni-intel - Fix remaining leak in rfc4106_set_hash_key
crypto: omap-sham - don't treat NULL clk as an error
crypto: omap-aes - don't treat NULL clk as an error
crypto: testmgr - mark ghash as fips_allowed
crypto: testmgr - mark xts(aes) as fips_allowed
crypto: skcipher - remove redundant NULL check
hwrng: pixocell - add support for picoxcell TRNG
crypto: aesni-intel - Don't leak memory in rfc4106_set_hash_subkey
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/crypto/aesni-intel_glue.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index e1e60c7d5813..e0e6340c8dad 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c @@ -873,22 +873,18 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len) crypto_ablkcipher_clear_flags(ctr_tfm, ~0); ret = crypto_ablkcipher_setkey(ctr_tfm, key, key_len); - if (ret) { - crypto_free_ablkcipher(ctr_tfm); - return ret; - } + if (ret) + goto out_free_ablkcipher; + ret = -ENOMEM; req = ablkcipher_request_alloc(ctr_tfm, GFP_KERNEL); - if (!req) { - crypto_free_ablkcipher(ctr_tfm); - return -EINVAL; - } + if (!req) + goto out_free_ablkcipher; req_data = kmalloc(sizeof(*req_data), GFP_KERNEL); - if (!req_data) { - crypto_free_ablkcipher(ctr_tfm); - return -ENOMEM; - } + if (!req_data) + goto out_free_request; + memset(req_data->iv, 0, sizeof(req_data->iv)); /* Clear the data in the hash sub key container to zero.*/ @@ -913,8 +909,10 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len) if (!ret) ret = req_data->result.err; } - ablkcipher_request_free(req); kfree(req_data); +out_free_request: + ablkcipher_request_free(req); +out_free_ablkcipher: crypto_free_ablkcipher(ctr_tfm); return ret; } |