You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Greg Stein <gs...@gmail.com> on 2017/01/24 07:41:50 UTC

push more often (was: [01/50] incubator-mynewt-core git commit: ...)

commit 1 of 50 ??

This says to me: push more often. How can the mynewt community review your
work, if you never push it?

On Mon, Jan 23, 2017 at 9:02 PM, <st...@apache.org> wrote:

> Repository: incubator-mynewt-core
> Updated Branches:
>   refs/heads/sensors_branch 6247b5afa -> 2681044e8
>
>
> nimble/sm: Use TinyCrypt for AES
>
> TinyCrypt is smaller than mbedTLS and is already used for ECDH.
> Using TC for all crypto in SM results in following code size reductions
> for bletiny application:
>
> Legacy Pairing only from
> >     250     277 *fill*
> >   11160       0 crypto_mbedtls.a
> >   48581    3410 net_nimble_host.a
> >  144992    2784   15788  163564   27eec apps/bletiny/bletiny.elf
>
> to
> <     252     277 *fill*
> <    1112       0 crypto_tinycrypt.a
> <   48563    3130 net_nimble_host.a
> <  134928    2784   15508  153220   25684 app/apps/bletiny/bletiny.elf
>
> Legacy + LE SC from
> >     264     276 *fill*
> >   11160       0 crypto_mbedtls.a
> >   51881    3627 net_nimble_host.a
> >  152272    2980   16004  171256   29cf8 app/apps/bletiny/bletiny.elf
>
> to
> <     254     276 *fill*
> <   51863    3347 net_nimble_host.a
> <  141084    2980   15724  159788   2702c app/apps/bletiny/bletiny.elf
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
> Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> core/commit/2785cad5
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> core/tree/2785cad5
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> core/diff/2785cad5
>
> Branch: refs/heads/sensors_branch
> Commit: 2785cad50147160d21bef9aef143199f294ed093
> Parents: a46fdfe
> Author: Szymon Janc <sz...@codecoup.pl>
> Authored: Wed Jan 18 14:24:44 2017 +0100
> Committer: Szymon Janc <sz...@codecoup.pl>
> Committed: Wed Jan 18 14:54:44 2017 +0100
>
> ----------------------------------------------------------------------
>  net/nimble/host/pkg.yml          |  2 +-
>  net/nimble/host/src/ble_sm_alg.c | 21 +++++++--------------
>  2 files changed, 8 insertions(+), 15 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> core/blob/2785cad5/net/nimble/host/pkg.yml
> ----------------------------------------------------------------------
> diff --git a/net/nimble/host/pkg.yml b/net/nimble/host/pkg.yml
> index f7539a4..d025934 100644
> --- a/net/nimble/host/pkg.yml
> +++ b/net/nimble/host/pkg.yml
> @@ -31,7 +31,7 @@ pkg.deps:
>      - util/mem
>
>  pkg.deps.BLE_SM_LEGACY:
> -    - crypto/mbedtls
> +    - crypto/tinycrypt
>
>  pkg.deps.BLE_SM_SC:
>      - crypto/tinycrypt
>
> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> core/blob/2785cad5/net/nimble/host/src/ble_sm_alg.c
> ----------------------------------------------------------------------
> diff --git a/net/nimble/host/src/ble_sm_alg.c
> b/net/nimble/host/src/ble_sm_alg.c
> index 8a5365d..f8208b4 100644
> --- a/net/nimble/host/src/ble_sm_alg.c
> +++ b/net/nimble/host/src/ble_sm_alg.c
> @@ -28,20 +28,15 @@
>  #include "nimble/ble.h"
>  #include "nimble/nimble_opt.h"
>  #include "ble_hs_priv.h"
> -#include "mbedtls/aes.h"
> -
> -#if MYNEWT_VAL(BLE_SM_SC)
> -
>  #include "tinycrypt/aes.h"
>  #include "tinycrypt/constants.h"
>  #include "tinycrypt/utils.h"
> +
> +#if MYNEWT_VAL(BLE_SM_SC)
>  #include "tinycrypt/cmac_mode.h"
>  #include "tinycrypt/ecc_dh.h"
> -
>  #endif
>
> -static mbedtls_aes_context ble_sm_alg_ctxt;
> -
>  static void
>  ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>  {
> @@ -55,22 +50,20 @@ ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>  static int
>  ble_sm_alg_encrypt(uint8_t *key, uint8_t *plaintext, uint8_t *enc_data)
>  {
> -    mbedtls_aes_init(&ble_sm_alg_ctxt);
> +    struct tc_aes_key_sched_struct s;
>      uint8_t tmp[16];
> -    int rc;
>
>      swap_buf(tmp, key, 16);
>
> -    rc = mbedtls_aes_setkey_enc(&ble_sm_alg_ctxt, tmp, 128);
> -    if (rc != 0) {
> +    if (tc_aes128_set_encrypt_key(&s, tmp) == TC_CRYPTO_FAIL) {
>          return BLE_HS_EUNKNOWN;
>      }
>
>      swap_buf(tmp, plaintext, 16);
>
> -    rc = mbedtls_aes_crypt_ecb(&ble_sm_alg_ctxt, MBEDTLS_AES_ENCRYPT,
> -                               tmp, enc_data);
> -    if (rc != 0) {
> +
> +
> +    if (tc_aes_encrypt(enc_data, tmp, &s) == TC_CRYPTO_FAIL) {
>          return BLE_HS_EUNKNOWN;
>      }
>
>
>

Re: push more often (was: [01/50] incubator-mynewt-core git commit: ...)

Posted by Christopher Collins <cc...@apache.org>.
Those commits were made to a different branch:

> >>> Repository: incubator-mynewt-core
> >>> Updated Branches:
> >>>  refs/heads/sensors_branch 6247b5afa -> 2681044e8

That mass of commits was just a big merge from develop to
sensors_branch.  Sterling was just bringing sensors_branch up to date
with develop.

I've also been confused by git commit emails sometimes.  You have to
double check the branch name!

Chris

On Tue, Jan 24, 2017 at 04:02:40PM +0000, Wayne Keenan wrote:
> 
> 
> > On 24 Jan 2017, at 15:56, Peter Saint-Andre - Filament <pe...@filament.com> wrote:
> > 
> > Things seem pretty transparent around here to me!
> > 
> 
> I'd say so, and I'd trust Sterling's commits, but,  'Review Harder', if you like :)
> 
> >> On 1/24/17 12:41 AM, Greg Stein wrote:
> >> commit 1 of 50 ??
> >> 
> >> This says to me: push more often. How can the mynewt community review your
> >> work, if you never push it?
> >> 
> >>> On Mon, Jan 23, 2017 at 9:02 PM, <st...@apache.org> wrote:
> >>> 
> >>> Repository: incubator-mynewt-core
> >>> Updated Branches:
> >>>  refs/heads/sensors_branch 6247b5afa -> 2681044e8
> >>> 
> >>> 
> >>> nimble/sm: Use TinyCrypt for AES
> >>> 
> >>> TinyCrypt is smaller than mbedTLS and is already used for ECDH.
> >>> Using TC for all crypto in SM results in following code size reductions
> >>> for bletiny application:
> >>> 
> >>> Legacy Pairing only from
> >>>>    250     277 *fill*
> >>>>  11160       0 crypto_mbedtls.a
> >>>>  48581    3410 net_nimble_host.a
> >>>> 144992    2784   15788  163564   27eec apps/bletiny/bletiny.elf
> >>> 
> >>> to
> >>> <     252     277 *fill*
> >>> <    1112       0 crypto_tinycrypt.a
> >>> <   48563    3130 net_nimble_host.a
> >>> <  134928    2784   15508  153220   25684 app/apps/bletiny/bletiny.elf
> >>> 
> >>> Legacy + LE SC from
> >>>>    264     276 *fill*
> >>>>  11160       0 crypto_mbedtls.a
> >>>>  51881    3627 net_nimble_host.a
> >>>> 152272    2980   16004  171256   29cf8 app/apps/bletiny/bletiny.elf
> >>> 
> >>> to
> >>> <     254     276 *fill*
> >>> <   51863    3347 net_nimble_host.a
> >>> <  141084    2980   15724  159788   2702c app/apps/bletiny/bletiny.elf
> >>> 
> >>> 
> >>> Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
> >>> Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> >>> core/commit/2785cad5
> >>> Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> >>> core/tree/2785cad5
> >>> Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> >>> core/diff/2785cad5
> >>> 
> >>> Branch: refs/heads/sensors_branch
> >>> Commit: 2785cad50147160d21bef9aef143199f294ed093
> >>> Parents: a46fdfe
> >>> Author: Szymon Janc <sz...@codecoup.pl>
> >>> Authored: Wed Jan 18 14:24:44 2017 +0100
> >>> Committer: Szymon Janc <sz...@codecoup.pl>
> >>> Committed: Wed Jan 18 14:54:44 2017 +0100
> >>> 
> >>> ----------------------------------------------------------------------
> >>> net/nimble/host/pkg.yml          |  2 +-
> >>> net/nimble/host/src/ble_sm_alg.c | 21 +++++++--------------
> >>> 2 files changed, 8 insertions(+), 15 deletions(-)
> >>> ----------------------------------------------------------------------
> >>> 
> >>> 
> >>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> >>> core/blob/2785cad5/net/nimble/host/pkg.yml
> >>> ----------------------------------------------------------------------
> >>> diff --git a/net/nimble/host/pkg.yml b/net/nimble/host/pkg.yml
> >>> index f7539a4..d025934 100644
> >>> --- a/net/nimble/host/pkg.yml
> >>> +++ b/net/nimble/host/pkg.yml
> >>> @@ -31,7 +31,7 @@ pkg.deps:
> >>>     - util/mem
> >>> 
> >>> pkg.deps.BLE_SM_LEGACY:
> >>> -    - crypto/mbedtls
> >>> +    - crypto/tinycrypt
> >>> 
> >>> pkg.deps.BLE_SM_SC:
> >>>     - crypto/tinycrypt
> >>> 
> >>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
> >>> core/blob/2785cad5/net/nimble/host/src/ble_sm_alg.c
> >>> ----------------------------------------------------------------------
> >>> diff --git a/net/nimble/host/src/ble_sm_alg.c
> >>> b/net/nimble/host/src/ble_sm_alg.c
> >>> index 8a5365d..f8208b4 100644
> >>> --- a/net/nimble/host/src/ble_sm_alg.c
> >>> +++ b/net/nimble/host/src/ble_sm_alg.c
> >>> @@ -28,20 +28,15 @@
> >>> #include "nimble/ble.h"
> >>> #include "nimble/nimble_opt.h"
> >>> #include "ble_hs_priv.h"
> >>> -#include "mbedtls/aes.h"
> >>> -
> >>> -#if MYNEWT_VAL(BLE_SM_SC)
> >>> -
> >>> #include "tinycrypt/aes.h"
> >>> #include "tinycrypt/constants.h"
> >>> #include "tinycrypt/utils.h"
> >>> +
> >>> +#if MYNEWT_VAL(BLE_SM_SC)
> >>> #include "tinycrypt/cmac_mode.h"
> >>> #include "tinycrypt/ecc_dh.h"
> >>> -
> >>> #endif
> >>> 
> >>> -static mbedtls_aes_context ble_sm_alg_ctxt;
> >>> -
> >>> static void
> >>> ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
> >>> {
> >>> @@ -55,22 +50,20 @@ ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
> >>> static int
> >>> ble_sm_alg_encrypt(uint8_t *key, uint8_t *plaintext, uint8_t *enc_data)
> >>> {
> >>> -    mbedtls_aes_init(&ble_sm_alg_ctxt);
> >>> +    struct tc_aes_key_sched_struct s;
> >>>     uint8_t tmp[16];
> >>> -    int rc;
> >>> 
> >>>     swap_buf(tmp, key, 16);
> >>> 
> >>> -    rc = mbedtls_aes_setkey_enc(&ble_sm_alg_ctxt, tmp, 128);
> >>> -    if (rc != 0) {
> >>> +    if (tc_aes128_set_encrypt_key(&s, tmp) == TC_CRYPTO_FAIL) {
> >>>         return BLE_HS_EUNKNOWN;
> >>>     }
> >>> 
> >>>     swap_buf(tmp, plaintext, 16);
> >>> 
> >>> -    rc = mbedtls_aes_crypt_ecb(&ble_sm_alg_ctxt, MBEDTLS_AES_ENCRYPT,
> >>> -                               tmp, enc_data);
> >>> -    if (rc != 0) {
> >>> +
> >>> +
> >>> +    if (tc_aes_encrypt(enc_data, tmp, &s) == TC_CRYPTO_FAIL) {
> >>>         return BLE_HS_EUNKNOWN;
> >>>     }
> >>> 
> >>> 
> >>> 

Re: push more often (was: [01/50] incubator-mynewt-core git commit: ...)

Posted by Wayne Keenan <wa...@gmail.com>.

> On 24 Jan 2017, at 15:56, Peter Saint-Andre - Filament <pe...@filament.com> wrote:
> 
> Things seem pretty transparent around here to me!
> 

I'd say so, and I'd trust Sterling's commits, but,  'Review Harder', if you like :)

>> On 1/24/17 12:41 AM, Greg Stein wrote:
>> commit 1 of 50 ??
>> 
>> This says to me: push more often. How can the mynewt community review your
>> work, if you never push it?
>> 
>>> On Mon, Jan 23, 2017 at 9:02 PM, <st...@apache.org> wrote:
>>> 
>>> Repository: incubator-mynewt-core
>>> Updated Branches:
>>>  refs/heads/sensors_branch 6247b5afa -> 2681044e8
>>> 
>>> 
>>> nimble/sm: Use TinyCrypt for AES
>>> 
>>> TinyCrypt is smaller than mbedTLS and is already used for ECDH.
>>> Using TC for all crypto in SM results in following code size reductions
>>> for bletiny application:
>>> 
>>> Legacy Pairing only from
>>>>    250     277 *fill*
>>>>  11160       0 crypto_mbedtls.a
>>>>  48581    3410 net_nimble_host.a
>>>> 144992    2784   15788  163564   27eec apps/bletiny/bletiny.elf
>>> 
>>> to
>>> <     252     277 *fill*
>>> <    1112       0 crypto_tinycrypt.a
>>> <   48563    3130 net_nimble_host.a
>>> <  134928    2784   15508  153220   25684 app/apps/bletiny/bletiny.elf
>>> 
>>> Legacy + LE SC from
>>>>    264     276 *fill*
>>>>  11160       0 crypto_mbedtls.a
>>>>  51881    3627 net_nimble_host.a
>>>> 152272    2980   16004  171256   29cf8 app/apps/bletiny/bletiny.elf
>>> 
>>> to
>>> <     254     276 *fill*
>>> <   51863    3347 net_nimble_host.a
>>> <  141084    2980   15724  159788   2702c app/apps/bletiny/bletiny.elf
>>> 
>>> 
>>> Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>>> core/commit/2785cad5
>>> Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>>> core/tree/2785cad5
>>> Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>>> core/diff/2785cad5
>>> 
>>> Branch: refs/heads/sensors_branch
>>> Commit: 2785cad50147160d21bef9aef143199f294ed093
>>> Parents: a46fdfe
>>> Author: Szymon Janc <sz...@codecoup.pl>
>>> Authored: Wed Jan 18 14:24:44 2017 +0100
>>> Committer: Szymon Janc <sz...@codecoup.pl>
>>> Committed: Wed Jan 18 14:54:44 2017 +0100
>>> 
>>> ----------------------------------------------------------------------
>>> net/nimble/host/pkg.yml          |  2 +-
>>> net/nimble/host/src/ble_sm_alg.c | 21 +++++++--------------
>>> 2 files changed, 8 insertions(+), 15 deletions(-)
>>> ----------------------------------------------------------------------
>>> 
>>> 
>>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>>> core/blob/2785cad5/net/nimble/host/pkg.yml
>>> ----------------------------------------------------------------------
>>> diff --git a/net/nimble/host/pkg.yml b/net/nimble/host/pkg.yml
>>> index f7539a4..d025934 100644
>>> --- a/net/nimble/host/pkg.yml
>>> +++ b/net/nimble/host/pkg.yml
>>> @@ -31,7 +31,7 @@ pkg.deps:
>>>     - util/mem
>>> 
>>> pkg.deps.BLE_SM_LEGACY:
>>> -    - crypto/mbedtls
>>> +    - crypto/tinycrypt
>>> 
>>> pkg.deps.BLE_SM_SC:
>>>     - crypto/tinycrypt
>>> 
>>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>>> core/blob/2785cad5/net/nimble/host/src/ble_sm_alg.c
>>> ----------------------------------------------------------------------
>>> diff --git a/net/nimble/host/src/ble_sm_alg.c
>>> b/net/nimble/host/src/ble_sm_alg.c
>>> index 8a5365d..f8208b4 100644
>>> --- a/net/nimble/host/src/ble_sm_alg.c
>>> +++ b/net/nimble/host/src/ble_sm_alg.c
>>> @@ -28,20 +28,15 @@
>>> #include "nimble/ble.h"
>>> #include "nimble/nimble_opt.h"
>>> #include "ble_hs_priv.h"
>>> -#include "mbedtls/aes.h"
>>> -
>>> -#if MYNEWT_VAL(BLE_SM_SC)
>>> -
>>> #include "tinycrypt/aes.h"
>>> #include "tinycrypt/constants.h"
>>> #include "tinycrypt/utils.h"
>>> +
>>> +#if MYNEWT_VAL(BLE_SM_SC)
>>> #include "tinycrypt/cmac_mode.h"
>>> #include "tinycrypt/ecc_dh.h"
>>> -
>>> #endif
>>> 
>>> -static mbedtls_aes_context ble_sm_alg_ctxt;
>>> -
>>> static void
>>> ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>>> {
>>> @@ -55,22 +50,20 @@ ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>>> static int
>>> ble_sm_alg_encrypt(uint8_t *key, uint8_t *plaintext, uint8_t *enc_data)
>>> {
>>> -    mbedtls_aes_init(&ble_sm_alg_ctxt);
>>> +    struct tc_aes_key_sched_struct s;
>>>     uint8_t tmp[16];
>>> -    int rc;
>>> 
>>>     swap_buf(tmp, key, 16);
>>> 
>>> -    rc = mbedtls_aes_setkey_enc(&ble_sm_alg_ctxt, tmp, 128);
>>> -    if (rc != 0) {
>>> +    if (tc_aes128_set_encrypt_key(&s, tmp) == TC_CRYPTO_FAIL) {
>>>         return BLE_HS_EUNKNOWN;
>>>     }
>>> 
>>>     swap_buf(tmp, plaintext, 16);
>>> 
>>> -    rc = mbedtls_aes_crypt_ecb(&ble_sm_alg_ctxt, MBEDTLS_AES_ENCRYPT,
>>> -                               tmp, enc_data);
>>> -    if (rc != 0) {
>>> +
>>> +
>>> +    if (tc_aes_encrypt(enc_data, tmp, &s) == TC_CRYPTO_FAIL) {
>>>         return BLE_HS_EUNKNOWN;
>>>     }
>>> 
>>> 
>>> 

Re: push more often (was: [01/50] incubator-mynewt-core git commit: ...)

Posted by Peter Saint-Andre - Filament <pe...@filament.com>.
Things seem pretty transparent around here to me!

On 1/24/17 12:41 AM, Greg Stein wrote:
> commit 1 of 50 ??
>
> This says to me: push more often. How can the mynewt community review your
> work, if you never push it?
>
> On Mon, Jan 23, 2017 at 9:02 PM, <st...@apache.org> wrote:
>
>> Repository: incubator-mynewt-core
>> Updated Branches:
>>   refs/heads/sensors_branch 6247b5afa -> 2681044e8
>>
>>
>> nimble/sm: Use TinyCrypt for AES
>>
>> TinyCrypt is smaller than mbedTLS and is already used for ECDH.
>> Using TC for all crypto in SM results in following code size reductions
>> for bletiny application:
>>
>> Legacy Pairing only from
>>>     250     277 *fill*
>>>   11160       0 crypto_mbedtls.a
>>>   48581    3410 net_nimble_host.a
>>>  144992    2784   15788  163564   27eec apps/bletiny/bletiny.elf
>>
>> to
>> <     252     277 *fill*
>> <    1112       0 crypto_tinycrypt.a
>> <   48563    3130 net_nimble_host.a
>> <  134928    2784   15508  153220   25684 app/apps/bletiny/bletiny.elf
>>
>> Legacy + LE SC from
>>>     264     276 *fill*
>>>   11160       0 crypto_mbedtls.a
>>>   51881    3627 net_nimble_host.a
>>>  152272    2980   16004  171256   29cf8 app/apps/bletiny/bletiny.elf
>>
>> to
>> <     254     276 *fill*
>> <   51863    3347 net_nimble_host.a
>> <  141084    2980   15724  159788   2702c app/apps/bletiny/bletiny.elf
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>> core/commit/2785cad5
>> Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>> core/tree/2785cad5
>> Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>> core/diff/2785cad5
>>
>> Branch: refs/heads/sensors_branch
>> Commit: 2785cad50147160d21bef9aef143199f294ed093
>> Parents: a46fdfe
>> Author: Szymon Janc <sz...@codecoup.pl>
>> Authored: Wed Jan 18 14:24:44 2017 +0100
>> Committer: Szymon Janc <sz...@codecoup.pl>
>> Committed: Wed Jan 18 14:54:44 2017 +0100
>>
>> ----------------------------------------------------------------------
>>  net/nimble/host/pkg.yml          |  2 +-
>>  net/nimble/host/src/ble_sm_alg.c | 21 +++++++--------------
>>  2 files changed, 8 insertions(+), 15 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>> core/blob/2785cad5/net/nimble/host/pkg.yml
>> ----------------------------------------------------------------------
>> diff --git a/net/nimble/host/pkg.yml b/net/nimble/host/pkg.yml
>> index f7539a4..d025934 100644
>> --- a/net/nimble/host/pkg.yml
>> +++ b/net/nimble/host/pkg.yml
>> @@ -31,7 +31,7 @@ pkg.deps:
>>      - util/mem
>>
>>  pkg.deps.BLE_SM_LEGACY:
>> -    - crypto/mbedtls
>> +    - crypto/tinycrypt
>>
>>  pkg.deps.BLE_SM_SC:
>>      - crypto/tinycrypt
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-
>> core/blob/2785cad5/net/nimble/host/src/ble_sm_alg.c
>> ----------------------------------------------------------------------
>> diff --git a/net/nimble/host/src/ble_sm_alg.c
>> b/net/nimble/host/src/ble_sm_alg.c
>> index 8a5365d..f8208b4 100644
>> --- a/net/nimble/host/src/ble_sm_alg.c
>> +++ b/net/nimble/host/src/ble_sm_alg.c
>> @@ -28,20 +28,15 @@
>>  #include "nimble/ble.h"
>>  #include "nimble/nimble_opt.h"
>>  #include "ble_hs_priv.h"
>> -#include "mbedtls/aes.h"
>> -
>> -#if MYNEWT_VAL(BLE_SM_SC)
>> -
>>  #include "tinycrypt/aes.h"
>>  #include "tinycrypt/constants.h"
>>  #include "tinycrypt/utils.h"
>> +
>> +#if MYNEWT_VAL(BLE_SM_SC)
>>  #include "tinycrypt/cmac_mode.h"
>>  #include "tinycrypt/ecc_dh.h"
>> -
>>  #endif
>>
>> -static mbedtls_aes_context ble_sm_alg_ctxt;
>> -
>>  static void
>>  ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>>  {
>> @@ -55,22 +50,20 @@ ble_sm_alg_xor_128(uint8_t *p, uint8_t *q, uint8_t *r)
>>  static int
>>  ble_sm_alg_encrypt(uint8_t *key, uint8_t *plaintext, uint8_t *enc_data)
>>  {
>> -    mbedtls_aes_init(&ble_sm_alg_ctxt);
>> +    struct tc_aes_key_sched_struct s;
>>      uint8_t tmp[16];
>> -    int rc;
>>
>>      swap_buf(tmp, key, 16);
>>
>> -    rc = mbedtls_aes_setkey_enc(&ble_sm_alg_ctxt, tmp, 128);
>> -    if (rc != 0) {
>> +    if (tc_aes128_set_encrypt_key(&s, tmp) == TC_CRYPTO_FAIL) {
>>          return BLE_HS_EUNKNOWN;
>>      }
>>
>>      swap_buf(tmp, plaintext, 16);
>>
>> -    rc = mbedtls_aes_crypt_ecb(&ble_sm_alg_ctxt, MBEDTLS_AES_ENCRYPT,
>> -                               tmp, enc_data);
>> -    if (rc != 0) {
>> +
>> +
>> +    if (tc_aes_encrypt(enc_data, tmp, &s) == TC_CRYPTO_FAIL) {
>>          return BLE_HS_EUNKNOWN;
>>      }
>>
>>
>>

Re: push more often (was: [01/50] incubator-mynewt-core git commit: ...)

Posted by "David G. Simmons" <sa...@mac.com>.
I'm about the last person to ask about git, as it's still black magic to me, but

$ git pull --rebase origin develop


is what I use all the time after checking out a branch. This has the effect of pulling in the latest develop branch, and replaying your changes on top of it.

dg

> On Jan 24, 2017, at 11:23 AM, Sterling Hughes <st...@gmail.com> wrote:
> 
> 
> $ git checkout <my-branch>
> $ git pull origin develop

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: push more often (was: [01/50] incubator-mynewt-core git commit: ...)

Posted by Sterling Hughes <st...@gmail.com>.
On 23 Jan 2017, at 23:41, Greg Stein wrote:

> commit 1 of 50 ??
>
> This says to me: push more often. How can the mynewt community review 
> your
> work, if you never push it?
>

:-) as pointed out, it\u2019s bringing the sensors_branch up to date: Vipul 
has started working on it, and I brought it up to develop so he 
wouldn\u2019t have to learn a new code base, and all the changes in develop 
simultaneously.   I\u2019ve been working on a long running branch, as I 
don\u2019t want this to make rel, but rather after-rel.

That said, I\u2019d like to use this opportunity to ask for remedial git 
lessons. :-)   I have found that when I merge from develop->my_branch, I 
often see merge conflicts in files I haven\u2019t even touched.  I go 
through, like a good git monkey and manually resolve the conflicts, but 
it makes me feel like I\u2019m doing something wrong.  As an example, this 
time I had a ton of merge conflicts in OIC and CBOR: neither of which 
I\u2019d touched on my branch.

When I merge, I often do either:

$ git checkout <my-branch>
$ git fetch origin develop
$ git merge

Or

$ git checkout <my-branch>
$ git pull origin develop

Then resolve conflicts.

Is this right?  What should I do when I see a whole bunch of merge 
conflicts in files I haven\u2019t touched?

Sterling