Closed Lipovlan closed 1 year ago
Actually... why? There is no real reason why you a provider should have to use OpenSSL's memory management routines. All the memory allocated by a provider is 100% provider private anyway, so as long as the provider handles dynamic memory cleanly, it's fine using the usual C RTL routines.
Thanks for the feedback. I was wondering since the OpenSSL core passes these functions to the provider that they must serve a purpose.
These functions are supposed to be like the CRYPTO_malloc related functions. But I wasn't quite able to figure out their exact purpose (other than doing normal allocation-related stuff).
As I do not have full overview of the functionalities and tools around OpenSSL I thought that maybe they have a purpose in tests and tracing. Thus if I changed the normal malloc
for CRYPTO_malloc
I could later write tests and such that when this provider is compiled with OpenSSL and not standalone they would run in the same manner.
And when doing research on other providers (which I found out today are neatly packed in your Provider corner) I found usage of what I thought were these functions which I assumed must be there for a purpose that I simply don't know yet.
So the goal of this issue was to find out if there were benefits for CNG provider in using these functions and if to implement them. But it seems like that is not necessary :)
OpenSSL has function that
core
passes to the provider such asOSSL_FUNC_CRYPTO_MALLOC
,OSSL_FUNC_CRYPTO_ZALLOC
orOSSL_FUNC_CRYPTO_FREE
. Those should be used instead of normalmalloc
andfree
so it can be better integrated with OpenSSL tools.