nimble/sm: Persist encryption key size Encryption key size is stored in persistent storage with encrpytion keys.
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/8f6e37fd Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8f6e37fd Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8f6e37fd Branch: refs/heads/develop Commit: 8f6e37fde2211b087b9f9a610f38053e1f49c817 Parents: 257381d Author: Andrzej Kaczmarek <[email protected]> Authored: Tue Nov 29 11:59:18 2016 +0100 Committer: Andrzej Kaczmarek <[email protected]> Committed: Wed Jan 4 14:14:24 2017 +0100 ---------------------------------------------------------------------- net/nimble/host/include/host/ble_store.h | 1 + net/nimble/host/src/ble_sm.c | 1 + net/nimble/host/src/ble_sm_priv.h | 1 + 3 files changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8f6e37fd/net/nimble/host/include/host/ble_store.h ---------------------------------------------------------------------- diff --git a/net/nimble/host/include/host/ble_store.h b/net/nimble/host/include/host/ble_store.h index d953bfc..71d8709 100644 --- a/net/nimble/host/include/host/ble_store.h +++ b/net/nimble/host/include/host/ble_store.h @@ -72,6 +72,7 @@ struct ble_store_value_sec { uint8_t peer_addr[6]; uint8_t peer_addr_type; + uint8_t key_size; uint16_t ediv; uint64_t rand_num; uint8_t ltk[16]; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8f6e37fd/net/nimble/host/src/ble_sm.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c index a49c3d2..dbdc7de 100644 --- a/net/nimble/host/src/ble_sm.c +++ b/net/nimble/host/src/ble_sm.c @@ -446,6 +446,7 @@ ble_sm_fill_store_value(uint8_t peer_addr_type, uint8_t *peer_addr, memcpy(value_sec->peer_addr, peer_addr, sizeof value_sec->peer_addr); if (keys->ediv_rand_valid && keys->ltk_valid) { + value_sec->key_size = keys->key_size; value_sec->ediv = keys->ediv; value_sec->rand_num = keys->rand_val; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8f6e37fd/net/nimble/host/src/ble_sm_priv.h ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_sm_priv.h b/net/nimble/host/src/ble_sm_priv.h index d75d475..3a6e2f7 100644 --- a/net/nimble/host/src/ble_sm_priv.h +++ b/net/nimble/host/src/ble_sm_priv.h @@ -242,6 +242,7 @@ struct ble_sm_keys { uint16_t ediv; uint64_t rand_val; uint8_t addr_type; + uint8_t key_size; uint8_t ltk[16]; /* Little endian. */ uint8_t irk[16]; /* Little endian. */ uint8_t csrk[16]; /* Little endian. */
