Fix for OSSL_PARAM sample code referencing OSSL_PARAM_UTF8_PTR
authorMichael Baentsch <57787676+baentsch@users.noreply.github.com>
Tue, 7 Jun 2022 06:28:26 +0000 (08:28 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 16 Jun 2022 13:36:23 +0000 (15:36 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18490)

doc/man3/OSSL_PARAM.pod
doc/man3/OSSL_PROVIDER.pod
doc/man7/provider-base.pod
include/openssl/core_names.h

index 1368a679b19cbab9297de7d4df4be9689e92d53a..db669c28ead91374ac278739b77ef952648968f5 100644 (file)
@@ -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 }
     };
index bc4cc1641eaec8feefb8045f9172c9596c86159d..7be2e9a5dfa1ac544f2e820acf3f502a382fe951 100644 (file)
@@ -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 <openssl/params.h>
+ #include <openssl/provider.h>
+ #include <openssl/err.h>
 
  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);
 
index 3bbab816f9937cec8d58b73b9483acfbf926a3ab..af8baf6dc96babd7a42523009919726c27704bfc 100644 (file)
@@ -416,17 +416,17 @@ provider_get_params() can return the following provider parameters to the core:
 
 =over 4
 
-=item "name" (B<OSSL_PROV_PARAM_NAME>) <UTF8 string ptr>
+=item "name" (B<OSSL_PROV_PARAM_NAME>) <UTF8 ptr>
 
 This points to a string that should give a unique name for the provider.
 
-=item "version" (B<OSSL_PROV_PARAM_VERSION>) <UTF8 string ptr>
+=item "version" (B<OSSL_PROV_PARAM_VERSION>) <UTF8 ptr>
 
 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<OSSL_PROV_PARAM_BUILDINFO>) <UTF8 string ptr>
+=item "buildinfo" (B<OSSL_PROV_PARAM_BUILDINFO>) <UTF8 ptr>
 
 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
index 78418dc6e0a2b9547ad73911c4df34847f70e030..9cd8f220cce4b2c16d55e890d1b78d7ed4e0f32d 100644 (file)
@@ -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 */