static int nitrox_skcipher_init(struct crypto_skcipher *tfm)
 {
        struct nitrox_crypto_ctx *nctx = crypto_skcipher_ctx(tfm);
-       void *fctx;
+       struct crypto_ctx_hdr *chdr;
 
        /* get the first device */
        nctx->ndev = nitrox_get_first_device();
                return -ENODEV;
 
        /* allocate nitrox crypto context */
-       fctx = crypto_alloc_context(nctx->ndev);
-       if (!fctx) {
+       chdr = crypto_alloc_context(nctx->ndev);
+       if (!chdr) {
                nitrox_put_device(nctx->ndev);
                return -ENOMEM;
        }
-       nctx->u.ctx_handle = (uintptr_t)fctx;
+       nctx->chdr = chdr;
+       nctx->u.ctx_handle = (uintptr_t)((u8 *)chdr->vaddr +
+                                        sizeof(struct ctx_hdr));
        crypto_skcipher_set_reqsize(tfm, crypto_skcipher_reqsize(tfm) +
                                    sizeof(struct nitrox_kcrypt_request));
        return 0;
 
                memset(&fctx->crypto, 0, sizeof(struct crypto_keys));
                memset(&fctx->auth, 0, sizeof(struct auth_keys));
-               crypto_free_context((void *)fctx);
+               crypto_free_context((void *)nctx->chdr);
        }
        nitrox_put_device(nctx->ndev);
 
 
 void *crypto_alloc_context(struct nitrox_device *ndev)
 {
        struct ctx_hdr *ctx;
+       struct crypto_ctx_hdr *chdr;
        void *vaddr;
        dma_addr_t dma;
 
+       chdr = kmalloc(sizeof(*chdr), GFP_KERNEL);
+       if (!chdr)
+               return NULL;
+
        vaddr = dma_pool_zalloc(ndev->ctx_pool, GFP_KERNEL, &dma);
-       if (!vaddr)
+       if (!vaddr) {
+               kfree(chdr);
                return NULL;
+       }
 
        /* fill meta data */
        ctx = vaddr;
        ctx->dma = dma;
        ctx->ctx_dma = dma + sizeof(struct ctx_hdr);
 
-       return ((u8 *)vaddr + sizeof(struct ctx_hdr));
+       chdr->pool = ndev->ctx_pool;
+       chdr->dma = dma;
+       chdr->vaddr = vaddr;
+
+       return chdr;
 }
 
 /**
  */
 void crypto_free_context(void *ctx)
 {
-       struct ctx_hdr *ctxp;
+       struct crypto_ctx_hdr *ctxp;
 
        if (!ctx)
                return;
 
-       ctxp = (struct ctx_hdr *)((u8 *)ctx - sizeof(struct ctx_hdr));
-       dma_pool_free(ctxp->pool, ctxp, ctxp->dma);
+       ctxp = ctx;
+       dma_pool_free(ctxp->pool, ctxp->vaddr, ctxp->dma);
+       kfree(ctxp);
 }
 
 /**
 
        struct auth_keys auth;
 };
 
+struct crypto_ctx_hdr {
+       struct dma_pool *pool;
+       dma_addr_t dma;
+       void *vaddr;
+};
+
 struct nitrox_crypto_ctx {
        struct nitrox_device *ndev;
        union {
                u64 ctx_handle;
                struct flexi_crypto_context *fctx;
        } u;
+       struct crypto_ctx_hdr *chdr;
 };
 
 struct nitrox_kcrypt_request {