aboutsummaryrefslogtreecommitdiff
path: root/secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3
diff options
context:
space:
mode:
Diffstat (limited to 'secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3')
-rw-r--r--secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3323
1 files changed, 323 insertions, 0 deletions
diff --git a/secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3 b/secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3
new file mode 100644
index 000000000000..c5fabb2a87dd
--- /dev/null
+++ b/secure/lib/libcrypto/man/man3/OSSL_PARAM_BLD.3
@@ -0,0 +1,323 @@
+.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+. ds C`
+. ds C'
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is >0, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.\"
+.\" Avoid warning from groff about undefined register 'F'.
+.de IX
+..
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{\
+. if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. if !\nF==2 \{\
+. nr % 0
+. nr F 2
+. \}
+. \}
+.\}
+.rr rF
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "OSSL_PARAM_BLD 3ossl"
+.TH OSSL_PARAM_BLD 3ossl "2023-09-19" "3.0.11" "OpenSSL"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+OSSL_PARAM_BLD, OSSL_PARAM_BLD_new, OSSL_PARAM_BLD_to_param,
+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_time_t, OSSL_PARAM_BLD_push_double,
+OSSL_PARAM_BLD_push_BN, OSSL_PARAM_BLD_push_BN_pad,
+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
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+.Vb 1
+\& #include <openssl/param_build.h>
+\&
+\& typedef struct OSSL_PARAM_BLD;
+\&
+\& OSSL_PARAM_BLD *OSSL_PARAM_BLD_new(void);
+\& OSSL_PARAM *OSSL_PARAM_BLD_to_param(OSSL_PARAM_BLD *bld);
+\& void OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld);
+\&
+\& int OSSL_PARAM_BLD_push_TYPE(OSSL_PARAM_BLD *bld, const char *key, TYPE val);
+\&
+\& int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key,
+\& const BIGNUM *bn);
+\& int OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key,
+\& const BIGNUM *bn, size_t sz);
+\&
+\& 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_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);
+.Ve
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+A collection of utility functions that simplify the creation of \s-1OSSL_PARAM\s0
+arrays. The \fB\f(BI\s-1TYPE\s0\fB\fR names are as per \fBOSSL_PARAM_int\fR\|(3).
+.PP
+\&\fBOSSL_PARAM_BLD_new()\fR allocates and initialises a new \s-1OSSL_PARAM_BLD\s0 structure
+so that values can be added.
+Any existing values are cleared.
+.PP
+\&\fBOSSL_PARAM_BLD_free()\fR deallocates the memory allocates by \fBOSSL_PARAM_BLD_new()\fR.
+.PP
+\&\fBOSSL_PARAM_BLD_to_param()\fR converts a built up \s-1OSSL_PARAM_BLD\s0 structure
+\&\fIbld\fR into an allocated \s-1OSSL_PARAM\s0 array.
+The \s-1OSSL_PARAM\s0 array and all associated storage must be freed by calling
+\&\fBOSSL_PARAM_free()\fR with the functions return value.
+\&\fBOSSL_PARAM_BLD_free()\fR can safely be called any time after this function is.
+.PP
+\&\fBOSSL_PARAM_BLD_push_\f(BI\s-1TYPE\s0\fB\fR() are a series of functions which will create
+\&\s-1OSSL_PARAM\s0 objects of the specified size and correct type for the \fIval\fR
+argument.
+\&\fIval\fR is stored by value and an expression or auto variable can be used.
+.PP
+\&\fBOSSL_PARAM_BLD_push_BN()\fR is a function that will create an \s-1OSSL_PARAM\s0 object
+that holds the specified \s-1BIGNUM\s0 \fIbn\fR.
+If \fIbn\fR is marked as being securely allocated, its \s-1OSSL_PARAM\s0 representation
+will also be securely allocated.
+The \fIbn\fR argument is stored by reference and the underlying \s-1BIGNUM\s0 object
+must exist until after \fBOSSL_PARAM_BLD_to_param()\fR has been called.
+.PP
+\&\fBOSSL_PARAM_BLD_push_BN_pad()\fR is a function that will create an \s-1OSSL_PARAM\s0 object
+that holds the specified \s-1BIGNUM\s0 \fIbn\fR.
+The object will be padded to occupy exactly \fIsz\fR bytes, if insufficient space
+is specified an error results.
+If \fIbn\fR is marked as being securely allocated, its \s-1OSSL_PARAM\s0 representation
+will also be securely allocated.
+The \fIbn\fR argument is stored by reference and the underlying \s-1BIGNUM\s0 object
+must exist until after \fBOSSL_PARAM_BLD_to_param()\fR has been called.
+.PP
+\&\fBOSSL_PARAM_BLD_push_utf8_string()\fR is a function that will create an \s-1OSSL_PARAM\s0
+object that references the \s-1UTF8\s0 string specified by \fIbuf\fR.
+The length of the string \fIbsize\fR should not include the terminating \s-1NUL\s0 byte.
+If it is zero then it will be calculated.
+The string that \fIbuf\fR points to is stored by reference and must remain in
+scope until after \fBOSSL_PARAM_BLD_to_param()\fR has been called.
+.PP
+\&\fBOSSL_PARAM_BLD_push_octet_string()\fR is a function that will create an \s-1OSSL_PARAM\s0
+object that references the octet string specified by \fIbuf\fR and <bsize>.
+The memory that \fIbuf\fR points to is stored by reference and must remain in
+scope until after \fBOSSL_PARAM_BLD_to_param()\fR has been called.
+.PP
+\&\fBOSSL_PARAM_BLD_push_utf8_ptr()\fR is a function that will create an \s-1OSSL_PARAM\s0
+object that references the \s-1UTF8\s0 string specified by \fIbuf\fR.
+The length of the string \fIbsize\fR should not include the terminating \s-1NUL\s0 byte.
+If it is zero then it will be calculated.
+The string \fIbuf\fR points to is stored by reference and must remain in
+scope until the \s-1OSSL_PARAM\s0 array is freed.
+.PP
+\&\fBOSSL_PARAM_BLD_push_octet_ptr()\fR is a function that will create an \s-1OSSL_PARAM\s0
+object that references the octet string specified by \fIbuf\fR.
+The memory \fIbuf\fR points to is stored by reference and must remain in
+scope until the \s-1OSSL_PARAM\s0 array is freed.
+.SH "RETURN VALUES"
+.IX Header "RETURN VALUES"
+\&\fBOSSL_PARAM_BLD_new()\fR returns the allocated \s-1OSSL_PARAM_BLD\s0 structure, or \s-1NULL\s0
+on error.
+.PP
+\&\fBOSSL_PARAM_BLD_to_param()\fR returns the allocated \s-1OSSL_PARAM\s0 array, or \s-1NULL\s0
+on error.
+.PP
+All of the OSSL_PARAM_BLD_push_TYPE functions return 1 on success and 0
+on error.
+.SH "NOTES"
+.IX Header "NOTES"
+\&\fBOSSL_PARAM_BLD_push_BN()\fR and \fBOSSL_PARAM_BLD_push_BN_pad()\fR currently only
+support nonnegative \fB\s-1BIGNUM\s0\fRs. They return an error on negative \fB\s-1BIGNUM\s0\fRs.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Both examples creating an \s-1OSSL_PARAM\s0 array that contains an \s-1RSA\s0 key.
+For both, the predefined key variables are:
+.PP
+.Vb 6
+\& BIGNUM *n; /* modulus */
+\& unsigned int e; /* public exponent */
+\& BIGNUM *d; /* private exponent */
+\& BIGNUM *p, *q; /* first two prime factors */
+\& BIGNUM *dmp1, *dmq1; /* first two CRT exponents */
+\& BIGNUM *iqmp; /* first CRT coefficient */
+.Ve
+.SS "Example 1"
+.IX Subsection "Example 1"
+This example shows how to create an \s-1OSSL_PARAM\s0 array that contains an \s-1RSA\s0
+private key.
+.PP
+.Vb 2
+\& OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();
+\& OSSL_PARAM *params = NULL;
+\&
+\& if (bld == NULL
+\& || !OSSL_PARAM_BLD_push_BN(bld, "n", n)
+\& || !OSSL_PARAM_BLD_push_uint(bld, "e", e)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "d", d)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "rsa\-factor1", p)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "rsa\-factor2", q)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "rsa\-exponent1", dmp1)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "rsa\-exponent2", dmq1)
+\& || !OSSL_PARAM_BLD_push_BN(bld, "rsa\-coefficient1", iqmp)
+\& || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)
+\& goto err;
+\& OSSL_PARAM_BLD_free(bld);
+\& /* Use params */
+\& ...
+\& OSSL_PARAM_free(params);
+.Ve
+.SS "Example 2"
+.IX Subsection "Example 2"
+This example shows how to create an \s-1OSSL_PARAM\s0 array that contains an \s-1RSA\s0
+public key.
+.PP
+.Vb 2
+\& OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();
+\& OSSL_PARAM *params = NULL;
+\&
+\& if (nld == NULL
+\& || !OSSL_PARAM_BLD_push_BN(bld, "n", n)
+\& || !OSSL_PARAM_BLD_push_uint(bld, "e", e)
+\& || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)
+\& goto err;
+\& OSSL_PARAM_BLD_free(bld);
+\& /* Use params */
+\& ...
+\& OSSL_PARAM_free(params);
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fBOSSL_PARAM_int\fR\|(3), \s-1\fBOSSL_PARAM\s0\fR\|(3), \fBOSSL_PARAM_free\fR\|(3)
+.SH "HISTORY"
+.IX Header "HISTORY"
+The functions described here were all added in OpenSSL 3.0.
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+Copyright 2019\-2022 The OpenSSL Project Authors. All Rights Reserved.
+.PP
+Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
+this file except in compliance with the License. You can obtain a copy
+in the file \s-1LICENSE\s0 in the source distribution or at
+<https://www.openssl.org/source/license.html>.