Skip to content

Commit 69cd3e1

Browse files
Gilad Ben-Yossefherbertx
authored andcommitted
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 6429ccd commit 69cd3e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/crypto/ccree/cc_aead.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,12 +1800,6 @@ static int cc_gcm(struct aead_request *req, struct cc_hw_desc desc[],
18001800
struct aead_req_ctx *req_ctx = aead_request_ctx(req);
18011801
unsigned int cipher_flow_mode;
18021802

1803-
if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
1804-
cipher_flow_mode = AES_and_HASH;
1805-
} else { /* Encrypt */
1806-
cipher_flow_mode = AES_to_HASH_and_DOUT;
1807-
}
1808-
18091803
//in RFC4543 no data to encrypt. just copy data from src to dest.
18101804
if (req_ctx->plaintext_authenticate_only) {
18111805
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[],
18171811
return 0;
18181812
}
18191813

1814+
if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
1815+
cipher_flow_mode = AES_and_HASH;
1816+
} else { /* Encrypt */
1817+
cipher_flow_mode = AES_to_HASH_and_DOUT;
1818+
}
1819+
18201820
// for gcm and rfc4106.
18211821
cc_set_ghash_desc(req, desc, seq_size);
18221822
/* process(ghash) assoc data */

0 commit comments

Comments
 (0)