Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62076e7b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Setting correct HW crypto driver instance for FDE"

parents be7f77e4 40acb558
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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 @@ static void req_cryptd_crypt_read_convert(struct req_dm_crypt_io *io)
	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 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io)
				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);