From e636c8d336489bf3eed5878299e6cc045bbad077 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 20 Feb 2024 01:17:29 +0000
Subject: [PATCH] debug lk
---
kernel/drivers/mmc/core/crypto.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/kernel/drivers/mmc/core/crypto.c b/kernel/drivers/mmc/core/crypto.c
index 661e7f8..6755780 100644
--- a/kernel/drivers/mmc/core/crypto.c
+++ b/kernel/drivers/mmc/core/crypto.c
@@ -1,40 +1,41 @@
-// SPDX-License-Identifier: GPL-2.0
+// SPDX-License-Identifier: GPL-2.0-only
/*
+ * MMC crypto engine (inline encryption) support
+ *
* Copyright 2020 Google LLC
*/
#include <linux/blk-crypto.h>
-#include <linux/blkdev.h>
-#include <linux/keyslot-manager.h>
#include <linux/mmc/host.h>
#include "core.h"
+#include "crypto.h"
#include "queue.h"
-void mmc_crypto_setup_queue(struct mmc_host *host, struct request_queue *q)
+void mmc_crypto_set_initial_state(struct mmc_host *host)
+{
+ /* Reset might clear all keys, so reprogram all the keys. */
+ if (host->caps2 & MMC_CAP2_CRYPTO)
+ blk_ksm_reprogram_all_keys(&host->ksm);
+}
+
+void mmc_crypto_setup_queue(struct request_queue *q, struct mmc_host *host)
{
if (host->caps2 & MMC_CAP2_CRYPTO)
- q->ksm = host->ksm;
+ blk_ksm_register(&host->ksm, q);
}
EXPORT_SYMBOL_GPL(mmc_crypto_setup_queue);
-
-void mmc_crypto_free_host(struct mmc_host *host)
-{
- keyslot_manager_destroy(host->ksm);
-}
void mmc_crypto_prepare_req(struct mmc_queue_req *mqrq)
{
struct request *req = mmc_queue_req_to_req(mqrq);
struct mmc_request *mrq = &mqrq->brq.mrq;
- const struct bio_crypt_ctx *bc;
- if (!bio_crypt_should_process(req))
+ if (!req->crypt_ctx)
return;
- bc = req->bio->bi_crypt_context;
- mrq->crypto_key_slot = bc->bc_keyslot;
- mrq->data_unit_num = bc->bc_dun[0];
- mrq->crypto_key = bc->bc_key;
+ mrq->crypto_ctx = req->crypt_ctx;
+ if (req->crypt_keyslot)
+ mrq->crypto_key_slot = blk_ksm_get_slot_idx(req->crypt_keyslot);
}
EXPORT_SYMBOL_GPL(mmc_crypto_prepare_req);
--
Gitblit v1.6.2