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