I'm using OpenSSL and not really familiar with it. Trying to use it to decode something someone is sending me from another programming language in a data package. Anyways, the info is encoded with OpenSSL and so I need to decode it using it. I have it working more or less, but I am concerned about resource usage.
I am using PKCS5_PBKDF2_HMAC() to make a digest_key following the way it was encrypted. One of the arguments to the function requires calling EVP_sha256(). When using functions like this, usually I am used to calling another function to free the memory or handle. I cannot find a function that is appropriate for freeing the handle/pointer returned. I am calling from C++ if that makes any difference.
Should I just always call EVP_sha256() before a call to PKCS5_PBKDF2_HMAC(), or should I use a static variable in C++ so that it only gets called once? Do I have to worry about running out of memory by repeatedly calling it, or is it always returning a pointer to something that only gets allocated once?
... 10 minutes elapse...
Ok, I just looked at the source code. It's returning a pointer to something that is statically allocated already, so it appears I don't need to worry about clearing it up?
https://stackoverflow.com/questions/65605731/need-to-free-evp-md-from-evp-sha256 January 07, 2021 at 10:06AM
没有评论:
发表评论