2017-10-23 01:41 AM
Hi,
I'm using X-CUBE-CRYPTOLIB 3.1.0.
All RSA_PKCS1v15_* functions uses a 'membuf_stt *P_pMemBuf)' parameter.
The documentation says : 'The structure pointed by P_pMemBuf must be properly initialized.'
In the examples the buffer use 4096 Bytes.
I could not find in the documentation the RAM size needed.
I try serval values, but RSA_PKCS1v15_Verify seems to need at least 4096 Bytes.
4KB is a lot of memory, for a STM32F103 with 20KB of RAM.
Where can I get more information ?
Regards,
Fred.
#x-cube-cryptolib2017-10-31 02:38 AM
Hi,
Using a 1024 bits RSA Key, it seems that the minimum size for preallocated_buffer is 2185 Bytes.
Is there a way to find/calculate the size needed by cryptographic functions ?
Regards.
Fred.
2017-10-31 07:21 AM
You might be able to read the mUsed field. The examples all assume the buffer provides 4096 bytes, and ST doesn't disclose the internal functionality, I would suppose it is used for a malloc/free emulation that is not reliant on external libraries. You'd probably want to discuss with the FAE assigned to your account, or via the local sales office.
2017-10-31 08:34 AM
Hi,
Thanks for your reply.
The field mUsed allways contains 0 after a function call, no matter if the call was successfull or not.
The functions I use Are :
- RSA_PKCS1v15_Encrypt
- RSA_PKCS1v15_Decrypt
- RSA_PKCS1v15_Sign
- RSA_PKCS1v15_Verify
I understand, the source is closed, but I think the requested arguments should be documented.
The examples provides 4KB. On a 20KB microcontroler it's a lot. Each byte count.