Make OCSP_id_cmp and OCSP_id_issuer_cmp accept const params
[openssl.git] / doc / man3 / OSSL_PARAM.pod
index 9d4748637cbcdb4c097ebc9bfac7408f6b8a1f50..50089b4d50ed5cfc9e5c8a75c91b0b200fd951ac 100644 (file)
@@ -11,9 +11,9 @@ OSSL_PARAM - a structure to pass or request object parameters
  typedef struct ossl_param_st OSSL_PARAM;
  struct ossl_param_st {
      const char *key;             /* the name of the parameter */
-     unsigned char data_type;     /* declare what kind of content is in buffer */
-     void *buffer;                /* value being passed in or out */
-     size_t buffer_size;          /* buffer size */
+     unsigned char data_type;     /* declare what kind of content is in data */
+     void *data;                  /* value being passed in or out */
+     size_t data_size;            /* data size */
      size_t *return_size;         /* OPTIONAL: address to content size */
  };
 
@@ -45,8 +45,8 @@ Request parameters of some object.
 The caller (the I<requestor>) sets up the C<OSSL_PARAM> array and
 calls some function (the I<responder>) that has intimate knowledge
 about the object, which can take the internal data of the object and
-copy (possibly convert) that to the buffers prepared by the
-I<requestor>.
+copy (possibly convert) that to the memory prepared by the
+I<requestor> and pointed at with the C<OSSL_PARAM> C<data>.
 
 =back
 
@@ -69,13 +69,13 @@ The C<data_type> is a value that describes the type and organization of
 the data.
 See L</Supported types> below for a description of the types.
 
-=item C<buffer>
+=item C<data>
 
-=item C<buffer_size>
+=item C<data_size>
 
-C<buffer> is a pointer to the memory where the parameter data is (when
+C<data> is a pointer to the memory where the parameter data is (when
 setting parameters) or shall (when requesting parameters) be stored,
-and C<buffer_size> is its size in bytes.
+and C<data_size> is its size in bytes.
 The organization of the data depends on the parameter type and flag.
 
 =item C<return_size>
@@ -83,9 +83,8 @@ The organization of the data depends on the parameter type and flag.
 When an array of C<OSSL_PARAM> is used to request data, the
 I<responder> must set this field to indicate the actual size of the
 parameter data.
-In case the C<buffer_size> is too small for the data, the I<responder>
-must still set this field to indicate the minimum buffer size
-required.
+In case the C<data_size> is too small for the data, the I<responder>
+must still set this field to indicate the minimum data size required.
 
 =back
 
@@ -119,8 +118,6 @@ systems.
 
 =item C<OSSL_PARAM_REAL>
 
-=for comment It's still debated if we need this or not.
-
 The parameter data is a floating point value in native form.
 
 =item C<OSSL_PARAM_UTF8_STRING>
@@ -131,47 +128,50 @@ The parameter data is a printable string.
 
 The parameter data is an arbitrary string of bytes.
 
-=back
-
-Additionally, this flag can be added to any type:
+=item C<OSSL_PARAM_UTF8_PTR>
 
-=over 4
-
-=item C<OSSL_PARAM_POINTER_FLAG>
+The parameter data is a pointer to a printable string.
 
-With this flag, C<buffer> doesn't point directly at the data, but at a
-pointer that points at the data.
+The difference between this and C<OSSL_PARAM_UTF8_STRING> is that C<data>
+doesn't point directly at the data, but to a pointer that points to the data.
 
-This can be used to indicate that constant data is or will be passed,
+This is used to indicate that constant data is or will be passed,
 and there is therefore no need to copy the data that is passed, just
 the pointer to it.
 
-If an C<OSSL_PARAM> with this flag set is used to set a parameter,
-C<buffer_size> must be set to the size of the data, not the size of
-the pointer to the data.
-
-If this C<OSSL_PARAM> is used in a parameter request, C<buffer_size>
-is not relevant.
-However, the I<responder> will set C<*return_size> to the size of the
-data (again, not the size of the pointer to the data).
+C<data_size> must be set to the size of the data, not the size of the
+pointer to the data.
+If this is used in a parameter request,
+C<data_size> is not relevant.  However, the I<responder> will set
+C<*return_size> to the size of the data.
 
-Note that the use of this flag is B<fragile> and can only be safely
+Note that the use of this type is B<fragile> and can only be safely
 used for data that remains constant and in a constant location for a
 long enough duration (such as the life-time of the entity that
 offers these parameters).
 
-=back
+=item C<OSSL_PARAM_OCTET_PTR>
 
-For convenience, these types are provided:
+The parameter data is a pointer to an arbitrary string of bytes.
 
-=over 4
+The difference between this and C<OSSL_PARAM_OCTET_STRING> is that
+C<data> doesn't point directly at the data, but to a pointer that
+points to the data.
 
-=item C<OSSL_PARAM_UTF8_STRING_PTR>
+This is used to indicate that constant data is or will be passed, and
+there is therefore no need to copy the data that is passed, just the
+pointer to it.
 
-=item C<OSSL_PARAM_OCTET_STRING_PTR>
+C<data_size> must be set to the size of the data, not the size of the
+pointer to the data.
+If this is used in a parameter request,
+C<data_size> is not relevant.  However, the I<responder> will set
+C<*return_size> to the size of the data.
 
-These are combinations of C<OSSL_PARAM_UTF8_STRING> as well as
-C<OSSL_PARAM_OCTET_STRING> with C<OSSL_PARAM_POINTER_FLAG>.
+Note that the use of this type is B<fragile> and can only be safely
+used for data that remains constant and in a constant location for a
+long enough duration (such as the life-time of the entity that
+offers these parameters).
 
 =back
 
@@ -197,7 +197,7 @@ enough set of data, that call should succeed.
 =item *
 
 A I<responder> must never change the fields of an C<OSSL_PARAM>, it
-may only change the contents of the buffers that C<buffer> and
+may only change the contents of the memory that C<data> and
 C<return_size> point at.
 
 =item *
@@ -213,7 +213,7 @@ C<OSSL_PARAM_OCTET_STRING>), but this is in no way mandatory.
 
 =item *
 
-If a I<responder> finds that some buffers are too small for the
+If a I<responder> finds that some data sizes are too small for the
 requested data, it must set C<*return_size> for each such
 C<OSSL_PARAM> item to the required size, and eventually return an
 error.
@@ -273,10 +273,10 @@ could fill in the parameters like this:
 
     for (i = 0; params[i].key != NULL; i++) {
         if (strcmp(params[i].key, "foo") == 0) {
-            *(char **)params[i].buffer = "foo value";
+            *(char **)params[i].data = "foo value";
             *params[i].return_size = 10; /* size of "foo value" */
         } else if (strcmp(params[i].key, "bar") == 0) {
-            memcpy(params[1].buffer, "bar value", 10);
+            memcpy(params[1].data, "bar value", 10);
             *params[1].return_size = 10; /* size of "bar value" */
         }
         /* Ignore stuff we don't know */
@@ -284,7 +284,7 @@ could fill in the parameters like this:
 
 =head1 SEE ALSO
 
-L<openssl-core.h(7)>
+L<openssl-core.h(7)>, L<OSSL_PARAM_get_int32_t(3)>
 
 =head1 HISTORY