]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Mar 2010 18:47:57 +0000 (10:47 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Mar 2010 18:47:57 +0000 (10:47 -0800)
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  padata: Allocate the cpumask for the padata instance
  crypto: authenc - Move saved IV in front of the ablkcipher request
  crypto: hash - Fix handling of unaligned buffers
  crypto: authenc - Use correct ahash complete functions
  crypto: md5 - Set statesize

crypto/ahash.c
crypto/authenc.c
crypto/md5.c
kernel/padata.c

index 33a4ff45f8425eb84c5a0308fcf80c50ddc40d9a..b8c59b889c6ea579e7a6bacd7241bbbc86cbe44c 100644 (file)
@@ -78,7 +78,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
        walk->data -= walk->offset;
 
        if (nbytes && walk->offset & alignmask && !err) {
-               walk->offset += alignmask - 1;
                walk->offset = ALIGN(walk->offset, alignmask + 1);
                walk->data += walk->offset;
 
index 18870906ea065a9953e68171e3765c6e4bd4002b..2bb7348d8d5543364b1c75440e9d1c13ad1a0e2c 100644 (file)
@@ -386,11 +386,13 @@ static int crypto_authenc_encrypt(struct aead_request *req)
 {
        struct crypto_aead *authenc = crypto_aead_reqtfm(req);
        struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
-       struct ablkcipher_request *abreq = aead_request_ctx(req);
+       struct authenc_request_ctx *areq_ctx = aead_request_ctx(req);
        struct crypto_ablkcipher *enc = ctx->enc;
        struct scatterlist *dst = req->dst;
        unsigned int cryptlen = req->cryptlen;
-       u8 *iv = (u8 *)(abreq + 1) + crypto_ablkcipher_reqsize(enc);
+       struct ablkcipher_request *abreq = (void *)(areq_ctx->tail
+                                                   + ctx->reqoff);
+       u8 *iv = (u8 *)abreq - crypto_ablkcipher_ivsize(enc);
        int err;
 
        ablkcipher_request_set_tfm(abreq, enc);
@@ -454,7 +456,7 @@ static int crypto_authenc_verify(struct aead_request *req,
        unsigned int authsize;
 
        areq_ctx->complete = authenc_verify_ahash_done;
-       areq_ctx->complete = authenc_verify_ahash_update_done;
+       areq_ctx->update_complete = authenc_verify_ahash_update_done;
 
        ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP);
        if (IS_ERR(ohash))
@@ -546,10 +548,6 @@ static int crypto_authenc_init_tfm(struct crypto_tfm *tfm)
        if (IS_ERR(auth))
                return PTR_ERR(auth);
 
-       ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) +
-                           crypto_ahash_alignmask(auth),
-                           crypto_ahash_alignmask(auth) + 1);
-
        enc = crypto_spawn_skcipher(&ictx->enc);
        err = PTR_ERR(enc);
        if (IS_ERR(enc))
@@ -558,13 +556,18 @@ static int crypto_authenc_init_tfm(struct crypto_tfm *tfm)
        ctx->auth = auth;
        ctx->enc = enc;
 
-       tfm->crt_aead.reqsize = max_t(unsigned int,
-                               crypto_ahash_reqsize(auth) + ctx->reqoff +
-                               sizeof(struct authenc_request_ctx) +
+       ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) +
+                           crypto_ahash_alignmask(auth),
+                           crypto_ahash_alignmask(auth) + 1) +
+                     crypto_ablkcipher_ivsize(enc);
+
+       tfm->crt_aead.reqsize = sizeof(struct authenc_request_ctx) +
+                               ctx->reqoff +
+                               max_t(unsigned int,
+                               crypto_ahash_reqsize(auth) +
                                sizeof(struct ahash_request),
                                sizeof(struct skcipher_givcrypt_request) +
-                               crypto_ablkcipher_reqsize(enc) +
-                               crypto_ablkcipher_ivsize(enc));
+                               crypto_ablkcipher_reqsize(enc));
 
        return 0;
 
index 9fda213a592ef6ccb7e709769f56b1b5f761d447..30efc7dad89173e86fcf65b6ac7c20d858abfeb2 100644 (file)
@@ -234,6 +234,7 @@ static struct shash_alg alg = {
        .export         =       md5_export,
        .import         =       md5_import,
        .descsize       =       sizeof(struct md5_state),
+       .statesize      =       sizeof(struct md5_state),
        .base           =       {
                .cra_name       =       "md5",
                .cra_flags      =       CRYPTO_ALG_TYPE_SHASH,
index 6f9bcb8313d604f62bceb54d21c1e2eeb0f48211..93caf65ff57c80cf52ce215e51c65694060d95af 100644 (file)
@@ -642,6 +642,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
        if (!pd)
                goto err_free_inst;
 
+       if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL))
+               goto err_free_pd;
+
        rcu_assign_pointer(pinst->pd, pd);
 
        pinst->wq = wq;
@@ -654,12 +657,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
        pinst->cpu_notifier.priority = 0;
        err = register_hotcpu_notifier(&pinst->cpu_notifier);
        if (err)
-               goto err_free_pd;
+               goto err_free_cpumask;
 
        mutex_init(&pinst->lock);
 
        return pinst;
 
+err_free_cpumask:
+       free_cpumask_var(pinst->cpumask);
 err_free_pd:
        padata_free_pd(pd);
 err_free_inst:
@@ -685,6 +690,7 @@ void padata_free(struct padata_instance *pinst)
 
        unregister_hotcpu_notifier(&pinst->cpu_notifier);
        padata_free_pd(pinst->pd);
+       free_cpumask_var(pinst->cpumask);
        kfree(pinst);
 }
 EXPORT_SYMBOL(padata_free);