X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=doc%2Fman3%2FOSSL_PARAM.pod;h=044b7a5c4236352ad381389c534325de64b01e04;hp=a872de3b77e9c40dc9b763f9caa95a85a65e48be;hb=HEAD;hpb=8020d79b4033400d0ef659a361c05b6902944042 diff --git a/doc/man3/OSSL_PARAM.pod b/doc/man3/OSSL_PARAM.pod index a872de3b77..1e5bf06cf7 100644 --- a/doc/man3/OSSL_PARAM.pod +++ b/doc/man3/OSSL_PARAM.pod @@ -40,11 +40,11 @@ suitable form for the internal structure of the object. =item * Request parameters of some object -The caller (the I) sets up the B array and +The caller (the I) sets up the B array and calls some function (the I) that has intimate knowledge about the object, which can take the internal data of the object and copy (possibly convert) that to the memory prepared by the -I and pointed at with the B I. +I and pointed at with the B I. =item * Request parameter descriptors @@ -71,6 +71,12 @@ is NULL. The usual full terminating template is: This can also be specified using L. +=head2 Functional support + +Libcrypto offers a limited set of helper functions to handle +B items and arrays, please see L. +Developers are free to extend or replace those as they see fit. + =head2 B fields =over 4 @@ -102,10 +108,10 @@ B in relation to C strings. When setting parameters, the size should be set to the length of the string, not counting the terminating NUL byte. When requesting parameters, the size should be set to the size of the buffer to be populated, which -should accomodate enough space for a terminating NUL byte. +should accommodate enough space for a terminating NUL byte. When I, it's acceptable for I to be NULL. -This can be used by the I to figure out dynamically exactly +This can be used by the I to figure out dynamically exactly how much buffer space is needed to store the parameter data. In this case, I is ignored. @@ -261,6 +267,14 @@ B), but this is in no way mandatory. =item * +If I for a B or a +B is NULL, the I should +set I to the size of the item to be returned +and return success. Later the responder will be called again +with I pointing at the place for the value to be put. + +=item * + If a I finds that some data sizes are too small for the requested data, it must set I for each such B item to the minimum required size, and eventually return @@ -300,11 +314,11 @@ This example is for setting parameters on some object: #include const char *foo = "some string"; - size_t foo_l = strlen(foo) + 1; + 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), 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 } }; @@ -317,7 +331,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 } }; @@ -332,17 +346,17 @@ 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].data = "foo value"; - params[i].return_size = 10; /* size of "foo value" */ + params[i].return_size = 9; /* length of "foo value" string */ } else if (strcmp(params[i].key, "bar") == 0) { memcpy(params[i].data, "bar value", 10); - params[i].return_size = 10; /* size of "bar value" */ + params[i].return_size = 9; /* length of "bar value" string */ } /* Ignore stuff we don't know */ } =head1 SEE ALSO -L, L +L, L, L =head1 HISTORY @@ -350,7 +364,7 @@ B was added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy