@@ -1911,24 +1911,21 @@ static int ble_secret_store_read(int obj_type, const union ble_store_key *key, u
1911
1911
// <type=peer,addr,*> (single)
1912
1912
// Find the entry for this specific peer.
1913
1913
assert (key -> sec .idx == 0 );
1914
- assert (!key -> sec .ediv_rand_present );
1915
1914
key_data = (const uint8_t * )& key -> sec .peer_addr ;
1916
1915
key_data_len = sizeof (ble_addr_t );
1917
1916
} else {
1918
1917
// <type=peer,*> (with index)
1919
1918
// Iterate all known peers.
1920
- assert (!key -> sec .ediv_rand_present );
1921
1919
key_data = NULL ;
1922
1920
key_data_len = 0 ;
1923
1921
}
1924
1922
break ;
1925
1923
}
1926
1924
case BLE_STORE_OBJ_TYPE_OUR_SEC : {
1927
- // <type=our,addr,ediv_rand >
1928
- // Find our secret for this remote device, matching this ediv/rand key .
1925
+ // <type=our,addr,* >
1926
+ // Find our secret for this remote device.
1929
1927
assert (ble_addr_cmp (& key -> sec .peer_addr , BLE_ADDR_ANY )); // Must have address.
1930
1928
assert (key -> sec .idx == 0 );
1931
- assert (key -> sec .ediv_rand_present );
1932
1929
key_data = (const uint8_t * )& key -> sec .peer_addr ;
1933
1930
key_data_len = sizeof (ble_addr_t );
1934
1931
break ;
@@ -1958,10 +1955,6 @@ static int ble_secret_store_read(int obj_type, const union ble_store_key *key, u
1958
1955
1959
1956
DEBUG_printf ("ble_secret_store_read: found secret\n" );
1960
1957
1961
- if (obj_type == BLE_STORE_OBJ_TYPE_OUR_SEC ) {
1962
- // TODO: Verify ediv_rand matches.
1963
- }
1964
-
1965
1958
return 0 ;
1966
1959
}
1967
1960
@@ -1970,14 +1963,13 @@ static int ble_secret_store_write(int obj_type, const union ble_store_value *val
1970
1963
switch (obj_type ) {
1971
1964
case BLE_STORE_OBJ_TYPE_PEER_SEC :
1972
1965
case BLE_STORE_OBJ_TYPE_OUR_SEC : {
1973
- // <type=peer,addr,edivrand >
1966
+ // <type=peer,addr,* >
1974
1967
1975
1968
struct ble_store_key_sec key_sec ;
1976
1969
const struct ble_store_value_sec * value_sec = & val -> sec ;
1977
1970
ble_store_key_from_value_sec (& key_sec , value_sec );
1978
1971
1979
1972
assert (ble_addr_cmp (& key_sec .peer_addr , BLE_ADDR_ANY )); // Must have address.
1980
- assert (key_sec .ediv_rand_present );
1981
1973
1982
1974
if (!mp_bluetooth_gap_on_set_secret (obj_type , (const uint8_t * )& key_sec .peer_addr , sizeof (ble_addr_t ), (const uint8_t * )value_sec , sizeof (struct ble_store_value_sec ))) {
1983
1975
DEBUG_printf ("Failed to write key: type=%d\n" , obj_type );
@@ -2005,9 +1997,7 @@ static int ble_secret_store_delete(int obj_type, const union ble_store_key *key)
2005
1997
case BLE_STORE_OBJ_TYPE_PEER_SEC :
2006
1998
case BLE_STORE_OBJ_TYPE_OUR_SEC : {
2007
1999
// <type=peer,addr,*>
2008
-
2009
2000
assert (ble_addr_cmp (& key -> sec .peer_addr , BLE_ADDR_ANY )); // Must have address.
2010
- // ediv_rand is optional (will not be present for delete).
2011
2001
2012
2002
if (!mp_bluetooth_gap_on_set_secret (obj_type , (const uint8_t * )& key -> sec .peer_addr , sizeof (ble_addr_t ), NULL , 0 )) {
2013
2003
DEBUG_printf ("Failed to delete key: type=%d\n" , obj_type );
0 commit comments