Make doc/man7/ and doc/internal/man3/ conform with man-pages(7)
[openssl.git] / doc / internal / man3 / ossl_param_bld_init.pod
index ca206c7628a9ecf508493414682257bbc110e052..2eb838d9a9babe4a31af68d8316f76fbd6109561 100644 (file)
@@ -2,45 +2,46 @@
 
 =head1 NAME
 
-ossl_param_build_init,
-ossl_param_build_to_param, ossl_param_build_push_int,
-ossl_param_build_push_uint, ossl_param_build_push_long,
-ossl_param_build_push_ulong, ossl_param_build_push_int32,
-ossl_param_build_push_uint32, ossl_param_build_push_int64,
-ossl_param_build_push_uint64, ossl_param_build_push_size_t,
-ossl_param_build_push_double, ossl_param_build_push_BN,
-ossl_param_build_push_utf8_string, ossl_param_build_push_utf8_ptr,
-ossl_param_build_push_octet_string, ossl_param_build_push_octet_ptr
+ossl_param_bld_init, ossl_param_bld_to_param, ossl_param_bld_to_param_ex,
+ossl_param_bld_free, ossl_param_bld_push_int, ossl_param_bld_push_uint,
+ossl_param_bld_push_long, ossl_param_bld_push_ulong,
+ossl_param_bld_push_int32, ossl_param_bld_push_uint32,
+ossl_param_bld_push_int64, ossl_param_bld_push_uint64,
+ossl_param_bld_push_size_t, ossl_param_bld_push_double,
+ossl_param_bld_push_BN, ossl_param_bld_push_utf8_string,
+ossl_param_bld_push_utf8_ptr, ossl_param_bld_push_octet_string,
+ossl_param_bld_push_octet_ptr
 - functions to assist in the creation of OSSL_PARAM arrays
 
 =head1 SYNOPSIS
 
 =for comment generic
 
- #include "internal/params_template.h"
+ #include "internal/params_build.h"
 
  #define OSSL_PARAM_BLD_MAX 10
  typedef struct { ... } OSSL_PARAM_BLD;
 
- void ossl_param_build_init(OSSL_PARAM_BLD *bld);
- OSSL_PARAM *ossl_param_build_to_param(OSSL_PARAM_BLD *bld, void **secure);
- OSSL_PARAM *ossl_param_build_to_param_ex(OSSL_PARAM_BLD *bld,
+ void ossl_param_bld_init(OSSL_PARAM_BLD *bld);
+ OSSL_PARAM *ossl_param_bld_to_param(OSSL_PARAM_BLD *bld);
+ OSSL_PARAM *ossl_param_bld_to_param_ex(OSSL_PARAM_BLD *bld,
                                         OSSL_PARAM *params, size_t param_n,
                                         void *data, size_t data_n,
                                         void *secure, size_t secure_n);
+ void ossl_param_bld_free(OSSL_PARAM *params);
 
- int ossl_param_build_push_TYPE(OSSL_PARAM_BLD *bld, const char *key, TYPE val);
+ int ossl_param_bld_push_TYPE(OSSL_PARAM_BLD *bld, const char *key, TYPE val);
 
- int ossl_param_build_push_BN(OSSL_PARAM_BLD *bld, const char *key,
+ int ossl_param_bld_push_BN(OSSL_PARAM_BLD *bld, const char *key,
                             const BIGNUM *bn);
 
- int ossl_param_build_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key,
-                                     char *buf, size_t bsize);
- int ossl_param_build_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key,
+ int ossl_param_bld_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key,
+                                     const char *buf, size_t bsize);
+ int ossl_param_bld_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key,
                                   char *buf, size_t bsize);
- int ossl_param_build_push_octet_string(OSSL_PARAM_BLD *bld, const char *key,
-                                      void *buf, size_t bsize);
- int ossl_param_build_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key,
+ int ossl_param_bld_push_octet_string(OSSL_PARAM_BLD *bld, const char *key,
+                                      const void *buf, size_t bsize);
+ int ossl_param_bld_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key,
                                    void *buf, size_t bsize);
 
 
@@ -49,66 +50,66 @@ ossl_param_build_push_octet_string, ossl_param_build_push_octet_ptr
 A collection of utility functions that simplify the creation of OSSL_PARAM
 arrays.  The B<TYPE> names are as per L<OSSL_PARAM_int(3)>.
 
-ossl_param_build_init() initialises the OSSL_PARAM_BLD structure so that values
+ossl_param_bld_init() initialises the OSSL_PARAM_BLD structure so that values
 can be added.
 Any existing values are cleared.
 
-ossl_param_build_to_param() converts a built up OSSL_PARAM_BLD structure
-B<bld> into an allocated OSSL_PARAM array.
-The pointer referenced by the B<secure> argument is set to point to an
-allocated block of secure memory if required and to NULL it not. 
-The OSSL_PARAM array and all associated storage can be freed by calling
-OPENSSL_free() with the functions return value and OPENSSL_secure_free()
-with the pointer referenced by B<secure>.
+ossl_param_bld_to_param() converts a built up OSSL_PARAM_BLD structure
+I<bld> into an allocated OSSL_PARAM array.
+The OSSL_PARAM array and all associated storage must be freed by calling
+ossl_param_bld_free() with the functions return value.
 
-ossl_param_build_to_param_ex() behaves like ossl_param_build_to_param(), except that
+ossl_param_bld_free() deallocates the memory allocated by
+ossl_param_bld_to_param().
+
+ossl_param_bld_to_param_ex() behaves like ossl_param_bld_to_param(), except that
 no additional memory is allocated.
-An OSSL_PARAM array of at least B<param_n> elements is passed in as B<params>.
+An OSSL_PARAM array of at least I<param_n> elements is passed in as I<params>.
 The auxiliary storage for the parameters is a block of memory pointed to
-by B<data> of at least B<data_n> bytes in size.
+by I<data> of at least I<data_n> bytes in size.
 If required, secure memory for private BIGNUMs should be pointed to by
-B<secure> of at least B<secure_n> bytes in size.
+I<secure> of at least I<secure_n> bytes in size.
 
-ossl_param_build_push_TYPE() are a series of functions which will create
-OSSL_PARAM objects of the specified size and correct type for the B<val>
+ossl_param_bld_push_TYPE() are a series of functions which will create
+OSSL_PARAM objects of the specified size and correct type for the I<val>
 argument.
-B<val> is stored by value and an expression or auto variable can be used.
-
-ossl_param_build_push_BN() is a function that will create an OSSL_PARAM object
-that holds the specified BIGNUM B<bn>.
-If B<bn> is marked as being securely allocated, the secure flag is
-set in the OSSL_PARAM_BLD structure.
-The B<bn> argument is stored by reference and the underlying BIGNUM object
-must exist until after ossl_param_build_to_param() has been called.
-
-ossl_param_build_push_utf8_string() is a function that will create an OSSL_PARAM
-object that references the UTF8 string specified by B<buf>.
-If the length of the string, B<bsize>, is zero then it will be calculated.
-The string that B<buf> points to is stored by reference and must remain in
-scope until after ossl_param_build_to_param() has been called.
-
-ossl_param_build_push_octet_string() is a function that will create an OSSL_PARAM
-object that references the octet string specified by B<buf> and <bsize>.
-The memory that B<buf> points to is stored by reference and must remain in
-scope until after ossl_param_build_to_param() has been called.
-
-ossl_param_build_push_utf8_ptr() is a function that will create an OSSL_PARAM
-object that references the UTF8 string specified by B<buf>.
-If the length of the string, B<bsize>, is zero then it will be calculated.
-The string B<buf> points to is stored by reference and must remain in
+I<val> is stored by value and an expression or auto variable can be used.
+
+ossl_param_bld_push_BN() is a function that will create an OSSL_PARAM object
+that holds the specified BIGNUM I<bn>.
+If I<bn> is marked as being securely allocated, it's OSSL_PARAM representation
+will also be securely allocated.
+The I<bn> argument is stored by reference and the underlying BIGNUM object
+must exist until after ossl_param_bld_to_param() has been called.
+
+ossl_param_bld_push_utf8_string() is a function that will create an OSSL_PARAM
+object that references the UTF8 string specified by I<buf>.
+If the length of the string, I<bsize>, is zero then it will be calculated.
+The string that I<buf> points to is stored by reference and must remain in
+scope until after ossl_param_bld_to_param() has been called.
+
+ossl_param_bld_push_octet_string() is a function that will create an OSSL_PARAM
+object that references the octet string specified by I<buf> and <bsize>.
+The memory that I<buf> points to is stored by reference and must remain in
+scope until after ossl_param_bld_to_param() has been called.
+
+ossl_param_bld_push_utf8_ptr() is a function that will create an OSSL_PARAM
+object that references the UTF8 string specified by I<buf>.
+If the length of the string, I<bsize>, is zero then it will be calculated.
+The string I<buf> points to is stored by reference and must remain in
 scope until the OSSL_PARAM array is freed.
 
-ossl_param_build_push_octet_ptr() is a function that will create an OSSL_PARAM
-object that references the octet string specified by B<buf>.
-The memory B<buf> points to is stored by reference and must remain in
+ossl_param_bld_push_octet_ptr() is a function that will create an OSSL_PARAM
+object that references the octet string specified by I<buf>.
+The memory I<buf> points to is stored by reference and must remain in
 scope until the OSSL_PARAM array is freed.
 
 =head1 RETURN VALUES
 
-ossl_param_build_to_param() and ossl_param_bld_to_param_ex() return the
+ossl_param_bld_to_param() and ossl_param_bld_to_param_ex() return the
 allocated OSSL_PARAM array, or NULL on error.
 
-All of the ossl_param_build_push_TYPE functions return 1 on success and 0
+All of the ossl_param_bld_push_TYPE functions return 1 on success and 0
 on error.
 
 =head1 NOTES
@@ -137,20 +138,18 @@ private key.
 
     OSSL_PARAM_BLD bld;
     OSSL_PARAM *params;
-    void *secure;
-
-    ossl_param_build_init(&bld, &secure);
-    if (!ossl_param_build_push_BN(&bld, "p", p)
-        || !ossl_param_build_push_BN(&bld, "q", q)
-        || !ossl_param_build_push_uint(&bld, "e", e)
-        || !ossl_param_build_push_BN(&bld, "n", n)
-        || !ossl_param_build_push_BN(&bld, "d", d)
-        || (params = ossl_param_build_to_param(&bld)) == NULL)
+
+    ossl_param_bld_init(&bld, &secure);
+    if (!ossl_param_bld_push_BN(&bld, "p", p)
+        || !ossl_param_bld_push_BN(&bld, "q", q)
+        || !ossl_param_bld_push_uint(&bld, "e", e)
+        || !ossl_param_bld_push_BN(&bld, "n", n)
+        || !ossl_param_bld_push_BN(&bld, "d", d)
+        || (params = ossl_param_bld_to_param(&bld)) == NULL)
         goto err;
     /* Use params */
     ...
-    OPENSSL_free(params);
-    OPENSSL_secure_free(secure);
+    ossl_param_bld_free(params);
 
 =head2 Example 2
 
@@ -159,17 +158,15 @@ public key.
 
     OSSL_PARAM_BLD bld;
     OSSL_PARAM *params;
-    void *secure;
 
-    ossl_param_build_init(&bld, &secure);
-    if (!ossl_param_build_push_BN(&bld, "n", n)
-        || !ossl_param_build_push_BN(&bld, "d", d)
-        || (params = ossl_param_build_to_param(&bld)) == NULL)
+    ossl_param_bld_init(&bld, &secure);
+    if (!ossl_param_bld_push_BN(&bld, "n", n)
+        || !ossl_param_bld_push_BN(&bld, "d", d)
+        || (params = ossl_param_bld_to_param(&bld)) == NULL)
         goto err;
     /* Use params */
     ...
-    OPENSSL_free(params);
-    OPENSSL_secure_free(secure);
+    ossl_param_bld_free(params);
 
 =head1 SEE ALSO