mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-20 13:51:32 +00:00
crypto: inside-secure - Only enable algorithms advertised by the hardware
This patch probes the supported algorithms from the hardware and only registers the ones that the hardware actually supports. This is necessary because this is a generic driver supposed to run on a wide variety of engines, which may or may not implement certain algorithms. Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
c7da38a71c
commit
062b64ca6d
4 changed files with 98 additions and 2 deletions
|
@ -1034,6 +1034,7 @@ static int safexcel_skcipher_aes_ecb_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_ecb_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_AES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_skcipher_aes_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1068,6 +1069,7 @@ static int safexcel_skcipher_aes_cbc_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_AES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_skcipher_aes_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1141,6 +1143,7 @@ static int safexcel_skcipher_aes_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_AES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_skcipher_aesctr_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1198,6 +1201,7 @@ static int safexcel_skcipher_des_cbc_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_cbc_des = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_DES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_des_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1233,6 +1237,7 @@ static int safexcel_skcipher_des_ecb_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_ecb_des = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_DES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_des_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1290,6 +1295,7 @@ static int safexcel_skcipher_des3_cbc_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_cbc_des3_ede = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_DES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_des3_ede_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1325,6 +1331,7 @@ static int safexcel_skcipher_des3_ecb_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_ecb_des3_ede = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_DES,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_des3_ede_setkey,
|
||||
.encrypt = safexcel_encrypt,
|
||||
|
@ -1393,6 +1400,7 @@ static int safexcel_aead_sha1_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA1,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1427,6 +1435,7 @@ static int safexcel_aead_sha256_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1461,6 +1470,7 @@ static int safexcel_aead_sha224_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1495,6 +1505,7 @@ static int safexcel_aead_sha512_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1529,6 +1540,7 @@ static int safexcel_aead_sha384_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1562,6 +1574,7 @@ static int safexcel_aead_sha1_des3_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_des3_ede = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_DES | SAFEXCEL_ALG_SHA1,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1595,6 +1608,7 @@ static int safexcel_aead_sha1_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA1,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1628,6 +1642,7 @@ static int safexcel_aead_sha256_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1661,6 +1676,7 @@ static int safexcel_aead_sha224_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1694,6 +1710,7 @@ static int safexcel_aead_sha512_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1727,6 +1744,7 @@ static int safexcel_aead_sha384_ctr_cra_init(struct crypto_tfm *tfm)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_AEAD,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512,
|
||||
.alg.aead = {
|
||||
.setkey = safexcel_aead_setkey,
|
||||
.encrypt = safexcel_aead_encrypt,
|
||||
|
@ -1840,6 +1858,7 @@ static int safexcel_decrypt_xts(struct skcipher_request *req)
|
|||
|
||||
struct safexcel_alg_template safexcel_alg_xts_aes = {
|
||||
.type = SAFEXCEL_ALG_TYPE_SKCIPHER,
|
||||
.algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_AES_XTS,
|
||||
.alg.skcipher = {
|
||||
.setkey = safexcel_skcipher_aesxts_setkey,
|
||||
.encrypt = safexcel_encrypt_xts,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue