| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Key-agreement Protocol Primitives (KPP) |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2016, Intel Corporation |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 12 | 7 | */ |
|---|
| 13 | 8 | |
|---|
| 14 | 9 | #ifndef _CRYPTO_KPP_ |
|---|
| .. | .. |
|---|
| 194 | 189 | */ |
|---|
| 195 | 190 | static inline void kpp_request_free(struct kpp_request *req) |
|---|
| 196 | 191 | { |
|---|
| 197 | | - kzfree(req); |
|---|
| 192 | + kfree_sensitive(req); |
|---|
| 198 | 193 | } |
|---|
| 199 | 194 | |
|---|
| 200 | 195 | /** |
|---|
| .. | .. |
|---|
| 289 | 284 | const void *buffer, unsigned int len) |
|---|
| 290 | 285 | { |
|---|
| 291 | 286 | struct kpp_alg *alg = crypto_kpp_alg(tfm); |
|---|
| 287 | + struct crypto_alg *calg = tfm->base.__crt_alg; |
|---|
| 288 | + int ret; |
|---|
| 292 | 289 | |
|---|
| 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; |
|---|
| 294 | 294 | } |
|---|
| 295 | 295 | |
|---|
| 296 | 296 | /** |
|---|
| .. | .. |
|---|
| 310 | 310 | { |
|---|
| 311 | 311 | struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); |
|---|
| 312 | 312 | struct kpp_alg *alg = crypto_kpp_alg(tfm); |
|---|
| 313 | + struct crypto_alg *calg = tfm->base.__crt_alg; |
|---|
| 314 | + int ret; |
|---|
| 313 | 315 | |
|---|
| 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; |
|---|
| 315 | 320 | } |
|---|
| 316 | 321 | |
|---|
| 317 | 322 | /** |
|---|
| .. | .. |
|---|
| 328 | 333 | { |
|---|
| 329 | 334 | struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); |
|---|
| 330 | 335 | struct kpp_alg *alg = crypto_kpp_alg(tfm); |
|---|
| 336 | + struct crypto_alg *calg = tfm->base.__crt_alg; |
|---|
| 337 | + int ret; |
|---|
| 331 | 338 | |
|---|
| 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; |
|---|
| 333 | 343 | } |
|---|
| 334 | 344 | |
|---|
| 335 | 345 | /** |
|---|