Lines Matching refs:rsa
7 #include <crypto/internal/rsa.h>
81 struct hpre_rsa_ctx rsa;
92 struct akcipher_request *rsa;
402 areq = req->areq.rsa;
457 h_req->areq.rsa = akreq;
728 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm);
734 if (unlikely(!ctx->rsa.pubkey))
742 msg->key = cpu_to_le64(ctx->rsa.dma_pubkey);
776 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm);
782 if (unlikely(!ctx->rsa.prikey))
790 msg->key = cpu_to_le64(ctx->rsa.dma_crt_prikey);
794 msg->key = cpu_to_le64(ctx->rsa.dma_prikey);
832 ctx->rsa.pubkey = dma_alloc_coherent(HPRE_DEV(ctx), vlen << 1,
833 &ctx->rsa.dma_pubkey,
835 if (!ctx->rsa.pubkey)
839 ctx->rsa.prikey = dma_alloc_coherent(HPRE_DEV(ctx), vlen << 1,
840 &ctx->rsa.dma_prikey,
842 if (!ctx->rsa.prikey) {
844 ctx->rsa.pubkey,
845 ctx->rsa.dma_pubkey);
846 ctx->rsa.pubkey = NULL;
849 memcpy(ctx->rsa.prikey + vlen, ptr, vlen);
851 memcpy(ctx->rsa.pubkey + vlen, ptr, vlen);
867 memcpy(ctx->rsa.pubkey + ctx->key_sz - vlen, ptr, vlen);
882 memcpy(ctx->rsa.prikey + ctx->key_sz - vlen, ptr, vlen);
909 ctx->rsa.crt_prikey = dma_alloc_coherent(dev, hlf_ksz * HPRE_CRT_PRMS,
910 &ctx->rsa.dma_crt_prikey,
912 if (!ctx->rsa.crt_prikey)
915 ret = hpre_crt_para_get(ctx->rsa.crt_prikey, hlf_ksz,
921 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
927 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
933 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
939 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
950 memzero_explicit(ctx->rsa.crt_prikey, offset);
951 dma_free_coherent(dev, hlf_ksz * HPRE_CRT_PRMS, ctx->rsa.crt_prikey,
952 ctx->rsa.dma_crt_prikey);
953 ctx->rsa.crt_prikey = NULL;
968 if (ctx->rsa.pubkey) {
970 ctx->rsa.pubkey, ctx->rsa.dma_pubkey);
971 ctx->rsa.pubkey = NULL;
974 if (ctx->rsa.crt_prikey) {
975 memzero_explicit(ctx->rsa.crt_prikey,
978 ctx->rsa.crt_prikey, ctx->rsa.dma_crt_prikey);
979 ctx->rsa.crt_prikey = NULL;
982 if (ctx->rsa.prikey) {
983 memzero_explicit(ctx->rsa.prikey, ctx->key_sz);
984 dma_free_coherent(dev, ctx->key_sz << 1, ctx->rsa.prikey,
985 ctx->rsa.dma_prikey);
986 ctx->rsa.prikey = NULL;
1042 if ((private && !ctx->rsa.prikey) || !ctx->rsa.pubkey) {
1060 ret = crypto_akcipher_set_pub_key(ctx->rsa.soft_tfm, key, keylen);
1073 ret = crypto_akcipher_set_priv_key(ctx->rsa.soft_tfm, key, keylen);
1087 return crypto_akcipher_maxsize(ctx->rsa.soft_tfm);
1097 ctx->rsa.soft_tfm = crypto_alloc_akcipher("rsa-generic", 0, 0);
1098 if (IS_ERR(ctx->rsa.soft_tfm)) {
1100 return PTR_ERR(ctx->rsa.soft_tfm);
1105 crypto_free_akcipher(ctx->rsa.soft_tfm);
1115 crypto_free_akcipher(ctx->rsa.soft_tfm);
1118 static struct akcipher_alg rsa = {
1132 .cra_name = "rsa",
1133 .cra_driver_name = "hpre-rsa",
1161 rsa.base.cra_flags = 0;
1162 ret = crypto_register_akcipher(&rsa);
1168 crypto_unregister_akcipher(&rsa);
1176 crypto_unregister_akcipher(&rsa);