Replace OSSL_ITEM with OSSL_PARAM as parameter descriptor, everywhere
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9346)
This commit is contained in:
parent
3efe19145c
commit
2617501348
11 changed files with 38 additions and 41 deletions
|
@ -35,7 +35,7 @@ int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OSSL_ITEM *OSSL_PROVIDER_get_param_types(const OSSL_PROVIDER *prov)
|
const OSSL_PARAM *OSSL_PROVIDER_get_param_types(const OSSL_PROVIDER *prov)
|
||||||
{
|
{
|
||||||
return ossl_provider_get_param_types(prov);
|
return ossl_provider_get_param_types(prov);
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,7 +680,7 @@ void ossl_provider_teardown(const OSSL_PROVIDER *prov)
|
||||||
prov->teardown(prov->provctx);
|
prov->teardown(prov->provctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov)
|
const OSSL_PARAM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov)
|
||||||
{
|
{
|
||||||
return prov->get_param_types == NULL
|
return prov->get_param_types == NULL
|
||||||
? NULL : prov->get_param_types(prov->provctx);
|
? NULL : prov->get_param_types(prov->provctx);
|
||||||
|
@ -712,13 +712,13 @@ const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
||||||
* discovery. We do not expect that many providers will use this, but one
|
* discovery. We do not expect that many providers will use this, but one
|
||||||
* never knows.
|
* never knows.
|
||||||
*/
|
*/
|
||||||
static const OSSL_ITEM param_types[] = {
|
static const OSSL_PARAM param_types[] = {
|
||||||
{ OSSL_PARAM_UTF8_PTR, "openssl-version" },
|
OSSL_PARAM_DEFN("openssl-verstion", OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ OSSL_PARAM_UTF8_PTR, "provider-name" },
|
OSSL_PARAM_DEFN("provider-name", OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ 0, NULL }
|
OSSL_PARAM_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const OSSL_ITEM *core_get_param_types(const OSSL_PROVIDER *prov)
|
static const OSSL_PARAM *core_get_param_types(const OSSL_PROVIDER *prov)
|
||||||
{
|
{
|
||||||
return param_types;
|
return param_types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ ossl_provider_get_params, ossl_provider_query_operation
|
||||||
|
|
||||||
/* Thin wrappers around calls to the provider */
|
/* Thin wrappers around calls to the provider */
|
||||||
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
|
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
|
||||||
const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov);
|
const OSSL_PARAM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov);
|
||||||
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
||||||
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
||||||
int operation_id,
|
int operation_id,
|
||||||
|
@ -174,7 +174,7 @@ the provider has one.
|
||||||
|
|
||||||
ossl_provider_get_param_types() calls the provider's I<get_param_types>
|
ossl_provider_get_param_types() calls the provider's I<get_param_types>
|
||||||
function, if the provider has one.
|
function, if the provider has one.
|
||||||
It should return an array of I<OSSL_ITEM> to describe all the
|
It should return an array of I<OSSL_PARAM> to describe all the
|
||||||
parameters that the provider has for the provider object.
|
parameters that the provider has for the provider object.
|
||||||
|
|
||||||
ossl_provider_get_params() calls the provider's parameter request
|
ossl_provider_get_params() calls the provider's parameter request
|
||||||
|
@ -235,9 +235,9 @@ is returned.
|
||||||
|
|
||||||
ossl_provider_teardown() doesnt't return any value.
|
ossl_provider_teardown() doesnt't return any value.
|
||||||
|
|
||||||
ossl_provider_get_param_types() returns a pointer to an I<OSSL_ITEM>
|
ossl_provider_get_param_types() returns a pointer to a constant
|
||||||
array if this function is available in the provider, otherwise
|
I<OSSL_PARAM> array if this function is available in the provider,
|
||||||
NULL.
|
otherwise NULL.
|
||||||
|
|
||||||
ossl_provider_get_params() returns 1 on success, or 0 on error.
|
ossl_provider_get_params() returns 1 on success, or 0 on error.
|
||||||
If this function isn't available in the provider, 0 is returned.
|
If this function isn't available in the provider, 0 is returned.
|
||||||
|
|
|
@ -15,7 +15,7 @@ OSSL_PROVIDER_add_builtin, OSSL_PROVIDER_name - provider routines
|
||||||
OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *, const char *name);
|
OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *, const char *name);
|
||||||
int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
|
int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
|
||||||
|
|
||||||
const OSSL_ITEM *OSSL_PROVIDER_get_param_types(OSSL_PROVIDER *prov);
|
const OSSL_PARAM *OSSL_PROVIDER_get_param_types(OSSL_PROVIDER *prov);
|
||||||
int OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
int OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
||||||
|
|
||||||
int OSSL_PROVIDER_add_builtin(OPENSSL_CTX *, const char *name,
|
int OSSL_PROVIDER_add_builtin(OPENSSL_CTX *, const char *name,
|
||||||
|
@ -50,11 +50,8 @@ For a provider added with OSSL_PROVIDER_add_builtin(), this simply
|
||||||
runs its teardown function.
|
runs its teardown function.
|
||||||
|
|
||||||
OSSL_PROVIDER_get_param_types() is used to get a provider parameter
|
OSSL_PROVIDER_get_param_types() is used to get a provider parameter
|
||||||
descriptor set as an B<OSSL_ITEM> array.
|
descriptor set as a constant B<OSSL_PARAM> array.
|
||||||
Each element is a tuple of an B<OSSL_PARAM> parameter type and a name
|
See L<OSSL_PARAM(3)> for more information.
|
||||||
in form of a C string.
|
|
||||||
See L<openssl-core.h(7)> for more information on B<OSSL_ITEM> and
|
|
||||||
parameter types.
|
|
||||||
|
|
||||||
OSSL_PROVIDER_get_params() is used to get provider parameter values.
|
OSSL_PROVIDER_get_params() is used to get provider parameter values.
|
||||||
The caller must prepare the B<OSSL_PARAM> array before calling this
|
The caller must prepare the B<OSSL_PARAM> array before calling this
|
||||||
|
@ -72,8 +69,8 @@ success, or B<NULL> on error.
|
||||||
|
|
||||||
OSSL_PROVIDER_unload() returns 1 on success, or 0 on error.
|
OSSL_PROVIDER_unload() returns 1 on success, or 0 on error.
|
||||||
|
|
||||||
OSSL_PROVIDER_get_param_types() returns a pointer to a constant array
|
OSSL_PROVIDER_get_param_types() returns a pointer to an array
|
||||||
of B<OSSL_ITEM>, or NULL if none is provided.
|
of constant B<OSSL_PARAM>, or NULL if none is provided.
|
||||||
|
|
||||||
OSSL_PROVIDER_get_params() returns 1 on success, or 0 on error.
|
OSSL_PROVIDER_get_params() returns 1 on success, or 0 on error.
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ const char *ossl_provider_module_path(const OSSL_PROVIDER *prov);
|
||||||
|
|
||||||
/* Thin wrappers around calls to the provider */
|
/* Thin wrappers around calls to the provider */
|
||||||
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
|
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
|
||||||
const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov);
|
const OSSL_PARAM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov);
|
||||||
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
||||||
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
||||||
int operation_id,
|
int operation_id,
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct ossl_dispatch_st {
|
||||||
* tables remain tables with function pointers only.
|
* tables remain tables with function pointers only.
|
||||||
*
|
*
|
||||||
* This is used whenever we need to pass things like a table of error reason
|
* This is used whenever we need to pass things like a table of error reason
|
||||||
* codes <-> reason string maps, parameter name <-> parameter type maps, ...
|
* codes <-> reason string maps, ...
|
||||||
*
|
*
|
||||||
* Usage determines which field works as key if any, rather than field order.
|
* Usage determines which field works as key if any, rather than field order.
|
||||||
*
|
*
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
/* Functions provided by the Core to the provider, reserved numbers 1-1023 */
|
/* Functions provided by the Core to the provider, reserved numbers 1-1023 */
|
||||||
# define OSSL_FUNC_CORE_GET_PARAM_TYPES 1
|
# define OSSL_FUNC_CORE_GET_PARAM_TYPES 1
|
||||||
OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *,
|
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
|
||||||
core_get_param_types,(const OSSL_PROVIDER *prov))
|
core_get_param_types,(const OSSL_PROVIDER *prov))
|
||||||
# define OSSL_FUNC_CORE_GET_PARAMS 2
|
# define OSSL_FUNC_CORE_GET_PARAMS 2
|
||||||
OSSL_CORE_MAKE_FUNC(int,core_get_params,(const OSSL_PROVIDER *prov,
|
OSSL_CORE_MAKE_FUNC(int,core_get_params,(const OSSL_PROVIDER *prov,
|
||||||
|
@ -132,7 +132,7 @@ OSSL_CORE_MAKE_FUNC(unsigned char *,
|
||||||
# define OSSL_FUNC_PROVIDER_TEARDOWN 1024
|
# define OSSL_FUNC_PROVIDER_TEARDOWN 1024
|
||||||
OSSL_CORE_MAKE_FUNC(void,provider_teardown,(void *provctx))
|
OSSL_CORE_MAKE_FUNC(void,provider_teardown,(void *provctx))
|
||||||
# define OSSL_FUNC_PROVIDER_GET_PARAM_TYPES 1025
|
# define OSSL_FUNC_PROVIDER_GET_PARAM_TYPES 1025
|
||||||
OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *,
|
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
|
||||||
provider_get_param_types,(void *provctx))
|
provider_get_param_types,(void *provctx))
|
||||||
# define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
|
# define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
|
||||||
OSSL_CORE_MAKE_FUNC(int,provider_get_params,(void *provctx,
|
OSSL_CORE_MAKE_FUNC(int,provider_get_params,(void *provctx,
|
||||||
|
|
|
@ -20,7 +20,7 @@ extern "C" {
|
||||||
OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *, const char *name);
|
OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *, const char *name);
|
||||||
int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
|
int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
|
||||||
|
|
||||||
const OSSL_ITEM *OSSL_PROVIDER_get_param_types(const OSSL_PROVIDER *prov);
|
const OSSL_PARAM *OSSL_PROVIDER_get_param_types(const OSSL_PROVIDER *prov);
|
||||||
int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
||||||
|
|
||||||
/* Add a built in providers */
|
/* Add a built in providers */
|
||||||
|
|
|
@ -20,14 +20,14 @@ static OSSL_core_get_param_types_fn *c_get_param_types = NULL;
|
||||||
static OSSL_core_get_params_fn *c_get_params = NULL;
|
static OSSL_core_get_params_fn *c_get_params = NULL;
|
||||||
|
|
||||||
/* Parameters we provide to the core */
|
/* Parameters we provide to the core */
|
||||||
static const OSSL_ITEM deflt_param_types[] = {
|
static const OSSL_PARAM deflt_param_types[] = {
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_NAME },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_VERSION },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_BUILDINFO },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ 0, NULL }
|
OSSL_PARAM_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const OSSL_ITEM *deflt_get_param_types(const OSSL_PROVIDER *prov)
|
static const OSSL_PARAM *deflt_get_param_types(const OSSL_PROVIDER *prov)
|
||||||
{
|
{
|
||||||
return deflt_param_types;
|
return deflt_param_types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,11 @@ static const OPENSSL_CTX_METHOD fips_prov_ossl_ctx_method = {
|
||||||
|
|
||||||
|
|
||||||
/* Parameters we provide to the core */
|
/* Parameters we provide to the core */
|
||||||
static const OSSL_ITEM fips_param_types[] = {
|
static const OSSL_PARAM fips_param_types[] = {
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_NAME },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_VERSION },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_BUILDINFO },
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
||||||
{ 0, NULL }
|
OSSL_PARAM_END
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO(3.0): To be removed */
|
/* TODO(3.0): To be removed */
|
||||||
|
@ -149,7 +149,7 @@ static int dummy_evp_call(void *provctx)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const OSSL_ITEM *fips_get_param_types(const OSSL_PROVIDER *prov)
|
static const OSSL_PARAM *fips_get_param_types(const OSSL_PROVIDER *prov)
|
||||||
{
|
{
|
||||||
return fips_param_types;
|
return fips_param_types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,16 @@ static OSSL_core_get_param_types_fn *c_get_param_types = NULL;
|
||||||
static OSSL_core_get_params_fn *c_get_params = NULL;
|
static OSSL_core_get_params_fn *c_get_params = NULL;
|
||||||
|
|
||||||
/* Tell the core what params we provide and what type they are */
|
/* Tell the core what params we provide and what type they are */
|
||||||
static const OSSL_ITEM p_param_types[] = {
|
static const OSSL_PARAM p_param_types[] = {
|
||||||
{ OSSL_PARAM_UTF8_STRING, "greeting" },
|
{ "greeting", OSSL_PARAM_UTF8_STRING, NULL, 0, 0 },
|
||||||
{ 0, NULL }
|
{ NULL, 0, NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is a trick to ensure we define the provider functions correctly */
|
/* This is a trick to ensure we define the provider functions correctly */
|
||||||
static OSSL_provider_get_param_types_fn p_get_param_types;
|
static OSSL_provider_get_param_types_fn p_get_param_types;
|
||||||
static OSSL_provider_get_params_fn p_get_params;
|
static OSSL_provider_get_params_fn p_get_params;
|
||||||
|
|
||||||
static const OSSL_ITEM *p_get_param_types(void *_)
|
static const OSSL_PARAM *p_get_param_types(void *_)
|
||||||
{
|
{
|
||||||
return p_param_types;
|
return p_param_types;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue