.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* Instantiate a public key crypto key from an X.509 Certificate |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. |
---|
4 | 5 | * 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. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #define pr_fmt(fmt) "X.509: "fmt |
---|
.. | .. |
---|
33 | 29 | int ret; |
---|
34 | 30 | |
---|
35 | 31 | pr_devel("==>%s()\n", __func__); |
---|
| 32 | + |
---|
| 33 | + sig->data = cert->tbs; |
---|
| 34 | + sig->data_size = cert->tbs_size; |
---|
36 | 35 | |
---|
37 | 36 | if (!cert->pub->pkey_algo) |
---|
38 | 37 | cert->unsupported_key = true; |
---|
.. | .. |
---|
77 | 76 | goto error; |
---|
78 | 77 | |
---|
79 | 78 | desc->tfm = tfm; |
---|
80 | | - desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
---|
81 | 79 | |
---|
82 | 80 | ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest); |
---|
83 | 81 | if (ret < 0) |
---|
.. | .. |
---|
134 | 132 | if (strcmp(cert->pub->pkey_algo, cert->sig->pkey_algo) != 0) |
---|
135 | 133 | goto out; |
---|
136 | 134 | |
---|
| 135 | + if (cert->unsupported_sig) { |
---|
| 136 | + ret = 0; |
---|
| 137 | + goto out; |
---|
| 138 | + } |
---|
| 139 | + |
---|
137 | 140 | ret = public_key_verify_signature(cert->pub, cert->sig); |
---|
138 | 141 | if (ret < 0) { |
---|
139 | 142 | if (ret == -ENOPKG) { |
---|