OSSL_PARAM thought
Dr Paul Dale
paul.dale at oracle.com
Mon Jun 24 01:04:21 UTC 2019
We’re only starting out, so there isn’t any issue yet. I am wondering if instead of terminating out OSSL_PARAM arrays with an empty element, would it make sense to pass a size and the array?
I.e. changing this code sequence (from crypto/evp/digest.c):
params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN,
&size, NULL);
params[i++] = OSSL_PARAM_construct_end();
EVP_MD_CTX_set_params(ctx, params);
into:
params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN,
&size, NULL);
EVP_MD_CTX_set_params(ctx, i, params);
For fixed arrays OSSL_NELEM would be used instead of the counter variable.
There are downsides with both approaches of course and neither jumps out as being obviously superior.
To me, at least, it looks like we’re going to have a lot of END’s throughout the codebase. Saving one line many times seems like a win.
Pauli
--
Dr Paul Dale | Cryptographer | Network Security & Encryption
Phone +61 7 3031 7217
Oracle Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-project/attachments/20190624/7c8fafa2/attachment.html>
More information about the openssl-project
mailing list