SecureStore: Add member initializers for inc_handle_t

_inc_set_handle is new'd in SecureStore::init(), then its members are
referenced in various functions without being explicitly initialized
first. These pre-existing values can confuse the SecureStore's internal
state and cause various undesired behavior.
pull/11810/head
Kyle Kearney 2019-11-04 14:49:57 -08:00
parent 18d4adf04f
commit db4dafc15a
1 changed files with 8 additions and 8 deletions

View File

@ -52,19 +52,19 @@ static const uint32_t security_flags = KVStore::REQUIRE_CONFIDENTIALITY_FLAG | K
namespace {
typedef struct {
uint16_t metadata_size;
uint16_t revision;
uint32_t data_size;
uint32_t create_flags;
uint8_t iv[iv_size];
uint16_t metadata_size = 0u;
uint16_t revision = 0u;
uint32_t data_size = 0u;
uint32_t create_flags = 0u;
uint8_t iv[iv_size] = { 0u };
} record_metadata_t;
// incremental set handle
typedef struct {
record_metadata_t metadata;
char *key;
uint32_t offset_in_data;
uint8_t ctr_buf[enc_block_size];
char *key = nullptr;
uint32_t offset_in_data = 0u;
uint8_t ctr_buf[enc_block_size] = { 0u };
mbedtls_aes_context enc_ctx;
mbedtls_cipher_context_t auth_ctx;
KVStore::set_handle_t underlying_handle;