diff options
author | Christian Lamparter <chunkeey@googlemail.com> | 2017-08-25 16:47:20 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-09-22 12:43:18 +0300 |
commit | 249c8d98ea339325dca481d5dae93686cd494059 (patch) | |
tree | 5dd6fbee8aa4676b2113e1b76927b10f5d3cfc34 /drivers/crypto/amcc/crypto4xx_sa.h | |
parent | 453e3090b9c3f5da70b21648c2244e9821f0916d (diff) | |
download | linux-249c8d98ea339325dca481d5dae93686cd494059.tar.xz |
crypto: crypto4xx - move and refactor dynamic_contents helpers
This patch refactors and moves the dynamic_contents helper
functions into the crypto4xx_sa.h header file.
* get_dynamic_sa_iv_size is no longer needed, as the cryptoapi
provides the required IV size information as well.
* refactor the function declarations to use the a pointer to the
dynamic_sa_contents union, instead of the crypto4xx_ctx.
* rename get_dynamic_sa_offset_key_field to get_dynamic_sa_key_field.
It returns the pointer to the key directly.
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/amcc/crypto4xx_sa.h')
-rw-r--r-- | drivers/crypto/amcc/crypto4xx_sa.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_sa.h b/drivers/crypto/amcc/crypto4xx_sa.h index 537d548a20b7..3c3dfcaf4e0f 100644 --- a/drivers/crypto/amcc/crypto4xx_sa.h +++ b/drivers/crypto/amcc/crypto4xx_sa.h @@ -240,4 +240,32 @@ struct dynamic_sa_hash160 { #define SA_HASH160_LEN (sizeof(struct dynamic_sa_hash160)/4) #define SA_HASH160_CONTENTS 0x2000a502 +static inline u32 +get_dynamic_sa_offset_state_ptr_field(struct dynamic_sa_ctl *cts) +{ + u32 offset; + + offset = cts->sa_contents.bf.key_size + + cts->sa_contents.bf.inner_size + + cts->sa_contents.bf.outer_size + + cts->sa_contents.bf.spi + + cts->sa_contents.bf.seq_num0 + + cts->sa_contents.bf.seq_num1 + + cts->sa_contents.bf.seq_num_mask0 + + cts->sa_contents.bf.seq_num_mask1 + + cts->sa_contents.bf.seq_num_mask2 + + cts->sa_contents.bf.seq_num_mask3 + + cts->sa_contents.bf.iv0 + + cts->sa_contents.bf.iv1 + + cts->sa_contents.bf.iv2 + + cts->sa_contents.bf.iv3; + + return sizeof(struct dynamic_sa_ctl) + offset * 4; +} + +static inline u8 *get_dynamic_sa_key_field(struct dynamic_sa_ctl *cts) +{ + return (u8 *) ((unsigned long)cts + sizeof(struct dynamic_sa_ctl)); +} + #endif |