@@ -191,6 +191,9 @@ psa_status_t psa_storage_set_impl(KVStore *kvstore, int32_t pid, psa_storage_uid
191
191
return PSA_ERROR_NOT_SUPPORTED;
192
192
}
193
193
194
+ if (uid == 0 ) {
195
+ return PSA_ERROR_INVALID_ARGUMENT;
196
+ }
194
197
// Generate KVStore key
195
198
char kv_key[PSA_STORAGE_FILE_NAME_MAX] = {' \0 ' };
196
199
generate_fn (kv_key, PSA_STORAGE_FILE_NAME_MAX, uid, pid);
@@ -208,6 +211,10 @@ psa_status_t psa_storage_set_impl(KVStore *kvstore, int32_t pid, psa_storage_uid
208
211
psa_status_t psa_storage_get_impl (KVStore *kvstore, int32_t pid, psa_storage_uid_t uid,
209
212
uint32_t data_offset, uint32_t data_length, void *p_data)
210
213
{
214
+ if (uid == 0 ) {
215
+ return PSA_ERROR_INVALID_ARGUMENT;
216
+ }
217
+
211
218
// Generate KVStore key
212
219
char kv_key[PSA_STORAGE_FILE_NAME_MAX] = {' \0 ' };
213
220
generate_fn (kv_key, PSA_STORAGE_FILE_NAME_MAX, uid, pid);
@@ -242,6 +249,11 @@ psa_status_t psa_storage_get_impl(KVStore *kvstore, int32_t pid, psa_storage_uid
242
249
psa_status_t psa_storage_get_info_impl (KVStore *kvstore, int32_t pid, psa_storage_uid_t uid,
243
250
struct psa_storage_info_t *p_info)
244
251
{
252
+
253
+ if (uid == 0 ) {
254
+ return PSA_ERROR_INVALID_ARGUMENT;
255
+ }
256
+
245
257
// Generate KVStore key
246
258
char kv_key[PSA_STORAGE_FILE_NAME_MAX] = {' \0 ' };
247
259
generate_fn (kv_key, PSA_STORAGE_FILE_NAME_MAX, uid, pid);
@@ -262,6 +274,10 @@ psa_status_t psa_storage_get_info_impl(KVStore *kvstore, int32_t pid, psa_storag
262
274
263
275
psa_status_t psa_storage_remove_impl (KVStore *kvstore, int32_t pid, psa_storage_uid_t uid)
264
276
{
277
+ if (uid == 0 ) {
278
+ return PSA_ERROR_INVALID_ARGUMENT;
279
+ }
280
+
265
281
// Generate KVStore key
266
282
char kv_key[PSA_STORAGE_FILE_NAME_MAX] = {' \0 ' };
267
283
generate_fn (kv_key, PSA_STORAGE_FILE_NAME_MAX, uid, pid);
0 commit comments