hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/crypto/kpp.h
....@@ -1,14 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Key-agreement Protocol Primitives (KPP)
34 *
45 * Copyright (c) 2016, Intel Corporation
56 * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the Free
9
- * Software Foundation; either version 2 of the License, or (at your option)
10
- * any later version.
11
- *
127 */
138
149 #ifndef _CRYPTO_KPP_
....@@ -194,7 +189,7 @@
194189 */
195190 static inline void kpp_request_free(struct kpp_request *req)
196191 {
197
- kzfree(req);
192
+ kfree_sensitive(req);
198193 }
199194
200195 /**
....@@ -289,8 +284,13 @@
289284 const void *buffer, unsigned int len)
290285 {
291286 struct kpp_alg *alg = crypto_kpp_alg(tfm);
287
+ struct crypto_alg *calg = tfm->base.__crt_alg;
288
+ int ret;
292289
293
- return alg->set_secret(tfm, buffer, len);
290
+ crypto_stats_get(calg);
291
+ ret = alg->set_secret(tfm, buffer, len);
292
+ crypto_stats_kpp_set_secret(calg, ret);
293
+ return ret;
294294 }
295295
296296 /**
....@@ -310,8 +310,13 @@
310310 {
311311 struct crypto_kpp *tfm = crypto_kpp_reqtfm(req);
312312 struct kpp_alg *alg = crypto_kpp_alg(tfm);
313
+ struct crypto_alg *calg = tfm->base.__crt_alg;
314
+ int ret;
313315
314
- return alg->generate_public_key(req);
316
+ crypto_stats_get(calg);
317
+ ret = alg->generate_public_key(req);
318
+ crypto_stats_kpp_generate_public_key(calg, ret);
319
+ return ret;
315320 }
316321
317322 /**
....@@ -328,8 +333,13 @@
328333 {
329334 struct crypto_kpp *tfm = crypto_kpp_reqtfm(req);
330335 struct kpp_alg *alg = crypto_kpp_alg(tfm);
336
+ struct crypto_alg *calg = tfm->base.__crt_alg;
337
+ int ret;
331338
332
- return alg->compute_shared_secret(req);
339
+ crypto_stats_get(calg);
340
+ ret = alg->compute_shared_secret(req);
341
+ crypto_stats_kpp_compute_shared_secret(calg, ret);
342
+ return ret;
333343 }
334344
335345 /**