cancel
Showing results for 
Search instead for 
Did you mean: 

How much memory CMOX_PQC_ML_DSA_44_DET_SIGN_ALGO needs ?

acapola
Associate III

I have a project which runs fine using CMOX_PQC_ML_DSA_44_DET_SIGN_LOWRAM_ALGO but I would like to see how much faster I can get with CMOX_PQC_ML_DSA_44_DET_SIGN_ALGO. When I use it, cmox_pqc_dsa_sign returns 0x9000c, which apparently means "Not enough memory".

I am also wandering what kind of memory we are speaking about because it does not seems to request heap memory and I don't expect it to detect if stack is large enough at runtime.

I am going to have exactly the same question for CMOX_PQC_ML_DSA_65_DET_SIGN_ALGO and CMOX_PQC_ML_DSA_87_DET_SIGN_ALGO.

Perhaps a more general question: is there a documentation for the cmox_pqc library ?

1 ACCEPTED SOLUTION

Accepted Solutions
S.RA
ST Employee

Hello 

There is a "non documented" macro size_t cmox_membuf_getMaxUsed(const cmox_membuf_handle_st *P_pMembufCtx) to get the actual memory buffer used by the algo. 

If you define the higher-level context ctx that is cmox_pqc_handle_t you just need to invoke:

cmox_membuf_getMaxUsed(&ctx.membuf_str) to obtain the maximum amount of memory used by the membuf during the previous computation. Note: remember to reinitialize the context (thanks to the construct) to reset that counter.
I will ask to add it documented in the next release of our library.

Please find below some measurement on H5 to give you idea about the performance gain for each configuration.

 

SRA_0-1769423232791.png

Thanks

Best Regards

Solofo

View solution in original post

2 REPLIES 2
acapola
Associate III

so the memory is not the stack nor the heap, it is the buffer size that you pass to 

cmox_pqc_dsa_construct

give it 31K and then CMOX_PQC_ML_DSA_44_DET_SIGN_ALGO works!

 

ST people: it would be nice to see it in a doc somewhere. even better we could have macros to give that size from the targeted algo.

S.RA
ST Employee

Hello 

There is a "non documented" macro size_t cmox_membuf_getMaxUsed(const cmox_membuf_handle_st *P_pMembufCtx) to get the actual memory buffer used by the algo. 

If you define the higher-level context ctx that is cmox_pqc_handle_t you just need to invoke:

cmox_membuf_getMaxUsed(&ctx.membuf_str) to obtain the maximum amount of memory used by the membuf during the previous computation. Note: remember to reinitialize the context (thanks to the construct) to reset that counter.
I will ask to add it documented in the next release of our library.

Please find below some measurement on H5 to give you idea about the performance gain for each configuration.

 

SRA_0-1769423232791.png

Thanks

Best Regards

Solofo