diff options
author | Horia Geantă <horia.geanta@nxp.com> | 2016-11-22 15:44:03 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-11-28 21:23:21 +0800 |
commit | 64c9295b2320efea5aec1d0511577e9cee06eddb (patch) | |
tree | 5c1d2628f0f8bb91f87b5e47eaa6b0daeedec3a3 /drivers/crypto | |
parent | 211f41af534ad426199a523e4cfec2034a2bdef7 (diff) | |
download | linux-64c9295b2320efea5aec1d0511577e9cee06eddb.tar.gz linux-64c9295b2320efea5aec1d0511577e9cee06eddb.tar.bz2 linux-64c9295b2320efea5aec1d0511577e9cee06eddb.zip |
crypto: caam - move append_key_aead() into init_sh_desc_key_aead()
append_key_aead() is used in only one place, thus inline it.
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 8db54b090d39..567e234fb49b 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -228,12 +228,19 @@ struct caam_ctx { unsigned int authsize; }; -static void append_key_aead(u32 *desc, struct caam_ctx *ctx, - int keys_fit_inline, bool is_rfc3686) +static void init_sh_desc_key_aead(u32 *desc, struct caam_ctx *ctx, + int keys_fit_inline, bool is_rfc3686) { - u32 *nonce; + u32 *key_jump_cmd; unsigned int enckeylen = ctx->enckeylen; + /* Note: Context registers are saved. */ + init_sh_desc(desc, HDR_SHARE_SERIAL | HDR_SAVECTX); + + /* Skip if already shared */ + key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | + JUMP_COND_SHRD); + /* * RFC3686 specific: * | ctx->key = {AUTH_KEY, ENC_KEY, NONCE} @@ -258,6 +265,8 @@ static void append_key_aead(u32 *desc, struct caam_ctx *ctx, /* Load Counter into CONTEXT1 reg */ if (is_rfc3686) { + u32 *nonce; + nonce = (u32 *)((void *)ctx->key + ctx->split_key_pad_len + enckeylen); append_load_as_imm(desc, nonce, CTR_RFC3686_NONCE_SIZE, @@ -269,21 +278,6 @@ static void append_key_aead(u32 *desc, struct caam_ctx *ctx, (16 << MOVE_OFFSET_SHIFT) | (CTR_RFC3686_NONCE_SIZE << MOVE_LEN_SHIFT)); } -} - -static void init_sh_desc_key_aead(u32 *desc, struct caam_ctx *ctx, - int keys_fit_inline, bool is_rfc3686) -{ - u32 *key_jump_cmd; - - /* Note: Context registers are saved. */ - init_sh_desc(desc, HDR_SHARE_SERIAL | HDR_SAVECTX); - - /* Skip if already shared */ - key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | - JUMP_COND_SHRD); - - append_key_aead(desc, ctx, keys_fit_inline, is_rfc3686); set_jump_tgt_here(desc, key_jump_cmd); } |