linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"Stotland, Inga" <inga.stotland@intel.com>
Subject: Re: [PATCH BlueZ] mesh: Add provisioner confirmation
Date: Wed, 16 Oct 2019 19:33:28 +0000	[thread overview]
Message-ID: <b0aecfc65f18e4cef1a2aeebd655d75bd7d6cd5e.camel@intel.com> (raw)
In-Reply-To: <20191014214758.13829-1-inga.stotland@intel.com>

Applied

On Mon, 2019-10-14 at 14:47 -0700, Inga Stotland wrote:
> This adds codes to send a confirmationfrom provisioner's side
> after receiving a callback from a provisioning agent.
> 
> ---
>  mesh/prov-initiator.c | 36 ++++++++++++++++++++----------------
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/mesh/prov-initiator.c b/mesh/prov-initiator.c
> index eb59f53f1..5e45d6813 100644
> --- a/mesh/prov-initiator.c
> +++ b/mesh/prov-initiator.c
> @@ -265,6 +265,18 @@ static void calc_local_material(const uint8_t *random)
>  	print_packet("Nonce", prov->s_nonce, sizeof(prov->s_nonce));
>  }
>  
> +static void send_confirm(struct mesh_prov_initiator *prov)
> +{
> +	struct prov_conf_msg msg;
> +
> +	msg.opcode = PROV_CONFIRM;
> +	mesh_crypto_aes_cmac(prov->calc_key, prov->rand_auth_workspace,
> +			32, msg.conf);
> +	prov->trans_tx(prov->trans_data, &msg, sizeof(msg));
> +	prov->state = INT_PROV_CONF_SENT;
> +	prov->expected = PROV_CONFIRM;
> +}
> +
>  static void number_cb(void *user_data, int err, uint32_t number)
>  {
>  	struct mesh_prov_initiator *rx_prov = user_data;
> @@ -284,6 +296,7 @@ static void number_cb(void *user_data, int err, uint32_t number)
>  	l_put_be32(number, prov->rand_auth_workspace + 28);
>  	l_put_be32(number, prov->rand_auth_workspace + 44);
>  	prov->material |= MAT_RAND_AUTH;
> +	send_confirm(prov);
>  }
>  
>  static void static_cb(void *user_data, int err, uint8_t *key, uint32_t len)
> @@ -304,6 +317,7 @@ static void static_cb(void *user_data, int err, uint8_t *key, uint32_t len)
>  	memcpy(prov->rand_auth_workspace + 16, key, 16);
>  	memcpy(prov->rand_auth_workspace + 32, key, 16);
>  	prov->material |= MAT_RAND_AUTH;
> +	send_confirm(prov);
>  }
>  
>  static void pub_key_cb(void *user_data, int err, uint8_t *key, uint32_t len)
> @@ -321,11 +335,13 @@ static void pub_key_cb(void *user_data, int err, uint8_t *key, uint32_t len)
>  		return;
>  	}
>  
> -		memcpy(prov->conf_inputs.dev_pub_key, key, 64);
> -		prov->material |= MAT_REMOTE_PUBLIC;
> +	memcpy(prov->conf_inputs.dev_pub_key, key, 64);
> +	prov->material |= MAT_REMOTE_PUBLIC;
>  
> -		if ((prov->material & MAT_SECRET) == MAT_SECRET)
> -			int_credentials(prov);
> +	if ((prov->material & MAT_SECRET) == MAT_SECRET)
> +		int_credentials(prov);
> +
> +	send_confirm(prov);
>  }
>  
>  static void send_pub_key(struct mesh_prov_initiator *prov)
> @@ -338,18 +354,6 @@ static void send_pub_key(struct mesh_prov_initiator *prov)
>  	prov->state = INT_PROV_KEY_SENT;
>  }
>  
> -static void send_confirm(struct mesh_prov_initiator *prov)
> -{
> -	struct prov_conf_msg msg;
> -
> -	msg.opcode = PROV_CONFIRM;
> -	mesh_crypto_aes_cmac(prov->calc_key, prov->rand_auth_workspace,
> -			32, msg.conf);
> -	prov->trans_tx(prov->trans_data, &msg, sizeof(msg));
> -	prov->state = INT_PROV_CONF_SENT;
> -	prov->expected = PROV_CONFIRM;
> -}
> -
>  static void send_random(struct mesh_prov_initiator *prov)
>  {
>  	struct prov_rand_msg msg;

      reply	other threads:[~2019-10-16 19:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 21:47 [PATCH BlueZ] mesh: Add provisioner confirmation Inga Stotland
2019-10-16 19:33 ` Gix, Brian [this message]

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=b0aecfc65f18e4cef1a2aeebd655d75bd7d6cd5e.camel@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).