treewide: fix nss-crypto and qca-nss-cfi patches for kernel 6.12

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2025-05-09 14:53:17 -04:00
parent 6f823a2b34
commit 061e717e06
2 changed files with 52 additions and 37 deletions

View File

@ -3,14 +3,14 @@
@@ -37,6 +37,9 @@
#include <linux/debugfs.h>
#include <linux/completion.h>
#include <linux/of.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0))
+#include <linux/vmalloc.h>
+#endif
#include <crypto/aes.h>
#include <crypto/des.h>
@@ -1849,6 +1852,12 @@ static struct ahash_alg cryptoapi_ahash_
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
@@ -1792,6 +1795,12 @@ static struct ahash_alg cryptoapi_ahash_
},
};
@ -23,7 +23,7 @@
/*
* nss_cryptoapi_copy_reverse()
* Reverse copy
@@ -1946,7 +1955,7 @@ struct nss_cryptoapi_algo_info *nss_cryp
@@ -1889,7 +1898,7 @@ struct nss_cryptoapi_algo_info *nss_cryp
* nss_cryptoapi_cra_name_lookup()
* Lookup the associated algorithm in NSS for the given transformation by name
*/
@ -32,7 +32,7 @@
{
struct nss_cryptoapi_algo_info *info = g_algo_info;
int i;
@@ -2117,7 +2126,7 @@ skip_iv:
@@ -2060,7 +2069,7 @@ skip_iv:
* nss_cryptoapi_ctx_stats_read()
* CryptoAPI context statistics read function
*/
@ -41,7 +41,7 @@
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
struct nss_cryptoapi_stats *stats = &ctx->stats;
@@ -2169,7 +2178,7 @@ ssize_t nss_cryptoapi_ctx_stats_read(str
@@ -2112,7 +2121,7 @@ ssize_t nss_cryptoapi_ctx_stats_read(str
* nss_cryptoapi_ctx_info_read()
* CryptoAPI context info read function
*/
@ -50,25 +50,25 @@
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
ssize_t max_buf_len;
@@ -2244,7 +2253,7 @@ void nss_cryptoapi_add_ctx2debugfs(struc
@@ -2198,7 +2207,7 @@ void nss_cryptoapi_add_ctx2debugfs(struc
* nss_cryptoapi_attach_user()
* register crypto core with the cryptoapi CFI
*/
-void nss_cryptoapi_attach_user(void *app_data, struct nss_crypto_user *user)
+static void nss_cryptoapi_attach_user(void *app_data, struct nss_crypto_user *user)
{
struct skcipher_alg *skcipher = cryptoapi_skcipher_algs;
struct aead_alg *aead = cryptoapi_aead_algs;
@@ -2312,7 +2321,7 @@ void nss_cryptoapi_attach_user(void *app
#if defined(NSS_CRYPTOAPI_SKCIPHER)
struct skcipher_alg *ablk = cryptoapi_skcipher_algs;
@@ -2270,7 +2279,7 @@ void nss_cryptoapi_attach_user(void *app
* nss_cryptoapi_detach_user()
* Unregister crypto core with cryptoapi CFI layer
*/
-void nss_cryptoapi_detach_user(void *app_data, struct nss_crypto_user *user)
+static void nss_cryptoapi_detach_user(void *app_data, struct nss_crypto_user *user)
{
struct skcipher_alg *skcipher = cryptoapi_skcipher_algs;
struct aead_alg *aead = cryptoapi_aead_algs;
@@ -2378,7 +2387,7 @@ EXPORT_SYMBOL(nss_cryptoapi_is_registere
#if defined(NSS_CRYPTOAPI_SKCIPHER)
struct skcipher_alg *ablk = cryptoapi_skcipher_algs;
@@ -2340,7 +2349,7 @@ EXPORT_SYMBOL(nss_cryptoapi_is_registere
* nss_cryptoapi_init()
* Initializing crypto core layer
*/
@ -77,7 +77,7 @@
{
nss_cfi_info("module loaded %s\n", NSS_CFI_BUILD_ID);
@@ -2408,7 +2417,7 @@ int nss_cryptoapi_init(void)
@@ -2370,7 +2379,7 @@ int nss_cryptoapi_init(void)
* nss_cryptoapi_exit()
* De-Initialize cryptoapi CFI layer
*/
@ -88,7 +88,7 @@
nss_crypto_unregister_user(g_cryptoapi.user);
--- a/cryptoapi/v2.0/nss_cryptoapi_aead.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_aead.c
@@ -386,7 +386,7 @@ int nss_cryptoapi_aead_setauthsize(struc
@@ -367,7 +367,7 @@ int nss_cryptoapi_aead_setauthsize(struc
* nss_cryptoapi_aead_done()
* Cipher/Auth encrypt request completion callback function
*/
@ -112,7 +112,7 @@
/*
* nss_cryptoapi_ahash_ctx2session()
* Cryptoapi function to get the session ID for an AHASH
@@ -234,7 +240,7 @@ int nss_cryptoapi_ahash_setkey(struct cr
@@ -228,7 +234,7 @@ int nss_cryptoapi_ahash_setkey(struct cr
* nss_cryptoapi_ahash_done()
* Hash request completion callback function
*/
@ -120,24 +120,15 @@
+static void nss_cryptoapi_ahash_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct ahash_request *req = app_data;
struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
@@ -476,8 +482,6 @@ static void nss_cryptoapi_ahash_finup_do
req->base.complete = rctx->complete;
req->base.data = rctx->data;
ahash_request_complete(req, err);
-
- return;
}
/*
struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
--- a/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
@@ -201,7 +201,7 @@ int nss_cryptoapi_skcipher_setkey(struct
@@ -217,7 +217,7 @@ int nss_cryptoapi_skcipher_setkey(struct
* nss_cryptoapi_skcipher_done()
* Cipher operation completion callback function
* Cipher operation completion callback function
*/
-void nss_cryptoapi_skcipher_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_skcipher_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct skcipher_request *req = app_data;
struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req);

View File

@ -1,6 +1,6 @@
--- a/v2.0/src/nss_crypto_ctrl.c
+++ b/v2.0/src/nss_crypto_ctrl.c
@@ -831,7 +831,7 @@ void nss_crypto_process_event(void *app_
@@ -833,7 +833,7 @@ void nss_crypto_process_event(void *app_
* nss_crypto_free()
* Free crypto context
*/
@ -9,7 +9,7 @@
{
struct nss_crypto_ctrl *ctrl = &g_control;
int32_t status;
@@ -891,7 +891,7 @@ free:
@@ -893,7 +893,7 @@ free:
* possible that the host to NSS queue is busy in which
* case we need to retry.
*/
@ -18,7 +18,7 @@
{
struct nss_crypto_ctrl *ctrl = &g_control;
struct nss_crypto_ctx *ctx;
@@ -1242,7 +1242,7 @@ void nss_crypto_engine_free(struct nss_c
@@ -1244,7 +1244,7 @@ void nss_crypto_engine_free(struct nss_c
* nss_crypto_ndev_setup()
* setup the dummy netdevice
*/
@ -27,7 +27,7 @@
{
nss_crypto_info("%px: dummy netdevice for crypto\n", dev);
}
@@ -1573,11 +1573,10 @@ static int nss_crypto_device_probe(struc
@@ -1575,11 +1575,10 @@ static int nss_crypto_device_probe(struc
* nss_crypto_device_remove()
* remove crypto device and deregister everything
*/
@ -40,7 +40,19 @@
};
/*
@@ -1654,7 +1653,7 @@ static int nss_crypto_probe(struct platf
@@ -1588,7 +1587,11 @@ static int nss_crypto_device_remove(stru
*/
static struct platform_driver nss_crypto_device = {
.probe = nss_crypto_device_probe,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
+ .remove_new = nss_crypto_device_remove,
+#else
.remove = nss_crypto_device_remove,
+#endif
.driver = {
.owner = THIS_MODULE,
.name = "nss-crypto-device",
@@ -1656,7 +1659,7 @@ static int nss_crypto_probe(struct platf
* nss_crypto_remove()
* remove the crypto driver
*/
@ -49,7 +61,7 @@
{
struct nss_crypto_ctrl *ctrl = platform_get_drvdata(pdev);
@@ -1668,7 +1667,6 @@ static int nss_crypto_remove(struct plat
@@ -1670,7 +1673,6 @@ static int nss_crypto_remove(struct plat
* Clear the active state of driver
*/
ctrl->active = false;
@ -57,7 +69,19 @@
}
/*
@@ -1689,7 +1687,7 @@ static struct platform_driver nss_crypto
@@ -1679,7 +1681,11 @@ static int nss_crypto_remove(struct plat
*/
static struct platform_driver nss_crypto_drv = {
.probe = nss_crypto_probe,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
+ .remove_new = nss_crypto_remove,
+#else
.remove = nss_crypto_remove,
+#endif
.driver = {
.owner = THIS_MODULE,
.name = "nss-crypto",
@@ -1691,7 +1697,7 @@ static struct platform_driver nss_crypto
* nss_crypto_delayed_probe()
* delayed sequence to initialize crypto after NSS FW is initialized
*/
@ -303,7 +327,7 @@
struct resource *res, uint32_t offset)
{
struct nss_crypto_node *node = platform_get_drvdata(pdev);
@@ -546,7 +546,7 @@ int nss_crypto_eip197_engine_init(struct
@@ -550,7 +550,7 @@ int nss_crypto_eip197_engine_init(struct
* nss_crypto_eip197_node_init()
* allocate & initialize eip197 node
*/