1b077aed3SPierre Pronchery=pod 2b077aed3SPierre Pronchery 3b077aed3SPierre Pronchery=head1 NAME 4b077aed3SPierre Pronchery 5b077aed3SPierre Proncheryprovider - OpenSSL operation implementation providers 6b077aed3SPierre Pronchery 7b077aed3SPierre Pronchery=head1 SYNOPSIS 8b077aed3SPierre Pronchery 9b077aed3SPierre Pronchery=for openssl generic 10b077aed3SPierre Pronchery 11b077aed3SPierre Pronchery#include <openssl/provider.h> 12b077aed3SPierre Pronchery 13b077aed3SPierre Pronchery=head1 DESCRIPTION 14b077aed3SPierre Pronchery 15b077aed3SPierre Pronchery=head2 General 16b077aed3SPierre Pronchery 17b077aed3SPierre ProncheryThis page contains information useful to provider authors. 18b077aed3SPierre Pronchery 19b077aed3SPierre ProncheryA I<provider>, in OpenSSL terms, is a unit of code that provides one 20b077aed3SPierre Proncheryor more implementations for various operations for diverse algorithms 21b077aed3SPierre Proncherythat one might want to perform. 22b077aed3SPierre Pronchery 23b077aed3SPierre ProncheryAn I<operation> is something one wants to do, such as encryption and 24b077aed3SPierre Proncherydecryption, key derivation, MAC calculation, signing and verification, 25b077aed3SPierre Proncheryetc. 26b077aed3SPierre Pronchery 27b077aed3SPierre ProncheryAn I<algorithm> is a named method to perform an operation. 28b077aed3SPierre ProncheryVery often, the algorithms revolve around cryptographic operations, 29b077aed3SPierre Proncherybut may also revolve around other types of operation, such as managing 30b077aed3SPierre Proncherycertain types of objects. 31b077aed3SPierre Pronchery 32b077aed3SPierre ProncherySee L<crypto(7)> for further details. 33b077aed3SPierre Pronchery 34b077aed3SPierre Pronchery=head2 Provider 35b077aed3SPierre Pronchery 36b077aed3SPierre ProncheryA I<provider> offers an initialization function, as a set of base 37b077aed3SPierre Proncheryfunctions in the form of an L<OSSL_DISPATCH(3)> array, and by extension, 38b077aed3SPierre Proncherya set of L<OSSL_ALGORITHM(3)>s (see L<openssl-core.h(7)>). 39b077aed3SPierre ProncheryIt may be a dynamically loadable module, or may be built-in, in 40b077aed3SPierre ProncheryOpenSSL libraries or in the application. 41b077aed3SPierre ProncheryIf it's a dynamically loadable module, the initialization function 42b077aed3SPierre Proncherymust be named C<OSSL_provider_init> and must be exported. 43b077aed3SPierre ProncheryIf it's built-in, the initialization function may have any name. 44b077aed3SPierre Pronchery 45b077aed3SPierre ProncheryThe initialization function must have the following signature: 46b077aed3SPierre Pronchery 47b077aed3SPierre Pronchery int NAME(const OSSL_CORE_HANDLE *handle, 48b077aed3SPierre Pronchery const OSSL_DISPATCH *in, const OSSL_DISPATCH **out, 49b077aed3SPierre Pronchery void **provctx); 50b077aed3SPierre Pronchery 51b077aed3SPierre ProncheryI<handle> is the OpenSSL library object for the provider, and works 52b077aed3SPierre Proncheryas a handle for everything the OpenSSL libraries need to know about 53b077aed3SPierre Proncherythe provider. 54b077aed3SPierre ProncheryFor the provider itself, it is passed to some of the functions given in the 55b077aed3SPierre Proncherydispatch array I<in>. 56b077aed3SPierre Pronchery 57b077aed3SPierre ProncheryI<in> is a dispatch array of base functions offered by the OpenSSL 58b077aed3SPierre Proncherylibraries, and the available functions are further described in 59b077aed3SPierre ProncheryL<provider-base(7)>. 60b077aed3SPierre Pronchery 61b077aed3SPierre ProncheryI<*out> must be assigned a dispatch array of base functions that the 62b077aed3SPierre Proncheryprovider offers to the OpenSSL libraries. 63b077aed3SPierre ProncheryThe functions that may be offered are further described in 64b077aed3SPierre ProncheryL<provider-base(7)>, and they are the central means of communication 65b077aed3SPierre Proncherybetween the OpenSSL libraries and the provider. 66b077aed3SPierre Pronchery 67b077aed3SPierre ProncheryI<*provctx> should be assigned a provider specific context to allow 68b077aed3SPierre Proncherythe provider multiple simultaneous uses. 69b077aed3SPierre ProncheryThis pointer will be passed to various operation functions offered by 70b077aed3SPierre Proncherythe provider. 71b077aed3SPierre Pronchery 72b077aed3SPierre ProncheryNote that the provider will not be made available for applications to use until 73b077aed3SPierre Proncherythe initialization function has completed and returned successfully. 74b077aed3SPierre Pronchery 75b077aed3SPierre ProncheryOne of the functions the provider offers to the OpenSSL libraries is 76b077aed3SPierre Proncherythe central mechanism for the OpenSSL libraries to get access to 77b077aed3SPierre Proncheryoperation implementations for diverse algorithms. 78b077aed3SPierre ProncheryIts referred to with the number B<OSSL_FUNC_PROVIDER_QUERY_OPERATION> 79b077aed3SPierre Proncheryand has the following signature: 80b077aed3SPierre Pronchery 81b077aed3SPierre Pronchery const OSSL_ALGORITHM *provider_query_operation(void *provctx, 82b077aed3SPierre Pronchery int operation_id, 83b077aed3SPierre Pronchery const int *no_store); 84b077aed3SPierre Pronchery 85b077aed3SPierre ProncheryI<provctx> is the provider specific context that was passed back by 86b077aed3SPierre Proncherythe initialization function. 87b077aed3SPierre Pronchery 88b077aed3SPierre ProncheryI<operation_id> is an operation identity (see L</Operations> below). 89b077aed3SPierre Pronchery 90b077aed3SPierre ProncheryI<no_store> is a flag back to the OpenSSL libraries which, when 91b077aed3SPierre Proncherynonzero, signifies that the OpenSSL libraries will not store a 92b077aed3SPierre Proncheryreference to the returned data in their internal store of 93b077aed3SPierre Proncheryimplementations. 94b077aed3SPierre Pronchery 95b077aed3SPierre ProncheryThe returned L<OSSL_ALGORITHM(3)> is the foundation of any OpenSSL 96b077aed3SPierre Proncherylibrary API that uses providers for their implementation, most 97b077aed3SPierre Proncherycommonly in the I<fetching> type of functions 98b077aed3SPierre Pronchery(see L<crypto(7)/ALGORITHM FETCHING>). 99b077aed3SPierre Pronchery 100b077aed3SPierre Pronchery=head2 Operations 101b077aed3SPierre Pronchery 102b077aed3SPierre ProncheryOperations are referred to with numbers, via macros with names 103b077aed3SPierre Proncherystarting with C<OSSL_OP_>. 104b077aed3SPierre Pronchery 105b077aed3SPierre ProncheryWith each operation comes a set of defined function types that a 106b077aed3SPierre Proncheryprovider may or may not offer, depending on its needs. 107b077aed3SPierre Pronchery 108b077aed3SPierre ProncheryCurrently available operations are: 109b077aed3SPierre Pronchery 110b077aed3SPierre Pronchery=over 4 111b077aed3SPierre Pronchery 112b077aed3SPierre Pronchery=item Digests 113b077aed3SPierre Pronchery 114b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 115b077aed3SPierre ProncheryB<EVP_MD>. 116b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_DIGEST>. 117b077aed3SPierre ProncheryThe functions the provider can offer are described in 118b077aed3SPierre ProncheryL<provider-digest(7)>. 119b077aed3SPierre Pronchery 120b077aed3SPierre Pronchery=item Symmetric ciphers 121b077aed3SPierre Pronchery 122b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 123b077aed3SPierre ProncheryB<EVP_CIPHER>. 124b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_CIPHER>. 125b077aed3SPierre ProncheryThe functions the provider can offer are described in 126b077aed3SPierre ProncheryL<provider-cipher(7)>. 127b077aed3SPierre Pronchery 128b077aed3SPierre Pronchery=item Message Authentication Code (MAC) 129b077aed3SPierre Pronchery 130b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 131b077aed3SPierre ProncheryB<EVP_MAC>. 132b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_MAC>. 133b077aed3SPierre ProncheryThe functions the provider can offer are described in 134b077aed3SPierre ProncheryL<provider-mac(7)>. 135b077aed3SPierre Pronchery 136b077aed3SPierre Pronchery=item Key Derivation Function (KDF) 137b077aed3SPierre Pronchery 138b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 139b077aed3SPierre ProncheryB<EVP_KDF>. 140b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_KDF>. 141b077aed3SPierre ProncheryThe functions the provider can offer are described in 142b077aed3SPierre ProncheryL<provider-kdf(7)>. 143b077aed3SPierre Pronchery 144b077aed3SPierre Pronchery=item Key Exchange 145b077aed3SPierre Pronchery 146b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 147b077aed3SPierre ProncheryB<EVP_KEYEXCH>. 148b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_KEYEXCH>. 149b077aed3SPierre ProncheryThe functions the provider can offer are described in 150b077aed3SPierre ProncheryL<provider-keyexch(7)>. 151b077aed3SPierre Pronchery 152b077aed3SPierre Pronchery=item Asymmetric Ciphers 153b077aed3SPierre Pronchery 154b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 155b077aed3SPierre ProncheryB<EVP_ASYM_CIPHER>. 156b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_ASYM_CIPHER>. 157b077aed3SPierre ProncheryThe functions the provider can offer are described in 158b077aed3SPierre ProncheryL<provider-asym_cipher(7)>. 159b077aed3SPierre Pronchery 160b077aed3SPierre Pronchery=item Asymmetric Key Encapsulation 161b077aed3SPierre Pronchery 162b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is B<EVP_KEM>. 163b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_KEM>. 164b077aed3SPierre ProncheryThe functions the provider can offer are described in L<provider-kem(7)>. 165b077aed3SPierre Pronchery 166b077aed3SPierre Pronchery=item Encoding 167b077aed3SPierre Pronchery 168b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 169b077aed3SPierre ProncheryB<OSSL_ENCODER>. 170b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_ENCODER>. 171b077aed3SPierre ProncheryThe functions the provider can offer are described in 172b077aed3SPierre ProncheryL<provider-encoder(7)>. 173b077aed3SPierre Pronchery 174b077aed3SPierre Pronchery=item Decoding 175b077aed3SPierre Pronchery 176b077aed3SPierre ProncheryIn the OpenSSL libraries, the corresponding method object is 177b077aed3SPierre ProncheryB<OSSL_DECODER>. 178b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_DECODER>. 179b077aed3SPierre ProncheryThe functions the provider can offer are described in 180b077aed3SPierre ProncheryL<provider-decoder(7)>. 181b077aed3SPierre Pronchery 182b077aed3SPierre Pronchery=item Random Number Generation 183b077aed3SPierre Pronchery 184b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_RAND>. 185b077aed3SPierre ProncheryThe functions the provider can offer for random number generation are described 186b077aed3SPierre Proncheryin L<provider-rand(7)>. 187b077aed3SPierre Pronchery 188b077aed3SPierre Pronchery=item Key Management 189b077aed3SPierre Pronchery 190b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_KEYMGMT>. 191b077aed3SPierre ProncheryThe functions the provider can offer for key management are described in 192b077aed3SPierre ProncheryL<provider-keymgmt(7)>. 193b077aed3SPierre Pronchery 194b077aed3SPierre Pronchery=item Signing and Signature Verification 195b077aed3SPierre Pronchery 196b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_SIGNATURE>. 197b077aed3SPierre ProncheryThe functions the provider can offer for digital signatures are described in 198b077aed3SPierre ProncheryL<provider-signature(7)>. 199b077aed3SPierre Pronchery 200b077aed3SPierre Pronchery=item Store Management 201b077aed3SPierre Pronchery 202b077aed3SPierre ProncheryThe number for this operation is B<OSSL_OP_STORE>. 203b077aed3SPierre ProncheryThe functions the provider can offer for store management are described in 204b077aed3SPierre ProncheryL<provider-storemgmt(7)>. 205b077aed3SPierre Pronchery 206b077aed3SPierre Pronchery=back 207b077aed3SPierre Pronchery 208b077aed3SPierre Pronchery=head3 Algorithm naming 209b077aed3SPierre Pronchery 210b077aed3SPierre ProncheryAlgorithm names are case insensitive. Any particular algorithm can have multiple 211b077aed3SPierre Proncheryaliases associated with it. The canonical OpenSSL naming scheme follows this 212b077aed3SPierre Proncheryformat: 213b077aed3SPierre Pronchery 214b077aed3SPierre ProncheryALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?] 215b077aed3SPierre Pronchery 216b077aed3SPierre ProncheryVERSION is only present if there are multiple versions of an algorithm (e.g. 217b077aed3SPierre ProncheryMD2, MD4, MD5). It may be omitted if there is only one version. 218b077aed3SPierre Pronchery 219b077aed3SPierre ProncherySUBNAME may be present where multiple algorithms are combined together, 220b077aed3SPierre Proncherye.g. MD5-SHA1. 221b077aed3SPierre Pronchery 222b077aed3SPierre ProncherySIZE is only present if multiple versions of an algorithm exist with different 223b077aed3SPierre Proncherysizes (e.g. AES-128-CBC, AES-256-CBC) 224b077aed3SPierre Pronchery 225b077aed3SPierre ProncheryMODE is only present where applicable. 226b077aed3SPierre Pronchery 227b077aed3SPierre ProncheryOther aliases may exist for example where standards bodies or common practice 228b077aed3SPierre Proncheryuse alternative names or names that OpenSSL has used historically. 229b077aed3SPierre Pronchery 230*0d0c8621SEnji Cooper=head3 Provider dependencies 231*0d0c8621SEnji Cooper 232*0d0c8621SEnji CooperProviders may depend for their proper operation on the availability of 233*0d0c8621SEnji Cooper(functionality implemented in) other providers. As there is no mechanism to 234*0d0c8621SEnji Cooperexpress such dependencies towards the OpenSSL core, provider authors must 235*0d0c8621SEnji Coopertake care that such dependencies are either completely avoided or made visible 236*0d0c8621SEnji Cooperto users, e.g., by documentation and/or defensive programming, e.g., 237*0d0c8621SEnji Cooperoutputting error messages if required external dependencies are not available, 238*0d0c8621SEnji Coopere.g., when no provider implementing the required functionality has been 239*0d0c8621SEnji Cooperactivated. In particular, provider initialization should not depend on other 240*0d0c8621SEnji Cooperproviders already having been initialized. 241*0d0c8621SEnji Cooper 242b077aed3SPierre Pronchery=head1 OPENSSL PROVIDERS 243b077aed3SPierre Pronchery 244b077aed3SPierre ProncheryOpenSSL provides a number of its own providers. These are the default, base, 245b077aed3SPierre Proncheryfips, legacy and null providers. See L<crypto(7)> for an overview of these 246b077aed3SPierre Proncheryproviders. 247b077aed3SPierre Pronchery 248b077aed3SPierre Pronchery=head1 SEE ALSO 249b077aed3SPierre Pronchery 250b077aed3SPierre ProncheryL<EVP_DigestInit_ex(3)>, L<EVP_EncryptInit_ex(3)>, 251b077aed3SPierre ProncheryL<OSSL_LIB_CTX(3)>, 252b077aed3SPierre ProncheryL<EVP_set_default_properties(3)>, 253b077aed3SPierre ProncheryL<EVP_MD_fetch(3)>, 254b077aed3SPierre ProncheryL<EVP_CIPHER_fetch(3)>, 255b077aed3SPierre ProncheryL<EVP_KEYMGMT_fetch(3)>, 256b077aed3SPierre ProncheryL<openssl-core.h(7)>, 257b077aed3SPierre ProncheryL<provider-base(7)>, 258b077aed3SPierre ProncheryL<provider-digest(7)>, 259b077aed3SPierre ProncheryL<provider-cipher(7)>, 260b077aed3SPierre ProncheryL<provider-keyexch(7)> 261b077aed3SPierre Pronchery 262b077aed3SPierre Pronchery=head1 HISTORY 263b077aed3SPierre Pronchery 264b077aed3SPierre ProncheryThe concept of providers and everything surrounding them was 265b077aed3SPierre Proncheryintroduced in OpenSSL 3.0. 266b077aed3SPierre Pronchery 267b077aed3SPierre Pronchery=head1 COPYRIGHT 268b077aed3SPierre Pronchery 269b077aed3SPierre ProncheryCopyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 270b077aed3SPierre Pronchery 271b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 272b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 273b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 274b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 275b077aed3SPierre Pronchery 276b077aed3SPierre Pronchery=cut 277