@@ -19,9 +19,11 @@ OSSL_DECODER_CLEANUP,
1919OSSL_DECODER_CTX_set_construct,
2020OSSL_DECODER_CTX_set_construct_data,
2121OSSL_DECODER_CTX_set_cleanup,
22+ OSSL_DECODER_CTX_set_finalized,
2223OSSL_DECODER_CTX_get_construct,
2324OSSL_DECODER_CTX_get_construct_data,
2425OSSL_DECODER_CTX_get_cleanup,
26+ OSSL_DECODER_CTX_get_finalized,
2527OSSL_DECODER_export,
2628OSSL_DECODER_INSTANCE_get_decoder,
2729OSSL_DECODER_INSTANCE_get_decoder_ctx,
@@ -77,6 +79,9 @@ OSSL_DECODER_INSTANCE_get_input_structure
7779 void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);
7880 OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);
7981
82+ int OSSL_DECODER_CTX_set_finalized(OSSL_DECODER_CTX *ctx);
83+ int OSSL_DECODER_CTX_get_finalized(OSSL_DECODER_CTX *ctx);
84+
8085 int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,
8186 void *reference, size_t reference_sz,
8287 OSSL_CALLBACK *export_cb, void *export_cbarg);
@@ -135,6 +140,8 @@ OSSL_DECODER_CTX_add_extra() finds decoders that generate input for already
135140added decoders, and adds them as well. This is used to build decoder
136141chains.
137142
143+ OSSL_DECODER_CTX_set_selection() sets what the input is expected to contain.
144+
138145OSSL_DECODER_CTX_set_input_type() sets the starting input type. This limits
139146the decoder chains to be considered, as explained in the general description
140147above.
@@ -160,6 +167,15 @@ OSSL_DECODER_CTX_get_cleanup() return the values that have been set by
160167OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and
161168OSSL_DECODER_CTX_set_cleanup() respectively.
162169
170+ OSSL_DECODER_CTX_set_finalized() finalises the context. Functions
171+ OSSL_DECODER_CTX_set_selection(), OSSL_DECODER_CTX_set_output_type(),
172+ OSSL_DECODER_CTX_set_output_structure(), OSSL_DECODER_CTX_add_encoder(),
173+ OSSL_DECODER_CTX_add_extra(), OSSL_DECODER_CTX_set_construct(),
174+ OSSL_DECODER_CTX_set_construct_data() and OSSL_DECODER_CTX_set_cleanup()
175+ can't be used after the context is finalised.
176+
177+ OSSL_DECODER_CTX_get_finalized() indicates if the context was finalised.
178+
163179OSSL_DECODER_export() is a fallback function for constructors that cannot
164180use the data they get directly for diverse reasons. It takes the same
165181decode instance I<decoder_inst> that the constructor got and an object
@@ -221,14 +237,20 @@ OSSL_DECODER_CTX_set_params() returns 1 if all recognised parameters were
221237valid, or 0 if one of them was invalid or caused some other failure in the
222238implementation.
223239
240+ OSSL_DECODER_CTX_set_selection(), OSSL_DECODER_CTX_set_input_type(),
241+ OSSL_DECODER_CTX_set_input_structure(),
224242OSSL_DECODER_CTX_add_decoder(), OSSL_DECODER_CTX_add_extra(),
225- OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and
226- OSSL_DECODER_CTX_set_cleanup() return 1 on success, or 0 on failure.
243+ OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data(),
244+ OSSL_DECODER_CTX_set_cleanup() and OSSL_DECODER_CTX_set_finalized()
245+ return 1 on success, or 0 on failure.
227246
228247OSSL_DECODER_CTX_get_construct(), OSSL_DECODER_CTX_get_construct_data() and
229248OSSL_DECODER_CTX_get_cleanup() return the current pointers to the
230249constructor, the constructor data and the cleanup functions, respectively.
231250
251+ OSSL_DECODER_CTX_get_finalized() returns 1 if I<ctx> was finalised,
252+ 0 otherwise. It also returns 0 if I<ctx> is NULL.
253+
232254OSSL_DECODER_CTX_num_decoders() returns the current number of decoders. It
233255returns 0 if I<ctx> is NULL.
234256
@@ -248,6 +270,9 @@ L<provider(7)>, L<OSSL_DECODER(3)>, L<OSSL_DECODER_from_bio(3)>
248270
249271The functions described here were added in OpenSSL 3.0.
250272
273+ OSSL_DECODER_CTX_set_finalized() and OSSL_DECODER_CTX_get_finalized()
274+ were added in OpenSSL 4.0.
275+
251276=head1 COPYRIGHT
252277
253278Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
0 commit comments