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 */
};
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
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>
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
=item C<OSSL_PARAM_POINTER_FLAG>
-With this flag, C<buffer> doesn't point directly at the data, but at a
+With this flag, C<data> doesn't point directly at the data, but at a
pointer that points at the data.
This can be used to indicate that constant data is or will be passed,
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
+C<data_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>
+If this C<OSSL_PARAM> 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 (again, not the size of the pointer to the data).
=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 *
=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.
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 */
size_t buf_l;
if (c_get_params(prov, counter_request)) {
- const char *versionp = *(void **)counter_request[0].buffer;
- const char *namep = *(void **)counter_request[1].buffer;
+ const char *versionp = *(void **)counter_request[0].data;
+ const char *namep = *(void **)counter_request[1].data;
sprintf(buf, "Hello OpenSSL %.20s, greetings from %s!",
versionp, namep);
} else {
}
*p->return_size = buf_l = strlen(buf) + 1;
- if (p->buffer_size >= buf_l)
- strncpy(p->buffer, buf, buf_l);
+ if (p->data_size >= buf_l)
+ strncpy(p->data, buf, buf_l);
else
ok = 0;
}