Commit 70e39e22 authored by Pascal van Leeuwen's avatar Pascal van Leeuwen Committed by Herbert Xu

crypto: inside-secure - Remove redundant algo to engine mapping code

This removes some code determine which engine has which algorithms which
was effectively redundant (may have been forward-looking?) due to always
enabling all algorithms for all currently supported engines.
A future patch will use a different, more scalable approach to achieve
this. This is removed now because otherwise the next patch will add new
hardware which would otherwise have to be added to all algorithms, so
now is a convenient time to just get rid of this.
Signed-off-by: default avatarPascal van Leeuwen <pvanleeuwen@verimatrix.com>
Acked-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0f6e5c82
...@@ -884,9 +884,6 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv) ...@@ -884,9 +884,6 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv)
for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) {
safexcel_algs[i]->priv = priv; safexcel_algs[i]->priv = priv;
if (!(safexcel_algs[i]->engines & priv->version))
continue;
if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
ret = crypto_register_skcipher(&safexcel_algs[i]->alg.skcipher); ret = crypto_register_skcipher(&safexcel_algs[i]->alg.skcipher);
else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD)
...@@ -902,9 +899,6 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv) ...@@ -902,9 +899,6 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv)
fail: fail:
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (!(safexcel_algs[j]->engines & priv->version))
continue;
if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
crypto_unregister_skcipher(&safexcel_algs[j]->alg.skcipher); crypto_unregister_skcipher(&safexcel_algs[j]->alg.skcipher);
else if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_AEAD) else if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_AEAD)
...@@ -921,9 +915,6 @@ static void safexcel_unregister_algorithms(struct safexcel_crypto_priv *priv) ...@@ -921,9 +915,6 @@ static void safexcel_unregister_algorithms(struct safexcel_crypto_priv *priv)
int i; int i;
for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) {
if (!(safexcel_algs[i]->engines & priv->version))
continue;
if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
crypto_unregister_skcipher(&safexcel_algs[i]->alg.skcipher); crypto_unregister_skcipher(&safexcel_algs[i]->alg.skcipher);
else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD)
......
...@@ -630,7 +630,6 @@ struct safexcel_ahash_export_state { ...@@ -630,7 +630,6 @@ struct safexcel_ahash_export_state {
struct safexcel_alg_template { struct safexcel_alg_template {
struct safexcel_crypto_priv *priv; struct safexcel_crypto_priv *priv;
enum safexcel_alg_type type; enum safexcel_alg_type type;
u32 engines;
union { union {
struct skcipher_alg skcipher; struct skcipher_alg skcipher;
struct aead_alg aead; struct aead_alg aead;
......
...@@ -1028,7 +1028,6 @@ static void safexcel_aead_cra_exit(struct crypto_tfm *tfm) ...@@ -1028,7 +1028,6 @@ static void safexcel_aead_cra_exit(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_ecb_aes = { struct safexcel_alg_template safexcel_alg_ecb_aes = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_skcipher_aes_setkey, .setkey = safexcel_skcipher_aes_setkey,
.encrypt = safexcel_ecb_aes_encrypt, .encrypt = safexcel_ecb_aes_encrypt,
...@@ -1067,7 +1066,6 @@ static int safexcel_cbc_aes_decrypt(struct skcipher_request *req) ...@@ -1067,7 +1066,6 @@ static int safexcel_cbc_aes_decrypt(struct skcipher_request *req)
struct safexcel_alg_template safexcel_alg_cbc_aes = { struct safexcel_alg_template safexcel_alg_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_skcipher_aes_setkey, .setkey = safexcel_skcipher_aes_setkey,
.encrypt = safexcel_cbc_aes_encrypt, .encrypt = safexcel_cbc_aes_encrypt,
...@@ -1206,7 +1204,6 @@ static int safexcel_des_setkey(struct crypto_skcipher *ctfm, const u8 *key, ...@@ -1206,7 +1204,6 @@ static int safexcel_des_setkey(struct crypto_skcipher *ctfm, const u8 *key,
struct safexcel_alg_template safexcel_alg_cbc_des = { struct safexcel_alg_template safexcel_alg_cbc_des = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_des_setkey, .setkey = safexcel_des_setkey,
.encrypt = safexcel_cbc_des_encrypt, .encrypt = safexcel_cbc_des_encrypt,
...@@ -1246,7 +1243,6 @@ static int safexcel_ecb_des_decrypt(struct skcipher_request *req) ...@@ -1246,7 +1243,6 @@ static int safexcel_ecb_des_decrypt(struct skcipher_request *req)
struct safexcel_alg_template safexcel_alg_ecb_des = { struct safexcel_alg_template safexcel_alg_ecb_des = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_des_setkey, .setkey = safexcel_des_setkey,
.encrypt = safexcel_ecb_des_encrypt, .encrypt = safexcel_ecb_des_encrypt,
...@@ -1308,7 +1304,6 @@ static int safexcel_des3_ede_setkey(struct crypto_skcipher *ctfm, ...@@ -1308,7 +1304,6 @@ static int safexcel_des3_ede_setkey(struct crypto_skcipher *ctfm,
struct safexcel_alg_template safexcel_alg_cbc_des3_ede = { struct safexcel_alg_template safexcel_alg_cbc_des3_ede = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_des3_ede_setkey, .setkey = safexcel_des3_ede_setkey,
.encrypt = safexcel_cbc_des3_ede_encrypt, .encrypt = safexcel_cbc_des3_ede_encrypt,
...@@ -1348,7 +1343,6 @@ static int safexcel_ecb_des3_ede_decrypt(struct skcipher_request *req) ...@@ -1348,7 +1343,6 @@ static int safexcel_ecb_des3_ede_decrypt(struct skcipher_request *req)
struct safexcel_alg_template safexcel_alg_ecb_des3_ede = { struct safexcel_alg_template safexcel_alg_ecb_des3_ede = {
.type = SAFEXCEL_ALG_TYPE_SKCIPHER, .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.skcipher = { .alg.skcipher = {
.setkey = safexcel_des3_ede_setkey, .setkey = safexcel_des3_ede_setkey,
.encrypt = safexcel_ecb_des3_ede_encrypt, .encrypt = safexcel_ecb_des3_ede_encrypt,
...@@ -1418,7 +1412,6 @@ static int safexcel_aead_sha1_cra_init(struct crypto_tfm *tfm) ...@@ -1418,7 +1412,6 @@ static int safexcel_aead_sha1_cra_init(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = { struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_AEAD, .type = SAFEXCEL_ALG_TYPE_AEAD,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.aead = { .alg.aead = {
.setkey = safexcel_aead_setkey, .setkey = safexcel_aead_setkey,
.encrypt = safexcel_aead_encrypt_aes, .encrypt = safexcel_aead_encrypt_aes,
...@@ -1453,7 +1446,6 @@ static int safexcel_aead_sha256_cra_init(struct crypto_tfm *tfm) ...@@ -1453,7 +1446,6 @@ static int safexcel_aead_sha256_cra_init(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = { struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_AEAD, .type = SAFEXCEL_ALG_TYPE_AEAD,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.aead = { .alg.aead = {
.setkey = safexcel_aead_setkey, .setkey = safexcel_aead_setkey,
.encrypt = safexcel_aead_encrypt_aes, .encrypt = safexcel_aead_encrypt_aes,
...@@ -1488,7 +1480,6 @@ static int safexcel_aead_sha224_cra_init(struct crypto_tfm *tfm) ...@@ -1488,7 +1480,6 @@ static int safexcel_aead_sha224_cra_init(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = { struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_AEAD, .type = SAFEXCEL_ALG_TYPE_AEAD,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.aead = { .alg.aead = {
.setkey = safexcel_aead_setkey, .setkey = safexcel_aead_setkey,
.encrypt = safexcel_aead_encrypt_aes, .encrypt = safexcel_aead_encrypt_aes,
...@@ -1523,7 +1514,6 @@ static int safexcel_aead_sha512_cra_init(struct crypto_tfm *tfm) ...@@ -1523,7 +1514,6 @@ static int safexcel_aead_sha512_cra_init(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = { struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_AEAD, .type = SAFEXCEL_ALG_TYPE_AEAD,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.aead = { .alg.aead = {
.setkey = safexcel_aead_setkey, .setkey = safexcel_aead_setkey,
.encrypt = safexcel_aead_encrypt_aes, .encrypt = safexcel_aead_encrypt_aes,
...@@ -1558,7 +1548,6 @@ static int safexcel_aead_sha384_cra_init(struct crypto_tfm *tfm) ...@@ -1558,7 +1548,6 @@ static int safexcel_aead_sha384_cra_init(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = { struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = {
.type = SAFEXCEL_ALG_TYPE_AEAD, .type = SAFEXCEL_ALG_TYPE_AEAD,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.aead = { .alg.aead = {
.setkey = safexcel_aead_setkey, .setkey = safexcel_aead_setkey,
.encrypt = safexcel_aead_encrypt_aes, .encrypt = safexcel_aead_encrypt_aes,
......
...@@ -845,7 +845,6 @@ static void safexcel_ahash_cra_exit(struct crypto_tfm *tfm) ...@@ -845,7 +845,6 @@ static void safexcel_ahash_cra_exit(struct crypto_tfm *tfm)
struct safexcel_alg_template safexcel_alg_sha1 = { struct safexcel_alg_template safexcel_alg_sha1 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_sha1_init, .init = safexcel_sha1_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1086,7 +1085,6 @@ static int safexcel_hmac_sha1_setkey(struct crypto_ahash *tfm, const u8 *key, ...@@ -1086,7 +1085,6 @@ static int safexcel_hmac_sha1_setkey(struct crypto_ahash *tfm, const u8 *key,
struct safexcel_alg_template safexcel_alg_hmac_sha1 = { struct safexcel_alg_template safexcel_alg_hmac_sha1 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_sha1_init, .init = safexcel_hmac_sha1_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1142,7 +1140,6 @@ static int safexcel_sha256_digest(struct ahash_request *areq) ...@@ -1142,7 +1140,6 @@ static int safexcel_sha256_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_sha256 = { struct safexcel_alg_template safexcel_alg_sha256 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_sha256_init, .init = safexcel_sha256_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1197,7 +1194,6 @@ static int safexcel_sha224_digest(struct ahash_request *areq) ...@@ -1197,7 +1194,6 @@ static int safexcel_sha224_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_sha224 = { struct safexcel_alg_template safexcel_alg_sha224 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_sha224_init, .init = safexcel_sha224_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1266,7 +1262,6 @@ static int safexcel_hmac_sha224_digest(struct ahash_request *areq) ...@@ -1266,7 +1262,6 @@ static int safexcel_hmac_sha224_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_hmac_sha224 = { struct safexcel_alg_template safexcel_alg_hmac_sha224 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_sha224_init, .init = safexcel_hmac_sha224_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1336,7 +1331,6 @@ static int safexcel_hmac_sha256_digest(struct ahash_request *areq) ...@@ -1336,7 +1331,6 @@ static int safexcel_hmac_sha256_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_hmac_sha256 = { struct safexcel_alg_template safexcel_alg_hmac_sha256 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_sha256_init, .init = safexcel_hmac_sha256_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1392,7 +1386,6 @@ static int safexcel_sha512_digest(struct ahash_request *areq) ...@@ -1392,7 +1386,6 @@ static int safexcel_sha512_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_sha512 = { struct safexcel_alg_template safexcel_alg_sha512 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_sha512_init, .init = safexcel_sha512_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1447,7 +1440,6 @@ static int safexcel_sha384_digest(struct ahash_request *areq) ...@@ -1447,7 +1440,6 @@ static int safexcel_sha384_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_sha384 = { struct safexcel_alg_template safexcel_alg_sha384 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_sha384_init, .init = safexcel_sha384_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1516,7 +1508,6 @@ static int safexcel_hmac_sha512_digest(struct ahash_request *areq) ...@@ -1516,7 +1508,6 @@ static int safexcel_hmac_sha512_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_hmac_sha512 = { struct safexcel_alg_template safexcel_alg_hmac_sha512 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_sha512_init, .init = safexcel_hmac_sha512_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1586,7 +1577,6 @@ static int safexcel_hmac_sha384_digest(struct ahash_request *areq) ...@@ -1586,7 +1577,6 @@ static int safexcel_hmac_sha384_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_hmac_sha384 = { struct safexcel_alg_template safexcel_alg_hmac_sha384 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_sha384_init, .init = safexcel_hmac_sha384_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1642,7 +1632,6 @@ static int safexcel_md5_digest(struct ahash_request *areq) ...@@ -1642,7 +1632,6 @@ static int safexcel_md5_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_md5 = { struct safexcel_alg_template safexcel_alg_md5 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_md5_init, .init = safexcel_md5_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
...@@ -1712,7 +1701,6 @@ static int safexcel_hmac_md5_digest(struct ahash_request *areq) ...@@ -1712,7 +1701,6 @@ static int safexcel_hmac_md5_digest(struct ahash_request *areq)
struct safexcel_alg_template safexcel_alg_hmac_md5 = { struct safexcel_alg_template safexcel_alg_hmac_md5 = {
.type = SAFEXCEL_ALG_TYPE_AHASH, .type = SAFEXCEL_ALG_TYPE_AHASH,
.engines = EIP97IES | EIP197B | EIP197D,
.alg.ahash = { .alg.ahash = {
.init = safexcel_hmac_md5_init, .init = safexcel_hmac_md5_init,
.update = safexcel_ahash_update, .update = safexcel_ahash_update,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment