From: Denis Kenzior <denkenz at gmail.com>
To: iwd at lists.01.org
Subject: Re: [PATCH v4 06/10] dpp: add DPP authentication protocol
Date: Thu, 16 Dec 2021 14:42:50 -0600 [thread overview]
Message-ID: <0ddc36ad-487d-e3c0-e743-2f32b53d9492@gmail.com> (raw)
In-Reply-To: 20211216180854.39470-6-prestwoj@gmail.com
[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]
On 12/16/21 12:08, James Prestwood wrote:
> This implements the DPP protocol used to authenticate to a
> DPP configurator.
>
> Note this is not a full implementation of the protocol and
> there are a few missing features which will be added as
> needed:
>
> - Mutual authentication (needed for BLE bootstrapping)
> - Configurator support
> - Initiator role
> ---
> src/dpp.c | 571 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 571 insertions(+)
>
<snip>
> @@ -143,6 +179,34 @@ static void dpp_send_frame(uint64_t wdev_id, struct iovec *iov, size_t iov_len,
> l_error("Could not send CMD_FRAME");
> }
>
> +static uint8_t *dpp_unwrap_attr(enum dpp_frame_type type, const void *start,
> + const void *key, size_t key_len,
> + const uint8_t *wrapped, size_t wrapped_len,
> + size_t *unwrapped_len)
> +{
> + uint8_t ad0[] = { 0x50, 0x6f, 0x9a, 0x1a, 0x01, type };
> + struct iovec ad[2];
> + uint8_t *unwrapped;
> +
> + ad[0].iov_base = ad0;
> + ad[0].iov_len = sizeof(ad0);
> +
> + ad[1].iov_base = (void *)start;
> + ad[1].iov_len = ((wrapped - 4) - ((const uint8_t *)start));
Ok, but I think you may need a comment about this referencing the spec
explaining the AD data setup being used.
Also, why do you have 'wrapped' as a const uint8_t * and 'start' as a const void
*? Might be easier to make them both const void * and avoid this cast.
> +
> + unwrapped = l_malloc(wrapped_len - 16);
> +
> + if (!aes_siv_decrypt(key, key_len, wrapped, wrapped_len, ad, 2,
> + unwrapped)) {
> + l_free(unwrapped);
> + return NULL;
> + }
> +
> + *unwrapped_len = wrapped_len - 16;
> +
> + return unwrapped;
> +}
> +
> static size_t dpp_append_attr(uint8_t *to, enum dpp_attribute_type type,
> void *attr, size_t attr_len)
> {
Do you want to split out the protocol parsers / builders from dpp.c into
dpp-util or another file so they can be unit tested separately?
Regards,
-Denis
next reply other threads:[~2021-12-16 20:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 20:42 Denis Kenzior [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-12-16 18:08 [PATCH v4 06/10] dpp: add DPP authentication protocol James Prestwood
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=0ddc36ad-487d-e3c0-e743-2f32b53d9492@gmail.com \
--to=iwd@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