nss-packages-qosmio/qca-nss-cfi/patches/0009-cryptoapi-v2.0-support-kernel-6.12.patch
Sean Khan 061e717e06 treewide: fix nss-crypto and qca-nss-cfi patches for kernel 6.12
Signed-off-by: Sean Khan <datapronix@protonmail.com>
2025-05-09 14:53:17 -04:00

135 lines
5.2 KiB
Diff

--- a/cryptoapi/v2.0/nss_cryptoapi.c
+++ b/cryptoapi/v2.0/nss_cryptoapi.c
@@ -37,6 +37,9 @@
#include <linux/debugfs.h>
#include <linux/completion.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0))
+#include <linux/vmalloc.h>
+#endif
#include <crypto/aes.h>
#include <crypto/des.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
@@ -1792,6 +1795,12 @@ static struct ahash_alg cryptoapi_ahash_
},
};
+/*-------------------------------------------------------------
+ * Prototypes
+ *-------------------------------------------------------------
+ */
+bool nss_cryptoapi_is_registered(void);
+
/*
* nss_cryptoapi_copy_reverse()
* Reverse copy
@@ -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
*/
-struct nss_cryptoapi_algo_info *nss_cryptoapi_cra_name_lookup(const char *cra_name)
+static struct nss_cryptoapi_algo_info *nss_cryptoapi_cra_name_lookup(const char *cra_name)
{
struct nss_cryptoapi_algo_info *info = g_algo_info;
int i;
@@ -2060,7 +2069,7 @@ skip_iv:
* nss_cryptoapi_ctx_stats_read()
* CryptoAPI context statistics read function
*/
-ssize_t nss_cryptoapi_ctx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
+static ssize_t nss_cryptoapi_ctx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
struct nss_cryptoapi_stats *stats = &ctx->stats;
@@ -2112,7 +2121,7 @@ ssize_t nss_cryptoapi_ctx_stats_read(str
* nss_cryptoapi_ctx_info_read()
* CryptoAPI context info read function
*/
-ssize_t nss_cryptoapi_ctx_info_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
+static ssize_t nss_cryptoapi_ctx_info_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
ssize_t max_buf_len;
@@ -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)
{
#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)
{
#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
*/
-int nss_cryptoapi_init(void)
+static int nss_cryptoapi_init(void)
{
nss_cfi_info("module loaded %s\n", NSS_CFI_BUILD_ID);
@@ -2370,7 +2379,7 @@ int nss_cryptoapi_init(void)
* nss_cryptoapi_exit()
* De-Initialize cryptoapi CFI layer
*/
-void nss_cryptoapi_exit(void)
+static void nss_cryptoapi_exit(void)
{
if (g_cryptoapi.user)
nss_crypto_unregister_user(g_cryptoapi.user);
--- a/cryptoapi/v2.0/nss_cryptoapi_aead.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_aead.c
@@ -367,7 +367,7 @@ int nss_cryptoapi_aead_setauthsize(struc
* nss_cryptoapi_aead_done()
* Cipher/Auth encrypt request completion callback function
*/
-void nss_cryptoapi_aead_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_aead_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct aead_request *req = (struct aead_request *)app_data;
struct crypto_aead *aead = crypto_aead_reqtfm(req);
--- a/cryptoapi/v2.0/nss_cryptoapi_ahash.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_ahash.c
@@ -87,6 +87,12 @@ extern struct nss_cryptoapi g_cryptoapi;
#endif /* NSS_CFI_DEBUG */
+/*-------------------------------------------------------------
+ * Prototype
+ *-------------------------------------------------------------
+ */
+int nss_cryptoapi_ahash_ctx2session(struct crypto_ahash *ahash, uint32_t *sid);
+
/*
* nss_cryptoapi_ahash_ctx2session()
* Cryptoapi function to get the session ID for an AHASH
@@ -228,7 +234,7 @@ int nss_cryptoapi_ahash_setkey(struct cr
* nss_cryptoapi_ahash_done()
* Hash request completion callback function
*/
-void nss_cryptoapi_ahash_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_ahash_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct ahash_request *req = app_data;
struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
--- a/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
@@ -217,7 +217,7 @@ int nss_cryptoapi_skcipher_setkey(struct
* nss_cryptoapi_skcipher_done()
* 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 crypto_skcipher *cipher = crypto_skcipher_reqtfm(req);