Lines Matching refs:ctx
115 struct nx842_crypto_ctx *ctx = crypto_tfm_ctx(tfm); in nx842_crypto_init() local
117 spin_lock_init(&ctx->lock); in nx842_crypto_init()
118 ctx->driver = driver; in nx842_crypto_init()
119 ctx->wmem = kmalloc(driver->workmem_size, GFP_KERNEL); in nx842_crypto_init()
120 ctx->sbounce = (u8 *)__get_free_pages(GFP_KERNEL, BOUNCE_BUFFER_ORDER); in nx842_crypto_init()
121 ctx->dbounce = (u8 *)__get_free_pages(GFP_KERNEL, BOUNCE_BUFFER_ORDER); in nx842_crypto_init()
122 if (!ctx->wmem || !ctx->sbounce || !ctx->dbounce) { in nx842_crypto_init()
123 kfree(ctx->wmem); in nx842_crypto_init()
124 free_page((unsigned long)ctx->sbounce); in nx842_crypto_init()
125 free_page((unsigned long)ctx->dbounce); in nx842_crypto_init()
135 struct nx842_crypto_ctx *ctx = crypto_tfm_ctx(tfm); in nx842_crypto_exit() local
137 kfree(ctx->wmem); in nx842_crypto_exit()
138 free_page((unsigned long)ctx->sbounce); in nx842_crypto_exit()
139 free_page((unsigned long)ctx->dbounce); in nx842_crypto_exit()
167 static int compress(struct nx842_crypto_ctx *ctx, in compress() argument
196 memset(ctx->sbounce + slen, 0, adj_slen - slen); in compress()
197 memcpy(ctx->sbounce, src, slen); in compress()
198 src = ctx->sbounce; in compress()
215 dst = ctx->dbounce; in compress()
228 ret = ctx->driver->compress(src, slen, dst, &dlen, ctx->wmem); in compress()
232 if (ret == -ENOSPC && dst != ctx->dbounce) in compress()
240 if (dst == ctx->dbounce) in compress()
262 struct nx842_crypto_ctx *ctx = crypto_tfm_ctx(tfm); in nx842_crypto_compress() local
263 struct nx842_crypto_header *hdr = &ctx->header; in nx842_crypto_compress()
265 struct nx842_constraints c = *ctx->driver->constraints; in nx842_crypto_compress()
285 spin_lock_bh(&ctx->lock); in nx842_crypto_compress()
313 ret = compress(ctx, &p, &hdr->group[n], &c, &ignore, h); in nx842_crypto_compress()
339 spin_unlock_bh(&ctx->lock); in nx842_crypto_compress()
344 static int decompress(struct nx842_crypto_ctx *ctx, in decompress() argument
382 memset(ctx->sbounce + slen, 0, adj_slen - slen); in decompress()
383 memcpy(ctx->sbounce, src, slen); in decompress()
384 src = ctx->sbounce; in decompress()
393 dst = ctx->dbounce; in decompress()
406 ret = ctx->driver->decompress(src, slen, dst, &dlen, ctx->wmem); in decompress()
418 dst = ctx->dbounce; in decompress()
433 if (dst == ctx->dbounce) in decompress()
446 struct nx842_crypto_ctx *ctx = crypto_tfm_ctx(tfm); in nx842_crypto_decompress() local
449 struct nx842_constraints c = *ctx->driver->constraints; in nx842_crypto_decompress()
465 spin_lock_bh(&ctx->lock); in nx842_crypto_decompress()
477 ret = decompress(ctx, &p, &g, &c, 0); in nx842_crypto_decompress()
502 memcpy(&ctx->header, src, hdr_len); in nx842_crypto_decompress()
503 hdr = &ctx->header; in nx842_crypto_decompress()
510 ret = decompress(ctx, &p, &hdr->group[n], &c, ignore); in nx842_crypto_decompress()
523 spin_unlock_bh(&ctx->lock); in nx842_crypto_decompress()