SecureStorage total error

Hello,

I am implementing some secure storage features and I would like to know how much of space I used. So I tried using secstore total from console of the device, in return I got this message:

root@swi-mdm9x28-wp:~# secstore total
Internal error check logs for details.

Jul 17 17:21:27 | secStore[880]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 796 | Sending QMI_SWI_SFS_GET_SPACE_INFO_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=3.[0x03]
Jul 17 17:21:27 | secStore[880]/le_pa_secStore T=main | pa_secStore_qmi.c pa_secStore_GetTotalSpace() 2390 | Unexpected QMI response -6 (LE_FAULT)
Jul 17 17:21:27 | secstore[22886]/secstore T=main | secStoreTool.c PrintTotalSizes() 439 | Could not get available secure storage space. Result code LE_FAULT.

I am using legato 18.06.03, I have my application which has secStorage service connected but I tried stopping my application and I get the same error.

Also I tried setting the limit by adding this line in .adef:
maxSecureStorageBytes: 10000
But that also reproduces the same error


Another approach I took was adding secStorage Admin to my application and then calling the API provided:

le_result_t secStoreAdmin_GetTotalSpace (uint64_t *totalSizePtr, uint64_t *freeSizePtr)

The result of calling this function was LE_FAULT.

Does anyone have an idea what I am doing wrong? My legato isn’t built with the admin enabled flag but this function should be available without it also.

Adding my code here:

// Connect current client to secStorage
le_secStore_ConnectService();
// Connect current client to admin secstorage service
secStoreAdmin_ConnectService();

uint64_t* totalSize = (uint64_t*)malloc(sizeof(uint64_t));
uint64_t* freeSize = (uint64_t*)malloc(sizeof(uint64_t));
le_result_t rez = secStoreAdmin_GetTotalSpace(totalSize, freeSize);
switch (rez) {
case LE_OK:
logger.debug(Poco::format(“secStorage total space <%lu>, available storage <%lu>”, *totalSize, *freeSize ));
break;
case LE_UNAVAILABLE:
logger.error(“Couldn’t SS_AVAIL_SIZE, currently unavailable”);
break;
case LE_FAULT:
logger.error(“Couldn’t SS_AVAIL_SIZE secStorage, uknown error [FAULT]”);
break;
default:
logger.error(“Couldn’t SS_AVAIL_SIZE, unknown error”);
break;
}
free(totalSize);
free(freeSize);

Once more: the error that is produced is shown here:

Jan 1 02:46:57 swi-mdm9x28-wp user.err Legato: =ERR= | secStore[889]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 796 | Sending QMI_SWI_SFS_GET_SPACE_INFO_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=3.[0x03]
Jan 1 02:46:57 swi-mdm9x28-wp user.err Legato: =ERR= | secStore[889]/le_pa_secStore T=main | pa_secStore_qmi.c pa_secStore_GetTotalSpace() 2390 | Unexpected QMI response -6 (LE_FAULT)

Thank you for your reply.

I guess then the documentation for this is wrong:
Secure Storage Admin

image

Also the same thing is then wrong on the latest and the 18_06 documentation

Hello Lazar,

Here is a revised answer:

SECSTOREADMIN is not disabling *GetTotalSpace function.

You might be using a WP76* product.
First WP76 firmware versions have got this limitation: QMI_SWI_SFS_GET_SPACE_INFO_REQ_V01 message is not fully supported, resulting in secStoreAdmin_GetTotalSpace returning LE_FAULT.

You should flash a FW whose version is >= SWI9X07Y_02.20.00.00.

KR,
flu.

Thank you for your answer, yes we are using WP76*

The modem firwmare that we are using is:
9999999_9907152_SWI9X07Y_02.18.05.00_00_GENERIC_002.041_002.spk

We will update the firmware soon and I will recheck if this is still as is or it works properly after fw upgrade, thanks.

hi @lazzox,
did you have time to test again using a recent firmware version?
Best Regards,