Skip to content

Commit 468ee97

Browse files
harrisonmutai-armLDong-Arm
authored andcommitted
Deprecate TDB_EXTERNAL_NO_RBP and FILESYSTEM_NO_RBP in kv_config
NO_RBP (no rollback protection) is intended to not require an internal TDB, however, DeviceKey, which we use to derive SecureStore's encryption key, still does. Currently, no internal TDB is created with these two configurations, meaning there's no way to store the DeviceKey and SecureStore doesn't work.
1 parent 125f584 commit 468ee97

File tree

5 files changed

+16
-119
lines changed

5 files changed

+16
-119
lines changed

storage/docs/Configuration/CONFIGURATION.md

Lines changed: 1 addition & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@ kvstore
2727
├───tdb_external
2828
│ mbed_lib.json
2929
30-
├───tdb_external_no_rbp
31-
│ mbed_lib.json
32-
3330
├───filesystem
3431
│ mbed_lib.json
3532
36-
├───filesystem_no_rbp
37-
│ mbed_lib.json
38-
3933
└───tdb_internal
4034
mbed_lib.json
4135
```
@@ -46,9 +40,7 @@ You can find the configuration files `conf/<configuration name>`:
4640

4741
* `conf/tdb_internal` - storage type `TDB_INTERNAL` configuration is intended to be used when all data will be stored in internal memory only. No need for additional security features. A single TDBStore object will be allocated in internal flash.
4842
* `conf/tdb_external` - storage type `TDB_EXTERNAL` configuration is providing full security and intended to be used when data is stored in external flash. It allocates: SecureStore, TDBStore in external flash and TDBStore in internal flash (for rollback protection - RBP).
49-
* `conf/tdb_external_no_rbp` - storage type `TDB_EXTERNAL_NO_RBP` configuration allows security but without rollback protection. Similar to `tdb_external` but without the TDBStore in internal memory.
5043
* `conf/filesystem` - This configuration will allocate: SecureStore, FileSystemStore, filesystem, TDBStore in internal memory and the required block devices. The allocated file system will be selected according to the COMPONENT set in `targets.json`, (FATFS for SD card and LittleFS for SPIF); however, you can set this differently by overriding the respective parameter. Use this configuration if you need the file system with a POSIX API in addition to the set/get API.
51-
* `conf/filesystem_no_rbp` - storage type `FILESYSTEM_NO_RBP` configuration allows security like FILESYSTEM configuration but without rollback protection.
5244

5345
A standalone block device is allocated for each component in internal and external memory and SD cards as required for the configurations. The full size of the memory allocated for each block device is used by the respective component.
5446

@@ -59,9 +51,7 @@ The following is a list of all storage parameters available and their descriptio
5951
* `storage_type` - Used to select one of the predefined configurations.
6052
* `TDB_INTERNAL`.
6153
* `TDB_EXTERNAL`.
62-
* `TDB_EXTERNAL_NO_RBP`.
6354
* `FILESYSTEM`.
64-
* `FILESYSTEM_NO_RBP`.
6555
* `default`
6656
If the `default` configuration is set, the system will choose the type of storage TDB_INTERNAL.
6757
* `default_kv` - This is a string representing the path for the default KVStore instantiation. Applications can pass an empty path (only the key name) or pass the generated name for this parameter (`MBED_CONF_STORAGE_DEFAULT_KV`) as the path to use this configuration.
@@ -85,7 +75,7 @@ Below is the main storage configuration `mbed_lib.json` file:
8575
"name": "storage",
8676
"config": {
8777
"storage_type": {
88-
"help": "Options are TDB_INTERNAL, TDB_EXTERNAL, TDB_EXTERNAL_NO_RBP, FILESYSTEM, FILESYSTEM_NO_RBP or default. If default, the storage type will be chosen according to the component defined in targets.json",
78+
"help": "Options are TDB_INTERNAL, TDB_EXTERNAL, FILESYSTEM, or default. If default, the storage type will be chosen according to the component defined in targets.json",
8979
"value": "NULL"
9080
},
9181
"default_kv": {
@@ -172,39 +162,6 @@ Below is the `TDB_EXTERNAL` configuration `mbed_lib.json`:
172162
}
173163
}
174164
```
175-
176-
### TDB_External_no_RBP
177-
178-
![External](./TDB_External_no_rbp.jpg)
179-
180-
`TDB_EXTERNAL_NO_RBF` configuration has no support for rollback protection and is therefore less secure.
181-
182-
The `TDB_EXTERNAL_NO_RBP` uses only one TDBStore on the external flash for all data. In this configuration, all KVStore C API calls are mapped to work with the SecureStore class. The external TDBStore works on top of the default block device; however, you can set the external TDBStore block device to any of the following block devices: SPIF, QSPIF, DATAFASH and SD.
183-
184-
You can enable this configuration by setting `storage_type` in storage `mbed_lib.json` to `TDB_EXTERNAL_NO_RBP`.
185-
186-
Below is the `TDB_EXTERNAL_NO_RBP` configuration `mbed_lib.json`:
187-
188-
```
189-
{
190-
"name": "tdb_external_no_rbp",
191-
"config": {
192-
"external_size": {
193-
"help": "Size of the external block device",
194-
"value": "NULL"
195-
},
196-
"external_base_address": {
197-
"help": "If not defined the default is from address 0",
198-
"value": "NULL"
199-
},
200-
"blockdevice": {
201-
"help": "Options are default, SPIF, DATAFASH, QSPIF or FILESYSTEM",
202-
"value": "NULL"
203-
}
204-
}
205-
}
206-
```
207-
208165
### FILESYSTEM
209166

210167
![FILESYSTEM](./FILESYSTEM.jpg)
@@ -263,51 +220,6 @@ Below is the FILESYSTEM configuration `mbed_lib.json`:
263220

264221
If file system is not set, the default file system and block device are applied and `blockdevice`, `external_size` and `external_base_address` are ignored.
265222

266-
### FILESYSTEM_NO_RBP
267-
268-
![FILESYSTEM](./FILESYSTEM_no_rbp.jpg)
269-
270-
The `FILESYSTEM_NO_RBP` configuration resembles the `EXTERNAL_NO_RBP` but uses FileSystemStore on the external flash. By default, FileSystemStore uses the default file system and the default block device. This Configuration has no support for rollback protection and is therefore less secure.
271-
272-
In this configuration, all KVStore C API calls are mapped to the SecureStore class. This class handles the use of the external FileSystemStore.
273-
274-
You can enable this configuration by setting `storage_type` in `storage mbed_lib.json` to `FILESYSTEM_NO_RBF`.
275-
276-
Below is the FILESYSTEM configuration `mbed_lib.json`:
277-
278-
```
279-
{
280-
"name": "filesystem_store_no_rbp",
281-
"config": {
282-
"filesystem": {
283-
"help": "Options are default, FAT or LITTLE. If not specified default filesystem will be used",
284-
"value": "NULL"
285-
},
286-
"blockdevice": {
287-
"help": "Options are default, SPIF, DATAFASH, QSPIF or FILESYSTEM. If not set the default block device will be used",
288-
"value": "NULL"
289-
},
290-
"external_size": {
291-
"help": "Size in bytes of the external block device, if not specified the maximum is the default.",
292-
"value": "NULL"
293-
},
294-
"external_base_address": {
295-
"help": "If not defined the default is from address 0",
296-
"value": "NULL"
297-
},
298-
"mount_point": {
299-
"help": "Where to mount the filesystem. Ignored if the default file system is applied.",
300-
"value": "/sd"
301-
},
302-
"folder_path": {
303-
"help": "Path for the working directory where the FileSyetemStore stores the data",
304-
"value": "/kvstore"
305-
}
306-
}
307-
}
308-
```
309-
310-
If file system is not set, the default file system and block device are applied and `blockdevice`, `external_size` and `external_base_address` are ignored.
311223

312224
### Configuration functions API
313225

@@ -349,18 +261,6 @@ bool _storage_config_TDB_INTERNAL();
349261
*/
350262
bool _storage_config_TDB_EXTERNAL();
351263
352-
/**
353-
* @brief This function initialize a predefined external memory secure storage
354-
* This includes a SecureStore class with external TDBStore over a blockdevice or,
355-
* if no blockdevice was set the default blockdevice will be used.
356-
* The following is a list of configuration parameter:
357-
* MBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_SIZE - Size of the external blockdevice in bytes or NULL for max possible size.
358-
* MBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_BASE_ADDRESS - The block device start address
359-
* MBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_BLOCK_DEVICE - Alowed vlaues are: default, SPIF, DATAFASH, QSPIF or SD
360-
* @returns true on success or false on failure.
361-
*/
362-
bool _storage_config_TDB_EXTERNAL_NO_RBP();
363-
364264
/**
365265
* @brief This function initialize a predefined FILESYSTEM memory secure storage
366266
* This includes a SecureStore class with TDBStore over FlashIAPBlockdevice
@@ -380,22 +280,6 @@ bool _storage_config_TDB_EXTERNAL_NO_RBP();
380280
*/
381281
bool _storage_config_FILESYSTEM();
382282
383-
/**
384-
* @brief This function initialize a predefined FILESYSTEM_NO_RBP memory secure storage with no
385-
* rollback protection. This includes a SecureStore class an external FileSysteStore over a default
386-
* filesystem with default blockdevice unless differently configured.
387-
* The following is a list of configuration parameter:
388-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FILESYSTEM - Allowed values are: default, FAT or LITTLE
389-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_BLOCKDEVICE - Allowed values are: default, SPIF, DATAFASH, QSPIF or SD
390-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_SIZE - Blockdevice size in bytes. or NULL for max possible size.
391-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_BASE_ADDRESS - The block device start address.
392-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_MOUNT_POINT - Where to mount the filesystem
393-
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FOLDER_PATH - The working folder paths
394-
*
395-
* @returns true on success or false on failure.
396-
*/
397-
bool _storage_config_FILESYSTEM_NO_RBP();
398-
399283
MBED_WEAK bool storage_configuration()
400284
{
401285
return _STORAGE_CONFIG(MBED_CONF_STORAGE_STORAGE_TYPE);

storage/kvstore/kv_config/filesystem_no_rbp/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"name": "storage_filesystem_no_rbp",
33
"config": {
4+
"WARNING": {
5+
"help": "DEPRECATION WARNING: storage_filesystem_no_rbp does not work and will be removed in the future",
6+
"value": null
7+
},
48
"filesystem": {
59
"help": "Options are default, FAT or LITTLE. If default value the filesystem is chosen by the blockdevice type",
610
"value": "default"

storage/kvstore/kv_config/global/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "storage",
33
"config": {
44
"storage_type": {
5-
"help": "Options are TDB_INTERNAL, TDB_EXTERNAL, TDB_EXTERNAL_NO_RBP, FILESYSTEM, FILESYSTEM_NO_RBP or default. If default, the storage type will be chosen according to the component defined in targets.json",
5+
"help": "Options are TDB_INTERNAL, TDB_EXTERNAL, FILESYSTEM or default. If default, the storage type will be chosen according to the component defined in targets.json",
66
"value": "default"
77
},
88
"default_kv": {

storage/kvstore/kv_config/source/kv_config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ int _storage_config_TDB_EXTERNAL();
9696
* or NULL for max possible size.
9797
* MBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_BASE_ADDRESS - The block device start address
9898
* MBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_BLOCK_DEVICE - Alowed vlaues are: default, SPIF, DATAFASH, QSPIF, OSPIF or SD
99+
*
100+
* @deprecated This does not work and will be removed in the future.
101+
*
99102
* @returns 0 on success or negative value on failure.
100103
*/
101104
int _storage_config_TDB_EXTERNAL_NO_RBP();
@@ -134,6 +137,8 @@ int _storage_config_FILESYSTEM();
134137
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_MOUNT_POINT - Where to mount the filesystem
135138
* MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FOLDER_PATH - The working folder paths
136139
*
140+
* @deprecated This does not work and will be removed in the future.
141+
*
137142
* @returns 0 on success or negative value on failure.
138143
*/
139144
int _storage_config_FILESYSTEM_NO_RBP();

storage/kvstore/kv_config/tdb_external_no_rbp/mbed_lib.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"name": "storage_tdb_external_no_rbp",
33
"config": {
4+
"WARNING": {
5+
"help": "DEPRECATION WARNING: storage_tdb_external_no_rbp does not work and will be removed in the future",
6+
"value": null
7+
},
48
"blockdevice": {
59
"help": "Options are default, SPIF, DATAFASH, QSPIF, SD or other. If default the block device will be chosen by the defined component. If other, override get_other_blockdevice() to support block device out of Mbed OS tree.",
610
"value": "default"
@@ -19,4 +23,4 @@
1923
"blockdevice": "other"
2024
}
2125
}
22-
}
26+
}

0 commit comments

Comments
 (0)