Lines Matching refs:rsa

11 #include <crypto/internal/rsa.h>
124 struct hpre_rsa_ctx rsa;
139 struct akcipher_request *rsa;
467 areq = req->areq.rsa;
532 h_req->areq.rsa = akreq;
805 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm);
811 if (unlikely(!ctx->rsa.pubkey))
819 msg->key = cpu_to_le64(ctx->rsa.dma_pubkey);
853 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm);
859 if (unlikely(!ctx->rsa.prikey))
867 msg->key = cpu_to_le64(ctx->rsa.dma_crt_prikey);
871 msg->key = cpu_to_le64(ctx->rsa.dma_prikey);
909 ctx->rsa.pubkey = dma_alloc_coherent(ctx->dev, vlen << 1,
910 &ctx->rsa.dma_pubkey,
912 if (!ctx->rsa.pubkey)
916 ctx->rsa.prikey = dma_alloc_coherent(ctx->dev, vlen << 1,
917 &ctx->rsa.dma_prikey,
919 if (!ctx->rsa.prikey) {
921 ctx->rsa.pubkey,
922 ctx->rsa.dma_pubkey);
923 ctx->rsa.pubkey = NULL;
926 memcpy(ctx->rsa.prikey + vlen, ptr, vlen);
928 memcpy(ctx->rsa.pubkey + vlen, ptr, vlen);
944 memcpy(ctx->rsa.pubkey + ctx->key_sz - vlen, ptr, vlen);
959 memcpy(ctx->rsa.prikey + ctx->key_sz - vlen, ptr, vlen);
986 ctx->rsa.crt_prikey = dma_alloc_coherent(dev, hlf_ksz * HPRE_CRT_PRMS,
987 &ctx->rsa.dma_crt_prikey,
989 if (!ctx->rsa.crt_prikey)
992 ret = hpre_crt_para_get(ctx->rsa.crt_prikey, hlf_ksz,
998 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
1004 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
1010 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
1016 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz,
1027 memzero_explicit(ctx->rsa.crt_prikey, offset);
1028 dma_free_coherent(dev, hlf_ksz * HPRE_CRT_PRMS, ctx->rsa.crt_prikey,
1029 ctx->rsa.dma_crt_prikey);
1030 ctx->rsa.crt_prikey = NULL;
1045 if (ctx->rsa.pubkey) {
1047 ctx->rsa.pubkey, ctx->rsa.dma_pubkey);
1048 ctx->rsa.pubkey = NULL;
1051 if (ctx->rsa.crt_prikey) {
1052 memzero_explicit(ctx->rsa.crt_prikey,
1055 ctx->rsa.crt_prikey, ctx->rsa.dma_crt_prikey);
1056 ctx->rsa.crt_prikey = NULL;
1059 if (ctx->rsa.prikey) {
1060 memzero_explicit(ctx->rsa.prikey, ctx->key_sz);
1061 dma_free_coherent(dev, ctx->key_sz << 1, ctx->rsa.prikey,
1062 ctx->rsa.dma_prikey);
1063 ctx->rsa.prikey = NULL;
1119 if ((private && !ctx->rsa.prikey) || !ctx->rsa.pubkey) {
1137 ret = crypto_akcipher_set_pub_key(ctx->rsa.soft_tfm, key, keylen);
1150 ret = crypto_akcipher_set_priv_key(ctx->rsa.soft_tfm, key, keylen);
1164 return crypto_akcipher_maxsize(ctx->rsa.soft_tfm);
1174 ctx->rsa.soft_tfm = crypto_alloc_akcipher("rsa-generic", 0, 0);
1175 if (IS_ERR(ctx->rsa.soft_tfm)) {
1177 return PTR_ERR(ctx->rsa.soft_tfm);
1185 crypto_free_akcipher(ctx->rsa.soft_tfm);
1195 crypto_free_akcipher(ctx->rsa.soft_tfm);
2003 static struct akcipher_alg rsa = {
2016 .cra_name = "rsa",
2017 .cra_driver_name = "hpre-rsa",
2107 rsa.base.cra_flags = 0;
2108 ret = crypto_register_akcipher(&rsa);
2110 dev_err(&qm->pdev->dev, "failed to register rsa (%d)!\n", ret);
2120 crypto_unregister_akcipher(&rsa);