Skip to content

Commit 89a82ef

Browse files
Cyrille Pitchenherbertx
authored andcommitted
crypto: atmel-authenc - add support to authenc(hmac(shaX), Y(aes)) modes
This patchs allows to combine the AES and SHA hardware accelerators on some Atmel SoCs. Doing so, AES blocks are only written to/read from the AES hardware. Those blocks are also transferred from the AES to the SHA accelerator internally, without additionnal accesses to the system busses. Hence, the AES and SHA accelerators work in parallel to process all the data blocks, instead of serializing the process by (de)crypting those blocks first then authenticating them after like the generic crypto/authenc.c driver does. Of course, both the AES and SHA hardware accelerators need to be available before we can start to process the data blocks. Hence we use their crypto request queue to synchronize both drivers. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent a1f613f commit 89a82ef

File tree

6 files changed

+883
-15
lines changed

6 files changed

+883
-15
lines changed

drivers/crypto/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,18 @@ config CRYPTO_DEV_BFIN_CRC
415415
Newer Blackfin processors have CRC hardware. Select this if you
416416
want to use the Blackfin CRC module.
417417

418+
config CRYPTO_DEV_ATMEL_AUTHENC
419+
tristate "Support for Atmel IPSEC/SSL hw accelerator"
420+
depends on (ARCH_AT91 && HAS_DMA) || COMPILE_TEST
421+
select CRYPTO_AUTHENC
422+
select CRYPTO_DEV_ATMEL_AES
423+
select CRYPTO_DEV_ATMEL_SHA
424+
help
425+
Some Atmel processors can combine the AES and SHA hw accelerators
426+
to enhance support of IPSEC/SSL.
427+
Select this if you want to use the Atmel modules for
428+
authenc(hmac(shaX),Y(cbc)) algorithms.
429+
418430
config CRYPTO_DEV_ATMEL_AES
419431
tristate "Support for Atmel AES hw accelerator"
420432
depends on HAS_DMA

drivers/crypto/atmel-aes-regs.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@
6868
#define AES_CTRR 0x98
6969
#define AES_GCMHR(x) (0x9c + ((x) * 0x04))
7070

71+
#define AES_EMR 0xb0
72+
#define AES_EMR_APEN BIT(0) /* Auto Padding Enable */
73+
#define AES_EMR_APM BIT(1) /* Auto Padding Mode */
74+
#define AES_EMR_APM_IPSEC 0x0
75+
#define AES_EMR_APM_SSL BIT(1)
76+
#define AES_EMR_PLIPEN BIT(4) /* PLIP Enable */
77+
#define AES_EMR_PLIPD BIT(5) /* PLIP Decipher */
78+
#define AES_EMR_PADLEN_MASK (0xFu << 8)
79+
#define AES_EMR_PADLEN_OFFSET 8
80+
#define AES_EMR_PADLEN(padlen) (((padlen) << AES_EMR_PADLEN_OFFSET) &\
81+
AES_EMR_PADLEN_MASK)
82+
#define AES_EMR_NHEAD_MASK (0xFu << 16)
83+
#define AES_EMR_NHEAD_OFFSET 16
84+
#define AES_EMR_NHEAD(nhead) (((nhead) << AES_EMR_NHEAD_OFFSET) &\
85+
AES_EMR_NHEAD_MASK)
86+
7187
#define AES_TWR(x) (0xc0 + ((x) * 0x04))
7288
#define AES_ALPHAR(x) (0xd0 + ((x) * 0x04))
7389

0 commit comments

Comments
 (0)