hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/mac80211/aead_api.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2003-2004, Instant802 Networks, Inc.
34 * Copyright 2005-2006, Devicescape Software, Inc.
45 * Copyright 2014-2015, Qualcomm Atheros, Inc.
56 *
67 * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/kernel.h>
....@@ -26,6 +23,7 @@
2623 struct aead_request *aead_req;
2724 int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
2825 u8 *__aad;
26
+ int ret;
2927
3028 aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC);
3129 if (!aead_req)
....@@ -43,10 +41,10 @@
4341 aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
4442 aead_request_set_ad(aead_req, sg[0].length);
4543
46
- crypto_aead_encrypt(aead_req);
47
- kzfree(aead_req);
44
+ ret = crypto_aead_encrypt(aead_req);
45
+ kfree_sensitive(aead_req);
4846
49
- return 0;
47
+ return ret;
5048 }
5149
5250 int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
....@@ -79,7 +77,7 @@
7977 aead_request_set_ad(aead_req, sg[0].length);
8078
8179 err = crypto_aead_decrypt(aead_req);
82
- kzfree(aead_req);
80
+ kfree_sensitive(aead_req);
8381
8482 return err;
8583 }