-*- mode: troff; coding: utf-8 -*-
Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
Standard preamble:
========================================================================
..
.... \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
. ds C` "" . ds C' "" 'br\} . 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 ========================================================================
Title "PROVIDER-DECODER 7"
way too many mistakes in technical documents.
The DECODER operation is a generic method to create a provider-native object reference or intermediate decoded data from an encoded form read from the given OSSL_CORE_BIO. If the caller wants to decode data from memory, it should provide a BIO_s_mem\|(3) BIO. The decoded data or object reference is passed along with eventual metadata to the metadata_cb as OSSL_PARAM\|(3) parameters.
The decoder doesn't need to know more about the OSSL_CORE_BIO pointer than being able to pass it to the appropriate BIO upcalls (see "Core functions" in provider-base\|(7)).
The DECODER implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to decode an object from PEM to DER, and another one that decodes DER to a provider-native object.
The last decoding step in the decoding chain is usually supposed to create a provider-native object referenced by an object reference. To import that object into a different provider the OSSL_FUNC_decoder_export_object() can be called as the final step of the decoding process.
All "functions" mentioned here are passed as function pointers between \fIlibcrypto and the provider in OSSL_DISPATCH\|(3) arrays via \fBOSSL_ALGORITHM\|(3) arrays that are returned by the provider's \fBprovider_query_operation() function (see "Provider Functions" in provider-base\|(7)).
All these "functions" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH\|(3) element named \fBOSSL_FUNC_{name}. For example, the "function" OSSL_FUNC_decoder_decode() has these:
.Vb 7 typedef int (OSSL_FUNC_decoder_decode_fn)(void *ctx, OSSL_CORE_BIO *in, int selection, OSSL_CALLBACK *data_cb, void *data_cbarg, OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg); static ossl_inline OSSL_FUNC_decoder_decode_fn* OSSL_FUNC_decoder_decode(const OSSL_DISPATCH *opf); .Ve
\fBOSSL_DISPATCH\|(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h\|(7), as follows:
.Vb 2 OSSL_FUNC_decoder_get_params OSSL_FUNC_DECODER_GET_PARAMS OSSL_FUNC_decoder_gettable_params OSSL_FUNC_DECODER_GETTABLE_PARAMS \& OSSL_FUNC_decoder_newctx OSSL_FUNC_DECODER_NEWCTX OSSL_FUNC_decoder_freectx OSSL_FUNC_DECODER_FREECTX OSSL_FUNC_decoder_set_ctx_params OSSL_FUNC_DECODER_SET_CTX_PARAMS OSSL_FUNC_decoder_settable_ctx_params OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS \& OSSL_FUNC_decoder_does_selection OSSL_FUNC_DECODER_DOES_SELECTION \& OSSL_FUNC_decoder_decode OSSL_FUNC_DECODER_DECODE \& OSSL_FUNC_decoder_export_object OSSL_FUNC_DECODER_EXPORT_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 input types and structures that libcrypto doesn't know anything about.
This set of bits depend entirely on what kind of provider-side object is to be decoded. For example, those bits are assumed to be the same as those used with provider-keymgmt\|(7) (see "Key Objects" in provider-keymgmt\|(7)) when the object is an asymmetric keypair - e.g., OSSL_KEYMGMT_SELECT_PRIVATE_KEY if the object to be decoded is supposed to contain private key components.
\fBOSSL_FUNC_decoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.
\fBOSSL_FUNC_decoder_freectx() frees the given ctx as created by \fBOSSL_FUNC_decoder_newctx().
\fBOSSL_FUNC_decoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing NULL for params should return true.
\fBOSSL_FUNC_decoder_settable_ctx_params() returns a constant OSSL_PARAM\|(3) array describing the parameters that OSSL_FUNC_decoder_set_ctx_params() can handle.
See OSSL_PARAM\|(3) for further details on the parameters structure used by \fBOSSL_FUNC_decoder_set_ctx_params() and OSSL_FUNC_decoder_settable_ctx_params().
\fBOSSL_FUNC_decoder_export_object() should export the object of size objref_sz referenced by objref as an OSSL_PARAM\|(3) array and pass that into the \fIexport_cb as well as the given export_cbarg.
It's important to understand that the return value from this function is interpreted as follows:
The conditions to stop the decoding process are at the discretion of the implementation.
Parameters currently recognised by the built-in pass phrase callback:
\fBOSSL_FUNC_decoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.
\fBOSSL_FUNC_decoder_settable_ctx_params() returns a pointer to an array of constant OSSL_PARAM\|(3) elements.
\fBOSSL_FUNC_decoder_does_selection() returns 1 if the decoder implementation supports any of the selection bits, otherwise 0.
\fBOSSL_FUNC_decoder_decode() returns 1 to signal that the decoding process should continue, or 0 to signal that it should stop.
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 in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.