• Home
  • Raw
  • Download

Lines Matching refs:ctx

324 			   struct karatsuba_ctx *ctx)  in mpihelp_mul_karatsuba_case()  argument
328 if (!ctx->tspace || ctx->tspace_size < vsize) { in mpihelp_mul_karatsuba_case()
329 if (ctx->tspace) in mpihelp_mul_karatsuba_case()
330 mpi_free_limb_space(ctx->tspace); in mpihelp_mul_karatsuba_case()
331 ctx->tspace = mpi_alloc_limb_space(2 * vsize); in mpihelp_mul_karatsuba_case()
332 if (!ctx->tspace) in mpihelp_mul_karatsuba_case()
334 ctx->tspace_size = vsize; in mpihelp_mul_karatsuba_case()
337 MPN_MUL_N_RECURSE(prodp, up, vp, vsize, ctx->tspace); in mpihelp_mul_karatsuba_case()
343 if (!ctx->tp || ctx->tp_size < vsize) { in mpihelp_mul_karatsuba_case()
344 if (ctx->tp) in mpihelp_mul_karatsuba_case()
345 mpi_free_limb_space(ctx->tp); in mpihelp_mul_karatsuba_case()
346 ctx->tp = mpi_alloc_limb_space(2 * vsize); in mpihelp_mul_karatsuba_case()
347 if (!ctx->tp) { in mpihelp_mul_karatsuba_case()
348 if (ctx->tspace) in mpihelp_mul_karatsuba_case()
349 mpi_free_limb_space(ctx->tspace); in mpihelp_mul_karatsuba_case()
350 ctx->tspace = NULL; in mpihelp_mul_karatsuba_case()
353 ctx->tp_size = vsize; in mpihelp_mul_karatsuba_case()
357 MPN_MUL_N_RECURSE(ctx->tp, up, vp, vsize, ctx->tspace); in mpihelp_mul_karatsuba_case()
358 cy = mpihelp_add_n(prodp, prodp, ctx->tp, vsize); in mpihelp_mul_karatsuba_case()
359 mpihelp_add_1(prodp + vsize, ctx->tp + vsize, vsize, in mpihelp_mul_karatsuba_case()
370 if (mpihelp_mul(ctx->tspace, vp, vsize, up, usize, &tmp) in mpihelp_mul_karatsuba_case()
374 if (!ctx->next) { in mpihelp_mul_karatsuba_case()
375 ctx->next = kzalloc(sizeof *ctx, GFP_KERNEL); in mpihelp_mul_karatsuba_case()
376 if (!ctx->next) in mpihelp_mul_karatsuba_case()
379 if (mpihelp_mul_karatsuba_case(ctx->tspace, in mpihelp_mul_karatsuba_case()
382 ctx->next) < 0) in mpihelp_mul_karatsuba_case()
386 cy = mpihelp_add_n(prodp, prodp, ctx->tspace, vsize); in mpihelp_mul_karatsuba_case()
387 mpihelp_add_1(prodp + vsize, ctx->tspace + vsize, usize, cy); in mpihelp_mul_karatsuba_case()
393 void mpihelp_release_karatsuba_ctx(struct karatsuba_ctx *ctx) in mpihelp_release_karatsuba_ctx() argument
397 if (ctx->tp) in mpihelp_release_karatsuba_ctx()
398 mpi_free_limb_space(ctx->tp); in mpihelp_release_karatsuba_ctx()
399 if (ctx->tspace) in mpihelp_release_karatsuba_ctx()
400 mpi_free_limb_space(ctx->tspace); in mpihelp_release_karatsuba_ctx()
401 for (ctx = ctx->next; ctx; ctx = ctx2) { in mpihelp_release_karatsuba_ctx()
402 ctx2 = ctx->next; in mpihelp_release_karatsuba_ctx()
403 if (ctx->tp) in mpihelp_release_karatsuba_ctx()
404 mpi_free_limb_space(ctx->tp); in mpihelp_release_karatsuba_ctx()
405 if (ctx->tspace) in mpihelp_release_karatsuba_ctx()
406 mpi_free_limb_space(ctx->tspace); in mpihelp_release_karatsuba_ctx()
407 kfree(ctx); in mpihelp_release_karatsuba_ctx()
432 struct karatsuba_ctx ctx; in mpihelp_mul() local
478 memset(&ctx, 0, sizeof ctx); in mpihelp_mul()
479 if (mpihelp_mul_karatsuba_case(prodp, up, usize, vp, vsize, &ctx) < 0) in mpihelp_mul()
481 mpihelp_release_karatsuba_ctx(&ctx); in mpihelp_mul()