Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org, szymon.janc@tieto.com
Subject: Re: [PATCH v2 01/12] shared/crypto: Extend bt_crypto_sign_att with sign counter
Date: Thu, 22 May 2014 13:28:58 +0300	[thread overview]
Message-ID: <20140522102858.GA7869@t440s.lan> (raw)
In-Reply-To: <1400746062-24766-2-git-send-email-lukasz.rymanowski@tieto.com>

Hi Lukasz,

On Thu, May 22, 2014, Lukasz Rymanowski wrote:
> Note: For testing purpose it is possible to provide sign counter
> less then 0.
<snip>
>  bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16],
>  					const uint8_t *m, uint16_t m_len,
> -					uint8_t signature[12])
> +					int32_t sign_cnt, uint8_t signature[12])
<snip>
> +	/* Add sign_counter to the message */
> +	if (sign_cnt >= 0)
> +		put_le32(sign_cnt, msg + msg_len);
> +	else
> +		msg_len = m_len;
<snip>
>  	/*
> +	 *  If there is sign counter available it should be placed in the
> +	 *  signature as specified in BT spec. 4.1 Vol[3], Part C,
> +	 *  chapter 10.4.1
> +	 */
> +	if (sign_cnt >= 0)
> +		put_le32(sign_cnt, out + 8);

Could you elaborate a bit on what exactly this "testing purpose" is and
why it really needs to be part of the API? I don't see anywhere in the
spec where it'd give us a choice of not having a counter available (I
might have missed it though).

Even if this is part of the API you're now restricting the range of
possible counter values to half of what the specification would allow,
i.e. the type should be int64_t with an added check that you don't allow
values beyond UINT32_MAX (however I'm unconvinced that this API should
have a signed parameter to begin with).

Johan

  reply	other threads:[~2014-05-22 10:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  8:07 [PATCH v2 00/12] android/gatt: Add support for write signature command Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 01/12] shared/crypto: Extend bt_crypto_sign_att with sign counter Lukasz Rymanowski
2014-05-22 10:28   ` Johan Hedberg [this message]
2014-05-22 10:59     ` Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 02/12] attrib: Add helpers to enc and dec signed write command Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 03/12] attrib/gatt: Add wrapper to send " Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 04/12] android/bluetooth: Expose API to get CSRK for device Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 05/12] android/bluetooth: Expose API to update sign counter Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 06/12] android/bluetooth: Add support to read CSRK from the kernel Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 07/12] android/bluetooth: Store CSRK Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 08/12] android/bluetooth: Read CSRK from the storage on startup Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 09/12] android/bluetooth: Store sign counter needed for aes-cmac sign Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 10/12] android/gatt: Add crypto needed for sign write Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 11/12] android/gatt: Add support for signed write command Lukasz Rymanowski
2014-05-22  8:07 ` [PATCH v2 12/12] android/gatt: Add handling signed write from remote device Lukasz Rymanowski

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=20140522102858.GA7869@t440s.lan \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lukasz.rymanowski@tieto.com \
    --cc=szymon.janc@tieto.com \
    /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