Standard preamble:
========================================================================
..
.... 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 -- \(*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\} . 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.
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'.
.. .nr rF 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 . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . 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 . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . 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 .\} ========================================================================
Title "PROVIDER-ENCODER 7ossl"
way too many mistakes in technical documents.
The \s-1ENCODER\s0 operation is a generic method to encode a provider-native object (obj_raw) or an object abstraction (object_abstract, see \fBprovider-object\|(7)) into an encoded form, and write the result to the given \s-1OSSL_CORE_BIO.\s0 If the caller wants to get the encoded stream to memory, it should provide a BIO_s_mem\|(3) \s-1BIO\s0.
The encoder doesn't need to know more about the \s-1OSSL_CORE_BIO\s0 pointer than being able to pass it to the appropriate \s-1BIO\s0 upcalls (see \*(L"Core functions\*(R" in provider-base\|(7)).
The \s-1ENCODER\s0 implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to encode an object to \s-1DER\s0 (that object is assumed to be provider-native and thereby passed via obj_raw), and another one that encodes \s-1DER\s0 to \s-1PEM\s0 (that one would receive the \s-1DER\s0 encoding via \fIobj_abstract).
The encoding using the \s-1OSSL_PARAM\s0\|(3) array form allows a encoder to be used for data that's been exported from another provider, and thereby allow them to exist independently of each other.
The encoding using a provider side object can only be safely used with provider data coming from the same provider, for example keys with the \s-1KEYMGMT\s0 provider.
All \*(L"functions\*(R" mentioned here are passed as function pointers between \fIlibcrypto and the provider in \s-1OSSL_DISPATCH\s0\|(3) arrays via \s-1OSSL_ALGORITHM\s0\|(3) arrays that are returned by the provider's \fBprovider_query_operation() function (see \*(L"Provider Functions\*(R" in provider-base\|(7)).
All these \*(L"functions\*(R" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an \s-1OSSL_DISPATCH\s0\|(3) element named \fBOSSL_FUNC_{name}. For example, the \*(L"function\*(R" OSSL_FUNC_encoder_encode() has these:
.Vb 8 typedef int (OSSL_FUNC_encoder_encode_fn)(void *ctx, OSSL_CORE_BIO *out, const void *obj_raw, const OSSL_PARAM obj_abstract[], int selection, OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg); static ossl_inline OSSL_FUNC_encoder_encode_fn OSSL_FUNC_encoder_encode(const OSSL_DISPATCH *opf); .Ve
\s-1OSSL_DISPATCH\s0\|(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h\|(7), as follows:
.Vb 2 OSSL_FUNC_encoder_get_params OSSL_FUNC_ENCODER_GET_PARAMS OSSL_FUNC_encoder_gettable_params OSSL_FUNC_ENCODER_GETTABLE_PARAMS \& OSSL_FUNC_encoder_newctx OSSL_FUNC_ENCODER_NEWCTX OSSL_FUNC_encoder_freectx OSSL_FUNC_ENCODER_FREECTX OSSL_FUNC_encoder_set_ctx_params OSSL_FUNC_ENCODER_SET_CTX_PARAMS OSSL_FUNC_encoder_settable_ctx_params OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS \& OSSL_FUNC_encoder_does_selection OSSL_FUNC_ENCODER_DOES_SELECTION \& OSSL_FUNC_encoder_encode OSSL_FUNC_ENCODER_ENCODE \& OSSL_FUNC_encoder_import_object OSSL_FUNC_ENCODER_IMPORT_OBJECT OSSL_FUNC_encoder_free_object OSSL_FUNC_ENCODER_FREE_OBJECT .Ve
Properties can be used to further specify details about an implementation:
The possible values of both these properties is open ended. A provider may very well specify output types and structures that libcrypto doesn't know anything about.
This set of bits depend entirely on what kind of provider-side object is passed. For example, those bits are assumed to be the same as those used with provider-keymgmt\|(7) (see \*(L"Key Objects\*(R" in provider-keymgmt\|(7)) when the object is an asymmetric keypair.
\s-1ENCODER\s0 implementations are free to regard the selection as a set of hints, but must do so with care. In the end, the output must make sense, and if there's a corresponding decoder, the resulting decoded object must match the original object that was encoded.
\fBOSSL_FUNC_encoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.
\fBOSSL_FUNC_encoder_freectx() frees the given ctx, if it was created by \fBOSSL_FUNC_encoder_newctx().
\fBOSSL_FUNC_encoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing \s-1NULL\s0 for params should return true.
\fBOSSL_FUNC_encoder_settable_ctx_params() returns a constant \s-1OSSL_PARAM\s0\|(3) array describing the parameters that OSSL_FUNC_encoder_set_ctx_params() can handle.
See \s-1OSSL_PARAM\s0\|(3) for further details on the parameters structure used by \fBOSSL_FUNC_encoder_set_ctx_params() and OSSL_FUNC_encoder_settable_ctx_params().
\fBOSSL_FUNC_encoder_import_object() should import the subset of params given with selection to create a provider-native object that can be passed as obj_raw to OSSL_FUNC_encoder_encode().
\fBOSSL_FUNC_encoder_free_object() should free the object that was created with \fBOSSL_FUNC_encoder_import_object().
Parameters currently recognised by the built-in pass phrase callback: Item "info (OSSL_PASSPHRASE_PARAM_INFO) <UTF8 string>" A string of information that will become part of the pass phrase prompt. This could be used to give the user information on what kind of object it's being prompted for.
\fBOSSL_FUNC_encoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.
\fBOSSL_FUNC_encoder_settable_ctx_params() returns a pointer to an array of constant \s-1OSSL_PARAM\s0\|(3) elements.
\fBOSSL_FUNC_encoder_does_selection() returns 1 if the encoder implementation supports any of the selection bits, otherwise 0.
\fBOSSL_FUNC_encoder_encode() returns 1 on success, or 0 on failure.
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>.