hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/crypto/asymmetric_keys/x509_public_key.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Instantiate a public key crypto key from an X.509 Certificate
23 *
34 * Copyright (C) 2012 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) "X.509: "fmt
....@@ -33,6 +29,9 @@
3329 int ret;
3430
3531 pr_devel("==>%s()\n", __func__);
32
+
33
+ sig->data = cert->tbs;
34
+ sig->data_size = cert->tbs_size;
3635
3736 if (!cert->pub->pkey_algo)
3837 cert->unsupported_key = true;
....@@ -77,7 +76,6 @@
7776 goto error;
7877
7978 desc->tfm = tfm;
80
- desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
8179
8280 ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest);
8381 if (ret < 0)
....@@ -134,6 +132,11 @@
134132 if (strcmp(cert->pub->pkey_algo, cert->sig->pkey_algo) != 0)
135133 goto out;
136134
135
+ if (cert->unsupported_sig) {
136
+ ret = 0;
137
+ goto out;
138
+ }
139
+
137140 ret = public_key_verify_signature(cert->pub, cert->sig);
138141 if (ret < 0) {
139142 if (ret == -ENOPKG) {