Param helper functions, continued#8451
Closed
levitte wants to merge 13 commits intoopenssl:masterfrom
Closed
Conversation
Contributor
|
Thanks. |
mattcaswell
requested changes
Mar 11, 2019
23d96fc to
f34bcf6
Compare
Member
Author
|
Please take note of 3690d01f86577d9438a333d8d459daa9dfa825f6, which renames |
Provide a number of functions to allow parameters to be set and retrieved in a type safe manner. Functions are provided for many integral types plus double, BIGNUM, UTF8 strings and OCTET strings. All of the integer functions will widen the parameter data as required. This permits a degree of malleability in the parameter definition. For example a type can be changed from a thirty two bit integer to a sixty four bit one without changing application code. Only four and eight byte integral sizes are supported here. A pair of real functions, a get and a set, that will accept all real and integer types and automaticly convert to/from double as required. There could be some loss of precision when converting wide integral types to reals and reals to any integer type. A pair of functions is available for BIGNUMs. These accept any sized unsigned integer input and convert to/from a BIGNUM. For each OCTET and UTF8 strings, four functions are defined. This provide get and set functionality for string and for pointers to strings. The latter avoiding copies but have other inherent risks. Finally, some utility macros and functions are defined to allow OSSL_PARAM definition arrays to be more simplify specified. There are two macro and one function for most types. The exception being BIGNUM, for which there is one macro and one function.
demacro the get/set/construct for the standard integral types
OSSL_PARAM.doc only describes the structure, not the added API, so when a description says "must", that should remain.
doc/man3/OSSL_PARAM_TYPE.pod was marked as generic, but the majority of it isn't, so remove that comment and adjust the page. To make this possible, generic names were entered in util/private.num, labeled "generic".
The return_size setting wasn't quite right
In unrelated code
The OSSL_PARAM attribute names |buffer| and |buffer_size| may lead to confusion, as they may make some think that the memory pointed at is an intermediate memory are. This is not generally the case, so we rename |buffer| and |buffer_size| to |data| and |data_size|
c0af87d to
5e5a1c5
Compare
This restricts the _get_ and _set_ functions to only handle their own types. This includes match of integer signedness, and doubles. API test is adapted to match.
Member
Author
|
Last commit restricts the diverse |
Cleanup, making the coding patterns for _get_ and _set_ functions a bit more uniform
mattcaswell
approved these changes
Mar 12, 2019
levitte
added a commit
that referenced
this pull request
Mar 12, 2019
The OSSL_PARAM attribute names |buffer| and |buffer_size| may lead to confusion, as they may make some think that the memory pointed at is an intermediate memory are. This is not generally the case, so we rename |buffer| and |buffer_size| to |data| and |data_size| Reviewed-by: Matt Caswell <[email protected]> (Merged from #8451)
levitte
pushed a commit
that referenced
this pull request
Mar 12, 2019
Provide a number of functions to allow parameters to be set and retrieved in a type safe manner. Functions are provided for many integral types plus double, BIGNUM, UTF8 strings and OCTET strings. All of the integer functions will widen the parameter data as required. This permits a degree of malleability in the parameter definition. For example a type can be changed from a thirty two bit integer to a sixty four bit one without changing application code. Only four and eight byte integral sizes are supported here. A pair of real functions are available for doubles. A pair of functions is available for BIGNUMs. These accept any sized unsigned integer input and convert to/from a BIGNUM. For each OCTET and UTF8 strings, four functions are defined. This provide get and set functionality for string and for pointers to strings. The latter avoiding copies but have other inherent risks. Finally, some utility macros and functions are defined to allow OSSL_PARAM definition arrays to be specified in a simple manner. There are two macro and one function for most types. The exception being BIGNUM, for which there is one macro and one function. Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #8451)
levitte
pushed a commit
that referenced
this pull request
Mar 12, 2019
Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Richard Levitte <[email protected]> (Merged from #8451)
levitte
added a commit
that referenced
this pull request
Mar 12, 2019
In unrelated code Reviewed-by: Matt Caswell <[email protected]> (Merged from #8451)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This takes over #8400 for final adjustments, on @paulidale's request.