From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Denis Kenzior <denkenz@gmail.com>
Cc: ell@lists.linux.dev
Subject: Re: [PATCH 4/9] tls: Support peer certificates that use ECDSA
Date: Mon, 18 Jul 2022 10:44:28 -0700 (PDT) [thread overview]
Message-ID: <b26fe3bf-fb39-65c-cdbc-784ee4cdb4a@linux.intel.com> (raw)
In-Reply-To: <20220718160222.10634-4-denkenz@gmail.com>
On Mon, 18 Jul 2022, Denis Kenzior wrote:
> ---
> ell/tls.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/ell/tls.c b/ell/tls.c
> index b2f7411f3b36..75b9d45c6523 100644
> --- a/ell/tls.c
> +++ b/ell/tls.c
> @@ -1899,6 +1899,8 @@ static void tls_handle_certificate(struct l_tls *tls,
> bool dummy;
> const char *error_str;
> char *subject_str;
> + enum l_key_cipher_type format_type;
> + enum l_checksum_type checksum_type;
>
> if (len < 3)
> goto decode_error;
> @@ -2028,9 +2030,23 @@ static void tls_handle_certificate(struct l_tls *tls,
> return;
> }
>
> - if (!l_key_get_info(tls->peer_pubkey, L_KEY_RSA_PKCS1_V1_5,
> - L_CHECKSUM_NONE, &tls->peer_pubkey_size,
> - &dummy)) {
> + switch (l_cert_get_pubkey_type(tls->peer_cert)) {
> + case L_CERT_KEY_RSA:
> + format_type = L_KEY_RSA_PKCS1_V1_5;
> + checksum_type = L_CHECKSUM_NONE;
> + break;
> + case L_CERT_KEY_ECC:
> + format_type = L_KEY_ECDSA_X962;
> + checksum_type = L_CHECKSUM_SHA1;
> + break;
> + case L_CERT_KEY_UNKNOWN:
Hi Denis,
I needed to add
default:
here to get it to build. Details below.
> + TLS_DISCONNECT(TLS_ALERT_INTERNAL_ERROR, 0,
> + "Unknown public key type");
> + return;
> + }
> +
> + if (!l_key_get_info(tls->peer_pubkey, format_type, checksum_type,
> + &tls->peer_pubkey_size, &dummy)) {
The ell (standalone, bootstrap-configure) build fails here with
gcc12/Fedora36:
ell/tls.c:2061:14: error: 'checksum_type' may be used uninitialized [-Werror=maybe-uninitialized]
ell/tls.c:2061:14: error: 'format_type' may be used uninitialized [-Werror=maybe-uninitialized]
Apparently gcc12 can't track that -Werror=switch-enum is in use in
combination with -Werror=maybe-uninitialized, and doesn't understand that
the switch statement above does guarantee initialization.
> TLS_DISCONNECT(TLS_ALERT_INTERNAL_ERROR, 0,
> "Can't l_key_get_info for peer public key");
>
> --
> 2.35.1
>
>
>
--
Mat Martineau
Intel
next prev parent reply other threads:[~2022-07-18 17:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 16:02 [PATCH 1/9] cert/key: Add support for EC based certificates Denis Kenzior
2022-07-18 16:02 ` [PATCH 2/9] unit: Add basic EC-DSA verification test Denis Kenzior
2022-07-18 16:02 ` [PATCH 3/9] key: ECDSA data is given in x962 format Denis Kenzior
2022-07-18 16:02 ` [PATCH 4/9] tls: Support peer certificates that use ECDSA Denis Kenzior
2022-07-18 17:44 ` Mat Martineau [this message]
2022-07-18 17:59 ` Denis Kenzior
2022-07-18 16:02 ` [PATCH 5/9] tls: Add helper for DigitallySigned validation Denis Kenzior
2022-07-18 16:02 ` [PATCH 6/9] tls: Add helper to find hash function by id Denis Kenzior
2022-07-18 16:02 ` [PATCH 7/9] tls-suites: Add ECDSA suites from RFC 8422 Denis Kenzior
2022-07-18 17:53 ` Mat Martineau
2022-07-18 16:02 ` [PATCH 8/9] useful: Add maxsize() Denis Kenzior
2022-07-18 16:02 ` [PATCH 9/9] tls: Do not set verify_data_length unless needed Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b26fe3bf-fb39-65c-cdbc-784ee4cdb4a@linux.intel.com \
--to=mathew.j.martineau@linux.intel.com \
--cc=denkenz@gmail.com \
--cc=ell@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox