struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req);
        struct caam_ctx *caam_ctx = crypto_ablkcipher_ctx(ablkcipher);
        struct device *qidev = caam_ctx->qidev;
-#ifdef DEBUG
        int ivsize = crypto_ablkcipher_ivsize(ablkcipher);
 
+#ifdef DEBUG
        dev_err(qidev, "%s %d: status 0x%x\n", __func__, __LINE__, status);
 #endif
 
        ablkcipher_unmap(qidev, edesc, req);
        qi_cache_free(edesc);
 
+       /*
+        * The crypto API expects us to set the IV (req->info) to the last
+        * ciphertext block. This is used e.g. by the CTS mode.
+        */
+       scatterwalk_map_and_copy(req->info, req->dst, req->nbytes - ivsize,
+                                ivsize, 0);
+
        ablkcipher_request_complete(req, status);
 }