<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114418/psa_ps_set-returning--135-error</link><description>Hi, 
 I need to create partition of size 4kb but using psa_ps_set() I could not able create partition of size more than 1Kb, If I try to create 4 kb Partition it&amp;#39;s throwing -135 error 
 I am working in TFM application 
 here providing you snippet of our</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Sep 2024 10:37:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114418/psa_ps_set-returning--135-error" /><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501693?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 10:37:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:545afaf8-287a-4c98-a4b3-d366f235da95</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="RAGHAV_M"]Before i tried with struct i changed that to union due to size issue[/quote]
&lt;p&gt;I see. Union is not what you want here. It has it&amp;#39;s uses in C, but not here.&lt;/p&gt;
[quote user="RAGHAV_M"]what you exactly mean by spliting do i need to split buffer or have other partition of 2 KB[/quote]
&lt;p&gt;The maximum size you can write is&amp;nbsp;4024 byte. So if you need to write more (like&amp;nbsp;4096), you need to split that in two (or more) chunks. So for instance, that could be one&amp;nbsp;4024 buffer and the remaining 72 bytes in another buffer, or y ou can split in a different way. The main thing is that you cannot store an asset larger than 4024 bytes. If this is difficult, what about just making two 2048 byte buffers and memcypy into thouse, and store those? Then when you read the two buffers, you can memcpy into a larger buffer again if needed.&lt;/p&gt;
&lt;p&gt;Note that in order to be able to store&amp;nbsp;4024 you need to allocate some larger buffers in TF-M, using CONFIG_TFM_CRYPTO_IOVEC_BUFFER_SIZE. So when I tested, I used these additional configs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_TFM_PS_MAX_ASSET_SIZE=4024
CONFIG_TFM_CRYPTO_IOVEC_BUFFER_SIZE=16384&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501496?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 08:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d17c13bb-3b75-495c-b388-18592fa2f4d2</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;Before i tried with struct i changed that to union due to size issue, what you exactly mean by spliting do i need to split buffer or have other partition of 2 KB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501491?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 08:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7475094f-ab44-485d-a6c4-16b27cec1286</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Here you are calling&amp;nbsp;&lt;code&gt;psa_ps_set()&lt;/code&gt; with an asset which is too large and cannot work. I suggest you split it in two.&lt;/p&gt;
&lt;p&gt;Another unrelated issue is the &lt;code&gt;union&lt;/code&gt; you have of &lt;code&gt;buf&lt;/code&gt; and &lt;code&gt;len&lt;/code&gt; (&lt;code&gt;response_info_t&lt;/code&gt;). Note that in C, all members of the union are in the same address space, so it is difficult to see what the intention here was. Perhaps this should have been a &lt;code&gt;struct&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501485?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 07:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7730f87-18d9-47ba-9f36-cccf8646f8ea</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp; for your reference i am sending snippet if you find any mistake let me know&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define RESP_INFO_BUF_SZ = 4096
psa_storage_uid_t uid2 = UID_RESPONSE_INFO_DATABASE;
	psa_storage_create_flags_t uid2_flag = PSA_STORAGE_FLAG_NONE;
    psa_status_t status = PSA_ERROR_DOES_NOT_EXIST;
    size_t read_len = 0;
    
typedef union {
    uint8_t buf[RESP_INFO_BUF_SZ];
    uint16_t len;

} response_info_t;

response_info_t response_info;

memset((uint8_t *)&amp;amp;response_info, 0, sizeof(response_info));	
for(uint8_t off = 0; off &amp;lt; 100; off++){
            response_info.buf[off] = off;
}

status = psa_ps_set(uid2,  sizeof(response_info), (uint8_t *)&amp;amp;response_info, uid2_flag);

if (status != PSA_SUCCESS) {
         return APP_INIT_ERROR;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501479?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 07:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95908d21-e26a-41cf-aa3c-4dd008f753c3</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;In my case i have already other partition which is 1Kb of size i am trying add other partition with different UID which i need 4 KB buffer size and if u are saying split that buffer size that i&amp;#39;ll try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501476?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 07:38:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4209e1d4-802e-472d-be5f-ac1f88eea534</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There was a typo in my previosu reply that made it unclear. I ment to say that it will not be possible to store your 4 kB data as one asset, so you need to split it up. Can you try setting&amp;nbsp;CONFIG_TFM_PS_MAX_ASSET_SIZE to a lower number (could also be 2100) and split your data in two 2 kB assets that you write? That would work around the limitation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501473?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 07:24:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff4b907e-b44f-4353-8d19-1ba90e096fc5</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;HI &lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;sorry I didn&amp;#39;t get you can you explain in detail&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501398?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 14:18:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84e83ca6-5737-4ab7-bf7a-5711f9af574e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;How big chunks are you tryign to write now? What if you set the&amp;nbsp;CONFIG_TFM_PS_MAX_ASSET_SIZE to say 2500 and devide your 4k asset in two 2k pieces and write those?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501377?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 13:05:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e36197fa-af0c-424c-b597-9612522225f0</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thanks for the reply&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if I do like this it shows error -132 i.e&amp;nbsp;&lt;span&gt;PSA_ERROR_GENERIC_ERROR&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501326?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 10:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f462957d-f887-478d-88be-b4f350866998</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The maximum asset size is lower than 4096 as the asset&amp;nbsp;&lt;em&gt;including&lt;/em&gt; additional metadata must be within a flash page, which is 4096 bytes. So the absolute maximum value you can set CONFIG_TFM_PS_MAX_ASSET_SIZE to is&amp;nbsp;4024.&lt;/p&gt;
&lt;p&gt;So if you need to store more data you&amp;nbsp;must split it up and store it as several assets.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501163?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 12:40:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d66dd1a-2436-4ecd-af35-e140dc003aeb</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;Hi thanks for the reply&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am using sdk v2.6.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501162?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 12:39:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:601601ee-220f-480a-ad50-faf3925db3d6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Which SDK version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/501117?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 09:26:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69bc4e46-1495-46e9-86e9-dfdc6611e9c7</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;do you have any update regarding this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/500962?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 11:52:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f056c327-124c-47d7-a63d-d88da0f41468</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;Thanks for the reply &lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;actually I tried it before only but it&amp;#39;s not working.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/500957?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 11:41:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3750b2f-82b5-4bef-b85e-f34f72339ca8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can configure a larger asset size with &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_TFM_PS_MAX_ASSET_SIZE"&gt;CONFIG_TFM_PS_MAX_ASSET_SIZE&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/500916?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 09:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4d77527-f6a8-4f77-aeaa-528d73c9723b</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;Could you please give me some update on this issue as soon as possible&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/500803?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2024 13:42:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0dd7975-81ac-4201-8649-7cdb3d9dfa10</guid><dc:creator>RAGHAV_M</dc:creator><description>&lt;p&gt;Thanks for the response&amp;nbsp;&lt;/p&gt;
&lt;p&gt;can you please provide some suggestions to resolve this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: psa_ps_set() returning -135 ERROR</title><link>https://devzone.nordicsemi.com/thread/500799?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2024 13:39:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61cba96f-993c-4c1c-be61-fb4e7e4b57d4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Return code -135 is PSA_ERROR_INVALID_ARGUMENT.&amp;nbsp;I expect this si due to using a length larger than the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.2.0/page/tfm/integration_guide/services/tfm_ps_integration_guide.html#maximum_asset_size"&gt;maximum asset size&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>