Skip to main content
SURLEAU.Frederic
Associate III
October 23, 2017
Question

X-CUBE-CRYPTOLIB memory

  • October 23, 2017
  • 1 reply
  • 707 views
Posted on October 23, 2017 at 10:41

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-cryptolib
This topic has been closed for replies.

1 reply

SURLEAU.Frederic
Associate III
October 31, 2017
Posted on October 31, 2017 at 10:38

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.

Tesla DeLorean
Guru
October 31, 2017
Posted on October 31, 2017 at 14:21

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.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
SURLEAU.Frederic
Associate III
October 31, 2017
Posted on October 31, 2017 at 15:34

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.