Commit 7545e166 authored by Corentin LABBE's avatar Corentin LABBE Committed by Herbert Xu

crypto: caam - Use GCM IV size constant

This patch replace GCM IV size value by their constant name.
Signed-off-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ef780324
...@@ -992,7 +992,7 @@ static void init_gcm_job(struct aead_request *req, ...@@ -992,7 +992,7 @@ static void init_gcm_job(struct aead_request *req,
struct caam_ctx *ctx = crypto_aead_ctx(aead); struct caam_ctx *ctx = crypto_aead_ctx(aead);
unsigned int ivsize = crypto_aead_ivsize(aead); unsigned int ivsize = crypto_aead_ivsize(aead);
u32 *desc = edesc->hw_desc; u32 *desc = edesc->hw_desc;
bool generic_gcm = (ivsize == 12); bool generic_gcm = (ivsize == GCM_AES_IV_SIZE);
unsigned int last; unsigned int last;
init_aead_job(req, edesc, all_contig, encrypt); init_aead_job(req, edesc, all_contig, encrypt);
...@@ -1004,7 +1004,7 @@ static void init_gcm_job(struct aead_request *req, ...@@ -1004,7 +1004,7 @@ static void init_gcm_job(struct aead_request *req,
/* Read GCM IV */ /* Read GCM IV */
append_cmd(desc, CMD_FIFO_LOAD | FIFOLD_CLASS_CLASS1 | IMMEDIATE | append_cmd(desc, CMD_FIFO_LOAD | FIFOLD_CLASS_CLASS1 | IMMEDIATE |
FIFOLD_TYPE_IV | FIFOLD_TYPE_FLUSH1 | 12 | last); FIFOLD_TYPE_IV | FIFOLD_TYPE_FLUSH1 | GCM_AES_IV_SIZE | last);
/* Append Salt */ /* Append Salt */
if (!generic_gcm) if (!generic_gcm)
append_data(desc, ctx->key + ctx->cdata.keylen, 4); append_data(desc, ctx->key + ctx->cdata.keylen, 4);
...@@ -1953,7 +1953,7 @@ static struct caam_aead_alg driver_aeads[] = { ...@@ -1953,7 +1953,7 @@ static struct caam_aead_alg driver_aeads[] = {
.setauthsize = rfc4106_setauthsize, .setauthsize = rfc4106_setauthsize,
.encrypt = ipsec_gcm_encrypt, .encrypt = ipsec_gcm_encrypt,
.decrypt = ipsec_gcm_decrypt, .decrypt = ipsec_gcm_decrypt,
.ivsize = 8, .ivsize = GCM_RFC4106_IV_SIZE,
.maxauthsize = AES_BLOCK_SIZE, .maxauthsize = AES_BLOCK_SIZE,
}, },
.caam = { .caam = {
...@@ -1971,7 +1971,7 @@ static struct caam_aead_alg driver_aeads[] = { ...@@ -1971,7 +1971,7 @@ static struct caam_aead_alg driver_aeads[] = {
.setauthsize = rfc4543_setauthsize, .setauthsize = rfc4543_setauthsize,
.encrypt = ipsec_gcm_encrypt, .encrypt = ipsec_gcm_encrypt,
.decrypt = ipsec_gcm_decrypt, .decrypt = ipsec_gcm_decrypt,
.ivsize = 8, .ivsize = GCM_RFC4543_IV_SIZE,
.maxauthsize = AES_BLOCK_SIZE, .maxauthsize = AES_BLOCK_SIZE,
}, },
.caam = { .caam = {
...@@ -1990,7 +1990,7 @@ static struct caam_aead_alg driver_aeads[] = { ...@@ -1990,7 +1990,7 @@ static struct caam_aead_alg driver_aeads[] = {
.setauthsize = gcm_setauthsize, .setauthsize = gcm_setauthsize,
.encrypt = gcm_encrypt, .encrypt = gcm_encrypt,
.decrypt = gcm_decrypt, .decrypt = gcm_decrypt,
.ivsize = 12, .ivsize = GCM_AES_IV_SIZE,
.maxauthsize = AES_BLOCK_SIZE, .maxauthsize = AES_BLOCK_SIZE,
}, },
.caam = { .caam = {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/ctr.h> #include <crypto/ctr.h>
#include <crypto/des.h> #include <crypto/des.h>
#include <crypto/gcm.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <crypto/md5.h> #include <crypto/md5.h>
#include <crypto/internal/aead.h> #include <crypto/internal/aead.h>
......
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