Lines Matching +full:ixp4xx +full:- +full:crypto

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Intel IXP4xx NPE-C crypto driver
9 #include <linux/dma-mapping.h>
11 #include <linux/crypto.h>
20 #include <crypto/ctr.h>
21 #include <crypto/internal/des.h>
22 #include <crypto/aes.h>
23 #include <crypto/hmac.h>
24 #include <crypto/sha1.h>
25 #include <crypto/algapi.h>
26 #include <crypto/internal/aead.h>
27 #include <crypto/internal/skcipher.h>
28 #include <crypto/authenc.h>
29 #include <crypto/scatterwalk.h>
31 #include <linux/soc/ixp4xx/npe.h>
32 #include <linux/soc/ixp4xx/qmgr.h>
34 /* Intermittent includes, delete this after v5.14-rc1 */
35 #include <linux/soc/ixp4xx/cpu.h>
136 u32 crypto_ctx; /* NPE Crypto Param structure address */
194 struct skcipher_alg crypto; member
203 struct aead_alg crypto; member
239 return crypt_phys + (virt - crypt_virt) * sizeof(struct crypt_ctl); in crypt_virt2phys()
244 return crypt_virt + (phys - crypt_phys) / sizeof(struct crypt_ctl); in crypt_phys2virt()
249 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_enc; in cipher_cfg_enc()
254 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_dec; in cipher_cfg_dec()
259 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->hash; in ix_hash()
264 struct device *dev = &pdev->dev; in setup_crypt_desc()
273 return -ENOMEM; in setup_crypt_desc()
340 buf1 = buf->next; in free_buf_chain()
341 phys1 = buf->phys_next; in free_buf_chain()
342 dma_unmap_single(dev, buf->phys_addr, buf->buf_len, buf->dir); in free_buf_chain()
353 struct aead_request *req = crypt->data.aead_req; in finish_scattered_hmac()
357 int decryptlen = req->assoclen + req->cryptlen - authsize; in finish_scattered_hmac()
359 if (req_ctx->encrypt) { in finish_scattered_hmac()
360 scatterwalk_map_and_copy(req_ctx->hmac_virt, req->dst, in finish_scattered_hmac()
363 dma_pool_free(buffer_pool, req_ctx->hmac_virt, crypt->icv_rev_aes); in finish_scattered_hmac()
368 struct device *dev = &pdev->dev; in one_packet()
373 failed = phys & 0x1 ? -EBADMSG : 0; in one_packet()
377 switch (crypt->ctl_flags & CTL_FLAG_MASK) { in one_packet()
379 struct aead_request *req = crypt->data.aead_req; in one_packet()
382 free_buf_chain(dev, req_ctx->src, crypt->src_buf); in one_packet()
383 free_buf_chain(dev, req_ctx->dst, crypt->dst_buf); in one_packet()
384 if (req_ctx->hmac_virt) in one_packet()
391 struct skcipher_request *req = crypt->data.ablk_req; in one_packet()
398 offset = req->cryptlen - ivsize; in one_packet()
399 if (req_ctx->encrypt) { in one_packet()
400 scatterwalk_map_and_copy(req->iv, req->dst, in one_packet()
403 memcpy(req->iv, req_ctx->iv, ivsize); in one_packet()
404 memzero_explicit(req_ctx->iv, ivsize); in one_packet()
408 if (req_ctx->dst) in one_packet()
409 free_buf_chain(dev, req_ctx->dst, crypt->dst_buf); in one_packet()
411 free_buf_chain(dev, req_ctx->src, crypt->src_buf); in one_packet()
416 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
417 dma_pool_free(ctx_pool, crypt->regist_ptr, in one_packet()
418 crypt->regist_buf->phys_addr); in one_packet()
419 dma_pool_free(buffer_pool, crypt->regist_buf, crypt->src_buf); in one_packet()
420 if (atomic_dec_and_test(&ctx->configuring)) in one_packet()
421 complete(&ctx->completion); in one_packet()
424 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
425 *(__be32 *)ctx->decrypt.npe_ctx &= cpu_to_be32(~CIPH_ENCR); in one_packet()
426 if (atomic_dec_and_test(&ctx->configuring)) in one_packet()
427 complete(&ctx->completion); in one_packet()
432 crypt->ctl_flags = CTL_FLAG_UNUSED; in one_packet()
455 struct device_node *np = dev->of_node; in init_ixp_crypto()
457 int ret = -ENODEV; in init_ixp_crypto()
467 ret = of_parse_phandle_with_fixed_args(np, "intel,npe-handle", in init_ixp_crypto()
471 return -ENODEV; in init_ixp_crypto()
475 ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0, in init_ixp_crypto()
479 return -ENODEV; in init_ixp_crypto()
483 ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0, in init_ixp_crypto()
487 return -ENODEV; in init_ixp_crypto()
528 dev_err(dev, "Firmware of %s lacks crypto support\n", npe_name(npe_c)); in init_ixp_crypto()
529 ret = -ENODEV; in init_ixp_crypto()
538 ret = -ENOMEM; in init_ixp_crypto()
564 ret = -EIO; in init_ixp_crypto()
593 memset(dir->npe_ctx, 0, NPE_CTX_LEN); in reset_sa_dir()
594 dir->npe_ctx_idx = 0; in reset_sa_dir()
595 dir->npe_mode = 0; in reset_sa_dir()
600 dir->npe_ctx = dma_pool_alloc(ctx_pool, GFP_KERNEL, &dir->npe_ctx_phys); in init_sa_dir()
601 if (!dir->npe_ctx) in init_sa_dir()
602 return -ENOMEM; in init_sa_dir()
610 memset(dir->npe_ctx, 0, NPE_CTX_LEN); in free_sa_dir()
611 dma_pool_free(ctx_pool, dir->npe_ctx, dir->npe_ctx_phys); in free_sa_dir()
619 atomic_set(&ctx->configuring, 0); in init_tfm()
620 ret = init_sa_dir(&ctx->encrypt); in init_tfm()
623 ret = init_sa_dir(&ctx->decrypt); in init_tfm()
625 free_sa_dir(&ctx->encrypt); in init_tfm()
636 ctx->fallback_tfm = crypto_alloc_skcipher(name, 0, CRYPTO_ALG_NEED_FALLBACK); in init_tfm_ablk()
637 if (IS_ERR(ctx->fallback_tfm)) { in init_tfm_ablk()
639 name, PTR_ERR(ctx->fallback_tfm)); in init_tfm_ablk()
640 return PTR_ERR(ctx->fallback_tfm); in init_tfm_ablk()
644 crypto_tfm_alg_driver_name(&tfm->base), in init_tfm_ablk()
645 crypto_tfm_alg_driver_name(crypto_skcipher_tfm(ctx->fallback_tfm)) in init_tfm_ablk()
648 …crypto_skcipher_set_reqsize(tfm, sizeof(struct ablk_ctx) + crypto_skcipher_reqsize(ctx->fallback_t… in init_tfm_ablk()
662 free_sa_dir(&ctx->encrypt); in exit_tfm()
663 free_sa_dir(&ctx->decrypt); in exit_tfm()
671 crypto_free_skcipher(ctx->fallback_tfm); in exit_tfm_ablk()
694 return -ENOMEM; in register_chain_var()
698 return -ENOMEM; in register_chain_var()
704 return -EAGAIN; in register_chain_var()
708 memset(pad + key_len, 0, HMAC_PAD_BLOCKLEN - key_len); in register_chain_var()
712 crypt->data.tfm = tfm; in register_chain_var()
713 crypt->regist_ptr = pad; in register_chain_var()
714 crypt->regist_buf = buf; in register_chain_var()
716 crypt->auth_offs = 0; in register_chain_var()
717 crypt->auth_len = HMAC_PAD_BLOCKLEN; in register_chain_var()
718 crypt->crypto_ctx = ctx_addr; in register_chain_var()
719 crypt->src_buf = buf_phys; in register_chain_var()
720 crypt->icv_rev_aes = target; in register_chain_var()
721 crypt->mode = NPE_OP_HASH_GEN_ICV; in register_chain_var()
722 crypt->init_len = init_len; in register_chain_var()
723 crypt->ctl_flags |= CTL_FLAG_GEN_ICV; in register_chain_var()
725 buf->next = NULL; in register_chain_var()
726 buf->buf_len = HMAC_PAD_BLOCKLEN; in register_chain_var()
727 buf->pkt_len = 0; in register_chain_var()
728 buf->phys_addr = pad_phys; in register_chain_var()
730 atomic_inc(&ctx->configuring); in register_chain_var()
747 dir = encrypt ? &ctx->encrypt : &ctx->decrypt; in setup_auth()
748 cinfo = dir->npe_ctx + dir->npe_ctx_idx; in setup_auth()
752 cfgword = algo->cfgword | (authsize << 6); /* (authsize/4) << 8 */ in setup_auth()
760 memcpy(cinfo, algo->icv, digest_len); in setup_auth()
763 itarget = dir->npe_ctx_phys + dir->npe_ctx_idx in setup_auth()
764 + sizeof(algo->cfgword); in setup_auth()
766 init_len = cinfo - (dir->npe_ctx + dir->npe_ctx_idx); in setup_auth()
767 npe_ctx_addr = dir->npe_ctx_phys + dir->npe_ctx_idx; in setup_auth()
769 dir->npe_ctx_idx += init_len; in setup_auth()
770 dir->npe_mode |= NPE_OP_HASH_ENABLE; in setup_auth()
773 dir->npe_mode |= NPE_OP_HASH_VERIFY; in setup_auth()
787 struct ix_sa_dir *dir = &ctx->decrypt; in gen_rev_aes_key()
791 return -EAGAIN; in gen_rev_aes_key()
793 *(__be32 *)dir->npe_ctx |= cpu_to_be32(CIPH_ENCR); in gen_rev_aes_key()
795 crypt->data.tfm = tfm; in gen_rev_aes_key()
796 crypt->crypt_offs = 0; in gen_rev_aes_key()
797 crypt->crypt_len = AES_BLOCK128; in gen_rev_aes_key()
798 crypt->src_buf = 0; in gen_rev_aes_key()
799 crypt->crypto_ctx = dir->npe_ctx_phys; in gen_rev_aes_key()
800 crypt->icv_rev_aes = dir->npe_ctx_phys + sizeof(u32); in gen_rev_aes_key()
801 crypt->mode = NPE_OP_ENC_GEN_KEY; in gen_rev_aes_key()
802 crypt->init_len = dir->npe_ctx_idx; in gen_rev_aes_key()
803 crypt->ctl_flags |= CTL_FLAG_GEN_REVAES; in gen_rev_aes_key()
805 atomic_inc(&ctx->configuring); in gen_rev_aes_key()
821 dir = encrypt ? &ctx->encrypt : &ctx->decrypt; in setup_cipher()
822 cinfo = dir->npe_ctx; in setup_cipher()
826 dir->npe_mode |= NPE_OP_CRYPT_ENCRYPT; in setup_cipher()
842 return -EINVAL; in setup_cipher()
858 memset(cinfo + key_len, 0, DES3_EDE_KEY_SIZE - key_len); in setup_cipher()
861 dir->npe_ctx_idx = sizeof(cipher_cfg) + key_len; in setup_cipher()
862 dir->npe_mode |= NPE_OP_CRYPT_ENABLE; in setup_cipher()
875 unsigned int len = min(nbytes, sg->length); in chainup_buffers()
880 nbytes -= len; in chainup_buffers()
888 buf->next = next_buf; in chainup_buffers()
889 buf->phys_next = next_buf_phys; in chainup_buffers()
892 buf->phys_addr = sg_dma_address(sg); in chainup_buffers()
893 buf->buf_len = len; in chainup_buffers()
894 buf->dir = dir; in chainup_buffers()
896 buf->next = NULL; in chainup_buffers()
897 buf->phys_next = 0; in chainup_buffers()
907 init_completion(&ctx->completion); in ablk_setkey()
908 atomic_inc(&ctx->configuring); in ablk_setkey()
910 reset_sa_dir(&ctx->encrypt); in ablk_setkey()
911 reset_sa_dir(&ctx->decrypt); in ablk_setkey()
913 ctx->encrypt.npe_mode = NPE_OP_HMAC_DISABLE; in ablk_setkey()
914 ctx->decrypt.npe_mode = NPE_OP_HMAC_DISABLE; in ablk_setkey()
916 ret = setup_cipher(&tfm->base, 0, key, key_len); in ablk_setkey()
919 ret = setup_cipher(&tfm->base, 1, key, key_len); in ablk_setkey()
921 if (!atomic_dec_and_test(&ctx->configuring)) in ablk_setkey()
922 wait_for_completion(&ctx->completion); in ablk_setkey()
925 crypto_skcipher_clear_flags(ctx->fallback_tfm, CRYPTO_TFM_REQ_MASK); in ablk_setkey()
926 crypto_skcipher_set_flags(ctx->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); in ablk_setkey()
928 return crypto_skcipher_setkey(ctx->fallback_tfm, key, key_len); in ablk_setkey()
945 return -EINVAL; in ablk_rfc3686_setkey()
947 memcpy(ctx->nonce, key + (key_len - CTR_RFC3686_NONCE_SIZE), in ablk_rfc3686_setkey()
950 key_len -= CTR_RFC3686_NONCE_SIZE; in ablk_rfc3686_setkey()
961 skcipher_request_set_tfm(&rctx->fallback_req, op->fallback_tfm); in ixp4xx_cipher_fallback()
962 skcipher_request_set_callback(&rctx->fallback_req, areq->base.flags, in ixp4xx_cipher_fallback()
963 areq->base.complete, areq->base.data); in ixp4xx_cipher_fallback()
964 skcipher_request_set_crypt(&rctx->fallback_req, areq->src, areq->dst, in ixp4xx_cipher_fallback()
965 areq->cryptlen, areq->iv); in ixp4xx_cipher_fallback()
967 err = crypto_skcipher_encrypt(&rctx->fallback_req); in ixp4xx_cipher_fallback()
969 err = crypto_skcipher_decrypt(&rctx->fallback_req); in ixp4xx_cipher_fallback()
980 unsigned int nbytes = req->cryptlen; in ablk_perform()
984 struct device *dev = &pdev->dev; in ablk_perform()
986 gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? in ablk_perform()
989 if (sg_nents(req->src) > 1 || sg_nents(req->dst) > 1) in ablk_perform()
993 return -EAGAIN; in ablk_perform()
994 if (atomic_read(&ctx->configuring)) in ablk_perform()
995 return -EAGAIN; in ablk_perform()
997 dir = encrypt ? &ctx->encrypt : &ctx->decrypt; in ablk_perform()
998 req_ctx->encrypt = encrypt; in ablk_perform()
1002 return -ENOMEM; in ablk_perform()
1004 crypt->data.ablk_req = req; in ablk_perform()
1005 crypt->crypto_ctx = dir->npe_ctx_phys; in ablk_perform()
1006 crypt->mode = dir->npe_mode; in ablk_perform()
1007 crypt->init_len = dir->npe_ctx_idx; in ablk_perform()
1009 crypt->crypt_offs = 0; in ablk_perform()
1010 crypt->crypt_len = nbytes; in ablk_perform()
1012 BUG_ON(ivsize && !req->iv); in ablk_perform()
1013 memcpy(crypt->iv, req->iv, ivsize); in ablk_perform()
1015 offset = req->cryptlen - ivsize; in ablk_perform()
1016 scatterwalk_map_and_copy(req_ctx->iv, req->src, offset, ivsize, 0); in ablk_perform()
1018 if (req->src != req->dst) { in ablk_perform()
1021 crypt->mode |= NPE_OP_NOT_IN_PLACE; in ablk_perform()
1024 req_ctx->dst = NULL; in ablk_perform()
1025 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, in ablk_perform()
1029 req_ctx->dst = dst_hook.next; in ablk_perform()
1030 crypt->dst_buf = dst_hook.phys_next; in ablk_perform()
1032 req_ctx->dst = NULL; in ablk_perform()
1034 req_ctx->src = NULL; in ablk_perform()
1035 if (!chainup_buffers(dev, req->src, nbytes, &src_hook, flags, in ablk_perform()
1039 req_ctx->src = src_hook.next; in ablk_perform()
1040 crypt->src_buf = src_hook.phys_next; in ablk_perform()
1041 crypt->ctl_flags |= CTL_FLAG_PERFORM_ABLK; in ablk_perform()
1044 return -EINPROGRESS; in ablk_perform()
1047 free_buf_chain(dev, req_ctx->src, crypt->src_buf); in ablk_perform()
1049 if (req->src != req->dst) in ablk_perform()
1050 free_buf_chain(dev, req_ctx->dst, crypt->dst_buf); in ablk_perform()
1052 crypt->ctl_flags = CTL_FLAG_UNUSED; in ablk_perform()
1053 return -ENOMEM; in ablk_perform()
1071 u8 *info = req->iv; in ablk_rfc3686_crypt()
1075 memcpy(iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE); in ablk_rfc3686_crypt()
1082 req->iv = iv; in ablk_rfc3686_crypt()
1084 req->iv = info; in ablk_rfc3686_crypt()
1100 struct device *dev = &pdev->dev; in aead_perform()
1101 gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? in aead_perform()
1107 return -EAGAIN; in aead_perform()
1108 if (atomic_read(&ctx->configuring)) in aead_perform()
1109 return -EAGAIN; in aead_perform()
1112 dir = &ctx->encrypt; in aead_perform()
1113 cryptlen = req->cryptlen; in aead_perform()
1115 dir = &ctx->decrypt; in aead_perform()
1116 /* req->cryptlen includes the authsize when decrypting */ in aead_perform()
1117 cryptlen = req->cryptlen - authsize; in aead_perform()
1118 eff_cryptlen -= authsize; in aead_perform()
1122 return -ENOMEM; in aead_perform()
1124 crypt->data.aead_req = req; in aead_perform()
1125 crypt->crypto_ctx = dir->npe_ctx_phys; in aead_perform()
1126 crypt->mode = dir->npe_mode; in aead_perform()
1127 crypt->init_len = dir->npe_ctx_idx; in aead_perform()
1129 crypt->crypt_offs = cryptoffset; in aead_perform()
1130 crypt->crypt_len = eff_cryptlen; in aead_perform()
1132 crypt->auth_offs = 0; in aead_perform()
1133 crypt->auth_len = req->assoclen + cryptlen; in aead_perform()
1134 BUG_ON(ivsize && !req->iv); in aead_perform()
1135 memcpy(crypt->iv, req->iv, ivsize); in aead_perform()
1137 buf = chainup_buffers(dev, req->src, crypt->auth_len, in aead_perform()
1139 req_ctx->src = src_hook.next; in aead_perform()
1140 crypt->src_buf = src_hook.phys_next; in aead_perform()
1144 lastlen = buf->buf_len; in aead_perform()
1146 crypt->icv_rev_aes = buf->phys_addr + in aead_perform()
1147 buf->buf_len - authsize; in aead_perform()
1149 req_ctx->dst = NULL; in aead_perform()
1151 if (req->src != req->dst) { in aead_perform()
1154 crypt->mode |= NPE_OP_NOT_IN_PLACE; in aead_perform()
1157 buf = chainup_buffers(dev, req->dst, crypt->auth_len, in aead_perform()
1159 req_ctx->dst = dst_hook.next; in aead_perform()
1160 crypt->dst_buf = dst_hook.phys_next; in aead_perform()
1166 lastlen = buf->buf_len; in aead_perform()
1168 crypt->icv_rev_aes = buf->phys_addr + in aead_perform()
1169 buf->buf_len - authsize; in aead_perform()
1177 req_ctx->hmac_virt = dma_pool_alloc(buffer_pool, flags, &dma); in aead_perform()
1178 if (unlikely(!req_ctx->hmac_virt)) in aead_perform()
1180 crypt->icv_rev_aes = dma; in aead_perform()
1182 scatterwalk_map_and_copy(req_ctx->hmac_virt, in aead_perform()
1183 req->src, cryptlen, authsize, 0); in aead_perform()
1185 req_ctx->encrypt = encrypt; in aead_perform()
1187 req_ctx->hmac_virt = NULL; in aead_perform()
1190 crypt->ctl_flags |= CTL_FLAG_PERFORM_AEAD; in aead_perform()
1193 return -EINPROGRESS; in aead_perform()
1196 free_buf_chain(dev, req_ctx->dst, crypt->dst_buf); in aead_perform()
1198 free_buf_chain(dev, req_ctx->src, crypt->src_buf); in aead_perform()
1199 crypt->ctl_flags = CTL_FLAG_UNUSED; in aead_perform()
1200 return -ENOMEM; in aead_perform()
1209 if (!ctx->enckey_len && !ctx->authkey_len) in aead_setup()
1211 init_completion(&ctx->completion); in aead_setup()
1212 atomic_inc(&ctx->configuring); in aead_setup()
1214 reset_sa_dir(&ctx->encrypt); in aead_setup()
1215 reset_sa_dir(&ctx->decrypt); in aead_setup()
1217 ret = setup_cipher(&tfm->base, 0, ctx->enckey, ctx->enckey_len); in aead_setup()
1220 ret = setup_cipher(&tfm->base, 1, ctx->enckey, ctx->enckey_len); in aead_setup()
1223 ret = setup_auth(&tfm->base, 0, authsize, ctx->authkey, in aead_setup()
1224 ctx->authkey_len, digest_len); in aead_setup()
1227 ret = setup_auth(&tfm->base, 1, authsize, ctx->authkey, in aead_setup()
1228 ctx->authkey_len, digest_len); in aead_setup()
1230 if (!atomic_dec_and_test(&ctx->configuring)) in aead_setup()
1231 wait_for_completion(&ctx->completion); in aead_setup()
1240 return -EINVAL; in aead_setauthsize()
1253 if (keys.authkeylen > sizeof(ctx->authkey)) in aead_setkey()
1256 if (keys.enckeylen > sizeof(ctx->enckey)) in aead_setkey()
1259 memcpy(ctx->authkey, keys.authkey, keys.authkeylen); in aead_setkey()
1260 memcpy(ctx->enckey, keys.enckey, keys.enckeylen); in aead_setkey()
1261 ctx->authkey_len = keys.authkeylen; in aead_setkey()
1262 ctx->enckey_len = keys.enckeylen; in aead_setkey()
1268 return -EINVAL; in aead_setkey()
1282 err = -EINVAL; in des3_aead_setkey()
1283 if (keys.authkeylen > sizeof(ctx->authkey)) in des3_aead_setkey()
1290 memcpy(ctx->authkey, keys.authkey, keys.authkeylen); in des3_aead_setkey()
1291 memcpy(ctx->enckey, keys.enckey, keys.enckeylen); in des3_aead_setkey()
1292 ctx->authkey_len = keys.authkeylen; in des3_aead_setkey()
1293 ctx->enckey_len = keys.enckeylen; in des3_aead_setkey()
1304 return aead_perform(req, 1, req->assoclen, req->cryptlen, req->iv); in aead_encrypt()
1309 return aead_perform(req, 0, req->assoclen, req->cryptlen, req->iv); in aead_decrypt()
1314 .crypto = {
1326 .crypto = {
1335 .crypto = {
1347 .crypto = {
1358 .crypto = {
1369 .crypto = {
1379 .crypto = {
1390 .crypto = {
1407 .crypto = {
1419 .crypto = {
1432 .crypto = {
1444 .crypto = {
1457 .crypto = {
1469 .crypto = {
1482 #define IXP_POSTFIX "-ixp4xx"
1486 struct device *dev = &_pdev->dev; in ixp_crypto_probe()
1497 struct skcipher_alg *cra = &ixp4xx_algos[i].crypto; in ixp_crypto_probe()
1499 if (snprintf(cra->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in ixp_crypto_probe()
1500 "%s"IXP_POSTFIX, cra->base.cra_name) >= in ixp_crypto_probe()
1507 cra->base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | in ixp_crypto_probe()
1511 if (!cra->setkey) in ixp_crypto_probe()
1512 cra->setkey = ablk_setkey; in ixp_crypto_probe()
1513 if (!cra->encrypt) in ixp_crypto_probe()
1514 cra->encrypt = ablk_encrypt; in ixp_crypto_probe()
1515 if (!cra->decrypt) in ixp_crypto_probe()
1516 cra->decrypt = ablk_decrypt; in ixp_crypto_probe()
1517 cra->init = init_tfm_ablk; in ixp_crypto_probe()
1518 cra->exit = exit_tfm_ablk; in ixp_crypto_probe()
1520 cra->base.cra_ctxsize = sizeof(struct ixp_ctx); in ixp_crypto_probe()
1521 cra->base.cra_module = THIS_MODULE; in ixp_crypto_probe()
1522 cra->base.cra_alignmask = 3; in ixp_crypto_probe()
1523 cra->base.cra_priority = 300; in ixp_crypto_probe()
1525 dev_err(&pdev->dev, "Failed to register '%s'\n", in ixp_crypto_probe()
1526 cra->base.cra_name); in ixp_crypto_probe()
1532 struct aead_alg *cra = &ixp4xx_aeads[i].crypto; in ixp_crypto_probe()
1534 if (snprintf(cra->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in ixp_crypto_probe()
1535 "%s"IXP_POSTFIX, cra->base.cra_name) >= in ixp_crypto_probe()
1542 cra->base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | in ixp_crypto_probe()
1545 cra->setkey = cra->setkey ?: aead_setkey; in ixp_crypto_probe()
1546 cra->setauthsize = aead_setauthsize; in ixp_crypto_probe()
1547 cra->encrypt = aead_encrypt; in ixp_crypto_probe()
1548 cra->decrypt = aead_decrypt; in ixp_crypto_probe()
1549 cra->init = init_tfm_aead; in ixp_crypto_probe()
1550 cra->exit = exit_tfm_aead; in ixp_crypto_probe()
1552 cra->base.cra_ctxsize = sizeof(struct ixp_ctx); in ixp_crypto_probe()
1553 cra->base.cra_module = THIS_MODULE; in ixp_crypto_probe()
1554 cra->base.cra_alignmask = 3; in ixp_crypto_probe()
1555 cra->base.cra_priority = 300; in ixp_crypto_probe()
1558 dev_err(&pdev->dev, "Failed to register '%s'\n", in ixp_crypto_probe()
1559 cra->base.cra_driver_name); in ixp_crypto_probe()
1573 crypto_unregister_aead(&ixp4xx_aeads[i].crypto); in ixp_crypto_remove()
1578 crypto_unregister_skcipher(&ixp4xx_algos[i].crypto); in ixp_crypto_remove()
1580 release_ixp_crypto(&pdev->dev); in ixp_crypto_remove()
1584 .compatible = "intel,ixp4xx-crypto",
1601 MODULE_DESCRIPTION("IXP4xx hardware crypto");