WriteBinary not working depending on the size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WriteBinary not working depending on the size

1,688 Views
antoine_provot
Contributor II

Hi,

I identified a problem with the WriteBinary command depending on the size of what I'm writing.

 

When the size I'm writting is not multiple of 16, sometimes I get a 0x6a80, but if I round the size to the next mutliple of 16, it magically works.

Could you explain me what happened ?

Kind regards

 

Antoine

 

 

0 Kudos
6 Replies

930 Views
peacelol
Contributor I

The WriteBinary command has to be detected as an issue based on the size of what you are writing.

Is it based on the MW that you implemented it? Let us see the code if it's feasible.

 

Onevanilla

0 Kudos

1,618 Views
Andrewne
Contributor I

Hiii,

You have to  identified a problem with the WriteBinary command depending on the size of what you are writing.

Did you implement it based on the MW? Is it possible to share the code with us?

0 Kudos

932 Views
peacelol
Contributor I

The WriteBinary command has to be detected as an issue based on the size of what you are writing.

Is it based on the MW that you implemented it? Let us see the code if it's feasible.

 

Onevanilla

0 Kudos

1,682 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Antoine,

 

Did you implement it based on the MW? Is it possible to share the code with us? We may try to reproduce this issue here.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,644 Views
antoine_provot
Contributor II

Hi, I isolated the problem and I can show it to through a simple example.

First, I only managed to reproduce the problem in encrypted session, maybe it also exist in plain, but I did not manage to reproduce it.

Here's what I did :

I authentifed my MCU with the SE050 with a key (the value is only zeroes). Then, I looped to write in a file already created with a big size (> 500), a single byte, then two bytes, and so on.

At 4 bytes, I had a 0x6a80 and then only 0x6a80 errors until I rebooted the SE050.

For your information, if instead of writing the precise number of bytes, I round the buffer length to the upper multiple of 16, I manage to write as much bytes I want without any problem.

Please find attached an encrypted set of command that is showing the problem.

 

0 Kudos

1,472 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @antoine_provot ,

 

Did you properly  use the WriteBinary command?  For example, if you implement this based on the MW, for the second WriteBinrary command and so on you need to set the policy and the file length to NULL. Please kindly refer to the following for details.

sm_status = Se05x_API_WriteBinary(&pSession->s_ctx,
&policy,
objectID,
0,
(uint16_t)128,
&file_data[0],
1);
if (sm_status != SM_OK) {
LOG_E("Se05x_API_WriteBinary Failed");
status = kStatus_SSS_Fail;
}

sm_status = Se05x_API_WriteBinary(&pSession->s_ctx,
NULL, // policy <==
objectID,
1,
NULL, // file length <==
&file_data[1],
2);
if (sm_status != SM_OK) {
LOG_E("Se05x_API_WriteBinary Failed");
status = kStatus_SSS_Fail;
}

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos