diff options
Diffstat (limited to 'drivers/crypto/inside-secure')
-rw-r--r-- | drivers/crypto/inside-secure/safexcel.c | 36 | ||||
-rw-r--r-- | drivers/crypto/inside-secure/safexcel.h | 33 | ||||
-rw-r--r-- | drivers/crypto/inside-secure/safexcel_cipher.c | 19 | ||||
-rw-r--r-- | drivers/crypto/inside-secure/safexcel_hash.c | 12 |
4 files changed, 98 insertions, 2 deletions
diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index 9941861ae1d8..25285d664581 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c | |||
@@ -284,7 +284,7 @@ retry_fw: | |||
284 | ipuesz = eip197_write_firmware(priv, fw[FW_IPUE]); | 284 | ipuesz = eip197_write_firmware(priv, fw[FW_IPUE]); |
285 | 285 | ||
286 | if (eip197_start_firmware(priv, ipuesz, ifppsz, minifw)) { | 286 | if (eip197_start_firmware(priv, ipuesz, ifppsz, minifw)) { |
287 | dev_dbg(priv->dev, "Firmware loaded successfully"); | 287 | dev_dbg(priv->dev, "Firmware loaded successfully\n"); |
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | 290 | ||
@@ -1014,6 +1014,12 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv) | |||
1014 | for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { | 1014 | for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { |
1015 | safexcel_algs[i]->priv = priv; | 1015 | safexcel_algs[i]->priv = priv; |
1016 | 1016 | ||
1017 | /* Do we have all required base algorithms available? */ | ||
1018 | if ((safexcel_algs[i]->algo_mask & priv->hwconfig.algo_flags) != | ||
1019 | safexcel_algs[i]->algo_mask) | ||
1020 | /* No, so don't register this ciphersuite */ | ||
1021 | continue; | ||
1022 | |||
1017 | if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) | 1023 | if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) |
1018 | ret = crypto_register_skcipher(&safexcel_algs[i]->alg.skcipher); | 1024 | ret = crypto_register_skcipher(&safexcel_algs[i]->alg.skcipher); |
1019 | else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) | 1025 | else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) |
@@ -1029,6 +1035,12 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv) | |||
1029 | 1035 | ||
1030 | fail: | 1036 | fail: |
1031 | for (j = 0; j < i; j++) { | 1037 | for (j = 0; j < i; j++) { |
1038 | /* Do we have all required base algorithms available? */ | ||
1039 | if ((safexcel_algs[j]->algo_mask & priv->hwconfig.algo_flags) != | ||
1040 | safexcel_algs[j]->algo_mask) | ||
1041 | /* No, so don't unregister this ciphersuite */ | ||
1042 | continue; | ||
1043 | |||
1032 | if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) | 1044 | if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) |
1033 | crypto_unregister_skcipher(&safexcel_algs[j]->alg.skcipher); | 1045 | crypto_unregister_skcipher(&safexcel_algs[j]->alg.skcipher); |
1034 | else if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_AEAD) | 1046 | else if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_AEAD) |
@@ -1045,6 +1057,12 @@ static void safexcel_unregister_algorithms(struct safexcel_crypto_priv *priv) | |||
1045 | int i; | 1057 | int i; |
1046 | 1058 | ||
1047 | for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { | 1059 | for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) { |
1060 | /* Do we have all required base algorithms available? */ | ||
1061 | if ((safexcel_algs[i]->algo_mask & priv->hwconfig.algo_flags) != | ||
1062 | safexcel_algs[i]->algo_mask) | ||
1063 | /* No, so don't unregister this ciphersuite */ | ||
1064 | continue; | ||
1065 | |||
1048 | if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) | 1066 | if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER) |
1049 | crypto_unregister_skcipher(&safexcel_algs[i]->alg.skcipher); | 1067 | crypto_unregister_skcipher(&safexcel_algs[i]->alg.skcipher); |
1050 | else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) | 1068 | else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD) |
@@ -1123,6 +1141,7 @@ static int safexcel_probe_generic(void *pdev, | |||
1123 | int is_pci_dev) | 1141 | int is_pci_dev) |
1124 | { | 1142 | { |
1125 | struct device *dev = priv->dev; | 1143 | struct device *dev = priv->dev; |
1144 | u32 peid; | ||
1126 | int i, ret; | 1145 | int i, ret; |
1127 | 1146 | ||
1128 | priv->context_pool = dmam_pool_create("safexcel-context", dev, | 1147 | priv->context_pool = dmam_pool_create("safexcel-context", dev, |
@@ -1133,8 +1152,21 @@ static int safexcel_probe_generic(void *pdev, | |||
1133 | 1152 | ||
1134 | safexcel_init_register_offsets(priv); | 1153 | safexcel_init_register_offsets(priv); |
1135 | 1154 | ||
1136 | if (priv->version != EIP97IES_MRVL) | 1155 | /* Get supported algorithms from EIP96 transform engine */ |
1156 | priv->hwconfig.algo_flags = readl(EIP197_PE(priv) + | ||
1157 | EIP197_PE_EIP96_OPTIONS(0)); | ||
1158 | |||
1159 | if (priv->version == EIP97IES_MRVL) { | ||
1160 | peid = 97; | ||
1161 | } else { | ||
1137 | priv->flags |= EIP197_TRC_CACHE; | 1162 | priv->flags |= EIP197_TRC_CACHE; |
1163 | peid = 197; | ||
1164 | } | ||
1165 | |||
1166 | /* Dump some debug information important during development */ | ||
1167 | dev_dbg(priv->dev, "Inside Secure EIP%d packetengine\n", peid); | ||
1168 | dev_dbg(priv->dev, "Supported algorithms: %08x\n", | ||
1169 | priv->hwconfig.algo_flags); | ||
1138 | 1170 | ||
1139 | safexcel_configure(priv); | 1171 | safexcel_configure(priv); |
1140 | 1172 | ||
diff --git a/drivers/crypto/inside-secure/safexcel.h b/drivers/crypto/inside-secure/safexcel.h index 0a30a7bf4fe0..b5ff62fa3044 100644 --- a/drivers/crypto/inside-secure/safexcel.h +++ b/drivers/crypto/inside-secure/safexcel.h | |||
@@ -145,6 +145,7 @@ | |||
145 | #define EIP197_PE_EIP96_FUNCTION_EN(n) (0x1004 + (0x2000 * (n))) | 145 | #define EIP197_PE_EIP96_FUNCTION_EN(n) (0x1004 + (0x2000 * (n))) |
146 | #define EIP197_PE_EIP96_CONTEXT_CTRL(n) (0x1008 + (0x2000 * (n))) | 146 | #define EIP197_PE_EIP96_CONTEXT_CTRL(n) (0x1008 + (0x2000 * (n))) |
147 | #define EIP197_PE_EIP96_CONTEXT_STAT(n) (0x100c + (0x2000 * (n))) | 147 | #define EIP197_PE_EIP96_CONTEXT_STAT(n) (0x100c + (0x2000 * (n))) |
148 | #define EIP197_PE_EIP96_OPTIONS(n) (0x13f8 + (0x2000 * (n))) | ||
148 | #define EIP197_PE_OUT_DBUF_THRES(n) (0x1c00 + (0x2000 * (n))) | 149 | #define EIP197_PE_OUT_DBUF_THRES(n) (0x1c00 + (0x2000 * (n))) |
149 | #define EIP197_PE_OUT_TBUF_THRES(n) (0x1d00 + (0x2000 * (n))) | 150 | #define EIP197_PE_OUT_TBUF_THRES(n) (0x1d00 + (0x2000 * (n))) |
150 | #define EIP197_MST_CTRL 0xfff4 | 151 | #define EIP197_MST_CTRL 0xfff4 |
@@ -597,6 +598,32 @@ enum safexcel_eip_version { | |||
597 | EIP197_DEVBRD | 598 | EIP197_DEVBRD |
598 | }; | 599 | }; |
599 | 600 | ||
601 | /* EIP algorithm presence flags */ | ||
602 | enum safexcel_eip_algorithms { | ||
603 | SAFEXCEL_ALG_BC0 = BIT(5), | ||
604 | SAFEXCEL_ALG_SM4 = BIT(6), | ||
605 | SAFEXCEL_ALG_SM3 = BIT(7), | ||
606 | SAFEXCEL_ALG_CHACHA20 = BIT(8), | ||
607 | SAFEXCEL_ALG_POLY1305 = BIT(9), | ||
608 | SAFEXCEL_SEQMASK_256 = BIT(10), | ||
609 | SAFEXCEL_SEQMASK_384 = BIT(11), | ||
610 | SAFEXCEL_ALG_AES = BIT(12), | ||
611 | SAFEXCEL_ALG_AES_XFB = BIT(13), | ||
612 | SAFEXCEL_ALG_DES = BIT(15), | ||
613 | SAFEXCEL_ALG_DES_XFB = BIT(16), | ||
614 | SAFEXCEL_ALG_ARC4 = BIT(18), | ||
615 | SAFEXCEL_ALG_AES_XTS = BIT(20), | ||
616 | SAFEXCEL_ALG_WIRELESS = BIT(21), | ||
617 | SAFEXCEL_ALG_MD5 = BIT(22), | ||
618 | SAFEXCEL_ALG_SHA1 = BIT(23), | ||
619 | SAFEXCEL_ALG_SHA2_256 = BIT(25), | ||
620 | SAFEXCEL_ALG_SHA2_512 = BIT(26), | ||
621 | SAFEXCEL_ALG_XCBC_MAC = BIT(27), | ||
622 | SAFEXCEL_ALG_CBC_MAC_ALL = BIT(29), | ||
623 | SAFEXCEL_ALG_GHASH = BIT(30), | ||
624 | SAFEXCEL_ALG_SHA3 = BIT(31), | ||
625 | }; | ||
626 | |||
600 | struct safexcel_register_offsets { | 627 | struct safexcel_register_offsets { |
601 | u32 hia_aic; | 628 | u32 hia_aic; |
602 | u32 hia_aic_g; | 629 | u32 hia_aic_g; |
@@ -614,6 +641,10 @@ enum safexcel_flags { | |||
614 | EIP197_TRC_CACHE = BIT(0), | 641 | EIP197_TRC_CACHE = BIT(0), |
615 | }; | 642 | }; |
616 | 643 | ||
644 | struct safexcel_hwconfig { | ||
645 | enum safexcel_eip_algorithms algo_flags; | ||
646 | }; | ||
647 | |||
617 | struct safexcel_crypto_priv { | 648 | struct safexcel_crypto_priv { |
618 | void __iomem *base; | 649 | void __iomem *base; |
619 | struct device *dev; | 650 | struct device *dev; |
@@ -623,6 +654,7 @@ struct safexcel_crypto_priv { | |||
623 | 654 | ||
624 | enum safexcel_eip_version version; | 655 | enum safexcel_eip_version version; |
625 | struct safexcel_register_offsets offsets; | 656 | struct safexcel_register_offsets offsets; |
657 | struct safexcel_hwconfig hwconfig; | ||
626 | u32 flags; | 658 | u32 flags; |
627 | 659 | ||
628 | /* context DMA pool */ | 660 | /* context DMA pool */ |
@@ -667,6 +699,7 @@ struct safexcel_ahash_export_state { | |||
667 | struct safexcel_alg_template { | 699 | struct safexcel_alg_template { |
668 | struct safexcel_crypto_priv *priv; | 700 | struct safexcel_crypto_priv *priv; |
669 | enum safexcel_alg_type type; | 701 | enum safexcel_alg_type type; |
702 | enum safexcel_eip_algorithms algo_mask; | ||
670 | union { | 703 | union { |
671 | struct skcipher_alg skcipher; | 704 | struct skcipher_alg skcipher; |
672 | struct aead_alg aead; | 705 | struct aead_alg aead; |
diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c index 05e34c62945c..e60e797b5719 100644 --- a/drivers/crypto/inside-secure/safexcel_cipher.c +++ b/drivers/crypto/inside-secure/safexcel_cipher.c | |||
@@ -1034,6 +1034,7 @@ static int safexcel_skcipher_aes_ecb_cra_init(struct crypto_tfm *tfm) | |||
1034 | 1034 | ||
1035 | struct safexcel_alg_template safexcel_alg_ecb_aes = { | 1035 | struct safexcel_alg_template safexcel_alg_ecb_aes = { |
1036 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1036 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1037 | .algo_mask = SAFEXCEL_ALG_AES, | ||
1037 | .alg.skcipher = { | 1038 | .alg.skcipher = { |
1038 | .setkey = safexcel_skcipher_aes_setkey, | 1039 | .setkey = safexcel_skcipher_aes_setkey, |
1039 | .encrypt = safexcel_encrypt, | 1040 | .encrypt = safexcel_encrypt, |
@@ -1068,6 +1069,7 @@ static int safexcel_skcipher_aes_cbc_cra_init(struct crypto_tfm *tfm) | |||
1068 | 1069 | ||
1069 | struct safexcel_alg_template safexcel_alg_cbc_aes = { | 1070 | struct safexcel_alg_template safexcel_alg_cbc_aes = { |
1070 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1071 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1072 | .algo_mask = SAFEXCEL_ALG_AES, | ||
1071 | .alg.skcipher = { | 1073 | .alg.skcipher = { |
1072 | .setkey = safexcel_skcipher_aes_setkey, | 1074 | .setkey = safexcel_skcipher_aes_setkey, |
1073 | .encrypt = safexcel_encrypt, | 1075 | .encrypt = safexcel_encrypt, |
@@ -1141,6 +1143,7 @@ static int safexcel_skcipher_aes_ctr_cra_init(struct crypto_tfm *tfm) | |||
1141 | 1143 | ||
1142 | struct safexcel_alg_template safexcel_alg_ctr_aes = { | 1144 | struct safexcel_alg_template safexcel_alg_ctr_aes = { |
1143 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1145 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1146 | .algo_mask = SAFEXCEL_ALG_AES, | ||
1144 | .alg.skcipher = { | 1147 | .alg.skcipher = { |
1145 | .setkey = safexcel_skcipher_aesctr_setkey, | 1148 | .setkey = safexcel_skcipher_aesctr_setkey, |
1146 | .encrypt = safexcel_encrypt, | 1149 | .encrypt = safexcel_encrypt, |
@@ -1198,6 +1201,7 @@ static int safexcel_skcipher_des_cbc_cra_init(struct crypto_tfm *tfm) | |||
1198 | 1201 | ||
1199 | struct safexcel_alg_template safexcel_alg_cbc_des = { | 1202 | struct safexcel_alg_template safexcel_alg_cbc_des = { |
1200 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1203 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1204 | .algo_mask = SAFEXCEL_ALG_DES, | ||
1201 | .alg.skcipher = { | 1205 | .alg.skcipher = { |
1202 | .setkey = safexcel_des_setkey, | 1206 | .setkey = safexcel_des_setkey, |
1203 | .encrypt = safexcel_encrypt, | 1207 | .encrypt = safexcel_encrypt, |
@@ -1233,6 +1237,7 @@ static int safexcel_skcipher_des_ecb_cra_init(struct crypto_tfm *tfm) | |||
1233 | 1237 | ||
1234 | struct safexcel_alg_template safexcel_alg_ecb_des = { | 1238 | struct safexcel_alg_template safexcel_alg_ecb_des = { |
1235 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1239 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1240 | .algo_mask = SAFEXCEL_ALG_DES, | ||
1236 | .alg.skcipher = { | 1241 | .alg.skcipher = { |
1237 | .setkey = safexcel_des_setkey, | 1242 | .setkey = safexcel_des_setkey, |
1238 | .encrypt = safexcel_encrypt, | 1243 | .encrypt = safexcel_encrypt, |
@@ -1290,6 +1295,7 @@ static int safexcel_skcipher_des3_cbc_cra_init(struct crypto_tfm *tfm) | |||
1290 | 1295 | ||
1291 | struct safexcel_alg_template safexcel_alg_cbc_des3_ede = { | 1296 | struct safexcel_alg_template safexcel_alg_cbc_des3_ede = { |
1292 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1297 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1298 | .algo_mask = SAFEXCEL_ALG_DES, | ||
1293 | .alg.skcipher = { | 1299 | .alg.skcipher = { |
1294 | .setkey = safexcel_des3_ede_setkey, | 1300 | .setkey = safexcel_des3_ede_setkey, |
1295 | .encrypt = safexcel_encrypt, | 1301 | .encrypt = safexcel_encrypt, |
@@ -1325,6 +1331,7 @@ static int safexcel_skcipher_des3_ecb_cra_init(struct crypto_tfm *tfm) | |||
1325 | 1331 | ||
1326 | struct safexcel_alg_template safexcel_alg_ecb_des3_ede = { | 1332 | struct safexcel_alg_template safexcel_alg_ecb_des3_ede = { |
1327 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1333 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1334 | .algo_mask = SAFEXCEL_ALG_DES, | ||
1328 | .alg.skcipher = { | 1335 | .alg.skcipher = { |
1329 | .setkey = safexcel_des3_ede_setkey, | 1336 | .setkey = safexcel_des3_ede_setkey, |
1330 | .encrypt = safexcel_encrypt, | 1337 | .encrypt = safexcel_encrypt, |
@@ -1393,6 +1400,7 @@ static int safexcel_aead_sha1_cra_init(struct crypto_tfm *tfm) | |||
1393 | 1400 | ||
1394 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = { | 1401 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = { |
1395 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1402 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1403 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA1, | ||
1396 | .alg.aead = { | 1404 | .alg.aead = { |
1397 | .setkey = safexcel_aead_setkey, | 1405 | .setkey = safexcel_aead_setkey, |
1398 | .encrypt = safexcel_aead_encrypt, | 1406 | .encrypt = safexcel_aead_encrypt, |
@@ -1427,6 +1435,7 @@ static int safexcel_aead_sha256_cra_init(struct crypto_tfm *tfm) | |||
1427 | 1435 | ||
1428 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = { | 1436 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = { |
1429 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1437 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1438 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256, | ||
1430 | .alg.aead = { | 1439 | .alg.aead = { |
1431 | .setkey = safexcel_aead_setkey, | 1440 | .setkey = safexcel_aead_setkey, |
1432 | .encrypt = safexcel_aead_encrypt, | 1441 | .encrypt = safexcel_aead_encrypt, |
@@ -1461,6 +1470,7 @@ static int safexcel_aead_sha224_cra_init(struct crypto_tfm *tfm) | |||
1461 | 1470 | ||
1462 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = { | 1471 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = { |
1463 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1472 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1473 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256, | ||
1464 | .alg.aead = { | 1474 | .alg.aead = { |
1465 | .setkey = safexcel_aead_setkey, | 1475 | .setkey = safexcel_aead_setkey, |
1466 | .encrypt = safexcel_aead_encrypt, | 1476 | .encrypt = safexcel_aead_encrypt, |
@@ -1495,6 +1505,7 @@ static int safexcel_aead_sha512_cra_init(struct crypto_tfm *tfm) | |||
1495 | 1505 | ||
1496 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = { | 1506 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = { |
1497 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1507 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1508 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512, | ||
1498 | .alg.aead = { | 1509 | .alg.aead = { |
1499 | .setkey = safexcel_aead_setkey, | 1510 | .setkey = safexcel_aead_setkey, |
1500 | .encrypt = safexcel_aead_encrypt, | 1511 | .encrypt = safexcel_aead_encrypt, |
@@ -1529,6 +1540,7 @@ static int safexcel_aead_sha384_cra_init(struct crypto_tfm *tfm) | |||
1529 | 1540 | ||
1530 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = { | 1541 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = { |
1531 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1542 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1543 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512, | ||
1532 | .alg.aead = { | 1544 | .alg.aead = { |
1533 | .setkey = safexcel_aead_setkey, | 1545 | .setkey = safexcel_aead_setkey, |
1534 | .encrypt = safexcel_aead_encrypt, | 1546 | .encrypt = safexcel_aead_encrypt, |
@@ -1562,6 +1574,7 @@ static int safexcel_aead_sha1_des3_cra_init(struct crypto_tfm *tfm) | |||
1562 | 1574 | ||
1563 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_des3_ede = { | 1575 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_des3_ede = { |
1564 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1576 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1577 | .algo_mask = SAFEXCEL_ALG_DES | SAFEXCEL_ALG_SHA1, | ||
1565 | .alg.aead = { | 1578 | .alg.aead = { |
1566 | .setkey = safexcel_aead_setkey, | 1579 | .setkey = safexcel_aead_setkey, |
1567 | .encrypt = safexcel_aead_encrypt, | 1580 | .encrypt = safexcel_aead_encrypt, |
@@ -1595,6 +1608,7 @@ static int safexcel_aead_sha1_ctr_cra_init(struct crypto_tfm *tfm) | |||
1595 | 1608 | ||
1596 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_ctr_aes = { | 1609 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_ctr_aes = { |
1597 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1610 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1611 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA1, | ||
1598 | .alg.aead = { | 1612 | .alg.aead = { |
1599 | .setkey = safexcel_aead_setkey, | 1613 | .setkey = safexcel_aead_setkey, |
1600 | .encrypt = safexcel_aead_encrypt, | 1614 | .encrypt = safexcel_aead_encrypt, |
@@ -1628,6 +1642,7 @@ static int safexcel_aead_sha256_ctr_cra_init(struct crypto_tfm *tfm) | |||
1628 | 1642 | ||
1629 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_ctr_aes = { | 1643 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_ctr_aes = { |
1630 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1644 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1645 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256, | ||
1631 | .alg.aead = { | 1646 | .alg.aead = { |
1632 | .setkey = safexcel_aead_setkey, | 1647 | .setkey = safexcel_aead_setkey, |
1633 | .encrypt = safexcel_aead_encrypt, | 1648 | .encrypt = safexcel_aead_encrypt, |
@@ -1661,6 +1676,7 @@ static int safexcel_aead_sha224_ctr_cra_init(struct crypto_tfm *tfm) | |||
1661 | 1676 | ||
1662 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_ctr_aes = { | 1677 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_ctr_aes = { |
1663 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1678 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1679 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_256, | ||
1664 | .alg.aead = { | 1680 | .alg.aead = { |
1665 | .setkey = safexcel_aead_setkey, | 1681 | .setkey = safexcel_aead_setkey, |
1666 | .encrypt = safexcel_aead_encrypt, | 1682 | .encrypt = safexcel_aead_encrypt, |
@@ -1694,6 +1710,7 @@ static int safexcel_aead_sha512_ctr_cra_init(struct crypto_tfm *tfm) | |||
1694 | 1710 | ||
1695 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes = { | 1711 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes = { |
1696 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1712 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1713 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512, | ||
1697 | .alg.aead = { | 1714 | .alg.aead = { |
1698 | .setkey = safexcel_aead_setkey, | 1715 | .setkey = safexcel_aead_setkey, |
1699 | .encrypt = safexcel_aead_encrypt, | 1716 | .encrypt = safexcel_aead_encrypt, |
@@ -1727,6 +1744,7 @@ static int safexcel_aead_sha384_ctr_cra_init(struct crypto_tfm *tfm) | |||
1727 | 1744 | ||
1728 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes = { | 1745 | struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes = { |
1729 | .type = SAFEXCEL_ALG_TYPE_AEAD, | 1746 | .type = SAFEXCEL_ALG_TYPE_AEAD, |
1747 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_SHA2_512, | ||
1730 | .alg.aead = { | 1748 | .alg.aead = { |
1731 | .setkey = safexcel_aead_setkey, | 1749 | .setkey = safexcel_aead_setkey, |
1732 | .encrypt = safexcel_aead_encrypt, | 1750 | .encrypt = safexcel_aead_encrypt, |
@@ -1840,6 +1858,7 @@ static int safexcel_decrypt_xts(struct skcipher_request *req) | |||
1840 | 1858 | ||
1841 | struct safexcel_alg_template safexcel_alg_xts_aes = { | 1859 | struct safexcel_alg_template safexcel_alg_xts_aes = { |
1842 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, | 1860 | .type = SAFEXCEL_ALG_TYPE_SKCIPHER, |
1861 | .algo_mask = SAFEXCEL_ALG_AES | SAFEXCEL_ALG_AES_XTS, | ||
1843 | .alg.skcipher = { | 1862 | .alg.skcipher = { |
1844 | .setkey = safexcel_skcipher_aesxts_setkey, | 1863 | .setkey = safexcel_skcipher_aesxts_setkey, |
1845 | .encrypt = safexcel_encrypt_xts, | 1864 | .encrypt = safexcel_encrypt_xts, |
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index 626dd82e583f..e60838f2fa96 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c | |||
@@ -845,6 +845,7 @@ static void safexcel_ahash_cra_exit(struct crypto_tfm *tfm) | |||
845 | 845 | ||
846 | struct safexcel_alg_template safexcel_alg_sha1 = { | 846 | struct safexcel_alg_template safexcel_alg_sha1 = { |
847 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 847 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
848 | .algo_mask = SAFEXCEL_ALG_SHA1, | ||
848 | .alg.ahash = { | 849 | .alg.ahash = { |
849 | .init = safexcel_sha1_init, | 850 | .init = safexcel_sha1_init, |
850 | .update = safexcel_ahash_update, | 851 | .update = safexcel_ahash_update, |
@@ -1085,6 +1086,7 @@ static int safexcel_hmac_sha1_setkey(struct crypto_ahash *tfm, const u8 *key, | |||
1085 | 1086 | ||
1086 | struct safexcel_alg_template safexcel_alg_hmac_sha1 = { | 1087 | struct safexcel_alg_template safexcel_alg_hmac_sha1 = { |
1087 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1088 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1089 | .algo_mask = SAFEXCEL_ALG_SHA1, | ||
1088 | .alg.ahash = { | 1090 | .alg.ahash = { |
1089 | .init = safexcel_hmac_sha1_init, | 1091 | .init = safexcel_hmac_sha1_init, |
1090 | .update = safexcel_ahash_update, | 1092 | .update = safexcel_ahash_update, |
@@ -1140,6 +1142,7 @@ static int safexcel_sha256_digest(struct ahash_request *areq) | |||
1140 | 1142 | ||
1141 | struct safexcel_alg_template safexcel_alg_sha256 = { | 1143 | struct safexcel_alg_template safexcel_alg_sha256 = { |
1142 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1144 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1145 | .algo_mask = SAFEXCEL_ALG_SHA2_256, | ||
1143 | .alg.ahash = { | 1146 | .alg.ahash = { |
1144 | .init = safexcel_sha256_init, | 1147 | .init = safexcel_sha256_init, |
1145 | .update = safexcel_ahash_update, | 1148 | .update = safexcel_ahash_update, |
@@ -1194,6 +1197,7 @@ static int safexcel_sha224_digest(struct ahash_request *areq) | |||
1194 | 1197 | ||
1195 | struct safexcel_alg_template safexcel_alg_sha224 = { | 1198 | struct safexcel_alg_template safexcel_alg_sha224 = { |
1196 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1199 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1200 | .algo_mask = SAFEXCEL_ALG_SHA2_256, | ||
1197 | .alg.ahash = { | 1201 | .alg.ahash = { |
1198 | .init = safexcel_sha224_init, | 1202 | .init = safexcel_sha224_init, |
1199 | .update = safexcel_ahash_update, | 1203 | .update = safexcel_ahash_update, |
@@ -1262,6 +1266,7 @@ static int safexcel_hmac_sha224_digest(struct ahash_request *areq) | |||
1262 | 1266 | ||
1263 | struct safexcel_alg_template safexcel_alg_hmac_sha224 = { | 1267 | struct safexcel_alg_template safexcel_alg_hmac_sha224 = { |
1264 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1268 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1269 | .algo_mask = SAFEXCEL_ALG_SHA2_256, | ||
1265 | .alg.ahash = { | 1270 | .alg.ahash = { |
1266 | .init = safexcel_hmac_sha224_init, | 1271 | .init = safexcel_hmac_sha224_init, |
1267 | .update = safexcel_ahash_update, | 1272 | .update = safexcel_ahash_update, |
@@ -1331,6 +1336,7 @@ static int safexcel_hmac_sha256_digest(struct ahash_request *areq) | |||
1331 | 1336 | ||
1332 | struct safexcel_alg_template safexcel_alg_hmac_sha256 = { | 1337 | struct safexcel_alg_template safexcel_alg_hmac_sha256 = { |
1333 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1338 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1339 | .algo_mask = SAFEXCEL_ALG_SHA2_256, | ||
1334 | .alg.ahash = { | 1340 | .alg.ahash = { |
1335 | .init = safexcel_hmac_sha256_init, | 1341 | .init = safexcel_hmac_sha256_init, |
1336 | .update = safexcel_ahash_update, | 1342 | .update = safexcel_ahash_update, |
@@ -1386,6 +1392,7 @@ static int safexcel_sha512_digest(struct ahash_request *areq) | |||
1386 | 1392 | ||
1387 | struct safexcel_alg_template safexcel_alg_sha512 = { | 1393 | struct safexcel_alg_template safexcel_alg_sha512 = { |
1388 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1394 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1395 | .algo_mask = SAFEXCEL_ALG_SHA2_512, | ||
1389 | .alg.ahash = { | 1396 | .alg.ahash = { |
1390 | .init = safexcel_sha512_init, | 1397 | .init = safexcel_sha512_init, |
1391 | .update = safexcel_ahash_update, | 1398 | .update = safexcel_ahash_update, |
@@ -1440,6 +1447,7 @@ static int safexcel_sha384_digest(struct ahash_request *areq) | |||
1440 | 1447 | ||
1441 | struct safexcel_alg_template safexcel_alg_sha384 = { | 1448 | struct safexcel_alg_template safexcel_alg_sha384 = { |
1442 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1449 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1450 | .algo_mask = SAFEXCEL_ALG_SHA2_512, | ||
1443 | .alg.ahash = { | 1451 | .alg.ahash = { |
1444 | .init = safexcel_sha384_init, | 1452 | .init = safexcel_sha384_init, |
1445 | .update = safexcel_ahash_update, | 1453 | .update = safexcel_ahash_update, |
@@ -1508,6 +1516,7 @@ static int safexcel_hmac_sha512_digest(struct ahash_request *areq) | |||
1508 | 1516 | ||
1509 | struct safexcel_alg_template safexcel_alg_hmac_sha512 = { | 1517 | struct safexcel_alg_template safexcel_alg_hmac_sha512 = { |
1510 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1518 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1519 | .algo_mask = SAFEXCEL_ALG_SHA2_512, | ||
1511 | .alg.ahash = { | 1520 | .alg.ahash = { |
1512 | .init = safexcel_hmac_sha512_init, | 1521 | .init = safexcel_hmac_sha512_init, |
1513 | .update = safexcel_ahash_update, | 1522 | .update = safexcel_ahash_update, |
@@ -1577,6 +1586,7 @@ static int safexcel_hmac_sha384_digest(struct ahash_request *areq) | |||
1577 | 1586 | ||
1578 | struct safexcel_alg_template safexcel_alg_hmac_sha384 = { | 1587 | struct safexcel_alg_template safexcel_alg_hmac_sha384 = { |
1579 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1588 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1589 | .algo_mask = SAFEXCEL_ALG_SHA2_512, | ||
1580 | .alg.ahash = { | 1590 | .alg.ahash = { |
1581 | .init = safexcel_hmac_sha384_init, | 1591 | .init = safexcel_hmac_sha384_init, |
1582 | .update = safexcel_ahash_update, | 1592 | .update = safexcel_ahash_update, |
@@ -1632,6 +1642,7 @@ static int safexcel_md5_digest(struct ahash_request *areq) | |||
1632 | 1642 | ||
1633 | struct safexcel_alg_template safexcel_alg_md5 = { | 1643 | struct safexcel_alg_template safexcel_alg_md5 = { |
1634 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1644 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1645 | .algo_mask = SAFEXCEL_ALG_MD5, | ||
1635 | .alg.ahash = { | 1646 | .alg.ahash = { |
1636 | .init = safexcel_md5_init, | 1647 | .init = safexcel_md5_init, |
1637 | .update = safexcel_ahash_update, | 1648 | .update = safexcel_ahash_update, |
@@ -1701,6 +1712,7 @@ static int safexcel_hmac_md5_digest(struct ahash_request *areq) | |||
1701 | 1712 | ||
1702 | struct safexcel_alg_template safexcel_alg_hmac_md5 = { | 1713 | struct safexcel_alg_template safexcel_alg_hmac_md5 = { |
1703 | .type = SAFEXCEL_ALG_TYPE_AHASH, | 1714 | .type = SAFEXCEL_ALG_TYPE_AHASH, |
1715 | .algo_mask = SAFEXCEL_ALG_MD5, | ||
1704 | .alg.ahash = { | 1716 | .alg.ahash = { |
1705 | .init = safexcel_hmac_md5_init, | 1717 | .init = safexcel_hmac_md5_init, |
1706 | .update = safexcel_ahash_update, | 1718 | .update = safexcel_ahash_update, |