[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7dMtDiL16JAXvTuTv3fOL5JNkMOCyjr6tVx44uDMKQxVnwqA@mail.gmail.com>
Date: Sun, 6 Oct 2024 19:32:47 -0700
From: Kevin Bowling <kevin.bowling@...009.com>
To: dhowells@...hat.com, keyrings@...r.kernel.org, jarkko@...nel.org
Cc: linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] KEYS: Print digitalSignature and CA link errors
Hi,
Hopefully this is pretty self explanatory, it just increases the
diagnostic capabilities of using the keyring erroneously. How do I
get someone to look at it?
Regards,
Kevin
On Thu, Aug 1, 2024 at 2:02 PM Kevin Bowling <kevin.bowling@...009.com> wrote:
>
> ENOKEY is overloaded for several different failure types in these link
> functions. In addition, by the time we are consuming the return several
> other methods can return ENOKEY. Add some error prints to help diagnose
> fundamental certificate issues.
>
> Cc: stable@...r.kernel.org
> Signed-off-by: Kevin Bowling <kevin.bowling@...009.com>
> ---
> crypto/asymmetric_keys/restrict.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/crypto/asymmetric_keys/restrict.c b/crypto/asymmetric_keys/restrict.c
> index afcd4d101ac5..472561e451b3 100644
> --- a/crypto/asymmetric_keys/restrict.c
> +++ b/crypto/asymmetric_keys/restrict.c
> @@ -140,14 +140,20 @@ int restrict_link_by_ca(struct key *dest_keyring,
> pkey = payload->data[asym_crypto];
> if (!pkey)
> return -ENOPKG;
> - if (!test_bit(KEY_EFLAG_CA, &pkey->key_eflags))
> + if (!test_bit(KEY_EFLAG_CA, &pkey->key_eflags)) {
> + pr_err("Missing CA usage bit\n");
> return -ENOKEY;
> - if (!test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags))
> + }
> + if (!test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags)) {
> + pr_err("Missing keyCertSign usage bit\n");
> return -ENOKEY;
> + }
> if (!IS_ENABLED(CONFIG_INTEGRITY_CA_MACHINE_KEYRING_MAX))
> return 0;
> - if (test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags))
> + if (test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) {
> + pr_err("Unexpected digitalSignature usage bit\n");
> return -ENOKEY;
> + }
>
> return 0;
> }
> @@ -183,14 +189,20 @@ int restrict_link_by_digsig(struct key *dest_keyring,
> if (!pkey)
> return -ENOPKG;
>
> - if (!test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags))
> + if (!test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) {
> + pr_err("Missing digitalSignature usage bit\n");
> return -ENOKEY;
> + }
>
> - if (test_bit(KEY_EFLAG_CA, &pkey->key_eflags))
> + if (test_bit(KEY_EFLAG_CA, &pkey->key_eflags)) {
> + pr_err("Unexpected CA usage bit\n");
> return -ENOKEY;
> + }
>
> - if (test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags))
> + if (test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags)) {
> + pr_err("Unexpected keyCertSign usage bit\n");
> return -ENOKEY;
> + }
>
> return restrict_link_by_signature(dest_keyring, type, payload,
> trust_keyring);
> --
> 2.46.0
>
Powered by blists - more mailing lists