From f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 31 Jan 2024 01:04:47 +0000
Subject: [PATCH] add driver 5G

---
 kernel/include/crypto/kpp.h |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/kernel/include/crypto/kpp.h b/kernel/include/crypto/kpp.h
index 1a34630..ccccead 100644
--- a/kernel/include/crypto/kpp.h
+++ b/kernel/include/crypto/kpp.h
@@ -1,14 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Key-agreement Protocol Primitives (KPP)
  *
  * Copyright (c) 2016, Intel Corporation
  * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
  */
 
 #ifndef _CRYPTO_KPP_
@@ -194,7 +189,7 @@
  */
 static inline void kpp_request_free(struct kpp_request *req)
 {
-	kzfree(req);
+	kfree_sensitive(req);
 }
 
 /**
@@ -289,8 +284,13 @@
 					const void *buffer, unsigned int len)
 {
 	struct kpp_alg *alg = crypto_kpp_alg(tfm);
+	struct crypto_alg *calg = tfm->base.__crt_alg;
+	int ret;
 
-	return alg->set_secret(tfm, buffer, len);
+	crypto_stats_get(calg);
+	ret = alg->set_secret(tfm, buffer, len);
+	crypto_stats_kpp_set_secret(calg, ret);
+	return ret;
 }
 
 /**
@@ -310,8 +310,13 @@
 {
 	struct crypto_kpp *tfm = crypto_kpp_reqtfm(req);
 	struct kpp_alg *alg = crypto_kpp_alg(tfm);
+	struct crypto_alg *calg = tfm->base.__crt_alg;
+	int ret;
 
-	return alg->generate_public_key(req);
+	crypto_stats_get(calg);
+	ret = alg->generate_public_key(req);
+	crypto_stats_kpp_generate_public_key(calg, ret);
+	return ret;
 }
 
 /**
@@ -328,8 +333,13 @@
 {
 	struct crypto_kpp *tfm = crypto_kpp_reqtfm(req);
 	struct kpp_alg *alg = crypto_kpp_alg(tfm);
+	struct crypto_alg *calg = tfm->base.__crt_alg;
+	int ret;
 
-	return alg->compute_shared_secret(req);
+	crypto_stats_get(calg);
+	ret = alg->compute_shared_secret(req);
+	crypto_stats_kpp_compute_shared_secret(calg, ret);
+	return ret;
 }
 
 /**

--
Gitblit v1.6.2