OSSL_PARAM helper functions.
authorPauli <paul.dale@oracle.com>
Fri, 22 Feb 2019 02:21:33 +0000 (12:21 +1000)
committerRichard Levitte <levitte@openssl.org>
Tue, 12 Mar 2019 18:12:12 +0000 (19:12 +0100)
commit7ffbd7ca9696ade5274068c29a8e03217f596e57
tree01061d02685de3c4b18b4ca34559f3fd7ddd729b
parent8c4412ed8fe80a8b92549d7e2db1359012074d65
OSSL_PARAM helper functions.

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 <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8451)
12 files changed:
crypto/build.info
crypto/params.c [new file with mode: 0644]
doc/man3/OSSL_PARAM.pod
doc/man3/OSSL_PARAM_TYPE.pod [new file with mode: 0644]
include/openssl/core.h
include/openssl/params.h [new file with mode: 0644]
test/build.info
test/params_api_test.c [new file with mode: 0644]
test/recipes/03-test_params_api.t [new file with mode: 0644]
test/testutil.h
test/testutil/tests.c
util/private.num