include/linux/slab.h: fix sparse warning in kmalloc_type()
[linux-2.6-microblaze.git] / crypto / chacha20poly1305.c
index 600afa9..fef1144 100644 (file)
@@ -13,7 +13,7 @@
 #include <crypto/internal/hash.h>
 #include <crypto/internal/skcipher.h>
 #include <crypto/scatterwalk.h>
-#include <crypto/chacha20.h>
+#include <crypto/chacha.h>
 #include <crypto/poly1305.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -22,8 +22,6 @@
 
 #include "internal.h"
 
-#define CHACHAPOLY_IV_SIZE     12
-
 struct chachapoly_instance_ctx {
        struct crypto_skcipher_spawn chacha;
        struct crypto_ahash_spawn poly;
@@ -51,7 +49,7 @@ struct poly_req {
 };
 
 struct chacha_req {
-       u8 iv[CHACHA20_IV_SIZE];
+       u8 iv[CHACHA_IV_SIZE];
        struct scatterlist src[1];
        struct skcipher_request req; /* must be last member */
 };
@@ -91,7 +89,7 @@ static void chacha_iv(u8 *iv, struct aead_request *req, u32 icb)
        memcpy(iv, &leicb, sizeof(leicb));
        memcpy(iv + sizeof(leicb), ctx->salt, ctx->saltlen);
        memcpy(iv + sizeof(leicb) + ctx->saltlen, req->iv,
-              CHACHA20_IV_SIZE - sizeof(leicb) - ctx->saltlen);
+              CHACHA_IV_SIZE - sizeof(leicb) - ctx->saltlen);
 }
 
 static int poly_verify_tag(struct aead_request *req)
@@ -494,7 +492,7 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
        struct chachapoly_ctx *ctx = crypto_aead_ctx(aead);
        int err;
 
-       if (keylen != ctx->saltlen + CHACHA20_KEY_SIZE)
+       if (keylen != ctx->saltlen + CHACHA_KEY_SIZE)
                return -EINVAL;
 
        keylen -= ctx->saltlen;
@@ -639,7 +637,7 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb,
 
        err = -EINVAL;
        /* Need 16-byte IV size, including Initial Block Counter value */
-       if (crypto_skcipher_alg_ivsize(chacha) != CHACHA20_IV_SIZE)
+       if (crypto_skcipher_alg_ivsize(chacha) != CHACHA_IV_SIZE)
                goto out_drop_chacha;
        /* Not a stream cipher? */
        if (chacha->base.cra_blocksize != 1)