Merge "Setting correct HW crypto driver instance for FDE"
diff --git a/drivers/md/dm-req-crypt.c b/drivers/md/dm-req-crypt.c
index 87a4ab9..48dca3c 100644
--- a/drivers/md/dm-req-crypt.c
+++ b/drivers/md/dm-req-crypt.c
@@ -46,6 +46,7 @@
#define DM_REQ_CRYPT_ERROR -1
#define DM_REQ_CRYPT_ERROR_AFTER_PAGE_MALLOC -2
+#define FDE_CRYPTO_DEVICE 0
struct req_crypt_result {
struct completion completion;
@@ -196,6 +197,13 @@
ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
req_crypt_cipher_complete, &result);
init_completion(&result.completion);
+ err = qcrypto_cipher_set_device(req, FDE_CRYPTO_DEVICE);
+ if (err != 0) {
+ DMERR("%s qcrypto_cipher_set_device failed with err %d\n",
+ __func__, err);
+ error = DM_REQ_CRYPT_ERROR;
+ goto ablkcipher_req_alloc_failure;
+ }
qcrypto_cipher_set_flag(req,
QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B);
crypto_ablkcipher_clear_flags(tfm, ~0);
@@ -322,6 +330,13 @@
req_crypt_cipher_complete, &result);
init_completion(&result.completion);
+ error = qcrypto_cipher_set_device(req, FDE_CRYPTO_DEVICE);
+ if (error != 0) {
+ DMERR("%s qcrypto_cipher_set_device failed with error %d\n",
+ __func__, error);
+ error = DM_REQ_CRYPT_ERROR;
+ goto ablkcipher_req_alloc_failure;
+ }
qcrypto_cipher_set_flag(req,
QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B);
crypto_ablkcipher_clear_flags(tfm, ~0);