From: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Date: Tue, 7 Jun 2022 06:28:26 +0000 (+0200) Subject: Fix for OSSL_PARAM sample code referencing OSSL_PARAM_UTF8_PTR X-Git-Tag: openssl-3.2.0-alpha1~2521 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=809526a06c1305d67a8f231ca15cd27ec800efce;p=thirdparty%2Fopenssl.git Fix for OSSL_PARAM sample code referencing OSSL_PARAM_UTF8_PTR Reviewed-by: Paul Dale Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18490) --- diff --git a/doc/man3/OSSL_PARAM.pod b/doc/man3/OSSL_PARAM.pod index 1368a679b19..db669c28ead 100644 --- a/doc/man3/OSSL_PARAM.pod +++ b/doc/man3/OSSL_PARAM.pod @@ -309,8 +309,8 @@ This example is for setting parameters on some object: size_t foo_l = strlen(foo); const char bar[] = "some other string"; OSSL_PARAM set[] = { - { "foo", OSSL_PARAM_UTF8_STRING_PTR, &foo, foo_l, 0 }, - { "bar", OSSL_PARAM_UTF8_STRING, &bar, sizeof(bar) - 1, 0 }, + { "foo", OSSL_PARAM_UTF8_PTR, &foo, foo_l, 0 }, + { "bar", OSSL_PARAM_UTF8_STRING, (void *)&bar, sizeof(bar) - 1, 0 }, { NULL, 0, NULL, 0, 0 } }; @@ -323,7 +323,7 @@ This example is for requesting parameters on some object: char bar[1024]; size_t bar_l; OSSL_PARAM request[] = { - { "foo", OSSL_PARAM_UTF8_STRING_PTR, &foo, 0 /*irrelevant*/, 0 }, + { "foo", OSSL_PARAM_UTF8_PTR, &foo, 0 /*irrelevant*/, 0 }, { "bar", OSSL_PARAM_UTF8_STRING, &bar, sizeof(bar), 0 }, { NULL, 0, NULL, 0, 0 } }; diff --git a/doc/man3/OSSL_PROVIDER.pod b/doc/man3/OSSL_PROVIDER.pod index bc4cc1641ea..7be2e9a5dfa 100644 --- a/doc/man3/OSSL_PROVIDER.pod +++ b/doc/man3/OSSL_PROVIDER.pod @@ -184,19 +184,22 @@ OSSL_PROVIDER_self_test() returns 1 if the self tests pass, or 0 on error. =head1 EXAMPLES This demonstrates how to load the provider module "foo" and ask for -its build number. +its build information. + + #include + #include + #include OSSL_PROVIDER *prov = NULL; const char *build = NULL; - size_t built_l = 0; OSSL_PARAM request[] = { - { "build", OSSL_PARAM_UTF8_STRING_PTR, &build, 0, &build_l }, - { NULL, 0, NULL, 0, NULL } + { "buildinfo", OSSL_PARAM_UTF8_PTR, &build, 0, 0 }, + { NULL, 0, NULL, 0, 0 } }; if ((prov = OSSL_PROVIDER_load(NULL, "foo")) != NULL && OSSL_PROVIDER_get_params(prov, request)) - printf("Provider 'foo' build %s\n", build); + printf("Provider 'foo' buildinfo: %s\n", build); else ERR_print_errors_fp(stderr); diff --git a/doc/man7/provider-base.pod b/doc/man7/provider-base.pod index 3bbab816f99..af8baf6dc96 100644 --- a/doc/man7/provider-base.pod +++ b/doc/man7/provider-base.pod @@ -416,17 +416,17 @@ provider_get_params() can return the following provider parameters to the core: =over 4 -=item "name" (B) +=item "name" (B) This points to a string that should give a unique name for the provider. -=item "version" (B) +=item "version" (B) This points to a string that is a version number associated with this provider. OpenSSL in-built providers use OPENSSL_VERSION_STR, but this may be different for any third party provider. This string is for informational purposes only. -=item "buildinfo" (B) +=item "buildinfo" (B) This points to a string that is a build information associated with this provider. OpenSSL in-built providers use OPENSSL_FULL_VERSION_STR, but this may be diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index 78418dc6e0a..9cd8f220cce 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -21,9 +21,9 @@ extern "C" { #define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename" /* utf8_ptr */ /* Well known parameter names that Providers can define */ -#define OSSL_PROV_PARAM_NAME "name" /* utf8_string */ -#define OSSL_PROV_PARAM_VERSION "version" /* utf8_string */ -#define OSSL_PROV_PARAM_BUILDINFO "buildinfo" /* utf8_string */ +#define OSSL_PROV_PARAM_NAME "name" /* utf8_ptr */ +#define OSSL_PROV_PARAM_VERSION "version" /* utf8_ptr */ +#define OSSL_PROV_PARAM_BUILDINFO "buildinfo" /* utf8_ptr */ #define OSSL_PROV_PARAM_STATUS "status" /* uint */ #define OSSL_PROV_PARAM_SECURITY_CHECKS "security-checks" /* uint */