=pod

=begin comment

This page collects all existing functions with this pattern:

EVP_{TYPE}_CTX_get_algor()
EVP_{TYPE}_CTX_get_algor_params()
EVP_{TYPE}_CTX_set_algor_params()

... where {TYPE} is the name of an EVP operation type.

=end comment

=head1 NAME

EVP_CIPHER_CTX_get_algor,
EVP_CIPHER_CTX_get_algor_params,
EVP_CIPHER_CTX_set_algor_params,
EVP_PKEY_CTX_get_algor,
EVP_PKEY_CTX_get_algor_params,
EVP_PKEY_CTX_set_algor_params
- pass AlgorithmIdentifier and its params to/from algorithm implementations

=head1 SYNOPSIS

=for openssl generic

 int EVP_TYPE_CTX_get_algor(EVP_TYPE_CTX *ctx, X509_ALGOR **alg);
 int EVP_TYPE_CTX_get_algor_params(EVP_TYPE_CTX *ctx, X509_ALGOR *alg);
 int EVP_TYPE_CTX_set_algor_params(EVP_TYPE_CTX *ctx, const X509_ALGOR *alg);

=head1 DESCRIPTION

In the description here and the L</SYNOPSIS> above, B<I<TYPE>> is used as a
placeholder for any EVP operation type.

B<EVP_I<TYPE>_CTX_get_algor>() attempts to retrieve a complete
AlgorithmIdentifier from the B<EVP_I<TYPE>> implementation, and populates
I<*alg> with it.
If I<alg> is NULL, calling this function will serve to see if calling this
function is supported at all by the B<EVP_I<TYPE>> implementation.
If I<*alg> is NULL, space will be allocated automatically, and assigned to
I<*alg>.

B<EVP_I<TYPE>_CTX_get_algor_params>() attempts to retrieve the I<parameters>
part of an AlgorithmIdentifier from the B<EVP_I<TYPE>> implementation, and
populates I<alg->parameters> with it.
If I<alg> is NULL, calling this function will serve to see if calling this
function is supported at all by the B<EVP_I<TYPE>> implementation.
If I<< alg->parameters >> is NULL, space will be allocated automatically, and
assigned to  I<< alg->parameters >>.
If I<< alg->parameters >> is not NULL, its previous contents will be overwritten
with the retrieved AlgorithmIdentifier parameters.  Beware!

B<EVP_I<TYPE>_CTX_set_algor_params>() attempts to pass I<< alg->parameters >>
to the B<EVP_I<TYPE>> implementation.
If I<alg> is NULL, calling this function will serve to see if calling this
function is supported at all by the B<EVP_I<TYPE>> implementation.

=head1 RETURN VALUES

All functions return 1 for success, and 0 or a negative number if an error
occurs.  In particular, -2 is returned when the function isn't supported by
the B<EVP_I<TYPE>> implementation.

=head1 HISTORY

These functions were added in OpenSSL 3.4.

=head1 COPYRIGHT

Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.

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
L<https://www.openssl.org/source/license.html>.

=cut
