summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccree/cc_aead.c
diff options
context:
space:
mode:
authorGilad Ben-Yossef <gilad@benyossef.com>2020-03-08 16:57:07 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2020-03-12 13:00:16 +0100
commit69cd3e16c0d6f7dfe92c969a43221a802ee549ae (patch)
tree2fa5feb6dc48b61346ac13e8427136d03f08fef1 /drivers/crypto/ccree/cc_aead.c
parentcrypto: ccree - remove ancient TODO remarks (diff)
downloadlinux-69cd3e16c0d6f7dfe92c969a43221a802ee549ae.tar.xz
linux-69cd3e16c0d6f7dfe92c969a43221a802ee549ae.zip
crypto: ccree - only check condition if needed
Move testing of condition to after the point we decide if we need it or not. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccree/cc_aead.c')
-rw-r--r--drivers/crypto/ccree/cc_aead.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
index 1c5d927d632c..cce103e3b822 100644
--- a/drivers/crypto/ccree/cc_aead.c
+++ b/drivers/crypto/ccree/cc_aead.c
@@ -1800,12 +1800,6 @@ static int cc_gcm(struct aead_request *req, struct cc_hw_desc desc[],
struct aead_req_ctx *req_ctx = aead_request_ctx(req);
unsigned int cipher_flow_mode;
- if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
- cipher_flow_mode = AES_and_HASH;
- } else { /* Encrypt */
- cipher_flow_mode = AES_to_HASH_and_DOUT;
- }
-
//in RFC4543 no data to encrypt. just copy data from src to dest.
if (req_ctx->plaintext_authenticate_only) {
cc_proc_cipher_desc(req, BYPASS, desc, seq_size);
@@ -1817,6 +1811,12 @@ static int cc_gcm(struct aead_request *req, struct cc_hw_desc desc[],
return 0;
}
+ if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
+ cipher_flow_mode = AES_and_HASH;
+ } else { /* Encrypt */
+ cipher_flow_mode = AES_to_HASH_and_DOUT;
+ }
+
// for gcm and rfc4106.
cc_set_ghash_desc(req, desc, seq_size);
/* process(ghash) assoc data */