xref: /freebsd/crypto/openssl/doc/man3/EVP_SIGNATURE.pod (revision a7148ab39c03abd4d1a84997c70bf96f15dd2a09)
1b077aed3SPierre Pronchery=pod
2b077aed3SPierre Pronchery
3b077aed3SPierre Pronchery=head1 NAME
4b077aed3SPierre Pronchery
5b077aed3SPierre ProncheryEVP_SIGNATURE,
6b077aed3SPierre ProncheryEVP_SIGNATURE_fetch, EVP_SIGNATURE_free, EVP_SIGNATURE_up_ref,
7b077aed3SPierre ProncheryEVP_SIGNATURE_is_a, EVP_SIGNATURE_get0_provider,
8b077aed3SPierre ProncheryEVP_SIGNATURE_do_all_provided, EVP_SIGNATURE_names_do_all,
9b077aed3SPierre ProncheryEVP_SIGNATURE_get0_name, EVP_SIGNATURE_get0_description,
10b077aed3SPierre ProncheryEVP_SIGNATURE_gettable_ctx_params, EVP_SIGNATURE_settable_ctx_params
11b077aed3SPierre Pronchery- Functions to manage EVP_SIGNATURE algorithm objects
12b077aed3SPierre Pronchery
13b077aed3SPierre Pronchery=head1 SYNOPSIS
14b077aed3SPierre Pronchery
15b077aed3SPierre Pronchery #include <openssl/evp.h>
16b077aed3SPierre Pronchery
17b077aed3SPierre Pronchery typedef struct evp_signature_st EVP_SIGNATURE;
18b077aed3SPierre Pronchery
19b077aed3SPierre Pronchery EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
20b077aed3SPierre Pronchery                                    const char *properties);
21b077aed3SPierre Pronchery void EVP_SIGNATURE_free(EVP_SIGNATURE *signature);
22b077aed3SPierre Pronchery int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature);
23b077aed3SPierre Pronchery const char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);
24b077aed3SPierre Pronchery int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name);
25b077aed3SPierre Pronchery OSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature);
26b077aed3SPierre Pronchery void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx,
27b077aed3SPierre Pronchery                                    void (*fn)(EVP_SIGNATURE *signature,
28b077aed3SPierre Pronchery                                               void *arg),
29b077aed3SPierre Pronchery                                    void *arg);
30b077aed3SPierre Pronchery int EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
31b077aed3SPierre Pronchery                                void (*fn)(const char *name, void *data),
32b077aed3SPierre Pronchery                                void *data);
33b077aed3SPierre Pronchery const char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);
34b077aed3SPierre Pronchery const char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature);
35b077aed3SPierre Pronchery const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);
36b077aed3SPierre Pronchery const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);
37b077aed3SPierre Pronchery
38b077aed3SPierre Pronchery=head1 DESCRIPTION
39b077aed3SPierre Pronchery
40b077aed3SPierre ProncheryEVP_SIGNATURE_fetch() fetches the implementation for the given
41b077aed3SPierre ProncheryB<algorithm> from any provider offering it, within the criteria given
42b077aed3SPierre Proncheryby the B<properties>.
43b077aed3SPierre ProncheryThe algorithm will be one offering functions for performing signature related
44b077aed3SPierre Proncherytasks such as signing and verifying.
45b077aed3SPierre ProncherySee L<crypto(7)/ALGORITHM FETCHING> for further information.
46b077aed3SPierre Pronchery
47b077aed3SPierre ProncheryThe returned value must eventually be freed with EVP_SIGNATURE_free().
48b077aed3SPierre Pronchery
49b077aed3SPierre ProncheryEVP_SIGNATURE_free() decrements the reference count for the B<EVP_SIGNATURE>
50b077aed3SPierre Proncherystructure. Typically this structure will have been obtained from an earlier call
51b077aed3SPierre Proncheryto EVP_SIGNATURE_fetch(). If the reference count drops to 0 then the
52*a7148ab3SEnji Cooperstructure is freed. If the argument is NULL, nothing is done.
53b077aed3SPierre Pronchery
54b077aed3SPierre ProncheryEVP_SIGNATURE_up_ref() increments the reference count for an B<EVP_SIGNATURE>
55b077aed3SPierre Proncherystructure.
56b077aed3SPierre Pronchery
57b077aed3SPierre ProncheryEVP_SIGNATURE_is_a() returns 1 if I<signature> is an implementation of an
58b077aed3SPierre Proncheryalgorithm that's identifiable with I<name>, otherwise 0.
59b077aed3SPierre Pronchery
60b077aed3SPierre ProncheryEVP_SIGNATURE_get0_provider() returns the provider that I<signature> was
61b077aed3SPierre Proncheryfetched from.
62b077aed3SPierre Pronchery
63b077aed3SPierre ProncheryEVP_SIGNATURE_do_all_provided() traverses all SIGNATURE implemented by all
646f1af0d7SPierre Proncheryactivated providers in the given library context I<libctx>, and for each of the
65b077aed3SPierre Proncheryimplementations, calls the given function I<fn> with the implementation method
66b077aed3SPierre Proncheryand the given I<arg> as argument.
67b077aed3SPierre Pronchery
68b077aed3SPierre ProncheryEVP_SIGNATURE_get0_name() returns the algorithm name from the provided
69b077aed3SPierre Proncheryimplementation for the given I<signature>. Note that the I<signature> may have
70b077aed3SPierre Proncherymultiple synonyms associated with it. In this case the first name from the
71b077aed3SPierre Proncheryalgorithm definition is returned. Ownership of the returned string is retained
72b077aed3SPierre Proncheryby the I<signature> object and should not be freed by the caller.
73b077aed3SPierre Pronchery
74b077aed3SPierre ProncheryEVP_SIGNATURE_names_do_all() traverses all names for I<signature>, and calls
75b077aed3SPierre ProncheryI<fn> with each name and I<data>.
76b077aed3SPierre Pronchery
77b077aed3SPierre ProncheryEVP_SIGNATURE_get0_description() returns a description of the I<signature>,
78b077aed3SPierre Proncherymeant for display and human consumption.  The description is at the
79b077aed3SPierre Proncherydiscretion of the I<signature> implementation.
80b077aed3SPierre Pronchery
81b077aed3SPierre ProncheryEVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params()
82b077aed3SPierre Proncheryreturn a constant L<OSSL_PARAM(3)> array that describes the names and types of key
83b077aed3SPierre Proncheryparameters that can be retrieved or set by a signature algorithm using
84b077aed3SPierre ProncheryL<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
85b077aed3SPierre Pronchery
86b077aed3SPierre Pronchery=head1 RETURN VALUES
87b077aed3SPierre Pronchery
88b077aed3SPierre ProncheryEVP_SIGNATURE_fetch() returns a pointer to an B<EVP_SIGNATURE> for success
89b077aed3SPierre Proncheryor B<NULL> for failure.
90b077aed3SPierre Pronchery
91b077aed3SPierre ProncheryEVP_SIGNATURE_up_ref() returns 1 for success or 0 otherwise.
92b077aed3SPierre Pronchery
93b077aed3SPierre ProncheryEVP_SIGNATURE_names_do_all() returns 1 if the callback was called for all names.
94b077aed3SPierre ProncheryA return value of 0 means that the callback was not called for any names.
95b077aed3SPierre Pronchery
96b077aed3SPierre ProncheryEVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params()
97b077aed3SPierre Proncheryreturn a constant L<OSSL_PARAM(3)> array or NULL on error.
98b077aed3SPierre Pronchery
99b077aed3SPierre Pronchery=head1 SEE ALSO
100b077aed3SPierre Pronchery
101b077aed3SPierre ProncheryL<crypto(7)/ALGORITHM FETCHING>, L<OSSL_PROVIDER(3)>
102b077aed3SPierre Pronchery
103b077aed3SPierre Pronchery=head1 HISTORY
104b077aed3SPierre Pronchery
105b077aed3SPierre ProncheryThe functions described here were added in OpenSSL 3.0.
106b077aed3SPierre Pronchery
107b077aed3SPierre Pronchery=head1 COPYRIGHT
108b077aed3SPierre Pronchery
109*a7148ab3SEnji CooperCopyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
110b077aed3SPierre Pronchery
111b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
112b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
113b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
114b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
115b077aed3SPierre Pronchery
116b077aed3SPierre Pronchery=cut
117