| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* Crypto operations using stored keys |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * 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. |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 62 | 58 | |
|---|
| 63 | 59 | static void dh_free_data(struct dh *dh) |
|---|
| 64 | 60 | { |
|---|
| 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); |
|---|
| 68 | 64 | } |
|---|
| 69 | 65 | |
|---|
| 70 | 66 | struct dh_completion { |
|---|
| .. | .. |
|---|
| 112 | 108 | if (!sdesc) |
|---|
| 113 | 109 | goto out_free_tfm; |
|---|
| 114 | 110 | sdesc->shash.tfm = tfm; |
|---|
| 115 | | - sdesc->shash.flags = 0x0; |
|---|
| 116 | 111 | |
|---|
| 117 | 112 | *sdesc_ret = sdesc; |
|---|
| 118 | 113 | |
|---|
| .. | .. |
|---|
| 131 | 126 | if (sdesc->shash.tfm) |
|---|
| 132 | 127 | crypto_free_shash(sdesc->shash.tfm); |
|---|
| 133 | 128 | |
|---|
| 134 | | - kzfree(sdesc); |
|---|
| 129 | + kfree_sensitive(sdesc); |
|---|
| 135 | 130 | } |
|---|
| 136 | 131 | |
|---|
| 137 | 132 | /* |
|---|
| .. | .. |
|---|
| 225 | 220 | ret = -EFAULT; |
|---|
| 226 | 221 | |
|---|
| 227 | 222 | err: |
|---|
| 228 | | - kzfree(outbuf); |
|---|
| 223 | + kfree_sensitive(outbuf); |
|---|
| 229 | 224 | return ret; |
|---|
| 230 | 225 | } |
|---|
| 231 | 226 | |
|---|
| .. | .. |
|---|
| 400 | 395 | out6: |
|---|
| 401 | 396 | kpp_request_free(req); |
|---|
| 402 | 397 | out5: |
|---|
| 403 | | - kzfree(outbuf); |
|---|
| 398 | + kfree_sensitive(outbuf); |
|---|
| 404 | 399 | out4: |
|---|
| 405 | 400 | crypto_free_kpp(tfm); |
|---|
| 406 | 401 | out3: |
|---|
| 407 | | - kzfree(secret); |
|---|
| 402 | + kfree_sensitive(secret); |
|---|
| 408 | 403 | out2: |
|---|
| 409 | 404 | dh_free_data(&dh_inputs); |
|---|
| 410 | 405 | out1: |
|---|