New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify the int param getter documentation #17445
Conversation
OSSL_PARAMs that are of type OSSL_PARAM_INTEGER or OSSL_PARAM_UNSIGNED_INTEGER can be obtained using any of the functions EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or EVP_PKEY_get_bn_param(). The former two will fail if the parameter is too large to fit into the C variable. We clarify this in the documentation.
Nice, thanks! Is there a way to guide the reader to which of the functions he should use to retrieve the param value? I.e., is it always recommended to use |
@@ -37,6 +37,15 @@ EVP_PKEY_gettable_params() returns a constant list of I<params> indicating | |||
the names and types of key parameters that can be retrieved. | |||
See L<OSSL_PARAM(3)> for information about parameters. | |||
|
|||
An B<OSSL_PARAM> of type B<OSSL_PARAM_INTEGER> or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the notes section? It seems slightly out of place here. It's also more likely to be read if here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would have this in NOTES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep it here. As @paulidale says it is much more likely to be read here, and I think this is critical information for understanding how these functions work.
It's IMO always - apply your reason about what the meaning of the parameter actually is. If it is some kind of length parameter get_size_t should be used. If it is some small integer parameter, you can use get_int_param. For the rest, use get_bn_param. Of course there are border-line cases such as the RSA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be OK with keeping it here or moving it to NOTES, no problem with either choice.
If you have the param, you can inspect the size directly. It is a public structure. |
Fixup pushed addressing the typo |
Can we indicate this somehow in the documentation for each parameter (not in this PR)? The parameter documentation all has a standard form, e.g.
Could we change that to something like:
or
|
This pull request is ready to merge |
Merged to 3.0 and master. |
OSSL_PARAMs that are of type OSSL_PARAM_INTEGER or OSSL_PARAM_UNSIGNED_INTEGER can be obtained using any of the functions EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or EVP_PKEY_get_bn_param(). The former two will fail if the parameter is too large to fit into the C variable. We clarify this in the documentation. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from #17445) (cherry picked from commit 254217a)
OSSL_PARAMs that are of type OSSL_PARAM_INTEGER or OSSL_PARAM_UNSIGNED_INTEGER can be obtained using any of the functions EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or EVP_PKEY_get_bn_param(). The former two will fail if the parameter is too large to fit into the C variable. We clarify this in the documentation. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from #17445)
OSSL_PARAMs that are of type OSSL_PARAM_INTEGER or
OSSL_PARAM_UNSIGNED_INTEGER can be obtained using any of the functions
EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or
EVP_PKEY_get_bn_param(). The former two will fail if the parameter is too
large to fit into the C variable. We clarify this in the documentation.