hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/security/keys/dh.c
....@@ -1,11 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Crypto operations using stored keys
23 *
34 * Copyright (c) 2016, Intel Corporation
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation; either version
8
- * 2 of the License, or (at your option) any later version.
95 */
106
117 #include <linux/slab.h>
....@@ -62,9 +58,9 @@
6258
6359 static void dh_free_data(struct dh *dh)
6460 {
65
- kzfree(dh->key);
66
- kzfree(dh->p);
67
- kzfree(dh->g);
61
+ kfree_sensitive(dh->key);
62
+ kfree_sensitive(dh->p);
63
+ kfree_sensitive(dh->g);
6864 }
6965
7066 struct dh_completion {
....@@ -112,7 +108,6 @@
112108 if (!sdesc)
113109 goto out_free_tfm;
114110 sdesc->shash.tfm = tfm;
115
- sdesc->shash.flags = 0x0;
116111
117112 *sdesc_ret = sdesc;
118113
....@@ -131,7 +126,7 @@
131126 if (sdesc->shash.tfm)
132127 crypto_free_shash(sdesc->shash.tfm);
133128
134
- kzfree(sdesc);
129
+ kfree_sensitive(sdesc);
135130 }
136131
137132 /*
....@@ -225,7 +220,7 @@
225220 ret = -EFAULT;
226221
227222 err:
228
- kzfree(outbuf);
223
+ kfree_sensitive(outbuf);
229224 return ret;
230225 }
231226
....@@ -400,11 +395,11 @@
400395 out6:
401396 kpp_request_free(req);
402397 out5:
403
- kzfree(outbuf);
398
+ kfree_sensitive(outbuf);
404399 out4:
405400 crypto_free_kpp(tfm);
406401 out3:
407
- kzfree(secret);
402
+ kfree_sensitive(secret);
408403 out2:
409404 dh_free_data(&dh_inputs);
410405 out1: