Lines Matching refs:rsa

124 		struct hpre_rsa_ctx rsa;  member
139 struct akcipher_request *rsa; member
467 areq = req->areq.rsa; in hpre_rsa_cb()
532 h_req->areq.rsa = akreq; in hpre_msg_request_set()
805 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm); in hpre_rsa_enc()
811 if (unlikely(!ctx->rsa.pubkey)) in hpre_rsa_enc()
819 msg->key = cpu_to_le64(ctx->rsa.dma_pubkey); in hpre_rsa_enc()
853 akcipher_request_set_tfm(req, ctx->rsa.soft_tfm); in hpre_rsa_dec()
859 if (unlikely(!ctx->rsa.prikey)) in hpre_rsa_dec()
867 msg->key = cpu_to_le64(ctx->rsa.dma_crt_prikey); in hpre_rsa_dec()
871 msg->key = cpu_to_le64(ctx->rsa.dma_prikey); in hpre_rsa_dec()
909 ctx->rsa.pubkey = dma_alloc_coherent(ctx->dev, vlen << 1, in hpre_rsa_set_n()
910 &ctx->rsa.dma_pubkey, in hpre_rsa_set_n()
912 if (!ctx->rsa.pubkey) in hpre_rsa_set_n()
916 ctx->rsa.prikey = dma_alloc_coherent(ctx->dev, vlen << 1, in hpre_rsa_set_n()
917 &ctx->rsa.dma_prikey, in hpre_rsa_set_n()
919 if (!ctx->rsa.prikey) { in hpre_rsa_set_n()
921 ctx->rsa.pubkey, in hpre_rsa_set_n()
922 ctx->rsa.dma_pubkey); in hpre_rsa_set_n()
923 ctx->rsa.pubkey = NULL; in hpre_rsa_set_n()
926 memcpy(ctx->rsa.prikey + vlen, ptr, vlen); in hpre_rsa_set_n()
928 memcpy(ctx->rsa.pubkey + vlen, ptr, vlen); in hpre_rsa_set_n()
944 memcpy(ctx->rsa.pubkey + ctx->key_sz - vlen, ptr, vlen); in hpre_rsa_set_e()
959 memcpy(ctx->rsa.prikey + ctx->key_sz - vlen, ptr, vlen); in hpre_rsa_set_d()
986 ctx->rsa.crt_prikey = dma_alloc_coherent(dev, hlf_ksz * HPRE_CRT_PRMS, in hpre_rsa_setkey_crt()
987 &ctx->rsa.dma_crt_prikey, in hpre_rsa_setkey_crt()
989 if (!ctx->rsa.crt_prikey) in hpre_rsa_setkey_crt()
992 ret = hpre_crt_para_get(ctx->rsa.crt_prikey, hlf_ksz, in hpre_rsa_setkey_crt()
998 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz, in hpre_rsa_setkey_crt()
1004 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz, in hpre_rsa_setkey_crt()
1010 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz, in hpre_rsa_setkey_crt()
1016 ret = hpre_crt_para_get(ctx->rsa.crt_prikey + offset, hlf_ksz, in hpre_rsa_setkey_crt()
1027 memzero_explicit(ctx->rsa.crt_prikey, offset); in hpre_rsa_setkey_crt()
1028 dma_free_coherent(dev, hlf_ksz * HPRE_CRT_PRMS, ctx->rsa.crt_prikey, in hpre_rsa_setkey_crt()
1029 ctx->rsa.dma_crt_prikey); in hpre_rsa_setkey_crt()
1030 ctx->rsa.crt_prikey = NULL; in hpre_rsa_setkey_crt()
1045 if (ctx->rsa.pubkey) { in hpre_rsa_clear_ctx()
1047 ctx->rsa.pubkey, ctx->rsa.dma_pubkey); in hpre_rsa_clear_ctx()
1048 ctx->rsa.pubkey = NULL; in hpre_rsa_clear_ctx()
1051 if (ctx->rsa.crt_prikey) { in hpre_rsa_clear_ctx()
1052 memzero_explicit(ctx->rsa.crt_prikey, in hpre_rsa_clear_ctx()
1055 ctx->rsa.crt_prikey, ctx->rsa.dma_crt_prikey); in hpre_rsa_clear_ctx()
1056 ctx->rsa.crt_prikey = NULL; in hpre_rsa_clear_ctx()
1059 if (ctx->rsa.prikey) { in hpre_rsa_clear_ctx()
1060 memzero_explicit(ctx->rsa.prikey, ctx->key_sz); in hpre_rsa_clear_ctx()
1061 dma_free_coherent(dev, ctx->key_sz << 1, ctx->rsa.prikey, in hpre_rsa_clear_ctx()
1062 ctx->rsa.dma_prikey); in hpre_rsa_clear_ctx()
1063 ctx->rsa.prikey = NULL; in hpre_rsa_clear_ctx()
1119 if ((private && !ctx->rsa.prikey) || !ctx->rsa.pubkey) { in hpre_rsa_setkey()
1137 ret = crypto_akcipher_set_pub_key(ctx->rsa.soft_tfm, key, keylen); in hpre_rsa_setpubkey()
1150 ret = crypto_akcipher_set_priv_key(ctx->rsa.soft_tfm, key, keylen); in hpre_rsa_setprivkey()
1164 return crypto_akcipher_maxsize(ctx->rsa.soft_tfm); in hpre_rsa_max_size()
1174 ctx->rsa.soft_tfm = crypto_alloc_akcipher("rsa-generic", 0, 0); in hpre_rsa_init_tfm()
1175 if (IS_ERR(ctx->rsa.soft_tfm)) { in hpre_rsa_init_tfm()
1177 return PTR_ERR(ctx->rsa.soft_tfm); in hpre_rsa_init_tfm()
1185 crypto_free_akcipher(ctx->rsa.soft_tfm); in hpre_rsa_init_tfm()
1195 crypto_free_akcipher(ctx->rsa.soft_tfm); in hpre_rsa_exit_tfm()
1997 static struct akcipher_alg rsa = { variable
2101 rsa.base.cra_flags = 0; in hpre_register_rsa()
2102 ret = crypto_register_akcipher(&rsa); in hpre_register_rsa()
2114 crypto_unregister_akcipher(&rsa); in hpre_unregister_rsa()