forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/crypto/asymmetric_keys/verify_pefile.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Parse a signed PE binary
23 *
34 * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
45 * Written by David Howells (dhowells@redhat.com)
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public Licence
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the Licence, or (at your option) any later version.
106 */
117
128 #define pr_fmt(fmt) "PEFILE: "fmt
....@@ -100,7 +96,7 @@
10096
10197 if (!ddir->certs.virtual_address || !ddir->certs.size) {
10298 pr_debug("Unsigned PE binary\n");
103
- return -EKEYREJECTED;
99
+ return -ENODATA;
104100 }
105101
106102 chkaddr(ctx->header_size, ddir->certs.virtual_address,
....@@ -354,7 +350,6 @@
354350 goto error_no_desc;
355351
356352 desc->tfm = tfm;
357
- desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
358353 ret = crypto_shash_init(desc);
359354 if (ret < 0)
360355 goto error;
....@@ -381,7 +376,7 @@
381376 }
382377
383378 error:
384
- kzfree(desc);
379
+ kfree_sensitive(desc);
385380 error_no_desc:
386381 crypto_free_shash(tfm);
387382 kleave(" = %d", ret);
....@@ -407,6 +402,8 @@
407402 *
408403 * (*) 0 if at least one signature chain intersects with the keys in the trust
409404 * keyring, or:
405
+ *
406
+ * (*) -ENODATA if there is no signature present.
410407 *
411408 * (*) -ENOPKG if a suitable crypto module couldn't be found for a check on a
412409 * chain.
....@@ -450,6 +447,6 @@
450447 ret = pefile_digest_pe(pebuf, pelen, &ctx);
451448
452449 error:
453
- kzfree(ctx.digest);
450
+ kfree_sensitive(ctx.digest);
454451 return ret;
455452 }