Lines Matching refs:ctx
100 static void ctx_free(struct ksmbd_crypto_ctx *ctx)
105 free_shash(ctx->desc[i]);
107 free_aead(ctx->ccmaes[i]);
108 kfree(ctx);
113 struct ksmbd_crypto_ctx *ctx;
118 ctx = list_entry(ctx_list.idle_ctx.next,
121 list_del(&ctx->list);
123 return ctx;
136 ctx = kzalloc(sizeof(struct ksmbd_crypto_ctx), GFP_KERNEL);
137 if (!ctx) {
147 return ctx;
150 void ksmbd_release_crypto_ctx(struct ksmbd_crypto_ctx *ctx)
152 if (!ctx)
157 list_add(&ctx->list, &ctx_list.idle_ctx);
165 ctx_free(ctx);
170 struct ksmbd_crypto_ctx *ctx;
175 ctx = ksmbd_find_crypto_ctx();
176 if (ctx->desc[id])
177 return ctx;
179 ctx->desc[id] = alloc_shash_desc(id);
180 if (ctx->desc[id])
181 return ctx;
182 ksmbd_release_crypto_ctx(ctx);
213 struct ksmbd_crypto_ctx *ctx;
218 ctx = ksmbd_find_crypto_ctx();
219 if (ctx->ccmaes[id])
220 return ctx;
222 ctx->ccmaes[id] = alloc_aead(id);
223 if (ctx->ccmaes[id])
224 return ctx;
225 ksmbd_release_crypto_ctx(ctx);
241 struct ksmbd_crypto_ctx *ctx;
244 ctx = list_entry(ctx_list.idle_ctx.next,
247 list_del(&ctx->list);
248 ctx_free(ctx);
254 struct ksmbd_crypto_ctx *ctx;
261 ctx = kzalloc(sizeof(struct ksmbd_crypto_ctx), GFP_KERNEL);
262 if (!ctx)
264 list_add(&ctx->list, &ctx_list.idle_ctx);