Open antonio-fr opened 7 months ago
It may also come from this part: https://github.com/kaoh/globalplatform/blob/4f26a8e30058d059aa6b7e7c8c65b07346f04494/gpshell/src/gpshell.c#L991 The parsed buffer "buf" is limited in size.
Hi Antonio, you are using the install_for_personalization
and store_data -dataFormat format -dataEncryption encryption -data data
command? I can look into increasing the buffer size then. Can you try to make your suggested changes (increase BUFLEN
) and give it a try?
No. I'm using direct perso store_data. More precisely, after selecting the applet (not SD), and opening a secure channel with it:
store_data -dataFormat 0x08 -data xxxx
I didn't want to spend time to compile, I can give a quick try bc I have the VC tools and cmake already.
I modified to #define BUFLEN 8192
and compiled (was not so hard). And store_data works with the 550 bytes payload (1200 bytes command line).
Great! I have pushed an update to main and the next release will contain the enhancement.
Since a line is limited to 1024, and data is hex encoded, it is not possible to send data larger than ~490 bytes. The buffer size is defined at compile time, and hardcoded.
One of our own applet uses direct personalization and STORE DATA to setup a x509 certificate, which is around 600 bytes large. This is not possible to use a store_data command line to upload it using this software. This is sad, as this software correctly -and automatically- performs the commands chaining to send multiple data blocks. Also, the data buffer is set to 4096 bytes. But this is limited by this hard limit of 1024 bytes per command line.
We are using the standard input to send command lines to the binary exe. The issue is that it cuts the lines which are greater to 1024 bytes. What is after 1024 bytes, is seen as new line.
I think of several ways to solve this issue:
Technically, the main culprit seems to be here: https://github.com/kaoh/globalplatform/blob/4f26a8e30058d059aa6b7e7c8c65b07346f04494/gpshell/src/gpshell.c#L276 This is used in handleCommands, and also in handleOptions.