diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-26 23:08:42 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-26 23:08:42 -0500 |
| commit | 8912858bcb9e314549a4abc15db6b5841a96fa2c (patch) | |
| tree | 92d815952374bc8f387452ab77ab3fb47e00c8f6 | |
| parent | 423eaf8f00d89ca79bb2c9d4d22e92c9774e2d8a (diff) | |
| parent | 38cb2419f544ad413c7f7aa8c17fd7377610cdd8 (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] api: Fix potential race in crypto_remove_spawn
[CRYPTO] authenc: Move initialisations up to shut up gcc
| -rw-r--r-- | crypto/algapi.c | 6 | ||||
| -rw-r--r-- | crypto/authenc.c | 12 |
2 files changed, 7 insertions, 11 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 8ff8c2656d9c..8383282de1dd 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
| @@ -95,6 +95,9 @@ static void crypto_remove_spawn(struct crypto_spawn *spawn, | |||
| 95 | return; | 95 | return; |
| 96 | 96 | ||
| 97 | inst->alg.cra_flags |= CRYPTO_ALG_DEAD; | 97 | inst->alg.cra_flags |= CRYPTO_ALG_DEAD; |
| 98 | if (hlist_unhashed(&inst->list)) | ||
| 99 | return; | ||
| 100 | |||
| 98 | if (!tmpl || !crypto_tmpl_get(tmpl)) | 101 | if (!tmpl || !crypto_tmpl_get(tmpl)) |
| 99 | return; | 102 | return; |
| 100 | 103 | ||
| @@ -335,9 +338,6 @@ int crypto_register_instance(struct crypto_template *tmpl, | |||
| 335 | LIST_HEAD(list); | 338 | LIST_HEAD(list); |
| 336 | int err = -EINVAL; | 339 | int err = -EINVAL; |
| 337 | 340 | ||
| 338 | if (inst->alg.cra_destroy) | ||
| 339 | goto err; | ||
| 340 | |||
| 341 | err = crypto_check_alg(&inst->alg); | 341 | err = crypto_check_alg(&inst->alg); |
| 342 | if (err) | 342 | if (err) |
| 343 | goto err; | 343 | goto err; |
diff --git a/crypto/authenc.c b/crypto/authenc.c index 0b29a6ae673d..126a529b496d 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
| @@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req) | |||
| 84 | .tfm = auth, | 84 | .tfm = auth, |
| 85 | }; | 85 | }; |
| 86 | u8 *hash = aead_request_ctx(req); | 86 | u8 *hash = aead_request_ctx(req); |
| 87 | struct scatterlist *dst; | 87 | struct scatterlist *dst = req->dst; |
| 88 | unsigned int cryptlen; | 88 | unsigned int cryptlen = req->cryptlen; |
| 89 | int err; | 89 | int err; |
| 90 | 90 | ||
| 91 | hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), | 91 | hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), |
| @@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req) | |||
| 100 | if (err) | 100 | if (err) |
| 101 | goto auth_unlock; | 101 | goto auth_unlock; |
| 102 | 102 | ||
| 103 | cryptlen = req->cryptlen; | ||
| 104 | dst = req->dst; | ||
| 105 | err = crypto_hash_update(&desc, dst, cryptlen); | 103 | err = crypto_hash_update(&desc, dst, cryptlen); |
| 106 | if (err) | 104 | if (err) |
| 107 | goto auth_unlock; | 105 | goto auth_unlock; |
| @@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req) | |||
| 159 | }; | 157 | }; |
| 160 | u8 *ohash = aead_request_ctx(req); | 158 | u8 *ohash = aead_request_ctx(req); |
| 161 | u8 *ihash; | 159 | u8 *ihash; |
| 162 | struct scatterlist *src; | 160 | struct scatterlist *src = req->src; |
| 163 | unsigned int cryptlen; | 161 | unsigned int cryptlen = req->cryptlen; |
| 164 | unsigned int authsize; | 162 | unsigned int authsize; |
| 165 | int err; | 163 | int err; |
| 166 | 164 | ||
| @@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req) | |||
| 177 | if (err) | 175 | if (err) |
| 178 | goto auth_unlock; | 176 | goto auth_unlock; |
| 179 | 177 | ||
| 180 | cryptlen = req->cryptlen; | ||
| 181 | src = req->src; | ||
| 182 | err = crypto_hash_update(&desc, src, cryptlen); | 178 | err = crypto_hash_update(&desc, src, cryptlen); |
| 183 | if (err) | 179 | if (err) |
| 184 | goto auth_unlock; | 180 | goto auth_unlock; |
