Skip to content

Commit

Permalink
crypto: vmx - Increase priority of aes-cbc cipher
Browse files Browse the repository at this point in the history
All of the VMX AES ciphers (AES, AES-CBC and AES-CTR) are set at
priority 1000. Unfortunately this means we never use AES-CBC and
AES-CTR, because the base AES-CBC cipher that is implemented on
top of AES inherits its priority.

To fix this, AES-CBC and AES-CTR have to be a higher priority. Set
them to 2000.

Testing on a POWER8 with:

cryptsetup benchmark --cipher aes --key-size 256

Shows decryption speed increase from 402.4 MB/s to 3069.2 MB/s,
over 7x faster. Thanks to Mike Strosaker for helping me debug
this issue.

Fixes: 8c755ac ("crypto: vmx - Adding CBC routines for VMX module")
Cc: [email protected]
Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
antonblanchard authored and herbertx committed Jun 13, 2016
1 parent 975f57f commit 12d3f49
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/crypto/vmx/aes_cbc.c
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ struct crypto_alg p8_aes_cbc_alg = {
.cra_name = "cbc(aes)",
.cra_driver_name = "p8_aes_cbc",
.cra_module = THIS_MODULE,
.cra_priority = 1000,
.cra_priority = 2000,
.cra_type = &crypto_blkcipher_type,
.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK,
.cra_alignmask = 0,
2 changes: 1 addition & 1 deletion drivers/crypto/vmx/aes_ctr.c
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ struct crypto_alg p8_aes_ctr_alg = {
.cra_name = "ctr(aes)",
.cra_driver_name = "p8_aes_ctr",
.cra_module = THIS_MODULE,
.cra_priority = 1000,
.cra_priority = 2000,
.cra_type = &crypto_blkcipher_type,
.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK,
.cra_alignmask = 0,

0 comments on commit 12d3f49

Please sign in to comment.