Commit dd09f58c authored by Ondrej Mosnacek's avatar Ondrej Mosnacek Committed by Herbert Xu

crypto: x86/aegis256 - Fix wrong key buffer size

AEGIS-256 key is two blocks, not one.

Fixes: 1d373d4e ("crypto: x86 - Add optimized AEGIS implementations")
Reported-by: default avatarEric Biggers <ebiggers3@gmail.com>
Signed-off-by: default avatarOndrej Mosnacek <omosnacek@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9f50fd5b
...@@ -57,7 +57,7 @@ struct aegis_state { ...@@ -57,7 +57,7 @@ struct aegis_state {
}; };
struct aegis_ctx { struct aegis_ctx {
struct aegis_block key; struct aegis_block key[AEGIS256_KEY_SIZE / AEGIS256_BLOCK_SIZE];
}; };
struct aegis_crypt_ops { struct aegis_crypt_ops {
...@@ -164,7 +164,7 @@ static int crypto_aegis256_aesni_setkey(struct crypto_aead *aead, const u8 *key, ...@@ -164,7 +164,7 @@ static int crypto_aegis256_aesni_setkey(struct crypto_aead *aead, const u8 *key,
return -EINVAL; return -EINVAL;
} }
memcpy(ctx->key.bytes, key, AEGIS256_KEY_SIZE); memcpy(ctx->key, key, AEGIS256_KEY_SIZE);
return 0; return 0;
} }
...@@ -190,7 +190,7 @@ static void crypto_aegis256_aesni_crypt(struct aead_request *req, ...@@ -190,7 +190,7 @@ static void crypto_aegis256_aesni_crypt(struct aead_request *req,
kernel_fpu_begin(); kernel_fpu_begin();
crypto_aegis256_aesni_init(&state, ctx->key.bytes, req->iv); crypto_aegis256_aesni_init(&state, ctx->key, req->iv);
crypto_aegis256_aesni_process_ad(&state, req->src, req->assoclen); crypto_aegis256_aesni_process_ad(&state, req->src, req->assoclen);
crypto_aegis256_aesni_process_crypt(&state, req, ops); crypto_aegis256_aesni_process_crypt(&state, req, ops);
crypto_aegis256_aesni_final(&state, tag_xor, req->assoclen, cryptlen); crypto_aegis256_aesni_final(&state, tag_xor, req->assoclen, cryptlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment