migration_guide - OpenSSL Documentation
migration_guide - OpenSSL Documentation
NAME
migration_guide - OpenSSL migration guide
SYNOPSIS
See the individual manual pages for details.
DESCRIPTION
This guide details the changes required to migrate to new versions of OpenSSL. Currently this covers
OpenSSL 3.0. For earlier versions refer to https://github.com/openssl/openssl/blob/master/
CHANGES.md. For an overview of some of the key concepts introduced in OpenSSL 3.0 see
crypto(7).
OPENSSL 3.0
Main Changes from OpenSSL 1.1.1
Major Release
OpenSSL 3.0 is a major release and consequently any application that currently uses an older
version of OpenSSL will at the very least need to be recompiled in order to work with the new
version. It is the intention that the large majority of applications will work unchanged with OpenSSL
3.0 if those applications previously worked with OpenSSL 1.1.1. However this is not guaranteed and
some changes may be required in some cases. Changes may also be required if applications need
to take advantage of some of the new features available in OpenSSL 3.0 such as the availability of
the FIPS module.
License Change
In previous versions, OpenSSL was licensed under the dual OpenSSL and SSLeay licenses (both
licenses apply). From OpenSSL 3.0 this is replaced by the Apache License v2.
Providers and FIPS support
One of the key changes from OpenSSL 1.1.1 is the introduction of the Provider concept. Providers
collect together and make available algorithm implementations. With OpenSSL 3.0 it is possible to
specify, either programmatically or via a conMg Mle, which providers you want to use for any given
application. OpenSSL 3.0 comes with 5 different providers as standard. Over time third parties may
distribute additional providers that can be plugged into OpenSSL. All algorithm implementations
available via providers are accessed through the "high level" APIs (for example those functions
preMxed with EVP ). They cannot be accessed using the "Low Level APIs".
One of the standard providers available is the FIPS provider. This makes available FIPS validated
cryptographic algorithms. The FIPS provider is disabled by default and needs to be enabled explicitly
at conMguration time using the enable-fips option. If it is enabled, the FIPS provider gets built and
installed in addition to the other standard providers. No separate installation procedure is necessary.
There is however a dedicated install_fips make target, which serves the special purpose of
installing only the FIPS provider into an existing OpenSSL installation.
Not all algorithms may be available for the application at a particular moment. If the application
code uses any digest or cipher algorithm via the EVP interface, the application should verify the
result of the EVP_EncryptInit(3), EVP_EncryptInit_ex(3), and EVP_DigestInit(3) functions. In case
when the requested algorithm is not available, these functions will fail.
See also "Completing the installation of the FIPS Module" and "Using the FIPS Module in
applications".
OpenSSL has historically provided two sets of APIs for invoking cryptographic algorithms: the "high
level" APIs (such as the EVP APIs) and the "low level" APIs. The high level APIs are typically designed
to work across all algorithm types. The "low level" APIs are targeted at a speciMc algorithm
implementation. For example, the EVP APIs provide the functions EVP_EncryptInit_ex(3),
EVP_EncryptUpdate(3) and EVP_EncryptFinal(3) to perform symmetric encryption. Those functions
can be used with the algorithms AES, CHACHA, 3DES etc. On the other hand, to do AES encryption
using the low level APIs you would have to call AES speciMc functions such as
AES_set_encrypt_key(3), AES_encrypt(3), and so on. The functions for 3DES are different. Use of the
low level APIs has been informally discouraged by the OpenSSL development team for a long time.
However in OpenSSL 3.0 this is made more formal. All such low level APIs have been deprecated.
You may still use them in your applications, but you may start to see deprecation warnings during
compilation (dependent on compiler support for this). Deprecated APIs may be removed from future
versions of OpenSSL so you are strongly encouraged to update your code to use the high level APIs
instead.
Legacy Algorithms
Some cryptographic algorithms such as MD2 and DES that were available via the EVP APIs are now
considered legacy and their use is strongly discouraged. These legacy EVP algorithms are still
available in OpenSSL 3.0 but not by default. If you want to use them then you must load the legacy
provider. This can be as simple as a conMg Mle change, or can be done programmatically. See
OSSL_PROVIDER-legacy(7) for a complete list of algorithms. Applications using the EVP APIs to
access these algorithms should instead use more modern algorithms. If that is not possible then
these applications should ensure that the legacy provider has been loaded. This can be achieved
either programmatically or via conMguration. See crypto(7) man page for more information about
providers.
The refactoring to support Providers conYicts internally with the APIs used to support engines,
including the ENGINE API and any function that creates or modiMes custom "METHODS" (for
example EVP_MD_meth_new(3), EVP_CIPHER_meth_new(3), EVP_PKEY_meth_new(3),
RSA_meth_new(3), EC_KEY_METHOD_new(3), etc.). These functions are being deprecated in
OpenSSL 3.0, and users of these APIs should know that their use can likely bypass provider
selection and conMguration, with unintended consequences. This is particularly relevant for
applications written to use the OpenSSL 3.0 FIPS module, as detailed below. Authors and
maintainers of external engines are strongly encouraged to refactor their code transforming engines
into providers using the new Provider API and avoiding deprecated methods.
If openssl is not built without engine support or deprecated API support, engines will still work.
However, their applicability will be limited.
Engine-backed keys can be loaded via custom OSSL_STORE implementation. In this case the
EVP_PKEY objects created via ENGINE_load_private_key(3) will be considered legacy and will
continue to work.
To ensure the future compatibility, the engines should be turned to providers. To prefer the provider-
based hardware o\oad, you can specify the default properties to prefer your provider.
Versioning Scheme
The OpenSSL versioning scheme has changed with the OpenSSL 3.0 release. The new versioning
scheme has this format:
MAJOR.MINOR.PATCH
For OpenSSL 1.1.1 and below, different patch levels were indicated by a letter at the end of the
release version number. This will no longer be used and instead the patch level is indicated by the
Mnal number in the version. A change in the second (MINOR) number indicates that new features
may have been added. OpenSSL versions with the same major number are API and ABI compatible.
If the major number changes then API and ABI compatibility is not guaranteed.
This also covers CRMF (RFC 4211) and HTTP transfer (RFC 6712) See openssl-cmp(1) and
OSSL_CMP_exec_certreq(3) as starting points.
HTTP(S) CLIENT
A proper HTTP(S) client that supports GET and POST, redirection, plain and ASN.1-encoded
contents, proxies, and timeouts.
This simpliMes the process of adding new KDF and PRF implementations.
Previously KDF algorithms had been shoe-horned into using the EVP_PKEY object which was not a
logical mapping. Existing applications that use KDF algorithms using EVP_PKEY (scrypt, TLS1 PRF
and HKDF) may be slower as they use an EVP_KDF bridge internally. All new applications should use
the new EVP_KDF(3) interface. See also "Key Derivation Function (KDF)" in OSSL_PROVIDER-
default(7) and "Key Derivation Function (KDF)" in OSSL_PROVIDER-FIPS(7).
All new applications should use the new EVP_MAC(3) interface. See also "Message Authentication
Code (MAC)" in OSSL_PROVIDER-default(7) and "Message Authentication Code (MAC)" in
OSSL_PROVIDER-FIPS(7).
ALGORITHM FETCHING
Using calls to convenience functions such as EVP_sha256() and EVP_aes_256_gcm() may incur a
performance penalty when using providers. Retrieving algorithms from providers involves searching
for an algorithm by name. This is much slower than directly accessing a method table. It is
recommended to prefetch algorithms if an algorithm is used many times. See "Performance" in
crypto(7), "Explicit fetching" in crypto(7) and "Implicit fetching" in crypto(7).
In order to use KTLS, support for it must be compiled in using the enable-ktls conMguration
option. It must also be enabled at run time using the SSL_OP_ENABLE_KTLS option.
NEW ALGORITHMS
See EVP_KEM-RSA(7).
The inverse ciphers use AES decryption for wrapping, and AES encryption for unwrapping. The
algorithms are: "AES-128-WRAP-INV", "AES-192-WRAP-INV", "AES-256-WRAP-INV", "AES-128-
WRAP-PAD-INV", "AES-192-WRAP-PAD-INV" and "AES-256-WRAP-PAD-INV".
• Added CAdES-BES signature scheme and attributes support (RFC 5126) to CMS API.
This uses the AES-GCM parameter (RFC 5084) for the Cryptographic Message Syntax. Its
purpose is to support encryption and decryption of a digital envelope that is both authenticated
and encrypted using AES GCM mode.
The default algorithms for pkcs12 creation with the PKCS12_create() function were changed to
more modern PBKDF2 and AES based algorithms. The default MAC iteration count was changed to
PKCS12_DEFAULT_ITER to make it equal with the password-based encryption iteration count. The
default digest algorithm for the MAC computation was changed to SHA-256. The pkcs12 application
now supports -legacy option that restores the previous default algorithms to support interoperability
with legacy systems.
Added enhanced PKCS#12 APIs which accept a library context OSSL_LIB_CTX and (where relevant)
a property query. Other APIs which handle PKCS#7 and PKCS#8 objects have also been enhanced
where required. This includes:
As part of this change the EVP_PBE_xxx APIs can also accept a library context and property query
and will call an extended version of the key/IV derivation function which supports these parameters.
This includes EVP_PBE_CipherInit_ex(3), EVP_PBE__nd_ex(3) and EVP_PBE_scrypt_ex(3).
Unlike in 1.x.y, the PKCS12KDF algorithm used when a PKCS#12 structure is created with a MAC
that does not work with the FIPS provider as the PKCS12KDF is not a FIPS approvable mechanism.
Windows thread synchronization uses read/write primitives (SRWLock) when supported by the OS,
otherwise CriticalSection continues to be used.
TRACE API
A new generic trace API has been added which provides support for enabling instrumentation
through trace output. This feature is mainly intended as an aid for developers and is disabled by
default. To utilize it, OpenSSL needs to be conMgured with the enable-trace option.
If the tracing API is enabled, the application can activate trace output by registering BIOs as trace
channels for a number of tracing and debugging categories. See OSSL_trace_enabled(3).
EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) now work for more key types. This
includes RSA, DSA, ED25519, X25519, ED448 and X448. Previously (in 1.1.1) they would return -2.
For key types that do not have parameters then EVP_PKEY_param_check(3) will always return 1.
This code is now always set to zero. Related functions are deprecated.
The type-safe wrappers are declared everywhere and implemented once. See DEFINE_STACK_OF(3)
and DECLARE_LHASH_OF(3).
The new EVP_RAND(3) is a partial replacement: the DRBG callback framework is absent. The
RAND_DRBG API did not Mt well into the new provider concept as implemented by EVP_RAND and
EVP_RAND_CTX.
These functions are legacy APIs that are not applicable to the new provider model. Applications
should instead use EVP_default_properties_is__ps_enabled(3) and
EVP_default_properties_enable__ps(3).
The Miller-Rabin test now uses 64 rounds, which is used for all prime generation, including RSA key
generation. This affects the time for larger keys sizes.
The default key generation method for the regular 2-prime RSA keys was changed to the FIPS186-4
B.3.6 method (Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes).
This method is slower than the original method.
This checks that the salt length is at least 128 bits, the derived key length is at least 112 bits, and
that the iteration count is at least 1000. For backwards compatibility these checks are disabled by
default in the default provider, but are enabled by default in the FIPS provider.
EC EVP_PKEYs with the SM2 curve have been reworked to automatically become EVP_PKEY_SM2
rather than EVP_PKEY_EC.
Unlike in previous OpenSSL versions, this means that applications cannot call
EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2) to get SM2 computations.
Parameter and key generation is also reworked to make it possible to generate EVP_PKEY_SM2
parameters and keys. Applications must now generate SM2 keys directly and must not create an
EVP_PKEY_EC key Mrst. It is no longer possible to import an SM2 key with domain parameters other
than the SM2 elliptic curve ones.
Validation of SM2 keys has been separated from the validation of regular EC keys, allowing to
improve the SM2 validation process to reject loaded private keys that are not conforming to the SM2
ISO standard. In particular, a private scalar k outside the range 1 <= k < n-1 is now correctly rejected.
This function made a EVP_PKEY object mutable after it had been set up. In OpenSSL 3.0 it was
decided that a provided key should not be able to change its type, so this function has been
removed.
For the above reasons the keys returned from these functions should typically be treated as read-
only. To emphasise this the value returned from EVP_PKEY_get0_RSA(3), EVP_PKEY_get0_DSA(3),
EVP_PKEY_get0_EC_KEY(3) and EVP_PKEY_get0_DH(3) have been made const. This may break
some existing code. Applications broken by this change should be modiMed. The preferred solution
is to refactor the code to avoid the use of these deprecated functions. Failing this the code should be
modiMed to use a const pointer instead. The EVP_PKEY_get1_RSA(3), EVP_PKEY_get1_DSA(3),
EVP_PKEY_get1_EC_KEY(3) and EVP_PKEY_get1_DH(3) functions continue to return a non-const
pointer to enable them to be "freed". However they should also be treated as read-only.
THE ERROR RETURN VALUES FROM SOME CONTROL CALLS (CTRL) HAVE CHANGED
One signiMcant change is that controls which used to return -2 for invalid inputs, now return -1
indicating a generic error condition instead.
Previously (in 1.1.1) these conYicting parameters were allowed, but will now result in errors. See
EVP_PKEY-DH(7) for further details. This affects the behaviour of openssl-genpkey(1) for DH
parameter generation.
If using a cipher from a provider the EVP_CIPH_FLAG_LENGTH_BITS Yag can only be set after the
cipher has been assigned to the cipher context. See "FLAGS" in EVP_EncryptInit(3) for more
information.
The function code part of the error code is now always set to 0. For that reason the
ERR_GET_FUNC() macro was removed. Applications must resolve the error codes only using the
library number and the reason code.
In OpenSSL 3.0 setting the IV length to any value other than 12 will result in an error. Prior to
OpenSSL 3.0 the ivlen could be smaller that the required 12 byte length, using
EVP_CIPHER_CTX_ctrl(ctx, EVP_CRTL_AEAD_SET_IVLEN, ivlen, NULL). This resulted in an IV that
had leading zero padding.
Please refer to the INSTALL.md Mle in the top of the distribution for instructions on how to build and
install OpenSSL 3.0. Please also refer to the various platform speciMc NOTES Mles for your speciMc
platform.
Upgrading to OpenSSL 3.0 from OpenSSL 1.1.1 should be relatively straight forward in most cases.
The most likely area where you will encounter problems is if you have used low level APIs in your
code (as discussed above). In that case you are likely to start seeing deprecation warnings when
compiling your application. If this happens you have 3 options:
1. Ignore the warnings. They are just warnings. The deprecated functions are still present and you
may still use them. However be aware that they may be removed from a future version of
OpenSSL.
As OpenSSL 3.0 provides a brand new Encoder/Decoder mechanism for working with widely used
Mle formats, application code that checks for particular error reason codes on key loading failures
might need an update.
Password-protected keys may deserve special attention. If only some errors are treated as an
indicator that the user should be asked about the password again, it's worth testing these scenarios
and processing the newly relevant codes.
There may be more cases to treat specially, depending on the calling application code.
Upgrading to OpenSSL 3.0 from OpenSSL 1.0.2 is likely to be signiMcantly more dilcult. In addition
to the issues discussed above in the section about "Upgrading from OpenSSL 1.1.1", the main
things to be aware of are:
Check the Mle INSTALL.md in the top of the installation for instructions on how to build and
install OpenSSL for your platform. Also read the various NOTES Mles in the same directory, as
applicable for your platform.
The structure deMnitions have been removed from the public header Mles and moved to internal
header Mles. In practice this means that you can no longer stack allocate some structures.
Instead they must be heap allocated through some function call (typically those function names
have a _new sulx to them). Additionally you must use "setter" or "getter" functions to access
the Melds within those structures.
EVP_MD_CTX md_ctx;
EVP_MD_CTX *md_ctx;
md_ctx = EVP_MD_CTX_new();
...
...
EVP_MD_CTX_free(md_ctx);
This has a number of implications for SSL/TLS applications. See the TLS1.3 page for further
details.
More details about the breaking changes between OpenSSL versions 1.0.2 and 1.1.0 can be found
on the OpenSSL 1.1.0 Changes page.
The OpenSSL 2.0 FIPS Object Module was a separate download that had to be built separately and
then integrated into your main OpenSSL 1.0.2 build. In OpenSSL 3.0 the FIPS support is fully
integrated into the mainline version of OpenSSL and is no longer a separate download. For further
information see "Completing the installation of the FIPS Module".
The function calls FIPS_mode() and FIPS_mode_set() have been removed from OpenSSL 3.0. You
should rewrite your application to not use them. See _ps_module(7) and OSSL_PROVIDER-FIPS(7)
for details.
The FIPS Module will be built and installed automatically if FIPS support has been conMgured. The
current documentation can be found in the README-FIPS Mle.
Programming
Applications written to work with OpenSSL 1.1.1 will mostly just work with OpenSSL 3.0. However
changes will be required if you want to take advantage of some of the new features that OpenSSL
3.0 makes available. In order to do that you need to understand some new concepts introduced in
OpenSSL 3.0. Read "Library contexts" in crypto(7) for further information.
Library Context
A library context allows different components of a complex application to each use a different library
context and have different providers loaded with different conMguration settings. See "Library
contexts" in crypto(7) for further info.
If the user creates an OSSL_LIB_CTX via OSSL_LIB_CTX_new(3) then many functions may need to
be changed to pass additional parameters to handle the library context.
If a library context is needed then all EVP_* digest functions that return a const EVP_MD * such as
EVP_sha256() should be replaced with a call to EVP_MD_fetch(3). See "ALGORITHM FETCHING" in
crypto(7).
If a library context is needed then all EVP_* cipher functions that return a const EVP_CIPHER * such
as EVP_aes_128_cbc() should be replaced vith a call to EVP_CIPHER_fetch(3). See "ALGORITHM
FETCHING" in crypto(7).
Some functions can be passed an object that has already been set up with a library context such as
d2i_X509(3), d2i_X509_CRL(3), d2i_X509_REQ(3) and d2i_X509_PUBKEY(3). If NULL is passed
instead then the created object will be set up with the default library context. Use X509_new_ex(3),
X509_CRL_new_ex(3), X509_REQ_new_ex(3) and X509_PUBKEY_new_ex(3) if a library context is
required.
All functions listed below with a NAME have a replacement function NAME_ex that takes
OSSL_LIB_CTX as an additional argument. Functions that have other mappings are listed along with
the respective name.
• BIO_new(3)
• CONF_modules_load__le(3)
• CT_POLICY_EVAL_CTX_new(3)
• EC_GROUP_new(3)
Use EC_GROUP_new_by_curve_name_ex(3) or EC_GROUP_new_from_params(3).
• PKCS5_PBE_keyivgen(3)
• EVP_PKCS82PKEY(3)
• EVP_PKEY_CTX_new_id(3)
Use EVP_PKEY_CTX_new_from_name(3)
• NCONF_new(3)
• OPENSSL_thread_stop(3)
• OSSL_STORE_open(3)
• SMIME_write_ASN1(3)
• SSL_load_client_CA__le(3)
• SSL_CTX_new(3)
• TS_RESP_CTX_new(3)
• X509_CRL_new(3)
• X509_NAME_hash(3)
• X509_new(3)
The following functions can be passed a library context if required. Passing NULL will use the default
library context.
• BIO_new_from_core_bio(3)
• EVP_PKEY_CTX_new_from_pkey(3)
• EVP_PKEY_Q_keygen(3)
• EVP_set_default_properties(3)
• OSSL_ENCODER_CTX_add_extra(3)
• OSSL_STORE_attach(3)
Providers
Providers are described in detail here "Providers" in crypto(7). See also "OPENSSL PROVIDERS" in
crypto(7).
Implicit and Explicit Fetching is described in detail here "ALGORITHM FETCHING" in crypto(7).
The existing functions for controls (such as EVP_CIPHER_CTX_ctrl(3)) and manipulating Yags (such
as EVP_MD_CTX_set_fags(3))internally use OSSL_PARAMS to pass information to/from provider
objects. See OSSL_PARAM(3) for additional information related to parameters.
Before providers were added algorithms were overridden by changing the methods used by
algorithms. All these methods such as RSA_new_method() and RSA_meth_new() are now
deprecated and can be replaced by using providers instead.
Any i2d and d2i functions such as d2i_DHparams() that take a low-level key type have been
deprecated. Applications should instead use the OSSL_DECODER(3) and OSSL_ENCODER(3) APIs to
read and write Mles. See "Migration" in d2i_RSAPrivateKey(3) for further details.
Functions that access low-level objects directly such as RSA_get0_n(3) are now deprecated.
Applications should use one of EVP_PKEY_get_bn_param(3), EVP_PKEY_get_int_param(3),
l<EVP_PKEY_get_size_t_param(3)>, EVP_PKEY_get_utf8_string_param(3),
EVP_PKEY_get_octet_string_param(3) or EVP_PKEY_get_params(3) to access Melds from an
EVP_PKEY. Gettable parameters are listed in "Common RSA parameters" in EVP_PKEY-RSA(7), "DH
parameters" in EVP_PKEY-DH(7), "DSA parameters" in EVP_PKEY-DSA(7), "FFC parameters" in
EVP_PKEY-FFC(7), "Common EC parameters" in EVP_PKEY-EC(7) and "Common X25519, X448,
ED25519 and ED448 parameters" in EVP_PKEY-X25519(7). Applications may also use
EVP_PKEY_todata(3) to return all Melds.
Functions that access low-level objects directly such as RSA_set0_crt_params(3) are now
deprecated. Applications should use EVP_PKEY_fromdata(3) to create new keys from user provided
key data. Keys should be immutable once they are created, so if required the user may use
EVP_PKEY_todata(3), OSSL_PARAM_merge(3), and EVP_PKEY_fromdata(3) to create a modiMed
key. See "Examples" in EVP_PKEY-DH(7) for more information. See "Deprecated low-level key
generation functions" for information on generating a key using parameters.
Low-level objects were created using methods such as RSA_new(3), RSA_up_ref(3) and
RSA_free(3). Applications should instead use the high-level EVP_PKEY APIs, e.g. EVP_PKEY_new(3),
EVP_PKEY_up_ref(3) and EVP_PKEY_free(3). See also EVP_PKEY_CTX_new_from_name(3) and
EVP_PKEY_CTX_new_from_pkey(3).
EVP_PKEYs may be created in a variety of ways: See also "Deprecated low-level key generation
functions", "Deprecated low-level key reading and writing functions" and "Deprecated low-level key
parameter setters".
Low-level encryption functions such as AES_encrypt(3) and AES_decrypt(3) have been informally
discouraged from use for a long time. Applications should instead use the high level EVP APIs
EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3), and EVP_EncryptFinal_ex(3) or
EVP_DecryptInit_ex(3), EVP_DecryptUpdate(3) and EVP_DecryptFinal_ex(3).
Use of low-level digest functions such as SHA1_Init(3) have been informally discouraged from use
for a long time. Applications should instead use the the high level EVP APIs EVP_DigestInit_ex(3),
EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3), or the quick one-shot EVP_Q_digest(3).
Note that the functions SHA1(3), SHA224(3), SHA256(3), SHA384(3) and SHA512(3) have changed
to macros that use EVP_Q_digest(3).
Use of low-level signing functions such as DSA_sign(3) have been informally discouraged for a long
time. Instead applications should use EVP_DigestSign(3) and EVP_DigestVerify(3). See also
EVP_SIGNATURE-RSA(7), EVP_SIGNATURE-DSA(7), EVP_SIGNATURE-ECDSA(7) and
EVP_SIGNATURE-ED25519(7).
Low-level mac functions such as CMAC_Init(3) are deprecated. Applications should instead use the
new EVP_MAC(3) interface, using EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3),
EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC__nal(3) or the single-shot MAC function
EVP_Q_mac(3). See EVP_MAC(3), EVP_MAC-HMAC(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7),
EVP_MAC-KMAC(7), EVP_MAC-BLAKE2(7), EVP_MAC-Poly1305(7) and EVP_MAC-Siphash(7) for
additional information.
Note that the one-shot method HMAC() is still available for compatibility purposes, but this can also
be replaced by using EVP_Q_MAC if a library context is required.
Low-level validation functions such as DH_check(3) have been informally discouraged from use for
a long time. Applications should instead use the high-level EVP_PKEY APIs such as
EVP_PKEY_check(3), EVP_PKEY_param_check(3), EVP_PKEY_param_check_quick(3),
EVP_PKEY_public_check(3), EVP_PKEY_public_check_quick(3), EVP_PKEY_private_check(3), and
EVP_PKEY_pairwise_check(3).
Many low-level functions have been informally discouraged from use for a long time. Applications
should instead use EVP_PKEY_derive(3). See EVP_KEYEXCH-DH(7), EVP_KEYEXCH-ECDH(7) and
EVP_KEYEXCH-X25519(7).
Many low-level functions have been informally discouraged from use for a long time. Applications
should instead use EVP_PKEY_keygen_init(3) and EVP_PKEY_generate(3) as described in
EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-RSA(7), EVP_PKEY-EC(7) and EVP_PKEY-
X25519(7). The 'quick' one-shot function EVP_PKEY_Q_keygen(3) and macros for the most
common cases: <EVP_RSA_gen(3)> and EVP_EC_gen(3) may also be used.
Use of low-level objects (such as DSA) has been informally discouraged from use for a long time.
Functions to read and write these low-level objects (such as PEM_read_DSA_PUBKEY()) should be
replaced. Applications should instead use OSSL_ENCODER_to_bio(3) and
OSSL_DECODER_from_bio(3).
Use of low-level objects (such as DSA) has been informally discouraged from use for a long time.
Functions to print these low-level objects such as DSA_print() should be replaced with the equivalent
EVP_PKEY functions. Application should use one of EVP_PKEY_print_public(3),
EVP_PKEY_print_private(3), EVP_PKEY_print_params(3), EVP_PKEY_print_public_fp(3),
EVP_PKEY_print_private_fp(3) or EVP_PKEY_print_params_fp(3). Note that internally these use
OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3).
There is no replacement for the IGE functions. New code should not use these modes. These
undocumented functions were never integrated into the EVP layer. They implemented the AES
InMnite Garble Extension (IGE) mode and AES Bi-directional IGE mode. These modes were never
formally standardised and usage of these functions is believed to be very small. In particular
AES_bi_ige_encrypt() has a known bug. It accepts 2 AES keys, but only one is ever used. The
security implications are believed to be minimal, but this issue was never Mxed for backwards
compatibility reasons.
• AES_unwrap_key(), AES_wrap_key()
• AES_options()
There is no replacement. It returned a string indicating if the AES code was unrolled.
There are no replacements. These old functions are not used, and could be disabled with the
macro NO_ASN1_OLD since OpenSSL 0.9.7.
• ASN1_STRING_length_set()
See "Deprecated low-level encryption functions". The BlowMsh algorithm has been moved to the
Legacy Provider.
• BF_options()
• BN_is_prime_ex(), BN_is_prime_fasttest_ex()
Use BN_check_prime(3) which avoids possible misuse and always uses at least 64 rounds of
the Miller-Rabin primality test.
• BN_pseudo_rand(), BN_pseudo_rand_range()
Use BN_rand(3) and BN_rand_range(3).
There are no replacements for these low-level functions. They were used internally by
RSA_X931_derive_ex() and RSA_X931_generate_key_ex() which are also deprecated. Use
EVP_PKEY_keygen(3) instead.
See "Deprecated low-level encryption functions". The CAST algorithm has been moved to the
Legacy Provider.
Memory-leak checking has been deprecated in favor of more modern development tools, such
as compiler memory and leak sanitizers or Valgrind.
See "Deprecated i2d and d2i functions for low-level key types"
• o2i_ECPublicKey()
See "Deprecated low-level encryption functions". Algorithms for "DESX-CBC", "DES-ECB", "DES-
CBC", "DES-OFB", "DES-CFB", "DES-CFB1" and "DES-CFB8" have been moved to the Legacy
Provider.
• DH_compute_key() DH_compute_key_padded()
• DH_generate_key(), DH_generate_parameters_ex()
• DH_KDF_X9_42()
See "Providers are a replacement for engines and low-level method overrides"
• DHparams_print(), DHparams_print_fp()
• DHparams_dup(), DSA_dup_DH()
• DSA_generate_key(), DSA_generate_parameters_ex()
See "Providers are a replacement for engines and low-level method overrides".
• DSAparams_dup()
• DSA_set0_key(), DSA_set0_pqg()
• ECDH_compute_key()
• ECDH_KDF_X9_62()
• ECDSA_size()
There are no replacements for these functions. Applications should rely on the library
automatically assigning a suitable method internally when an EC_GROUP is constructed.
• EC_GROUP_clear_free()
• EC_GROUP_have_precompute_mult(), EC_GROUP_precompute_mult(),
EC_KEY_precompute_mult()
These functions are not widely used. Applications should instead switch to named curves which
OpenSSL has hardcoded lookup tables for.
• EC_KEY_can_sign()
• EC_KEY_check_key()
• EC_KEY_dup(), EC_KEY_copy()
• EC_KEY_decoded_from_explicit_params()
There is no replacement.
• EC_KEY_generate_key()
See "Providers are a replacement for engines and low-level method overrides"
• EC_METHOD_get_Meld_type()
Use EC_GROUP_get__eld_type(3) instead. See "Providers are a replacement for engines and
low-level method overrides"
• EC_KEY_key2buf(), EC_KEY_oct2key(), EC_KEY_oct2priv(), EC_KEY_priv2buf(),
EC_KEY_priv2oct()
• EC_KEY_print(), EC_KEY_print_fp()
• EC_POINT_bn2point(), EC_POINT_point2bn()
These functions were not particularly useful, since EC point serialization formats are not
individual big-endian integers.
• EC_POINT_get_alne_coordinates_GF2m(), EC_POINT_get_alne_coordinates_GFp(),
EC_POINT_set_alne_coordinates_GF2m(), EC_POINT_set_alne_coordinates_GFp()
• EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_Jprojective_coordinates_GFp()
These functions are not widely used. Applications should instead use the
EC_POINT_set_aine_coordinates(3) and EC_POINT_get_aine_coordinates(3) functions.
• EC_POINT_make_alne(), EC_POINTs_make_alne()
There is no replacement. These functions were not widely used, and OpenSSL automatically
performs this conversion when needed.
• EC_POINT_set_compressed_coordinates_GF2m(),
EC_POINT_set_compressed_coordinates_GFp()
• EC_POINTs_mul()
This function is not widely used. Applications should instead use the EC_POINT_mul(3)
function.
• ENGINE_*()
All engine functions are deprecated. An engine should be rewritten as a provider. See "Providers
are a replacement for engines and low-level method overrides".
OpenSSL now loads error strings automatically so these functions are not needed.
• ERR_peek_error_line_data(), ERR_peek_last_error_line_data()
See "Providers are a replacement for engines and low-level method overrides".
• EVP_PKEY_CTRL_PKCS7_ENCRYPT(), EVP_PKEY_CTRL_PKCS7_DECRYPT(),
EVP_PKEY_CTRL_PKCS7_SIGN(), EVP_PKEY_CTRL_CMS_ENCRYPT(),
EVP_PKEY_CTRL_CMS_DECRYPT(), and EVP_PKEY_CTRL_CMS_SIGN()
These control operations are not invoked by the OpenSSL library anymore and are replaced by
direct checks of the key operation against the key type when the operation is initialized.
• EVP_PKEY_CTX_get0_dh_kdf_ukm(), EVP_PKEY_CTX_get0_ecdh_kdf_ukm()
See the "kdf-ukm" item in "DH key exchange parameters" in EVP_KEYEXCH-DH(7) and "ECDH
Key Exchange parameters" in EVP_KEYEXCH-ECDH(7). These functions are obsolete and
should not be required.
• EVP_PKEY_CTX_set_rsa_keygen_pubexp()
• EVP_PKEY_cmp(), EVP_PKEY_cmp_parameters()
• EVP_PKEY_encrypt_old(), EVP_PKEY_decrypt_old(),
• EVP_PKEY_get0()
See "Functions that return an internal key should be treated as read only".
• EVP_PKEY_meth_*()
See "Providers are a replacement for engines and low-level method overrides".
• EVP_PKEY_new_CMAC_key()
• EVP_PKEY_set1_tls_encodedpoint() EVP_PKEY_get1_tls_encodedpoint()
These functions were previously used by libssl to set or get an encoded public key into/from an
EVP_PKEY object. With OpenSSL 3.0 these are replaced by the more generic functions
EVP_PKEY_set1_encoded_public_key(3) and EVP_PKEY_get1_encoded_public_key(3). The old
versions have been converted to deprecated macros that just call the new functions.
• EVP_PKEY_set1_engine(), EVP_PKEY_get0_engine()
See "Providers are a replacement for engines and low-level method overrides".
• EVP_PKEY_set_alias_type()
• i2d_DHparams(), i2d_DHxparams()
See "Deprecated low-level key reading and writing functions" and "Migration" in
d2i_RSAPrivateKey(3)
See "Deprecated low-level key reading and writing functions" and "Migration" in
d2i_RSAPrivateKey(3)
See "Deprecated low-level key reading and writing functions" and "Migration" in
d2i_RSAPrivateKey(3)
• i2o_ECPublicKey()
See "Deprecated low-level key reading and writing functions" and "Migration" in
d2i_RSAPrivateKey(3)
See "Deprecated low-level encryption functions". IDEA has been moved to the Legacy Provider.
• IDEA_options()
See "Deprecated low-level encryption functions". MD2 has been moved to the Legacy Provider.
• MD2_options()
See "Deprecated low-level encryption functions". MD4 has been moved to the Legacy Provider.
See "Deprecated low-level encryption functions". MDC2 has been moved to the Legacy
Provider.
• NCONF_WIN32()
This undocumented function has no replacement. See "HISTORY" in con_g(5) for more details.
• OCSP_parse_url()
These methods were used to collect all necessary data to form a HTTP request, and to perform
the HTTP transfer with that request. With OpenSSL 3.0, the type is OSSL_HTTP_REQ_CTX, and
the deprecated functions are replaced with OSSL_HTTP_REQ_CTX_*(). See
OSSL_HTTP_REQ_CTX(3) for additional details.
There is no replacement for these functions. These pthread fork support methods were unused
by OpenSSL.
These functions helped applications and engines create loaders for schemes they supported.
These are all deprecated and discouraged in favour of provider implementations, see provider-
storemgmt(7).
• PKCS1_MGF1()
See "Deprecated low-level encryption functions". The Algorithms "RC2", "RC4" and "RC5" have
been moved to the Legacy Provider.
See "Deprecated low-level digest functions". The RIPE algorithm has been moved to the Legacy
Provider.
• RSA_check_key(), RSA_check_key_ex()
• RSA_generate_key_ex(), RSA_generate_multi_prime_key()
See "Deprecated low-level key generation functions".
• RSA_get0_engine()
See "Providers are a replacement for engines and low-level method overrides"
See "Providers are a replacement for engines and low-level method overrides".
• RSA_get_version()
There is no replacement.
See "Providers are a replacement for engines and low-level method overrides".
• RSA_padding_add_*(), RSA_padding_check_*()
See "Deprecated low-level signing functions" and "Deprecated low-level encryption functions".
• RSA_print(), RSA_print_fp()
• RSA_public_encrypt(), RSA_private_decrypt()
• RSA_private_encrypt(), RSA_public_decrypt()
This is equivalent to doing sign and verify recover operations (with a padding mode of none).
See "Deprecated low-level signing functions".
• RSAPrivateKey_dup(), RSAPublicKey_dup()
• RSAPublicKey_it(), RSAPrivateKey_it()
See "Providers are a replacement for engines and low-level method overrides"
There are no replacements for these functions. X931 padding can be set using "Signature
Parameters" in EVP_SIGNATURE-RSA(7). See OSSL_SIGNATURE_PARAM_PAD_MODE.
See "Deprecated low-level encryption functions". The SEED algorithm has been moved to the
Legacy Provider.
These are used to set the Dile-Hellman (DH) parameters that are to be used by servers
requiring ephemeral DH keys. Instead applications should consider using the built-in DH
parameters that are available by calling SSL_CTX_set_dh_auto(3) or SSL_set_dh_auto(3). If
custom parameters are necessary then applications can use the alternative functions
SSL_CTX_set0_tmp_dh_pkey(3) and SSL_set0_tmp_dh_pkey(3). There is no direct replacement
for the "callback" functions. The callback was originally useful in order to have different
parameters for export and non-export ciphersuites. Export ciphersuites are no longer supported
by OpenSSL. Use of the callback functions should be replaced by one of the other methods
described above.
• SSL_CTX_set_tlsext_ticket_key_cb()
See "Deprecated low-level digest functions". The Whirlpool algorithm has been moved to the
Legacy Provider.
• X509_certiMcate_type()
• X509_http_nbio(), X509_CRL_http_nbio()
The following functions for NID (numeric id) handling have changed semantics.
• EVP_PKEY_id(), EVP_PKEY_get_id()
This function was previously used to reliably return the NID of an EVP_PKEY object, e.g., to look
up the name of the algorithm of such EVP_PKEY by calling OBJ_nid2sn(3). With the introduction
of provider(7)s EVP_PKEY_id() or its new equivalent EVP_PKEY_get_id(3) might now also return
the value -1 (EVP_PKEY_KEYMGMT) indicating the use of a provider to implement the
EVP_PKEY object. Therefore, the use of EVP_PKEY_get0_type_name(3) is recommended for
retrieving the name of the EVP_PKEY algorithm.
New applications
openssl kdf uses the new EVP_KDF(3) API. openssl kdf uses the new EVP_MAC(3) API.
Added options
-provider_path and -provider are available to all apps and can be used multiple times to load any
providers, such as the 'legacy' provider or third party providers. If used then the 'default' provider
would also need to be speciMed if required. The -provider_path must be speciMed before the -
provider option.
The list app has many new options. See openssl-list(1) for more information.
-crl_lastupdate and -crl_nextupdate used by openssl ca allows explicit setting of Melds in the
generated CRL.
Removed options
The -crypt option used by openssl passwd. The -c option used by openssl x509, openssl dhparam,
openssl dsaparam, and openssl ecparam.
Other Changes
The output of Command line applications may have minor changes. These are primarily changes in
capitalisation and white space. However, in some cases, there are additional differences. For
example, the DH parameters output from openssl dhparam now lists 'P', 'Q', 'G' and 'pcounter'
instead of 'prime', 'generator', 'subgroup order' and 'counter' respectively.
The openssl commands that read keys, certiMcates, and CRLs now automatically detect the PEM or
DER format of the input Mles so it is not necessary to explicitly specify the input format anymore.
However if the input format option is used the speciMed format will be required.
openssl speed no longer uses low-level API calls. This implies some of the performance numbers
might not be comparable with the previous releases due to higher overhead. This applies particularly
to measuring performance on smaller data chunks.
b<openssl dhparam>, openssl dsa, openssl gendsa, openssl dsaparam, openssl genrsa and
openssl rsa have been modiMed to use PKEY APIs. openssl genrsa and openssl rsa now write PKCS
#8 keys by default.
Default settings
"SHA256" is now the default digest for TS query used by openssl ts.
Deprecated apps
openssl rsautl is deprecated, use openssl pkeyutl instead. openssl dhparam, openssl dsa, openssl
gendsa, openssl dsaparam, openssl genrsa, openssl rsa, openssl genrsa and openssl rsa are now
in maintenance mode and no new features will be added to them.
TLS Changes
This means that providers may supply their own group implementations (using either the "key
exchange" or the "key encapsulation" methods) which will automatically be detected and used
by libssl.
The signatures of the functions to get and set options on SSL and SSL_CTX objects changed
from "unsigned long" to "uint64_t" type.
This may require source code changes. For example it is no longer possible to use the SSL_OP_
macro values in preprocessor #if conditions. However it is still possible to test whether these
macros are deMned or not.
If the option is set, openssl cleanses (zeroizes) plaintext bytes from internal buffers after
delivering them to the application. Note, the application is still responsible for cleansing other
copies (e.g.: data received by SSL_read(3)).
Support for RFC 5746 secure renegotiation is now required by default for SSL or TLS
connections to succeed. Applications that require the ability to connect to legacy peers will need
to explicitly set SSL_OP_LEGACY_SERVER_CONNECT. Accordingly,
SSL_OP_LEGACY_SERVER_CONNECT is no longer set as part of SSL_OP_ALL.
• Combining the ConMgure options no-ec and no-dh no longer disables TLSv1.3
The security callback, which can be customised by application code, supports the security
operation SSL_SECOP_TMP_DH. This is deMned to take an EVP_PKEY in the "other" parameter.
In most places this is what is passed. All these places occur server side. However there was one
client side call of this security operation and it passed a DH object instead. This is incorrect
according to the deMnition of SSL_SECOP_TMP_DH, and is inconsistent with all of the other
locations. Therefore this client side call has been changed to pass an EVP_PKEY instead.
• The security strength of SHA1 and MD5 based signatures in TLS has been reduced.
This results in SSL 3, TLS 1.0, TLS 1.1 and DTLS 1.0 no longer working at the default security
level of 1 and instead requires security level 0. The security level can be changed either using the
cipher string with @SECLEVEL , or calling SSL_CTX_set_security_level(3). This also means that
where the signature algorithms extension is missing from a ClientHello then the handshake will
fail in TLS 1.2 at security level 1. This is because, although this extension is optional, failing to
provide one means that OpenSSL will fallback to a default set of signature algorithms. This
default set requires the availability of SHA1.
• X509 certiMcates signed using SHA1 are no longer allowed at security level 1 and above.
In TLS/SSL the default security level is 1. It can be set either using the cipher string with
@SECLEVEL , or calling SSL_CTX_set_security_level(3). If the leaf certiMcate is signed with
SHA-1, a call to SSL_CTX_use_certi_cate(3) will fail if the security level is not lowered Mrst.
Outside TLS/SSL, the default security level is -1 (effectively 0). It can be set using
X509_VERIFY_PARAM_set_auth_level(3) or using the -auth_level options of the commands.
SEE ALSO
_ps_module(7)
HISTORY
The migration guide was created for OpenSSL 3.0.
COPYRIGHT
Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this Mle except in
compliance with the License. You can obtain a copy in the Mle LICENSE in the source distribution or
at https://www.openssl.org/source/license.html.