Compare commits
8
Commits
be29e7bcc6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e85ee33eee
|
||
|
|
3a6d64bb68
|
||
|
|
ad9fce94c2
|
||
|
|
5dc84c29bf
|
||
|
|
8c362f8c50
|
||
|
|
2fe8309780
|
||
|
|
80ef640063
|
||
|
|
2015c00c43
|
@@ -3,6 +3,5 @@ Acknowlegements
|
||||
|
||||
Please see our [Thanks!][] page for the current acknowledgements.
|
||||
|
||||
|
||||
[Thanks!]: https://www.openssl.org/community/thanks.html
|
||||
|
||||
+28
-30
@@ -7,40 +7,38 @@ since in some cases, their employer may be the copyright holder.
|
||||
To see the full list of contributors, see the revision history in
|
||||
source control.
|
||||
|
||||
|
||||
Groups
|
||||
------
|
||||
|
||||
* OpenSSL Software Services, Inc.
|
||||
* OpenSSL Software Foundation, Inc.
|
||||
|
||||
* OpenSSL Software Services, Inc.
|
||||
* OpenSSL Software Foundation, Inc.
|
||||
|
||||
Individuals
|
||||
-----------
|
||||
|
||||
* Andy Polyakov
|
||||
* Ben Laurie
|
||||
* Ben Kaduk
|
||||
* Bernd Edlinger
|
||||
* Bodo Möller
|
||||
* David Benjamin
|
||||
* Emilia Käsper
|
||||
* Eric Young
|
||||
* Geoff Thorpe
|
||||
* Holger Reif
|
||||
* Kurt Roeckx
|
||||
* Lutz Jänicke
|
||||
* Mark J. Cox
|
||||
* Matt Caswell
|
||||
* Matthias St. Pierre
|
||||
* Nils Larsch
|
||||
* Paul Dale
|
||||
* Paul C. Sutton
|
||||
* Ralf S. Engelschall
|
||||
* Rich Salz
|
||||
* Richard Levitte
|
||||
* Stephen Henson
|
||||
* Steve Marquess
|
||||
* Tim Hudson
|
||||
* Ulf Möller
|
||||
* Viktor Dukhovni
|
||||
* Andy Polyakov
|
||||
* Ben Laurie
|
||||
* Ben Kaduk
|
||||
* Bernd Edlinger
|
||||
* Bodo Möller
|
||||
* David Benjamin
|
||||
* Emilia Käsper
|
||||
* Eric Young
|
||||
* Geoff Thorpe
|
||||
* Holger Reif
|
||||
* Kurt Roeckx
|
||||
* Lutz Jänicke
|
||||
* Mark J. Cox
|
||||
* Matt Caswell
|
||||
* Matthias St. Pierre
|
||||
* Nils Larsch
|
||||
* Paul Dale
|
||||
* Paul C. Sutton
|
||||
* Ralf S. Engelschall
|
||||
* Rich Salz
|
||||
* Richard Levitte
|
||||
* Stephen Henson
|
||||
* Steve Marquess
|
||||
* Tim Hudson
|
||||
* Ulf Möller
|
||||
* Viktor Dukhovni
|
||||
+622
-515
@@ -7,7 +7,6 @@ pick the appropriate release branch.
|
||||
|
||||
[log]: https://github.com/openssl/openssl/commits/
|
||||
|
||||
|
||||
OpenSSL Releases
|
||||
----------------
|
||||
|
||||
@@ -22,11 +21,118 @@ OpenSSL Releases
|
||||
OpenSSL 3.0
|
||||
-----------
|
||||
|
||||
### Changes between 1.1.1 and 3.0 [xx XXX xxxx] ###
|
||||
### Changes between 1.1.1 and 3.0 [xx XXX xxxx]
|
||||
|
||||
* `ASN1_verify()`, `ASN1_digest()` and `ASN1_sign()` have been deprecated.
|
||||
* Handshake now fails if Extended Master Secret extension is dropped
|
||||
on renegotiation.
|
||||
|
||||
*Tomas Mraz*
|
||||
|
||||
* Dropped interactive mode from the 'openssl' program. From now on,
|
||||
the `openssl` command without arguments is equivalent to `openssl
|
||||
help`.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* Renamed EVP_PKEY_cmp() to EVP_PKEY_eq() and
|
||||
EVP_PKEY_cmp_parameters() to EVP_PKEY_parameters_eq().
|
||||
While the old function names have been retained for backward compatibility
|
||||
they should not be used in new developments
|
||||
because their return values are confusing: Unlike other `_cmp()` functions
|
||||
they do not return 0 in case their arguments are equal.
|
||||
|
||||
*David von Oheimb*
|
||||
|
||||
* Deprecated EC_METHOD_get_field_type(). Applications should switch to
|
||||
EC_GROUP_get_field_type().
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Deprecated EC_GFp_simple_method(), EC_GFp_mont_method(),
|
||||
EC_GF2m_simple_method(), EC_GFp_nist_method(), EC_GFp_nistp224_method()
|
||||
EC_GFp_nistp256_method(), and EC_GFp_nistp521_method().
|
||||
Applications should rely on the library automatically assigning a suitable
|
||||
EC_METHOD internally upon EC_GROUP construction.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Deprecated EC_GROUP_new(), EC_GROUP_method_of(), and EC_POINT_method_of().
|
||||
EC_METHOD is now an internal-only concept and a suitable EC_METHOD is
|
||||
assigned internally without application intervention.
|
||||
Users of EC_GROUP_new() should switch to a different suitable constructor.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Add CAdES-BES signature verification support, mostly derived
|
||||
from ESSCertIDv2 TS (RFC 5816) contribution by Marek Klein.
|
||||
|
||||
*Filipe Raimundo da Silva*
|
||||
|
||||
* Add CAdES-BES signature scheme and attributes support (RFC 5126) to CMS API.
|
||||
|
||||
*Antonio Iacono*
|
||||
|
||||
* Deprecated EC_POINT_make_affine() and EC_POINTs_make_affine(). These
|
||||
functions are not widely used and now OpenSSL automatically perform this
|
||||
conversion when needed.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Deprecated EC_GROUP_precompute_mult(), EC_GROUP_have_precompute_mult(), and
|
||||
EC_KEY_precompute_mult(). These functions are not widely used and
|
||||
applications should instead switch to named curves which OpenSSL has
|
||||
hardcoded lookup tables for.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Deprecated EC_POINTs_mul(). This function is not widely used and applications
|
||||
should instead use the L<EC_POINT_mul(3)> function.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Removed FIPS_mode() and FIPS_mode_set(). These functions are legacy API's
|
||||
that are not applicable to the new provider model. Applications should
|
||||
instead use EVP_default_properties_is_fips_enabled() and
|
||||
EVP_default_properties_enable_fips().
|
||||
|
||||
*Shane Lontis*
|
||||
|
||||
* The SSL option SSL_OP_IGNORE_UNEXPECTED_EOF is introduced. If that option
|
||||
is set, an unexpected EOF is ignored, it pretends a close notify was received
|
||||
instead and so the returned error becomes SSL_ERROR_ZERO_RETURN.
|
||||
|
||||
*Dmitry Belyavskiy*
|
||||
|
||||
* Deprecated EC_POINT_set_Jprojective_coordinates_GFp() and
|
||||
EC_POINT_get_Jprojective_coordinates_GFp(). These functions are not widely
|
||||
used and applications should instead use the
|
||||
L<EC_POINT_set_affine_coordinates(3)> and
|
||||
L<EC_POINT_get_affine_coordinates(3)> functions.
|
||||
|
||||
*Billy Bob Brumley*
|
||||
|
||||
* Added OSSL_PARAM_BLD to the public interface. This allows OSSL_PARAM
|
||||
arrays to be more easily constructed via a series of utility functions.
|
||||
Create a parameter builder using OSSL_PARAM_BLD_new(), add parameters using
|
||||
the various push functions and finally convert to a passable OSSL_PARAM
|
||||
array using OSSL_PARAM_BLD_to_param().
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH(), and
|
||||
EVP_PKEY_get0_EC_KEY() can now handle EVP_PKEYs with provider side
|
||||
internal keys, if they correspond to one of those built in types.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* Added EVP_PKEY_set_type_by_keymgmt(), to initialise an EVP_PKEY to
|
||||
contain a provider side internal key.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* ASN1_verify(), ASN1_digest() and ASN1_sign() have been deprecated.
|
||||
They are old functions that we don't use, and that you could disable with
|
||||
the macro `NO_ASN1_OLD`. This goes all the way back to OpenSSL 0.9.7.
|
||||
the macro NO_ASN1_OLD. This goes all the way back to OpenSSL 0.9.7.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
@@ -53,38 +159,48 @@ OpenSSL 3.0
|
||||
|
||||
*Matthias St. Pierre*
|
||||
|
||||
|
||||
* The test suite is changed to preserve results of each test recipe.
|
||||
A new directory test-runs/ with subdirectories named like the
|
||||
test recipes are created in the build tree for this purpose.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* The command line utilities ecparam and ec have been deprecated. Instead
|
||||
use the pkeyparam, pkey and genpkey programs.
|
||||
* Added an implementation of CMP and CRMF (RFC 4210, RFC 4211 RFC 6712).
|
||||
This adds crypto/cmp/, crpyto/crmf/, apps/cmp.c, and test/cmp_*.
|
||||
See L<openssl-cmp(1)> and L<OSSL_CMP_exec_IR_ses(3)> as starting points.
|
||||
|
||||
*Paul Dale*
|
||||
*David von Oheimb, Martin Peylo*
|
||||
|
||||
* Generalized the HTTP client code from crypto/ocsp/ into crpyto/http/.
|
||||
The legacy OCSP-focused and only partly documented API is retained.
|
||||
See L<OSSL_CMP_MSG_http_perform(3)> etc. for details.
|
||||
|
||||
*David von Oheimb*
|
||||
|
||||
* BIO_do_connect and BIO_do_handshake have been extended:
|
||||
If domain name resolution yields multiple IP addresses all of them are tried
|
||||
after connect() failures.
|
||||
|
||||
*David von Oheimb*
|
||||
|
||||
* All of the low level RSA functions have been deprecated including:
|
||||
|
||||
RSA_new_method, RSA_bits, RSA_size, RSA_security_bits,
|
||||
RSA_get0_pss_params, RSA_get_version, RSA_get0_engine,
|
||||
RSA_generate_key_ex, RSA_generate_multi_prime_key,
|
||||
RSA_X931_derive_ex, RSA_X931_generate_key_ex, RSA_check_key,
|
||||
RSA_check_key_ex, RSA_public_encrypt, RSA_private_encrypt,
|
||||
RSA_new_method, RSA_size, RSA_security_bits, RSA_get0_pss_params,
|
||||
RSA_get_version, RSA_get0_engine, RSA_generate_key_ex,
|
||||
RSA_generate_multi_prime_key, RSA_X931_derive_ex, RSA_X931_generate_key_ex,
|
||||
RSA_check_key, RSA_check_key_ex, RSA_public_encrypt, RSA_private_encrypt,
|
||||
RSA_public_decrypt, RSA_private_decrypt, RSA_set_default_method,
|
||||
RSA_get_default_method, RSA_null_method, RSA_get_method, RSA_set_method,
|
||||
RSA_PKCS1_OpenSSL, RSA_print_fp, RSA_print, RSA_sign, RSA_verify,
|
||||
RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING,
|
||||
RSA_blinding_on, RSA_blinding_off, RSA_setup_blinding,
|
||||
RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1,
|
||||
RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2,
|
||||
PKCS1_MGF1, RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP,
|
||||
RSA_padding_add_PKCS1_OAEP_mgf1, RSA_padding_check_PKCS1_OAEP_mgf1,
|
||||
RSA_padding_add_SSLv23, RSA_padding_check_SSLv23,
|
||||
RSA_padding_add_none, RSA_padding_check_none, RSA_padding_add_X931,
|
||||
RSA_padding_check_X931, RSA_X931_hash_id, RSA_verify_PKCS1_PSS,
|
||||
RSA_padding_add_PKCS1_PSS, RSA_verify_PKCS1_PSS_mgf1,
|
||||
RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING, RSA_blinding_on,
|
||||
RSA_blinding_off, RSA_setup_blinding, RSA_padding_add_PKCS1_type_1,
|
||||
RSA_padding_check_PKCS1_type_1, RSA_padding_add_PKCS1_type_2,
|
||||
RSA_padding_check_PKCS1_type_2, PKCS1_MGF1, RSA_padding_add_PKCS1_OAEP,
|
||||
RSA_padding_check_PKCS1_OAEP, RSA_padding_add_PKCS1_OAEP_mgf1,
|
||||
RSA_padding_check_PKCS1_OAEP_mgf1, RSA_padding_add_SSLv23,
|
||||
RSA_padding_check_SSLv23, RSA_padding_add_none, RSA_padding_check_none,
|
||||
RSA_padding_add_X931, RSA_padding_check_X931, RSA_X931_hash_id,
|
||||
RSA_verify_PKCS1_PSS, RSA_padding_add_PKCS1_PSS, RSA_verify_PKCS1_PSS_mgf1,
|
||||
RSA_padding_add_PKCS1_PSS_mgf1, RSA_set_ex_data, RSA_get_ex_data,
|
||||
RSA_meth_new, RSA_meth_free, RSA_meth_dup, RSA_meth_get0_name,
|
||||
RSA_meth_set1_name, RSA_meth_get_flags, RSA_meth_set_flags,
|
||||
@@ -119,28 +235,37 @@ OpenSSL 3.0
|
||||
*Kurt Roeckx*
|
||||
|
||||
* The command line utilities dhparam, dsa, gendsa and dsaparam have been
|
||||
deprecated. Instead use the pkeyparam, pkey, genpkey and pkeyparam
|
||||
programs respectively.
|
||||
modified to use PKEY APIs. These commands are now in maintenance mode
|
||||
and no new features will be added to them.
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* The command line utility rsautl has been deprecated.
|
||||
Instead use the pkeyutl program.
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* The command line utilities genrsa and rsa have been modified to use PKEY
|
||||
APIs These commands are now in maintenance mode and no new features will
|
||||
be added to them.
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* All of the low level DH functions have been deprecated including:
|
||||
|
||||
DH_OpenSSL, DH_set_default_method, DH_get_default_method, DH_set_method,
|
||||
DH_new_method, DH_bits, DH_size, DH_security_bits, DH_get_ex_new_index,
|
||||
DH_new_method, DH_size, DH_security_bits, DH_get_ex_new_index,
|
||||
DH_set_ex_data, DH_get_ex_data, DH_generate_parameters_ex,
|
||||
DH_check_params_ex, DH_check_ex, DH_check_pub_key_ex,
|
||||
DH_check, DH_check_pub_key, DH_generate_key, DH_compute_key,
|
||||
DH_compute_key_padded, DHparams_print_fp, DHparams_print, DH_get_nid,
|
||||
DH_KDF_X9_42, DH_get0_engine, DH_get_length, DH_set_length, DH_meth_new,
|
||||
DH_meth_free, DH_meth_dup, DH_meth_get0_name, DH_meth_set1_name,
|
||||
DH_meth_get_flags, DH_meth_set_flags, DH_meth_get0_app_data,
|
||||
DH_meth_set0_app_data, DH_meth_get_generate_key,
|
||||
DH_meth_set_generate_key, DH_meth_get_compute_key,
|
||||
DH_meth_set_compute_key, DH_meth_get_bn_mod_exp,
|
||||
DH_meth_set_bn_mod_exp, DH_meth_get_init, DH_meth_set_init,
|
||||
DH_meth_get_finish, DH_meth_set_finish, DH_meth_get_generate_params
|
||||
and DH_meth_set_generate_params.
|
||||
DH_KDF_X9_42, DH_get0_engine, DH_meth_new, DH_meth_free, DH_meth_dup,
|
||||
DH_meth_get0_name, DH_meth_set1_name, DH_meth_get_flags, DH_meth_set_flags,
|
||||
DH_meth_get0_app_data, DH_meth_set0_app_data, DH_meth_get_generate_key,
|
||||
DH_meth_set_generate_key, DH_meth_get_compute_key, DH_meth_set_compute_key,
|
||||
DH_meth_get_bn_mod_exp, DH_meth_set_bn_mod_exp, DH_meth_get_init,
|
||||
DH_meth_set_init, DH_meth_get_finish, DH_meth_set_finish,
|
||||
DH_meth_get_generate_params and DH_meth_set_generate_params.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use L<EVP_PKEY_derive_init(3)>
|
||||
@@ -151,18 +276,19 @@ OpenSSL 3.0
|
||||
* All of the low level DSA functions have been deprecated including:
|
||||
|
||||
DSA_do_sign, DSA_do_verify, DSA_OpenSSL, DSA_set_default_method,
|
||||
DSA_get_default_method, DSA_set_method, DSA_get_method, DSA_new_method,
|
||||
DSA_sign_setup, DSA_sign, DSA_verify, DSA_get_ex_new_index,
|
||||
DSA_set_ex_data, DSA_get_ex_data, DSA_generate_parameters_ex,
|
||||
DSA_generate_key, DSA_meth_new, DSA_get0_engine, DSA_meth_free,
|
||||
DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name, DSA_meth_get_flags,
|
||||
DSA_meth_set_flags, DSA_meth_get0_app_data, DSA_meth_set0_app_data,
|
||||
DSA_meth_get_sign, DSA_meth_set_sign, DSA_meth_get_sign_setup,
|
||||
DSA_meth_set_sign_setup, DSA_meth_get_verify, DSA_meth_set_verify,
|
||||
DSA_meth_get_mod_exp, DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp,
|
||||
DSA_meth_set_bn_mod_exp, DSA_meth_get_init, DSA_meth_set_init,
|
||||
DSA_meth_get_finish, DSA_meth_set_finish, DSA_meth_get_paramgen,
|
||||
DSA_meth_set_paramgen, DSA_meth_get_keygen and DSA_meth_set_keygen.
|
||||
DSA_get_default_method, DSA_set_method, DSA_get_method,
|
||||
DSA_new_method, DSA_size, DSA_security_bits, DSA_sign_setup, DSA_sign,
|
||||
DSA_verify, DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data,
|
||||
DSA_generate_parameters_ex, DSA_generate_key, DSA_meth_new, DSA_get0_engine,
|
||||
DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name,
|
||||
DSA_meth_get_flags, DSA_meth_set_flags, DSA_meth_get0_app_data,
|
||||
DSA_meth_set0_app_data, DSA_meth_get_sign, DSA_meth_set_sign,
|
||||
DSA_meth_get_sign_setup, DSA_meth_set_sign_setup, DSA_meth_get_verify,
|
||||
DSA_meth_set_verify, DSA_meth_get_mod_exp, DSA_meth_set_mod_exp,
|
||||
DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp, DSA_meth_get_init,
|
||||
DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish,
|
||||
DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen and
|
||||
DSA_meth_set_keygen.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use L<EVP_DigestSignInit_ex(3)>,
|
||||
@@ -235,8 +361,8 @@ OpenSSL 3.0
|
||||
and HMAC_CTX_get_md.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use L<EVP_MAC_CTX_new(3)>,
|
||||
L<EVP_MAC_CTX_free(3)>, L<EVP_MAC_init(3)>, L<EVP_MAC_update(3)>
|
||||
time. Instead applications should use L<EVP_MAC_new_ctx(3)>,
|
||||
L<EVP_MAC_free_ctx(3)>, L<EVP_MAC_init(3)>, L<EVP_MAC_update(3)>
|
||||
and L<EVP_MAC_final(3)>.
|
||||
|
||||
*Paul Dale*
|
||||
@@ -259,8 +385,8 @@ OpenSSL 3.0
|
||||
CMAC_CTX_copy, CMAC_Init, CMAC_Update, CMAC_Final and CMAC_resume.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use L<EVP_MAC_CTX_new(3)>,
|
||||
L<EVP_MAC_CTX_free(3)>, L<EVP_MAC_init(3)>, L<EVP_MAC_update(3)>
|
||||
time. Instead applications should use L<EVP_MAC_new_ctx(3)>,
|
||||
L<EVP_MAC_free_ctx(3)>, L<EVP_MAC_init(3)>, L<EVP_MAC_update(3)>
|
||||
and L<EVP_MAC_final(3)>.
|
||||
|
||||
*Paul Dale*
|
||||
@@ -286,7 +412,7 @@ OpenSSL 3.0
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* Corrected the documentation of the return values from the EVP_DigestSign*
|
||||
* Corrected the documentation of the return values from the `EVP_DigestSign*`
|
||||
set of functions. The documentation mentioned negative values for some
|
||||
errors, but this was never the case, so the mention of negative values
|
||||
was removed.
|
||||
@@ -374,6 +500,11 @@ OpenSSL 3.0
|
||||
|
||||
*Rich Salz*
|
||||
|
||||
* Added documentation for the STACK API. OpenSSL only defines the STACK
|
||||
functions where they are used.
|
||||
|
||||
*Rich Salz*
|
||||
|
||||
* Introduced a new method type and API, OSSL_SERIALIZER, to
|
||||
represent generic serializers. An implementation is expected to
|
||||
be able to serialize an object associated with a given name (such
|
||||
@@ -457,13 +588,6 @@ OpenSSL 3.0
|
||||
- SSL_CTX_load_verify_dir()
|
||||
- SSL_CTX_load_verify_store()
|
||||
|
||||
Also, the following functions are now deprecated:
|
||||
|
||||
- X509_STORE_load_locations() (use X509_STORE_load_file(),
|
||||
X509_STORE_load_path() or X509_STORE_load_store() instead)
|
||||
- SSL_CTX_load_verify_locations() (use SSL_CTX_load_verify_file(),
|
||||
SSL_CTX_load_verify_dir() or SSL_CTX_load_verify_store() instead)
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* Added a new method to gather entropy on VMS, based on SYS$GET_ENTROPY.
|
||||
@@ -535,7 +659,6 @@ OpenSSL 3.0
|
||||
$ mms /macro=(VF=1) test ! OpenVMS
|
||||
$ nmake VF=1 test # Windows
|
||||
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* For built-in EC curves, ensure an EC_GROUP built from the curve name is
|
||||
@@ -587,7 +710,7 @@ OpenSSL 3.0
|
||||
when primes for RSA keys are computed.
|
||||
Since we previously always generated primes == 2 (mod 3) for RSA keys,
|
||||
the 2-prime and 3-prime RSA modules were easy to distinguish, since
|
||||
N = p*q = 1 (mod 3), but N = p*q*r = 2 (mod 3). Therefore fingerprinting
|
||||
`N = p*q = 1 (mod 3)`, but `N = p*q*r = 2 (mod 3)`. Therefore fingerprinting
|
||||
2-prime vs. 3-prime RSA keys was possible by computing N mod 3.
|
||||
This avoids possible fingerprinting of newly generated RSA modules.
|
||||
|
||||
@@ -638,7 +761,7 @@ OpenSSL 3.0
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
* {CRYPTO,OPENSSL}_mem_debug_{push,pop} are now no-ops and have been
|
||||
* `{CRYPTO,OPENSSL}_mem_debug_{push,pop}` are now no-ops and have been
|
||||
deprecated.
|
||||
|
||||
*Rich Salz*
|
||||
@@ -753,7 +876,7 @@ OpenSSL 3.0
|
||||
*Paul Dale*
|
||||
|
||||
* Added newline escaping functionality to a filename when using openssl dgst.
|
||||
This output format is to replicate the output format found in the '*sum'
|
||||
This output format is to replicate the output format found in the `*sum`
|
||||
checksum programs. This aims to preserve backward compatibility.
|
||||
|
||||
*Matt Eaton, Richard Levitte, and Paul Dale*
|
||||
@@ -913,7 +1036,7 @@ OpenSSL 3.0
|
||||
the attacked described in "Efficient Instantiations of Tweakable
|
||||
Blockciphers and Refinements to Modes OCB and PMAC" by Phillip Rogaway.
|
||||
Details of this attack can be obtained from:
|
||||
http://web.cs.ucdavis.edu/%7Erogaway/papers/offsets.pdf
|
||||
<http://web.cs.ucdavis.edu/%7Erogaway/papers/offsets.pdf>
|
||||
|
||||
*Paul Dale*
|
||||
|
||||
@@ -934,11 +1057,35 @@ OpenSSL 3.0
|
||||
|
||||
*Boris Pismenny*
|
||||
|
||||
|
||||
OpenSSL 1.1.1
|
||||
-------------
|
||||
|
||||
### Changes between 1.1.1d and 1.1.1e [xx XXX xxxx] ###
|
||||
### Changes between 1.1.1e and 1.1.1f [xx XXX xxxx]
|
||||
|
||||
### Changes between 1.1.1d and 1.1.1e [17 Mar 2020]
|
||||
|
||||
* Properly detect EOF while reading in libssl. Previously if we hit an EOF
|
||||
while reading in libssl then we would report an error back to the
|
||||
application (SSL_ERROR_SYSCALL) but errno would be 0. We now add
|
||||
an error to the stack (which means we instead return SSL_ERROR_SSL) and
|
||||
therefore give a hint as to what went wrong.
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
* Check that ed25519 and ed448 are allowed by the security level. Previously
|
||||
signature algorithms not using an MD were not being checked that they were
|
||||
allowed by the security level.
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
* Fixed SSL_get_servername() behaviour. The behaviour of SSL_get_servername()
|
||||
was not quite right. The behaviour was not consistent between resumption
|
||||
and normal handshakes, and also not quite consistent with historical
|
||||
behaviour. The behaviour in various scenarios has been clarified and
|
||||
it has been updated to make it match historical behaviour as closely as
|
||||
possible.
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
* *[VMS only]* The header files that the VMS compilers include automatically,
|
||||
`__DECC_INCLUDE_PROLOGUE.H` and `__DECC_INCLUDE_EPILOGUE.H`, use pragmas
|
||||
@@ -959,7 +1106,7 @@ OpenSSL 1.1.1
|
||||
*Richard Levitte*
|
||||
|
||||
* Added newline escaping functionality to a filename when using openssl dgst.
|
||||
This output format is to replicate the output format found in the '*sum'
|
||||
This output format is to replicate the output format found in the `*sum`
|
||||
checksum programs. This aims to preserve backward compatibility.
|
||||
|
||||
*Matt Eaton, Richard Levitte, and Paul Dale*
|
||||
@@ -969,7 +1116,7 @@ OpenSSL 1.1.1
|
||||
|
||||
*Jon Spillett*
|
||||
|
||||
### Changes between 1.1.1c and 1.1.1d [10 Sep 2019] ###
|
||||
### Changes between 1.1.1c and 1.1.1d [10 Sep 2019]
|
||||
|
||||
* Fixed a fork protection issue. OpenSSL 1.1.1 introduced a rewritten random
|
||||
number generator (RNG). This was intended to include protection in the
|
||||
@@ -1074,7 +1221,7 @@ OpenSSL 1.1.1
|
||||
|
||||
*Matthias St. Pierre*
|
||||
|
||||
### Changes between 1.1.1b and 1.1.1c [28 May 2019] ###
|
||||
### Changes between 1.1.1b and 1.1.1c [28 May 2019]
|
||||
|
||||
* Add build tests for C++. These are generated files that only do one
|
||||
thing, to include one public OpenSSL head file each. This tests that
|
||||
@@ -1165,7 +1312,7 @@ OpenSSL 1.1.1
|
||||
|
||||
*Paul Yang*
|
||||
|
||||
### Changes between 1.1.1a and 1.1.1b [26 Feb 2019] ###
|
||||
### Changes between 1.1.1a and 1.1.1b [26 Feb 2019]
|
||||
|
||||
* Change the info callback signals for the start and end of a post-handshake
|
||||
message exchange in TLSv1.3. In 1.1.1/1.1.1a we used SSL_CB_HANDSHAKE_START
|
||||
@@ -1179,7 +1326,7 @@ OpenSSL 1.1.1
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.1.1 and 1.1.1a [20 Nov 2018] ###
|
||||
### Changes between 1.1.1 and 1.1.1a [20 Nov 2018]
|
||||
|
||||
* Timing vulnerability in DSA signature generation
|
||||
|
||||
@@ -1212,7 +1359,7 @@ OpenSSL 1.1.1
|
||||
automatically and is fully functional even without additional randomness
|
||||
provided by the application.
|
||||
|
||||
### Changes between 1.1.0i and 1.1.1 [11 Sep 2018] ###
|
||||
### Changes between 1.1.0i and 1.1.1 [11 Sep 2018]
|
||||
|
||||
* Add a new ClientHello callback. Provides a callback interface that gives
|
||||
the application the ability to adjust the nascent SSL object at the
|
||||
@@ -1482,7 +1629,7 @@ OpenSSL 1.1.1
|
||||
* Support for TLSv1.3 added. Note that users upgrading from an earlier
|
||||
version of OpenSSL should review their configuration settings to ensure
|
||||
that they are still appropriate for TLSv1.3. For further information see:
|
||||
https://wiki.openssl.org/index.php/TLS1.3
|
||||
<https://wiki.openssl.org/index.php/TLS1.3>
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
@@ -1735,7 +1882,7 @@ OpenSSL 1.1.1
|
||||
|
||||
* 'openssl passwd' can now produce SHA256 and SHA512 based output,
|
||||
using the algorithm defined in
|
||||
https://www.akkadia.org/drepper/SHA-crypt.txt
|
||||
<https://www.akkadia.org/drepper/SHA-crypt.txt>
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
@@ -1755,8 +1902,7 @@ OpenSSL 1.1.1
|
||||
OpenSSL 1.1.0
|
||||
-------------
|
||||
|
||||
|
||||
### Changes between 1.1.0k and 1.1.0l [10 Sep 2019] ###
|
||||
### Changes between 1.1.0k and 1.1.0l [10 Sep 2019]
|
||||
|
||||
* For built-in EC curves, ensure an EC_GROUP built from the curve name is
|
||||
used even when parsing explicit parameters, when loading a serialized key
|
||||
@@ -1802,7 +1948,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.1.0j and 1.1.0k [28 May 2019] ###
|
||||
### Changes between 1.1.0j and 1.1.0k [28 May 2019]
|
||||
|
||||
* Change the default RSA, DSA and DH size to 2048 bit instead of 1024.
|
||||
This changes the size when using the genpkey app when no size is given. It
|
||||
@@ -1865,7 +2011,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.1.0i and 1.1.0j [20 Nov 2018] ###
|
||||
### Changes between 1.1.0i and 1.1.0j [20 Nov 2018]
|
||||
|
||||
* Timing vulnerability in DSA signature generation
|
||||
|
||||
@@ -1895,7 +2041,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Sohaib ul Hassan, Nicola Tuveri, Billy Bob Brumley*
|
||||
|
||||
### Changes between 1.1.0h and 1.1.0i [14 Aug 2018] ###
|
||||
### Changes between 1.1.0h and 1.1.0i [14 Aug 2018]
|
||||
|
||||
* Client DoS due to large DH parameter
|
||||
|
||||
@@ -1980,7 +2126,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.1.0g and 1.1.0h [27 Mar 2018] ###
|
||||
### Changes between 1.1.0g and 1.1.0h [27 Mar 2018]
|
||||
|
||||
* Constructed ASN.1 types with a recursive definition could exceed the stack
|
||||
|
||||
@@ -2059,7 +2205,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.1.0f and 1.1.0g [2 Nov 2017] ###
|
||||
### Changes between 1.1.0f and 1.1.0g [2 Nov 2017]
|
||||
|
||||
* bn_sqrx8x_internal carry bug on x86_64
|
||||
|
||||
@@ -2094,7 +2240,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Rich Salz*
|
||||
|
||||
### Changes between 1.1.0e and 1.1.0f [25 May 2017] ###
|
||||
### Changes between 1.1.0e and 1.1.0f [25 May 2017]
|
||||
|
||||
* Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target
|
||||
platform rather than 'mingw'.
|
||||
@@ -2107,7 +2253,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.1.0d and 1.1.0e [16 Feb 2017] ###
|
||||
### Changes between 1.1.0d and 1.1.0e [16 Feb 2017]
|
||||
|
||||
* Encrypt-Then-Mac renegotiation crash
|
||||
|
||||
@@ -2121,7 +2267,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.1.0c and 1.1.0d [26 Jan 2017] ###
|
||||
### Changes between 1.1.0c and 1.1.0d [26 Jan 2017]
|
||||
|
||||
* Truncated packet could crash via OOB read
|
||||
|
||||
@@ -2167,11 +2313,11 @@ OpenSSL 1.1.0
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.1.0b and 1.1.0c [10 Nov 2016] ###
|
||||
### Changes between 1.1.0b and 1.1.0c [10 Nov 2016]
|
||||
|
||||
* ChaCha20/Poly1305 heap-buffer-overflow
|
||||
|
||||
TLS connections using *-CHACHA20-POLY1305 ciphersuites are susceptible to
|
||||
TLS connections using `*-CHACHA20-POLY1305` ciphersuites are susceptible to
|
||||
a DoS attack by corrupting larger payloads. This can result in an OpenSSL
|
||||
crash. This issue is not considered to be exploitable beyond a DoS.
|
||||
|
||||
@@ -2223,7 +2369,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.1.0a and 1.1.0b [26 Sep 2016] ###
|
||||
### Changes between 1.1.0a and 1.1.0b [26 Sep 2016]
|
||||
|
||||
* Fix Use After Free for large message sizes
|
||||
|
||||
@@ -2241,7 +2387,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.1.0 and 1.1.0a [22 Sep 2016] ###
|
||||
### Changes between 1.1.0 and 1.1.0a [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth
|
||||
|
||||
@@ -2320,7 +2466,7 @@ OpenSSL 1.1.0
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.0.2h and 1.1.0 [25 Aug 2016] ###
|
||||
### Changes between 1.0.2h and 1.1.0 [25 Aug 2016]
|
||||
|
||||
* Windows command-line tool supports UTF-8 opt-in option for arguments
|
||||
and console input. Setting OPENSSL_WIN32_UTF8 environment variable
|
||||
@@ -2363,8 +2509,8 @@ OpenSSL 1.1.0
|
||||
|
||||
*Joseph Wylie Yandle, Rich Salz*
|
||||
|
||||
* The stack and lhash API's were renamed to start with OPENSSL_SK_
|
||||
and OPENSSL_LH_, respectively. The old names are available
|
||||
* The stack and lhash API's were renamed to start with `OPENSSL_SK_`
|
||||
and `OPENSSL_LH_`, respectively. The old names are available
|
||||
with API compatibility. They new names are now completely documented.
|
||||
|
||||
*Rich Salz*
|
||||
@@ -2542,12 +2688,12 @@ OpenSSL 1.1.0
|
||||
*Todd Short*
|
||||
|
||||
* Changes to the DEFAULT cipherlist:
|
||||
- Prefer (EC)DHE handshakes over plain RSA.
|
||||
- Prefer AEAD ciphers over legacy ciphers.
|
||||
- Prefer ECDSA over RSA when both certificates are available.
|
||||
- Prefer TLSv1.2 ciphers/PRF.
|
||||
- Remove DSS, SEED, IDEA, CAMELLIA, and AES-CCM from the
|
||||
default cipherlist.
|
||||
- Prefer (EC)DHE handshakes over plain RSA.
|
||||
- Prefer AEAD ciphers over legacy ciphers.
|
||||
- Prefer ECDSA over RSA when both certificates are available.
|
||||
- Prefer TLSv1.2 ciphers/PRF.
|
||||
- Remove DSS, SEED, IDEA, CAMELLIA, and AES-CCM from the
|
||||
default cipherlist.
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
@@ -2709,8 +2855,8 @@ OpenSSL 1.1.0
|
||||
|
||||
* The signature of the session callback configured with
|
||||
SSL_CTX_sess_set_get_cb was changed. The read-only input buffer
|
||||
was explicitly marked as 'const unsigned char*' instead of
|
||||
'unsigned char*'.
|
||||
was explicitly marked as `const unsigned char*` instead of
|
||||
`unsigned char*`.
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
@@ -2742,7 +2888,7 @@ OpenSSL 1.1.0
|
||||
Makefile. Instead, Configure produces a perl module in
|
||||
configdata.pm which holds most of the config data (in the hash
|
||||
table %config), the target data that comes from the target
|
||||
configuration in one of the Configurations/*.conf files (in
|
||||
configuration in one of the `Configurations/*.conf~ files (in
|
||||
%target).
|
||||
|
||||
*Richard Levitte*
|
||||
@@ -2771,7 +2917,7 @@ OpenSSL 1.1.0
|
||||
|
||||
* The GOST engine was out of date and therefore it has been removed. An up
|
||||
to date GOST engine is now being maintained in an external repository.
|
||||
See: https://wiki.openssl.org/index.php/Binaries. Libssl still retains
|
||||
See: <https://wiki.openssl.org/index.php/Binaries>. Libssl still retains
|
||||
support for GOST ciphersuites (these are only activated if a GOST engine
|
||||
is present).
|
||||
|
||||
@@ -3125,7 +3271,7 @@ OpenSSL 1.1.0
|
||||
|
||||
* Added support for OCB mode. OpenSSL has been granted a patent license
|
||||
compatible with the OpenSSL license for use of OCB. Details are available
|
||||
at https://www.openssl.org/source/OCB-patent-grant-OpenSSL.pdf. Support
|
||||
at <https://www.openssl.org/source/OCB-patent-grant-OpenSSL.pdf>. Support
|
||||
for OCB can be removed by calling config with no-ocb.
|
||||
|
||||
*Matt Caswell*
|
||||
@@ -3164,16 +3310,16 @@ OpenSSL 1.1.0
|
||||
*Rich Salz*
|
||||
|
||||
* Clean up OPENSSL_NO_xxx #define's
|
||||
- Use setbuf() and remove OPENSSL_NO_SETVBUF_IONBF
|
||||
- Rename OPENSSL_SYSNAME_xxx to OPENSSL_SYS_xxx
|
||||
- OPENSSL_NO_EC{DH,DSA} merged into OPENSSL_NO_EC
|
||||
- OPENSSL_NO_RIPEMD160, OPENSSL_NO_RIPEMD merged into OPENSSL_NO_RMD160
|
||||
- OPENSSL_NO_FP_API merged into OPENSSL_NO_STDIO
|
||||
- Remove OPENSSL_NO_BIO OPENSSL_NO_BUFFER OPENSSL_NO_CHAIN_VERIFY
|
||||
OPENSSL_NO_EVP OPENSSL_NO_FIPS_ERR OPENSSL_NO_HASH_COMP
|
||||
OPENSSL_NO_LHASH OPENSSL_NO_OBJECT OPENSSL_NO_SPEED OPENSSL_NO_STACK
|
||||
OPENSSL_NO_X509 OPENSSL_NO_X509_VERIFY
|
||||
- Remove MS_STATIC; it's a relic from platforms <32 bits.
|
||||
- Use setbuf() and remove OPENSSL_NO_SETVBUF_IONBF
|
||||
- Rename OPENSSL_SYSNAME_xxx to OPENSSL_SYS_xxx
|
||||
- OPENSSL_NO_EC{DH,DSA} merged into OPENSSL_NO_EC
|
||||
- OPENSSL_NO_RIPEMD160, OPENSSL_NO_RIPEMD merged into OPENSSL_NO_RMD160
|
||||
- OPENSSL_NO_FP_API merged into OPENSSL_NO_STDIO
|
||||
- Remove OPENSSL_NO_BIO OPENSSL_NO_BUFFER OPENSSL_NO_CHAIN_VERIFY
|
||||
OPENSSL_NO_EVP OPENSSL_NO_FIPS_ERR OPENSSL_NO_HASH_COMP
|
||||
OPENSSL_NO_LHASH OPENSSL_NO_OBJECT OPENSSL_NO_SPEED OPENSSL_NO_STACK
|
||||
OPENSSL_NO_X509 OPENSSL_NO_X509_VERIFY
|
||||
- Remove MS_STATIC; it's a relic from platforms <32 bits.
|
||||
|
||||
*Rich Salz*
|
||||
|
||||
@@ -3231,7 +3377,7 @@ OpenSSL 1.1.0
|
||||
* Fix for the attack described in the paper "Recovering OpenSSL
|
||||
ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
|
||||
by Yuval Yarom and Naomi Benger. Details can be obtained from:
|
||||
http://eprint.iacr.org/2014/140
|
||||
<http://eprint.iacr.org/2014/140>
|
||||
|
||||
Thanks to Yuval Yarom and Naomi Benger for discovering this
|
||||
flaw and to Yuval Yarom for supplying a fix [CVE-2014-0076][]
|
||||
@@ -3256,7 +3402,6 @@ OpenSSL 1.1.0
|
||||
|
||||
WARNING: EXPERIMENTAL, SUBJECT TO CHANGE.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Add EVP support for key wrapping algorithms, to avoid problems with
|
||||
@@ -3462,7 +3607,7 @@ OpenSSL 1.1.0
|
||||
*Steve Henson*
|
||||
|
||||
* Initial, experimental EVP support for AES-GCM. AAD can be input by
|
||||
setting output buffer to NULL. The *Final function must be
|
||||
setting output buffer to NULL. The `*Final` function must be
|
||||
called although it will not retrieve any additional data. The tag
|
||||
can be set or retrieved with a ctrl. The IV length is by default 12
|
||||
bytes (96 bits) but can be set to an alternative value. If the IV
|
||||
@@ -3554,7 +3699,7 @@ OpenSSL 1.1.0
|
||||
OpenSSL 1.0.2
|
||||
-------------
|
||||
|
||||
### Changes between 1.0.2s and 1.0.2t [10 Sep 2019] ###
|
||||
### Changes between 1.0.2s and 1.0.2t [10 Sep 2019]
|
||||
|
||||
* For built-in EC curves, ensure an EC_GROUP built from the curve name is
|
||||
used even when parsing explicit parameters, when loading a serialized key
|
||||
@@ -3600,7 +3745,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.0.2r and 1.0.2s [28 May 2019] ###
|
||||
### Changes between 1.0.2r and 1.0.2s [28 May 2019]
|
||||
|
||||
* Change the default RSA, DSA and DH size to 2048 bit instead of 1024.
|
||||
This changes the size when using the genpkey app when no size is given. It
|
||||
@@ -3619,7 +3764,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matthias St. Pierre*
|
||||
|
||||
### Changes between 1.0.2q and 1.0.2r [26 Feb 2019] ###
|
||||
### Changes between 1.0.2q and 1.0.2r [26 Feb 2019]
|
||||
|
||||
* 0-byte record padding oracle
|
||||
|
||||
@@ -3648,7 +3793,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.0.2p and 1.0.2q [20 Nov 2018] ###
|
||||
### Changes between 1.0.2p and 1.0.2q [20 Nov 2018]
|
||||
|
||||
* Microarchitecture timing vulnerability in ECC scalar multiplication
|
||||
|
||||
@@ -3681,7 +3826,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Nicola Tuveri*
|
||||
|
||||
### Changes between 1.0.2o and 1.0.2p [14 Aug 2018] ###
|
||||
### Changes between 1.0.2o and 1.0.2p [14 Aug 2018]
|
||||
|
||||
* Client DoS due to large DH parameter
|
||||
|
||||
@@ -3748,7 +3893,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
### Changes between 1.0.2n and 1.0.2o [27 Mar 2018] ###
|
||||
### Changes between 1.0.2n and 1.0.2o [27 Mar 2018]
|
||||
|
||||
* Constructed ASN.1 types with a recursive definition could exceed the stack
|
||||
|
||||
@@ -3764,7 +3909,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.2m and 1.0.2n [7 Dec 2017] ###
|
||||
### Changes between 1.0.2m and 1.0.2n [7 Dec 2017]
|
||||
|
||||
* Read/write after SSL object in error state
|
||||
|
||||
@@ -3811,7 +3956,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.0.2l and 1.0.2m [2 Nov 2017] ###
|
||||
### Changes between 1.0.2l and 1.0.2m [2 Nov 2017]
|
||||
|
||||
* bn_sqrx8x_internal carry bug on x86_64
|
||||
|
||||
@@ -3846,14 +3991,14 @@ OpenSSL 1.0.2
|
||||
|
||||
*Rich Salz*
|
||||
|
||||
### Changes between 1.0.2k and 1.0.2l [25 May 2017] ###
|
||||
### Changes between 1.0.2k and 1.0.2l [25 May 2017]
|
||||
|
||||
* Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target
|
||||
platform rather than 'mingw'.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 1.0.2j and 1.0.2k [26 Jan 2017] ###
|
||||
### Changes between 1.0.2j and 1.0.2k [26 Jan 2017]
|
||||
|
||||
* Truncated packet could crash via OOB read
|
||||
|
||||
@@ -3918,7 +4063,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.2i and 1.0.2j [26 Sep 2016] ###
|
||||
### Changes between 1.0.2i and 1.0.2j [26 Sep 2016]
|
||||
|
||||
* Missing CRL sanity check
|
||||
|
||||
@@ -3931,7 +4076,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.2h and 1.0.2i [22 Sep 2016] ###
|
||||
### Changes between 1.0.2h and 1.0.2i [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth
|
||||
|
||||
@@ -4102,7 +4247,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Stephen Henson*
|
||||
|
||||
### Changes between 1.0.2g and 1.0.2h [3 May 2016] ###
|
||||
### Changes between 1.0.2g and 1.0.2h [3 May 2016]
|
||||
|
||||
* Prevent padding oracle in AES-NI CBC MAC check
|
||||
|
||||
@@ -4130,7 +4275,7 @@ OpenSSL 1.0.2
|
||||
corruption.
|
||||
|
||||
Internally to OpenSSL the EVP_EncodeUpdate() function is primarily used by
|
||||
the PEM_write_bio* family of functions. These are mainly used within the
|
||||
the `PEM_write_bio*` family of functions. These are mainly used within the
|
||||
OpenSSL command line applications, so any application which processes data
|
||||
from an untrusted source and outputs it as a PEM file should be considered
|
||||
vulnerable to this issue. User applications that call these APIs directly
|
||||
@@ -4207,7 +4352,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.2f and 1.0.2g [1 Mar 2016] ###
|
||||
### Changes between 1.0.2f and 1.0.2g [1 Mar 2016]
|
||||
|
||||
* Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
Builds that are not configured with "enable-weak-ssl-ciphers" will not
|
||||
@@ -4292,10 +4437,10 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
* Fix memory issues in BIO_*printf functions
|
||||
* Fix memory issues in `BIO_*printf` functions
|
||||
|
||||
The internal |fmtstr| function used in processing a "%s" format string in
|
||||
the BIO_*printf functions could overflow while calculating the length of a
|
||||
the `BIO_*printf` functions could overflow while calculating the length of a
|
||||
string and cause an OOB read when printing very long strings.
|
||||
|
||||
Additionally the internal |doapr_outch| function can attempt to write to an
|
||||
@@ -4307,7 +4452,7 @@ OpenSSL 1.0.2
|
||||
|
||||
The first issue may mask the second issue dependent on compiler behaviour.
|
||||
These problems could enable attacks where large amounts of untrusted data
|
||||
is passed to the BIO_*printf functions. If applications use these functions
|
||||
is passed to the `BIO_*printf` functions. If applications use these functions
|
||||
in this way then they could be vulnerable. OpenSSL itself uses these
|
||||
functions when printing out human-readable dumps of ASN.1 data. Therefore
|
||||
applications that print this data could be vulnerable if the data is from
|
||||
@@ -4335,7 +4480,7 @@ OpenSSL 1.0.2
|
||||
This issue was reported to OpenSSL by Yuval Yarom, The University of
|
||||
Adelaide and NICTA, Daniel Genkin, Technion and Tel Aviv University, and
|
||||
Nadia Heninger, University of Pennsylvania with more information at
|
||||
http://cachebleed.info.
|
||||
<http://cachebleed.info>.
|
||||
[CVE-2016-0702][]
|
||||
|
||||
*Andy Polyakov*
|
||||
@@ -4347,7 +4492,8 @@ OpenSSL 1.0.2
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
### Changes between 1.0.2e and 1.0.2f [28 Jan 2016] ###
|
||||
### Changes between 1.0.2e and 1.0.2f [28 Jan 2016]
|
||||
|
||||
* DH small subgroups
|
||||
|
||||
Historically OpenSSL only ever generated DH parameters based on "safe"
|
||||
@@ -4393,7 +4539,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Viktor Dukhovni*
|
||||
|
||||
### Changes between 1.0.2d and 1.0.2e [3 Dec 2015] ###
|
||||
### Changes between 1.0.2d and 1.0.2e [3 Dec 2015]
|
||||
|
||||
* BN_mod_exp may produce incorrect results on x86_64
|
||||
|
||||
@@ -4456,7 +4602,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Rich Salz and Ismo Puustinen <ismo.puustinen@intel.com>*
|
||||
|
||||
### Changes between 1.0.2c and 1.0.2d [9 Jul 2015] ###
|
||||
### Changes between 1.0.2c and 1.0.2d [9 Jul 2015]
|
||||
|
||||
* Alternate chains certificate forgery
|
||||
|
||||
@@ -4472,7 +4618,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.2b and 1.0.2c [12 Jun 2015] ###
|
||||
### Changes between 1.0.2b and 1.0.2c [12 Jun 2015]
|
||||
|
||||
* Fix HMAC ABI incompatibility. The previous version introduced an ABI
|
||||
incompatibility in the handling of HMAC. The previous ABI has now been
|
||||
@@ -4480,7 +4626,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.2a and 1.0.2b [11 Jun 2015] ###
|
||||
### Changes between 1.0.2a and 1.0.2b [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop
|
||||
|
||||
@@ -4559,7 +4705,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Emilia Kasper*
|
||||
|
||||
### Changes between 1.0.2 and 1.0.2a [19 Mar 2015] ###
|
||||
### Changes between 1.0.2 and 1.0.2a [19 Mar 2015]
|
||||
|
||||
* ClientHello sigalgs DoS fix
|
||||
|
||||
@@ -4735,7 +4881,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.1l and 1.0.2 [22 Jan 2015] ###
|
||||
### Changes between 1.0.1l and 1.0.2 [22 Jan 2015]
|
||||
|
||||
* Facilitate "universal" ARM builds targeting range of ARM ISAs, e.g.
|
||||
ARMv5 through ARMv8, as opposite to "locking" it to single one.
|
||||
@@ -4886,7 +5032,7 @@ OpenSSL 1.0.2
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* SSL_CONF* functions. These provide a common framework for application
|
||||
* `SSL_CONF*` functions. These provide a common framework for application
|
||||
configuration using configuration files or command lines.
|
||||
|
||||
*Steve Henson*
|
||||
@@ -4954,7 +5100,6 @@ OpenSSL 1.0.2
|
||||
Note: if the CERT based stores are not set then the parent SSL_CTX
|
||||
store is used to retain compatibility with existing behaviour.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New function ssl_set_client_disabled to set a ciphersuite disabled
|
||||
@@ -5130,11 +5275,10 @@ OpenSSL 1.0.2
|
||||
X509_CINF_set_modified, X509_CINF_get_issuer, X509_CINF_get_extensions and
|
||||
X509_CINF_get_signature were reverted post internal team review.
|
||||
|
||||
|
||||
OpenSSL 1.0.1
|
||||
-------------
|
||||
|
||||
### Changes between 1.0.1t and 1.0.1u [22 Sep 2016] ###
|
||||
### Changes between 1.0.1t and 1.0.1u [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth
|
||||
|
||||
@@ -5305,7 +5449,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Stephen Henson*
|
||||
|
||||
### Changes between 1.0.1s and 1.0.1t [3 May 2016] ###
|
||||
### Changes between 1.0.1s and 1.0.1t [3 May 2016]
|
||||
|
||||
* Prevent padding oracle in AES-NI CBC MAC check
|
||||
|
||||
@@ -5333,7 +5477,7 @@ OpenSSL 1.0.1
|
||||
corruption.
|
||||
|
||||
Internally to OpenSSL the EVP_EncodeUpdate() function is primarly used by
|
||||
the PEM_write_bio* family of functions. These are mainly used within the
|
||||
the `PEM_write_bio*` family of functions. These are mainly used within the
|
||||
OpenSSL command line applications, so any application which processes data
|
||||
from an untrusted source and outputs it as a PEM file should be considered
|
||||
vulnerable to this issue. User applications that call these APIs directly
|
||||
@@ -5410,7 +5554,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.1r and 1.0.1s [1 Mar 2016] ###
|
||||
### Changes between 1.0.1r and 1.0.1s [1 Mar 2016]
|
||||
|
||||
* Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
Builds that are not configured with "enable-weak-ssl-ciphers" will not
|
||||
@@ -5495,10 +5639,10 @@ OpenSSL 1.0.1
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
* Fix memory issues in BIO_*printf functions
|
||||
* Fix memory issues in `BIO_*printf` functions
|
||||
|
||||
The internal |fmtstr| function used in processing a "%s" format string in
|
||||
the BIO_*printf functions could overflow while calculating the length of a
|
||||
the `BIO_*printf` functions could overflow while calculating the length of a
|
||||
string and cause an OOB read when printing very long strings.
|
||||
|
||||
Additionally the internal |doapr_outch| function can attempt to write to an
|
||||
@@ -5510,7 +5654,7 @@ OpenSSL 1.0.1
|
||||
|
||||
The first issue may mask the second issue dependent on compiler behaviour.
|
||||
These problems could enable attacks where large amounts of untrusted data
|
||||
is passed to the BIO_*printf functions. If applications use these functions
|
||||
is passed to the `BIO_*printf` functions. If applications use these functions
|
||||
in this way then they could be vulnerable. OpenSSL itself uses these
|
||||
functions when printing out human-readable dumps of ASN.1 data. Therefore
|
||||
applications that print this data could be vulnerable if the data is from
|
||||
@@ -5538,7 +5682,7 @@ OpenSSL 1.0.1
|
||||
This issue was reported to OpenSSL by Yuval Yarom, The University of
|
||||
Adelaide and NICTA, Daniel Genkin, Technion and Tel Aviv University, and
|
||||
Nadia Heninger, University of Pennsylvania with more information at
|
||||
http://cachebleed.info.
|
||||
<http://cachebleed.info>.
|
||||
[CVE-2016-0702][]
|
||||
|
||||
*Andy Polyakov*
|
||||
@@ -5550,7 +5694,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
### Changes between 1.0.1q and 1.0.1r [28 Jan 2016] ###
|
||||
### Changes between 1.0.1q and 1.0.1r [28 Jan 2016]
|
||||
|
||||
* Protection for DH small subgroup attacks
|
||||
|
||||
@@ -5577,7 +5721,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.1p and 1.0.1q [3 Dec 2015] ###
|
||||
### Changes between 1.0.1p and 1.0.1q [3 Dec 2015]
|
||||
|
||||
* Certificate verify crash with missing PSS parameter
|
||||
|
||||
@@ -5620,7 +5764,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Rich Salz and Ismo Puustinen <ismo.puustinen@intel.com>*
|
||||
|
||||
### Changes between 1.0.1o and 1.0.1p [9 Jul 2015] ###
|
||||
### Changes between 1.0.1o and 1.0.1p [9 Jul 2015]
|
||||
|
||||
* Alternate chains certificate forgery
|
||||
|
||||
@@ -5647,12 +5791,13 @@ OpenSSL 1.0.1
|
||||
|
||||
*Stephen Henson*
|
||||
|
||||
### Changes between 1.0.1n and 1.0.1o [12 Jun 2015] ###
|
||||
### Changes between 1.0.1n and 1.0.1o [12 Jun 2015]
|
||||
|
||||
* Fix HMAC ABI incompatibility. The previous version introduced an ABI
|
||||
incompatibility in the handling of HMAC. The previous ABI has now been
|
||||
restored.
|
||||
|
||||
### Changes between 1.0.1m and 1.0.1n [11 Jun 2015] ###
|
||||
### Changes between 1.0.1m and 1.0.1n [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop
|
||||
|
||||
@@ -5733,7 +5878,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Kurt Roeckx and Emilia Kasper*
|
||||
|
||||
### Changes between 1.0.1l and 1.0.1m [19 Mar 2015] ###
|
||||
### Changes between 1.0.1l and 1.0.1m [19 Mar 2015]
|
||||
|
||||
* Segmentation fault in ASN1_TYPE_cmp fix
|
||||
|
||||
@@ -5817,13 +5962,13 @@ OpenSSL 1.0.1
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.1k and 1.0.1l [15 Jan 2015] ###
|
||||
### Changes between 1.0.1k and 1.0.1l [15 Jan 2015]
|
||||
|
||||
* Build fixes for the Windows and OpenVMS platforms
|
||||
|
||||
*Matt Caswell and Richard Levitte*
|
||||
|
||||
### Changes between 1.0.1j and 1.0.1k [8 Jan 2015] ###
|
||||
### Changes between 1.0.1j and 1.0.1k [8 Jan 2015]
|
||||
|
||||
* Fix DTLS segmentation fault in dtls1_get_record. A carefully crafted DTLS
|
||||
message can cause a segmentation fault in OpenSSL due to a NULL pointer
|
||||
@@ -5928,44 +6073,44 @@ OpenSSL 1.0.1
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
*) Correct Bignum squaring. Bignum squaring (BN_sqr) may produce incorrect
|
||||
results on some platforms, including x86_64. This bug occurs at random
|
||||
with a very low probability, and is not known to be exploitable in any
|
||||
way, though its exact impact is difficult to determine. Thanks to Pieter
|
||||
Wuille (Blockstream) who reported this issue and also suggested an initial
|
||||
fix. Further analysis was conducted by the OpenSSL development team and
|
||||
Adam Langley of Google. The final fix was developed by Andy Polyakov of
|
||||
the OpenSSL core team.
|
||||
[CVE-2014-3570][]
|
||||
* Correct Bignum squaring. Bignum squaring (BN_sqr) may produce incorrect
|
||||
results on some platforms, including x86_64. This bug occurs at random
|
||||
with a very low probability, and is not known to be exploitable in any
|
||||
way, though its exact impact is difficult to determine. Thanks to Pieter
|
||||
Wuille (Blockstream) who reported this issue and also suggested an initial
|
||||
fix. Further analysis was conducted by the OpenSSL development team and
|
||||
Adam Langley of Google. The final fix was developed by Andy Polyakov of
|
||||
the OpenSSL core team.
|
||||
[CVE-2014-3570][]
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
*) Do not resume sessions on the server if the negotiated protocol
|
||||
version does not match the session's version. Resuming with a different
|
||||
version, while not strictly forbidden by the RFC, is of questionable
|
||||
sanity and breaks all known clients.
|
||||
* Do not resume sessions on the server if the negotiated protocol
|
||||
version does not match the session's version. Resuming with a different
|
||||
version, while not strictly forbidden by the RFC, is of questionable
|
||||
sanity and breaks all known clients.
|
||||
|
||||
*David Benjamin, Emilia Käsper*
|
||||
|
||||
*) Tighten handling of the ChangeCipherSpec (CCS) message: reject
|
||||
early CCS messages during renegotiation. (Note that because
|
||||
renegotiation is encrypted, this early CCS was not exploitable.)
|
||||
* Tighten handling of the ChangeCipherSpec (CCS) message: reject
|
||||
early CCS messages during renegotiation. (Note that because
|
||||
renegotiation is encrypted, this early CCS was not exploitable.)
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
*) Tighten client-side session ticket handling during renegotiation:
|
||||
ensure that the client only accepts a session ticket if the server sends
|
||||
the extension anew in the ServerHello. Previously, a TLS client would
|
||||
reuse the old extension state and thus accept a session ticket if one was
|
||||
announced in the initial ServerHello.
|
||||
* Tighten client-side session ticket handling during renegotiation:
|
||||
ensure that the client only accepts a session ticket if the server sends
|
||||
the extension anew in the ServerHello. Previously, a TLS client would
|
||||
reuse the old extension state and thus accept a session ticket if one was
|
||||
announced in the initial ServerHello.
|
||||
|
||||
Similarly, ensure that the client requires a session ticket if one
|
||||
was advertised in the ServerHello. Previously, a TLS client would
|
||||
ignore a missing NewSessionTicket message.
|
||||
Similarly, ensure that the client requires a session ticket if one
|
||||
was advertised in the ServerHello. Previously, a TLS client would
|
||||
ignore a missing NewSessionTicket message.
|
||||
|
||||
*Emilia Käsper*
|
||||
|
||||
### Changes between 1.0.1i and 1.0.1j [15 Oct 2014] ###
|
||||
### Changes between 1.0.1i and 1.0.1j [15 Oct 2014]
|
||||
|
||||
* SRTP Memory Leak.
|
||||
|
||||
@@ -6018,10 +6163,9 @@ OpenSSL 1.0.1
|
||||
|
||||
Note: this is a precautionary measure and no attacks are currently known.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.1h and 1.0.1i [6 Aug 2014] ###
|
||||
### Changes between 1.0.1h and 1.0.1i [6 Aug 2014]
|
||||
|
||||
* Fix SRP buffer overrun vulnerability. Invalid parameters passed to the
|
||||
SRP code can be overrun an internal buffer. Add sanity check that
|
||||
@@ -6117,7 +6261,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 1.0.1g and 1.0.1h [5 Jun 2014] ###
|
||||
### Changes between 1.0.1g and 1.0.1h [5 Jun 2014]
|
||||
|
||||
* Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted
|
||||
handshake can force the use of weak keying material in OpenSSL
|
||||
@@ -6168,7 +6312,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*mancha <mancha1@zoho.com>*
|
||||
|
||||
### Changes between 1.0.1f and 1.0.1g [7 Apr 2014] ###
|
||||
### Changes between 1.0.1f and 1.0.1g [7 Apr 2014]
|
||||
|
||||
* A missing bounds check in the handling of the TLS heartbeat extension
|
||||
can be used to reveal up to 64k of memory to a connected client or
|
||||
@@ -6183,7 +6327,7 @@ OpenSSL 1.0.1
|
||||
* Fix for the attack described in the paper "Recovering OpenSSL
|
||||
ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
|
||||
by Yuval Yarom and Naomi Benger. Details can be obtained from:
|
||||
http://eprint.iacr.org/2014/140
|
||||
<http://eprint.iacr.org/2014/140>
|
||||
|
||||
Thanks to Yuval Yarom and Naomi Benger for discovering this
|
||||
flaw and to Yuval Yarom for supplying a fix [CVE-2014-0076][]
|
||||
@@ -6197,10 +6341,9 @@ OpenSSL 1.0.1
|
||||
less that 512 pad with a dummy extension containing zeroes so it
|
||||
is at least 512 bytes long.
|
||||
|
||||
|
||||
*Adam Langley, Steve Henson*
|
||||
|
||||
### Changes between 1.0.1e and 1.0.1f [6 Jan 2014] ###
|
||||
### Changes between 1.0.1e and 1.0.1f [6 Jan 2014]
|
||||
|
||||
* Fix for TLS record tampering bug. A carefully crafted invalid
|
||||
handshake could crash OpenSSL with a NULL pointer exception.
|
||||
@@ -6222,20 +6365,20 @@ OpenSSL 1.0.1
|
||||
|
||||
*Rob Stradling, Adam Langley*
|
||||
|
||||
### Changes between 1.0.1d and 1.0.1e [11 Feb 2013] ###
|
||||
### Changes between 1.0.1d and 1.0.1e [11 Feb 2013]
|
||||
|
||||
* Correct fix for CVE-2013-0169. The original didn't work on AES-NI
|
||||
supporting platforms or when small records were transferred.
|
||||
|
||||
*Andy Polyakov, Steve Henson*
|
||||
|
||||
### Changes between 1.0.1c and 1.0.1d [5 Feb 2013] ###
|
||||
### Changes between 1.0.1c and 1.0.1d [5 Feb 2013]
|
||||
|
||||
* Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
|
||||
|
||||
This addresses the flaw in CBC record processing discovered by
|
||||
Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
|
||||
at: http://www.isg.rhul.ac.uk/tls/
|
||||
at: <http://www.isg.rhul.ac.uk/tls/>
|
||||
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
@@ -6266,7 +6409,7 @@ OpenSSL 1.0.1
|
||||
* Call OCSP Stapling callback after ciphersuite has been chosen, so
|
||||
the right response is stapled. Also change SSL_get_certificate()
|
||||
so it returns the certificate actually sent.
|
||||
See http://rt.openssl.org/Ticket/Display.html?id=2836.
|
||||
See <http://rt.openssl.org/Ticket/Display.html?id=2836>.
|
||||
|
||||
*Rob Stradling <rob.stradling@comodo.com>*
|
||||
|
||||
@@ -6279,7 +6422,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.1b and 1.0.1c [10 May 2012] ###
|
||||
### Changes between 1.0.1b and 1.0.1c [10 May 2012]
|
||||
|
||||
* Sanity check record length before skipping explicit IV in TLS
|
||||
1.2, 1.1 and DTLS to fix DoS attack.
|
||||
@@ -6300,7 +6443,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.1a and 1.0.1b [26 Apr 2012] ###
|
||||
### Changes between 1.0.1a and 1.0.1b [26 Apr 2012]
|
||||
|
||||
* OpenSSL 1.0.0 sets SSL_OP_ALL to 0x80000FFFL and OpenSSL 1.0.1 and
|
||||
1.0.1a set SSL_OP_NO_TLSv1_1 to 0x00000400L which would unfortunately
|
||||
@@ -6325,7 +6468,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.0.1 and 1.0.1a [19 Apr 2012] ###
|
||||
### Changes between 1.0.1 and 1.0.1a [19 Apr 2012]
|
||||
|
||||
* Check for potentially exploitable overflows in asn1_d2i_read_bio
|
||||
BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
|
||||
@@ -6360,7 +6503,7 @@ OpenSSL 1.0.1
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 1.0.0h and 1.0.1 [14 Mar 2012] ###
|
||||
### Changes between 1.0.0h and 1.0.1 [14 Mar 2012]
|
||||
|
||||
* Add compatibility with old MDC2 signatures which use an ASN1 OCTET
|
||||
STRING form instead of a DigestInfo.
|
||||
@@ -6397,12 +6540,12 @@ OpenSSL 1.0.1
|
||||
|
||||
* Extensive assembler packs updates, most notably:
|
||||
|
||||
- x86[_64]: AES-NI, PCLMULQDQ, RDRAND support;
|
||||
- x86[_64]: SSSE3 support (SHA1, vector-permutation AES);
|
||||
- x86_64: bit-sliced AES implementation;
|
||||
- ARM: NEON support, contemporary platforms optimizations;
|
||||
- s390x: z196 support;
|
||||
- *: GHASH and GF(2^m) multiplication implementations;
|
||||
- x86[_64]: AES-NI, PCLMULQDQ, RDRAND support;
|
||||
- x86[_64]: SSSE3 support (SHA1, vector-permutation AES);
|
||||
- x86_64: bit-sliced AES implementation;
|
||||
- ARM: NEON support, contemporary platforms optimizations;
|
||||
- s390x: z196 support;
|
||||
- `*`: GHASH and GF(2^m) multiplication implementations;
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
@@ -6420,7 +6563,7 @@ OpenSSL 1.0.1
|
||||
*Eric Rescorla*
|
||||
|
||||
* Add Next Protocol Negotiation,
|
||||
http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-00. Can be
|
||||
<http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-00>. Can be
|
||||
disabled with a no-npn flag to config or Configure. Code donated
|
||||
by Google.
|
||||
|
||||
@@ -6528,7 +6671,7 @@ OpenSSL 1.0.1
|
||||
* Add GCM support to TLS library. Some custom code is needed to split
|
||||
the IV between the fixed (from PRF) and explicit (from TLS record)
|
||||
portions. This adds all GCM ciphersuites supported by RFC5288 and
|
||||
RFC5289. Generalise some AES* cipherstrings to include GCM and
|
||||
RFC5289. Generalise some `AES*` cipherstrings to include GCM and
|
||||
add a special AESGCM string for GCM only.
|
||||
|
||||
*Steve Henson*
|
||||
@@ -6590,7 +6733,7 @@ OpenSSL 1.0.1
|
||||
|
||||
* Low level digest APIs are not approved in FIPS mode: any attempt
|
||||
to use these will cause a fatal error. Applications that *really* want
|
||||
to use them can use the private_* version instead.
|
||||
to use them can use the `private_*` version instead.
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
@@ -6702,7 +6845,7 @@ OpenSSL 1.0.1
|
||||
OpenSSL 1.0.0
|
||||
-------------
|
||||
|
||||
### Changes between 1.0.0s and 1.0.0t [3 Dec 2015] ###
|
||||
### Changes between 1.0.0s and 1.0.0t [3 Dec 2015]
|
||||
|
||||
* X509_ATTRIBUTE memory leak
|
||||
|
||||
@@ -6727,7 +6870,7 @@ OpenSSL 1.0.0
|
||||
|
||||
*Stephen Henson*
|
||||
|
||||
### Changes between 1.0.0r and 1.0.0s [11 Jun 2015] ###
|
||||
### Changes between 1.0.0r and 1.0.0s [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop
|
||||
|
||||
@@ -6800,7 +6943,7 @@ OpenSSL 1.0.0
|
||||
|
||||
*Matt Caswell*
|
||||
|
||||
### Changes between 1.0.0q and 1.0.0r [19 Mar 2015] ###
|
||||
### Changes between 1.0.0q and 1.0.0r [19 Mar 2015]
|
||||
|
||||
* Segmentation fault in ASN1_TYPE_cmp fix
|
||||
|
||||
@@ -6884,13 +7027,13 @@ OpenSSL 1.0.0
|
||||
|
||||
*Kurt Roeckx*
|
||||
|
||||
### Changes between 1.0.0p and 1.0.0q [15 Jan 2015] ###
|
||||
### Changes between 1.0.0p and 1.0.0q [15 Jan 2015]
|
||||
|
||||
* Build fixes for the Windows and OpenVMS platforms
|
||||
|
||||
*Matt Caswell and Richard Levitte*
|
||||
|
||||
### Changes between 1.0.0o and 1.0.0p [8 Jan 2015] ###
|
||||
### Changes between 1.0.0o and 1.0.0p [8 Jan 2015]
|
||||
|
||||
* Fix DTLS segmentation fault in dtls1_get_record. A carefully crafted DTLS
|
||||
message can cause a segmentation fault in OpenSSL due to a NULL pointer
|
||||
@@ -6949,17 +7092,17 @@ OpenSSL 1.0.0
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
*) Correct Bignum squaring. Bignum squaring (BN_sqr) may produce incorrect
|
||||
results on some platforms, including x86_64. This bug occurs at random
|
||||
with a very low probability, and is not known to be exploitable in any
|
||||
way, though its exact impact is difficult to determine. Thanks to Pieter
|
||||
Wuille (Blockstream) who reported this issue and also suggested an initial
|
||||
fix. Further analysis was conducted by the OpenSSL development team and
|
||||
Adam Langley of Google. The final fix was developed by Andy Polyakov of
|
||||
the OpenSSL core team.
|
||||
[CVE-2014-3570][]
|
||||
* Correct Bignum squaring. Bignum squaring (BN_sqr) may produce incorrect
|
||||
results on some platforms, including x86_64. This bug occurs at random
|
||||
with a very low probability, and is not known to be exploitable in any
|
||||
way, though its exact impact is difficult to determine. Thanks to Pieter
|
||||
Wuille (Blockstream) who reported this issue and also suggested an initial
|
||||
fix. Further analysis was conducted by the OpenSSL development team and
|
||||
Adam Langley of Google. The final fix was developed by Andy Polyakov of
|
||||
the OpenSSL core team.
|
||||
[CVE-2014-3570][]
|
||||
|
||||
*Andy Polyakov*
|
||||
*Andy Polyakov*
|
||||
|
||||
* Fix various certificate fingerprint issues.
|
||||
|
||||
@@ -6999,7 +7142,7 @@ OpenSSL 1.0.0
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0n and 1.0.0o [15 Oct 2014] ###
|
||||
### Changes between 1.0.0n and 1.0.0o [15 Oct 2014]
|
||||
|
||||
* Session Ticket Memory Leak.
|
||||
|
||||
@@ -7037,10 +7180,9 @@ OpenSSL 1.0.0
|
||||
|
||||
Note: this is a precautionary measure and no attacks are currently known.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0m and 1.0.0n [6 Aug 2014] ###
|
||||
### Changes between 1.0.0m and 1.0.0n [6 Aug 2014]
|
||||
|
||||
* OpenSSL DTLS clients enabling anonymous (EC)DH ciphersuites are subject
|
||||
to a denial of service attack. A malicious server can crash the client
|
||||
@@ -7103,7 +7245,7 @@ OpenSSL 1.0.0
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 1.0.0l and 1.0.0m [5 Jun 2014] ###
|
||||
### Changes between 1.0.0l and 1.0.0m [5 Jun 2014]
|
||||
|
||||
* Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted
|
||||
handshake can force the use of weak keying material in OpenSSL
|
||||
@@ -7157,14 +7299,14 @@ OpenSSL 1.0.0
|
||||
* Fix for the attack described in the paper "Recovering OpenSSL
|
||||
ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
|
||||
by Yuval Yarom and Naomi Benger. Details can be obtained from:
|
||||
http://eprint.iacr.org/2014/140
|
||||
<http://eprint.iacr.org/2014/140>
|
||||
|
||||
Thanks to Yuval Yarom and Naomi Benger for discovering this
|
||||
flaw and to Yuval Yarom for supplying a fix [CVE-2014-0076][]
|
||||
|
||||
*Yuval Yarom and Naomi Benger*
|
||||
|
||||
### Changes between 1.0.0k and 1.0.0l [6 Jan 2014] ###
|
||||
### Changes between 1.0.0k and 1.0.0l [6 Jan 2014]
|
||||
|
||||
* Keep original DTLS digest and encryption contexts in retransmission
|
||||
structures so we can use the previous session parameters if they need
|
||||
@@ -7181,13 +7323,13 @@ OpenSSL 1.0.0
|
||||
|
||||
*Rob Stradling, Adam Langley*
|
||||
|
||||
### Changes between 1.0.0j and 1.0.0k [5 Feb 2013] ###
|
||||
### Changes between 1.0.0j and 1.0.0k [5 Feb 2013]
|
||||
|
||||
* Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
|
||||
|
||||
This addresses the flaw in CBC record processing discovered by
|
||||
Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
|
||||
at: http://www.isg.rhul.ac.uk/tls/
|
||||
at: <http://www.isg.rhul.ac.uk/tls/>
|
||||
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
@@ -7205,7 +7347,7 @@ OpenSSL 1.0.0
|
||||
* Call OCSP Stapling callback after ciphersuite has been chosen, so
|
||||
the right response is stapled. Also change SSL_get_certificate()
|
||||
so it returns the certificate actually sent.
|
||||
See http://rt.openssl.org/Ticket/Display.html?id=2836.
|
||||
See <http://rt.openssl.org/Ticket/Display.html?id=2836>.
|
||||
(This is a backport)
|
||||
|
||||
*Rob Stradling <rob.stradling@comodo.com>*
|
||||
@@ -7214,7 +7356,7 @@ OpenSSL 1.0.0
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0i and 1.0.0j [10 May 2012] ###
|
||||
### Changes between 1.0.0i and 1.0.0j [10 May 2012]
|
||||
|
||||
[NB: OpenSSL 1.0.0i and later 1.0.0 patch levels were released after
|
||||
OpenSSL 1.0.1.]
|
||||
@@ -7233,7 +7375,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0h and 1.0.0i [19 Apr 2012] ###
|
||||
### Changes between 1.0.0h and 1.0.0i [19 Apr 2012]
|
||||
|
||||
* Check for potentially exploitable overflows in asn1_d2i_read_bio
|
||||
BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
|
||||
@@ -7245,7 +7387,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Adam Langley (Google), Tavis Ormandy, Google Security Team*
|
||||
|
||||
### Changes between 1.0.0g and 1.0.0h [12 Mar 2012] ###
|
||||
### Changes between 1.0.0g and 1.0.0h [12 Mar 2012]
|
||||
|
||||
* Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
|
||||
in CMS and PKCS7 code. When RSA decryption fails use a random key for
|
||||
@@ -7265,7 +7407,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0f and 1.0.0g [18 Jan 2012] ###
|
||||
### Changes between 1.0.0f and 1.0.0g [18 Jan 2012]
|
||||
|
||||
* Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
|
||||
Thanks to Antonio Martin, Enterprise Secure Access Research and
|
||||
@@ -7274,7 +7416,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Antonio Martin*
|
||||
|
||||
### Changes between 1.0.0e and 1.0.0f [4 Jan 2012] ###
|
||||
### Changes between 1.0.0e and 1.0.0f [4 Jan 2012]
|
||||
|
||||
* Nadhem Alfardan and Kenny Paterson have discovered an extension
|
||||
of the Vaudenay padding oracle attack on CBC mode encryption
|
||||
@@ -7282,7 +7424,7 @@ OpenSSL 1.0.1.]
|
||||
the OpenSSL implementation of DTLS. Their attack exploits timing
|
||||
differences arising during decryption processing. A research
|
||||
paper describing this attack can be found at:
|
||||
http://www.isg.rhul.ac.uk/~kp/dtls.pdf
|
||||
<http://www.isg.rhul.ac.uk/~kp/dtls.pdf>
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
(www.isg.rhul.ac.uk) for discovering this flaw and to Robin Seggelmann
|
||||
@@ -7325,7 +7467,7 @@ OpenSSL 1.0.1.]
|
||||
*Emilia Käsper (Google)*
|
||||
|
||||
* Fix the BIO_f_buffer() implementation (which was mixing different
|
||||
interpretations of the '..._len' fields).
|
||||
interpretations of the `..._len` fields).
|
||||
|
||||
*Adam Langley (Google)*
|
||||
|
||||
@@ -7344,7 +7486,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Bob Buckholz (Google)*
|
||||
|
||||
### Changes between 1.0.0d and 1.0.0e [6 Sep 2011] ###
|
||||
### Changes between 1.0.0d and 1.0.0e [6 Sep 2011]
|
||||
|
||||
* Fix bug where CRLs with nextUpdate in the past are sometimes accepted
|
||||
by initialising X509_STORE_CTX properly. [CVE-2011-3207][]
|
||||
@@ -7368,13 +7510,11 @@ OpenSSL 1.0.1.]
|
||||
|
||||
* Add protection against ECDSA timing attacks as mentioned in the paper
|
||||
by Billy Bob Brumley and Nicola Tuveri, see:
|
||||
|
||||
http://eprint.iacr.org/2011/232.pdf
|
||||
|
||||
<http://eprint.iacr.org/2011/232.pdf>
|
||||
|
||||
*Billy Bob Brumley and Nicola Tuveri*
|
||||
|
||||
### Changes between 1.0.0c and 1.0.0d [8 Feb 2011] ###
|
||||
### Changes between 1.0.0c and 1.0.0d [8 Feb 2011]
|
||||
|
||||
* Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
|
||||
|
||||
@@ -7386,7 +7526,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0b and 1.0.0c [2 Dec 2010] ###
|
||||
### Changes between 1.0.0b and 1.0.0c [2 Dec 2010]
|
||||
|
||||
* Disable code workaround for ancient and obsolete Netscape browsers
|
||||
and servers: an attacker can use it in a ciphersuite downgrade attack.
|
||||
@@ -7400,7 +7540,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
### Changes between 1.0.0a and 1.0.0b [16 Nov 2010] ###
|
||||
### Changes between 1.0.0a and 1.0.0b [16 Nov 2010]
|
||||
|
||||
* Fix extension code to avoid race conditions which can result in a buffer
|
||||
overrun vulnerability: resumed sessions must not be modified as they can
|
||||
@@ -7413,14 +7553,14 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 1.0.0 and 1.0.0a [01 Jun 2010] ###
|
||||
### Changes between 1.0.0 and 1.0.0a [01 Jun 2010]
|
||||
|
||||
* Check return value of int_rsa_verify in pkey_rsa_verifyrecover
|
||||
[CVE-2010-1633][]
|
||||
|
||||
*Steve Henson, Peter-Michael Hager <hager@dortmund.net>*
|
||||
|
||||
### Changes between 0.9.8n and 1.0.0 [29 Mar 2010] ###
|
||||
### Changes between 0.9.8n and 1.0.0 [29 Mar 2010]
|
||||
|
||||
* Add "missing" function EVP_CIPHER_CTX_copy(). This copies a cipher
|
||||
context. The operation can be customised via the ctrl mechanism in
|
||||
@@ -7496,7 +7636,7 @@ OpenSSL 1.0.1.]
|
||||
|
||||
* Add "missing" function EVP_MD_flags() (without this the only way to
|
||||
retrieve a digest flags is by accessing the structure directly. Update
|
||||
EVP_MD_do_all*() and EVP_CIPHER_do_all*() to include the name a digest
|
||||
`EVP_MD_do_all*()` and `EVP_CIPHER_do_all*()` to include the name a digest
|
||||
or cipher is registered as in the "from" argument. Print out all
|
||||
registered digests in the dgst usage message instead of manually
|
||||
attempting to work them out.
|
||||
@@ -7530,7 +7670,6 @@ OpenSSL 1.0.1.]
|
||||
|
||||
and this works for ENGINE based algorithms too.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Update Gost ENGINE to support parameter files.
|
||||
@@ -7583,7 +7722,7 @@ OpenSSL 1.0.1.]
|
||||
* New function OPENSSL_gmtime_adj() to add a specific number of days and
|
||||
seconds to a tm structure directly, instead of going through OS
|
||||
specific date routines. This avoids any issues with OS routines such
|
||||
as the year 2038 bug. New *_adj() functions for ASN1 time structures
|
||||
as the year 2038 bug. New `*_adj()` functions for ASN1 time structures
|
||||
and X509_time_adj_ex() to cover the extended range. The existing
|
||||
X509_time_adj() is still usable and will no longer have any date issues.
|
||||
|
||||
@@ -7801,13 +7940,11 @@ OpenSSL 1.0.1.]
|
||||
SSL_set_options(ssl, SSL_OP_NO_SSLv2) is especially recommended
|
||||
for applications that need to enforce opaque PRF input.
|
||||
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Update ssl code to support digests other than SHA1+MD5 for handshake
|
||||
MAC.
|
||||
|
||||
|
||||
*Victor B. Wagner <vitus@cryptocom.ru>*
|
||||
|
||||
* Add RFC4507 support to OpenSSL. This includes the corrections in
|
||||
@@ -7851,7 +7988,7 @@ OpenSSL 1.0.1.]
|
||||
*Steve Henson*
|
||||
|
||||
* Experimental support for use of HMAC via EVP_PKEY interface. This
|
||||
allows HMAC to be handled via the EVP_DigestSign*() interface. The
|
||||
allows HMAC to be handled via the `EVP_DigestSign*()` interface. The
|
||||
EVP_PKEY "key" in this case is the HMAC key, potentially allowing
|
||||
ENGINE support for HMAC keys which are unextractable. New -mac and
|
||||
-macopt options to dgst utility.
|
||||
@@ -7859,7 +7996,7 @@ OpenSSL 1.0.1.]
|
||||
*Steve Henson*
|
||||
|
||||
* New option -sigopt to dgst utility. Update dgst to use
|
||||
EVP_Digest{Sign,Verify}*. These two changes make it possible to use
|
||||
`EVP_Digest{Sign,Verify}*`. These two changes make it possible to use
|
||||
alternative signing parameters such as X9.31 or PSS in the dgst
|
||||
utility.
|
||||
|
||||
@@ -8068,7 +8205,6 @@ OpenSSL 1.0.1.]
|
||||
AECDH - anonymous ECDH
|
||||
EECDH - non-anonymous ephemeral ECDH (equivalent to "kEECDH:-AECDH")
|
||||
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Add additional S/MIME capabilities for AES and GOST ciphers if supported.
|
||||
@@ -8087,8 +8223,8 @@ OpenSSL 1.0.1.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New functions EVP_Digest{Sign,Verify)*. These are enhanced versions of
|
||||
EVP_{Sign,Verify}* which allow an application to customise the signature
|
||||
* New functions `EVP_Digest{Sign,Verify)*`. These are enhanced versions of
|
||||
`EVP_{Sign,Verify}*` which allow an application to customise the signature
|
||||
process.
|
||||
|
||||
*Steve Henson*
|
||||
@@ -8196,8 +8332,8 @@ OpenSSL 1.0.1.]
|
||||
*Steve Henson*
|
||||
|
||||
* Add functions for main EVP_PKEY_method operations. The undocumented
|
||||
functions EVP_PKEY_{encrypt,decrypt} have been renamed to
|
||||
EVP_PKEY_{encrypt,decrypt}_old.
|
||||
functions `EVP_PKEY_{encrypt,decrypt}` have been renamed to
|
||||
`EVP_PKEY_{encrypt,decrypt}_old`.
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
@@ -8263,7 +8399,6 @@ OpenSSL 1.0.1.]
|
||||
SSL_get_psk_identity
|
||||
SSL_use_psk_identity_hint
|
||||
|
||||
|
||||
*Mika Kousa and Pasi Eronen of Nokia Corporation*
|
||||
|
||||
* Add RFC 3161 compliant time stamp request creation, response generation
|
||||
@@ -8274,7 +8409,7 @@ OpenSSL 1.0.1.]
|
||||
* Add initial support for TLS extensions, specifically for the server_name
|
||||
extension so far. The SSL_SESSION, SSL_CTX, and SSL data structures now
|
||||
have new members for a host name. The SSL data structure has an
|
||||
additional member SSL_CTX *initial_ctx so that new sessions can be
|
||||
additional member `SSL_CTX *initial_ctx` so that new sessions can be
|
||||
stored in that context to allow for session resumption, even after the
|
||||
SSL has been switched to a new SSL_CTX in reaction to a client's
|
||||
server_name extension.
|
||||
@@ -8303,7 +8438,6 @@ OpenSSL 1.0.1.]
|
||||
default is a warning; it becomes fatal with the '-servername_fatal'
|
||||
option.
|
||||
|
||||
|
||||
*Peter Sylvester, Remy Allais, Christophe Renou*
|
||||
|
||||
* Whirlpool hash implementation is added.
|
||||
@@ -8388,7 +8522,7 @@ OpenSSL 1.0.1.]
|
||||
OpenSSL 0.9.x
|
||||
-------------
|
||||
|
||||
### Changes between 0.9.8m and 0.9.8n [24 Mar 2010] ###
|
||||
### Changes between 0.9.8m and 0.9.8n [24 Mar 2010]
|
||||
|
||||
* When rejecting SSL/TLS records due to an incorrect version number, never
|
||||
update s->server with a new major version number. As of
|
||||
@@ -8405,7 +8539,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Tomas Hoger <thoger@redhat.com>*
|
||||
|
||||
### Changes between 0.9.8l and 0.9.8m [25 Feb 2010] ###
|
||||
### Changes between 0.9.8l and 0.9.8m [25 Feb 2010]
|
||||
|
||||
* Always check bn_wexpand() return values for failure. [CVE-2009-3245][]
|
||||
|
||||
@@ -8589,11 +8723,11 @@ OpenSSL 0.9.x
|
||||
|
||||
*Darryl Miles <darryl-mailinglists@netbauds.net>*
|
||||
|
||||
* Add 2.5.4.* OIDs
|
||||
* Add `2.5.4.*` OIDs
|
||||
|
||||
*Ilya O. <vrghost@gmail.com>*
|
||||
|
||||
### Changes between 0.9.8k and 0.9.8l [5 Nov 2009] ###
|
||||
### Changes between 0.9.8k and 0.9.8l [5 Nov 2009]
|
||||
|
||||
* Disable renegotiation completely - this fixes a severe security
|
||||
problem [CVE-2009-3555][] at the cost of breaking all
|
||||
@@ -8604,10 +8738,10 @@ OpenSSL 0.9.x
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
### Changes between 0.9.8j and 0.9.8k [25 Mar 2009] ###
|
||||
### Changes between 0.9.8j and 0.9.8k [25 Mar 2009]
|
||||
|
||||
* Don't set val to NULL when freeing up structures, it is freed up by
|
||||
underlying code. If sizeof(void *) > sizeof(long) this can result in
|
||||
underlying code. If `sizeof(void *) > sizeof(long)` this can result in
|
||||
zeroing past the valid field. [CVE-2009-0789][]
|
||||
|
||||
*Paolo Ganci <Paolo.Ganci@AdNovum.CH>*
|
||||
@@ -8658,7 +8792,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
### Changes between 0.9.8i and 0.9.8j [07 Jan 2009] ###
|
||||
### Changes between 0.9.8i and 0.9.8j [07 Jan 2009]
|
||||
|
||||
* Properly check EVP_VerifyFinal() and similar return values
|
||||
[CVE-2008-5077][].
|
||||
@@ -8705,7 +8839,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.8h and 0.9.8i [15 Sep 2008] ###
|
||||
### Changes between 0.9.8h and 0.9.8i [15 Sep 2008]
|
||||
|
||||
* Fix NULL pointer dereference if a DTLS server received
|
||||
ChangeCipherSpec as first record [CVE-2009-1386][].
|
||||
@@ -8713,7 +8847,7 @@ OpenSSL 0.9.x
|
||||
*PR #1679*
|
||||
|
||||
* Fix a state transition in s3_srvr.c and d1_srvr.c
|
||||
(was using SSL3_ST_CW_CLNT_HELLO_B, should be ..._ST_SW_SRVR_...).
|
||||
(was using SSL3_ST_CW_CLNT_HELLO_B, should be `..._ST_SW_SRVR_...`).
|
||||
|
||||
*Nagendra Modadugu*
|
||||
|
||||
@@ -8725,7 +8859,6 @@ OpenSSL 0.9.x
|
||||
So now fix this for real by retiring the MONT_HELPER macro
|
||||
in crypto/rsa/rsa_eay.c.
|
||||
|
||||
|
||||
*Bodo Moeller; problem pointed out by Marius Schilder*
|
||||
|
||||
* Various precautionary measures:
|
||||
@@ -8742,7 +8875,6 @@ OpenSSL 0.9.x
|
||||
- Enforce the 'num' check in BN_div() (bn_div.c) for non-BN_DEBUG
|
||||
builds.
|
||||
|
||||
|
||||
*Neel Mehta, Bodo Moeller*
|
||||
|
||||
* Allow engines to be "soft loaded" - i.e. optionally don't die if
|
||||
@@ -8779,7 +8911,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.8g and 0.9.8h [28 May 2008] ###
|
||||
### Changes between 0.9.8g and 0.9.8h [28 May 2008]
|
||||
|
||||
* Fix flaw if 'Server Key exchange message' is omitted from a TLS
|
||||
handshake which could lead to a client crash as found using the
|
||||
@@ -8834,7 +8966,6 @@ OpenSSL 0.9.x
|
||||
namely BN_from_montgomery_word. (To enable this otherwise,
|
||||
e.g. x86_64, try `-DMONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD`.)
|
||||
|
||||
|
||||
*Andy Polyakov (backport partially by Bodo Moeller)*
|
||||
|
||||
* Add TLS session ticket callback. This allows an application to set
|
||||
@@ -8931,7 +9062,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.8f and 0.9.8g [19 Oct 2007] ###
|
||||
### Changes between 0.9.8f and 0.9.8g [19 Oct 2007]
|
||||
|
||||
* Fix various bugs:
|
||||
+ Binary incompatibility of ssl_ctx_st structure
|
||||
@@ -8941,7 +9072,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Andy Polyakov, Steve Henson*
|
||||
|
||||
### Changes between 0.9.8e and 0.9.8f [11 Oct 2007] ###
|
||||
### Changes between 0.9.8e and 0.9.8f [11 Oct 2007]
|
||||
|
||||
* DTLS Handshake overhaul. There were longstanding issues with
|
||||
OpenSSL DTLS implementation, which were making it impossible for
|
||||
@@ -8985,7 +9116,7 @@ OpenSSL 0.9.x
|
||||
* Add initial support for TLS extensions, specifically for the server_name
|
||||
extension so far. The SSL_SESSION, SSL_CTX, and SSL data structures now
|
||||
have new members for a host name. The SSL data structure has an
|
||||
additional member SSL_CTX *initial_ctx so that new sessions can be
|
||||
additional member `SSL_CTX *initial_ctx` so that new sessions can be
|
||||
stored in that context to allow for session resumption, even after the
|
||||
SSL has been switched to a new SSL_CTX in reaction to a client's
|
||||
server_name extension.
|
||||
@@ -9014,7 +9145,6 @@ OpenSSL 0.9.x
|
||||
default is a warning; it becomes fatal with the '-servername_fatal'
|
||||
option.
|
||||
|
||||
|
||||
*Peter Sylvester, Remy Allais, Christophe Renou, Steve Henson*
|
||||
|
||||
* Add AES and SSE2 assembly language support to VC++ build.
|
||||
@@ -9039,7 +9169,7 @@ OpenSSL 0.9.x
|
||||
*Dean Gaudet (Google)*
|
||||
|
||||
* Add the Korean symmetric 128-bit cipher SEED (see
|
||||
http://www.kisa.or.kr/kisa/seed/jsp/seed_eng.jsp) and
|
||||
<http://www.kisa.or.kr/kisa/seed/jsp/seed_eng.jsp>) and
|
||||
add SEED ciphersuites from RFC 4162:
|
||||
|
||||
TLS_RSA_WITH_SEED_CBC_SHA = "SEED-SHA"
|
||||
@@ -9056,7 +9186,7 @@ OpenSSL 0.9.x
|
||||
* Mitigate branch prediction attacks, which can be practical if a
|
||||
single processor is shared, allowing a spy process to extract
|
||||
information. For detailed background information, see
|
||||
http://eprint.iacr.org/2007/039 (O. Aciicmez, S. Gueron,
|
||||
<http://eprint.iacr.org/2007/039> (O. Aciicmez, S. Gueron,
|
||||
J.-P. Seifert, "New Branch Prediction Vulnerabilities in OpenSSL
|
||||
and Necessary Software Countermeasures"). The core of the change
|
||||
are new versions BN_div_no_branch() and
|
||||
@@ -9081,14 +9211,13 @@ OpenSSL 0.9.x
|
||||
|
||||
BN_BLINDING_new() will now use BN_dup() for the modulus so that
|
||||
the BN_BLINDING structure gets an independent copy of the
|
||||
modulus. This means that the previous "BIGNUM *m" argument to
|
||||
modulus. This means that the previous `BIGNUM *m` argument to
|
||||
BN_BLINDING_new() and to BN_BLINDING_create_param() now
|
||||
essentially becomes "const BIGNUM *m", although we can't actually
|
||||
essentially becomes `const BIGNUM *m`, although we can't actually
|
||||
change this in the header file before 0.9.9. It allows
|
||||
RSA_setup_blinding() to use BN_with_flags() on the modulus to
|
||||
enable BN_FLG_CONSTTIME.
|
||||
|
||||
|
||||
*Matthew D Wood (Intel Corp)*
|
||||
|
||||
* In the SSL/TLS server implementation, be strict about session ID
|
||||
@@ -9113,7 +9242,7 @@ OpenSSL 0.9.x
|
||||
not complete and could lead to a possible single byte overflow
|
||||
[CVE-2007-5135][] [Ben Laurie]
|
||||
|
||||
### Changes between 0.9.8d and 0.9.8e [23 Feb 2007] ###
|
||||
### Changes between 0.9.8d and 0.9.8e [23 Feb 2007]
|
||||
|
||||
* Since AES128 and AES256 (and similarly Camellia128 and
|
||||
Camellia256) share a single mask bit in the logic of
|
||||
@@ -9155,7 +9284,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Goetz Babin-Ebell*
|
||||
|
||||
### Changes between 0.9.8c and 0.9.8d [28 Sep 2006] ###
|
||||
### Changes between 0.9.8c and 0.9.8d [28 Sep 2006]
|
||||
|
||||
* Introduce limits to prevent malicious keys being able to
|
||||
cause a denial of service. [CVE-2006-2940][]
|
||||
@@ -9198,10 +9327,9 @@ OpenSSL 0.9.x
|
||||
definition to split the single 'unsigned long mask' bitmap into
|
||||
multiple values to extend the available space.
|
||||
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.8b and 0.9.8c [05 Sep 2006] ###
|
||||
### Changes between 0.9.8b and 0.9.8c [05 Sep 2006]
|
||||
|
||||
* Avoid PKCS #1 v1.5 signature attack discovered by Daniel Bleichenbacher
|
||||
[CVE-2006-4339][] [Ben Laurie and Google Security Team]
|
||||
@@ -9228,9 +9356,9 @@ OpenSSL 0.9.x
|
||||
|
||||
* Disable rogue ciphersuites:
|
||||
|
||||
- SSLv2 0x08 0x00 0x80 ("RC4-64-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x61 ("EXP1024-RC2-CBC-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x60 ("EXP1024-RC4-MD5")
|
||||
- SSLv2 0x08 0x00 0x80 ("RC4-64-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x61 ("EXP1024-RC2-CBC-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x60 ("EXP1024-RC4-MD5")
|
||||
|
||||
The latter two were purportedly from
|
||||
draft-ietf-tls-56-bit-ciphersuites-0[01].txt, but do not really
|
||||
@@ -9249,7 +9377,7 @@ OpenSSL 0.9.x
|
||||
|
||||
* Add the symmetric cipher Camellia (128-bit, 192-bit, 256-bit key
|
||||
versions), which is now available for royalty-free use
|
||||
(see http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html).
|
||||
(see <http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html>).
|
||||
Also, add Camellia TLS ciphersuites from RFC 4132.
|
||||
|
||||
To minimize changes between patchlevels in the OpenSSL 0.9.8
|
||||
@@ -9267,7 +9395,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.8a and 0.9.8b [04 May 2006] ###
|
||||
### Changes between 0.9.8a and 0.9.8b [04 May 2006]
|
||||
|
||||
* When applying a cipher rule check to see if string match is an explicit
|
||||
cipher suite and only match that one cipher suite if it is.
|
||||
@@ -9293,7 +9421,7 @@ OpenSSL 0.9.x
|
||||
* Fixes and enhancements to zlib compression code. We now only use
|
||||
"zlib1.dll" and use the default `__cdecl` calling convention on Win32
|
||||
to conform with the standards mentioned here:
|
||||
http://www.zlib.net/DLL_FAQ.txt
|
||||
<http://www.zlib.net/DLL_FAQ.txt>
|
||||
Static zlib linking now works on Windows and the new --with-zlib-include
|
||||
--with-zlib-lib options to Configure can be used to supply the location
|
||||
of the headers and library. Gracefully handle case where zlib library
|
||||
@@ -9318,7 +9446,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.8 and 0.9.8a [11 Oct 2005] ###
|
||||
### Changes between 0.9.8 and 0.9.8a [11 Oct 2005]
|
||||
|
||||
* Remove the functionality of SSL_OP_MSIE_SSLV2_RSA_PADDING
|
||||
(part of SSL_OP_ALL). This option used to disable the
|
||||
@@ -9328,7 +9456,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Bodo Moeller; problem pointed out by Yutaka Oiwa (Research Center
|
||||
for Information Security, National Institute of Advanced Industrial
|
||||
Science and Technology [AIST*, Japan)]
|
||||
Science and Technology [AIST], Japan)*
|
||||
|
||||
* Add two function to clear and return the verify parameter flags.
|
||||
|
||||
@@ -9362,7 +9490,7 @@ OpenSSL 0.9.x
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7h and 0.9.8 [05 Jul 2005] ###
|
||||
### Changes between 0.9.7h and 0.9.8 [05 Jul 2005]
|
||||
|
||||
[NB: OpenSSL 0.9.7i and later 0.9.7 patch levels were released after
|
||||
OpenSSL 0.9.8.]
|
||||
@@ -9452,7 +9580,6 @@ OpenSSL 0.9.8.]
|
||||
fee for non-commercial use. As before, "no-idea" can be used to
|
||||
avoid this algorithm.)
|
||||
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Add processing of proxy certificates (see RFC 3820). This work was
|
||||
@@ -9475,7 +9602,6 @@ OpenSSL 0.9.8.]
|
||||
|
||||
The blank line is mandatory.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New arguments -certform, -keyform and -pass for s_client and s_server
|
||||
@@ -9499,7 +9625,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Michal Ludvig <michal@logix.cz>, with help from Andy Polyakov*
|
||||
|
||||
* Deprecate BN_[get|set]_params() functions (they were ignored internally).
|
||||
* Deprecate `BN_[get|set]_params()` functions (they were ignored internally).
|
||||
|
||||
*Geoff Thorpe*
|
||||
|
||||
@@ -9648,7 +9774,7 @@ OpenSSL 0.9.8.]
|
||||
to clean up those corresponding objects before destroying the hash table
|
||||
(and losing the object pointers). So some over-zealous constifications in
|
||||
LHASH have been relaxed so that lh_insert() does not take (nor store) the
|
||||
objects as "const" and the lh_doall[_arg] callback wrappers are not
|
||||
objects as "const" and the `lh_doall[_arg]` callback wrappers are not
|
||||
prototyped to have "const" restrictions on the object pointers they are
|
||||
given (and so aren't required to cast them away any more).
|
||||
|
||||
@@ -9657,8 +9783,9 @@ OpenSSL 0.9.8.]
|
||||
* The tmdiff.h API was so ugly and minimal that our own timing utility
|
||||
(speed) prefers to use its own implementation. The two implementations
|
||||
haven't been consolidated as yet (volunteers?) but the tmdiff API has had
|
||||
its object type properly exposed (MS_TM) instead of casting to/from "char
|
||||
*". This may still change yet if someone realises MS_TM and "ms_time_***"
|
||||
its object type properly exposed (MS_TM) instead of casting to/from
|
||||
`char *`. This may still change yet if someone realises MS_TM and
|
||||
`ms_time_***`
|
||||
aren't necessarily the greatest nomenclatures - but this is what was used
|
||||
internally to the implementation so I've used that for now.
|
||||
|
||||
@@ -9891,7 +10018,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
* Change the "progress" mechanism used in key-generation and
|
||||
primality testing to functions that take a new BN_GENCB pointer in
|
||||
place of callback/argument pairs. The new API functions have "_ex"
|
||||
place of callback/argument pairs. The new API functions have `_ex`
|
||||
postfixes and the older functions are reimplemented as wrappers for
|
||||
the new ones. The OPENSSL_NO_DEPRECATED symbol can be used to hide
|
||||
declarations of the old functions to help (graceful) attempts to
|
||||
@@ -10052,8 +10179,7 @@ OpenSSL 0.9.8.]
|
||||
* Add named elliptic curves over binary fields from X9.62, SECG,
|
||||
and WAP/WTLS; add OIDs that were still missing.
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* Extend the EC library for elliptic curves over binary fields
|
||||
(new files ec2_smpl.c, ec2_smpt.c, ec2_mult.c in crypto/ec/).
|
||||
@@ -10077,16 +10203,15 @@ OpenSSL 0.9.8.]
|
||||
As binary polynomials are represented as BIGNUMs, various members
|
||||
of the EC_GROUP and EC_POINT data structures can be shared
|
||||
between the implementations for prime fields and binary fields;
|
||||
the above ..._GF2m functions (except for EX_GROUP_new_curve_GF2m)
|
||||
are essentially identical to their ..._GFp counterparts.
|
||||
(For simplicity, the '..._GFp' prefix has been dropped from
|
||||
the above `..._GF2m functions` (except for EX_GROUP_new_curve_GF2m)
|
||||
are essentially identical to their `..._GFp` counterparts.
|
||||
(For simplicity, the `..._GFp` prefix has been dropped from
|
||||
various internal method names.)
|
||||
|
||||
An internal 'field_div' method (similar to 'field_mul' and
|
||||
'field_sqr') has been added; this is used only for binary fields.
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* Optionally dispatch EC_POINT_mul(), EC_POINT_precompute_mult()
|
||||
through methods ('mul', 'precompute_mult').
|
||||
@@ -10095,21 +10220,18 @@ OpenSSL 0.9.8.]
|
||||
and 'ec_wNAF_precomputed_mult') remain the default if these
|
||||
methods are undefined.
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* New function EC_GROUP_get_degree, which is defined through
|
||||
EC_METHOD. For curves over prime fields, this returns the bit
|
||||
length of the modulus.
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* New functions EC_GROUP_dup, EC_POINT_dup.
|
||||
(These simply call ..._new and ..._copy).
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* Add binary polynomial arithmetic software in crypto/bn/bn_gf2m.c.
|
||||
Polynomials are represented as BIGNUMs (where the sign bit is not
|
||||
@@ -10162,8 +10284,7 @@ OpenSSL 0.9.8.]
|
||||
if OPENSSL_SUN_GF2M_DIV is defined (patent pending; read the
|
||||
copyright notice in crypto/bn/bn_gf2m.c before enabling it).
|
||||
|
||||
*Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)*
|
||||
*Sheueling Chang Shantz and Douglas Stebila (Sun Microsystems Laboratories)*
|
||||
|
||||
* Add new error code 'ERR_R_DISABLED' that can be used when some
|
||||
functionality is disabled at compile-time.
|
||||
@@ -10286,7 +10407,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.7l and 0.9.7m [23 Feb 2007] ###
|
||||
### Changes between 0.9.7l and 0.9.7m [23 Feb 2007]
|
||||
|
||||
* Cleanse PEM buffers before freeing them since they may contain
|
||||
sensitive data.
|
||||
@@ -10336,7 +10457,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7k and 0.9.7l [28 Sep 2006] ###
|
||||
### Changes between 0.9.7k and 0.9.7l [28 Sep 2006]
|
||||
|
||||
* Introduce limits to prevent malicious keys being able to
|
||||
cause a denial of service. [CVE-2006-2940][]
|
||||
@@ -10364,7 +10485,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.7j and 0.9.7k [05 Sep 2006] ###
|
||||
### Changes between 0.9.7j and 0.9.7k [05 Sep 2006]
|
||||
|
||||
* Avoid PKCS #1 v1.5 signature attack discovered by Daniel Bleichenbacher
|
||||
[CVE-2006-4339][] [Ben Laurie and Google Security Team]
|
||||
@@ -10377,9 +10498,9 @@ OpenSSL 0.9.8.]
|
||||
|
||||
* Disable rogue ciphersuites:
|
||||
|
||||
- SSLv2 0x08 0x00 0x80 ("RC4-64-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x61 ("EXP1024-RC2-CBC-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x60 ("EXP1024-RC4-MD5")
|
||||
- SSLv2 0x08 0x00 0x80 ("RC4-64-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x61 ("EXP1024-RC2-CBC-MD5")
|
||||
- SSLv3/TLSv1 0x00 0x60 ("EXP1024-RC4-MD5")
|
||||
|
||||
The latter two were purportedly from
|
||||
draft-ietf-tls-56-bit-ciphersuites-0[01].txt, but do not really
|
||||
@@ -10396,7 +10517,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.7i and 0.9.7j [04 May 2006] ###
|
||||
### Changes between 0.9.7i and 0.9.7j [04 May 2006]
|
||||
|
||||
* Adapt fipsld and the build system to link against the validated FIPS
|
||||
module in FIPS mode.
|
||||
@@ -10414,7 +10535,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7h and 0.9.7i [14 Oct 2005] ###
|
||||
### Changes between 0.9.7h and 0.9.7i [14 Oct 2005]
|
||||
|
||||
* Wrapped the definition of EVP_MAX_MD_SIZE in a #ifdef OPENSSL_FIPS.
|
||||
The value now differs depending on if you build for FIPS or not.
|
||||
@@ -10424,7 +10545,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Andy Polyakov*
|
||||
|
||||
### Changes between 0.9.7g and 0.9.7h [11 Oct 2005] ###
|
||||
### Changes between 0.9.7g and 0.9.7h [11 Oct 2005]
|
||||
|
||||
* Remove the functionality of SSL_OP_MSIE_SSLV2_RSA_PADDING
|
||||
(part of SSL_OP_ALL). This option used to disable the
|
||||
@@ -10434,7 +10555,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Bodo Moeller; problem pointed out by Yutaka Oiwa (Research Center
|
||||
for Information Security, National Institute of Advanced Industrial
|
||||
Science and Technology [AIST*, Japan)]
|
||||
Science and Technology [AIST, Japan)]*
|
||||
|
||||
* Minimal support for X9.31 signatures and PSS padding modes. This is
|
||||
mainly for FIPS compliance and not fully integrated at this stage.
|
||||
@@ -10462,7 +10583,6 @@ OpenSSL 0.9.8.]
|
||||
RSA_FLAG_NO_EXP_CONSTTIME, DSA_FLAG_NO_EXP_CONSTTIME, or
|
||||
DH_FLAG_NO_EXP_CONSTTIME, respectively, is set.
|
||||
|
||||
|
||||
*Matthew D Wood (Intel Corp), with some changes by Bodo Moeller*
|
||||
|
||||
* Change the client implementation for SSLv23_method() and
|
||||
@@ -10490,7 +10610,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7f and 0.9.7g [11 Apr 2005] ###
|
||||
### Changes between 0.9.7f and 0.9.7g [11 Apr 2005]
|
||||
|
||||
[NB: OpenSSL 0.9.7h and later 0.9.7 patch levels were released after
|
||||
OpenSSL 0.9.8.]
|
||||
@@ -10515,7 +10635,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.7e and 0.9.7f [22 Mar 2005] ###
|
||||
### Changes between 0.9.7e and 0.9.7f [22 Mar 2005]
|
||||
|
||||
* Use (SSL_RANDOM_VALUE - 4) bytes of pseudo random data when generating
|
||||
server and client random values. Previously
|
||||
@@ -10578,15 +10698,15 @@ OpenSSL 0.9.8.]
|
||||
side effect always do the following basic checks on extensions,
|
||||
not just when there's an associated purpose to the check:
|
||||
|
||||
- if there is an unhandled critical extension (unless the user
|
||||
has chosen to ignore this fault)
|
||||
- if the path length has been exceeded (if one is set at all)
|
||||
- that certain extensions fit the associated purpose (if one has
|
||||
been given)
|
||||
- if there is an unhandled critical extension (unless the user
|
||||
has chosen to ignore this fault)
|
||||
- if the path length has been exceeded (if one is set at all)
|
||||
- that certain extensions fit the associated purpose (if one has
|
||||
been given)
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.7d and 0.9.7e [25 Oct 2004] ###
|
||||
### Changes between 0.9.7d and 0.9.7e [25 Oct 2004]
|
||||
|
||||
* Avoid a race condition when CRLs are checked in a multi threaded
|
||||
environment. This would happen due to the reordering of the revoked
|
||||
@@ -10614,7 +10734,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7c and 0.9.7d [17 Mar 2004] ###
|
||||
### Changes between 0.9.7c and 0.9.7d [17 Mar 2004]
|
||||
|
||||
* Fix null-pointer assignment in do_change_cipher_spec() revealed
|
||||
by using the Codenomicon TLS Test Tool [CVE-2004-0079][]
|
||||
@@ -10667,7 +10787,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7b and 0.9.7c [30 Sep 2003] ###
|
||||
### Changes between 0.9.7b and 0.9.7c [30 Sep 2003]
|
||||
|
||||
* Fix various bugs revealed by running the NISCC test suite:
|
||||
|
||||
@@ -10679,7 +10799,6 @@ OpenSSL 0.9.8.]
|
||||
If verify callback ignores invalid public key errors don't try to check
|
||||
certificate signature with the NULL public key.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New -ignore_err option in ocsp application to stop the server
|
||||
@@ -10726,7 +10845,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.7a and 0.9.7b [10 Apr 2003] ###
|
||||
### Changes between 0.9.7a and 0.9.7b [10 Apr 2003]
|
||||
|
||||
* Countermeasure against the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack on PKCS #1 v1.5 padding: treat
|
||||
@@ -10766,7 +10885,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Ulf Moeller*
|
||||
|
||||
### Changes between 0.9.7 and 0.9.7a [19 Feb 2003] ###
|
||||
### Changes between 0.9.7 and 0.9.7a [19 Feb 2003]
|
||||
|
||||
* In ssl3_get_record (ssl/s3_pkt.c), minimize information leaked
|
||||
via timing by performing a MAC computation even if incorrect
|
||||
@@ -10857,7 +10976,7 @@ OpenSSL 0.9.8.]
|
||||
|
||||
*Richard Levitte & Kris Kennaway <kris@obsecurity.org>*
|
||||
|
||||
### Changes between 0.9.6h and 0.9.7 [31 Dec 2002] ###
|
||||
### Changes between 0.9.6h and 0.9.7 [31 Dec 2002]
|
||||
|
||||
[NB: OpenSSL 0.9.6i and later 0.9.6 patch levels were released after
|
||||
OpenSSL 0.9.7.]
|
||||
@@ -11101,7 +11220,7 @@ OpenSSL 0.9.7.]
|
||||
|
||||
* Remove most calls to EVP_CIPHER_CTX_cleanup() in evp_enc.c, this
|
||||
allows existing EVP_CIPHER_CTX structures to be reused after
|
||||
calling EVP_*Final(). This behaviour is used by encryption
|
||||
calling `EVP_*Final()`. This behaviour is used by encryption
|
||||
BIOs and some applications. This has the side effect that
|
||||
applications must explicitly clean up cipher contexts with
|
||||
EVP_CIPHER_CTX_cleanup() or they will leak memory.
|
||||
@@ -11356,12 +11475,12 @@ OpenSSL 0.9.7.]
|
||||
|
||||
*Massimiliano Pala madwolf@openca.org*
|
||||
|
||||
* Change all functions with names starting with des_ to be starting
|
||||
with DES_ instead. Add wrappers that are compatible with libdes,
|
||||
but are named _ossl_old_des_*. Finally, add macros that map the
|
||||
des_* symbols to the corresponding _ossl_old_des_* if libdes
|
||||
* Change all functions with names starting with `des_` to be starting
|
||||
with `DES_` instead. Add wrappers that are compatible with libdes,
|
||||
but are named `_ossl_old_des_*`. Finally, add macros that map the
|
||||
`des_*` symbols to the corresponding `_ossl_old_des_*` if libdes
|
||||
compatibility is desired. If OpenSSL 0.9.6c compatibility is
|
||||
desired, the des_* symbols will be mapped to DES_*, with one
|
||||
desired, the `des_*` symbols will be mapped to `DES_*`, with one
|
||||
exception.
|
||||
|
||||
Since we provide two compatibility mappings, the user needs to
|
||||
@@ -11379,7 +11498,7 @@ OpenSSL 0.9.7.]
|
||||
won't work.
|
||||
|
||||
NOTE: This is a major break of an old API into a new one. Software
|
||||
authors are encouraged to switch to the DES_ style functions. Some
|
||||
authors are encouraged to switch to the `DES_` style functions. Some
|
||||
time in the future, des_old.h and the libdes compatibility functions
|
||||
will be disable (i.e. OPENSSL_DISABLE_OLD_DES_SUPPORT will be the
|
||||
default), and then completely removed.
|
||||
@@ -11439,7 +11558,7 @@ OpenSSL 0.9.7.]
|
||||
deal more passive and at run-time, operations deal directly with
|
||||
RSA_METHODs, DSA_METHODs (etc) as they did before, rather than
|
||||
dereferencing through an ENGINE pointer any more. Also, the ENGINE
|
||||
functions dealing with BN_MOD_EXP[_CRT] handlers have been removed -
|
||||
functions dealing with `BN_MOD_EXP[_CRT]` handlers have been removed -
|
||||
they were not being used by the framework as there is no concept of a
|
||||
BIGNUM_METHOD and they could not be generalised to the new
|
||||
'ENGINE_TABLE' mechanism that underlies the new code. Similarly,
|
||||
@@ -11453,7 +11572,7 @@ OpenSSL 0.9.7.]
|
||||
*Steve Henson*
|
||||
|
||||
* Change mkdef.pl to sort symbols that get the same entry number,
|
||||
and make sure the automatically generated functions ERR_load_*
|
||||
and make sure the automatically generated functions `ERR_load_*`
|
||||
become part of libeay.num as well.
|
||||
|
||||
*Richard Levitte*
|
||||
@@ -11485,7 +11604,7 @@ OpenSSL 0.9.7.]
|
||||
*Steve Henson*
|
||||
|
||||
* Make maximum certificate chain size accepted from the peer application
|
||||
settable (SSL*_get/set_max_cert_list()), as proposed by
|
||||
settable (`SSL*_get/set_max_cert_list()`), as proposed by
|
||||
"Douglas E. Engert" <deengert@anl.gov>.
|
||||
|
||||
*Lutz Jaenicke*
|
||||
@@ -11579,7 +11698,7 @@ OpenSSL 0.9.7.]
|
||||
|
||||
*Geoff Thorpe*
|
||||
|
||||
* Give DH, DSA, and RSA types their own "**_up_ref()" function to increment
|
||||
* Give DH, DSA, and RSA types their own `*_up_ref()` function to increment
|
||||
reference counts. This performs normal REF_PRINT/REF_CHECK macros on
|
||||
the operation, and provides a more encapsulated way for external code
|
||||
(crypto/evp/ and ssl/) to do this. Also changed the evp and ssl code
|
||||
@@ -11627,7 +11746,6 @@ OpenSSL 0.9.7.]
|
||||
EVP_DigestFinal(&md, out, NULL);
|
||||
EVP_MD_CTX_cleanup(&md); /* new function call */
|
||||
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
* Make DES key schedule conform to the usual scheme, as well as
|
||||
@@ -11658,8 +11776,8 @@ OpenSSL 0.9.7.]
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
* Change historical references to {NID,SN,LN}_des_ede and ede3 to add the
|
||||
correct _ecb suffix.
|
||||
* Change historical references to `{NID,SN,LN}_des_ede` and ede3 to add the
|
||||
correct `_ecb suffix`.
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
@@ -11676,17 +11794,16 @@ OpenSSL 0.9.7.]
|
||||
*Richard Levitte*
|
||||
|
||||
* Changes to Kerberos SSL for RFC 2712 compliance:
|
||||
1. Implemented real KerberosWrapper, instead of just using
|
||||
KRB5 AP_REQ message. [Thanks to Simon Wilkinson <sxw@sxw.org.uk>]
|
||||
2. Implemented optional authenticator field of KerberosWrapper.
|
||||
1. Implemented real KerberosWrapper, instead of just using
|
||||
KRB5 AP_REQ message. [Thanks to Simon Wilkinson <sxw@sxw.org.uk>]
|
||||
2. Implemented optional authenticator field of KerberosWrapper.
|
||||
|
||||
Added openssl-style ASN.1 macros for Kerberos ticket, ap_req,
|
||||
and authenticator structs; see crypto/krb5/.
|
||||
|
||||
Generalized Kerberos calls to support multiple Kerberos libraries.
|
||||
*Vern Staats <staatsvr@asc.hpc.mil>,
|
||||
Jeffrey Altman <jaltman@columbia.edu>
|
||||
via Richard Levitte*
|
||||
*Vern Staats <staatsvr@asc.hpc.mil>, Jeffrey Altman <jaltman@columbia.edu>
|
||||
via Richard Levitte*
|
||||
|
||||
* Cause 'openssl speed' to use fully hard-coded DSA keys as it
|
||||
already does with RSA. testdsa.h now has 'priv_key/pub_key'
|
||||
@@ -12028,7 +12145,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Modify EVP_Digest*() routines so they now return values. Although the
|
||||
* Modify `EVP_Digest*()` routines so they now return values. Although the
|
||||
internal software routines can never fail additional hardware versions
|
||||
might.
|
||||
|
||||
@@ -12174,14 +12291,14 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
* Make all configuration macros available for application by making
|
||||
sure they are available in opensslconf.h, by giving them names starting
|
||||
with "OPENSSL_" to avoid conflicts with other packages and by making
|
||||
with `OPENSSL_` to avoid conflicts with other packages and by making
|
||||
sure e_os2.h will cover all platform-specific cases together with
|
||||
opensslconf.h.
|
||||
Additionally, it is now possible to define configuration/platform-
|
||||
specific names (called "system identities"). In the C code, these
|
||||
are prefixed with "OPENSSL_SYSNAME_". e_os2.h will create another
|
||||
macro with the name beginning with "OPENSSL_SYS_", which is determined
|
||||
from "OPENSSL_SYSNAME_*" or compiler-specific macros depending on
|
||||
are prefixed with `OPENSSL_SYSNAME_`. e_os2.h will create another
|
||||
macro with the name beginning with `OPENSSL_SYS_`, which is determined
|
||||
from `OPENSSL_SYSNAME_*` or compiler-specific macros depending on
|
||||
what is available.
|
||||
|
||||
*Richard Levitte*
|
||||
@@ -12230,7 +12347,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
* Disable stdin buffering in load_cert (apps/apps.c) so that no certs are
|
||||
skipped when using openssl x509 multiple times on a single input file,
|
||||
e.g. "(openssl x509 -out cert1; openssl x509 -out cert2) <certs".
|
||||
e.g. `(openssl x509 -out cert1; openssl x509 -out cert2) <certs`.
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
@@ -12393,9 +12510,9 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*Steve Henson*
|
||||
|
||||
* New subcommands for 'openssl ca':
|
||||
'openssl ca -status <serial>' prints the status of the cert with
|
||||
`openssl ca -status <serial>` prints the status of the cert with
|
||||
the given serial number (according to the index file).
|
||||
'openssl ca -updatedb' updates the expiry status of certificates
|
||||
`openssl ca -updatedb` updates the expiry status of certificates
|
||||
in the index file.
|
||||
|
||||
*Massimiliano Pala <madwolf@comune.modena.it>*
|
||||
@@ -12424,7 +12541,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
* Allowing defining memory allocation callbacks that will be given
|
||||
file name and line number information in additional arguments
|
||||
(a const char* and an int). The basic functionality remains, as
|
||||
(a `const char*` and an int). The basic functionality remains, as
|
||||
well as the original possibility to just replace malloc(),
|
||||
realloc() and free() by functions that do not know about these
|
||||
additional arguments. To register and find out the current
|
||||
@@ -12437,9 +12554,9 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
CRYPTO_get_locked_mem_ex_functions
|
||||
|
||||
These work the same way as CRYPTO_set_mem_functions and friends.
|
||||
CRYPTO_get_[locked_]mem_functions now writes 0 where such an
|
||||
`CRYPTO_get_[locked_]mem_functions` now writes 0 where such an
|
||||
extended allocation function is enabled.
|
||||
Similarly, CRYPTO_get_[locked_]mem_ex_functions writes 0 where
|
||||
Similarly, `CRYPTO_get_[locked_]mem_ex_functions` writes 0 where
|
||||
a conventional allocation function is enabled.
|
||||
|
||||
*Richard Levitte, Bodo Moeller*
|
||||
@@ -12547,7 +12664,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
* New functions or ASN1_item_d2i_fp() and ASN1_item_d2i_bio(). These
|
||||
replace the old function pointer based I/O routines. Change most of
|
||||
the *_d2i_bio() and *_d2i_fp() functions to use these.
|
||||
the `*_d2i_bio()` and `*_d2i_fp()` functions to use these.
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
@@ -12674,7 +12791,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
* Added Kerberos Cipher Suites to be used with TLS, as written in
|
||||
RFC 2712.
|
||||
*Veers Staats <staatsvr@asc.hpc.mil>,
|
||||
Jeffrey Altman <jaltman@columbia.edu>, via Richard Levitte*
|
||||
Jeffrey Altman <jaltman@columbia.edu>, via Richard Levitte*
|
||||
|
||||
* Reformat the FAQ so the different questions and answers can be divided
|
||||
in sections depending on the subject.
|
||||
@@ -12740,7 +12857,7 @@ s-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Move BN_mod_... functions into new file crypto/bn/bn_mod.c
|
||||
* Move `BN_mod_...` functions into new file crypto/bn/bn_mod.c
|
||||
(except for exponentiation, which stays in crypto/bn/bn_exp.c,
|
||||
and BN_mod_mul_reciprocal, which stays in crypto/bn/bn_recp.c)
|
||||
and add new functions:
|
||||
@@ -12904,7 +13021,7 @@ ndif
|
||||
|
||||
* NCONF changes.
|
||||
NCONF_get_number() has no error checking at all. As a replacement,
|
||||
NCONF_get_number_e() is defined (_e for "error checking") and is
|
||||
NCONF_get_number_e() is defined (`_e` for "error checking") and is
|
||||
promoted strongly. The old NCONF_get_number is kept around for
|
||||
binary backward compatibility.
|
||||
Make it possible for methods to load from something other than a BIO,
|
||||
@@ -12938,14 +13055,14 @@ ndif
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.6l and 0.9.6m [17 Mar 2004] ###
|
||||
### Changes between 0.9.6l and 0.9.6m [17 Mar 2004]
|
||||
|
||||
* Fix null-pointer assignment in do_change_cipher_spec() revealed
|
||||
by using the Codenomicon TLS Test Tool [CVE-2004-0079][]
|
||||
|
||||
*Joe Orton, Steve Henson*
|
||||
|
||||
### Changes between 0.9.6k and 0.9.6l [04 Nov 2003] ###
|
||||
### Changes between 0.9.6k and 0.9.6l [04 Nov 2003]
|
||||
|
||||
* Fix additional bug revealed by the NISCC test suite:
|
||||
|
||||
@@ -12954,7 +13071,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.6j and 0.9.6k [30 Sep 2003] ###
|
||||
### Changes between 0.9.6j and 0.9.6k [30 Sep 2003]
|
||||
|
||||
* Fix various bugs revealed by running the NISCC test suite:
|
||||
|
||||
@@ -12964,7 +13081,6 @@ ndif
|
||||
If verify callback ignores invalid public key errors don't try to check
|
||||
certificate signature with the NULL public key.
|
||||
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* In ssl3_accept() (ssl/s3_srvr.c) only accept a client certificate
|
||||
@@ -12984,7 +13100,7 @@ ndif
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.6i and 0.9.6j [10 Apr 2003] ###
|
||||
### Changes between 0.9.6i and 0.9.6j [10 Apr 2003]
|
||||
|
||||
* Countermeasure against the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack on PKCS #1 v1.5 padding: treat
|
||||
@@ -13012,7 +13128,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.6h and 0.9.6i [19 Feb 2003] ###
|
||||
### Changes between 0.9.6h and 0.9.6i [19 Feb 2003]
|
||||
|
||||
* In ssl3_get_record (ssl/s3_pkt.c), minimize information leaked
|
||||
via timing by performing a MAC computation even if incorrect
|
||||
@@ -13024,7 +13140,7 @@ ndif
|
||||
Alain Hiltgen (UBS), Serge Vaudenay (EPFL), and
|
||||
Martin Vuagnoux (EPFL, Ilion)*
|
||||
|
||||
### Changes between 0.9.6g and 0.9.6h [5 Dec 2002] ###
|
||||
### Changes between 0.9.6g and 0.9.6h [5 Dec 2002]
|
||||
|
||||
* New function OPENSSL_cleanse(), which is used to cleanse a section of
|
||||
memory from its contents. This is done with a counter that will
|
||||
@@ -13104,20 +13220,19 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
### Changes between 0.9.6f and 0.9.6g [9 Aug 2002] ###
|
||||
### Changes between 0.9.6f and 0.9.6g [9 Aug 2002]
|
||||
|
||||
* [In 0.9.6g-engine release:]
|
||||
Fix crypto/engine/vendor_defns/cswift.h for WIN32 (use '_stdcall').
|
||||
Fix crypto/engine/vendor_defns/cswift.h for WIN32 (use `_stdcall`).
|
||||
|
||||
*Lynn Gazis <lgazis@rainbow.com>*
|
||||
|
||||
### Changes between 0.9.6e and 0.9.6f [8 Aug 2002] ###
|
||||
### Changes between 0.9.6e and 0.9.6f [8 Aug 2002]
|
||||
|
||||
* Fix ASN1 checks. Check for overflow by comparing with LONG_MAX
|
||||
and get fix the header length calculation.
|
||||
*Florian Weimer <Weimer@CERT.Uni-Stuttgart.DE>,
|
||||
Alon Kantor <alonk@checkpoint.com> (and others),
|
||||
Steve Henson*
|
||||
Alon Kantor <alonk@checkpoint.com> (and others), Steve Henson*
|
||||
|
||||
* Use proper error handling instead of 'assertions' in buffer
|
||||
overflow checks added in 0.9.6e. This prevents DoS (the
|
||||
@@ -13125,7 +13240,7 @@ ndif
|
||||
|
||||
*Arne Ansper <arne@ats.cyber.ee>, Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.6d and 0.9.6e [30 Jul 2002] ###
|
||||
### Changes between 0.9.6d and 0.9.6e [30 Jul 2002]
|
||||
|
||||
* Add various sanity checks to asn1_get_length() to reject
|
||||
the ASN1 length bytes if they exceed sizeof(long), will appear
|
||||
@@ -13179,7 +13294,7 @@ ndif
|
||||
|
||||
* Various temporary buffers to hold ASCII versions of integers were
|
||||
too small for 64 bit platforms. [CVE-2002-0655][]
|
||||
*Matthew Byng-Maddick <mbm@aldigital.co.uk> and Ben Laurie (CHATS)>
|
||||
*Matthew Byng-Maddick <mbm@aldigital.co.uk> and Ben Laurie (CHATS)>*
|
||||
|
||||
* Remote buffer overflow in SSL3 protocol - an attacker could
|
||||
supply an oversized session ID to a client. [CVE-2002-0656][]
|
||||
@@ -13191,14 +13306,14 @@ ndif
|
||||
|
||||
*Ben Laurie (CHATS)*
|
||||
|
||||
### Changes between 0.9.6c and 0.9.6d [9 May 2002] ###
|
||||
### Changes between 0.9.6c and 0.9.6d [9 May 2002]
|
||||
|
||||
* Fix crypto/asn1/a_sign.c so that 'parameters' is omitted (not
|
||||
encoded as NULL) with id-dsa-with-sha1.
|
||||
|
||||
*Nils Larsch <nla@trustcenter.de>; problem pointed out by Bodo Moeller*
|
||||
|
||||
* Check various X509_...() return values in apps/req.c.
|
||||
* Check various `X509_...()` return values in apps/req.c.
|
||||
|
||||
*Nils Larsch <nla@trustcenter.de>*
|
||||
|
||||
@@ -13334,12 +13449,12 @@ ndif
|
||||
|
||||
*D P Chang <dpc@qualys.com>*
|
||||
|
||||
### Changes between 0.9.6b and 0.9.6c [21 dec 2001] ###
|
||||
### Changes between 0.9.6b and 0.9.6c [21 dec 2001]
|
||||
|
||||
* Fix BN_rand_range bug pointed out by Dominikus Scherkl
|
||||
<Dominikus.Scherkl@biodata.com>. (The previous implementation
|
||||
worked incorrectly for those cases where range = 10..._2 and
|
||||
3*range is two bits longer than range.)
|
||||
worked incorrectly for those cases where range = `10..._2` and
|
||||
`3*range` is two bits longer than range.)
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
@@ -13410,7 +13525,7 @@ ndif
|
||||
instead. BIO_gethostbyname() does not know what timeouts are
|
||||
appropriate, so entries would stay in cache even when they have
|
||||
become invalid.
|
||||
*Bodo Moeller; problem pointed out by Rich Salz <rsalz@zolera.com>
|
||||
*Bodo Moeller; problem pointed out by Rich Salz <rsalz@zolera.com>*
|
||||
|
||||
* Change ssl23_get_client_hello (ssl/s23_srvr.c) behaviour when
|
||||
faced with a pathologically small ClientHello fragment that does
|
||||
@@ -13507,7 +13622,7 @@ ndif
|
||||
|
||||
*Lutz Jaenicke*
|
||||
|
||||
* Add alert descriptions for TLSv1 to SSL_alert_desc_string[_long]().
|
||||
* Add alert descriptions for TLSv1 to `SSL_alert_desc_string[_long]()`.
|
||||
|
||||
*Lutz Jaenicke*
|
||||
|
||||
@@ -13613,7 +13728,7 @@ ndif
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
### Changes between 0.9.6a and 0.9.6b [9 Jul 2001] ###
|
||||
### Changes between 0.9.6a and 0.9.6b [9 Jul 2001]
|
||||
|
||||
* Change ssleay_rand_bytes (crypto/rand/md_rand.c)
|
||||
to avoid a SSLeay/OpenSSL PRNG weakness pointed out by
|
||||
@@ -13659,7 +13774,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Don't change *pointer in CRYPTO_add_lock() is add_lock_callback is
|
||||
* Don't change `*pointer` in CRYPTO_add_lock() is add_lock_callback is
|
||||
used: it isn't thread safe and the add_lock_callback should handle
|
||||
that itself.
|
||||
|
||||
@@ -13741,7 +13856,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.6 and 0.9.6a [5 Apr 2001] ###
|
||||
### Changes between 0.9.6 and 0.9.6a [5 Apr 2001]
|
||||
|
||||
* Fix a couple of memory leaks in PKCS7_dataDecode()
|
||||
|
||||
@@ -13779,7 +13894,7 @@ ndif
|
||||
* Check the result of RSA-CRT (see D. Boneh, R. DeMillo, R. Lipton:
|
||||
On the Importance of Eliminating Errors in Cryptographic
|
||||
Computations, J. Cryptology 14 (2001) 2, 101-119,
|
||||
http://theory.stanford.edu/~dabo/papers/faults.ps.gz).
|
||||
<http://theory.stanford.edu/~dabo/papers/faults.ps.gz>).
|
||||
|
||||
*Ulf Moeller*
|
||||
|
||||
@@ -13820,7 +13935,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Replace rdtsc with _emit statements for VC++ version 5.
|
||||
* Replace rdtsc with `_emit` statements for VC++ version 5.
|
||||
|
||||
*Jeremy Cooper <jeremy@baymoo.org>*
|
||||
|
||||
@@ -13864,7 +13979,7 @@ ndif
|
||||
|
||||
* Fix CPU detection on Irix 6.x.
|
||||
*Kurt Hockenbury <khockenb@stevens-tech.edu> and
|
||||
"Bruce W. Forsberg" <bruce.forsberg@baesystems.com>*
|
||||
"Bruce W. Forsberg" <bruce.forsberg@baesystems.com>*
|
||||
|
||||
* Fix X509_NAME bug which produced incorrect encoding if X509_NAME
|
||||
was empty.
|
||||
@@ -13887,7 +14002,7 @@ ndif
|
||||
|
||||
*Ulf Moeller, Bodo Moeller*
|
||||
|
||||
* In the NCONF_...-based implementations for CONF_... queries
|
||||
* In the `NCONF_...`-based implementations for `CONF_...` queries
|
||||
(crypto/conf/conf_lib.c), if the input LHASH is NULL, avoid using
|
||||
a temporary CONF structure with the data component set to NULL
|
||||
(which gives segmentation faults in lh_retrieve).
|
||||
@@ -13970,8 +14085,8 @@ ndif
|
||||
|
||||
*Bodo Moeller; problem reported by Eric Day <eday@concentric.net>*
|
||||
|
||||
* In RSA_eay_public_{en,ed}crypt and RSA_eay_mod_exp (rsa_eay.c),
|
||||
obtain lock CRYPTO_LOCK_RSA before setting rsa->_method_mod_{n,p,q}.
|
||||
* In `RSA_eay_public_{en,ed}crypt` and RSA_eay_mod_exp (rsa_eay.c),
|
||||
obtain lock CRYPTO_LOCK_RSA before setting `rsa->_method_mod_{n,p,q}`.
|
||||
|
||||
(RSA objects have a reference count access to which is protected
|
||||
by CRYPTO_LOCK_RSA [see rsa_lib.c, s3_srvr.c, ssl_cert.c, ssl_rsa.c],
|
||||
@@ -14083,7 +14198,7 @@ ndif
|
||||
|
||||
*Lutz Jaenicke*
|
||||
|
||||
### Changes between 0.9.5a and 0.9.6 [24 Sep 2000] ###
|
||||
### Changes between 0.9.5a and 0.9.6 [24 Sep 2000]
|
||||
|
||||
* In ssl23_get_client_hello, generate an error message when faced
|
||||
with an initial SSL 3.0/TLS record that is too small to contain the
|
||||
@@ -14203,7 +14318,7 @@ ndif
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
* Add a few more EBCDIC conditionals that make `req' and `x509'
|
||||
* Add a few more EBCDIC conditionals that make `req` and `x509`
|
||||
work better on such systems.
|
||||
|
||||
*Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>*
|
||||
@@ -14327,7 +14442,7 @@ ndif
|
||||
*Andreas Schneider <andreas@ds3.etech.fh-hamburg.de>*
|
||||
|
||||
* A demo state-machine implementation was sponsored by
|
||||
Nuron (http://www.nuron.com/) and is now available in
|
||||
Nuron (<http://www.nuron.com/>) and is now available in
|
||||
demos/state_machine.
|
||||
|
||||
*Ben Laurie*
|
||||
@@ -14383,13 +14498,12 @@ ndif
|
||||
and as before, if none of those prefixes are present at the
|
||||
beginning of the string, LOG_ERR is chosen.
|
||||
|
||||
On Win32, the LOG_* levels are mapped according to this:
|
||||
On Win32, the `LOG_*` levels are mapped according to this:
|
||||
|
||||
LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR => EVENTLOG_ERROR_TYPE
|
||||
LOG_WARNING => EVENTLOG_WARNING_TYPE
|
||||
LOG_NOTICE, LOG_INFO, LOG_DEBUG => EVENTLOG_INFORMATION_TYPE
|
||||
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* Made it possible to reconfigure with just the configuration
|
||||
@@ -14471,8 +14585,8 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* crypto/err.c locking bugfix: Use write locks (CRYPTO_w_[un]lock),
|
||||
not read locks (CRYPTO_r_[un]lock).
|
||||
* crypto/err.c locking bugfix: Use write locks (`CRYPTO_w_[un]lock`),
|
||||
not read locks (`CRYPTO_r_[un]lock`).
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
@@ -14508,7 +14622,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New ASN1 functions, i2c_* and c2i_* for INTEGER and BIT
|
||||
* New ASN1 functions, `i2c_*` and `c2i_*` for INTEGER and BIT
|
||||
STRING types. These convert content octets to and from the
|
||||
underlying type. The actual tag and length octets are
|
||||
already assumed to have been read in and checked. These
|
||||
@@ -14566,7 +14680,7 @@ ndif
|
||||
|
||||
* Reorganisation of the stack code. The macros are now all
|
||||
collected in safestack.h . Each macro is defined in terms of
|
||||
a "stack macro" of the form SKM_<name>(type, a, b). The
|
||||
a "stack macro" of the form `SKM_<name>(type, a, b)`. The
|
||||
DEBUG_SAFESTACK is now handled in terms of function casts,
|
||||
this has the advantage of retaining type safety without the
|
||||
use of additional functions. If DEBUG_SAFESTACK is not defined
|
||||
@@ -14609,7 +14723,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Increase maximum window size in BN_mod_exp_... to 6 bits instead of 5
|
||||
* Increase maximum window size in `BN_mod_exp_...` to 6 bits instead of 5
|
||||
(meaning that now 2^5 values will be precomputed, which is only 4 KB
|
||||
plus overhead for 1024 bit moduli).
|
||||
This makes exponentiations about 0.5 % faster for 1024 bit
|
||||
@@ -14649,7 +14763,7 @@ ndif
|
||||
also involved a cleanup of sorts in safestack.h to more correctly
|
||||
map type-safe stack functions onto their plain stack counterparts.
|
||||
This work has also resulted in a variety of "const"ifications of
|
||||
lots of the code, especially "_cmp" operations which should normally
|
||||
lots of the code, especially `_cmp` operations which should normally
|
||||
be prototyped with "const" parameters anyway.
|
||||
|
||||
*Geoff Thorpe*
|
||||
@@ -14712,7 +14826,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
* Call dh_tmp_cb (set by ..._TMP_DH_CB) with correct 'is_export' flag;
|
||||
* Call dh_tmp_cb (set by `..._TMP_DH_CB`) with correct 'is_export' flag;
|
||||
i.e. non-zero for export ciphersuites, zero otherwise.
|
||||
Previous versions had this flag inverted, inconsistent with
|
||||
rsa_tmp_cb (..._TMP_RSA_CB).
|
||||
@@ -14802,13 +14916,13 @@ ndif
|
||||
|
||||
* CONF library reworked to become more general. A new CONF
|
||||
configuration file reader "class" is implemented as well as a
|
||||
new functions (NCONF_*, for "New CONF") to handle it. The now
|
||||
old CONF_* functions are still there, but are reimplemented to
|
||||
new functions (`NCONF_*`, for "New CONF") to handle it. The now
|
||||
old `CONF_*` functions are still there, but are reimplemented to
|
||||
work in terms of the new functions. Also, a set of functions
|
||||
to handle the internal storage of the configuration data is
|
||||
provided to make it easier to write new configuration file
|
||||
reader "classes" (I can definitely see something reading a
|
||||
configuration file in XML format, for example), called _CONF_*,
|
||||
configuration file in XML format, for example), called `_CONF_*`,
|
||||
or "the configuration storage API"...
|
||||
|
||||
The new configuration file reading functions are:
|
||||
@@ -14823,12 +14937,12 @@ ndif
|
||||
NCONF_default and NCONF_WIN32 are method (or "class") choosers,
|
||||
NCONF_new creates a new CONF object. This works in the same way
|
||||
as other interfaces in OpenSSL, like the BIO interface.
|
||||
NCONF_dump_* dump the internal storage of the configuration file,
|
||||
`NCONF_dump_*` dump the internal storage of the configuration file,
|
||||
which is useful for debugging. All other functions take the same
|
||||
arguments as the old CONF_* functions with the exception of the
|
||||
first that must be a `CONF *' instead of a `LHASH *'.
|
||||
arguments as the old `CONF_*` functions with the exception of the
|
||||
first that must be a `CONF *` instead of a `LHASH *`.
|
||||
|
||||
To make it easier to use the new classes with the old CONF_* functions,
|
||||
To make it easier to use the new classes with the old `CONF_*` functions,
|
||||
the function CONF_set_default_method is provided.
|
||||
|
||||
*Richard Levitte*
|
||||
@@ -14846,7 +14960,7 @@ ndif
|
||||
|
||||
*Geoff Thorpe, with contributions from Richard Levitte*
|
||||
|
||||
### Changes between 0.9.5 and 0.9.5a [1 Apr 2000] ###
|
||||
### Changes between 0.9.5 and 0.9.5a [1 Apr 2000]
|
||||
|
||||
* Make sure _lrotl and _lrotr are only used with MSVC.
|
||||
|
||||
@@ -14873,7 +14987,7 @@ ndif
|
||||
|
||||
* des_quad_cksum() byte order bug fix.
|
||||
*Ulf Möller, using the problem description in krb4-0.9.7, where
|
||||
the solution is attributed to Derrick J Brashear <shadow@DEMENTIA.ORG>*
|
||||
the solution is attributed to Derrick J Brashear <shadow@DEMENTIA.ORG>*
|
||||
|
||||
* Fix so V_ASN1_APP_CHOOSE works again: however its use is strongly
|
||||
discouraged.
|
||||
@@ -15001,7 +15115,7 @@ ndif
|
||||
|
||||
*Lutz Behnke <behnke@trustcenter.de>*
|
||||
|
||||
### Changes between 0.9.4 and 0.9.5 [28 Feb 2000] ###
|
||||
### Changes between 0.9.4 and 0.9.5 [28 Feb 2000]
|
||||
|
||||
* PKCS7_encrypt() was adding text MIME headers twice because they
|
||||
were added manually and by SMIME_crlf_copy().
|
||||
@@ -15034,7 +15148,7 @@ ndif
|
||||
|
||||
* Change names of new functions to the new get1/get0 naming
|
||||
convention: After 'get1', the caller owns a reference count
|
||||
and has to call ..._free; 'get0' returns a pointer to some
|
||||
and has to call `..._free`; 'get0' returns a pointer to some
|
||||
data structure without incrementing reference counters.
|
||||
(Some of the existing 'get' functions increment a reference
|
||||
counter, some don't.)
|
||||
@@ -15050,7 +15164,7 @@ ndif
|
||||
|
||||
* Fix potential buffer overrun problem in BIO_printf().
|
||||
*Ulf Möller, using public domain code by Patrick Powell; problem
|
||||
pointed out by David Sacerdote <das33@cornell.edu>*
|
||||
pointed out by David Sacerdote <das33@cornell.edu>*
|
||||
|
||||
* Support EGD <http://www.lothar.com/tech/crypto/>. New functions
|
||||
RAND_egd() and RAND_status(). In the command line application,
|
||||
@@ -15077,23 +15191,23 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* ..._ctrl functions now have corresponding ..._callback_ctrl functions
|
||||
where the 'void *' argument is replaced by a function pointer argument.
|
||||
Previously 'void *' was abused to point to functions, which works on
|
||||
* `..._ctrl` functions now have corresponding `..._callback_ctrl` functions
|
||||
where the `void *` argument is replaced by a function pointer argument.
|
||||
Previously `void *` was abused to point to functions, which works on
|
||||
many platforms, but is not correct. As these functions are usually
|
||||
called by macros defined in OpenSSL header files, most source code
|
||||
should work without changes.
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
* <openssl/opensslconf.h> (which is created by Configure) now contains
|
||||
* `<openssl/opensslconf.h>` (which is created by Configure) now contains
|
||||
sections with information on -D... compiler switches used for
|
||||
compiling the library so that applications can see them. To enable
|
||||
one of these sections, a pre-processor symbol OPENSSL_..._DEFINES
|
||||
one of these sections, a pre-processor symbol `OPENSSL_..._DEFINES`
|
||||
must be defined. E.g.,
|
||||
#define OPENSSL_ALGORITHM_DEFINES
|
||||
#include <openssl/opensslconf.h>
|
||||
defines all pertinent NO_<algo> symbols, such as NO_IDEA, NO_RSA, etc.
|
||||
defines all pertinent `NO_<algo>` symbols, such as NO_IDEA, NO_RSA, etc.
|
||||
|
||||
*Richard Levitte, Ulf and Bodo Möller*
|
||||
|
||||
@@ -15168,7 +15282,7 @@ ndif
|
||||
*Andy Polyakov*
|
||||
|
||||
* Bug fix for BN_div() when the first words of num and divisor are
|
||||
equal (it gave wrong results if (rem=(n1-q*d0)&BN_MASK2) < d0).
|
||||
equal (it gave wrong results if `(rem=(n1-q*d0)&BN_MASK2) < d0)`.
|
||||
|
||||
*Ulf Möller*
|
||||
|
||||
@@ -15187,7 +15301,7 @@ ndif
|
||||
|
||||
*Ulf Möller*
|
||||
|
||||
* Change the SSLeay_add_all_*() functions to OpenSSL_add_all_*() and
|
||||
* Change the `SSLeay_add_all_*()` functions to `OpenSSL_add_all_*()` and
|
||||
include a #define from the old name to the new. The original intent
|
||||
was that statically linked binaries could for example just call
|
||||
SSLeay_add_all_ciphers() to just add ciphers to the table and not
|
||||
@@ -15212,7 +15326,7 @@ ndif
|
||||
*Martin Kraemer <Martin.Kraemer@Mch.SNI.De>*
|
||||
|
||||
* Source code cleanups: use const where appropriate, eliminate casts,
|
||||
use void * instead of char * in lhash.
|
||||
use `void *` instead of `char *` in lhash.
|
||||
|
||||
*Ulf Möller*
|
||||
|
||||
@@ -15287,7 +15401,7 @@ ndif
|
||||
*Ulf Möller, Bodo Möller*
|
||||
|
||||
* Clean up CRYPTO_EX_DATA functions, some of these didn't have prototypes
|
||||
used (char *) instead of (void *) and had casts all over the place.
|
||||
used `char *` instead of `void *` and had casts all over the place.
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
@@ -15352,7 +15466,7 @@ ndif
|
||||
*Steve Henson*
|
||||
|
||||
* Changes to X509_ATTRIBUTE utilities. These have been renamed from
|
||||
X509_*() to X509at_*() on the grounds that they don't handle X509
|
||||
`X509_*()` to `X509at_*()` on the grounds that they don't handle X509
|
||||
structures and behave in an analogous way to the X509v3 functions:
|
||||
they shouldn't be called directly but wrapper functions should be used
|
||||
instead.
|
||||
@@ -15367,7 +15481,7 @@ ndif
|
||||
|
||||
* Add missing #ifndefs that caused missing symbols when building libssl
|
||||
as a shared library without RSA. Use #ifndef NO_SSL2 instead of
|
||||
NO_RSA in ssl/s2*.c.
|
||||
NO_RSA in `ssl/s2*.c`.
|
||||
|
||||
*Kris Kennaway <kris@hub.freebsd.org>, modified by Ulf Möller*
|
||||
|
||||
@@ -15680,8 +15794,8 @@ ndif
|
||||
There are two big advantages in doing things this way. The extensions
|
||||
can be looked up immediately and no longer need to be "added" using
|
||||
X509V3_add_standard_extensions(): this function now does nothing.
|
||||
*Side note: I get *lots* of email saying the extension code doesn't
|
||||
work because people forget to call this function*
|
||||
Side note: I get *lots* of email saying the extension code doesn't
|
||||
work because people forget to call this function.
|
||||
Also no dynamic allocation is done unless new extensions are added:
|
||||
so if we don't add custom extensions there is no need to call
|
||||
X509V3_EXT_cleanup().
|
||||
@@ -15761,10 +15875,10 @@ ndif
|
||||
it clearly returns an error if you try to read the wrong kind of key.
|
||||
|
||||
Added a -pubkey option to the 'x509' utility to output the public key.
|
||||
Also rename the EVP_PKEY_get_*() to EVP_PKEY_rget_*()
|
||||
(renamed to EVP_PKEY_get1_*() in the OpenSSL 0.9.5 release) and add
|
||||
EVP_PKEY_rset_*() functions (renamed to EVP_PKEY_set1_*())
|
||||
that do the same as the EVP_PKEY_assign_*() except they up the
|
||||
Also rename the `EVP_PKEY_get_*()` to `EVP_PKEY_rget_*()`
|
||||
(renamed to `EVP_PKEY_get1_*()` in the OpenSSL 0.9.5 release) and add
|
||||
`EVP_PKEY_rset_*()` functions (renamed to `EVP_PKEY_set1_*()`)
|
||||
that do the same as the `EVP_PKEY_assign_*()` except they up the
|
||||
reference count of the added key (they don't "swallow" the
|
||||
supplied key).
|
||||
|
||||
@@ -15899,7 +16013,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Fix assembler for Alpha (tested only on DEC OSF not Linux or *BSD).
|
||||
* Fix assembler for Alpha (tested only on DEC OSF not Linux or `*BSD`).
|
||||
The problem was that one of the replacement routines had not been working
|
||||
since SSLeay releases. For now the offending routine has been replaced
|
||||
with non-optimised assembler. Even so, this now gives around 95%
|
||||
@@ -15990,8 +16104,8 @@ ndif
|
||||
*Steve Henson*
|
||||
|
||||
* Add function equivalents to the various macros in asn1.h. The old
|
||||
macros are retained with an M_ prefix. Code inside the library can
|
||||
use the M_ macros. External code (including the openssl utility)
|
||||
macros are retained with an `M_` prefix. Code inside the library can
|
||||
use the `M_` macros. External code (including the openssl utility)
|
||||
should *NOT* in order to be "shared library friendly".
|
||||
|
||||
*Steve Henson*
|
||||
@@ -16010,7 +16124,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* New X509V3_{X509,CRL,REVOKED}_get_d2i() functions. These will search
|
||||
* New `X509V3_{X509,CRL,REVOKED}_get_d2i()` functions. These will search
|
||||
for, obtain and decode and extension and obtain its critical flag.
|
||||
This allows all the necessary extension code to be handled in a
|
||||
single function call.
|
||||
@@ -16072,7 +16186,7 @@ ndif
|
||||
usual with these problems it takes *ages* to find and the fix is
|
||||
trivial: move one line.
|
||||
|
||||
*Steve Henson, reported by ian@uns.ns.ac.yu (Ivan Nejgebauer) *
|
||||
*Steve Henson, reported by ian@uns.ns.ac.yu (Ivan Nejgebauer)*
|
||||
|
||||
* Ugly workaround to get s_client and s_server working under Windows. The
|
||||
old code wouldn't work because it needed to select() on sockets and the
|
||||
@@ -16249,13 +16363,13 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
### Changes between 0.9.3a and 0.9.4 [09 Aug 1999] ###
|
||||
### Changes between 0.9.3a and 0.9.4 [09 Aug 1999]
|
||||
|
||||
* Install libRSAglue.a when OpenSSL is built with RSAref.
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
* A few more ``#ifndef NO_FP_API / #endif'' pairs for consistency.
|
||||
* A few more `#ifndef NO_FP_API / #endif` pairs for consistency.
|
||||
|
||||
*Andrija Antonijevic <TheAntony2@bigfoot.com>*
|
||||
|
||||
@@ -16270,7 +16384,7 @@ ndif
|
||||
|
||||
For 1024-bit p, DSA_generate_parameters followed by DSA_dup_DH is
|
||||
much faster than DH_generate_parameters (which creates parameters
|
||||
where p = 2*q + 1), and also the smaller q makes DH computations
|
||||
where `p = 2*q + 1`), and also the smaller q makes DH computations
|
||||
much more efficient (160-bit exponentiation instead of 1024-bit
|
||||
exponentiation); so this provides a convenient way to support DHE
|
||||
ciphersuites in SSL/TLS servers (see ssl/ssltest.c). It is of
|
||||
@@ -16318,7 +16432,7 @@ ndif
|
||||
to
|
||||
....(char *buf, int size, int rwflag, void *userdata);
|
||||
so that applications can pass data to their callbacks:
|
||||
The PEM[_ASN1]_{read,write}... functions and macros now take an
|
||||
The `PEM[_ASN1]_{read,write}...` functions and macros now take an
|
||||
additional void * argument, which is just handed through whenever
|
||||
the password callback is called.
|
||||
|
||||
@@ -16375,7 +16489,7 @@ ndif
|
||||
1. Casts to avoid "loss of data" warnings in p5_crpt2.c
|
||||
2. Change unsigned int to int in b_dump.c to avoid "signed/unsigned
|
||||
comparison" warnings.
|
||||
3. Add sk_<TYPE>_sort to DEF file generator and do make update.
|
||||
3. Add `sk_<TYPE>_sort` to DEF file generator and do make update.
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
@@ -16468,8 +16582,7 @@ ndif
|
||||
store the length when it is first determined and use it later, rather
|
||||
than trying to keep track of where data is copied and updating it to
|
||||
point to the end.
|
||||
*Steve Henson, reported by Brien Wheeler
|
||||
<bwheeler@authentica-security.com>*
|
||||
*Steve Henson, reported by Brien Wheeler <bwheeler@authentica-security.com>*
|
||||
|
||||
* Add a new function PKCS7_signatureVerify. This allows the verification
|
||||
of a PKCS#7 signature but with the signing certificate passed to the
|
||||
@@ -16480,7 +16593,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Complete the PEM_* macros with DECLARE_PEM versions to replace the
|
||||
* Complete the `PEM_*` macros with DECLARE_PEM versions to replace the
|
||||
function prototypes in pem.h, also change util/mkdef.pl to add the
|
||||
necessary function names.
|
||||
|
||||
@@ -16538,7 +16651,7 @@ ndif
|
||||
*Steve Henson*
|
||||
|
||||
* Fix determination of Perl interpreter: A perl or perl5
|
||||
_directory_ in $PATH was also accepted as the interpreter.
|
||||
*directory* in $PATH was also accepted as the interpreter.
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
@@ -16567,7 +16680,6 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
f 0
|
||||
* DES CBC did not update the IV. Weird.
|
||||
|
||||
*Ben Laurie*
|
||||
@@ -16648,7 +16760,7 @@ ndif
|
||||
|
||||
*Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>*
|
||||
|
||||
* Make callbacks for key generation use void * instead of char *.
|
||||
* Make callbacks for key generation use `void *` instead of `char *`.
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
@@ -16664,8 +16776,7 @@ ndif
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
|
||||
### Changes between 0.9.3 and 0.9.3a [29 May 1999] ###
|
||||
### Changes between 0.9.3 and 0.9.3a [29 May 1999]
|
||||
|
||||
* New configuration variant "sco5-gcc".
|
||||
|
||||
@@ -16698,8 +16809,7 @@ ndif
|
||||
|
||||
*Richard Levitte*
|
||||
|
||||
|
||||
### Changes between 0.9.2b and 0.9.3 [24 May 1999] ###
|
||||
### Changes between 0.9.2b and 0.9.3 [24 May 1999]
|
||||
|
||||
* Bignum library bug fix. IRIX 6 passes "make test" now!
|
||||
This also avoids the problems with SC4.2 and unpatched SC5.
|
||||
@@ -16766,8 +16876,8 @@ ndif
|
||||
*Steve Henson*
|
||||
|
||||
* Make SSL library a little more fool-proof by not requiring any longer
|
||||
that SSL_set_{accept,connect}_state be called before
|
||||
SSL_{accept,connect} may be used (SSL_set_..._state is omitted
|
||||
that `SSL_set_{accept,connect}_state` be called before
|
||||
`SSL_{accept,connect}` may be used (`SSL_set_..._state` is omitted
|
||||
in many applications because usually everything *appeared* to work as
|
||||
intended anyway -- now it really works as intended).
|
||||
|
||||
@@ -16777,9 +16887,9 @@ ndif
|
||||
|
||||
*Ulf Möller*
|
||||
|
||||
* Fix various things to let OpenSSL even pass ``egcc -pipe -O2 -Wall
|
||||
* Fix various things to let OpenSSL even pass "egcc -pipe -O2 -Wall
|
||||
-Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes
|
||||
-Wmissing-declarations -Wnested-externs -Winline'' with EGCS 1.1.2+
|
||||
-Wmissing-declarations -Wnested-externs -Winline" with EGCS 1.1.2+
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
@@ -16791,7 +16901,7 @@ ndif
|
||||
* Create a duplicate of the SSL_CTX's CERT in SSL_new instead of
|
||||
copying pointers. The cert_st handling is changed by this in
|
||||
various ways (and thus what used to be known as ctx->default_cert
|
||||
is now called ctx->cert, since we don't resort to s->ctx->[default_]cert
|
||||
is now called ctx->cert, since we don't resort to `s->ctx->[default_]cert`
|
||||
any longer when s->cert does not give us what we need).
|
||||
ssl_cert_instantiate becomes obsolete by this change.
|
||||
As soon as we've got the new code right (possibly it already is?),
|
||||
@@ -16800,7 +16910,7 @@ ndif
|
||||
|
||||
Note that using the SSL API in certain dirty ways now will result
|
||||
in different behaviour than observed with earlier library versions:
|
||||
Changing settings for an SSL_CTX *ctx after having done s = SSL_new(ctx)
|
||||
Changing settings for an `SSL_CTX *ctx` after having done s = SSL_new(ctx)
|
||||
does not influence s as it used to.
|
||||
|
||||
In order to clean up things more thoroughly, inside SSL_SESSION
|
||||
@@ -16862,7 +16972,7 @@ ndif
|
||||
|
||||
*Anonymous*
|
||||
|
||||
* Add missing sk_<type>_unshift() function to safestack.h
|
||||
* Add missing `sk_<type>_unshift()` function to safestack.h
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
@@ -16922,7 +17032,7 @@ ndif
|
||||
|
||||
*Niels Poppe <niels@netbox.org>*
|
||||
|
||||
* New Configure option no-<cipher> (rsa, idea, rc5, ...).
|
||||
* New Configure option `no-<cipher>` (rsa, idea, rc5, ...).
|
||||
|
||||
*Ulf Möller*
|
||||
|
||||
@@ -16957,7 +17067,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Change #include filenames from <foo.h> to <openssl/foo.h>.
|
||||
* Change #include filenames from `<foo.h>` to `<openssl/foo.h>`.
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
@@ -17077,16 +17187,16 @@ ndif
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
* Add `openssl ca -revoke <certfile>' facility which revokes a certificate
|
||||
specified in <certfile> by updating the entry in the index.txt file.
|
||||
* Add `openssl ca -revoke <certfile>` facility which revokes a certificate
|
||||
specified in `<certfile>` by updating the entry in the index.txt file.
|
||||
This way one no longer has to edit the index.txt file manually for
|
||||
revoking a certificate. The -revoke option does the gory details now.
|
||||
|
||||
*Massimiliano Pala <madwolf@openca.org>, Ralf S. Engelschall*
|
||||
|
||||
* Fix `openssl crl -noout -text' combination where `-noout' killed the
|
||||
`-text' option at all and this way the `-noout -text' combination was
|
||||
inconsistent in `openssl crl' with the friends in `openssl x509|rsa|dsa'.
|
||||
* Fix `openssl crl -noout -text` combination where `-noout` killed the
|
||||
`-text` option at all and this way the `-noout -text` combination was
|
||||
inconsistent in `openssl crl` with the friends in `openssl x509|rsa|dsa`.
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
@@ -17096,12 +17206,12 @@ ndif
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
|
||||
* Bugfix: In test/testenc, don't test "openssl <cipher>" for
|
||||
* Bugfix: In test/testenc, don't test `openssl <cipher>` for
|
||||
ciphers that were excluded, e.g. by -DNO_IDEA. Also, test
|
||||
all available ciphers including rc5, which was forgotten until now.
|
||||
In order to let the testing shell script know which algorithms
|
||||
are available, a new (up to now undocumented) command
|
||||
"openssl list-cipher-commands" is used.
|
||||
`openssl list-cipher-commands` is used.
|
||||
|
||||
*Bodo Moeller*
|
||||
|
||||
@@ -17190,8 +17300,7 @@ ndif
|
||||
|
||||
*Soren S. Jorvang <soren@t.dk>*
|
||||
|
||||
|
||||
### Changes between 0.9.1c and 0.9.2b [22 Mar 1999] ###
|
||||
### Changes between 0.9.1c and 0.9.2b [22 Mar 1999]
|
||||
|
||||
* Make SSL_get_peer_cert_chain() work in servers. Unfortunately, it still
|
||||
doesn't work when the session is reused. Coming soon!
|
||||
@@ -17321,13 +17430,14 @@ ndif
|
||||
|
||||
* Add a useful kludge to allow package maintainers to specify compiler and
|
||||
other platforms details on the command line without having to patch the
|
||||
Configure script every time: One now can use ``perl Configure
|
||||
<id>:<details>'', i.e. platform ids are allowed to have details appended
|
||||
Configure script every time: One now can use
|
||||
`perl Configure <id>:<details>`,
|
||||
i.e. platform ids are allowed to have details appended
|
||||
to them (separated by colons). This is treated as there would be a static
|
||||
pre-configured entry in Configure's %table under key <id> with value
|
||||
<details> and ``perl Configure <id>'' is called. So, when you want to
|
||||
pre-configured entry in Configure's %table under key `<id>` with value
|
||||
`<details>` and `perl Configure <id>` is called. So, when you want to
|
||||
perform a quick test-compile under FreeBSD 3.1 with pgcc and without
|
||||
assembler stuff you can use ``perl Configure "FreeBSD-elf:pgcc:-O6:::"''
|
||||
assembler stuff you can use `perl Configure "FreeBSD-elf:pgcc:-O6:::"`
|
||||
now, which overrides the FreeBSD-elf entry on-the-fly.
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
@@ -17388,7 +17498,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Added the new `Includes OpenSSL Cryptography Software' button as
|
||||
* Added the new 'Includes OpenSSL Cryptography Software' button as
|
||||
doc/openssl_button.{gif,html} which is similar in style to the old SSLeay
|
||||
button and can be used by applications based on OpenSSL to show the
|
||||
relationship to the OpenSSL project.
|
||||
@@ -17424,7 +17534,7 @@ ndif
|
||||
|
||||
* Experiment with doxygen documentation. Currently only partially applied to
|
||||
ssl/ssl_lib.c.
|
||||
See http://www.stack.nl/~dimitri/doxygen/index.html, and run doxygen with
|
||||
See <http://www.stack.nl/~dimitri/doxygen/index.html>, and run doxygen with
|
||||
openssl.doxy as the configuration file.
|
||||
|
||||
*Ben Laurie*
|
||||
@@ -17470,13 +17580,13 @@ ndif
|
||||
|
||||
*Richard Levitte <levitte@stacken.kth.se>*
|
||||
|
||||
* Fix 'port' variable from `int' to `unsigned int' in crypto/bio/b_sock.c
|
||||
* Fix `port` variable from `int` to `unsigned int` in crypto/bio/b_sock.c
|
||||
|
||||
*Richard Levitte <levitte@stacken.kth.se>*
|
||||
|
||||
* Change type of another md_len variable in pk7_doit.c:PKCS7_dataFinal()
|
||||
from `int' to `unsigned int' because it's a length and initialized by
|
||||
EVP_DigestFinal() which expects an `unsigned int *'.
|
||||
from `int` to `unsigned int` because it is a length and initialized by
|
||||
EVP_DigestFinal() which expects an `unsigned int *`.
|
||||
|
||||
*Richard Levitte <levitte@stacken.kth.se>*
|
||||
|
||||
@@ -17548,7 +17658,7 @@ ndif
|
||||
foundations than the ad-hoc padding used in PKCS #1 v1.5. It is secure
|
||||
against Bleichbacher's attack on RSA.
|
||||
*Ulf Moeller <ulf@fitug.de>, reformatted, corrected and integrated by
|
||||
Ben Laurie*
|
||||
Ben Laurie*
|
||||
|
||||
* Updates to the new SSL compression code
|
||||
|
||||
@@ -17628,7 +17738,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Overhauled the Perl interface (perl/*):
|
||||
* Overhauled the Perl interface:
|
||||
- ported BN stuff to OpenSSL's different BN library
|
||||
- made the perl/ source tree CVS-aware
|
||||
- renamed the package from SSLeay to OpenSSL (the files still contain
|
||||
@@ -17667,7 +17777,7 @@ ndif
|
||||
|
||||
*Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)*
|
||||
|
||||
* Make sure `make rehash' target really finds the `openssl' program.
|
||||
* Make sure `make rehash` target really finds the `openssl` program.
|
||||
|
||||
*Ralf S. Engelschall, Matthias Loepfe <Matthias.Loepfe@adnovum.ch>*
|
||||
|
||||
@@ -17680,7 +17790,7 @@ ndif
|
||||
|
||||
*Alan Batie <batie@aahz.jf.intel.com>*
|
||||
|
||||
* Fixed ms/32all.bat script: `no_asm' -> `no-asm'
|
||||
* Fixed ms/32all.bat script: `no_asm` -> `no-asm`
|
||||
|
||||
*Rainer W. Gerling <gerling@mpg-gv.mpg.de>*
|
||||
|
||||
@@ -17833,7 +17943,7 @@ ndif
|
||||
|
||||
*Steve Henson*
|
||||
|
||||
* Make _all_ *_free functions accept a NULL pointer.
|
||||
* Make *all* `*_free` functions accept a NULL pointer.
|
||||
|
||||
*Frans Heymans <fheymans@isaserver.be>*
|
||||
|
||||
@@ -17896,10 +18006,10 @@ ndif
|
||||
|
||||
*Steve Henson and Ben Laurie*
|
||||
|
||||
* First cut of a cleanup for apps/. First the `ssleay' program is now named
|
||||
`openssl' and second, the shortcut symlinks for the `openssl <command>'
|
||||
* First cut of a cleanup for apps/. First the `ssleay` program is now named
|
||||
`openssl` and second, the shortcut symlinks for the `openssl <command>`
|
||||
are no longer created. This way we have a single and consistent command
|
||||
line interface `openssl <command>', similar to `cvs <command>'.
|
||||
line interface `openssl <command>`, similar to `cvs <command>`.
|
||||
|
||||
*Ralf S. Engelschall, Paul Sutton and Ben Laurie*
|
||||
|
||||
@@ -17992,8 +18102,7 @@ ndif
|
||||
|
||||
*Ben Laurie*
|
||||
|
||||
|
||||
### Changes between 0.9.1b and 0.9.1c [23-Dec-1998] ###
|
||||
### Changes between 0.9.1b and 0.9.1c [23-Dec-1998]
|
||||
|
||||
* Added OPENSSL_VERSION_NUMBER to crypto/crypto.h and
|
||||
changed SSLeay to OpenSSL in version strings.
|
||||
@@ -18014,7 +18123,7 @@ ndif
|
||||
|
||||
*Andrew Cooke / Interrader Ldt., Ralf S. Engelschall*
|
||||
|
||||
* Fixed nasty rehash problem under `make -f Makefile.ssl links'
|
||||
* Fixed nasty rehash problem under `make -f Makefile.ssl links`
|
||||
when "ssleay" is still not found.
|
||||
|
||||
*Ralf S. Engelschall*
|
||||
@@ -18066,8 +18175,7 @@ ndif
|
||||
|
||||
*The OpenSSL Project*
|
||||
|
||||
|
||||
### Changes between 0.9.0b and 0.9.1b [not released] ###
|
||||
### Changes between 0.9.0b and 0.9.1b [not released]
|
||||
|
||||
* Updated a few CA certificates under certs/
|
||||
|
||||
@@ -18198,7 +18306,6 @@ ndif
|
||||
|
||||
*Edward Bishop <ebishop@spyglass.com>*
|
||||
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[CVE-2019-1563]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1563
|
||||
|
||||
+11
-7
@@ -5,7 +5,6 @@ Please visit our [Getting Started][gs] page for other ideas about how to contrib
|
||||
|
||||
[gs]: https://www.openssl.org/community/getting-started.html
|
||||
|
||||
|
||||
Development is done on GitHub in the [openssl/openssl][gh] repository.
|
||||
|
||||
[gh]: https://github.com/openssl/openssl
|
||||
@@ -30,14 +29,17 @@ guidelines:
|
||||
[CLA]: https://www.openssl.org/policies/cla.html
|
||||
|
||||
To amend a missing "`CLA: trivial`" line after submission, do the following:
|
||||
|
||||
```
|
||||
git commit --amend
|
||||
[add the line, save and quit the editor]
|
||||
git push -f
|
||||
```
|
||||
|
||||
2. All source files should start with the following text (with
|
||||
appropriate comment characters at the start of each line and the
|
||||
year(s) updated):
|
||||
|
||||
```
|
||||
Copyright 20xx-20yy The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
@@ -70,18 +72,20 @@ guidelines:
|
||||
documentation changes are clean.
|
||||
|
||||
7. For user visible changes (API changes, behaviour changes, ...),
|
||||
consider adding a note in [CHANGES](CHANGES). This could be a summarising
|
||||
description of the change, and could explain the grander details.
|
||||
consider adding a note in [CHANGES.md](CHANGES.md).
|
||||
This could be a summarising description of the change, and could
|
||||
explain the grander details.
|
||||
Have a look through existing entries for inspiration.
|
||||
Please note that this is NOT simply a copy of git-log one-liners.
|
||||
Also note that security fixes get an entry in CHANGES.
|
||||
Also note that security fixes get an entry in CHANGES.md.
|
||||
This file helps users get more in depth information of what comes
|
||||
with a specific release without having to sift through the higher
|
||||
noise ratio in git-log.
|
||||
|
||||
8. For larger or more important user visible changes, as well as
|
||||
security fixes, please add a line in [NEWS](NEWS). On exception, it might be
|
||||
worth adding a multi-line entry (such as the entry that announces all
|
||||
the types that became opaque with OpenSSL 1.1.0).
|
||||
security fixes, please add a line in [NEWS.md](NEWS.md).
|
||||
On exception, it might be worth adding a multi-line entry (such as
|
||||
the entry that announces all the types that became opaque with
|
||||
OpenSSL 1.1.0).
|
||||
This file helps users get a very quick summary of what comes with a
|
||||
specific release, to see if an upgrade is worth the effort.
|
||||
@@ -10,7 +10,7 @@ my %targets=(
|
||||
includes => [],
|
||||
lib_cflags => "",
|
||||
lib_cppflags => "",
|
||||
lib_defines => [ 'OPENSSL_BUILDING_OPENSSL' ],
|
||||
lib_defines => [],
|
||||
thread_scheme => "(unknown)", # Assume we don't know
|
||||
thread_defines => [],
|
||||
|
||||
@@ -47,7 +47,7 @@ my %targets=(
|
||||
|
||||
defines =>
|
||||
sub {
|
||||
my @defs = ();
|
||||
my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
|
||||
push @defs, "ZLIB" unless $disabled{zlib};
|
||||
push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
|
||||
return [ @defs ];
|
||||
|
||||
@@ -790,7 +790,7 @@ my %targets = (
|
||||
inherit_from => [ "linux-generic32" ],
|
||||
cflags => add("-mabi=n32"),
|
||||
cxxflags => add("-mabi=n32"),
|
||||
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
|
||||
bn_ops => "RC4_CHAR",
|
||||
asm_arch => 'mips64',
|
||||
perlasm_scheme => "n32",
|
||||
multilib => "32",
|
||||
@@ -1004,7 +1004,6 @@ my %targets = (
|
||||
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
|
||||
lib_cppflags => add("-DL_ENDIAN"),
|
||||
bn_ops => "BN_LLONG",
|
||||
shared_target => "bsd-shared",
|
||||
asm_arch => 'x86',
|
||||
perlasm_scheme => "a.out",
|
||||
},
|
||||
|
||||
@@ -24,17 +24,17 @@
|
||||
|
||||
my $ndk_var;
|
||||
my $ndk;
|
||||
foreach (qw(ANDROID_NDK_HOME ANDROID_NDK)) {
|
||||
foreach (qw(ANDROID_NDK_ROOT ANDROID_NDK)) {
|
||||
$ndk_var = $_;
|
||||
$ndk = $ENV{$ndk_var};
|
||||
last if defined $ndk;
|
||||
}
|
||||
die "\$ANDROID_NDK_HOME is not defined" if (!$ndk);
|
||||
die "\$ANDROID_NDK_ROOT is not defined" if (!$ndk);
|
||||
if (!-d "$ndk/platforms" && !-f "$ndk/AndroidVersion.txt") {
|
||||
# $ndk/platforms is traditional "all-inclusive" NDK, while
|
||||
# $ndk/AndroidVersion.txt is so-called standalone toolchain
|
||||
# tailored for specific target down to API level.
|
||||
die "\$ANDROID_NDK_HOME=$ndk is invalid";
|
||||
die "\$ANDROID_NDK_ROOT=$ndk is invalid";
|
||||
}
|
||||
$ndk = canonpath($ndk);
|
||||
|
||||
@@ -168,7 +168,8 @@ my %targets = (
|
||||
cppflags => add(sub { android_ndk()->{cppflags} }),
|
||||
cxxflags => add(sub { android_ndk()->{cflags} }),
|
||||
bn_ops => sub { android_ndk()->{bn_ops} },
|
||||
bin_cflags => "-pie",
|
||||
bin_cflags => "-fPIE",
|
||||
bin_lflags => "-pie",
|
||||
enable => [ ],
|
||||
},
|
||||
"android-arm" => {
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}};
|
||||
our @install_modules =
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}};
|
||||
our @install_programs =
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}};
|
||||
@@ -132,6 +136,7 @@ GENERATED={- # common0.tmpl provides @generated
|
||||
INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
|
||||
INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
|
||||
INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
|
||||
INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
|
||||
INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
|
||||
BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
|
||||
MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
|
||||
@@ -521,11 +526,11 @@ descrip.mms : FORCE
|
||||
|
||||
# Install helper targets #############################################
|
||||
|
||||
install_sw : install_dev install_engines install_runtime -
|
||||
install_startup install_ivp
|
||||
install_sw : install_dev install_engines install_modules -
|
||||
install_runtime install_startup install_ivp
|
||||
|
||||
uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime -
|
||||
uninstall_startup uninstall_ivp
|
||||
uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
|
||||
uninstall_runtime uninstall_startup uninstall_ivp
|
||||
|
||||
install_docs : install_html_docs
|
||||
|
||||
@@ -566,13 +571,22 @@ install_dev : check_INSTALLTOP install_runtime_libs
|
||||
|
||||
install_engines : check_INSTALLTOP install_runtime_libs build_modules
|
||||
@ {- output_off() unless scalar @install_engines; "" -} !
|
||||
@ WRITE SYS$OUTPUT "*** Installing ENGINE modules"
|
||||
@ WRITE SYS$OUTPUT "*** Installing engines"
|
||||
- CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
|
||||
{- join("\n ",
|
||||
map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
|
||||
@install_engines) -}
|
||||
@ {- output_on() unless scalar @install_engines; "" -} !
|
||||
|
||||
install_modules : check_INSTALLTOP install_runtime_libs build_modules
|
||||
@ {- output_off() unless scalar @install_modules; "" -} !
|
||||
@ WRITE SYS$OUTPUT "*** Installing modules"
|
||||
- CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
|
||||
{- join("\n ",
|
||||
map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
|
||||
@install_modules) -}
|
||||
@ {- output_on() unless scalar @install_modules; "" -} !
|
||||
|
||||
install_runtime : install_programs
|
||||
|
||||
install_runtime_libs : check_INSTALLTOP build_libs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /usr/bin/env perl
|
||||
# -*- mode: perl; -*-
|
||||
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2016-2020 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
|
||||
@@ -36,16 +36,10 @@ my %shared_info;
|
||||
(grep /(?:^|\s)-fsanitize/,
|
||||
@{$config{CFLAGS}}, @{$config{cflags}})
|
||||
? ''
|
||||
: '-z defs',
|
||||
: '-Wl,-z,defs',
|
||||
};
|
||||
},
|
||||
'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
|
||||
'bsd-shared' => sub {
|
||||
return $shared_info{'gnu-shared'} if detect_gnu_ld();
|
||||
return {
|
||||
shared_ldflag => '-shared -nostdlib',
|
||||
};
|
||||
},
|
||||
'darwin-shared' => {
|
||||
module_ldflags => '-bundle',
|
||||
shared_ldflag => '-dynamiclib -current_version $(SHLIB_VERSION_NUMBER) -compatibility_version $(SHLIB_VERSION_NUMBER)',
|
||||
|
||||
@@ -138,6 +138,14 @@ INSTALL_ENGINES={-
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}}))
|
||||
-}
|
||||
INSTALL_MODULES={-
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16,
|
||||
map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}}))
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
|
||||
@@ -511,7 +519,7 @@ clean: libclean
|
||||
-$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
|
||||
-$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print`
|
||||
$(RM) core
|
||||
$(RM) tags TAGS doc-nits cmd-nits
|
||||
$(RM) tags TAGS doc-nits cmd-nits md-nits
|
||||
$(RM) -r test/test-runs
|
||||
$(RM) openssl.pc libcrypto.pc libssl.pc
|
||||
-$(RM) `find . -type l \! -name '.*' -print`
|
||||
@@ -532,9 +540,9 @@ depend:
|
||||
|
||||
# Install helper targets #############################################
|
||||
|
||||
install_sw: install_dev install_engines install_runtime
|
||||
install_sw: install_dev install_engines install_modules install_runtime
|
||||
|
||||
uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
|
||||
uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
|
||||
|
||||
install_docs: install_man_docs install_html_docs
|
||||
|
||||
@@ -702,10 +710,12 @@ uninstall_dev: uninstall_runtime_libs
|
||||
-$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
|
||||
-$(RMDIR) $(DESTDIR)$(libdir)
|
||||
|
||||
install_engines: install_runtime_libs build_modules
|
||||
_install_modules_deps: install_runtime_libs build_modules
|
||||
|
||||
install_engines: _install_modules_deps
|
||||
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
|
||||
@$(ECHO) "*** Installing ENGINE modules"
|
||||
@$(ECHO) "*** Installing engines"
|
||||
@set -e; for e in dummy $(INSTALL_ENGINES); do \
|
||||
if [ "$$e" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$e`; \
|
||||
@@ -717,7 +727,7 @@ install_engines: install_runtime_libs build_modules
|
||||
done
|
||||
|
||||
uninstall_engines:
|
||||
@$(ECHO) "*** Uninstalling ENGINE modules"
|
||||
@$(ECHO) "*** Uninstalling engines"
|
||||
@set -e; for e in dummy $(INSTALL_ENGINES); do \
|
||||
if [ "$$e" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$e`; \
|
||||
@@ -729,6 +739,33 @@ uninstall_engines:
|
||||
done
|
||||
-$(RMDIR) $(DESTDIR)$(ENGINESDIR)
|
||||
|
||||
install_modules: _install_modules_deps
|
||||
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
|
||||
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
|
||||
@$(ECHO) "*** Installing modules"
|
||||
@set -e; for e in dummy $(INSTALL_MODULES); do \
|
||||
if [ "$$e" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$e`; \
|
||||
$(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
|
||||
cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \
|
||||
chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \
|
||||
mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \
|
||||
$(DESTDIR)$(MODULESDIR)/$$fn; \
|
||||
done
|
||||
|
||||
uninstall_modules:
|
||||
@$(ECHO) "*** Uninstalling modules"
|
||||
@set -e; for e in dummy $(INSTALL_MODULES); do \
|
||||
if [ "$$e" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$e`; \
|
||||
if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
|
||||
done
|
||||
-$(RMDIR) $(DESTDIR)$(MODULESDIR)
|
||||
|
||||
install_runtime: install_programs
|
||||
|
||||
install_runtime_libs: build_libs
|
||||
@@ -822,30 +859,30 @@ install_man_docs: build_man_docs
|
||||
@set -e; for x in dummy $(MANDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$$fn"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
|
||||
cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
|
||||
chmod 755 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
|
||||
uninstall_man_docs:
|
||||
@@ -853,26 +890,26 @@ uninstall_man_docs:
|
||||
@set -e; for x in dummy $(MANDOCS1); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS3); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS5); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
@set -e; for x in dummy $(MANDOCS7); do \
|
||||
if [ "$$x" = "dummy" ]; then continue; fi; \
|
||||
fn=`basename $$x`; \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
|
||||
$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
|
||||
$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
|
||||
done
|
||||
|
||||
install_html_docs: build_html_docs
|
||||
@@ -945,13 +982,22 @@ update: generate errors ordinals
|
||||
generate: generate_apps generate_crypto_bn generate_crypto_objects \
|
||||
generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
|
||||
|
||||
.PHONY: doc-nits cmd-nits
|
||||
.PHONY: doc-nits cmd-nits md-nits
|
||||
doc-nits: build_generated
|
||||
$(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
|
||||
|
||||
cmd-nits: build_generated apps/openssl
|
||||
$(PERL) $(SRCDIR)/util/find-doc-nits -c
|
||||
|
||||
# This uses "mdl", the markdownlint application, which is written in ruby.
|
||||
# The source is at https://github.com/markdownlint/markdownlint
|
||||
# If you have ruby installed, "gem install mdl" should work.
|
||||
# Another option is at https://snapcraft.io/install/mdl/debian
|
||||
# Finally, there's a Node.js version, which we haven't tried, that
|
||||
# can be found at https://github.com/DavidAnson/markdownlint
|
||||
md-nits:
|
||||
mdl -s util/markdownlint.rb .
|
||||
|
||||
# Test coverage is a good idea for the future
|
||||
#coverage: $(PROGRAMS) $(TESTPROGRAMS)
|
||||
# ...
|
||||
@@ -983,6 +1029,7 @@ generate_crypto_objects:
|
||||
crypto/objects/obj_mac.num \
|
||||
crypto/objects/obj_xref.txt \
|
||||
> crypto/objects/obj_xref.h )
|
||||
( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
|
||||
|
||||
generate_crypto_conf:
|
||||
( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
|
||||
@@ -1025,6 +1072,7 @@ errors:
|
||||
qw( include/internal/dso.h
|
||||
include/internal/o_dir.h
|
||||
include/internal/err.h
|
||||
include/internal/evp.h
|
||||
include/internal/sslconf.h );
|
||||
our @cryptoskipheaders = ( @sslheaders,
|
||||
qw( include/openssl/conf_api.h
|
||||
@@ -1229,7 +1277,7 @@ EOF
|
||||
|
||||
if ($args{generator}->[0] =~ /\.pl$/) {
|
||||
$generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
|
||||
.' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
|
||||
.' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
|
||||
} elsif ($args{generator}->[0] =~ /\.m4$/) {
|
||||
$generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
|
||||
} elsif ($args{generator}->[0] =~ /\.S$/) {
|
||||
|
||||
@@ -47,19 +47,22 @@ SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
|
||||
LIBS={- join(" ", map { ( platform->sharedlib_import($_), platform->staticlib($_) ) } @{$unified_info{libraries}}) -}
|
||||
SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
|
||||
SHLIBPDBS={- join(" ", map { platform->sharedlibpdb($_) // () } @{$unified_info{libraries}}) -}
|
||||
MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
|
||||
MODULES={- our @MODULES = map { platform->dso($_) } @{$unified_info{modules}};
|
||||
join(" ", @MODULES) -}
|
||||
MODULEPDBS={- join(" ", map { platform->dsopdb($_) } @{$unified_info{modules}}) -}
|
||||
PROGRAMS={- our @PROGRAMS = map { platform->bin($_) } @{$unified_info{programs}}; join(" ", @PROGRAMS) -}
|
||||
PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
|
||||
SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
|
||||
SCRIPTS={- our @SCRIPTS = @{$unified_info{scripts}}; join(" ", @SCRIPTS) -}
|
||||
{- output_off() if $disabled{makedepend}; "" -}
|
||||
DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
|
||||
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
||||
keys %{$unified_info{sources}}); -}
|
||||
{- output_on() if $disabled{makedepend}; "" -}
|
||||
GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
|
||||
GENERATED_MANDATORY={- our @GENERATED_MANDATORY = @{$unified_info{depends}->{""}};
|
||||
join(" ", @GENERATED_MANDATORY) -}
|
||||
GENERATED={- # common0.tmpl provides @generated
|
||||
join(" ", map { platform->convertext($_) } @generated) -}
|
||||
our @GENERATED = map { platform->convertext($_) } @generated;
|
||||
join(" ", @GENERATED) -}
|
||||
|
||||
INSTALL_LIBS={-
|
||||
join(" ", map { quotify1(platform->sharedlib_import($_)
|
||||
@@ -91,6 +94,18 @@ INSTALL_ENGINEPDBS={-
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_MODULES={-
|
||||
join(" ", map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_MODULEPDBS={-
|
||||
join(" ", map { quotify1(platform->dsopdb($_)) }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" ", map { quotify1(platform->bin($_)) }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@@ -417,10 +432,10 @@ clean: libclean
|
||||
-rmdir /Q /S $(HTMLDOCS5_BLDDIRS)
|
||||
-rmdir /Q /S $(HTMLDOCS7_BLDDIRS)
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
|
||||
-del /Q /F $(MODULES)
|
||||
-del /Q /F $(SCRIPTS)
|
||||
-del /Q /F $(GENERATED_MANDATORY)
|
||||
-del /Q /F $(GENERATED)
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @MODULES) -}
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @SCRIPTS) -}
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED_MANDATORY) -}
|
||||
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED) -}
|
||||
-del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest
|
||||
-del /Q /S /F engines\*.lib engines\*.exp
|
||||
-del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp
|
||||
@@ -438,9 +453,9 @@ depend:
|
||||
|
||||
# Install helper targets #############################################
|
||||
|
||||
install_sw: install_dev install_engines install_runtime
|
||||
install_sw: install_dev install_engines install_modules install_runtime
|
||||
|
||||
uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
|
||||
uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
|
||||
|
||||
install_docs: install_html_docs
|
||||
|
||||
@@ -484,9 +499,11 @@ install_dev: install_runtime_libs
|
||||
|
||||
uninstall_dev:
|
||||
|
||||
install_engines: install_runtime_libs build_modules
|
||||
_install_modules_deps: install_runtime_libs build_modules
|
||||
|
||||
install_engines: _install_modules_deps
|
||||
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
||||
@$(ECHO) "*** Installing ENGINE modules"
|
||||
@$(ECHO) "*** Installing engines"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
|
||||
@if not "$(INSTALL_ENGINES)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
|
||||
@@ -495,6 +512,17 @@ install_engines: install_runtime_libs build_modules
|
||||
|
||||
uninstall_engines:
|
||||
|
||||
install_modules: _install_modules_deps
|
||||
@if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
|
||||
@$(ECHO) "*** Installing modules"
|
||||
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)"
|
||||
@if not "$(INSTALL_MODULES)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)"
|
||||
@if not "$(INSTALL_MODULES)"=="" \
|
||||
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)"
|
||||
|
||||
uninstall_modules:
|
||||
|
||||
install_runtime: install_programs
|
||||
|
||||
install_runtime_libs: build_libs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /usr/bin/env perl
|
||||
# -*- mode: perl; -*-
|
||||
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2016-2020 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
|
||||
@@ -21,7 +21,7 @@ use OpenSSL::fallback "$FindBin::Bin/external/perl/MODULES.txt";
|
||||
use OpenSSL::Glob;
|
||||
use OpenSSL::Template;
|
||||
|
||||
# see INSTALL for instructions.
|
||||
# see INSTALL.md for instructions.
|
||||
|
||||
my $orig_death_handler = $SIG{__DIE__};
|
||||
$SIG{__DIE__} = \&death_handler;
|
||||
@@ -286,7 +286,13 @@ collect_information(
|
||||
qr/\s*(\w+)\s*=\s*(.*?)\s*$/ =>
|
||||
sub {
|
||||
# Only define it if there is a value at all
|
||||
$version{uc $1} = $2 if $2 ne '';
|
||||
if ($2 ne '') {
|
||||
my $k = $1;
|
||||
my $v = $2;
|
||||
# Some values are quoted. Trim the quotes
|
||||
$v = $1 if $v =~ /^"(.*)"$/;
|
||||
$version{uc $k} = $v;
|
||||
}
|
||||
},
|
||||
"OTHERWISE" =>
|
||||
sub { die "Something wrong with this line:\n$_\nin $srcdir/VERSION" },
|
||||
@@ -417,6 +423,7 @@ my @disablables = (
|
||||
"poly1305",
|
||||
"posix-io",
|
||||
"psk",
|
||||
"quic",
|
||||
"rc2",
|
||||
"rc4",
|
||||
"rc5",
|
||||
@@ -518,7 +525,7 @@ my @disable_cascades = (
|
||||
"ssl3-method" => [ "ssl3" ],
|
||||
"zlib" => [ "zlib-dynamic" ],
|
||||
"des" => [ "mdc2" ],
|
||||
"ec" => [ "ecdsa", "ecdh", "sm2" ],
|
||||
"ec" => [ "ecdsa", "ecdh", "sm2", "gost" ],
|
||||
sub { $disabled{"ec"} && $disabled{"dh"} }
|
||||
=> [ "tls1_3" ],
|
||||
"dgram" => [ "dtls", "sctp" ],
|
||||
@@ -573,6 +580,7 @@ my @disable_cascades = (
|
||||
"legacy" => [ "md2" ],
|
||||
|
||||
"cmp" => [ "crmf" ],
|
||||
"tls1_3" => [ "quic" ],
|
||||
|
||||
# Padlock engine uses low-level AES APIs which are deprecated
|
||||
sub { $disabled{"deprecated-3.0"} }
|
||||
@@ -1118,6 +1126,9 @@ if (scalar(@seed_sources) == 0) {
|
||||
print "Using os-specific seed configuration\n";
|
||||
push @seed_sources, 'os';
|
||||
}
|
||||
if (scalar(grep { $_ eq 'egd' } @seed_sources) > 0) {
|
||||
delete $disabled{'egd'};
|
||||
}
|
||||
if (scalar(grep { $_ eq 'none' } @seed_sources) > 0) {
|
||||
die "Cannot seed with none and anything else" if scalar(@seed_sources) > 1;
|
||||
warn <<_____ if scalar(@seed_sources) == 1;
|
||||
@@ -1130,7 +1141,8 @@ will not work unless the random generator is seeded manually by the
|
||||
application.
|
||||
|
||||
Please read the 'Note on random number generation' section in the
|
||||
INSTALL instructions and the RAND_DRBG(7) manual page for more details.
|
||||
INSTALL.md instructions and the RAND_DRBG(7) manual page for more
|
||||
details.
|
||||
============================== WARNING ===============================
|
||||
|
||||
_____
|
||||
@@ -1824,23 +1836,13 @@ if ($builder eq "unified") {
|
||||
my $variable_name_re = qr/(?P<VARIABLE>[[:alpha:]][[:alnum:]_]*)/;
|
||||
# Value modifier syntaxes
|
||||
my $variable_subst_re = qr/\/(?P<RE>(?:\\\/|.)*?)\/(?P<SUBST>.*?)/;
|
||||
# Put it all together
|
||||
my $variable_re = qr/\$
|
||||
(?|
|
||||
# Simple case, just the name
|
||||
${variable_name_re}
|
||||
|
|
||||
# Expressive case, with braces and possible
|
||||
# modifier expressions
|
||||
\{
|
||||
${variable_name_re}
|
||||
(?:
|
||||
# Pile on modifier expressions,
|
||||
# separated by |
|
||||
${variable_subst_re}
|
||||
)
|
||||
\}
|
||||
)/x;
|
||||
# Variable reference
|
||||
my $variable_simple_re = qr/(?<!\\)\$${variable_name_re}/;
|
||||
my $variable_w_mod_re =
|
||||
qr/(?<!\\)\$\{${variable_name_re}(?P<MOD>(?:\\\/|.)*?)\}/;
|
||||
# Tie it all together
|
||||
my $variable_re = qr/${variable_simple_re}|${variable_w_mod_re}/;
|
||||
|
||||
my $expand_variables = sub {
|
||||
my $value = '';
|
||||
my $value_rest = shift;
|
||||
@@ -1849,25 +1851,29 @@ if ($builder eq "unified") {
|
||||
print STDERR
|
||||
"DEBUG[\$expand_variables] Parsed '$value_rest' ...\n"
|
||||
}
|
||||
while ($value_rest =~ /(?<!\\)${variable_re}/) {
|
||||
|
||||
while ($value_rest =~ /${variable_re}/) {
|
||||
# We must save important regexp values, because the next
|
||||
# regexp clears them
|
||||
my $mod = $+{MOD};
|
||||
my $variable_value = $variables{$+{VARIABLE}};
|
||||
|
||||
$value_rest = $';
|
||||
$value .= $`;
|
||||
|
||||
my $variable_value = $variables{$+{VARIABLE}};
|
||||
|
||||
# Process modifier expressions, if present
|
||||
if (defined $+{RE}) {
|
||||
# We must save important %+ values, because the s///
|
||||
# below clears them
|
||||
my $re = $+{RE};
|
||||
my $subst = $+{SUBST};
|
||||
if (defined $mod) {
|
||||
if ($mod =~ /^${variable_subst_re}$/) {
|
||||
my $re = $+{RE};
|
||||
my $subst = $+{SUBST};
|
||||
|
||||
$variable_value =~ s/\Q$re\E/$subst/g;
|
||||
$variable_value =~ s/\Q$re\E/$subst/g;
|
||||
|
||||
if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
|
||||
print STDERR
|
||||
"DEBUG[\$expand_variables] ... and substituted ",
|
||||
"'$re' with '$subst'\n";
|
||||
if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
|
||||
print STDERR
|
||||
"DEBUG[\$expand_variables] ... and substituted ",
|
||||
"'$re' with '$subst'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2610,7 +2616,7 @@ print <<"EOF" if ($disabled{threads} eq "unavailable");
|
||||
|
||||
The library could not be configured for supporting multi-threaded
|
||||
applications as the compiler options required on this system are not known.
|
||||
See file INSTALL for details if you need multi-threading.
|
||||
See file INSTALL.md for details if you need multi-threading.
|
||||
EOF
|
||||
|
||||
print <<"EOF" if ($no_shared_warn);
|
||||
@@ -2635,7 +2641,7 @@ print <<"EOF";
|
||||
*** perl configdata.pm --dump ***
|
||||
*** ***
|
||||
*** (If you are new to OpenSSL, you might want to consult the ***
|
||||
*** 'Troubleshooting' section in the INSTALL file first) ***
|
||||
*** 'Troubleshooting' section in the INSTALL.md file first) ***
|
||||
*** ***
|
||||
**********************************************************************
|
||||
EOF
|
||||
@@ -2655,8 +2661,8 @@ sub death_handler {
|
||||
my @message = ( <<"_____", @_ );
|
||||
|
||||
Failure! $build_file wasn't produced.
|
||||
Please read INSTALL and associated NOTES files. You may also have to look over
|
||||
your available compiler tool chain or change your configuration.
|
||||
Please read INSTALL.md and associated NOTES files. You may also have to
|
||||
look over your available compiler tool chain or change your configuration.
|
||||
|
||||
_____
|
||||
|
||||
|
||||
+161
-173
@@ -1,4 +1,3 @@
|
||||
|
||||
Build and Install
|
||||
=================
|
||||
|
||||
@@ -12,36 +11,35 @@ Table of Contents
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Notational Conventions](#notational-conventions)
|
||||
- [Quick Installation Guide](#quick-installation-guide)
|
||||
- [Building OpenSSL](#building-openssl)
|
||||
- [Installing OpenSSL](#installing-openssl)
|
||||
- [Building OpenSSL](#building-openssl)
|
||||
- [Installing OpenSSL](#installing-openssl)
|
||||
- [Configuration Options](#configuration-options)
|
||||
- [API Level](#api-level)
|
||||
- [Cross Compile Prefix](#cross-compile-prefix)
|
||||
- [Build Type](#build-type)
|
||||
- [Directories](#directories)
|
||||
- [Compiler Warnings](#compiler-warnings)
|
||||
- [ZLib Flags](#zlib-flags)
|
||||
- [Seeding the Random Generator](#seeding-the-random-generator)
|
||||
- [Enable and Disable Features](#enable-and-disable-features)
|
||||
- [Displaying configuration data](#displaying-configuration-data)
|
||||
- [API Level](#api-level)
|
||||
- [Cross Compile Prefix](#cross-compile-prefix)
|
||||
- [Build Type](#build-type)
|
||||
- [Directories](#directories)
|
||||
- [Compiler Warnings](#compiler-warnings)
|
||||
- [ZLib Flags](#zlib-flags)
|
||||
- [Seeding the Random Generator](#seeding-the-random-generator)
|
||||
- [Enable and Disable Features](#enable-and-disable-features)
|
||||
- [Displaying configuration data](#displaying-configuration-data)
|
||||
- [Installation Steps in Detail](#installation-steps-in-detail)
|
||||
- [Configure](#configure-openssl)
|
||||
- [Build](#build-openssl)
|
||||
- [Test](#test-openssl)
|
||||
- [Install](#install-openssl)
|
||||
- [Configure](#configure-openssl)
|
||||
- [Build](#build-openssl)
|
||||
- [Test](#test-openssl)
|
||||
- [Install](#install-openssl)
|
||||
- [Advanced Build Options](#advanced-build-options)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Makefile Targets](#makefile-targets)
|
||||
- [Running Selected Tests](#running-selected-tests)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Makefile Targets](#makefile-targets)
|
||||
- [Running Selected Tests](#running-selected-tests)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Configuration Problems](#configuration-problems)
|
||||
- [Build Failures](#build-failures)
|
||||
- [Test Failures](#test-failures)
|
||||
- [Configuration Problems](#configuration-problems)
|
||||
- [Build Failures](#build-failures)
|
||||
- [Test Failures](#test-failures)
|
||||
- [Notes](#notes)
|
||||
- [Notes on multi-threading](#notes-on-multi-threading)
|
||||
- [Notes on shared libraries](#notes-on-shared-libraries)
|
||||
- [Notes on random number generation](#notes-on-random-number-generation)
|
||||
|
||||
- [Notes on multi-threading](#notes-on-multi-threading)
|
||||
- [Notes on shared libraries](#notes-on-shared-libraries)
|
||||
- [Notes on random number generation](#notes-on-random-number-generation)
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
@@ -67,7 +65,6 @@ issues and other details, please read one of these:
|
||||
* [NOTES.VALGRIND](NOTES.VALGRIND) - testing with Valgrind
|
||||
* [NOTES.PERL](NOTES.PERL) - some notes on Perl
|
||||
|
||||
|
||||
Notational conventions
|
||||
======================
|
||||
|
||||
@@ -129,7 +126,6 @@ A simple example would be
|
||||
which is to be understood to use the command `type` on some file name
|
||||
determined by the user.
|
||||
|
||||
|
||||
**Optional Arguments** are enclosed in double square brackets.
|
||||
|
||||
[[ options ]]
|
||||
@@ -138,7 +134,6 @@ Note that the notation assumes spaces around {, }, [, ], {{, }} and
|
||||
[[, ]]. This is to differentiate from OpenVMS directory
|
||||
specifications, which also use [ and ], but without spaces.
|
||||
|
||||
|
||||
Quick Installation Guide
|
||||
========================
|
||||
|
||||
@@ -154,13 +149,13 @@ Use the following commands to configure, build and test OpenSSL.
|
||||
The testing is optional, but recommended if you intend to install
|
||||
OpenSSL for production use.
|
||||
|
||||
### Unix / Linux / macOS ###
|
||||
### Unix / Linux / macOS
|
||||
|
||||
$ ./config
|
||||
$ make
|
||||
$ make test
|
||||
|
||||
### OpenVMS ###
|
||||
### OpenVMS
|
||||
|
||||
Use the following commands to build OpenSSL:
|
||||
|
||||
@@ -168,7 +163,7 @@ Use the following commands to build OpenSSL:
|
||||
$ mms
|
||||
$ mms test
|
||||
|
||||
### Windows ###
|
||||
### Windows
|
||||
|
||||
If you are using Visual Studio, open a Developer Command Prompt and
|
||||
and issue the following commands to build OpenSSL.
|
||||
@@ -207,7 +202,10 @@ To avoid breaking other applications, install your copy of OpenSSL to a
|
||||
[different location](#installing-to-a-different-location) which is not in
|
||||
the global search path for system libraries.
|
||||
|
||||
### Unix / Linux / macOS ###
|
||||
Finally, if you plan on using the FIPS module, you need to read the
|
||||
[Post-installation Notes](#post-installation-notes) further down.
|
||||
|
||||
### Unix / Linux / macOS
|
||||
|
||||
Depending on your distribution, you need to run the following command as
|
||||
root user or prepend `sudo` to the command:
|
||||
@@ -227,7 +225,7 @@ More precisely, the files will be installed into the subdirectories
|
||||
|
||||
depending on the file type, as it is custom on Unix-like operating systems.
|
||||
|
||||
### OpenVMS ###
|
||||
### OpenVMS
|
||||
|
||||
Use the following command to install OpenSSL.
|
||||
|
||||
@@ -240,7 +238,7 @@ By default, OpenSSL will be installed to
|
||||
where 'version' is the OpenSSL version number with underscores instead
|
||||
of periods.
|
||||
|
||||
### Windows ###
|
||||
### Windows
|
||||
|
||||
If you are using Visual Studio, open the Developer Command Prompt _elevated_
|
||||
and issue the following command.
|
||||
@@ -261,26 +259,25 @@ for native binaries, or
|
||||
|
||||
for 32bit binaries on 64bit Windows (WOW64).
|
||||
|
||||
|
||||
#### Installing to a different location ####
|
||||
#### Installing to a different location
|
||||
|
||||
To install OpenSSL to a different location (for example into your home
|
||||
directory for testing purposes) run config like this:
|
||||
directory for testing purposes) run config as shown in the following
|
||||
examples.
|
||||
|
||||
**On Unix**
|
||||
On Unix:
|
||||
|
||||
$ ./config --prefix=/opt/openssl --openssldir=/usr/local/ssl
|
||||
|
||||
**On OpenVMS**
|
||||
On OpenVMS:
|
||||
|
||||
$ @config --prefix=PROGRAM:[INSTALLS] --openssldir=SYS$MANAGER:[OPENSSL]
|
||||
|
||||
Note: if you do add options to the configuration command, please make sure
|
||||
you've read more than just this Quick Start, such as relevant NOTES.* files,
|
||||
you've read more than just this Quick Start, such as relevant `NOTES.*` files,
|
||||
the options outline below, as configuration options may change the outcome
|
||||
in otherwise unexpected ways.
|
||||
|
||||
|
||||
Configuration Options
|
||||
=====================
|
||||
|
||||
@@ -307,7 +304,6 @@ If you just intend to remove all deprecated APIs up to the current version
|
||||
entirely, just specify [no-deprecated](#no-deprecated).
|
||||
If `--api` isn't given, it defaults to the current (minor) OpenSSL version.
|
||||
|
||||
|
||||
Cross Compile Prefix
|
||||
--------------------
|
||||
|
||||
@@ -330,7 +326,6 @@ mention that you have to invoke `./Configure`, not `./config`, and pass your tar
|
||||
name explicitly. Also, note that `--openssldir` refers to target's file system,
|
||||
not one you are building on.
|
||||
|
||||
|
||||
Build Type
|
||||
----------
|
||||
|
||||
@@ -342,11 +337,10 @@ Build OpenSSL with debugging symbols and zero optimization level.
|
||||
|
||||
Build OpenSSL without debugging symbols. This is the default.
|
||||
|
||||
|
||||
Directories
|
||||
-----------
|
||||
|
||||
### libdir ###
|
||||
### libdir
|
||||
|
||||
--libdir=DIR
|
||||
|
||||
@@ -356,7 +350,7 @@ this is "lib". Note that on Windows only static libraries (`*.lib`) will
|
||||
be stored in this location. Shared libraries (`*.dll`) will always be
|
||||
installed to the "bin" directory.
|
||||
|
||||
### openssldir ###
|
||||
### openssldir
|
||||
|
||||
--openssldir=DIR
|
||||
|
||||
@@ -370,7 +364,7 @@ and key store. Defaults are:
|
||||
For 32bit Windows applications on Windows 64bit (WOW64), always replace
|
||||
`C:\Program Files` by `C:\Program Files (x86)`.
|
||||
|
||||
### prefix ###
|
||||
### prefix
|
||||
|
||||
--prefix=DIR
|
||||
|
||||
@@ -380,7 +374,6 @@ The top of the installation directory tree. Defaults are:
|
||||
Windows: C:\Program Files\OpenSSL
|
||||
OpenVMS: SYS$COMMON:[OPENSSL-'version']
|
||||
|
||||
|
||||
Compiler Warnings
|
||||
-----------------
|
||||
|
||||
@@ -394,7 +387,7 @@ this option where possible.
|
||||
ZLib Flags
|
||||
----------
|
||||
|
||||
### with-zlib-include ###
|
||||
### with-zlib-include
|
||||
|
||||
--with-zlib-include=DIR
|
||||
|
||||
@@ -402,7 +395,7 @@ The directory for the location of the zlib include file. This option is only
|
||||
necessary if [enable-zlib](#enable-zlib) is used and the include file is not
|
||||
already on the system include path.
|
||||
|
||||
### with-zlib-lib ###
|
||||
### with-zlib-lib
|
||||
|
||||
--with-zlib-lib=LIB
|
||||
|
||||
@@ -418,7 +411,6 @@ then this flag is optional and defaults to "ZLIB1" if not provided.
|
||||
This flag is optional and if not provided then "GNV$LIBZSHR", "GNV$LIBZSHR32"
|
||||
or "GNV$LIBZSHR64" is used by default depending on the pointer size chosen.
|
||||
|
||||
|
||||
Seeding the Random Generator
|
||||
----------------------------
|
||||
|
||||
@@ -429,18 +421,18 @@ in order to obtain random input (a.k.a "entropy") for seeding its
|
||||
cryptographically secure random number generator (CSPRNG).
|
||||
The current seeding methods are:
|
||||
|
||||
### os ###
|
||||
### os
|
||||
|
||||
Use a trusted operating system entropy source.
|
||||
This is the default method if such an entropy source exists.
|
||||
|
||||
### getrandom ###
|
||||
### getrandom
|
||||
|
||||
Use the [getrandom(2)][man-getrandom] or equivalent system call.
|
||||
|
||||
[man-getrandom]: http://man7.org/linux/man-pages/man2/getrandom.2.html
|
||||
|
||||
### devrandom ###
|
||||
### devrandom
|
||||
|
||||
Use the first device from the DEVRANDOM list which can be opened to read
|
||||
random bytes. The DEVRANDOM preprocessor constant expands to
|
||||
@@ -449,19 +441,19 @@ random bytes. The DEVRANDOM preprocessor constant expands to
|
||||
|
||||
on most unix-ish operating systems.
|
||||
|
||||
### egd ###
|
||||
### egd
|
||||
|
||||
Check for an entropy generating daemon.
|
||||
|
||||
### rdcpu ###
|
||||
### rdcpu
|
||||
|
||||
Use the RDSEED or RDRAND command if provided by the CPU.
|
||||
|
||||
### librandom ###
|
||||
### librandom
|
||||
|
||||
Use librandom (not implemented yet).
|
||||
|
||||
### none ###
|
||||
### none
|
||||
|
||||
Disable automatic seeding. This is the default on some operating systems where
|
||||
no suitable entropy source exists, or no support for it is implemented yet.
|
||||
@@ -471,7 +463,6 @@ at the end of this document.
|
||||
|
||||
[rng]: #notes-on-random-number-generation
|
||||
|
||||
|
||||
Enable and Disable Features
|
||||
---------------------------
|
||||
|
||||
@@ -485,14 +476,13 @@ In the following list, always the non-default variant is documented: if
|
||||
feature xxxx is disabled by default then enable-xxxx is documented and
|
||||
if feature xxxx is enabled by default then no-xxxx is documented.
|
||||
|
||||
|
||||
### no-afalgeng ###
|
||||
### no-afalgeng
|
||||
|
||||
Don't build the AFALG engine.
|
||||
|
||||
This option will be forced on a platform that does not support AFALG.
|
||||
|
||||
### enable-ktls ###
|
||||
### enable-ktls
|
||||
|
||||
Build with Kernel TLS support.
|
||||
|
||||
@@ -502,7 +492,7 @@ TLS sockets. The Kernel may use TLS accelerators if any are available on the
|
||||
system. This option will be forced off on systems that do not support the
|
||||
Kernel TLS data-path.
|
||||
|
||||
### enable-asan ###
|
||||
### enable-asan
|
||||
|
||||
Build with the Address sanitiser.
|
||||
|
||||
@@ -511,7 +501,7 @@ never be used in production environments. It will only work when used with
|
||||
gcc or clang and should be used in conjunction with the [no-shared](#no-shared)
|
||||
option.
|
||||
|
||||
### no-asm ###
|
||||
### no-asm
|
||||
|
||||
Do not use assembler code.
|
||||
|
||||
@@ -519,11 +509,11 @@ This should be viewed as debugging/troubleshooting option rather than for
|
||||
production use. On some platforms a small amount of assembler code may still
|
||||
be used even with this option.
|
||||
|
||||
### no-async ###
|
||||
### no-async
|
||||
|
||||
Do not build support for async operations.
|
||||
|
||||
### no-autoalginit ###
|
||||
### no-autoalginit
|
||||
|
||||
Don't automatically load all supported ciphers and digests.
|
||||
|
||||
@@ -533,7 +523,7 @@ size is an objective. This only affects libcrypto. Ciphers and digests will
|
||||
have to be loaded manually using EVP_add_cipher() and EVP_add_digest() if this
|
||||
option is used. This option will force a non-shared build.
|
||||
|
||||
### no-autoerrinit ###
|
||||
### no-autoerrinit
|
||||
|
||||
Don't automatically load all libcrypto/libssl error strings.
|
||||
|
||||
@@ -541,14 +531,14 @@ Typically OpenSSL will automatically load human readable error strings. For a
|
||||
statically linked application this may be undesirable if small executable size
|
||||
is an objective.
|
||||
|
||||
### no-autoload-config ###
|
||||
### no-autoload-config
|
||||
|
||||
Don't automatically load the default openssl.cnf file.
|
||||
|
||||
Typically OpenSSL will automatically load a system config file which configures
|
||||
default SSL options.
|
||||
|
||||
### enable-buildtest-c++ ###
|
||||
### enable-buildtest-c++
|
||||
|
||||
While testing, generate C++ buildtest files that simply check that the public
|
||||
OpenSSL header files are usable standalone with C++.
|
||||
@@ -558,76 +548,76 @@ as configuration option, you must ensure that it's valid for both the C and
|
||||
the C++ compiler. If not, the C++ build test will most likely break. As an
|
||||
alternative, you can use the language specific variables, CFLAGS and CXXFLAGS.
|
||||
|
||||
### no-capieng ###
|
||||
### no-capieng
|
||||
|
||||
Don't build the CAPI engine.
|
||||
|
||||
This option will be forced if on a platform that does not support CAPI.
|
||||
|
||||
### no-cmp ###
|
||||
### no-cmp
|
||||
|
||||
Don't build support for Certificate Management Protocol (CMP).
|
||||
|
||||
### no-cms ###
|
||||
### no-cms
|
||||
|
||||
Don't build support for Cryptographic Message Syntax (CMS).
|
||||
|
||||
### no-comp ###
|
||||
### no-comp
|
||||
|
||||
Don't build support for SSL/TLS compression.
|
||||
|
||||
If this option is enabled (the default), then compression will only work if
|
||||
the zlib or zlib-dynamic options are also chosen.
|
||||
|
||||
### enable-crypto-mdebug ###
|
||||
### enable-crypto-mdebug
|
||||
|
||||
This now only enables the failed-malloc feature.
|
||||
|
||||
### enable-crypto-mdebug-backtrace ###
|
||||
### enable-crypto-mdebug-backtrace
|
||||
|
||||
This is a no-op; the project uses the compiler's address/leak sanitizer instead.
|
||||
|
||||
### no-ct ###
|
||||
### no-ct
|
||||
|
||||
Don't build support for Certificate Transparency (CT).
|
||||
|
||||
### no-deprecated ###
|
||||
### no-deprecated
|
||||
|
||||
Don't build with support for deprecated APIs up until and including the version
|
||||
given with `--api` (or the current version, if `--api` wasn't specified).
|
||||
|
||||
### no-dgram ###
|
||||
### no-dgram
|
||||
|
||||
Don't build support for datagram based BIOs.
|
||||
|
||||
Selecting this option will also force the disabling of DTLS.
|
||||
|
||||
### no-dso ###
|
||||
### no-dso
|
||||
|
||||
Don't build support for loading Dynamic Shared Objects (DSO)
|
||||
|
||||
### enable-devcryptoeng ###
|
||||
### enable-devcryptoeng
|
||||
|
||||
Build the `/dev/crypto` engine.
|
||||
|
||||
This option is automatically selected on the BSD platform, in which case it can
|
||||
be disabled with no-devcryptoeng.
|
||||
|
||||
### no-dynamic-engine ###
|
||||
### no-dynamic-engine
|
||||
|
||||
Don't build the dynamically loaded engines.
|
||||
|
||||
This only has an effect in a shared build.
|
||||
|
||||
### no-ec ###
|
||||
### no-ec
|
||||
|
||||
Don't build support for Elliptic Curves.
|
||||
|
||||
### no-ec2m ###
|
||||
### no-ec2m
|
||||
|
||||
Don't build support for binary Elliptic Curves
|
||||
|
||||
### enable-ec_nistp_64_gcc_128 ###
|
||||
### enable-ec_nistp_64_gcc_128
|
||||
|
||||
Enable support for optimised implementations of some commonly used NIST
|
||||
elliptic curves.
|
||||
@@ -640,19 +630,19 @@ This option is only supported on platforms:
|
||||
- supports the non-standard type `__uint128_t`
|
||||
- defines the built-in macro `__SIZEOF_INT128__`
|
||||
|
||||
### enable-egd ###
|
||||
### enable-egd
|
||||
|
||||
Build support for gathering entropy from the Entropy Gathering Daemon (EGD).
|
||||
|
||||
### no-engine ###
|
||||
### no-engine
|
||||
|
||||
Don't build support for loading engines.
|
||||
|
||||
### no-err ###
|
||||
### no-err
|
||||
|
||||
Don't compile in any error strings.
|
||||
|
||||
### enable-external-tests ###
|
||||
### enable-external-tests
|
||||
|
||||
Enable building of integration with external test suites.
|
||||
|
||||
@@ -665,16 +655,16 @@ external test suites are currently supported:
|
||||
|
||||
See the file [test/README.external]/(test/README.external) for further details.
|
||||
|
||||
### no-filenames ###
|
||||
### no-filenames
|
||||
|
||||
Don't compile in filename and line number information (e.g. for errors and
|
||||
memory allocation).
|
||||
|
||||
### no-fips ###
|
||||
### no-fips
|
||||
|
||||
Don't compile the FIPS provider
|
||||
|
||||
### enable-fuzz-libfuzzer, enable-fuzz-afl ###
|
||||
### enable-fuzz-libfuzzer, enable-fuzz-afl
|
||||
|
||||
Build with support for fuzzing using either libfuzzer or AFL.
|
||||
|
||||
@@ -683,7 +673,7 @@ should never be used in production environments.
|
||||
|
||||
See the file [fuzz/README.md](fuzz/README.md) for further details.
|
||||
|
||||
### no-gost ###
|
||||
### no-gost
|
||||
|
||||
Don't build support for GOST based ciphersuites.
|
||||
|
||||
@@ -691,51 +681,49 @@ Note that if this feature is enabled then GOST ciphersuites are only available
|
||||
if the GOST algorithms are also available through loading an externally supplied
|
||||
engine.
|
||||
|
||||
### no-legacy ###
|
||||
### no-legacy
|
||||
|
||||
Don't build the legacy provider.
|
||||
|
||||
Disabling this also disables the legacy algorithms: MD2 (already disabled by default).
|
||||
|
||||
|
||||
### no-makedepend ###
|
||||
### no-makedepend
|
||||
|
||||
Don't generate dependencies.
|
||||
|
||||
### no-module ###
|
||||
### no-module
|
||||
|
||||
Don't build any dynamically loadable engines.
|
||||
|
||||
This also implies 'no-dynamic-engine'.
|
||||
|
||||
### no-multiblock ###
|
||||
### no-multiblock
|
||||
|
||||
Don't build support for writing multiple records in one go in libssl
|
||||
|
||||
Note: this is a different capability to the pipelining functionality.
|
||||
|
||||
### no-nextprotoneg ###
|
||||
### no-nextprotoneg
|
||||
|
||||
Don't build support for the Next Protocol Negotiation (NPN) TLS extension.
|
||||
|
||||
### no-ocsp ###
|
||||
### no-ocsp
|
||||
|
||||
Don't build support for Online Certificate Status Protocol (OCSP).
|
||||
|
||||
|
||||
### no-padlockeng ###
|
||||
### no-padlockeng
|
||||
|
||||
Don't build the padlock engine.
|
||||
|
||||
### no-hw-padlock ###
|
||||
### no-hw-padlock
|
||||
|
||||
As synonyme for no-padlockeng. Deprecated and should not be used.
|
||||
|
||||
### no-pic ###
|
||||
### no-pic
|
||||
|
||||
Don't build with support for Position Independent Code.
|
||||
|
||||
### no-pinshared ###
|
||||
### no-pinshared
|
||||
|
||||
Don't pin the shared libraries.
|
||||
|
||||
@@ -752,48 +740,47 @@ before libcrypto then a crash is likely to happen. Applications can suppress
|
||||
running of the atexit() handler at run time by using the OPENSSL_INIT_NO_ATEXIT
|
||||
option to OPENSSL_init_crypto(). See the man page for it for further details.
|
||||
|
||||
### no-posix-io ###
|
||||
### no-posix-io
|
||||
|
||||
Don't use POSIX IO capabilities.
|
||||
|
||||
### no-psk ###
|
||||
### no-psk
|
||||
|
||||
Don't build support for Pre-Shared Key based ciphersuites.
|
||||
|
||||
### no-rdrand ###
|
||||
### no-rdrand
|
||||
|
||||
Don't use hardware RDRAND capabilities.
|
||||
|
||||
### no-rfc3779 ###
|
||||
### no-rfc3779
|
||||
|
||||
Don't build support for RFC3779, "X.509 Extensions for IP Addresses and
|
||||
AS Identifiers".
|
||||
|
||||
### sctp ###
|
||||
### sctp
|
||||
|
||||
Build support for Stream Control Transmission Protocol (SCTP).
|
||||
|
||||
### no-shared ###
|
||||
### no-shared
|
||||
|
||||
Do not create shared libraries, only static ones.
|
||||
|
||||
|
||||
See [Notes on shared libraries](#notes-on-shared-libraries) below.
|
||||
|
||||
### no-sock ###
|
||||
### no-sock
|
||||
|
||||
Don't build support for socket BIOs.
|
||||
|
||||
### no-srp ###
|
||||
### no-srp
|
||||
|
||||
Don't build support for Secure Remote Password (SRP) protocol or
|
||||
SRP based ciphersuites.
|
||||
|
||||
### no-srtp ###
|
||||
### no-srtp
|
||||
|
||||
Don't build Secure Real-Time Transport Protocol (SRTP) support.
|
||||
|
||||
### no-sse2 ###
|
||||
### no-sse2
|
||||
|
||||
Exclude SSE2 code paths from 32-bit x86 assembly modules.
|
||||
|
||||
@@ -807,34 +794,34 @@ disengage SSE2 code paths upon application start-up, but if you aim for wider
|
||||
"audience" running such kernel, consider no-sse2. Both the 386 and no-asm
|
||||
options imply no-sse2.
|
||||
|
||||
### enable-ssl-trace ###
|
||||
### enable-ssl-trace
|
||||
|
||||
Build with the SSL Trace capabilities.
|
||||
|
||||
This adds the "-trace" option to s_client and s_server.
|
||||
|
||||
### no-static-engine ###
|
||||
### no-static-engine
|
||||
|
||||
Don't build the statically linked engines.
|
||||
|
||||
This only has an impact when not built "shared".
|
||||
|
||||
### no-stdio ###
|
||||
### no-stdio
|
||||
|
||||
Don't use anything from the C header file "stdio.h" that makes use of the "FILE"
|
||||
type. Only libcrypto and libssl can be built in this way. Using this option will
|
||||
suppress building the command line applications. Additionally, since the OpenSSL
|
||||
tests also use the command line applications, the tests will also be skipped.
|
||||
|
||||
### no-tests ###
|
||||
### no-tests
|
||||
|
||||
Don't build test programs or run any tests.
|
||||
|
||||
### no-threads ###
|
||||
### no-threads
|
||||
|
||||
Don't build with support for multi-threaded applications.
|
||||
|
||||
### threads ###
|
||||
### threads
|
||||
|
||||
Build with support for multi-threaded applications. Most platforms will enable
|
||||
this by default. However if on a platform where this is not the case then this
|
||||
@@ -842,17 +829,17 @@ will usually require additional system-dependent options!
|
||||
|
||||
See [Notes on multi-threading](#notes-on-multi-threading) below.
|
||||
|
||||
### enable-trace ###
|
||||
### enable-trace
|
||||
|
||||
Build with support for the integrated tracing api.
|
||||
|
||||
See manual pages OSSL_trace_set_channel(3) and OSSL_trace_enabled(3) for details.
|
||||
|
||||
### no-ts ###
|
||||
### no-ts
|
||||
|
||||
Don't build Time Stamping (TS) Authority support.
|
||||
|
||||
### enable-ubsan ###
|
||||
### enable-ubsan
|
||||
|
||||
Build with the Undefined Behaviour sanitiser (UBSAN).
|
||||
|
||||
@@ -861,40 +848,40 @@ never be used in production environments. It will only work when used with gcc
|
||||
or clang and should be used in conjunction with the `-DPEDANTIC` option
|
||||
(or the `--strict-warnings` option).
|
||||
|
||||
### no-ui ###
|
||||
### no-ui-console
|
||||
|
||||
Don't build with the User Interface (UI) capability
|
||||
Don't build with the User Interface (UI) console method
|
||||
|
||||
The User Interface is the set of features enabling text based prompts.
|
||||
The User Interface console method enables text based console prompts.
|
||||
|
||||
### enable-unit-test ###
|
||||
### enable-unit-test
|
||||
|
||||
Enable additional unit test APIs.
|
||||
|
||||
This should not typically be used in production deployments.
|
||||
|
||||
### no-uplink ###
|
||||
### no-uplink
|
||||
|
||||
Don't build support for UPLINK interface.
|
||||
|
||||
### enable-weak-ssl-ciphers ###
|
||||
### enable-weak-ssl-ciphers
|
||||
|
||||
Build support for SSL/TLS ciphers that are considered "weak"
|
||||
|
||||
Enabling this includes for example the RC4 based ciphersuites.
|
||||
|
||||
### zlib ###
|
||||
### zlib
|
||||
|
||||
Build with support for zlib compression/decompression.
|
||||
|
||||
### zlib-dynamic ###
|
||||
### zlib-dynamic
|
||||
|
||||
Like the zlib option, but has OpenSSL load the zlib library dynamically
|
||||
when needed.
|
||||
|
||||
This is only supported on systems where loading of shared libraries is supported.
|
||||
|
||||
### 386 ###
|
||||
### 386
|
||||
|
||||
In 32-bit x86 builds, use the 80386 instruction set only in assembly modules
|
||||
|
||||
@@ -902,7 +889,7 @@ The default x86 code is more efficient, but requires at least an 486 processor.
|
||||
Note: This doesn't affect compiler generated code, so this option needs to be
|
||||
accompanied by a corresponding compiler-specific option.
|
||||
|
||||
### no-{protocol} ###
|
||||
### no-{protocol}
|
||||
|
||||
no-{ssl|ssl3|tls|tls1|tls1_1|tls1_2|tls1_3|dtls|dtls1|dtls1_2}
|
||||
|
||||
@@ -914,7 +901,7 @@ synonymous with "no-ssl3". Note this only affects version negotiation.
|
||||
OpenSSL will still provide the methods for applications to explicitly select
|
||||
the individual protocol versions.
|
||||
|
||||
### no-{protocol}-method ###
|
||||
### no-{protocol}-method
|
||||
|
||||
no-{ssl|ssl3|tls|tls1|tls1_1|tls1_2|tls1_3|dtls|dtls1|dtls1_2}-method
|
||||
|
||||
@@ -926,13 +913,13 @@ TLSv1.3.
|
||||
Using individual protocol methods directly is deprecated. Applications should
|
||||
use TLS_method() instead.
|
||||
|
||||
### enable-{algorithm} ###
|
||||
### enable-{algorithm}
|
||||
|
||||
enable-{md2|rc5}
|
||||
|
||||
Build with support for the specified algorithm.
|
||||
|
||||
### no-{algorithm} ###
|
||||
### no-{algorithm}
|
||||
|
||||
no-{aria|bf|blake2|camellia|cast|chacha|cmac|
|
||||
des|dh|dsa|ecdh|ecdsa|idea|md4|mdc2|ocb|
|
||||
@@ -943,7 +930,7 @@ Build without support for the specified algorithm.
|
||||
|
||||
The "ripemd" algorithm is deprecated and if used is synonymous with rmd160.
|
||||
|
||||
### Compiler-specific options ###
|
||||
### Compiler-specific options
|
||||
|
||||
-Dxxx, -Ixxx, -Wp, -lxxx, -Lxxx, -Wl, -rpath, -R, -framework, -static
|
||||
|
||||
@@ -974,7 +961,7 @@ encoding.
|
||||
Take note of the [Environment Variables](#environment-variables) documentation
|
||||
below and how these flags interact with those variables.
|
||||
|
||||
### Environment Variables ###
|
||||
### Environment Variables
|
||||
|
||||
VAR=value
|
||||
|
||||
@@ -1051,7 +1038,7 @@ If CC is set, it is advisable to also set CXX to ensure both the C and C++
|
||||
compiler are in the same "family". This becomes relevant with
|
||||
'enable-external-tests' and 'enable-buildtest-c++'.
|
||||
|
||||
### Reconfigure ###
|
||||
### Reconfigure
|
||||
|
||||
reconf
|
||||
reconfigure
|
||||
@@ -1090,7 +1077,7 @@ Installation Steps in Detail
|
||||
Configure OpenSSL
|
||||
-----------------
|
||||
|
||||
### Automatic Configuration ###
|
||||
### Automatic Configuration
|
||||
|
||||
On some platform a `config` script is available which attempts to guess
|
||||
your operating system (and compiler, if necessary) and calls the `Configure`
|
||||
@@ -1098,15 +1085,15 @@ Perl script with appropriate target based on its guess. Further options can
|
||||
be supplied to the `config` script, which will be passed on to the `Configure`
|
||||
script.
|
||||
|
||||
#### Unix / Linux / macOS ####
|
||||
#### Unix / Linux / macOS
|
||||
|
||||
$ ./config [[ options ]]
|
||||
|
||||
#### OpenVMS ####
|
||||
#### OpenVMS
|
||||
|
||||
$ @config [[ options ]]
|
||||
|
||||
#### Windows ####
|
||||
#### Windows
|
||||
|
||||
Automatic configuration is not available on Windows.
|
||||
|
||||
@@ -1126,7 +1113,7 @@ On some systems, you can include debugging information as follows:
|
||||
|
||||
$ ./config -d [[ options ]]
|
||||
|
||||
### Manual Configuration ###
|
||||
### Manual Configuration
|
||||
|
||||
OpenSSL knows about a range of different operating system, hardware and
|
||||
compiler combinations. To see the ones it knows about, run
|
||||
@@ -1148,8 +1135,7 @@ run:
|
||||
|
||||
$ ./Configure linux-elf [[ options ]]
|
||||
|
||||
|
||||
### Creating your own Configuration ###
|
||||
### Creating your own Configuration
|
||||
|
||||
If your system isn't listed, you will have to create a configuration
|
||||
file named Configurations/{{ something }}.conf and add the correct
|
||||
@@ -1165,13 +1151,13 @@ and "descrip.mms" on OpenVMS) from a suitable template in Configurations,
|
||||
and defines various macros in include/openssl/configuration.h (generated
|
||||
from include/openssl/configuration.h.in).
|
||||
|
||||
### Out of Tree Builds ###
|
||||
### Out of Tree Builds
|
||||
|
||||
OpenSSL can be configured to build in a build directory separate from the
|
||||
source code directory. It's done by placing yourself in some other
|
||||
directory and invoking the configuration commands from there.
|
||||
|
||||
#### Unix example ####
|
||||
#### Unix example
|
||||
|
||||
$ mkdir /var/tmp/openssl-build
|
||||
$ cd /var/tmp/openssl-build
|
||||
@@ -1181,7 +1167,7 @@ or
|
||||
|
||||
$ /PATH/TO/OPENSSL/SOURCE/Configure {{ target }} [[ options ]]
|
||||
|
||||
#### OpenVMS example ####
|
||||
#### OpenVMS example
|
||||
|
||||
$ set default sys$login:
|
||||
$ create/dir [.tmp.openssl-build]
|
||||
@@ -1192,7 +1178,7 @@ or
|
||||
|
||||
$ @[PATH.TO.OPENSSL.SOURCE]Configure {{ target }} [[ options ]]
|
||||
|
||||
#### Windows example ####
|
||||
#### Windows example
|
||||
|
||||
$ C:
|
||||
$ mkdir \temp-openssl
|
||||
@@ -1202,7 +1188,6 @@ or
|
||||
Paths can be relative just as well as absolute. Configure will do its best
|
||||
to translate them to relative paths whenever possible.
|
||||
|
||||
|
||||
Build OpenSSL
|
||||
-------------
|
||||
|
||||
@@ -1236,7 +1221,6 @@ your privileges temporarily if your platform allows it).
|
||||
If some tests fail, take a look at the [Test Failures](#test-failures)
|
||||
subsection of the [Troubleshooting](#troubleshooting) section.
|
||||
|
||||
|
||||
Install OpenSSL
|
||||
---------------
|
||||
|
||||
@@ -1253,7 +1237,7 @@ The above commands will install all the software components in this
|
||||
directory tree under PREFIX (the directory given with `--prefix` or
|
||||
its default):
|
||||
|
||||
#### Unix / Linux / macOS ####
|
||||
### Unix / Linux / macOS
|
||||
|
||||
bin/ Contains the openssl binary and a few other
|
||||
utility scripts.
|
||||
@@ -1275,7 +1259,7 @@ its default):
|
||||
share/doc/openssl/html/man7
|
||||
Contains the HTML rendition of the man-pages.
|
||||
|
||||
#### OpenVMS ####
|
||||
### OpenVMS
|
||||
|
||||
'arch' is replaced with the architecture name, "Alpha" or "ia64",
|
||||
'sover' is replaced with the shared library version (0101 for 1.1), and
|
||||
@@ -1296,8 +1280,7 @@ its default):
|
||||
[.SYSTEST] Contains the installation verification procedure.
|
||||
[.HTML] Contains the HTML rendition of the manual pages.
|
||||
|
||||
|
||||
#### Additional Directories ####
|
||||
### Additional Directories
|
||||
|
||||
Additionally, install will add the following directories under
|
||||
OPENSSLDIR (the directory given with `--openssldir` or its default)
|
||||
@@ -1325,9 +1308,10 @@ packaged, can use
|
||||
The specified destination directory will be prepended to all installation
|
||||
target paths.
|
||||
|
||||
### Compatibility issues with previous OpenSSL versions ###
|
||||
Compatibility issues with previous OpenSSL versions
|
||||
---------------------------------------------------
|
||||
|
||||
#### COMPILING existing applications ####
|
||||
### COMPILING existing applications
|
||||
|
||||
Starting with version 1.1.0, OpenSSL hides a number of structures that were
|
||||
previously open. This includes all internal libssl structures and a number
|
||||
@@ -1343,11 +1327,20 @@ access a structure's field directly.
|
||||
Some APIs have changed as well. However, older APIs have been preserved when
|
||||
possible.
|
||||
|
||||
Post-installation Notes
|
||||
-----------------------
|
||||
|
||||
With the default OpenSSL installation comes a FIPS provider module, which
|
||||
needs some post-installation attention, without which it will not be usable.
|
||||
This involves using the following command:
|
||||
|
||||
openssl fipsinstall
|
||||
|
||||
See the openssl-fipsinstall(1) manual for details and examples.
|
||||
|
||||
Advanced Build Options
|
||||
======================
|
||||
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
@@ -1422,7 +1415,6 @@ platforms.
|
||||
WINDRES
|
||||
See RC.
|
||||
|
||||
|
||||
Makefile Targets
|
||||
----------------
|
||||
|
||||
@@ -1515,7 +1507,7 @@ Also, all tokens except for "alltests" may have wildcards, such as *.
|
||||
(on Unix and Windows, BSD style wildcards are supported, while on VMS,
|
||||
it's VMS style wildcards)
|
||||
|
||||
### Examples ###
|
||||
### Examples
|
||||
|
||||
Run all tests except for the fuzz tests:
|
||||
|
||||
@@ -1553,7 +1545,7 @@ Troubleshooting
|
||||
Configuration Problems
|
||||
----------------------
|
||||
|
||||
### Selecting the correct target ###
|
||||
### Selecting the correct target
|
||||
|
||||
The `./config` script tries hard to guess your operating system, but in some
|
||||
cases it does not succeed. You will see a message like the following:
|
||||
@@ -1601,7 +1593,7 @@ you can [raise an issue][] to ask a question yourself.
|
||||
|
||||
More about our support resources can be found in the [SUPPORT][] file.
|
||||
|
||||
### Configuration Errors ###
|
||||
### Configuration Errors
|
||||
|
||||
If the `./config` or `./Configure` command fails with an error message,
|
||||
read the error message carefully and try to figure out whether you made
|
||||
@@ -1622,7 +1614,6 @@ Note: To make the output readable, pleace add a 'code fence' (three backquotes
|
||||
|
||||
```
|
||||
|
||||
|
||||
Build Failures
|
||||
--------------
|
||||
|
||||
@@ -1653,7 +1644,6 @@ encountered an OpenSSL bug, please [raise an issue][] to file a bug report.
|
||||
Please take the time to review the existing issues first; maybe the bug was
|
||||
already reported or has already been fixed.
|
||||
|
||||
|
||||
Test Failures
|
||||
-------------
|
||||
|
||||
@@ -1698,12 +1688,11 @@ compiler optimization flags from the CFLAGS line in Makefile and
|
||||
run "make clean; make" or corresponding.
|
||||
|
||||
To report a bug please open an issue on GitHub, at
|
||||
https://github.com/openssl/openssl/issues.
|
||||
<https://github.com/openssl/openssl/issues>.
|
||||
|
||||
For more details on how the make variables TESTS can be used,
|
||||
see section [Running Selected Tests](#running-selected-tests) below.
|
||||
|
||||
|
||||
Notes
|
||||
=====
|
||||
|
||||
@@ -1788,20 +1777,19 @@ to install additional support software to obtain a random seed and reseed
|
||||
the CSPRNG manually. Please check out the manual pages for RAND_add(),
|
||||
RAND_bytes(), RAND_egd(), and the FAQ for more information.
|
||||
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[openssl-users]:
|
||||
https://mta.openssl.org/mailman/listinfo/openssl-users
|
||||
<https://mta.openssl.org/mailman/listinfo/openssl-users>
|
||||
|
||||
[SUPPORT]:
|
||||
./SUPPORT.md
|
||||
|
||||
[GitHub Issues]:
|
||||
https://github.com/openssl/openssl/issues
|
||||
<https://github.com/openssl/openssl/issues>
|
||||
|
||||
[raise an issue]:
|
||||
https://github.com/openssl/openssl/issues/new/choose
|
||||
<https://github.com/openssl/openssl/issues/new/choose>
|
||||
|
||||
[10-main.conf]:
|
||||
Configurations/10-main.conf
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
NEWS
|
||||
====
|
||||
|
||||
@@ -19,8 +18,12 @@ OpenSSL Releases
|
||||
OpenSSL 3.0
|
||||
-----------
|
||||
|
||||
### Major changes between OpenSSL 1.1.1 and OpenSSL 3.0 [under development] ###
|
||||
### Major changes between OpenSSL 1.1.1 and OpenSSL 3.0 [under development]
|
||||
|
||||
* Interactive mode is removed from the 'openssl' program.
|
||||
* The X25519, X448, Ed25519, Ed448 and SHAKE256 algorithms are included in
|
||||
the FIPS provider. None have the "fips=yes" property set and, as such,
|
||||
will not be accidentially used.
|
||||
* The algorithm specific public key command line applications have
|
||||
been deprecated. These include dhparam, gendsa and others. The pkey
|
||||
alternatives should be used intead: pkey, pkeyparam and genpkey.
|
||||
@@ -30,7 +33,14 @@ OpenSSL 3.0
|
||||
authenticate servers or clients.
|
||||
* enable-crypto-mdebug and enable-crypto-mdebug-backtrace were mostly
|
||||
disabled; the project uses address sanitize/leak-detect instead.
|
||||
* Added a Certificate Management Protocol (CMP, RFC 4210) implementation
|
||||
also covering CRMF (RFC 4211) and HTTP transfer (RFC 6712).
|
||||
It is part of the crypto lib and adds a 'cmp' app with a demo configuration.
|
||||
All widely used CMP features are supported for both clients and servers.
|
||||
* Added a proper HTTP(S) client to libcrypto supporting GET and POST,
|
||||
redirection, plain and ASN.1-encoded contents, proxies, and timeouts.
|
||||
* Added OSSL_SERIALIZER, a generic serializer API.
|
||||
* Added OSSL_PARAM_BLD, an easier to use API to OSSL_PARAM.
|
||||
* Added error raising macros, ERR_raise() and ERR_raise_data().
|
||||
* Deprecated ERR_put_error().
|
||||
* Added OSSL_PROVIDER_available(), to check provider availibility.
|
||||
@@ -57,7 +67,16 @@ OpenSSL 3.0
|
||||
OpenSSL 1.1.1
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019] ###
|
||||
### Major changes between OpenSSL 1.1.1e and OpenSSL 1.1.1f [under development]
|
||||
|
||||
*
|
||||
|
||||
### Major changes between OpenSSL 1.1.1d and OpenSSL 1.1.1e [17 Mar 2020]
|
||||
|
||||
* Fixed an overflow bug in the x64_64 Montgomery squaring procedure
|
||||
used in exponentiation with 512-bit moduli ([CVE-2019-1551][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019]
|
||||
|
||||
* Fixed a fork protection issue ([CVE-2019-1549][])
|
||||
* Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey
|
||||
@@ -74,36 +93,36 @@ OpenSSL 1.1.1
|
||||
* Significantly reduce secure memory usage by the randomness pools
|
||||
* Revert the DEVRANDOM_WAIT feature for Linux systems
|
||||
|
||||
### Major changes between OpenSSL 1.1.1b and OpenSSL 1.1.1c [28 May 2019] ###
|
||||
### Major changes between OpenSSL 1.1.1b and OpenSSL 1.1.1c [28 May 2019]
|
||||
|
||||
* Prevent over long nonces in ChaCha20-Poly1305 ([CVE-2019-1543][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.1a and OpenSSL 1.1.1b [26 Feb 2019] ###
|
||||
### Major changes between OpenSSL 1.1.1a and OpenSSL 1.1.1b [26 Feb 2019]
|
||||
|
||||
* Change the info callback signals for the start and end of a post-handshake
|
||||
message exchange in TLSv1.3.
|
||||
* Fix a bug in DTLS over SCTP. This breaks interoperability with older
|
||||
versions of OpenSSL like OpenSSL 1.1.0 and OpenSSL 1.0.2.
|
||||
|
||||
### Major changes between OpenSSL 1.1.1 and OpenSSL 1.1.1a [20 Nov 2018] ###
|
||||
### Major changes between OpenSSL 1.1.1 and OpenSSL 1.1.1a [20 Nov 2018]
|
||||
|
||||
* Timing vulnerability in DSA signature generation ([CVE-2018-0734][])
|
||||
* Timing vulnerability in ECDSA signature generation ([CVE-2018-0735][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0i and OpenSSL 1.1.1 [11 Sep 2018] ###
|
||||
### Major changes between OpenSSL 1.1.0i and OpenSSL 1.1.1 [11 Sep 2018]
|
||||
|
||||
* Support for TLSv1.3 added. The TLSv1.3 implementation includes:
|
||||
* Fully compliant implementation of RFC8446 (TLSv1.3) on by default
|
||||
* Early data (0-RTT)
|
||||
* Post-handshake authentication and key update
|
||||
* Middlebox Compatibility Mode
|
||||
* TLSv1.3 PSKs
|
||||
* Support for all five RFC8446 ciphersuites
|
||||
* RSA-PSS signature algorithms (backported to TLSv1.2)
|
||||
* Configurable session ticket support
|
||||
* Stateless server support
|
||||
* Rewrite of the packet construction code for "safer" packet handling
|
||||
* Rewrite of the extension handling code
|
||||
* Fully compliant implementation of RFC8446 (TLSv1.3) on by default
|
||||
* Early data (0-RTT)
|
||||
* Post-handshake authentication and key update
|
||||
* Middlebox Compatibility Mode
|
||||
* TLSv1.3 PSKs
|
||||
* Support for all five RFC8446 ciphersuites
|
||||
* RSA-PSS signature algorithms (backported to TLSv1.2)
|
||||
* Configurable session ticket support
|
||||
* Stateless server support
|
||||
* Rewrite of the packet construction code for "safer" packet handling
|
||||
* Rewrite of the extension handling code
|
||||
For further important information, see the [TLS1.3 page](
|
||||
https://wiki.openssl.org/index.php/TLS1.3) in the OpenSSL Wiki.
|
||||
|
||||
@@ -140,11 +159,10 @@ OpenSSL 1.1.1
|
||||
* Claim the namespaces OSSL and OPENSSL, represented as symbol prefixes
|
||||
* Rewrite of devcrypto engine
|
||||
|
||||
|
||||
OpenSSL 1.1.0
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 1.1.0k and OpenSSL 1.1.0l [10 Sep 2019] ###
|
||||
### Major changes between OpenSSL 1.1.0k and OpenSSL 1.1.0l [10 Sep 2019]
|
||||
|
||||
* Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey
|
||||
([CVE-2019-1563][])
|
||||
@@ -154,57 +172,57 @@ OpenSSL 1.1.0
|
||||
([CVE-2019-1547][])
|
||||
* Use Windows installation paths in the mingw builds ([CVE-2019-1552][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0j and OpenSSL 1.1.0k [28 May 2019] ###
|
||||
### Major changes between OpenSSL 1.1.0j and OpenSSL 1.1.0k [28 May 2019]
|
||||
|
||||
* Prevent over long nonces in ChaCha20-Poly1305 ([CVE-2019-1543][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0i and OpenSSL 1.1.0j [20 Nov 2018] ###
|
||||
### Major changes between OpenSSL 1.1.0i and OpenSSL 1.1.0j [20 Nov 2018]
|
||||
|
||||
* Timing vulnerability in DSA signature generation ([CVE-2018-0734][])
|
||||
* Timing vulnerability in ECDSA signature generation ([CVE-2018-0735][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0h and OpenSSL 1.1.0i [14 Aug 2018] ###
|
||||
### Major changes between OpenSSL 1.1.0h and OpenSSL 1.1.0i [14 Aug 2018]
|
||||
|
||||
* Client DoS due to large DH parameter ([CVE-2018-0732][])
|
||||
* Cache timing vulnerability in RSA Key Generation ([CVE-2018-0737][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0g and OpenSSL 1.1.0h [27 Mar 2018] ###
|
||||
### Major changes between OpenSSL 1.1.0g and OpenSSL 1.1.0h [27 Mar 2018]
|
||||
|
||||
* Constructed ASN.1 types with a recursive definition could exceed the
|
||||
stack ([CVE-2018-0739][])
|
||||
* Incorrect CRYPTO_memcmp on HP-UX PA-RISC ([CVE-2018-0733][])
|
||||
* rsaz_1024_mul_avx2 overflow bug on x86_64 ([CVE-2017-3738][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0f and OpenSSL 1.1.0g [2 Nov 2017] ###
|
||||
### Major changes between OpenSSL 1.1.0f and OpenSSL 1.1.0g [2 Nov 2017]
|
||||
|
||||
* bn_sqrx8x_internal carry bug on x86_64 ([CVE-2017-3736][])
|
||||
* Malformed X.509 IPAddressFamily could cause OOB read ([CVE-2017-3735][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0e and OpenSSL 1.1.0f [25 May 2017] ###
|
||||
### Major changes between OpenSSL 1.1.0e and OpenSSL 1.1.0f [25 May 2017]
|
||||
|
||||
* config now recognises 64-bit mingw and chooses mingw64 instead of mingw
|
||||
|
||||
### Major changes between OpenSSL 1.1.0d and OpenSSL 1.1.0e [16 Feb 2017] ###
|
||||
### Major changes between OpenSSL 1.1.0d and OpenSSL 1.1.0e [16 Feb 2017]
|
||||
|
||||
* Encrypt-Then-Mac renegotiation crash ([CVE-2017-3733][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0c and OpenSSL 1.1.0d [26 Jan 2017] ###
|
||||
### Major changes between OpenSSL 1.1.0c and OpenSSL 1.1.0d [26 Jan 2017]
|
||||
|
||||
* Truncated packet could crash via OOB read ([CVE-2017-3731][])
|
||||
* Bad (EC)DHE parameters cause a client crash ([CVE-2017-3730][])
|
||||
* BN_mod_exp may produce incorrect results on x86_64 ([CVE-2017-3732][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0b and OpenSSL 1.1.0c [10 Nov 2016] ###
|
||||
### Major changes between OpenSSL 1.1.0b and OpenSSL 1.1.0c [10 Nov 2016]
|
||||
|
||||
* ChaCha20/Poly1305 heap-buffer-overflow ([CVE-2016-7054][])
|
||||
* CMS Null dereference ([CVE-2016-7053][])
|
||||
* Montgomery multiplication may produce incorrect results ([CVE-2016-7055][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0a and OpenSSL 1.1.0b [26 Sep 2016] ###
|
||||
### Major changes between OpenSSL 1.1.0a and OpenSSL 1.1.0b [26 Sep 2016]
|
||||
|
||||
* Fix Use After Free for large message sizes ([CVE-2016-6309][])
|
||||
|
||||
### Major changes between OpenSSL 1.1.0 and OpenSSL 1.1.0a [22 Sep 2016] ###
|
||||
### Major changes between OpenSSL 1.1.0 and OpenSSL 1.1.0a [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth ([CVE-2016-6304][])
|
||||
* SSL_peek() hang on empty record ([CVE-2016-6305][])
|
||||
@@ -213,7 +231,7 @@ OpenSSL 1.1.0
|
||||
* Excessive allocation of memory in dtls1_preprocess_fragment()
|
||||
([CVE-2016-6308][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2h and OpenSSL 1.1.0 [25 Aug 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2h and OpenSSL 1.1.0 [25 Aug 2016]
|
||||
|
||||
* Copyright text was shrunk to a boilerplate that points to the license
|
||||
* "shared" builds are now the default when possible
|
||||
@@ -261,11 +279,10 @@ OpenSSL 1.1.0
|
||||
* Support for Certificate Transparency
|
||||
* HKDF support.
|
||||
|
||||
|
||||
OpenSSL 1.0.2
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 1.0.2s and OpenSSL 1.0.2t [10 Sep 2019] ###
|
||||
### Major changes between OpenSSL 1.0.2s and OpenSSL 1.0.2t [10 Sep 2019]
|
||||
|
||||
* Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey
|
||||
([CVE-2019-1563][])
|
||||
@@ -276,54 +293,54 @@ OpenSSL 1.0.2
|
||||
* Document issue with installation paths in diverse Windows builds
|
||||
([CVE-2019-1552][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2r and OpenSSL 1.0.2s [28 May 2019] ###
|
||||
### Major changes between OpenSSL 1.0.2r and OpenSSL 1.0.2s [28 May 2019]
|
||||
|
||||
* None
|
||||
|
||||
### Major changes between OpenSSL 1.0.2q and OpenSSL 1.0.2r [26 Feb 2019] ###
|
||||
### Major changes between OpenSSL 1.0.2q and OpenSSL 1.0.2r [26 Feb 2019]
|
||||
|
||||
* 0-byte record padding oracle ([CVE-2019-1559][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2p and OpenSSL 1.0.2q [20 Nov 2018] ###
|
||||
### Major changes between OpenSSL 1.0.2p and OpenSSL 1.0.2q [20 Nov 2018]
|
||||
|
||||
* Microarchitecture timing vulnerability in ECC scalar multiplication ([CVE-2018-5407][])
|
||||
* Timing vulnerability in DSA signature generation ([CVE-2018-0734][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2o and OpenSSL 1.0.2p [14 Aug 2018] ###
|
||||
### Major changes between OpenSSL 1.0.2o and OpenSSL 1.0.2p [14 Aug 2018]
|
||||
|
||||
* Client DoS due to large DH parameter ([CVE-2018-0732][])
|
||||
* Cache timing vulnerability in RSA Key Generation ([CVE-2018-0737][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2n and OpenSSL 1.0.2o [27 Mar 2018] ###
|
||||
### Major changes between OpenSSL 1.0.2n and OpenSSL 1.0.2o [27 Mar 2018]
|
||||
|
||||
* Constructed ASN.1 types with a recursive definition could exceed the
|
||||
stack ([CVE-2018-0739][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2m and OpenSSL 1.0.2n [7 Dec 2017] ###
|
||||
### Major changes between OpenSSL 1.0.2m and OpenSSL 1.0.2n [7 Dec 2017]
|
||||
|
||||
* Read/write after SSL object in error state ([CVE-2017-3737][])
|
||||
* rsaz_1024_mul_avx2 overflow bug on x86_64 ([CVE-2017-3738][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2l and OpenSSL 1.0.2m [2 Nov 2017] ###
|
||||
### Major changes between OpenSSL 1.0.2l and OpenSSL 1.0.2m [2 Nov 2017]
|
||||
|
||||
* bn_sqrx8x_internal carry bug on x86_64 ([CVE-2017-3736][])
|
||||
* Malformed X.509 IPAddressFamily could cause OOB read ([CVE-2017-3735][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017] ###
|
||||
### Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017]
|
||||
|
||||
* config now recognises 64-bit mingw and chooses mingw64 instead of mingw
|
||||
|
||||
### Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] ###
|
||||
### Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017]
|
||||
|
||||
* Truncated packet could crash via OOB read ([CVE-2017-3731][])
|
||||
* BN_mod_exp may produce incorrect results on x86_64 ([CVE-2017-3732][])
|
||||
* Montgomery multiplication may produce incorrect results ([CVE-2016-7055][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016]
|
||||
|
||||
* Missing CRL sanity check ([CVE-2016-7052][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth ([CVE-2016-6304][])
|
||||
* SWEET32 Mitigation ([CVE-2016-2183][])
|
||||
@@ -337,7 +354,7 @@ OpenSSL 1.0.2
|
||||
* DTLS replay protection DoS ([CVE-2016-2181][])
|
||||
* Certificate message OOB reads ([CVE-2016-6306][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2g and OpenSSL 1.0.2h [3 May 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2g and OpenSSL 1.0.2h [3 May 2016]
|
||||
|
||||
* Prevent padding oracle in AES-NI CBC MAC check ([CVE-2016-2107][])
|
||||
* Fix EVP_EncodeUpdate overflow ([CVE-2016-2105][])
|
||||
@@ -350,7 +367,7 @@ OpenSSL 1.0.2
|
||||
the default.
|
||||
* Only remove the SSLv2 methods with the no-ssl2-method option.
|
||||
|
||||
### Major changes between OpenSSL 1.0.2f and OpenSSL 1.0.2g [1 Mar 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2f and OpenSSL 1.0.2g [1 Mar 2016]
|
||||
|
||||
* Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
* Disable SSLv2 default build, default negotiation and weak ciphers
|
||||
@@ -363,12 +380,12 @@ OpenSSL 1.0.2
|
||||
* Fix memory issues in BIO_*printf functions ([CVE-2016-0799][])
|
||||
* Fix side channel attack on modular exponentiation ([CVE-2016-0702][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2e and OpenSSL 1.0.2f [28 Jan 2016] ###
|
||||
### Major changes between OpenSSL 1.0.2e and OpenSSL 1.0.2f [28 Jan 2016]
|
||||
|
||||
* DH small subgroups ([CVE-2016-0701][])
|
||||
* SSLv2 doesn't block disabled ciphers ([CVE-2015-3197][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2d and OpenSSL 1.0.2e [3 Dec 2015] ###
|
||||
### Major changes between OpenSSL 1.0.2d and OpenSSL 1.0.2e [3 Dec 2015]
|
||||
|
||||
* BN_mod_exp may produce incorrect results on x86_64 ([CVE-2015-3193][])
|
||||
* Certificate verify crash with missing PSS parameter ([CVE-2015-3194][])
|
||||
@@ -377,16 +394,16 @@ OpenSSL 1.0.2
|
||||
* In DSA_generate_parameters_ex, if the provided seed is too short,
|
||||
return an error
|
||||
|
||||
### Major changes between OpenSSL 1.0.2c and OpenSSL 1.0.2d [9 Jul 2015] ###
|
||||
### Major changes between OpenSSL 1.0.2c and OpenSSL 1.0.2d [9 Jul 2015]
|
||||
|
||||
* Alternate chains certificate forgery ([CVE-2015-1793][])
|
||||
* Race condition handling PSK identify hint ([CVE-2015-3196][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2b and OpenSSL 1.0.2c [12 Jun 2015] ###
|
||||
### Major changes between OpenSSL 1.0.2b and OpenSSL 1.0.2c [12 Jun 2015]
|
||||
|
||||
* Fix HMAC ABI incompatibility
|
||||
|
||||
### Major changes between OpenSSL 1.0.2a and OpenSSL 1.0.2b [11 Jun 2015] ###
|
||||
### Major changes between OpenSSL 1.0.2a and OpenSSL 1.0.2b [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop ([CVE-2015-1788][])
|
||||
* Exploitable out-of-bounds read in X509_cmp_time ([CVE-2015-1789][])
|
||||
@@ -394,7 +411,7 @@ OpenSSL 1.0.2
|
||||
* CMS verify infinite loop with unknown hash function ([CVE-2015-1792][])
|
||||
* Race condition handling NewSessionTicket ([CVE-2015-1791][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.2 and OpenSSL 1.0.2a [19 Mar 2015] ###
|
||||
### Major changes between OpenSSL 1.0.2 and OpenSSL 1.0.2a [19 Mar 2015]
|
||||
|
||||
* OpenSSL 1.0.2 ClientHello sigalgs DoS fix ([CVE-2015-0291][])
|
||||
* Multiblock corrupted pointer fix ([CVE-2015-0290][])
|
||||
@@ -410,7 +427,7 @@ OpenSSL 1.0.2
|
||||
* X509_to_X509_REQ NULL pointer deref fix ([CVE-2015-0288][])
|
||||
* Removed the export ciphers from the DEFAULT ciphers
|
||||
|
||||
### Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.2 [22 Jan 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.2 [22 Jan 2015]
|
||||
|
||||
* Suite B support for TLS 1.2 and DTLS 1.2
|
||||
* Support for DTLS 1.2
|
||||
@@ -421,11 +438,10 @@ OpenSSL 1.0.2
|
||||
* ALPN support.
|
||||
* CMS support for RSA-PSS, RSA-OAEP, ECDH and X9.42 DH.
|
||||
|
||||
|
||||
OpenSSL 1.0.1
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 1.0.1t and OpenSSL 1.0.1u [22 Sep 2016] ###
|
||||
### Major changes between OpenSSL 1.0.1t and OpenSSL 1.0.1u [22 Sep 2016]
|
||||
|
||||
* OCSP Status Request extension unbounded memory growth ([CVE-2016-6304][])
|
||||
* SWEET32 Mitigation ([CVE-2016-2183][])
|
||||
@@ -439,7 +455,7 @@ OpenSSL 1.0.1
|
||||
* DTLS replay protection DoS ([CVE-2016-2181][])
|
||||
* Certificate message OOB reads ([CVE-2016-6306][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.1s and OpenSSL 1.0.1t [3 May 2016] ###
|
||||
### Major changes between OpenSSL 1.0.1s and OpenSSL 1.0.1t [3 May 2016]
|
||||
|
||||
* Prevent padding oracle in AES-NI CBC MAC check ([CVE-2016-2107][])
|
||||
* Fix EVP_EncodeUpdate overflow ([CVE-2016-2105][])
|
||||
@@ -452,7 +468,7 @@ OpenSSL 1.0.1
|
||||
the default.
|
||||
* Only remove the SSLv2 methods with the no-ssl2-method option.
|
||||
|
||||
### Major changes between OpenSSL 1.0.1r and OpenSSL 1.0.1s [1 Mar 2016] ###
|
||||
### Major changes between OpenSSL 1.0.1r and OpenSSL 1.0.1s [1 Mar 2016]
|
||||
|
||||
* Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
* Disable SSLv2 default build, default negotiation and weak ciphers
|
||||
@@ -465,12 +481,12 @@ OpenSSL 1.0.1
|
||||
* Fix memory issues in BIO_*printf functions ([CVE-2016-0799][])
|
||||
* Fix side channel attack on modular exponentiation ([CVE-2016-0702][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.1q and OpenSSL 1.0.1r [28 Jan 2016] ###
|
||||
### Major changes between OpenSSL 1.0.1q and OpenSSL 1.0.1r [28 Jan 2016]
|
||||
|
||||
* Protection for DH small subgroup attacks
|
||||
* SSLv2 doesn't block disabled ciphers ([CVE-2015-3197][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.1p and OpenSSL 1.0.1q [3 Dec 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1p and OpenSSL 1.0.1q [3 Dec 2015]
|
||||
|
||||
* Certificate verify crash with missing PSS parameter ([CVE-2015-3194][])
|
||||
* X509_ATTRIBUTE memory leak ([CVE-2015-3195][])
|
||||
@@ -478,16 +494,16 @@ OpenSSL 1.0.1
|
||||
* In DSA_generate_parameters_ex, if the provided seed is too short,
|
||||
return an error
|
||||
|
||||
### Major changes between OpenSSL 1.0.1o and OpenSSL 1.0.1p [9 Jul 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1o and OpenSSL 1.0.1p [9 Jul 2015]
|
||||
|
||||
* Alternate chains certificate forgery ([CVE-2015-1793][])
|
||||
* Race condition handling PSK identify hint ([CVE-2015-3196][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.1n and OpenSSL 1.0.1o [12 Jun 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1n and OpenSSL 1.0.1o [12 Jun 2015]
|
||||
|
||||
* Fix HMAC ABI incompatibility
|
||||
|
||||
### Major changes between OpenSSL 1.0.1m and OpenSSL 1.0.1n [11 Jun 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1m and OpenSSL 1.0.1n [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop ([CVE-2015-1788][])
|
||||
* Exploitable out-of-bounds read in X509_cmp_time ([CVE-2015-1789][])
|
||||
@@ -495,7 +511,7 @@ OpenSSL 1.0.1
|
||||
* CMS verify infinite loop with unknown hash function ([CVE-2015-1792][])
|
||||
* Race condition handling NewSessionTicket ([CVE-2015-1791][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.1m [19 Mar 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.1m [19 Mar 2015]
|
||||
|
||||
* Segmentation fault in ASN1_TYPE_cmp fix ([CVE-2015-0286][])
|
||||
* ASN.1 structure reuse memory corruption fix ([CVE-2015-0287][])
|
||||
@@ -505,11 +521,11 @@ OpenSSL 1.0.1
|
||||
* X509_to_X509_REQ NULL pointer deref fix ([CVE-2015-0288][])
|
||||
* Removed the export ciphers from the DEFAULT ciphers
|
||||
|
||||
### Major changes between OpenSSL 1.0.1k and OpenSSL 1.0.1l [15 Jan 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1k and OpenSSL 1.0.1l [15 Jan 2015]
|
||||
|
||||
* Build fixes for the Windows and OpenVMS platforms
|
||||
|
||||
### Major changes between OpenSSL 1.0.1j and OpenSSL 1.0.1k [8 Jan 2015] ###
|
||||
### Major changes between OpenSSL 1.0.1j and OpenSSL 1.0.1k [8 Jan 2015]
|
||||
|
||||
* Fix for [CVE-2014-3571][]
|
||||
* Fix for [CVE-2015-0206][]
|
||||
@@ -520,14 +536,14 @@ OpenSSL 1.0.1
|
||||
* Fix for [CVE-2014-8275][]
|
||||
* Fix for [CVE-2014-3570][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014] ###
|
||||
### Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014]
|
||||
|
||||
* Fix for [CVE-2014-3513][]
|
||||
* Fix for [CVE-2014-3567][]
|
||||
* Mitigation for [CVE-2014-3566][] (SSL protocol vulnerability)
|
||||
* Fix for [CVE-2014-3568][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014] ###
|
||||
### Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014]
|
||||
|
||||
* Fix for [CVE-2014-3512][]
|
||||
* Fix for [CVE-2014-3511][]
|
||||
@@ -539,7 +555,7 @@ OpenSSL 1.0.1
|
||||
* Fix for [CVE-2014-5139][]
|
||||
* Fix for [CVE-2014-3508][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014] ###
|
||||
### Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014]
|
||||
|
||||
* Fix for [CVE-2014-0224][]
|
||||
* Fix for [CVE-2014-0221][]
|
||||
@@ -548,24 +564,24 @@ OpenSSL 1.0.1
|
||||
* Fix for [CVE-2014-3470][]
|
||||
* Fix for [CVE-2010-5298][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014] ###
|
||||
### Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014]
|
||||
|
||||
* Fix for [CVE-2014-0160][]
|
||||
* Add TLS padding extension workaround for broken servers.
|
||||
* Fix for [CVE-2014-0076][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014] ###
|
||||
### Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014]
|
||||
|
||||
* Don't include gmt_unix_time in TLS server and client random values
|
||||
* Fix for TLS record tampering bug [CVE-2013-4353][]
|
||||
* Fix for TLS version checking bug [CVE-2013-6449][]
|
||||
* Fix for DTLS retransmission bug [CVE-2013-6450][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013] ###
|
||||
### Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013]
|
||||
|
||||
* Corrected fix for [CVE-2013-0169][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013] ###
|
||||
### Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013]
|
||||
|
||||
* Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version.
|
||||
* Include the fips configuration module.
|
||||
@@ -573,24 +589,24 @@ OpenSSL 1.0.1
|
||||
* Fix for SSL/TLS/DTLS CBC plaintext recovery attack [CVE-2013-0169][]
|
||||
* Fix for TLS AESNI record handling flaw [CVE-2012-2686][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c [10 May 2012] ###
|
||||
### Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c [10 May 2012]
|
||||
|
||||
* Fix TLS/DTLS record length checking bug [CVE-2012-2333][]
|
||||
* Don't attempt to use non-FIPS composite ciphers in FIPS mode.
|
||||
|
||||
### Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b [26 Apr 2012] ###
|
||||
### Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b [26 Apr 2012]
|
||||
|
||||
* Fix compilation error on non-x86 platforms.
|
||||
* Make FIPS capable OpenSSL ciphers work in non-FIPS mode.
|
||||
* Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0
|
||||
|
||||
### Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a [19 Apr 2012] ###
|
||||
### Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a [19 Apr 2012]
|
||||
|
||||
* Fix for ASN1 overflow bug [CVE-2012-2110][]
|
||||
* Workarounds for some servers that hang on long client hellos.
|
||||
* Fix SEGV in AES code.
|
||||
|
||||
### Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012]
|
||||
|
||||
* TLS/DTLS heartbeat support.
|
||||
* SCTP support.
|
||||
@@ -603,16 +619,15 @@ OpenSSL 1.0.1
|
||||
* Preliminary FIPS capability for unvalidated 2.0 FIPS module.
|
||||
* SRP support.
|
||||
|
||||
|
||||
OpenSSL 1.0.0
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 1.0.0s and OpenSSL 1.0.0t [3 Dec 2015] ###
|
||||
### Major changes between OpenSSL 1.0.0s and OpenSSL 1.0.0t [3 Dec 2015]
|
||||
|
||||
* X509_ATTRIBUTE memory leak ([CVE-2015-3195][])
|
||||
* Race condition handling PSK identify hint ([CVE-2015-3196][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.0r and OpenSSL 1.0.0s [11 Jun 2015] ###
|
||||
### Major changes between OpenSSL 1.0.0r and OpenSSL 1.0.0s [11 Jun 2015]
|
||||
|
||||
* Malformed ECParameters causes infinite loop ([CVE-2015-1788][])
|
||||
* Exploitable out-of-bounds read in X509_cmp_time ([CVE-2015-1789][])
|
||||
@@ -620,7 +635,7 @@ OpenSSL 1.0.0
|
||||
* CMS verify infinite loop with unknown hash function ([CVE-2015-1792][])
|
||||
* Race condition handling NewSessionTicket ([CVE-2015-1791][])
|
||||
|
||||
### Major changes between OpenSSL 1.0.0q and OpenSSL 1.0.0r [19 Mar 2015] ###
|
||||
### Major changes between OpenSSL 1.0.0q and OpenSSL 1.0.0r [19 Mar 2015]
|
||||
|
||||
* Segmentation fault in ASN1_TYPE_cmp fix ([CVE-2015-0286][])
|
||||
* ASN.1 structure reuse memory corruption fix ([CVE-2015-0287][])
|
||||
@@ -630,11 +645,11 @@ OpenSSL 1.0.0
|
||||
* X509_to_X509_REQ NULL pointer deref fix ([CVE-2015-0288][])
|
||||
* Removed the export ciphers from the DEFAULT ciphers
|
||||
|
||||
### Major changes between OpenSSL 1.0.0p and OpenSSL 1.0.0q [15 Jan 2015] ###
|
||||
### Major changes between OpenSSL 1.0.0p and OpenSSL 1.0.0q [15 Jan 2015]
|
||||
|
||||
* Build fixes for the Windows and OpenVMS platforms
|
||||
|
||||
### Major changes between OpenSSL 1.0.0o and OpenSSL 1.0.0p [8 Jan 2015] ###
|
||||
### Major changes between OpenSSL 1.0.0o and OpenSSL 1.0.0p [8 Jan 2015]
|
||||
|
||||
* Fix for [CVE-2014-3571][]
|
||||
* Fix for [CVE-2015-0206][]
|
||||
@@ -645,14 +660,14 @@ OpenSSL 1.0.0
|
||||
* Fix for [CVE-2014-8275][]
|
||||
* Fix for [CVE-2014-3570][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0n and OpenSSL 1.0.0o [15 Oct 2014] ###
|
||||
### Major changes between OpenSSL 1.0.0n and OpenSSL 1.0.0o [15 Oct 2014]
|
||||
|
||||
* Fix for [CVE-2014-3513][]
|
||||
* Fix for [CVE-2014-3567][]
|
||||
* Mitigation for [CVE-2014-3566][] (SSL protocol vulnerability)
|
||||
* Fix for [CVE-2014-3568][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0m and OpenSSL 1.0.0n [6 Aug 2014] ###
|
||||
### Major changes between OpenSSL 1.0.0m and OpenSSL 1.0.0n [6 Aug 2014]
|
||||
|
||||
* Fix for [CVE-2014-3510][]
|
||||
* Fix for [CVE-2014-3507][]
|
||||
@@ -666,9 +681,9 @@ OpenSSL 1.0.0
|
||||
* EAP-FAST and other applications using tls_session_secret_cb
|
||||
wont resume sessions. Fixed in 1.0.0n-dev
|
||||
* Compilation failure of s3_pkt.c on some platforms due to missing
|
||||
<limits.h> include. Fixed in 1.0.0n-dev
|
||||
`<limits.h>` include. Fixed in 1.0.0n-dev
|
||||
|
||||
### Major changes between OpenSSL 1.0.0l and OpenSSL 1.0.0m [5 Jun 2014] ###
|
||||
### Major changes between OpenSSL 1.0.0l and OpenSSL 1.0.0m [5 Jun 2014]
|
||||
|
||||
* Fix for [CVE-2014-0224][]
|
||||
* Fix for [CVE-2014-0221][]
|
||||
@@ -678,35 +693,34 @@ OpenSSL 1.0.0
|
||||
* Fix for [CVE-2014-0076][]
|
||||
* Fix for [CVE-2010-5298][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0k and OpenSSL 1.0.0l [6 Jan 2014] ###
|
||||
### Major changes between OpenSSL 1.0.0k and OpenSSL 1.0.0l [6 Jan 2014]
|
||||
|
||||
* Fix for DTLS retransmission bug [CVE-2013-6450][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0j and OpenSSL 1.0.0k [5 Feb 2013] ###
|
||||
### Major changes between OpenSSL 1.0.0j and OpenSSL 1.0.0k [5 Feb 2013]
|
||||
|
||||
* Fix for SSL/TLS/DTLS CBC plaintext recovery attack [CVE-2013-0169][]
|
||||
* Fix OCSP bad key DoS attack [CVE-2013-0166][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0i and OpenSSL 1.0.0j [10 May 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0i and OpenSSL 1.0.0j [10 May 2012]
|
||||
|
||||
* Fix DTLS record length checking bug [CVE-2012-2333][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.0i [19 Apr 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.0i [19 Apr 2012]
|
||||
|
||||
* Fix for ASN1 overflow bug [CVE-2012-2110][]
|
||||
|
||||
|
||||
### Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012]
|
||||
|
||||
* Fix for CMS/PKCS#7 MMA [CVE-2012-0884][]
|
||||
* Corrected fix for [CVE-2011-4619][]
|
||||
* Various DTLS fixes.
|
||||
|
||||
### Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012]
|
||||
|
||||
* Fix for DTLS DoS issue [CVE-2012-0050][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012] ###
|
||||
### Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012]
|
||||
|
||||
* Fix for DTLS plaintext recovery attack [CVE-2011-4108][]
|
||||
* Clear block padding bytes of SSL 3.0 records [CVE-2011-4576][]
|
||||
@@ -714,7 +728,7 @@ OpenSSL 1.0.0
|
||||
* Check parameters are not NULL in GOST ENGINE [CVE-2012-0027][]
|
||||
* Check for malformed RFC3779 data [CVE-2011-4577][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011] ###
|
||||
### Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011]
|
||||
|
||||
* Fix for CRL vulnerability issue [CVE-2011-3207][]
|
||||
* Fix for ECDH crashes [CVE-2011-3210][]
|
||||
@@ -722,11 +736,11 @@ OpenSSL 1.0.0
|
||||
* Support ECDH ciphersuites for certificates using SHA2 algorithms.
|
||||
* Various DTLS fixes.
|
||||
|
||||
### Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011] ###
|
||||
### Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011]
|
||||
|
||||
* Fix for security issue [CVE-2011-0014][]
|
||||
|
||||
### Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010] ###
|
||||
### Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010]
|
||||
|
||||
* Fix for security issue [CVE-2010-4180][]
|
||||
* Fix for [CVE-2010-4252][]
|
||||
@@ -734,18 +748,18 @@ OpenSSL 1.0.0
|
||||
* Fix various platform compilation issues.
|
||||
* Corrected fix for security issue [CVE-2010-3864][].
|
||||
|
||||
### Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010] ###
|
||||
### Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010]
|
||||
|
||||
* Fix for security issue [CVE-2010-3864][].
|
||||
* Fix for [CVE-2010-2939][]
|
||||
* Fix WIN32 build system for GOST ENGINE.
|
||||
|
||||
### Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010] ###
|
||||
### Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010]
|
||||
|
||||
* Fix for security issue [CVE-2010-1633][].
|
||||
* GOST MAC and CFB fixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010] ###
|
||||
### Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010]
|
||||
|
||||
* RFC3280 path validation: sufficient to process PKITS tests.
|
||||
* Integrated support for PVK files and keyblobs.
|
||||
@@ -771,12 +785,12 @@ OpenSSL 1.0.0
|
||||
OpenSSL 0.9.x
|
||||
-------------
|
||||
|
||||
### Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010] ###
|
||||
### Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]
|
||||
|
||||
* CFB cipher definition fixes.
|
||||
* Fix security issues [CVE-2010-0740][] and [CVE-2010-0433][].
|
||||
|
||||
### Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010] ###
|
||||
### Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010]
|
||||
|
||||
* Cipher definition fixes.
|
||||
* Workaround for slow RAND_poll() on some WIN32 versions.
|
||||
@@ -788,33 +802,33 @@ OpenSSL 0.9.x
|
||||
* Ticket and SNI coexistence fixes.
|
||||
* Many fixes to DTLS handling.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009] ###
|
||||
### Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]
|
||||
|
||||
* Temporary work around for [CVE-2009-3555][]: disable renegotiation.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009] ###
|
||||
### Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]
|
||||
|
||||
* Fix various build issues.
|
||||
* Fix security issues ([CVE-2009-0590][], [CVE-2009-0591][], [CVE-2009-0789][])
|
||||
|
||||
### Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009] ###
|
||||
### Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009]
|
||||
|
||||
* Fix security issue ([CVE-2008-5077][])
|
||||
* Merge FIPS 140-2 branch code.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008] ###
|
||||
### Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]
|
||||
|
||||
* CryptoAPI ENGINE support.
|
||||
* Various precautionary measures.
|
||||
* Fix for bugs affecting certificate request creation.
|
||||
* Support for local machine keyset attribute in PKCS#12 files.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007] ###
|
||||
### Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007]
|
||||
|
||||
* Backport of CMS functionality to 0.9.8.
|
||||
* Fixes for bugs introduced with 0.9.8f.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007] ###
|
||||
### Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]
|
||||
|
||||
* Add gcc 4.2 support.
|
||||
* Add support for AES and SSE2 assembly language optimization
|
||||
@@ -825,23 +839,23 @@ OpenSSL 0.9.x
|
||||
* RFC4507bis support.
|
||||
* TLS Extensions support.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007] ###
|
||||
### Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]
|
||||
|
||||
* Various ciphersuite selection fixes.
|
||||
* RFC3779 support.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006] ###
|
||||
### Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]
|
||||
|
||||
* Introduce limits to prevent malicious key DoS ([CVE-2006-2940][])
|
||||
* Fix security issues ([CVE-2006-2937][], [CVE-2006-3737][], [CVE-2006-4343][])
|
||||
* Changes to ciphersuite selection algorithm
|
||||
|
||||
### Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006] ###
|
||||
### Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]
|
||||
|
||||
* Fix Daniel Bleichenbacher forged signature attack, [CVE-2006-4339][]
|
||||
* New cipher Camellia
|
||||
|
||||
### Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006] ###
|
||||
### Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]
|
||||
|
||||
* Cipher string fixes.
|
||||
* Fixes for VC++ 2005.
|
||||
@@ -851,12 +865,12 @@ OpenSSL 0.9.x
|
||||
* Built in dynamic engine compilation support on Win32.
|
||||
* Fixes auto dynamic engine loading in Win32.
|
||||
|
||||
### Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005] ###
|
||||
### Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]
|
||||
|
||||
* Fix potential SSL 2.0 rollback, [CVE-2005-2969][]
|
||||
* Extended Windows CE support
|
||||
|
||||
### Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005] ###
|
||||
### Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]
|
||||
|
||||
* Major work on the BIGNUM library for higher efficiency and to
|
||||
make operations more streamlined and less contradictory. This
|
||||
@@ -930,36 +944,36 @@ OpenSSL 0.9.x
|
||||
* Added initial support for Win64.
|
||||
* Added alternate pkg-config files.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007] ###
|
||||
### Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]
|
||||
|
||||
* FIPS 1.1.1 module linking.
|
||||
* Various ciphersuite selection fixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006] ###
|
||||
### Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]
|
||||
|
||||
* Introduce limits to prevent malicious key DoS ([CVE-2006-2940][])
|
||||
* Fix security issues ([CVE-2006-2937][], [CVE-2006-3737][], [CVE-2006-4343][])
|
||||
|
||||
### Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006] ###
|
||||
### Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006]
|
||||
|
||||
* Fix Daniel Bleichenbacher forged signature attack, [CVE-2006-4339][]
|
||||
|
||||
### Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006] ###
|
||||
### Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]
|
||||
|
||||
* Visual C++ 2005 fixes.
|
||||
* Update Windows build system for FIPS.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005] ###
|
||||
### Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]
|
||||
|
||||
* Give EVP_MAX_MD_SIZE its old value, except for a FIPS build.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005] ###
|
||||
### Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]
|
||||
|
||||
* Fix SSL 2.0 Rollback, [CVE-2005-2969][]
|
||||
* Allow use of fixed-length exponent on DSA signing
|
||||
* Default fixed-window RSA, DSA, DH private-key operations
|
||||
|
||||
### Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005] ###
|
||||
### Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]
|
||||
|
||||
* More compilation issues fixed.
|
||||
* Adaptation to more modern Kerberos API.
|
||||
@@ -968,7 +982,7 @@ OpenSSL 0.9.x
|
||||
* More constification.
|
||||
* Added processing of proxy certificates (RFC 3820).
|
||||
|
||||
### Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005] ###
|
||||
### Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]
|
||||
|
||||
* Several compilation issues fixed.
|
||||
* Many memory allocation failure checks added.
|
||||
@@ -976,12 +990,12 @@ OpenSSL 0.9.x
|
||||
* Mandatory basic checks on certificates.
|
||||
* Performance improvements.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004] ###
|
||||
### Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]
|
||||
|
||||
* Fix race condition in CRL checking code.
|
||||
* Fixes to PKCS#7 (S/MIME) code.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004] ###
|
||||
### Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]
|
||||
|
||||
* Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug
|
||||
* Security: Fix null-pointer assignment in do_change_cipher_spec()
|
||||
@@ -989,14 +1003,14 @@ OpenSSL 0.9.x
|
||||
* Multiple X509 verification fixes
|
||||
* Speed up HMAC and other operations
|
||||
|
||||
### Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003] ###
|
||||
### Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]
|
||||
|
||||
* Security: fix various ASN1 parsing bugs.
|
||||
* New -ignore_err option to OCSP utility.
|
||||
* Various interop and bug fixes in S/MIME code.
|
||||
* SSL/TLS protocol fix for unrequested client certificates.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003] ###
|
||||
### Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]
|
||||
|
||||
* Security: counter the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack
|
||||
@@ -1007,7 +1021,7 @@ OpenSSL 0.9.x
|
||||
* ASN.1: treat domainComponent correctly.
|
||||
* Documentation: fixes and additions.
|
||||
|
||||
### Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003] ###
|
||||
### Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]
|
||||
|
||||
* Security: Important security related bugfixes.
|
||||
* Enhanced compatibility with MIT Kerberos.
|
||||
@@ -1018,7 +1032,7 @@ OpenSSL 0.9.x
|
||||
* SSL/TLS: now handles manual certificate chain building.
|
||||
* SSL/TLS: certain session ID malfunctions corrected.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]
|
||||
|
||||
* New library section OCSP.
|
||||
* Complete rewrite of ASN1 code.
|
||||
@@ -1064,23 +1078,23 @@ OpenSSL 0.9.x
|
||||
* SSL/TLS: add callback to retrieve SSL/TLS messages.
|
||||
* SSL/TLS: support AES cipher suites (RFC3268).
|
||||
|
||||
### Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003] ###
|
||||
### Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]
|
||||
|
||||
* Security: fix various ASN1 parsing bugs.
|
||||
* SSL/TLS protocol fix for unrequested client certificates.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003] ###
|
||||
### Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]
|
||||
|
||||
* Security: counter the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack
|
||||
* Security: make RSA blinding default.
|
||||
* Build: shared library support fixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003] ###
|
||||
### Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]
|
||||
|
||||
* Important security related bugfixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]
|
||||
|
||||
* New configuration targets for Tandem OSS and A/UX.
|
||||
* New OIDs for Microsoft attributes.
|
||||
@@ -1094,25 +1108,25 @@ OpenSSL 0.9.x
|
||||
* Fixes for smaller building problems.
|
||||
* Updates of manuals, FAQ and other instructive documents.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]
|
||||
|
||||
* Important building fixes on Unix.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]
|
||||
|
||||
* Various important bugfixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]
|
||||
|
||||
* Important security related bugfixes.
|
||||
* Various SSL/TLS library bugfixes.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002] ###
|
||||
### Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]
|
||||
|
||||
* Various SSL/TLS library bugfixes.
|
||||
* Fix DH parameter generation for 'non-standard' generators.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001] ###
|
||||
### Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]
|
||||
|
||||
* Various SSL/TLS library bugfixes.
|
||||
* BIGNUM library fixes.
|
||||
@@ -1125,7 +1139,7 @@ OpenSSL 0.9.x
|
||||
Broadcom and Cryptographic Appliance's keyserver
|
||||
[in 0.9.6c-engine release].
|
||||
|
||||
### Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001] ###
|
||||
### Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001]
|
||||
|
||||
* Security fix: PRNG improvements.
|
||||
* Security fix: RSA OAEP check.
|
||||
@@ -1142,7 +1156,7 @@ OpenSSL 0.9.x
|
||||
* Increase default size for BIO buffering filter.
|
||||
* Compatibility fixes in some scripts.
|
||||
|
||||
### Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001] ###
|
||||
### Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]
|
||||
|
||||
* Security fix: change behavior of OpenSSL to avoid using
|
||||
environment variables when running as root.
|
||||
@@ -1167,7 +1181,7 @@ OpenSSL 0.9.x
|
||||
* New function BN_rand_range().
|
||||
* Add "-rand" option to openssl s_client and s_server.
|
||||
|
||||
### Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000] ###
|
||||
### Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000]
|
||||
|
||||
* Some documentation for BIO and SSL libraries.
|
||||
* Enhanced chain verification using key identifiers.
|
||||
@@ -1182,7 +1196,7 @@ OpenSSL 0.9.x
|
||||
[1] The support for external crypto devices is currently a separate
|
||||
distribution. See the file README.ENGINE.
|
||||
|
||||
### Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000] ###
|
||||
### Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000]
|
||||
|
||||
* Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
|
||||
* Shared library support for HPUX and Solaris-gcc
|
||||
@@ -1191,7 +1205,7 @@ OpenSSL 0.9.x
|
||||
* New 'rand' application
|
||||
* New way to check for existence of algorithms from scripts
|
||||
|
||||
### Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000] ###
|
||||
### Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000]
|
||||
|
||||
* S/MIME support in new 'smime' command
|
||||
* Documentation for the OpenSSL command line application
|
||||
@@ -1227,7 +1241,7 @@ OpenSSL 0.9.x
|
||||
* Enhanced support for Alpha Linux
|
||||
* Experimental MacOS support
|
||||
|
||||
### Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999] ###
|
||||
### Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]
|
||||
|
||||
* Transparent support for PKCS#8 format private keys: these are used
|
||||
by several software packages and are more secure than the standard
|
||||
@@ -1238,7 +1252,7 @@ OpenSSL 0.9.x
|
||||
* New pipe-like BIO that allows using the SSL library when actual I/O
|
||||
must be handled by the application (BIO pair)
|
||||
|
||||
### Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999] ###
|
||||
### Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999]
|
||||
|
||||
* Lots of enhancements and cleanups to the Configuration mechanism
|
||||
* RSA OEAP related fixes
|
||||
@@ -1253,7 +1267,7 @@ OpenSSL 0.9.x
|
||||
* Sparc assembler bignum implementation, optimized hash functions
|
||||
* Option to disable selected ciphers
|
||||
|
||||
### Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999] ###
|
||||
### Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]
|
||||
|
||||
* Fixed a security hole related to session resumption
|
||||
* Fixed RSA encryption routines for the p < q case
|
||||
@@ -1276,7 +1290,7 @@ OpenSSL 0.9.x
|
||||
* Lots of memory leak fixes.
|
||||
* Lots of bug fixes.
|
||||
|
||||
### Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998] ###
|
||||
### Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]
|
||||
|
||||
* Integration of the popular NO_RSA/NO_DSA patches
|
||||
* Initial support for compression inside the SSL record layer
|
||||
@@ -1288,13 +1302,12 @@ OpenSSL 0.9.x
|
||||
* Adjustments of the source tree for CVS
|
||||
* Support for various new platforms
|
||||
|
||||
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[CVE-2019-1563]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1563
|
||||
[CVE-2019-1559]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1559
|
||||
[CVE-2019-1552]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1552
|
||||
[CVE-2019-1551]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1551
|
||||
[CVE-2019-1549]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1549
|
||||
[CVE-2019-1547]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1547
|
||||
[CVE-2019-1543]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1543
|
||||
|
||||
+8
-8
@@ -24,7 +24,7 @@
|
||||
need to know the prefix to extend your PATH, in order to invoke
|
||||
$(CROSS_COMPILE)clang [*gcc on NDK 19 and lower] and company. (Configure
|
||||
will fail and give you a hint if you get it wrong.) Apart from PATH
|
||||
adjustment you need to set ANDROID_NDK_HOME environment to point at the
|
||||
adjustment you need to set ANDROID_NDK_ROOT environment to point at the
|
||||
NDK directory. If you're using a side-by-side NDK the path will look
|
||||
something like /some/where/android-sdk/ndk/<ver>, and for a standalone
|
||||
NDK the path will be something like /some/where/android-ndk-<ver>.
|
||||
@@ -35,21 +35,21 @@
|
||||
with N being the numerical value of the target platform version. For example,
|
||||
to compile for Android 10 arm64 with a side-by-side NDK r20.0.5594570
|
||||
|
||||
export ANDROID_NDK_HOME=/home/whoever/Android/android-sdk/ndk/20.0.5594570
|
||||
PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
|
||||
export ANDROID_NDK_ROOT=/home/whoever/Android/android-sdk/ndk/20.0.5594570
|
||||
PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
|
||||
./Configure android-arm64 -D__ANDROID_API__=29
|
||||
make
|
||||
|
||||
Older versions of the NDK have GCC under their common prebuilt tools directory, so the bin path
|
||||
will be slightly different. EG: to compile for ICS on ARM with NDK 10d:
|
||||
|
||||
export ANDROID_NDK_HOME=/some/where/android-ndk-10d
|
||||
PATH=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
|
||||
export ANDROID_NDK_ROOT=/some/where/android-ndk-10d
|
||||
PATH=$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
|
||||
./Configure android-arm -D__ANDROID_API__=14
|
||||
make
|
||||
|
||||
Caveat lector! Earlier OpenSSL versions relied on additional CROSS_SYSROOT
|
||||
variable set to $ANDROID_NDK_HOME/platforms/android-<api>/arch-<arch> to
|
||||
variable set to $ANDROID_NDK_ROOT/platforms/android-<api>/arch-<arch> to
|
||||
appoint headers-n-libraries' location. It's still recognized in order
|
||||
to facilitate migration from older projects. However, since API level
|
||||
appears in CROSS_SYSROOT value, passing -D__ANDROID_API__=N can be in
|
||||
@@ -64,9 +64,9 @@
|
||||
|
||||
Another option is to create so called "standalone toolchain" tailored
|
||||
for single specific platform including Android API level, and assign its
|
||||
location to ANDROID_NDK_HOME. In such case you have to pass matching
|
||||
location to ANDROID_NDK_ROOT. In such case you have to pass matching
|
||||
target name to Configure and shouldn't use -D__ANDROID_API__=N. PATH
|
||||
adjustment becomes simpler, $ANDROID_NDK_HOME/bin:$PATH suffices.
|
||||
adjustment becomes simpler, $ANDROID_NDK_ROOT/bin:$PATH suffices.
|
||||
|
||||
Running tests (on Linux)
|
||||
------------------------
|
||||
|
||||
+5
-3
@@ -35,9 +35,11 @@
|
||||
MinGW and Cygwin. The key recommendation is to use "matching" Perl,
|
||||
one that matches build environment. For example, if you will build
|
||||
on Cygwin be sure to use the Cygwin package manager to install Perl.
|
||||
For MSYS builds use the MSYS provided Perl. For VC-* builds we
|
||||
recommend ActiveState Perl, available from
|
||||
http://www.activestate.com/ActivePerl.
|
||||
For MSYS builds use the MSYS provided Perl.
|
||||
For VC-* builds we recommend Strawberry Perl, from http://strawberryperl.com.
|
||||
An alternative is ActiveState Perl, from http://www.activestate.com/ActivePerl
|
||||
for which you may need to explicitly select the Perl module Win32/Console.pm
|
||||
available via https://platform.activestate.com/ActiveState.
|
||||
|
||||
Notes on Perl on VMS
|
||||
--------------------
|
||||
|
||||
@@ -1,58 +1,74 @@
|
||||
|
||||
NOTES FOR THE WINDOWS PLATFORMS
|
||||
===============================
|
||||
NOTES FOR WINDOWS PLATFORMS
|
||||
===========================
|
||||
|
||||
Windows targets can be classified as "native", ones that use Windows API
|
||||
directly, and "hosted" which rely on POSIX-compatible layer. "Native"
|
||||
targets are VC-* (where "VC" stems from abbreviating Microsoft Visual C
|
||||
compiler) and mingw[64]. "Hosted" platforms are Cygwin and MSYS[2]. Even
|
||||
though the latter is not directly supported by OpenSSL Team, it's #1
|
||||
popular choice for building MinGW targets. In the nutshell MinGW builds
|
||||
are always cross-compiled. On Linux and Cygwin they look exactly as such
|
||||
and require --cross-compile-prefix option. While on MSYS[2] it's solved
|
||||
rather by placing gcc that produces "MinGW binary" code 1st on $PATH.
|
||||
This is customarily source of confusion. "Hosted" applications "live" in
|
||||
emulated file system name space with POSIX-y root, mount points, /dev
|
||||
and even /proc. Confusion is intensified by the fact that MSYS2 shell
|
||||
(or rather emulated execve(2) call) examines the binary it's about to
|
||||
start, and if it's found *not* to be linked with MSYS2 POSIX-y thing,
|
||||
command line arguments that look like file names get translated from
|
||||
emulated name space to "native". For example '/c/some/where' becomes
|
||||
'c:\some\where', '/dev/null' - 'nul'. This creates an illusion that
|
||||
there is no difference between MSYS2 shell and "MinGW binary", but
|
||||
there is. Just keep in mind that "MinGW binary" "experiences" Windows
|
||||
system in exactly same way as one produced by VC, and in its essence
|
||||
is indistinguishable from the latter. (Which by the way is why
|
||||
it's referred to in quotes here, as "MinGW binary", it's just as
|
||||
"native" as it can get.)
|
||||
There are various options to build and run OpenSSL on the Windows platforms.
|
||||
|
||||
Visual C++ builds, a.k.a. VC-*
|
||||
==============================
|
||||
"Native" OpenSSL uses the Windows APIs directly at run time.
|
||||
To build a native OpenSSL you can either use:
|
||||
|
||||
Microsoft Visual C++ (MSVC) C compiler on the command line
|
||||
or
|
||||
MinGW cross compiler
|
||||
run on the GNU-like development environment MSYS2
|
||||
or run on Linux or Cygwin
|
||||
|
||||
"Hosted" OpenSSL relies on an external POSIX compatibility layer
|
||||
for building (using GNU/Unix shell, compiler, and tools) and at run time.
|
||||
For this option you can use Cygwin.
|
||||
|
||||
|
||||
Visual C++ native builds, a.k.a. VC-*
|
||||
=====================================
|
||||
|
||||
Requirement details
|
||||
-------------------
|
||||
|
||||
In addition to the requirements and instructions listed in INSTALL,
|
||||
In addition to the requirements and instructions listed in INSTALL.md,
|
||||
these are required as well:
|
||||
|
||||
- Perl. We recommend ActiveState Perl, available from
|
||||
https://www.activestate.com/ActivePerl. Another viable alternative
|
||||
appears to be Strawberry Perl, http://strawberryperl.com.
|
||||
You also need the perl module Text::Template, available on CPAN.
|
||||
Please read NOTES.PERL for more information.
|
||||
- Perl.
|
||||
We recommend Strawberry Perl, available from http://strawberryperl.com/
|
||||
Please read NOTES.PERL for more information, including the use of CPAN.
|
||||
An alternative is ActiveState Perl, https://www.activestate.com/ActivePerl
|
||||
for which you may need to explicitly build the Perl module Win32/Console.pm
|
||||
via https://platform.activestate.com/ActiveState and then download it.
|
||||
|
||||
- Microsoft Visual C compiler. Since we can't test them all, there is
|
||||
unavoidable uncertainty about which versions are supported. Latest
|
||||
version along with couple of previous are certainly supported. On
|
||||
the other hand oldest one is known not to work. Everything between
|
||||
falls into best-effort category.
|
||||
- Microsoft Visual C compiler.
|
||||
Since these are proprietary and ever-changing we cannot test them all.
|
||||
Older versions may not work. Use a recent version wherever possible.
|
||||
|
||||
- Netwide Assembler, a.k.a. NASM, available from https://www.nasm.us,
|
||||
is required. Note that NASM is the only supported assembler. Even
|
||||
though Microsoft provided assembler is NOT supported, contemporary
|
||||
64-bit version is exercised through continuous integration of
|
||||
VC-WIN64A-masm target.
|
||||
- Netwide Assembler (NASM), available from https://www.nasm.us
|
||||
Note that NASM is the only supported assembler.
|
||||
|
||||
Quick start
|
||||
-----------
|
||||
|
||||
1. Install Perl
|
||||
|
||||
2. Install NASM
|
||||
|
||||
3. Make sure both Perl and NASM are on your %PATH%
|
||||
|
||||
4. Use Visual Studio Developer Command Prompt with administrative privileges,
|
||||
choosing one of its variants depending on the intended architecture.
|
||||
Or run "cmd" and execute "vcvarsall.bat" with one of the options x86,
|
||||
x86_amd64, x86_arm, x86_arm64, amd64, amd64_x86, amd64_arm, or amd64_arm64.
|
||||
This sets up the environment variables needed for nmake.exe, cl.exe, etc.
|
||||
See also https://docs.microsoft.com/cpp/build/building-on-the-command-line
|
||||
|
||||
5. From the root of the OpenSSL source directory enter
|
||||
perl Configure VC-WIN32 if you want 32-bit OpenSSL or
|
||||
perl Configure VC-WIN64A if you want 64-bit OpenSSL
|
||||
|
||||
6. nmake
|
||||
|
||||
7. nmake test
|
||||
|
||||
8. nmake install
|
||||
|
||||
For the full installation instructions, or if anything goes wrong at any stage,
|
||||
check the INSTALL.md file.
|
||||
|
||||
Installation directories
|
||||
------------------------
|
||||
@@ -83,7 +99,6 @@
|
||||
is, of course, to choose a different set of directories by using
|
||||
--prefix and --openssldir when configuring.
|
||||
|
||||
|
||||
Special notes for Universal Windows Platform builds, a.k.a. VC-*-UWP
|
||||
--------------------------------------------------------------------
|
||||
|
||||
@@ -91,33 +106,56 @@
|
||||
|
||||
- You should define the platform type to "uwp" and the target arch via
|
||||
"vcvarsall.bat" before you compile. For example, if you want to build
|
||||
"arm64" builds, you should type "vcvarsall.bat x86_arm64 uwp".
|
||||
"arm64" builds, you should run "vcvarsall.bat x86_arm64 uwp".
|
||||
|
||||
mingw and mingw64
|
||||
=================
|
||||
|
||||
* MSYS2 shell and development environment installation:
|
||||
Native OpenSSL built using MinGW
|
||||
================================
|
||||
|
||||
Download MSYS2 from https://msys2.github.io/ and follow installation
|
||||
instructions. Once up and running install even make, perl, (git if
|
||||
needed,) mingw-w64-i686-gcc and/or mingw-w64-x86_64-gcc. You should
|
||||
have corresponding MinGW items on your start menu, use *them*, not
|
||||
generic MSYS2. As implied in opening note, difference between them
|
||||
is which compiler is found 1st on $PATH. At this point ./config
|
||||
should recognize correct target, roll as if it was Unix...
|
||||
MinGW offers an alternative way to build native OpenSSL, by cross compilation.
|
||||
|
||||
* It is also possible to build mingw[64] on Linux or Cygwin by
|
||||
configuring with corresponding --cross-compile-prefix= option. For
|
||||
example
|
||||
* Usually the build is done on Windows in a GNU-like environment called MSYS2.
|
||||
|
||||
MSYS2 provides GNU tools, a Unix-like command prompt,
|
||||
and a UNIX compatibility layer for applications.
|
||||
However in this context it is only used for building OpenSSL.
|
||||
The resulting OpenSSL does not rely on MSYS2 to run and is fully native.
|
||||
|
||||
Requirement details
|
||||
|
||||
- MSYS2 shell, from https://www.msys2.org/
|
||||
|
||||
- Perl, at least version 5.10.0, which usually comes pre-installed with MSYS2
|
||||
|
||||
- make, installed using "pacman -S make" into the MSYS2 environment
|
||||
|
||||
- MinGW[64] compiler: mingw-w64-i686-gcc and/or mingw-w64-x86_64-gcc.
|
||||
These compilers must be on your MSYS2 $PATH.
|
||||
A common error is to not have these on your $PATH.
|
||||
The MSYS2 version of gcc will not work correctly here.
|
||||
|
||||
In the MSYS2 shell do the configuration depending on the target architecture:
|
||||
|
||||
./Configure mingw ...
|
||||
or
|
||||
./Configure mingw64 ...
|
||||
or
|
||||
./config ...
|
||||
for the default architecture.
|
||||
|
||||
Apart from that, follow the Unix / Linux instructions in INSTALL.md.
|
||||
|
||||
* It is also possible to build mingw[64] on Linux or Cygwin.
|
||||
|
||||
In this case configure with the corresponding --cross-compile-prefix= option.
|
||||
For example
|
||||
|
||||
./Configure mingw --cross-compile-prefix=i686-w64-mingw32- ...
|
||||
|
||||
or
|
||||
|
||||
./Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32- ...
|
||||
|
||||
This naturally implies that you've installed corresponding add-on
|
||||
packages.
|
||||
This requires that you've installed the necessary add-on packages for
|
||||
mingw[64] cross compilation.
|
||||
|
||||
Linking your application
|
||||
========================
|
||||
@@ -146,28 +184,29 @@
|
||||
}
|
||||
|
||||
If you link with OpenSSL .DLLs, then you're expected to include into
|
||||
your application code small "shim" snippet, which provides glue between
|
||||
OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
|
||||
manual page for further details.
|
||||
your application code a small "shim" snippet, which provides
|
||||
the glue between the OpenSSL BIO layer and your compiler run-time.
|
||||
See also the OPENSSL_Applink manual page.
|
||||
|
||||
Cygwin, "hosted" environment
|
||||
============================
|
||||
|
||||
Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
|
||||
Windows subsystem and provides a bash shell and GNU tools environment.
|
||||
Consequently, a make of OpenSSL with Cygwin is virtually identical to the
|
||||
Hosted OpenSSL built using Cygwin
|
||||
=================================
|
||||
|
||||
Cygwin implements a POSIX/Unix runtime system (cygwin1.dll) on top of the
|
||||
Windows subsystem and provides a Bash shell and GNU tools environment.
|
||||
Consequently, a build of OpenSSL with Cygwin is virtually identical to the
|
||||
Unix procedure.
|
||||
|
||||
To build OpenSSL using Cygwin, you need to:
|
||||
|
||||
* Install Cygwin (see https://cygwin.com/)
|
||||
* Install Cygwin, see https://cygwin.com/
|
||||
|
||||
* Install Cygwin Perl and ensure it is in the path. Recall that
|
||||
as least 5.10.0 is required.
|
||||
* Install Cygwin Perl, at least version 5.10.0
|
||||
and ensure it is in the $PATH
|
||||
|
||||
* Run the Cygwin bash shell
|
||||
* Run the Cygwin Bash shell
|
||||
|
||||
Apart from that, follow the Unix instructions in INSTALL.
|
||||
Apart from that, follow the Unix / Linux instructions in INSTALL.md.
|
||||
|
||||
NOTE: "make test" and normal file operations may fail in directories
|
||||
mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
Welcome to the OpenSSL Project
|
||||
==============================
|
||||
|
||||
[![openssl logo][]][www.openssl.org]
|
||||
|
||||
[![travis badge][]][travis jobs]
|
||||
[![appveyor badge][]][appveyor jobs]
|
||||
|
||||
|
||||
|
||||
Welcome to the OpenSSL Project
|
||||
==============================
|
||||
|
||||
OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit
|
||||
for the Transport Layer Security (TLS) protocol formerly known as the
|
||||
Secure Sockets Layer (SSL) protocol. The protocol implementation is based
|
||||
@@ -19,7 +17,6 @@ and Tim J. Hudson.
|
||||
|
||||
The official Home Page of the OpenSSL Project is [www.openssl.org][].
|
||||
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
|
||||
@@ -47,13 +44,13 @@ The OpenSSL toolkit includes:
|
||||
- **openssl**
|
||||
the OpenSSL command line tool, a swiss army knife for cryptographic tasks,
|
||||
testing and analyzing. It can be used for
|
||||
- creation of key parameters
|
||||
- creation of X.509 certificates, CSRs and CRLs
|
||||
- calculation of message digests
|
||||
- encryption and decryption
|
||||
- SSL/TLS client and server tests
|
||||
- handling of S/MIME signed or encrypted mail
|
||||
- and more...
|
||||
- creation of key parameters
|
||||
- creation of X.509 certificates, CSRs and CRLs
|
||||
- calculation of message digests
|
||||
- encryption and decryption
|
||||
- SSL/TLS client and server tests
|
||||
- handling of S/MIME signed or encrypted mail
|
||||
- and more...
|
||||
|
||||
Download
|
||||
========
|
||||
@@ -70,7 +67,6 @@ of the OpenSSL toolkit are available. In particular on Linux and other
|
||||
Unix operating systems it is normally recommended to link against the
|
||||
precompiled shared libraries provided by the distributor or vendor.
|
||||
|
||||
|
||||
For Testing and Development
|
||||
---------------------------
|
||||
|
||||
@@ -86,22 +82,21 @@ which is updated automatically from the former on every commit.
|
||||
A local copy of the Git Repository can be obtained by cloning it from
|
||||
the original OpenSSL repository using
|
||||
|
||||
git clone git://git.openssl.org/openssl.git
|
||||
git clone git://git.openssl.org/openssl.git
|
||||
|
||||
or from the GitHub mirror using
|
||||
|
||||
git clone https://github.com/openssl/openssl.git
|
||||
git clone https://github.com/openssl/openssl.git
|
||||
|
||||
If you intend to contribute to OpenSSL, either to fix bugs or contribute
|
||||
new features, you need to fork the OpenSSL repository openssl/openssl on
|
||||
GitHub and clone your public fork instead.
|
||||
|
||||
git clone https://github.com/yourname/openssl.git
|
||||
git clone https://github.com/yourname/openssl.git
|
||||
|
||||
This is necessary, because all development of OpenSSL nowadays is done via
|
||||
GitHub pull requests. For more details, see [Contributing](#contributing).
|
||||
|
||||
|
||||
Build and Install
|
||||
=================
|
||||
|
||||
@@ -118,6 +113,9 @@ document.
|
||||
* [NOTES.VMS](NOTES.VMS)
|
||||
* [NOTES.WIN](NOTES.WIN)
|
||||
|
||||
Specific notes on upgrading to OpenSSL 3.0 from previous versions, as well as
|
||||
known issues are available on the OpenSSL
|
||||
[wiki](https://wiki.openssl.org/index.php/OpenSSL_3.0).
|
||||
|
||||
Documentation
|
||||
=============
|
||||
@@ -163,7 +161,6 @@ platform. The OpenSSL Project Pages at [openssl.github.io][] are a
|
||||
valuable source of information if you want to get familiar with our
|
||||
development process on GitHub.
|
||||
|
||||
|
||||
Legalities
|
||||
==========
|
||||
|
||||
@@ -171,7 +168,6 @@ A number of nations restrict the use or export of cryptography. If you are
|
||||
potentially subject to such restrictions you should seek legal advice before
|
||||
attempting to develop or distribute cryptographic code.
|
||||
|
||||
|
||||
Copyright
|
||||
=========
|
||||
|
||||
@@ -181,37 +177,34 @@ Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[www.openssl.org]:
|
||||
https://www.openssl.org
|
||||
<https://www.openssl.org>
|
||||
"OpenSSL Homepage"
|
||||
|
||||
[git.openssl.org]:
|
||||
https://git.openssl.org
|
||||
<https://git.openssl.org>
|
||||
"OpenSSL Git Repository"
|
||||
|
||||
[git.openssl.org]:
|
||||
https://git.openssl.org
|
||||
<https://git.openssl.org>
|
||||
"OpenSSL Git Repository"
|
||||
|
||||
[github.com/openssl/openssl]:
|
||||
https://github.com/openssl/openssl
|
||||
<https://github.com/openssl/openssl>
|
||||
"OpenSSL GitHub Mirror"
|
||||
|
||||
[openssl.github.io]:
|
||||
https://mspncp.github.io
|
||||
<https://mspncp.github.io>
|
||||
"OpenSSL Project Pages"
|
||||
|
||||
[wiki.openssl.org]:
|
||||
https://wiki.openssl.org
|
||||
<https://wiki.openssl.org>
|
||||
"OpenSSL Wiki"
|
||||
|
||||
|
||||
[RFC 8446]:
|
||||
https://tools.ietf.org/html/rfc8446
|
||||
|
||||
<https://tools.ietf.org/html/rfc8446>
|
||||
|
||||
<!-- Logos and Badges -->
|
||||
<!--
|
||||
@@ -227,17 +220,17 @@ All rights reserved.
|
||||
"OpenSSL Logo"
|
||||
|
||||
[travis badge]:
|
||||
https://travis-ci.org/openssl/openssl.svg?branch=master
|
||||
<https://travis-ci.org/openssl/openssl.svg?branch=master>
|
||||
"Travis Build Status"
|
||||
|
||||
[travis jobs]:
|
||||
https://travis-ci.org/openssl/openssl
|
||||
<https://travis-ci.org/openssl/openssl>
|
||||
"Travis Jobs"
|
||||
|
||||
[appveyor badge]:
|
||||
https://ci.appveyor.com/api/projects/status/ikn2l4u1xsume63u/branch/master?svg=true
|
||||
<https://ci.appveyor.com/api/projects/status/ikn2l4u1xsume63u/branch/master?svg=true>
|
||||
"AppVeyor Build Status"
|
||||
|
||||
[appveyor jobs]:
|
||||
https://ci.appveyor.com/project/openssl/openssl/branch/master
|
||||
<https://ci.appveyor.com/project/openssl/openssl/branch/master>
|
||||
"AppVeyor Jobs"
|
||||
+2
-13
@@ -1,4 +1,3 @@
|
||||
|
||||
OpenSSL User Support resources
|
||||
==============================
|
||||
|
||||
@@ -7,7 +6,7 @@ _Under Construction; not more than a collection of text fragments yet._
|
||||
See the OpenSSL website www.openssl.org for details on how to obtain
|
||||
commercial technical support. Free community support is available through the
|
||||
openssl-users email list (see
|
||||
https://www.openssl.org/community/mailinglists.html for further details).
|
||||
<https://www.openssl.org/community/mailinglists.html for> further details).
|
||||
|
||||
If you have any problems with OpenSSL then please take the following steps
|
||||
first:
|
||||
@@ -32,8 +31,6 @@ Just because something doesn't work the way you expect does not mean it
|
||||
is necessarily a bug in OpenSSL. Use the openssl-users email list for this type
|
||||
of query.
|
||||
|
||||
|
||||
|
||||
For *questions* on how to use OpenSSL or what went wrong when you
|
||||
tried something, our primary resource is the mailing list
|
||||
openssl-users@openssl.org, where you can get help from others in the
|
||||
@@ -41,10 +38,7 @@ OpenSSL community (which includes the developers as time permits).
|
||||
|
||||
Only subscribers can post to openssl-users@openssl.org (although the
|
||||
archives are public).
|
||||
For more information, see https://www.openssl.org/community/mailinglists.html
|
||||
|
||||
|
||||
|
||||
For more information, see <https://www.openssl.org/community/mailinglists.html>
|
||||
|
||||
You have general questions about using OpenSSL
|
||||
----------------------------------------------
|
||||
@@ -97,10 +91,6 @@ pull request. The details are covered in the [Contributing](#contributing) secti
|
||||
Don't hesitate to open a pull request, even if it's only a small change
|
||||
like a grammatical or typographical error in the documentation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mailing Lists
|
||||
=============
|
||||
|
||||
@@ -121,7 +111,6 @@ The openssl-dev list has been discontinued since development is now taking
|
||||
place in form of GitHub pull requests. Although not active anymore, the
|
||||
searchable archive may still contain useful information.
|
||||
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[mailing lists]: https://www.openssl.org/community/mailinglists.html
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MAJOR=3
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
PRE_RELEASE_TAG=dev
|
||||
PRE_RELEASE_TAG=alpha4-dev
|
||||
BUILD_METADATA=
|
||||
RELEASE_DATE=
|
||||
RELEASE_DATE=""
|
||||
SHLIB_VERSION=3
|
||||
+76
-56
@@ -1,5 +1,5 @@
|
||||
#!{- $config{HASHBANGPERL} -}
|
||||
# Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2000-2020 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
|
||||
@@ -14,57 +14,63 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $openssl = "openssl";
|
||||
if(defined $ENV{'OPENSSL'}) {
|
||||
$openssl = $ENV{'OPENSSL'};
|
||||
} else {
|
||||
$ENV{'OPENSSL'} = $openssl;
|
||||
}
|
||||
|
||||
my $verbose = 1;
|
||||
my @OPENSSL_CMDS = ("req", "ca", "pkcs12", "x509", "verify");
|
||||
|
||||
my $OPENSSL_CONFIG = $ENV{"OPENSSL_CONFIG"} || "";
|
||||
my $DAYS = "-days 365";
|
||||
my $CADAYS = "-days 1095"; # 3 years
|
||||
my $openssl = $ENV{'OPENSSL'} // "openssl";
|
||||
$ENV{'OPENSSL'} = $openssl;
|
||||
my $OPENSSL_CONFIG = $ENV{"OPENSSL_CONFIG"} // "";
|
||||
|
||||
# Command invocations.
|
||||
my $REQ = "$openssl req $OPENSSL_CONFIG";
|
||||
my $CA = "$openssl ca $OPENSSL_CONFIG";
|
||||
my $VERIFY = "$openssl verify";
|
||||
my $X509 = "$openssl x509";
|
||||
my $PKCS12 = "$openssl pkcs12";
|
||||
|
||||
# default openssl.cnf file has setup as per the following
|
||||
# Default values for various configuration settings.
|
||||
my $CATOP = "./demoCA";
|
||||
my $CAKEY = "cakey.pem";
|
||||
my $CAREQ = "careq.pem";
|
||||
my $CACERT = "cacert.pem";
|
||||
my $CACRL = "crl.pem";
|
||||
my $DIRMODE = 0777;
|
||||
|
||||
my $DAYS = "-days 365";
|
||||
my $CADAYS = "-days 1095"; # 3 years
|
||||
my $NEWKEY = "newkey.pem";
|
||||
my $NEWREQ = "newreq.pem";
|
||||
my $NEWCERT = "newcert.pem";
|
||||
my $NEWP12 = "newcert.p12";
|
||||
my $RET = 0;
|
||||
my $WHAT = shift @ARGV || "";
|
||||
my @OPENSSL_CMDS = ("req", "ca", "pkcs12", "x509", "verify");
|
||||
my %EXTRA = extra_args(\@ARGV, "-extra-");
|
||||
my $FILE;
|
||||
|
||||
sub extra_args {
|
||||
my ($args_ref, $arg_prefix) = @_;
|
||||
my %eargs = map {
|
||||
if ($_ < $#$args_ref) {
|
||||
my ($arg, $value) = splice(@$args_ref, $_, 2);
|
||||
$arg =~ s/$arg_prefix//;
|
||||
($arg, $value);
|
||||
} else {
|
||||
();
|
||||
}
|
||||
} reverse grep($$args_ref[$_] =~ /$arg_prefix/, 0..$#$args_ref);
|
||||
my %empty = map { ($_, "") } @OPENSSL_CMDS;
|
||||
return (%empty, %eargs);
|
||||
# Commandline parsing
|
||||
my %EXTRA;
|
||||
my $WHAT = shift @ARGV || "";
|
||||
@ARGV = parse_extra(@ARGV);
|
||||
my $RET = 0;
|
||||
|
||||
# Split out "-extra-CMD value", and return new |@ARGV|. Fill in
|
||||
# |EXTRA{CMD}| with list of values.
|
||||
sub parse_extra
|
||||
{
|
||||
foreach ( @OPENSSL_CMDS ) {
|
||||
$EXTRA{$_} = '';
|
||||
}
|
||||
|
||||
my @result;
|
||||
while ( scalar(@_) > 0 ) {
|
||||
my $arg = shift;
|
||||
if ( $arg !~ m/-extra-([a-z0-9]+)/ ) {
|
||||
push @result, $arg;
|
||||
next;
|
||||
}
|
||||
$arg =~ s/-extra-//;
|
||||
die("Unknown \"-${arg}-extra\" option, exiting")
|
||||
unless scalar grep { $arg eq $_ } @OPENSSL_CMDS;
|
||||
$EXTRA{$arg} .= " " . shift;
|
||||
}
|
||||
return @result;
|
||||
}
|
||||
|
||||
|
||||
# See if reason for a CRL entry is valid; exit if not.
|
||||
sub crl_reason_ok
|
||||
{
|
||||
@@ -113,19 +119,25 @@ sub run
|
||||
|
||||
|
||||
if ( $WHAT =~ /^(-\?|-h|-help)$/ ) {
|
||||
print STDERR "usage: CA.pl -newcert | -newreq | -newreq-nodes | -xsign | -sign | -signCA | -signcert | -crl | -newca [-extra-cmd extra-params]\n";
|
||||
print STDERR " CA.pl -pkcs12 [-extra-pkcs12 extra-params] [certname]\n";
|
||||
print STDERR " CA.pl -verify [-extra-verify extra-params] certfile ...\n";
|
||||
print STDERR " CA.pl -revoke [-extra-ca extra-params] certfile [reason]\n";
|
||||
print STDERR <<EOF;
|
||||
Usage:
|
||||
CA.pl -newcert | -newreq | -newreq-nodes | -xsign | -sign | -signCA | -signcert | -crl | -newca [-extra-cmd parameter]
|
||||
CA.pl -pkcs12 [-extra-pkcs12 parameter] [certname]
|
||||
CA.pl -verify [-extra-verify parameter] certfile ...
|
||||
CA.pl -revoke [-extra-ca parameter] certfile [reason]
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($WHAT eq '-newcert' ) {
|
||||
# create a certificate
|
||||
$RET = run("$REQ -new -x509 -keyout $NEWKEY -out $NEWCERT $DAYS $EXTRA{req}");
|
||||
$RET = run("$REQ -new -x509 -keyout $NEWKEY -out $NEWCERT $DAYS"
|
||||
. " $EXTRA{req}");
|
||||
print "Cert is in $NEWCERT, private key is in $NEWKEY\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-precert' ) {
|
||||
# create a pre-certificate
|
||||
$RET = run("$REQ -x509 -precert -keyout $NEWKEY -out $NEWCERT $DAYS");
|
||||
$RET = run("$REQ -x509 -precert -keyout $NEWKEY -out $NEWCERT $DAYS"
|
||||
. " $EXTRA{req}");
|
||||
print "Pre-cert is in $NEWCERT, private key is in $NEWKEY\n" if $RET == 0;
|
||||
} elsif ($WHAT =~ /^\-newreq(\-nodes)?$/ ) {
|
||||
# create a certificate request
|
||||
@@ -133,11 +145,20 @@ if ($WHAT eq '-newcert' ) {
|
||||
print "Request is in $NEWREQ, private key is in $NEWKEY\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-newca' ) {
|
||||
# create the directory hierarchy
|
||||
mkdir ${CATOP}, $DIRMODE;
|
||||
mkdir "${CATOP}/certs", $DIRMODE;
|
||||
mkdir "${CATOP}/crl", $DIRMODE ;
|
||||
mkdir "${CATOP}/newcerts", $DIRMODE;
|
||||
mkdir "${CATOP}/private", $DIRMODE;
|
||||
my @dirs = ( "${CATOP}", "${CATOP}/certs", "${CATOP}/crl",
|
||||
"${CATOP}/newcerts", "${CATOP}/private" );
|
||||
die "${CATOP}/index.txt exists.\nRemove old sub-tree to proceed,"
|
||||
if -f "${CATOP}/index.txt";
|
||||
die "${CATOP}/serial exists.\nRemove old sub-tree to proceed,"
|
||||
if -f "${CATOP}/serial";
|
||||
foreach my $d ( @dirs ) {
|
||||
if ( -d $d ) {
|
||||
warn "Directory $d exists" if -d $d;
|
||||
} else {
|
||||
mkdir $d or die "Can't mkdir $d, $!";
|
||||
}
|
||||
}
|
||||
|
||||
open OUT, ">${CATOP}/index.txt";
|
||||
close OUT;
|
||||
open OUT, ">${CATOP}/crlnumber";
|
||||
@@ -145,6 +166,7 @@ if ($WHAT eq '-newcert' ) {
|
||||
close OUT;
|
||||
# ask user for existing CA certificate
|
||||
print "CA certificate filename (or enter to create)\n";
|
||||
my $FILE;
|
||||
$FILE = "" unless defined($FILE = <STDIN>);
|
||||
$FILE =~ s{\R$}{};
|
||||
if ($FILE ne "") {
|
||||
@@ -152,44 +174,42 @@ if ($WHAT eq '-newcert' ) {
|
||||
copy_pemfile($FILE,"${CATOP}/$CACERT", "CERTIFICATE");
|
||||
} else {
|
||||
print "Making CA certificate ...\n";
|
||||
$RET = run("$REQ -new -keyout"
|
||||
. " ${CATOP}/private/$CAKEY"
|
||||
$RET = run("$REQ -new -keyout ${CATOP}/private/$CAKEY"
|
||||
. " -out ${CATOP}/$CAREQ $EXTRA{req}");
|
||||
$RET = run("$CA -create_serial"
|
||||
. " -out ${CATOP}/$CACERT $CADAYS -batch"
|
||||
. " -keyfile ${CATOP}/private/$CAKEY -selfsign"
|
||||
. " -extensions v3_ca $EXTRA{ca}"
|
||||
. " -infiles ${CATOP}/$CAREQ") if $RET == 0;
|
||||
. " -extensions v3_ca"
|
||||
. " -infiles ${CATOP}/$CAREQ $EXTRA{ca}") if $RET == 0;
|
||||
print "CA certificate is in ${CATOP}/$CACERT\n" if $RET == 0;
|
||||
}
|
||||
} elsif ($WHAT eq '-pkcs12' ) {
|
||||
my $cname = $ARGV[0];
|
||||
$cname = "My Certificate" unless defined $cname;
|
||||
$RET = run("$PKCS12 -in $NEWCERT -inkey $NEWKEY"
|
||||
. " -certfile ${CATOP}/$CACERT"
|
||||
. " -out $NEWP12"
|
||||
. " -certfile ${CATOP}/$CACERT -out $NEWP12"
|
||||
. " -export -name \"$cname\" $EXTRA{pkcs12}");
|
||||
print "PKCS #12 file is in $NEWP12\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-xsign' ) {
|
||||
$RET = run("$CA -policy policy_anything $EXTRA{ca} -infiles $NEWREQ");
|
||||
$RET = run("$CA -policy policy_anything -infiles $NEWREQ $EXTRA{ca}");
|
||||
} elsif ($WHAT eq '-sign' ) {
|
||||
$RET = run("$CA -policy policy_anything -out $NEWCERT $EXTRA{ca} -infiles $NEWREQ");
|
||||
$RET = run("$CA -policy policy_anything -out $NEWCERT"
|
||||
. " -infiles $NEWREQ $EXTRA{ca}");
|
||||
print "Signed certificate is in $NEWCERT\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-signCA' ) {
|
||||
$RET = run("$CA -policy policy_anything -out $NEWCERT"
|
||||
. " -extensions v3_ca $EXTRA{ca} -infiles $NEWREQ");
|
||||
. " -extensions v3_ca -infiles $NEWREQ $EXTRA{ca}");
|
||||
print "Signed CA certificate is in $NEWCERT\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-signcert' ) {
|
||||
$RET = run("$X509 -x509toreq -in $NEWREQ -signkey $NEWREQ"
|
||||
. " -out tmp.pem $EXTRA{x509}");
|
||||
$RET = run("$CA -policy policy_anything -out $NEWCERT"
|
||||
. "$EXTRA{ca} -infiles tmp.pem") if $RET == 0;
|
||||
. "-infiles tmp.pem $EXTRA{ca}") if $RET == 0;
|
||||
print "Signed certificate is in $NEWCERT\n" if $RET == 0;
|
||||
} elsif ($WHAT eq '-verify' ) {
|
||||
my @files = @ARGV ? @ARGV : ( $NEWCERT );
|
||||
my $file;
|
||||
foreach $file (@files) {
|
||||
my $status = run("$VERIFY \"-CAfile\" ${CATOP}/$CACERT $file $EXTRA{verify}");
|
||||
foreach my $file (@files) {
|
||||
my $status = run("$VERIFY -CAfile ${CATOP}/$CACERT $file $EXTRA{verify}");
|
||||
$RET = $status if $status != 0;
|
||||
}
|
||||
} elsif ($WHAT eq '-crl' ) {
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -18,6 +18,9 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/asn1t.h>
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_INFORM, OPT_IN, OPT_OUT, OPT_INDENT, OPT_NOOUT,
|
||||
|
||||
+36
-7
@@ -13,15 +13,41 @@ ENDIF
|
||||
$OPENSSLSRC=\
|
||||
openssl.c progs.c \
|
||||
asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c \
|
||||
ec.c ecparam.c enc.c engine.c errstr.c \
|
||||
genpkey.c genrsa.c kdf.c mac.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c \
|
||||
pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c rsa.c \
|
||||
enc.c errstr.c \
|
||||
genpkey.c kdf.c mac.c nseq.c passwd.c pkcs7.c \
|
||||
pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c \
|
||||
rsautl.c s_client.c s_server.c s_time.c sess_id.c smime.c speed.c \
|
||||
spkac.c srp.c ts.c verify.c version.c x509.c rehash.c storeutl.c \
|
||||
spkac.c verify.c version.c x509.c rehash.c storeutl.c \
|
||||
list.c info.c provider.c fipsinstall.c
|
||||
IF[{- !$disabled{'deprecated-3.0'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC \
|
||||
dhparam.c dsa.c dsaparam.c gendsa.c
|
||||
IF[{- !$disabled{'des'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC pkcs12.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'ec'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC ec.c ecparam.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'ocsp'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC ocsp.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'srp'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC srp.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'ts'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC ts.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'dh'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC dhparam.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'dsa'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC dsa.c dsaparam.c gendsa.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'engine'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC engine.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'rsa'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC rsa.c genrsa.c
|
||||
ENDIF
|
||||
IF[{- !$disabled{'cmp'} -}]
|
||||
$OPENSSLSRC=$OPENSSLSRC cmp.c cmp_mock_srv.c
|
||||
ENDIF
|
||||
|
||||
IF[{- !$disabled{apps} -}]
|
||||
@@ -36,6 +62,9 @@ IF[{- !$disabled{apps} -}]
|
||||
# progs.pl tries to read all 'openssl' sources, including progs.c, so we make
|
||||
# sure things are generated in the correct order.
|
||||
DEPEND[progs.h]=progs.c
|
||||
# Because the files to look through may change (depends on $OPENSSLSRC),
|
||||
# always depend on a changed configuration.
|
||||
DEPEND[progs.c]=../configdata.pm
|
||||
|
||||
IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
|
||||
GENERATE[openssl.rc]=../util/mkrc.pl openssl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -34,6 +34,11 @@
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#ifndef W_OK
|
||||
# define F_OK 0
|
||||
# define W_OK 2
|
||||
@@ -88,18 +93,23 @@ typedef enum {
|
||||
|
||||
static char *lookup_conf(const CONF *conf, const char *group, const char *tag);
|
||||
|
||||
static int certify(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
static int certify(X509 **xret, const char *infile, int informat,
|
||||
EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, const char *subj, unsigned long chtype,
|
||||
int multirdn, int email_dn, const char *startdate,
|
||||
const char *enddate,
|
||||
long days, int batch, const char *ext_sect, CONF *conf,
|
||||
int verbose, unsigned long certopt, unsigned long nameopt,
|
||||
int default_op, int ext_copy, int selfsign,
|
||||
unsigned char *sm2_id, size_t sm2idlen);
|
||||
static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
int default_op, int ext_copy, int selfsign);
|
||||
static int certify_cert(X509 **xret, const char *infile, int informat,
|
||||
EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, const char *subj, unsigned long chtype,
|
||||
int multirdn, int email_dn, const char *startdate,
|
||||
@@ -142,13 +152,14 @@ typedef enum OPTION_choice {
|
||||
OPT_ENGINE, OPT_VERBOSE, OPT_CONFIG, OPT_NAME, OPT_SUBJ, OPT_UTF8,
|
||||
OPT_CREATE_SERIAL, OPT_MULTIVALUE_RDN, OPT_STARTDATE, OPT_ENDDATE,
|
||||
OPT_DAYS, OPT_MD, OPT_POLICY, OPT_KEYFILE, OPT_KEYFORM, OPT_PASSIN,
|
||||
OPT_KEY, OPT_CERT, OPT_SELFSIGN, OPT_IN, OPT_OUT, OPT_OUTDIR,
|
||||
OPT_KEY, OPT_CERT, OPT_CERTFORM, OPT_SELFSIGN,
|
||||
OPT_IN, OPT_INFORM, OPT_OUT, OPT_OUTDIR, OPT_VFYOPT,
|
||||
OPT_SIGOPT, OPT_NOTEXT, OPT_BATCH, OPT_PRESERVEDN, OPT_NOEMAILDN,
|
||||
OPT_GENCRL, OPT_MSIE_HACK, OPT_CRLDAYS, OPT_CRLHOURS, OPT_CRLSEC,
|
||||
OPT_INFILES, OPT_SS_CERT, OPT_SPKAC, OPT_REVOKE, OPT_VALID,
|
||||
OPT_EXTENSIONS, OPT_EXTFILE, OPT_STATUS, OPT_UPDATEDB, OPT_CRLEXTS,
|
||||
OPT_RAND_SERIAL,
|
||||
OPT_R_ENUM, OPT_SM2ID, OPT_SM2HEXID, OPT_PROV_ENUM,
|
||||
OPT_R_ENUM, OPT_PROV_ENUM,
|
||||
/* Do not change the order here; see related case statements below */
|
||||
OPT_CRL_REASON, OPT_CRL_HOLD, OPT_CRL_COMPROMISE, OPT_CRL_CA_COMPROMISE
|
||||
} OPTION_CHOICE;
|
||||
@@ -160,7 +171,8 @@ const OPTIONS ca_options[] = {
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"verbose", OPT_VERBOSE, '-', "Verbose output during processing"},
|
||||
{"outdir", OPT_OUTDIR, '/', "Where to put output cert"},
|
||||
{"in", OPT_IN, '<', "The input PEM encoded cert request(s)"},
|
||||
{"in", OPT_IN, '<', "The input cert request(s)"},
|
||||
{"inform", OPT_INFORM, 'F', "CSR input format (DER or PEM); default PEM"},
|
||||
{"infiles", OPT_INFILES, '-', "The last argument, requests to process"},
|
||||
{"out", OPT_OUT, '>', "Where to put the output file(s)"},
|
||||
{"notext", OPT_NOTEXT, '-', "Do not print the generated certificate"},
|
||||
@@ -182,7 +194,7 @@ const OPTIONS ca_options[] = {
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"subj", OPT_SUBJ, 's', "Use arg instead of request's subject"},
|
||||
{"utf8", OPT_UTF8, '-', "Input characters are UTF8 (default ASCII)"},
|
||||
{"utf8", OPT_UTF8, '-', "Input characters are UTF8; default ASCII"},
|
||||
{"create_serial", OPT_CREATE_SERIAL, '-',
|
||||
"If reading serial fails, create a new random serial"},
|
||||
{"rand_serial", OPT_RAND_SERIAL, '-',
|
||||
@@ -197,25 +209,22 @@ const OPTIONS ca_options[] = {
|
||||
"Extension section (override value in config file)"},
|
||||
{"extfile", OPT_EXTFILE, '<',
|
||||
"Configuration file with X509v3 extensions to add"},
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate request"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate request"},
|
||||
#endif
|
||||
{"preserveDN", OPT_PRESERVEDN, '-', "Don't re-order the DN"},
|
||||
{"noemailDN", OPT_NOEMAILDN, '-', "Don't add the EMAIL field to the DN"},
|
||||
|
||||
OPT_SECTION("Signing"),
|
||||
{"md", OPT_MD, 's', "md to use; one of md2, md5, sha or sha1"},
|
||||
{"keyfile", OPT_KEYFILE, 's', "Private key"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format (PEM or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format (ENGINE, other values ignored)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"key", OPT_KEY, 's', "Key to decode the private key if it is encrypted"},
|
||||
{"cert", OPT_CERT, '<', "The CA cert"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
"certificate input format (DER/PEM/P12); has no effect"},
|
||||
{"selfsign", OPT_SELFSIGN, '-',
|
||||
"Sign a cert with the key associated with it"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"vfyopt", OPT_SIGOPT, 's', "Verification parameter in n:v form"},
|
||||
|
||||
OPT_SECTION("Revocation"),
|
||||
{"gencrl", OPT_GENCRL, '-', "Generate a new CRL"},
|
||||
@@ -257,13 +266,14 @@ int ca_main(int argc, char **argv)
|
||||
CA_DB *db = NULL;
|
||||
DB_ATTR db_attr;
|
||||
STACK_OF(CONF_VALUE) *attribs = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL, *vfyopts = NULL;
|
||||
STACK_OF(X509) *cert_sk = NULL;
|
||||
X509_CRL *crl = NULL;
|
||||
const EVP_MD *dgst = NULL;
|
||||
char *configfile = default_config_file, *section = NULL;
|
||||
char *md = NULL, *policy = NULL, *keyfile = NULL;
|
||||
char *certfile = NULL, *crl_ext = NULL, *crlnumberfile = NULL, *key = NULL;
|
||||
int certformat = FORMAT_PEM, informat = FORMAT_PEM;
|
||||
const char *infile = NULL, *spkac_file = NULL, *ss_cert_file = NULL;
|
||||
const char *extensions = NULL, *extfile = NULL, *passinarg = NULL;
|
||||
char *outdir = NULL, *outfile = NULL, *rev_arg = NULL, *ser_status = NULL;
|
||||
@@ -286,9 +296,6 @@ int ca_main(int argc, char **argv)
|
||||
REVINFO_TYPE rev_type = REV_NONE;
|
||||
X509_REVOKED *r = NULL;
|
||||
OPTION_CHOICE o;
|
||||
unsigned char *sm2_id = NULL;
|
||||
size_t sm2_idlen = 0;
|
||||
int sm2_free = 0;
|
||||
|
||||
prog = opt_init(argc, argv, ca_options);
|
||||
while ((o = opt_next()) != OPT_EOF) {
|
||||
@@ -306,6 +313,10 @@ opthelp:
|
||||
req = 1;
|
||||
infile = opt_arg();
|
||||
break;
|
||||
case OPT_INFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &informat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_OUT:
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
@@ -373,6 +384,10 @@ opthelp:
|
||||
case OPT_CERT:
|
||||
certfile = opt_arg();
|
||||
break;
|
||||
case OPT_CERTFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &certformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_SELFSIGN:
|
||||
selfsign = 1;
|
||||
break;
|
||||
@@ -385,6 +400,12 @@ opthelp:
|
||||
if (sigopts == NULL || !sk_OPENSSL_STRING_push(sigopts, opt_arg()))
|
||||
goto end;
|
||||
break;
|
||||
case OPT_VFYOPT:
|
||||
if (vfyopts == NULL)
|
||||
vfyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (vfyopts == NULL || !sk_OPENSSL_STRING_push(vfyopts, opt_arg()))
|
||||
goto end;
|
||||
break;
|
||||
case OPT_NOTEXT:
|
||||
notext = 1;
|
||||
break;
|
||||
@@ -456,30 +477,6 @@ opthelp:
|
||||
case OPT_ENGINE:
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_SM2ID:
|
||||
/* we assume the input is not a hex string */
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id'\n");
|
||||
goto end;
|
||||
}
|
||||
sm2_id = (unsigned char *)opt_arg();
|
||||
sm2_idlen = strlen((const char *)sm2_id);
|
||||
break;
|
||||
case OPT_SM2HEXID:
|
||||
/* try to parse the input as hex string first */
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id'\n");
|
||||
goto end;
|
||||
}
|
||||
sm2_free = 1;
|
||||
sm2_id = OPENSSL_hexstr2buf(opt_arg(), (long *)&sm2_idlen);
|
||||
if (sm2_id == NULL) {
|
||||
BIO_printf(bio_err, "Invalid hex string input\n");
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
end_of_options:
|
||||
@@ -576,8 +573,7 @@ end_of_options:
|
||||
}
|
||||
}
|
||||
pkey = load_key(keyfile, keyformat, 0, key, e, "CA private key");
|
||||
if (key != NULL)
|
||||
OPENSSL_cleanse(key, strlen(key));
|
||||
cleanse(key);
|
||||
if (pkey == NULL)
|
||||
/* load_key() has already printed an appropriate message */
|
||||
goto end;
|
||||
@@ -589,7 +585,7 @@ end_of_options:
|
||||
&& (certfile = lookup_conf(conf, section, ENV_CERTIFICATE)) == NULL)
|
||||
goto end;
|
||||
|
||||
x509 = load_cert(certfile, FORMAT_PEM, "CA certificate");
|
||||
x509 = load_cert(certfile, certformat, "CA certificate");
|
||||
if (x509 == NULL)
|
||||
goto end;
|
||||
|
||||
@@ -944,8 +940,8 @@ end_of_options:
|
||||
}
|
||||
if (ss_cert_file != NULL) {
|
||||
total++;
|
||||
j = certify_cert(&x, ss_cert_file, pkey, x509, dgst, sigopts,
|
||||
attribs,
|
||||
j = certify_cert(&x, ss_cert_file, certformat, pkey, x509, dgst,
|
||||
sigopts, vfyopts, attribs,
|
||||
db, serial, subj, chtype, multirdn, email_dn,
|
||||
startdate, enddate, days, batch, extensions,
|
||||
conf, verbose, certopt, get_nameopt(), default_op,
|
||||
@@ -965,11 +961,11 @@ end_of_options:
|
||||
}
|
||||
if (infile != NULL) {
|
||||
total++;
|
||||
j = certify(&x, infile, pkey, x509p, dgst, sigopts, attribs, db,
|
||||
j = certify(&x, infile, informat, pkey, x509p, dgst,
|
||||
sigopts, vfyopts, attribs, db,
|
||||
serial, subj, chtype, multirdn, email_dn, startdate,
|
||||
enddate, days, batch, extensions, conf, verbose,
|
||||
certopt, get_nameopt(), default_op, ext_copy, selfsign,
|
||||
sm2_id, sm2_idlen);
|
||||
certopt, get_nameopt(), default_op, ext_copy, selfsign);
|
||||
if (j < 0)
|
||||
goto end;
|
||||
if (j > 0) {
|
||||
@@ -985,11 +981,12 @@ end_of_options:
|
||||
}
|
||||
for (i = 0; i < argc; i++) {
|
||||
total++;
|
||||
j = certify(&x, argv[i], pkey, x509p, dgst, sigopts, attribs, db,
|
||||
j = certify(&x, argv[i], informat, pkey, x509p, dgst,
|
||||
sigopts, vfyopts,
|
||||
attribs, db,
|
||||
serial, subj, chtype, multirdn, email_dn, startdate,
|
||||
enddate, days, batch, extensions, conf, verbose,
|
||||
certopt, get_nameopt(), default_op, ext_copy, selfsign,
|
||||
sm2_id, sm2_idlen);
|
||||
certopt, get_nameopt(), default_op, ext_copy, selfsign);
|
||||
if (j < 0)
|
||||
goto end;
|
||||
if (j > 0) {
|
||||
@@ -1265,7 +1262,7 @@ end_of_options:
|
||||
goto end;
|
||||
} else {
|
||||
X509 *revcert;
|
||||
revcert = load_cert(infile, FORMAT_PEM, infile);
|
||||
revcert = load_cert(infile, certformat, infile);
|
||||
if (revcert == NULL)
|
||||
goto end;
|
||||
if (dorevoke == 2)
|
||||
@@ -1287,8 +1284,6 @@ end_of_options:
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
if (sm2_free)
|
||||
OPENSSL_free(sm2_id);
|
||||
if (ret)
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_free_all(Sout);
|
||||
@@ -1302,6 +1297,7 @@ end_of_options:
|
||||
BN_free(crlnumber);
|
||||
free_index(db);
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
sk_OPENSSL_STRING_free(vfyopts);
|
||||
EVP_PKEY_free(pkey);
|
||||
X509_free(x509);
|
||||
X509_CRL_free(crl);
|
||||
@@ -1319,32 +1315,26 @@ static char *lookup_conf(const CONF *conf, const char *section, const char *tag)
|
||||
return entry;
|
||||
}
|
||||
|
||||
static int certify(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
static int certify(X509 **xret, const char *infile, int informat,
|
||||
EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, const char *subj, unsigned long chtype,
|
||||
int multirdn, int email_dn, const char *startdate,
|
||||
const char *enddate,
|
||||
long days, int batch, const char *ext_sect, CONF *lconf,
|
||||
int verbose, unsigned long certopt, unsigned long nameopt,
|
||||
int default_op, int ext_copy, int selfsign,
|
||||
unsigned char *sm2id, size_t sm2idlen)
|
||||
int default_op, int ext_copy, int selfsign)
|
||||
{
|
||||
X509_REQ *req = NULL;
|
||||
BIO *in = NULL;
|
||||
EVP_PKEY *pktmp = NULL;
|
||||
int ok = -1, i;
|
||||
|
||||
in = BIO_new_file(infile, "r");
|
||||
if (in == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
req = load_csr(infile, informat, "certificate request");
|
||||
if (req == NULL)
|
||||
goto end;
|
||||
}
|
||||
if ((req = PEM_read_bio_X509_REQ(in, NULL, NULL, NULL)) == NULL) {
|
||||
BIO_printf(bio_err, "Error reading certificate request in %s\n",
|
||||
infile);
|
||||
goto end;
|
||||
}
|
||||
if (verbose)
|
||||
X509_REQ_print_ex(bio_err, req, nameopt, X509_FLAG_COMPAT);
|
||||
|
||||
@@ -1360,26 +1350,7 @@ static int certify(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
BIO_printf(bio_err, "error unpacking public key\n");
|
||||
goto end;
|
||||
}
|
||||
if (sm2id != NULL) {
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING *v;
|
||||
|
||||
v = ASN1_OCTET_STRING_new();
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err, "error: SM2 ID allocation failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ASN1_OCTET_STRING_set(v, sm2id, sm2idlen)) {
|
||||
BIO_printf(bio_err, "error: setting SM2 ID failed\n");
|
||||
ASN1_OCTET_STRING_free(v);
|
||||
goto end;
|
||||
}
|
||||
|
||||
X509_REQ_set0_sm2_id(req, v);
|
||||
#endif
|
||||
}
|
||||
i = X509_REQ_verify(req, pktmp);
|
||||
i = do_X509_REQ_verify(req, pktmp, vfyopts);
|
||||
pktmp = NULL;
|
||||
if (i < 0) {
|
||||
ok = 0;
|
||||
@@ -1404,12 +1375,14 @@ static int certify(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
|
||||
end:
|
||||
X509_REQ_free(req);
|
||||
BIO_free(in);
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
static int certify_cert(X509 **xret, const char *infile, int certformat,
|
||||
EVP_PKEY *pkey, X509 *x509,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts,
|
||||
STACK_OF(CONF_VALUE) *policy, CA_DB *db,
|
||||
BIGNUM *serial, const char *subj, unsigned long chtype,
|
||||
int multirdn, int email_dn, const char *startdate,
|
||||
@@ -1422,7 +1395,7 @@ static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x
|
||||
EVP_PKEY *pktmp = NULL;
|
||||
int ok = -1, i;
|
||||
|
||||
if ((req = load_cert(infile, FORMAT_PEM, infile)) == NULL)
|
||||
if ((req = load_cert(infile, certformat, infile)) == NULL)
|
||||
goto end;
|
||||
if (verbose)
|
||||
X509_print(bio_err, req);
|
||||
@@ -1433,7 +1406,7 @@ static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x
|
||||
BIO_printf(bio_err, "error unpacking public key\n");
|
||||
goto end;
|
||||
}
|
||||
i = X509_verify(req, pktmp);
|
||||
i = do_X509_verify(req, pktmp, vfyopts);
|
||||
if (i < 0) {
|
||||
ok = 0;
|
||||
BIO_printf(bio_err, "Signature verification problems....\n");
|
||||
@@ -1470,7 +1443,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
|
||||
CONF *lconf, unsigned long certopt, unsigned long nameopt,
|
||||
int default_op, int ext_copy, int selfsign)
|
||||
{
|
||||
X509_NAME *name = NULL, *CAname = NULL, *subject = NULL;
|
||||
const X509_NAME *name = NULL;
|
||||
X509_NAME *CAname = NULL, *subject = NULL;
|
||||
const ASN1_TIME *tm;
|
||||
ASN1_STRING *str, *str2;
|
||||
ASN1_OBJECT *obj;
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
DEFINE_STACK_OF_CONST(SSL_CIPHER)
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_STDNAME,
|
||||
|
||||
+3192
@@ -0,0 +1,3192 @@
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Nokia 2007-2019
|
||||
* Copyright Siemens AG 2015-2019
|
||||
*
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "apps.h"
|
||||
#include "http_server.h"
|
||||
#include "s_apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
#include "cmp_mock_srv.h"
|
||||
|
||||
/* tweaks needed due to missing unistd.h on Windows */
|
||||
#ifdef _WIN32
|
||||
# define access _access
|
||||
#endif
|
||||
#ifndef F_OK
|
||||
# define F_OK 0
|
||||
#endif
|
||||
|
||||
#include <openssl/ui.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
/* explicit #includes not strictly needed since implied by the above: */
|
||||
#include <stdlib.h>
|
||||
#include <openssl/cmp.h>
|
||||
#include <openssl/cmp_util.h>
|
||||
#include <openssl/crmf.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/store.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF(OSSL_CMP_ITAV)
|
||||
|
||||
static char *opt_config = NULL;
|
||||
#define CMP_SECTION "cmp"
|
||||
#define SECTION_NAME_MAX 40 /* max length of section name */
|
||||
#define DEFAULT_SECTION "default"
|
||||
static char *opt_section = CMP_SECTION;
|
||||
|
||||
#undef PROG
|
||||
#define PROG cmp_main
|
||||
static char *prog = "cmp";
|
||||
|
||||
static int read_config(void);
|
||||
|
||||
static CONF *conf = NULL; /* OpenSSL config file context structure */
|
||||
static OSSL_CMP_CTX *cmp_ctx = NULL; /* the client-side CMP context */
|
||||
|
||||
/* the type of cmp command we want to send */
|
||||
typedef enum {
|
||||
CMP_IR,
|
||||
CMP_KUR,
|
||||
CMP_CR,
|
||||
CMP_P10CR,
|
||||
CMP_RR,
|
||||
CMP_GENM
|
||||
} cmp_cmd_t;
|
||||
|
||||
/* message transfer */
|
||||
static char *opt_server = NULL;
|
||||
static char server_port_s[32] = { '\0' };
|
||||
static int server_port = 0;
|
||||
static char *opt_proxy = NULL;
|
||||
static char *opt_no_proxy = NULL;
|
||||
static char *opt_path = "/";
|
||||
static int opt_msg_timeout = -1;
|
||||
static int opt_total_timeout = -1;
|
||||
|
||||
/* server authentication */
|
||||
static char *opt_trusted = NULL;
|
||||
static char *opt_untrusted = NULL;
|
||||
static char *opt_srvcert = NULL;
|
||||
static char *opt_recipient = NULL;
|
||||
static char *opt_expect_sender = NULL;
|
||||
static int opt_ignore_keyusage = 0;
|
||||
static int opt_unprotected_errors = 0;
|
||||
static char *opt_extracertsout = NULL;
|
||||
static char *opt_cacertsout = NULL;
|
||||
|
||||
/* client authentication */
|
||||
static char *opt_ref = NULL;
|
||||
static char *opt_secret = NULL;
|
||||
static char *opt_cert = NULL;
|
||||
static char *opt_key = NULL;
|
||||
static char *opt_keypass = NULL;
|
||||
static char *opt_digest = NULL;
|
||||
static char *opt_mac = NULL;
|
||||
static char *opt_extracerts = NULL;
|
||||
static int opt_unprotected_requests = 0;
|
||||
|
||||
/* generic message */
|
||||
static char *opt_cmd_s = NULL;
|
||||
static int opt_cmd = -1;
|
||||
static char *opt_geninfo = NULL;
|
||||
static char *opt_infotype_s = NULL;
|
||||
static int opt_infotype = NID_undef;
|
||||
|
||||
/* certificate enrollment */
|
||||
static char *opt_newkey = NULL;
|
||||
static char *opt_newkeypass = NULL;
|
||||
static char *opt_subject = NULL;
|
||||
static char *opt_issuer = NULL;
|
||||
static int opt_days = 0;
|
||||
static char *opt_reqexts = NULL;
|
||||
static char *opt_sans = NULL;
|
||||
static int opt_san_nodefault = 0;
|
||||
static char *opt_policies = NULL;
|
||||
static char *opt_policy_oids = NULL;
|
||||
static int opt_policy_oids_critical = 0;
|
||||
static int opt_popo = OSSL_CRMF_POPO_NONE - 1;
|
||||
static char *opt_csr = NULL;
|
||||
static char *opt_out_trusted = NULL;
|
||||
static int opt_implicit_confirm = 0;
|
||||
static int opt_disable_confirm = 0;
|
||||
static char *opt_certout = NULL;
|
||||
|
||||
/* certificate enrollment and revocation */
|
||||
static char *opt_oldcert = NULL;
|
||||
static int opt_revreason = CRL_REASON_NONE;
|
||||
|
||||
/* credentials format */
|
||||
static char *opt_certform_s = "PEM";
|
||||
static int opt_certform = FORMAT_PEM;
|
||||
static char *opt_keyform_s = "PEM";
|
||||
static int opt_keyform = FORMAT_PEM;
|
||||
static char *opt_certsform_s = "PEM";
|
||||
static int opt_certsform = FORMAT_PEM;
|
||||
static char *opt_otherpass = NULL;
|
||||
static char *opt_engine = NULL;
|
||||
|
||||
/* TLS connection */
|
||||
static int opt_tls_used = 0;
|
||||
static char *opt_tls_cert = NULL;
|
||||
static char *opt_tls_key = NULL;
|
||||
static char *opt_tls_keypass = NULL;
|
||||
static char *opt_tls_extra = NULL;
|
||||
static char *opt_tls_trusted = NULL;
|
||||
static char *opt_tls_host = NULL;
|
||||
|
||||
/* client-side debugging */
|
||||
static int opt_batch = 0;
|
||||
static int opt_repeat = 1;
|
||||
static char *opt_reqin = NULL;
|
||||
static int opt_reqin_new_tid = 0;
|
||||
static char *opt_reqout = NULL;
|
||||
static char *opt_rspin = NULL;
|
||||
static char *opt_rspout = NULL;
|
||||
static int opt_use_mock_srv = 0;
|
||||
|
||||
/* server-side debugging */
|
||||
static char *opt_port = NULL;
|
||||
static int opt_max_msgs = 0;
|
||||
|
||||
static char *opt_srv_ref = NULL;
|
||||
static char *opt_srv_secret = NULL;
|
||||
static char *opt_srv_cert = NULL;
|
||||
static char *opt_srv_key = NULL;
|
||||
static char *opt_srv_keypass = NULL;
|
||||
|
||||
static char *opt_srv_trusted = NULL;
|
||||
static char *opt_srv_untrusted = NULL;
|
||||
static char *opt_rsp_cert = NULL;
|
||||
static char *opt_rsp_extracerts = NULL;
|
||||
static char *opt_rsp_capubs = NULL;
|
||||
static int opt_poll_count = 0;
|
||||
static int opt_check_after = 1;
|
||||
static int opt_grant_implicitconf = 0;
|
||||
|
||||
static int opt_pkistatus = OSSL_CMP_PKISTATUS_accepted;
|
||||
static int opt_failure = INT_MIN;
|
||||
static int opt_failurebits = 0;
|
||||
static char *opt_statusstring = NULL;
|
||||
static int opt_send_error = 0;
|
||||
static int opt_send_unprotected = 0;
|
||||
static int opt_send_unprot_err = 0;
|
||||
static int opt_accept_unprotected = 0;
|
||||
static int opt_accept_unprot_err = 0;
|
||||
static int opt_accept_raverified = 0;
|
||||
|
||||
static X509_VERIFY_PARAM *vpm = NULL;
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_CONFIG, OPT_SECTION,
|
||||
|
||||
OPT_CMD, OPT_INFOTYPE, OPT_GENINFO,
|
||||
|
||||
OPT_NEWKEY, OPT_NEWKEYPASS, OPT_SUBJECT, OPT_ISSUER,
|
||||
OPT_DAYS, OPT_REQEXTS,
|
||||
OPT_SANS, OPT_SAN_NODEFAULT,
|
||||
OPT_POLICIES, OPT_POLICY_OIDS, OPT_POLICY_OIDS_CRITICAL,
|
||||
OPT_POPO, OPT_CSR,
|
||||
OPT_OUT_TRUSTED, OPT_IMPLICIT_CONFIRM, OPT_DISABLE_CONFIRM,
|
||||
OPT_CERTOUT,
|
||||
|
||||
OPT_OLDCERT, OPT_REVREASON,
|
||||
|
||||
OPT_SERVER, OPT_PROXY, OPT_NO_PROXY, OPT_PATH,
|
||||
OPT_MSG_TIMEOUT, OPT_TOTAL_TIMEOUT,
|
||||
|
||||
OPT_TRUSTED, OPT_UNTRUSTED, OPT_SRVCERT,
|
||||
OPT_RECIPIENT, OPT_EXPECT_SENDER,
|
||||
OPT_IGNORE_KEYUSAGE, OPT_UNPROTECTED_ERRORS,
|
||||
OPT_EXTRACERTSOUT, OPT_CACERTSOUT,
|
||||
|
||||
OPT_REF, OPT_SECRET, OPT_CERT, OPT_KEY, OPT_KEYPASS,
|
||||
OPT_DIGEST, OPT_MAC, OPT_EXTRACERTS,
|
||||
OPT_UNPROTECTED_REQUESTS,
|
||||
|
||||
OPT_CERTFORM, OPT_KEYFORM, OPT_CERTSFORM,
|
||||
OPT_OTHERPASS,
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
OPT_ENGINE,
|
||||
#endif
|
||||
OPT_PROV_ENUM,
|
||||
|
||||
OPT_TLS_USED, OPT_TLS_CERT, OPT_TLS_KEY,
|
||||
OPT_TLS_KEYPASS,
|
||||
OPT_TLS_EXTRA, OPT_TLS_TRUSTED, OPT_TLS_HOST,
|
||||
|
||||
OPT_BATCH, OPT_REPEAT,
|
||||
OPT_REQIN, OPT_REQIN_NEW_TID, OPT_REQOUT, OPT_RSPIN, OPT_RSPOUT,
|
||||
|
||||
OPT_USE_MOCK_SRV, OPT_PORT, OPT_MAX_MSGS,
|
||||
OPT_SRV_REF, OPT_SRV_SECRET,
|
||||
OPT_SRV_CERT, OPT_SRV_KEY, OPT_SRV_KEYPASS,
|
||||
OPT_SRV_TRUSTED, OPT_SRV_UNTRUSTED,
|
||||
OPT_RSP_CERT, OPT_RSP_EXTRACERTS, OPT_RSP_CAPUBS,
|
||||
OPT_POLL_COUNT, OPT_CHECK_AFTER,
|
||||
OPT_GRANT_IMPLICITCONF,
|
||||
OPT_PKISTATUS, OPT_FAILURE,
|
||||
OPT_FAILUREBITS, OPT_STATUSSTRING,
|
||||
OPT_SEND_ERROR, OPT_SEND_UNPROTECTED,
|
||||
OPT_SEND_UNPROT_ERR, OPT_ACCEPT_UNPROTECTED,
|
||||
OPT_ACCEPT_UNPROT_ERR, OPT_ACCEPT_RAVERIFIED,
|
||||
|
||||
OPT_V_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS cmp_options[] = {
|
||||
/* entries must be in the same order as enumerated above!! */
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"config", OPT_CONFIG, 's',
|
||||
"Configuration file to use. \"\" = none. Default from env variable OPENSSL_CONF"},
|
||||
{"section", OPT_SECTION, 's',
|
||||
"Section(s) in config file to get options from. \"\" = 'default'. Default 'cmp'"},
|
||||
|
||||
OPT_SECTION("Generic message"),
|
||||
{"cmd", OPT_CMD, 's', "CMP request to send: ir/cr/kur/p10cr/rr/genm"},
|
||||
{"infotype", OPT_INFOTYPE, 's',
|
||||
"InfoType name for requesting specific info in genm, e.g. 'signKeyPairTypes'"},
|
||||
{"geninfo", OPT_GENINFO, 's',
|
||||
"generalInfo integer values to place in request PKIHeader with given OID"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"specified in the form <OID>:int:<n>, e.g. \"1.2.3:int:987\""},
|
||||
|
||||
OPT_SECTION("Certificate enrollment"),
|
||||
{"newkey", OPT_NEWKEY, 's',
|
||||
"Private or public key for the requested cert. Default: CSR key or client key"},
|
||||
{"newkeypass", OPT_NEWKEYPASS, 's', "New private key pass phrase source"},
|
||||
{"subject", OPT_SUBJECT, 's',
|
||||
"Distinguished Name (DN) of subject to use in the requested cert template"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"For kur, default is the subject DN of the reference cert (see -oldcert);"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"this default is used for ir and cr only if no Subject Alt Names are set"},
|
||||
{"issuer", OPT_ISSUER, 's',
|
||||
"DN of the issuer to place in the requested certificate template"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"also used as recipient if neither -recipient nor -srvcert are given"},
|
||||
{"days", OPT_DAYS, 'n',
|
||||
"Requested validity time of the new certificate in number of days"},
|
||||
{"reqexts", OPT_REQEXTS, 's',
|
||||
"Name of config file section defining certificate request extensions"},
|
||||
{"sans", OPT_SANS, 's',
|
||||
"Subject Alt Names (IPADDR/DNS/URI) to add as (critical) cert req extension"},
|
||||
{"san_nodefault", OPT_SAN_NODEFAULT, '-',
|
||||
"Do not take default SANs from reference certificate (see -oldcert)"},
|
||||
{"policies", OPT_POLICIES, 's',
|
||||
"Name of config file section defining policies certificate request extension"},
|
||||
{"policy_oids", OPT_POLICY_OIDS, 's',
|
||||
"Policy OID(s) to add as policies certificate request extension"},
|
||||
{"policy_oids_critical", OPT_POLICY_OIDS_CRITICAL, '-',
|
||||
"Flag the policy OID(s) given with -policy_oids as critical"},
|
||||
{"popo", OPT_POPO, 'n',
|
||||
"Proof-of-Possession (POPO) method to use for ir/cr/kur where"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"-1 = NONE, 0 = RAVERIFIED, 1 = SIGNATURE (default), 2 = KEYENC"},
|
||||
{"csr", OPT_CSR, 's',
|
||||
"CSR file in PKCS#10 format to use in p10cr for legacy support"},
|
||||
{"out_trusted", OPT_OUT_TRUSTED, 's',
|
||||
"Certificates to trust when verifying newly enrolled certificates"},
|
||||
{"implicit_confirm", OPT_IMPLICIT_CONFIRM, '-',
|
||||
"Request implicit confirmation of newly enrolled certificates"},
|
||||
{"disable_confirm", OPT_DISABLE_CONFIRM, '-',
|
||||
"Do not confirm newly enrolled certificate w/o requesting implicit"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"confirmation. WARNING: This leads to behavior violating RFC 4210"},
|
||||
{"certout", OPT_CERTOUT, 's',
|
||||
"File to save newly enrolled certificate"},
|
||||
|
||||
OPT_SECTION("Certificate enrollment and revocation"),
|
||||
|
||||
{"oldcert", OPT_OLDCERT, 's',
|
||||
"Certificate to be updated (defaulting to -cert) or to be revoked in rr;"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"also used as reference (defaulting to -cert) for subject DN and SANs."},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"Its issuer is used as recipient unless -srvcert, -recipient or -issuer given"},
|
||||
{"revreason", OPT_REVREASON, 'n',
|
||||
"Reason code to include in revocation request (rr); possible values:"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"0..6, 8..10 (see RFC5280, 5.3.1) or -1. Default -1 = none included"},
|
||||
|
||||
OPT_SECTION("Message transfer"),
|
||||
{"server", OPT_SERVER, 's',
|
||||
"[http[s]://]address[:port] of CMP server. Default port 80 or 443."},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"The address may be a DNS name or an IP address"},
|
||||
{"proxy", OPT_PROXY, 's',
|
||||
"[http[s]://]address[:port][/path] of HTTP(S) proxy to use; path is ignored"},
|
||||
{"no_proxy", OPT_NO_PROXY, 's',
|
||||
"List of addresses of servers not to use HTTP(S) proxy for"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"Default from environment variable 'no_proxy', else 'NO_PROXY', else none"},
|
||||
{"path", OPT_PATH, 's',
|
||||
"HTTP path (aka CMP alias) at the CMP server. Default \"/\""},
|
||||
{"msg_timeout", OPT_MSG_TIMEOUT, 'n',
|
||||
"Timeout per CMP message round trip (or 0 for none). Default 120 seconds"},
|
||||
{"total_timeout", OPT_TOTAL_TIMEOUT, 'n',
|
||||
"Overall time an enrollment incl. polling may take. Default 0 = infinite"},
|
||||
|
||||
OPT_SECTION("Server authentication"),
|
||||
{"trusted", OPT_TRUSTED, 's',
|
||||
"Certificates to trust as chain roots when verifying signed CMP responses"},
|
||||
{OPT_MORE_STR, 0, 0, "unless -srvcert is given"},
|
||||
{"untrusted", OPT_UNTRUSTED, 's',
|
||||
"Intermediate CA certs for chain construction for CMP/TLS/enrolled certs"},
|
||||
{"srvcert", OPT_SRVCERT, 's',
|
||||
"Server cert to pin and trust directly when verifying signed CMP responses"},
|
||||
{"recipient", OPT_RECIPIENT, 's',
|
||||
"Distinguished Name (DN) to use as msg recipient; see man page for defaults"},
|
||||
{"expect_sender", OPT_EXPECT_SENDER, 's',
|
||||
"DN of expected sender of responses. Defaults to subject of -srvcert, if any"},
|
||||
{"ignore_keyusage", OPT_IGNORE_KEYUSAGE, '-',
|
||||
"Ignore CMP signer cert key usage, else 'digitalSignature' must be allowed"},
|
||||
{"unprotected_errors", OPT_UNPROTECTED_ERRORS, '-',
|
||||
"Accept missing or invalid protection of regular error messages and negative"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"certificate responses (ip/cp/kup), revocation responses (rp), and PKIConf"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"WARNING: This setting leads to behavior allowing violation of RFC 4210"},
|
||||
{"extracertsout", OPT_EXTRACERTSOUT, 's',
|
||||
"File to save extra certificates received in the extraCerts field"},
|
||||
{"cacertsout", OPT_CACERTSOUT, 's',
|
||||
"File to save CA certificates received in the caPubs field of 'ip' messages"},
|
||||
|
||||
OPT_SECTION("Client authentication"),
|
||||
{"ref", OPT_REF, 's',
|
||||
"Reference value to use as senderKID in case no -cert is given"},
|
||||
{"secret", OPT_SECRET, 's',
|
||||
"Password source for client authentication with a pre-shared key (secret)"},
|
||||
{"cert", OPT_CERT, 's',
|
||||
"Client's current certificate (needed unless using -secret for PBM);"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"any further certs included are appended in extraCerts field"},
|
||||
{"key", OPT_KEY, 's', "Private key for the client's current certificate"},
|
||||
{"keypass", OPT_KEYPASS, 's',
|
||||
"Client private key (and cert and old cert file) pass phrase source"},
|
||||
{"digest", OPT_DIGEST, 's',
|
||||
"Digest to use in message protection and POPO signatures. Default \"sha256\""},
|
||||
{"mac", OPT_MAC, 's',
|
||||
"MAC algorithm to use in PBM-based message protection. Default \"hmac-sha1\""},
|
||||
{"extracerts", OPT_EXTRACERTS, 's',
|
||||
"Certificates to append in extraCerts field of outgoing messages"},
|
||||
{"unprotected_requests", OPT_UNPROTECTED_REQUESTS, '-',
|
||||
"Send messages without CMP-level protection"},
|
||||
|
||||
OPT_SECTION("Credentials format"),
|
||||
{"certform", OPT_CERTFORM, 's',
|
||||
"Format (PEM or DER) to use when saving a certificate to a file. Default PEM"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"This also determines format to use for writing (not supported for P12)"},
|
||||
{"keyform", OPT_KEYFORM, 's',
|
||||
"Format to assume when reading key files. Default PEM"},
|
||||
{"certsform", OPT_CERTSFORM, 's',
|
||||
"Format (PEM/DER/P12) to try first reading multiple certs. Default PEM"},
|
||||
{"otherpass", OPT_OTHERPASS, 's',
|
||||
"Pass phrase source potentially needed for loading certificates of others"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's',
|
||||
"Use crypto engine with given identifier, possibly a hardware device."},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"Engines may be defined in OpenSSL config file engine section."},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"Options like -key specifying keys held in the engine can give key IDs"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"prefixed by 'engine:', e.g. '-key engine:pkcs11:object=mykey;pin-value=1234'"},
|
||||
#endif
|
||||
OPT_PROV_OPTIONS,
|
||||
|
||||
OPT_SECTION("TLS connection"),
|
||||
{"tls_used", OPT_TLS_USED, '-',
|
||||
"Enable using TLS (also when other TLS options are not set)"},
|
||||
{"tls_cert", OPT_TLS_CERT, 's',
|
||||
"Client's TLS certificate. May include chain to be provided to TLS server"},
|
||||
{"tls_key", OPT_TLS_KEY, 's',
|
||||
"Private key for the client's TLS certificate"},
|
||||
{"tls_keypass", OPT_TLS_KEYPASS, 's',
|
||||
"Pass phrase source for the client's private TLS key (and TLS cert file)"},
|
||||
{"tls_extra", OPT_TLS_EXTRA, 's',
|
||||
"Extra certificates to provide to TLS server during TLS handshake"},
|
||||
{"tls_trusted", OPT_TLS_TRUSTED, 's',
|
||||
"Trusted certificates to use for verifying the TLS server certificate;"},
|
||||
{OPT_MORE_STR, 0, 0, "this implies host name validation"},
|
||||
{"tls_host", OPT_TLS_HOST, 's',
|
||||
"Address to be checked (rather than -server) during TLS host name validation"},
|
||||
|
||||
OPT_SECTION("Client-side debugging"),
|
||||
{"batch", OPT_BATCH, '-',
|
||||
"Do not interactively prompt for input when a password is required etc."},
|
||||
{"repeat", OPT_REPEAT, 'n',
|
||||
"Invoke the transaction the given number of times. Default 1"},
|
||||
{"reqin", OPT_REQIN, 's', "Take sequence of CMP requests from file(s)"},
|
||||
{"reqin_new_tid", OPT_REQIN_NEW_TID, '-',
|
||||
"Use fresh transactionID for CMP requests read from -reqin"},
|
||||
{"reqout", OPT_REQOUT, 's', "Save sequence of CMP requests to file(s)"},
|
||||
{"rspin", OPT_RSPIN, 's',
|
||||
"Process sequence of CMP responses provided in file(s), skipping server"},
|
||||
{"rspout", OPT_RSPOUT, 's', "Save sequence of CMP responses to file(s)"},
|
||||
|
||||
{"use_mock_srv", OPT_USE_MOCK_SRV, '-', "Use mock server at API level, bypassing HTTP"},
|
||||
|
||||
OPT_SECTION("Mock server"),
|
||||
{"port", OPT_PORT, 's', "Act as HTTP mock server listening on given port"},
|
||||
{"max_msgs", OPT_MAX_MSGS, 'n',
|
||||
"max number of messages handled by HTTP mock server. Default: 0 = unlimited"},
|
||||
|
||||
{"srv_ref", OPT_SRV_REF, 's',
|
||||
"Reference value to use as senderKID of server in case no -srv_cert is given"},
|
||||
{"srv_secret", OPT_SRV_SECRET, 's',
|
||||
"Password source for server authentication with a pre-shared key (secret)"},
|
||||
{"srv_cert", OPT_SRV_CERT, 's', "Certificate of the server"},
|
||||
{"srv_key", OPT_SRV_KEY, 's',
|
||||
"Private key used by the server for signing messages"},
|
||||
{"srv_keypass", OPT_SRV_KEYPASS, 's',
|
||||
"Server private key (and cert) file pass phrase source"},
|
||||
|
||||
{"srv_trusted", OPT_SRV_TRUSTED, 's',
|
||||
"Trusted certificates for client authentication"},
|
||||
{"srv_untrusted", OPT_SRV_UNTRUSTED, 's',
|
||||
"Intermediate certs that may be useful for verifying CMP protection"},
|
||||
{"rsp_cert", OPT_RSP_CERT, 's',
|
||||
"Certificate to be returned as mock enrollment result"},
|
||||
{"rsp_extracerts", OPT_RSP_EXTRACERTS, 's',
|
||||
"Extra certificates to be included in mock certification responses"},
|
||||
{"rsp_capubs", OPT_RSP_CAPUBS, 's',
|
||||
"CA certificates to be included in mock ip response"},
|
||||
{"poll_count", OPT_POLL_COUNT, 'n',
|
||||
"Number of times the client must poll before receiving a certificate"},
|
||||
{"check_after", OPT_CHECK_AFTER, 'n',
|
||||
"The check_after value (time to wait) to include in poll response"},
|
||||
{"grant_implicitconf", OPT_GRANT_IMPLICITCONF, '-',
|
||||
"Grant implicit confirmation of newly enrolled certificate"},
|
||||
|
||||
{"pkistatus", OPT_PKISTATUS, 'n',
|
||||
"PKIStatus to be included in server response. Possible values: 0..6"},
|
||||
{"failure", OPT_FAILURE, 'n',
|
||||
"A single failure info bit number to include in server response, 0..26"},
|
||||
{"failurebits", OPT_FAILUREBITS, 'n',
|
||||
"Number representing failure bits to include in server response, 0..2^27 - 1"},
|
||||
{"statusstring", OPT_STATUSSTRING, 's',
|
||||
"Status string to be included in server response"},
|
||||
{"send_error", OPT_SEND_ERROR, '-',
|
||||
"Force server to reply with error message"},
|
||||
{"send_unprotected", OPT_SEND_UNPROTECTED, '-',
|
||||
"Send response messages without CMP-level protection"},
|
||||
{"send_unprot_err", OPT_SEND_UNPROT_ERR, '-',
|
||||
"In case of negative responses, server shall send unprotected error messages,"},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"certificate responses (ip/cp/kup), and revocation responses (rp)."},
|
||||
{OPT_MORE_STR, 0, 0,
|
||||
"WARNING: This setting leads to behavior violating RFC 4210"},
|
||||
{"accept_unprotected", OPT_ACCEPT_UNPROTECTED, '-',
|
||||
"Accept missing or invalid protection of requests"},
|
||||
{"accept_unprot_err", OPT_ACCEPT_UNPROT_ERR, '-',
|
||||
"Accept unprotected error messages from client"},
|
||||
{"accept_raverified", OPT_ACCEPT_RAVERIFIED, '-',
|
||||
"Accept RAVERIFIED as proof-of-possession (POPO)"},
|
||||
|
||||
OPT_V_OPTIONS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
typedef union {
|
||||
char **txt;
|
||||
int *num;
|
||||
long *num_long;
|
||||
} varref;
|
||||
static varref cmp_vars[] = { /* must be in same order as enumerated above! */
|
||||
{&opt_config}, {&opt_section},
|
||||
|
||||
{&opt_cmd_s}, {&opt_infotype_s}, {&opt_geninfo},
|
||||
|
||||
{&opt_newkey}, {&opt_newkeypass}, {&opt_subject}, {&opt_issuer},
|
||||
{(char **)&opt_days}, {&opt_reqexts},
|
||||
{&opt_sans}, {(char **)&opt_san_nodefault},
|
||||
{&opt_policies}, {&opt_policy_oids}, {(char **)&opt_policy_oids_critical},
|
||||
{(char **)&opt_popo}, {&opt_csr},
|
||||
{&opt_out_trusted},
|
||||
{(char **)&opt_implicit_confirm}, {(char **)&opt_disable_confirm},
|
||||
{&opt_certout},
|
||||
|
||||
{&opt_oldcert}, {(char **)&opt_revreason},
|
||||
|
||||
{&opt_server}, {&opt_proxy}, {&opt_no_proxy}, {&opt_path},
|
||||
{(char **)&opt_msg_timeout}, {(char **)&opt_total_timeout},
|
||||
|
||||
{&opt_trusted}, {&opt_untrusted}, {&opt_srvcert},
|
||||
{&opt_recipient}, {&opt_expect_sender},
|
||||
{(char **)&opt_ignore_keyusage}, {(char **)&opt_unprotected_errors},
|
||||
{&opt_extracertsout}, {&opt_cacertsout},
|
||||
|
||||
{&opt_ref}, {&opt_secret}, {&opt_cert}, {&opt_key}, {&opt_keypass},
|
||||
{&opt_digest}, {&opt_mac}, {&opt_extracerts},
|
||||
{(char **)&opt_unprotected_requests},
|
||||
|
||||
{&opt_certform_s}, {&opt_keyform_s}, {&opt_certsform_s},
|
||||
{&opt_otherpass},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{&opt_engine},
|
||||
#endif
|
||||
|
||||
{(char **)&opt_tls_used}, {&opt_tls_cert}, {&opt_tls_key},
|
||||
{&opt_tls_keypass},
|
||||
{&opt_tls_extra}, {&opt_tls_trusted}, {&opt_tls_host},
|
||||
|
||||
{(char **)&opt_batch}, {(char **)&opt_repeat},
|
||||
{&opt_reqin}, {(char **)&opt_reqin_new_tid},
|
||||
{&opt_reqout}, {&opt_rspin}, {&opt_rspout},
|
||||
|
||||
{(char **)&opt_use_mock_srv}, {&opt_port}, {(char **)&opt_max_msgs},
|
||||
{&opt_srv_ref}, {&opt_srv_secret},
|
||||
{&opt_srv_cert}, {&opt_srv_key}, {&opt_srv_keypass},
|
||||
{&opt_srv_trusted}, {&opt_srv_untrusted},
|
||||
{&opt_rsp_cert}, {&opt_rsp_extracerts}, {&opt_rsp_capubs},
|
||||
{(char **)&opt_poll_count}, {(char **)&opt_check_after},
|
||||
{(char **)&opt_grant_implicitconf},
|
||||
{(char **)&opt_pkistatus}, {(char **)&opt_failure},
|
||||
{(char **)&opt_failurebits}, {&opt_statusstring},
|
||||
{(char **)&opt_send_error}, {(char **)&opt_send_unprotected},
|
||||
{(char **)&opt_send_unprot_err}, {(char **)&opt_accept_unprotected},
|
||||
{(char **)&opt_accept_unprot_err}, {(char **)&opt_accept_raverified},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define FUNC (strcmp(OPENSSL_FUNC, "(unknown function)") == 0 \
|
||||
? "CMP" : "OPENSSL_FUNC")
|
||||
# define PRINT_LOCATION(bio) BIO_printf(bio, "%s:%s:%d:", \
|
||||
FUNC, OPENSSL_FILE, OPENSSL_LINE)
|
||||
#else
|
||||
# define PRINT_LOCATION(bio) ((void)0)
|
||||
#endif
|
||||
#define CMP_print(bio, prefix, msg, a1, a2, a3) \
|
||||
(PRINT_LOCATION(bio), \
|
||||
BIO_printf(bio, "CMP %s: " msg "\n", prefix, a1, a2, a3))
|
||||
#define CMP_INFO(msg, a1, a2, a3) CMP_print(bio_out, "info", msg, a1, a2, a3)
|
||||
#define CMP_info(msg) CMP_INFO(msg"%s%s%s", "", "", "")
|
||||
#define CMP_info1(msg, a1) CMP_INFO(msg"%s%s", a1, "", "")
|
||||
#define CMP_info2(msg, a1, a2) CMP_INFO(msg"%s", a1, a2, "")
|
||||
#define CMP_info3(msg, a1, a2, a3) CMP_INFO(msg, a1, a2, a3)
|
||||
#define CMP_WARN(m, a1, a2, a3) CMP_print(bio_out, "warning", m, a1, a2, a3)
|
||||
#define CMP_warn(msg) CMP_WARN(msg"%s%s%s", "", "", "")
|
||||
#define CMP_warn1(msg, a1) CMP_WARN(msg"%s%s", a1, "", "")
|
||||
#define CMP_warn2(msg, a1, a2) CMP_WARN(msg"%s", a1, a2, "")
|
||||
#define CMP_warn3(msg, a1, a2, a3) CMP_WARN(msg, a1, a2, a3)
|
||||
#define CMP_ERR(msg, a1, a2, a3) CMP_print(bio_err, "error", msg, a1, a2, a3)
|
||||
#define CMP_err(msg) CMP_ERR(msg"%s%s%s", "", "", "")
|
||||
#define CMP_err1(msg, a1) CMP_ERR(msg"%s%s", a1, "", "")
|
||||
#define CMP_err2(msg, a1, a2) CMP_ERR(msg"%s", a1, a2, "")
|
||||
#define CMP_err3(msg, a1, a2, a3) CMP_ERR(msg, a1, a2, a3)
|
||||
|
||||
static int print_to_bio_out(const char *func, const char *file, int line,
|
||||
OSSL_CMP_severity level, const char *msg)
|
||||
{
|
||||
return OSSL_CMP_print_to_bio(bio_out, func, file, line, level, msg);
|
||||
}
|
||||
|
||||
/* code duplicated from crypto/cmp/cmp_util.c */
|
||||
static int sk_X509_add1_cert(STACK_OF(X509) *sk, X509 *cert,
|
||||
int no_dup, int prepend)
|
||||
{
|
||||
if (no_dup) {
|
||||
/*
|
||||
* not using sk_X509_set_cmp_func() and sk_X509_find()
|
||||
* because this re-orders the certs on the stack
|
||||
*/
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sk_X509_num(sk); i++) {
|
||||
if (X509_cmp(sk_X509_value(sk, i), cert) == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!X509_up_ref(cert))
|
||||
return 0;
|
||||
if (!sk_X509_insert(sk, cert, prepend ? 0 : -1)) {
|
||||
X509_free(cert);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* code duplicated from crypto/cmp/cmp_util.c */
|
||||
static int sk_X509_add1_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs,
|
||||
int no_self_signed, int no_dups, int prepend)
|
||||
/* compiler would allow 'const' for the list of certs, yet they are up-ref'ed */
|
||||
{
|
||||
int i;
|
||||
|
||||
if (sk == NULL)
|
||||
return 0;
|
||||
if (certs == NULL)
|
||||
return 1;
|
||||
for (i = 0; i < sk_X509_num(certs); i++) {
|
||||
X509 *cert = sk_X509_value(certs, i);
|
||||
|
||||
if (!no_self_signed || X509_check_issued(cert, cert) != X509_V_OK) {
|
||||
if (!sk_X509_add1_cert(sk, cert, no_dups, prepend))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TODO potentially move to apps/lib/apps.c */
|
||||
static char *next_item(char *opt) /* in list separated by comma and/or space */
|
||||
{
|
||||
/* advance to separator (comma or whitespace), if any */
|
||||
while (*opt != ',' && !isspace(*opt) && *opt != '\0') {
|
||||
if (*opt == '\\' && opt[1] != '\0')
|
||||
/* skip and unescape '\' escaped char */
|
||||
memmove(opt, opt + 1, strlen(opt));
|
||||
opt++;
|
||||
}
|
||||
if (*opt != '\0') {
|
||||
/* terminate current item */
|
||||
*opt++ = '\0';
|
||||
/* skip over any whitespace after separator */
|
||||
while (isspace(*opt))
|
||||
opt++;
|
||||
}
|
||||
return *opt == '\0' ? NULL : opt; /* NULL indicates end of input */
|
||||
}
|
||||
|
||||
static EVP_PKEY *load_key_pwd(const char *uri, int format,
|
||||
const char *pass, ENGINE *e, const char *desc)
|
||||
{
|
||||
char *pass_string = get_passwd(pass, desc);
|
||||
EVP_PKEY *pkey = load_key(uri, format, 0, pass_string, e, desc);
|
||||
|
||||
clear_free(pass_string);
|
||||
return pkey;
|
||||
}
|
||||
|
||||
static X509 *load_cert_pwd(const char *uri, const char *pass, const char *desc)
|
||||
{
|
||||
X509 *cert;
|
||||
char *pass_string = get_passwd(pass, desc);
|
||||
|
||||
cert = load_cert_pass(uri, 0, pass_string, desc);
|
||||
clear_free(pass_string);
|
||||
return cert;
|
||||
}
|
||||
|
||||
/* TODO remove when PR #4930 is merged */
|
||||
static int load_pkcs12(BIO *in, const char *desc,
|
||||
pem_password_cb *pem_cb, void *cb_data,
|
||||
EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca)
|
||||
{
|
||||
const char *pass;
|
||||
char tpass[PEM_BUFSIZE];
|
||||
int len;
|
||||
int ret = 0;
|
||||
PKCS12 *p12 = d2i_PKCS12_bio(in, NULL);
|
||||
|
||||
if (desc == NULL)
|
||||
desc = "PKCS12 input";
|
||||
if (p12 == NULL) {
|
||||
BIO_printf(bio_err, "error loading PKCS12 file for %s\n", desc);
|
||||
goto die;
|
||||
}
|
||||
|
||||
/* See if an empty password will do */
|
||||
if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0)) {
|
||||
pass = "";
|
||||
} else {
|
||||
if (pem_cb == NULL)
|
||||
pem_cb = wrap_password_callback;
|
||||
len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
|
||||
if (len < 0) {
|
||||
BIO_printf(bio_err, "passphrase callback error for %s\n", desc);
|
||||
goto die;
|
||||
}
|
||||
if (len < PEM_BUFSIZE)
|
||||
tpass[len] = 0;
|
||||
if (!PKCS12_verify_mac(p12, tpass, len)) {
|
||||
BIO_printf(bio_err,
|
||||
"mac verify error (wrong password?) in PKCS12 file for %s\n",
|
||||
desc);
|
||||
goto die;
|
||||
}
|
||||
pass = tpass;
|
||||
}
|
||||
ret = PKCS12_parse(p12, pass, pkey, cert, ca);
|
||||
die:
|
||||
PKCS12_free(p12);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* TODO potentially move this and related functions to apps/lib/apps.c */
|
||||
static int adjust_format(const char **infile, int format, int engine_ok)
|
||||
{
|
||||
if (!strncasecmp(*infile, "http://", 7)
|
||||
|| !strncasecmp(*infile, "https://", 8)) {
|
||||
format = FORMAT_HTTP;
|
||||
} else if (engine_ok && strncasecmp(*infile, "engine:", 7) == 0) {
|
||||
*infile += 7;
|
||||
format = FORMAT_ENGINE;
|
||||
} else {
|
||||
if (strncasecmp(*infile, "file:", 5) == 0)
|
||||
*infile += 5;
|
||||
/*
|
||||
* the following is a heuristic whether first to try PEM or DER
|
||||
* or PKCS12 as the input format for files
|
||||
*/
|
||||
if (strlen(*infile) >= 4) {
|
||||
const char *extension = *infile + strlen(*infile) - 4;
|
||||
|
||||
if (strncasecmp(extension, ".crt", 4) == 0
|
||||
|| strncasecmp(extension, ".pem", 4) == 0)
|
||||
/* weak recognition of PEM format */
|
||||
format = FORMAT_PEM;
|
||||
else if (strncasecmp(extension, ".cer", 4) == 0
|
||||
|| strncasecmp(extension, ".der", 4) == 0)
|
||||
/* weak recognition of DER format */
|
||||
format = FORMAT_ASN1;
|
||||
else if (strncasecmp(extension, ".p12", 4) == 0)
|
||||
/* weak recognition of PKCS#12 format */
|
||||
format = FORMAT_PKCS12;
|
||||
/* else retain given format */
|
||||
}
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO potentially move this and related functions to apps/lib/
|
||||
* or even better extend OSSL_STORE with type OSSL_STORE_INFO_CRL
|
||||
*/
|
||||
static X509_REQ *load_csr_autofmt(const char *infile, const char *desc)
|
||||
{
|
||||
X509_REQ *csr;
|
||||
BIO *bio_bak = bio_err;
|
||||
int can_retry;
|
||||
int format = adjust_format(&infile, FORMAT_PEM, 0);
|
||||
|
||||
can_retry = format == FORMAT_PEM || format == FORMAT_ASN1;
|
||||
if (can_retry)
|
||||
bio_err = NULL; /* do not show errors on more than one try */
|
||||
csr = load_csr(infile, format, desc);
|
||||
bio_err = bio_bak;
|
||||
if (csr == NULL && can_retry) {
|
||||
ERR_clear_error();
|
||||
format = (format == FORMAT_PEM ? FORMAT_ASN1 : FORMAT_PEM);
|
||||
csr = load_csr(infile, format, desc);
|
||||
}
|
||||
if (csr == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "error: unable to load %s from file '%s'\n", desc,
|
||||
infile);
|
||||
}
|
||||
return csr;
|
||||
}
|
||||
|
||||
/* TODO replace by calling generalized load_certs() when PR #4930 is merged */
|
||||
static int load_certs_preliminary(const char *file, STACK_OF(X509) **certs,
|
||||
int format, const char *pass,
|
||||
const char *desc)
|
||||
{
|
||||
X509 *cert = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (format == FORMAT_PKCS12) {
|
||||
BIO *bio = bio_open_default(file, 'r', format);
|
||||
|
||||
if (bio != NULL) {
|
||||
EVP_PKEY *pkey = NULL; /* pkey is needed until PR #4930 is merged */
|
||||
PW_CB_DATA cb_data;
|
||||
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = file;
|
||||
ret = load_pkcs12(bio, desc, wrap_password_callback,
|
||||
&cb_data, &pkey, &cert, certs);
|
||||
EVP_PKEY_free(pkey);
|
||||
BIO_free(bio);
|
||||
}
|
||||
} else if (format == FORMAT_ASN1) { /* load only one cert in this case */
|
||||
CMP_warn1("can load only one certificate in DER format from %s", file);
|
||||
cert = load_cert_pass(file, 0, pass, desc);
|
||||
}
|
||||
if (format == FORMAT_PKCS12 || format == FORMAT_ASN1) {
|
||||
if (cert) {
|
||||
if (*certs == NULL)
|
||||
*certs = sk_X509_new_null();
|
||||
if (*certs != NULL)
|
||||
ret = sk_X509_insert(*certs, cert, 0);
|
||||
else
|
||||
X509_free(cert);
|
||||
}
|
||||
} else {
|
||||
ret = load_certs(file, certs, format, pass, desc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void warn_certs_expired(const char *file, STACK_OF(X509) **certs)
|
||||
{
|
||||
int i, res;
|
||||
X509 *cert;
|
||||
char *subj;
|
||||
|
||||
for (i = 0; i < sk_X509_num(*certs); i++) {
|
||||
cert = sk_X509_value(*certs, i);
|
||||
res = X509_cmp_timeframe(vpm, X509_get0_notBefore(cert),
|
||||
X509_get0_notAfter(cert));
|
||||
if (res != 0) {
|
||||
subj = X509_NAME_oneline(X509_get_subject_name(cert), NULL, 0);
|
||||
CMP_warn3("certificate from '%s' with subject '%s' %s", file, subj,
|
||||
res > 0 ? "has expired" : "not yet valid");
|
||||
OPENSSL_free(subj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO potentially move this and related functions to apps/lib/
|
||||
* or even better extend OSSL_STORE with type OSSL_STORE_INFO_CERTS
|
||||
*/
|
||||
static int load_certs_autofmt(const char *infile, STACK_OF(X509) **certs,
|
||||
int exclude_http, const char *pass,
|
||||
const char *desc)
|
||||
{
|
||||
int ret = 0;
|
||||
char *pass_string;
|
||||
BIO *bio_bak = bio_err;
|
||||
int format = adjust_format(&infile, opt_certsform, 0);
|
||||
|
||||
if (exclude_http && format == FORMAT_HTTP) {
|
||||
BIO_printf(bio_err, "error: HTTP retrieval not allowed for %s\n", desc);
|
||||
return ret;
|
||||
}
|
||||
pass_string = get_passwd(pass, desc);
|
||||
if (format != FORMAT_HTTP)
|
||||
bio_err = NULL; /* do not show errors on more than one try */
|
||||
ret = load_certs_preliminary(infile, certs, format, pass_string, desc);
|
||||
bio_err = bio_bak;
|
||||
if (!ret && format != FORMAT_HTTP) {
|
||||
int format2 = format == FORMAT_PEM ? FORMAT_ASN1 : FORMAT_PEM;
|
||||
|
||||
ERR_clear_error();
|
||||
ret = load_certs_preliminary(infile, certs, format2, pass_string, desc);
|
||||
}
|
||||
clear_free(pass_string);
|
||||
|
||||
if (ret)
|
||||
warn_certs_expired(infile, certs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set expected host name/IP addr and clears the email addr in the given ts */
|
||||
static int truststore_set_host_etc(X509_STORE *ts, char *host)
|
||||
{
|
||||
X509_VERIFY_PARAM *ts_vpm = X509_STORE_get0_param(ts);
|
||||
|
||||
/* first clear any host names, IP, and email addresses */
|
||||
if (!X509_VERIFY_PARAM_set1_host(ts_vpm, NULL, 0)
|
||||
|| !X509_VERIFY_PARAM_set1_ip(ts_vpm, NULL, 0)
|
||||
|| !X509_VERIFY_PARAM_set1_email(ts_vpm, NULL, 0))
|
||||
return 0;
|
||||
X509_VERIFY_PARAM_set_hostflags(ts_vpm,
|
||||
X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT |
|
||||
X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
|
||||
return (host != NULL && X509_VERIFY_PARAM_set1_ip_asc(ts_vpm, host))
|
||||
|| X509_VERIFY_PARAM_set1_host(ts_vpm, host, 0);
|
||||
}
|
||||
|
||||
static X509_STORE *sk_X509_to_store(X509_STORE *store /* may be NULL */,
|
||||
const STACK_OF(X509) *certs /* may NULL */)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (store == NULL)
|
||||
store = X509_STORE_new();
|
||||
if (store == NULL)
|
||||
return NULL;
|
||||
for (i = 0; i < sk_X509_num(certs); i++) {
|
||||
if (!X509_STORE_add_cert(store, sk_X509_value(certs, i))) {
|
||||
X509_STORE_free(store);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
/* write OSSL_CMP_MSG DER-encoded to the specified file name item */
|
||||
static int write_PKIMESSAGE(const OSSL_CMP_MSG *msg, char **filenames)
|
||||
{
|
||||
char *file;
|
||||
BIO *bio;
|
||||
|
||||
if (msg == NULL || filenames == NULL) {
|
||||
CMP_err("NULL arg to write_PKIMESSAGE");
|
||||
return 0;
|
||||
}
|
||||
if (*filenames == NULL) {
|
||||
CMP_err("Not enough file names provided for writing PKIMessage");
|
||||
return 0;
|
||||
}
|
||||
|
||||
file = *filenames;
|
||||
*filenames = next_item(file);
|
||||
bio = BIO_new_file(file, "wb");
|
||||
if (bio == NULL) {
|
||||
CMP_err1("Cannot open file '%s' for writing", file);
|
||||
return 0;
|
||||
}
|
||||
if (i2d_OSSL_CMP_MSG_bio(bio, msg) < 0) {
|
||||
CMP_err1("Cannot write PKIMessage to file '%s'", file);
|
||||
BIO_free(bio);
|
||||
return 0;
|
||||
}
|
||||
BIO_free(bio);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* read DER-encoded OSSL_CMP_MSG from the specified file name item */
|
||||
static OSSL_CMP_MSG *read_PKIMESSAGE(char **filenames)
|
||||
{
|
||||
char *file;
|
||||
BIO *bio;
|
||||
OSSL_CMP_MSG *ret;
|
||||
|
||||
if (filenames == NULL) {
|
||||
CMP_err("NULL arg to read_PKIMESSAGE");
|
||||
return NULL;
|
||||
}
|
||||
if (*filenames == NULL) {
|
||||
CMP_err("Not enough file names provided for reading PKIMessage");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
file = *filenames;
|
||||
*filenames = next_item(file);
|
||||
bio = BIO_new_file(file, "rb");
|
||||
if (bio == NULL) {
|
||||
CMP_err1("Cannot open file '%s' for reading", file);
|
||||
return NULL;
|
||||
}
|
||||
ret = d2i_OSSL_CMP_MSG_bio(bio, NULL);
|
||||
if (ret == NULL)
|
||||
CMP_err1("Cannot read PKIMessage from file '%s'", file);
|
||||
BIO_free(bio);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*-
|
||||
* Sends the PKIMessage req and on success place the response in *res
|
||||
* basically like OSSL_CMP_MSG_http_perform(), but in addition allows
|
||||
* to dump the sequence of requests and responses to files and/or
|
||||
* to take the sequence of requests and responses from files.
|
||||
*/
|
||||
static OSSL_CMP_MSG *read_write_req_resp(OSSL_CMP_CTX *ctx,
|
||||
const OSSL_CMP_MSG *req)
|
||||
{
|
||||
OSSL_CMP_MSG *req_new = NULL;
|
||||
OSSL_CMP_MSG *res = NULL;
|
||||
OSSL_CMP_PKIHEADER *hdr;
|
||||
|
||||
if (req != NULL && opt_reqout != NULL
|
||||
&& !write_PKIMESSAGE(req, &opt_reqout))
|
||||
goto err;
|
||||
if (opt_reqin != NULL && opt_rspin == NULL) {
|
||||
if ((req_new = read_PKIMESSAGE(&opt_reqin)) == NULL)
|
||||
goto err;
|
||||
/*-
|
||||
* The transaction ID in req_new read from opt_reqin may not be fresh.
|
||||
* In this case the server may complain "Transaction id already in use."
|
||||
* The following workaround unfortunately requires re-protection.
|
||||
*/
|
||||
if (opt_reqin_new_tid
|
||||
&& !OSSL_CMP_MSG_update_transactionID(ctx, req_new))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_rspin != NULL) {
|
||||
res = read_PKIMESSAGE(&opt_rspin);
|
||||
} else {
|
||||
const OSSL_CMP_MSG *actual_req = opt_reqin != NULL ? req_new : req;
|
||||
|
||||
res = opt_use_mock_srv
|
||||
? OSSL_CMP_CTX_server_perform(ctx, actual_req)
|
||||
: OSSL_CMP_MSG_http_perform(ctx, actual_req);
|
||||
}
|
||||
if (res == NULL)
|
||||
goto err;
|
||||
|
||||
if (opt_reqin != NULL || opt_rspin != NULL) {
|
||||
/* need to satisfy nonce and transactionID checks */
|
||||
ASN1_OCTET_STRING *nonce;
|
||||
ASN1_OCTET_STRING *tid;
|
||||
|
||||
hdr = OSSL_CMP_MSG_get0_header(res);
|
||||
nonce = OSSL_CMP_HDR_get0_recipNonce(hdr);
|
||||
tid = OSSL_CMP_HDR_get0_transactionID(hdr);
|
||||
if (!OSSL_CMP_CTX_set1_senderNonce(ctx, nonce)
|
||||
|| !OSSL_CMP_CTX_set1_transactionID(ctx, tid)) {
|
||||
OSSL_CMP_MSG_free(res);
|
||||
res = NULL;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_rspout != NULL && !write_PKIMESSAGE(res, &opt_rspout)) {
|
||||
OSSL_CMP_MSG_free(res);
|
||||
res = NULL;
|
||||
}
|
||||
|
||||
err:
|
||||
OSSL_CMP_MSG_free(req_new);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* parse string as integer value, not allowing trailing garbage, see also
|
||||
* https://www.gnu.org/software/libc/manual/html_node/Parsing-of-Integers.html
|
||||
*
|
||||
* returns integer value, or INT_MIN on error
|
||||
*/
|
||||
static int atoint(const char *str)
|
||||
{
|
||||
char *tailptr;
|
||||
long res = strtol(str, &tailptr, 10);
|
||||
|
||||
if ((*tailptr != '\0') || (res < INT_MIN) || (res > INT_MAX))
|
||||
return INT_MIN;
|
||||
else
|
||||
return (int)res;
|
||||
}
|
||||
|
||||
static int parse_addr(char **opt_string, int port, const char *name)
|
||||
{
|
||||
char *port_string;
|
||||
|
||||
if (strncasecmp(*opt_string, OSSL_HTTP_PREFIX,
|
||||
strlen(OSSL_HTTP_PREFIX)) == 0) {
|
||||
*opt_string += strlen(OSSL_HTTP_PREFIX);
|
||||
} else if (strncasecmp(*opt_string, OSSL_HTTPS_PREFIX,
|
||||
strlen(OSSL_HTTPS_PREFIX)) == 0) {
|
||||
*opt_string += strlen(OSSL_HTTPS_PREFIX);
|
||||
if (port == 0)
|
||||
port = 443; /* == integer value of OSSL_HTTPS_PORT */
|
||||
}
|
||||
|
||||
if ((port_string = strrchr(*opt_string, ':')) == NULL)
|
||||
return port; /* using default */
|
||||
*(port_string++) = '\0';
|
||||
port = atoint(port_string);
|
||||
if ((port <= 0) || (port > 65535)) {
|
||||
CMP_err2("invalid %s port '%s' given, sane range 1-65535",
|
||||
name, port_string);
|
||||
return -1;
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
static int set1_store_parameters(X509_STORE *ts)
|
||||
{
|
||||
if (ts == NULL)
|
||||
return 0;
|
||||
|
||||
/* copy vpm to store */
|
||||
if (!X509_STORE_set1_param(ts, vpm /* may be NULL */)) {
|
||||
BIO_printf(bio_err, "error setting verification parameters\n");
|
||||
OSSL_CMP_CTX_print_errors(cmp_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_STORE_set_verify_cb(ts, X509_STORE_CTX_print_verify_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int set_name(const char *str,
|
||||
int (*set_fn) (OSSL_CMP_CTX *ctx, const X509_NAME *name),
|
||||
OSSL_CMP_CTX *ctx, const char *desc)
|
||||
{
|
||||
if (str != NULL) {
|
||||
X509_NAME *n = parse_name(str, MBSTRING_ASC, 0);
|
||||
|
||||
if (n == NULL) {
|
||||
CMP_err2("cannot parse %s DN '%s'", desc, str);
|
||||
return 0;
|
||||
}
|
||||
if (!(*set_fn) (ctx, n)) {
|
||||
X509_NAME_free(n);
|
||||
CMP_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
X509_NAME_free(n);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int set_gennames(OSSL_CMP_CTX *ctx, char *names, const char *desc)
|
||||
{
|
||||
char *next;
|
||||
|
||||
for (; names != NULL; names = next) {
|
||||
GENERAL_NAME *n;
|
||||
|
||||
next = next_item(names);
|
||||
if (strcmp(names, "critical") == 0) {
|
||||
(void)OSSL_CMP_CTX_set_option(ctx,
|
||||
OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL,
|
||||
1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* try IP address first, then URI or domain name */
|
||||
(void)ERR_set_mark();
|
||||
n = a2i_GENERAL_NAME(NULL, NULL, NULL, GEN_IPADD, names, 0);
|
||||
if (n == NULL)
|
||||
n = a2i_GENERAL_NAME(NULL, NULL, NULL,
|
||||
strchr(names, ':') != NULL ? GEN_URI : GEN_DNS,
|
||||
names, 0);
|
||||
(void)ERR_pop_to_mark();
|
||||
|
||||
if (n == NULL) {
|
||||
CMP_err2("bad syntax of %s '%s'", desc, names);
|
||||
return 0;
|
||||
}
|
||||
if (!OSSL_CMP_CTX_push1_subjectAltName(ctx, n)) {
|
||||
GENERAL_NAME_free(n);
|
||||
CMP_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
GENERAL_NAME_free(n);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TODO potentially move to apps/lib/apps.c */
|
||||
/*
|
||||
* create cert store structure with certificates read from given file(s)
|
||||
* returns pointer to created X509_STORE on success, NULL on error
|
||||
*/
|
||||
static X509_STORE *load_certstore(char *input, const char *desc)
|
||||
{
|
||||
X509_STORE *store = NULL;
|
||||
STACK_OF(X509) *certs = NULL;
|
||||
|
||||
if (input == NULL)
|
||||
goto err;
|
||||
|
||||
while (input != NULL) {
|
||||
char *next = next_item(input); \
|
||||
|
||||
if (!load_certs_autofmt(input, &certs, 1, opt_otherpass, desc)
|
||||
|| !(store = sk_X509_to_store(store, certs))) {
|
||||
/* CMP_err("out of memory"); */
|
||||
X509_STORE_free(store);
|
||||
store = NULL;
|
||||
goto err;
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
certs = NULL;
|
||||
input = next;
|
||||
}
|
||||
err:
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
return store;
|
||||
}
|
||||
|
||||
/* TODO potentially move to apps/lib/apps.c */
|
||||
static STACK_OF(X509) *load_certs_multifile(char *files,
|
||||
const char *pass, const char *desc)
|
||||
{
|
||||
STACK_OF(X509) *certs = NULL;
|
||||
STACK_OF(X509) *result = sk_X509_new_null();
|
||||
|
||||
if (files == NULL)
|
||||
goto err;
|
||||
if (result == NULL)
|
||||
goto oom;
|
||||
|
||||
while (files != NULL) {
|
||||
char *next = next_item(files);
|
||||
|
||||
if (!load_certs_autofmt(files, &certs, 0, pass, desc))
|
||||
goto err;
|
||||
if (!sk_X509_add1_certs(result, certs, 0, 1 /* no dups */, 0))
|
||||
goto oom;
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
certs = NULL;
|
||||
files = next;
|
||||
}
|
||||
return result;
|
||||
|
||||
oom:
|
||||
BIO_printf(bio_err, "out of memory\n");
|
||||
err:
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
sk_X509_pop_free(result, X509_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef int (*add_X509_stack_fn_t)(void *ctx, const STACK_OF(X509) *certs);
|
||||
typedef int (*add_X509_fn_t)(void *ctx, const X509 *cert);
|
||||
|
||||
static int setup_certs(char *files, const char *desc, void *ctx,
|
||||
add_X509_stack_fn_t addn_fn, add_X509_fn_t add1_fn)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
if (files != NULL) {
|
||||
STACK_OF(X509) *certs = load_certs_multifile(files, opt_otherpass,
|
||||
desc);
|
||||
if (certs == NULL) {
|
||||
ret = 0;
|
||||
} else {
|
||||
if (addn_fn != NULL) {
|
||||
ret = (*addn_fn)(ctx, certs);
|
||||
} else {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sk_X509_num(certs /* may be NULL */); i++)
|
||||
ret &= (*add1_fn)(ctx, sk_X509_value(certs, i));
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* parse and transform some options, checking their syntax.
|
||||
* Returns 1 on success, 0 on error
|
||||
*/
|
||||
static int transform_opts(void)
|
||||
{
|
||||
if (opt_cmd_s != NULL) {
|
||||
if (!strcmp(opt_cmd_s, "ir")) {
|
||||
opt_cmd = CMP_IR;
|
||||
} else if (!strcmp(opt_cmd_s, "kur")) {
|
||||
opt_cmd = CMP_KUR;
|
||||
} else if (!strcmp(opt_cmd_s, "cr")) {
|
||||
opt_cmd = CMP_CR;
|
||||
} else if (!strcmp(opt_cmd_s, "p10cr")) {
|
||||
opt_cmd = CMP_P10CR;
|
||||
} else if (!strcmp(opt_cmd_s, "rr")) {
|
||||
opt_cmd = CMP_RR;
|
||||
} else if (!strcmp(opt_cmd_s, "genm")) {
|
||||
opt_cmd = CMP_GENM;
|
||||
} else {
|
||||
CMP_err1("unknown cmp command '%s'", opt_cmd_s);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
CMP_err("no cmp command to execute");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_NO_ENGINE
|
||||
# define FORMAT_OPTIONS (OPT_FMT_PEMDER | OPT_FMT_PKCS12 | OPT_FMT_ENGINE)
|
||||
#else
|
||||
# define FORMAT_OPTIONS (OPT_FMT_PEMDER | OPT_FMT_PKCS12)
|
||||
#endif
|
||||
|
||||
if (opt_keyform_s != NULL
|
||||
&& !opt_format(opt_keyform_s, FORMAT_OPTIONS, &opt_keyform)) {
|
||||
CMP_err("unknown option given for key loading format");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef FORMAT_OPTIONS
|
||||
|
||||
if (opt_certform_s != NULL
|
||||
&& !opt_format(opt_certform_s, OPT_FMT_PEMDER, &opt_certform)) {
|
||||
CMP_err("unknown option given for certificate storing format");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (opt_certsform_s != NULL
|
||||
&& !opt_format(opt_certsform_s, OPT_FMT_PEMDER | OPT_FMT_PKCS12,
|
||||
&opt_certsform)) {
|
||||
CMP_err("unknown option given for certificate list loading format");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static OSSL_CMP_SRV_CTX *setup_srv_ctx(ENGINE *e)
|
||||
{
|
||||
OSSL_CMP_CTX *ctx; /* extra CMP (client) ctx partly used by server */
|
||||
OSSL_CMP_SRV_CTX *srv_ctx = ossl_cmp_mock_srv_new();
|
||||
|
||||
if (srv_ctx == NULL)
|
||||
return NULL;
|
||||
ctx = OSSL_CMP_SRV_CTX_get0_cmp_ctx(srv_ctx);
|
||||
|
||||
if (opt_srv_ref == NULL) {
|
||||
if (opt_srv_cert == NULL) {
|
||||
/* opt_srv_cert should determine the sender */
|
||||
CMP_err("must give -srv_ref for server if no -srv_cert given");
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
if (!OSSL_CMP_CTX_set1_referenceValue(ctx, (unsigned char *)opt_srv_ref,
|
||||
strlen(opt_srv_ref)))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_srv_secret != NULL) {
|
||||
int res;
|
||||
char *pass_str = get_passwd(opt_srv_secret, "PBMAC secret of server");
|
||||
|
||||
if (pass_str != NULL) {
|
||||
cleanse(opt_srv_secret);
|
||||
res = OSSL_CMP_CTX_set1_secretValue(ctx, (unsigned char *)pass_str,
|
||||
strlen(pass_str));
|
||||
clear_free(pass_str);
|
||||
if (res == 0)
|
||||
goto err;
|
||||
}
|
||||
} else if (opt_srv_cert == NULL) {
|
||||
CMP_err("server credentials must be given if -use_mock_srv or -port is used");
|
||||
goto err;
|
||||
} else {
|
||||
CMP_warn("server will not be able to handle PBM-protected requests since -srv_secret is not given");
|
||||
}
|
||||
|
||||
if (opt_srv_secret == NULL
|
||||
&& ((opt_srv_cert == NULL) != (opt_srv_key == NULL))) {
|
||||
CMP_err("must give both -srv_cert and -srv_key options or neither");
|
||||
goto err;
|
||||
}
|
||||
if (opt_srv_cert != NULL) {
|
||||
X509 *srv_cert = load_cert_pwd(opt_srv_cert, opt_srv_keypass,
|
||||
"certificate of the server");
|
||||
|
||||
if (srv_cert == NULL || !OSSL_CMP_CTX_set1_cert(ctx, srv_cert)) {
|
||||
X509_free(srv_cert);
|
||||
goto err;
|
||||
}
|
||||
X509_free(srv_cert);
|
||||
}
|
||||
if (opt_srv_key != NULL) {
|
||||
EVP_PKEY *pkey = load_key_pwd(opt_srv_key, opt_keyform,
|
||||
opt_srv_keypass,
|
||||
e, "private key for server cert");
|
||||
|
||||
if (pkey == NULL || !OSSL_CMP_CTX_set1_pkey(ctx, pkey)) {
|
||||
EVP_PKEY_free(pkey);
|
||||
goto err;
|
||||
}
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
cleanse(opt_srv_keypass);
|
||||
|
||||
if (opt_srv_trusted != NULL) {
|
||||
X509_STORE *ts =
|
||||
load_certstore(opt_srv_trusted, "certificates trusted by server");
|
||||
|
||||
if (ts == NULL)
|
||||
goto err;
|
||||
if (!set1_store_parameters(ts)
|
||||
|| !truststore_set_host_etc(ts, NULL)
|
||||
|| !OSSL_CMP_CTX_set0_trustedStore(ctx, ts)) {
|
||||
X509_STORE_free(ts);
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
CMP_warn("server will not be able to handle signature-protected requests since -srv_trusted is not given");
|
||||
}
|
||||
if (!setup_certs(opt_srv_untrusted, "untrusted certificates", ctx,
|
||||
(add_X509_stack_fn_t)OSSL_CMP_CTX_set1_untrusted_certs,
|
||||
NULL))
|
||||
goto err;
|
||||
|
||||
if (opt_rsp_cert == NULL) {
|
||||
CMP_err("must give -rsp_cert for mock server");
|
||||
goto err;
|
||||
} else {
|
||||
X509 *cert = load_cert_pwd(opt_rsp_cert, opt_keypass,
|
||||
"cert to be returned by the mock server");
|
||||
|
||||
if (cert == NULL)
|
||||
goto err;
|
||||
/* from server perspective the server is the client */
|
||||
if (!ossl_cmp_mock_srv_set1_certOut(srv_ctx, cert)) {
|
||||
X509_free(cert);
|
||||
goto err;
|
||||
}
|
||||
X509_free(cert);
|
||||
}
|
||||
/* TODO find a cleaner solution not requiring type casts */
|
||||
if (!setup_certs(opt_rsp_extracerts,
|
||||
"CMP extra certificates for mock server", srv_ctx,
|
||||
(add_X509_stack_fn_t)ossl_cmp_mock_srv_set1_chainOut,
|
||||
NULL))
|
||||
goto err;
|
||||
if (!setup_certs(opt_rsp_capubs, "caPubs for mock server", srv_ctx,
|
||||
(add_X509_stack_fn_t)ossl_cmp_mock_srv_set1_caPubsOut,
|
||||
NULL))
|
||||
goto err;
|
||||
(void)ossl_cmp_mock_srv_set_pollCount(srv_ctx, opt_poll_count);
|
||||
(void)ossl_cmp_mock_srv_set_checkAfterTime(srv_ctx, opt_check_after);
|
||||
if (opt_grant_implicitconf)
|
||||
(void)OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(srv_ctx, 1);
|
||||
|
||||
if (opt_failure != INT_MIN) { /* option has been set explicity */
|
||||
if (opt_failure < 0 || OSSL_CMP_PKIFAILUREINFO_MAX < opt_failure) {
|
||||
CMP_err1("-failure out of range, should be >= 0 and <= %d",
|
||||
OSSL_CMP_PKIFAILUREINFO_MAX);
|
||||
goto err;
|
||||
}
|
||||
if (opt_failurebits != 0)
|
||||
CMP_warn("-failurebits overrides -failure");
|
||||
else
|
||||
opt_failurebits = 1 << opt_failure;
|
||||
}
|
||||
if ((unsigned)opt_failurebits > OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN) {
|
||||
CMP_err("-failurebits out of range");
|
||||
goto err;
|
||||
}
|
||||
if (!ossl_cmp_mock_srv_set_statusInfo(srv_ctx, opt_pkistatus,
|
||||
opt_failurebits, opt_statusstring))
|
||||
goto err;
|
||||
|
||||
if (opt_send_error)
|
||||
(void)ossl_cmp_mock_srv_set_send_error(srv_ctx, 1);
|
||||
|
||||
if (opt_send_unprotected)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_UNPROTECTED_SEND, 1);
|
||||
if (opt_send_unprot_err)
|
||||
(void)OSSL_CMP_SRV_CTX_set_send_unprotected_errors(srv_ctx, 1);
|
||||
if (opt_accept_unprotected)
|
||||
(void)OSSL_CMP_SRV_CTX_set_accept_unprotected(srv_ctx, 1);
|
||||
if (opt_accept_unprot_err)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_UNPROTECTED_ERRORS, 1);
|
||||
if (opt_accept_raverified)
|
||||
(void)OSSL_CMP_SRV_CTX_set_accept_raverified(srv_ctx, 1);
|
||||
|
||||
return srv_ctx;
|
||||
|
||||
err:
|
||||
ossl_cmp_mock_srv_free(srv_ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up verification aspects of OSSL_CMP_CTX w.r.t. opts from config file/CLI.
|
||||
* Returns pointer on success, NULL on error
|
||||
*/
|
||||
static int setup_verification_ctx(OSSL_CMP_CTX *ctx)
|
||||
{
|
||||
if (!setup_certs(opt_untrusted, "untrusted certificates", ctx,
|
||||
(add_X509_stack_fn_t)OSSL_CMP_CTX_set1_untrusted_certs,
|
||||
NULL))
|
||||
goto err;
|
||||
|
||||
if (opt_srvcert != NULL || opt_trusted != NULL) {
|
||||
X509_STORE *ts = NULL;
|
||||
|
||||
if (opt_srvcert != NULL) {
|
||||
X509 *srvcert;
|
||||
|
||||
if (opt_trusted != NULL) {
|
||||
CMP_warn("-trusted option is ignored since -srvcert option is present");
|
||||
opt_trusted = NULL;
|
||||
}
|
||||
if (opt_recipient != NULL) {
|
||||
CMP_warn("-recipient option is ignored since -srvcert option is present");
|
||||
opt_recipient = NULL;
|
||||
}
|
||||
srvcert = load_cert_pwd(opt_srvcert, opt_otherpass,
|
||||
"directly trusted CMP server certificate");
|
||||
if (srvcert == NULL)
|
||||
/*
|
||||
* opt_otherpass is needed in case
|
||||
* opt_srvcert is an encrypted PKCS#12 file
|
||||
*/
|
||||
goto err;
|
||||
if (!OSSL_CMP_CTX_set1_srvCert(ctx, srvcert)) {
|
||||
X509_free(srvcert);
|
||||
goto oom;
|
||||
}
|
||||
X509_free(srvcert);
|
||||
if ((ts = X509_STORE_new()) == NULL)
|
||||
goto oom;
|
||||
}
|
||||
if (opt_trusted != NULL
|
||||
&& (ts = load_certstore(opt_trusted, "trusted certificates"))
|
||||
== NULL)
|
||||
goto err;
|
||||
if (!set1_store_parameters(ts) /* also copies vpm */
|
||||
/*
|
||||
* clear any expected host/ip/email address;
|
||||
* opt_expect_sender is used instead
|
||||
*/
|
||||
|| !truststore_set_host_etc(ts, NULL)
|
||||
|| !OSSL_CMP_CTX_set0_trustedStore(ctx, ts)) {
|
||||
X509_STORE_free(ts);
|
||||
goto oom;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_ignore_keyusage)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_IGNORE_KEYUSAGE, 1);
|
||||
|
||||
if (opt_unprotected_errors)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_UNPROTECTED_ERRORS, 1);
|
||||
|
||||
if (opt_out_trusted != NULL) { /* for use in OSSL_CMP_certConf_cb() */
|
||||
X509_VERIFY_PARAM *out_vpm = NULL;
|
||||
X509_STORE *out_trusted =
|
||||
load_certstore(opt_out_trusted,
|
||||
"trusted certs for verifying newly enrolled cert");
|
||||
|
||||
if (out_trusted == NULL)
|
||||
goto err;
|
||||
/* any -verify_hostname, -verify_ip, and -verify_email apply here */
|
||||
if (!set1_store_parameters(out_trusted))
|
||||
goto oom;
|
||||
/* ignore any -attime here, new certs are current anyway */
|
||||
out_vpm = X509_STORE_get0_param(out_trusted);
|
||||
X509_VERIFY_PARAM_clear_flags(out_vpm, X509_V_FLAG_USE_CHECK_TIME);
|
||||
|
||||
(void)OSSL_CMP_CTX_set_certConf_cb_arg(ctx, out_trusted);
|
||||
}
|
||||
|
||||
if (opt_disable_confirm)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_DISABLE_CONFIRM, 1);
|
||||
|
||||
if (opt_implicit_confirm)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_IMPLICIT_CONFIRM, 1);
|
||||
|
||||
(void)OSSL_CMP_CTX_set_certConf_cb(ctx, OSSL_CMP_certConf_cb);
|
||||
|
||||
return 1;
|
||||
|
||||
oom:
|
||||
CMP_err("out of memory");
|
||||
err:
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
/*
|
||||
* set up ssl_ctx for the OSSL_CMP_CTX based on options from config file/CLI.
|
||||
* Returns pointer on success, NULL on error
|
||||
*/
|
||||
static SSL_CTX *setup_ssl_ctx(OSSL_CMP_CTX *ctx, ENGINE *e)
|
||||
{
|
||||
STACK_OF(X509) *untrusted_certs = OSSL_CMP_CTX_get0_untrusted_certs(ctx);
|
||||
EVP_PKEY *pkey = NULL;
|
||||
X509_STORE *trust_store = NULL;
|
||||
SSL_CTX *ssl_ctx;
|
||||
int i;
|
||||
|
||||
ssl_ctx = SSL_CTX_new(TLS_client_method());
|
||||
if (ssl_ctx == NULL)
|
||||
return NULL;
|
||||
|
||||
SSL_CTX_set_mode(ssl_ctx, SSL_MODE_AUTO_RETRY);
|
||||
|
||||
if (opt_tls_trusted != NULL) {
|
||||
if ((trust_store = load_certstore(opt_tls_trusted,
|
||||
"trusted TLS certificates")) == NULL)
|
||||
goto err;
|
||||
SSL_CTX_set_cert_store(ssl_ctx, trust_store);
|
||||
/* for improved diagnostics on SSL_CTX_build_cert_chain() errors: */
|
||||
X509_STORE_set_verify_cb(trust_store, X509_STORE_CTX_print_verify_cb);
|
||||
}
|
||||
|
||||
if (opt_tls_cert != NULL && opt_tls_key != NULL) {
|
||||
X509 *cert;
|
||||
STACK_OF(X509) *certs = NULL;
|
||||
|
||||
if (!load_certs_autofmt(opt_tls_cert, &certs, 0, opt_tls_keypass,
|
||||
"TLS client certificate (optionally with chain)"))
|
||||
/*
|
||||
* opt_tls_keypass is needed in case opt_tls_cert is an encrypted
|
||||
* PKCS#12 file
|
||||
*/
|
||||
goto err;
|
||||
|
||||
cert = sk_X509_delete(certs, 0);
|
||||
if (cert == NULL || SSL_CTX_use_certificate(ssl_ctx, cert) <= 0) {
|
||||
CMP_err1("unable to use client TLS certificate file '%s'",
|
||||
opt_tls_cert);
|
||||
X509_free(cert);
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
goto err;
|
||||
}
|
||||
X509_free(cert); /* we do not need the handle any more */
|
||||
|
||||
/*
|
||||
* Any further certs and any untrusted certs are used for constructing
|
||||
* the chain to be provided with the TLS client cert to the TLS server.
|
||||
*/
|
||||
if (!SSL_CTX_set0_chain(ssl_ctx, certs)) {
|
||||
CMP_err("could not set TLS client cert chain");
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < sk_X509_num(untrusted_certs); i++) {
|
||||
cert = sk_X509_value(untrusted_certs, i);
|
||||
if (!SSL_CTX_add1_chain_cert(ssl_ctx, cert)) {
|
||||
CMP_err("could not add untrusted cert to TLS client cert chain");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!SSL_CTX_build_cert_chain(ssl_ctx,
|
||||
SSL_BUILD_CHAIN_FLAG_UNTRUSTED |
|
||||
SSL_BUILD_CHAIN_FLAG_NO_ROOT)) {
|
||||
CMP_warn("could not build cert chain for own TLS cert");
|
||||
OSSL_CMP_CTX_print_errors(ctx);
|
||||
}
|
||||
|
||||
/* If present we append to the list also the certs from opt_tls_extra */
|
||||
if (opt_tls_extra != NULL) {
|
||||
STACK_OF(X509) *tls_extra = load_certs_multifile(opt_tls_extra,
|
||||
opt_otherpass,
|
||||
"extra certificates for TLS");
|
||||
int res = 1;
|
||||
|
||||
if (tls_extra == NULL)
|
||||
goto err;
|
||||
for (i = 0; i < sk_X509_num(tls_extra); i++) {
|
||||
cert = sk_X509_value(tls_extra, i);
|
||||
if (res != 0)
|
||||
res = SSL_CTX_add_extra_chain_cert(ssl_ctx, cert);
|
||||
if (res == 0)
|
||||
X509_free(cert);
|
||||
}
|
||||
sk_X509_free(tls_extra);
|
||||
if (res == 0) {
|
||||
BIO_printf(bio_err, "error: unable to add TLS extra certs\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
pkey = load_key_pwd(opt_tls_key, opt_keyform, opt_tls_keypass,
|
||||
e, "TLS client private key");
|
||||
cleanse(opt_tls_keypass);
|
||||
if (pkey == NULL)
|
||||
goto err;
|
||||
/*
|
||||
* verify the key matches the cert,
|
||||
* not using SSL_CTX_check_private_key(ssl_ctx)
|
||||
* because it gives poor and sometimes misleading diagnostics
|
||||
*/
|
||||
if (!X509_check_private_key(SSL_CTX_get0_certificate(ssl_ctx),
|
||||
pkey)) {
|
||||
CMP_err2("TLS private key '%s' does not match the TLS certificate '%s'\n",
|
||||
opt_tls_key, opt_tls_cert);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL; /* otherwise, for some reason double free! */
|
||||
goto err;
|
||||
}
|
||||
if (SSL_CTX_use_PrivateKey(ssl_ctx, pkey) <= 0) {
|
||||
CMP_err1("unable to use TLS client private key '%s'", opt_tls_key);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL; /* otherwise, for some reason double free! */
|
||||
goto err;
|
||||
}
|
||||
EVP_PKEY_free(pkey); /* we do not need the handle any more */
|
||||
}
|
||||
if (opt_tls_trusted != NULL) {
|
||||
/* enable and parameterize server hostname/IP address check */
|
||||
if (!truststore_set_host_etc(trust_store,
|
||||
opt_tls_host != NULL ?
|
||||
opt_tls_host : opt_server))
|
||||
/* TODO: is the server host name correct for TLS via proxy? */
|
||||
goto err;
|
||||
SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);
|
||||
}
|
||||
return ssl_ctx;
|
||||
err:
|
||||
SSL_CTX_free(ssl_ctx);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* set up protection aspects of OSSL_CMP_CTX based on options from config
|
||||
* file/CLI while parsing options and checking their consistency.
|
||||
* Returns 1 on success, 0 on error
|
||||
*/
|
||||
static int setup_protection_ctx(OSSL_CMP_CTX *ctx, ENGINE *e)
|
||||
{
|
||||
if (!opt_unprotected_requests && opt_secret == NULL && opt_cert == NULL) {
|
||||
CMP_err("must give client credentials unless -unprotected_requests is set");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_ref == NULL && opt_cert == NULL && opt_subject == NULL) {
|
||||
/* cert or subject should determine the sender */
|
||||
CMP_err("must give -ref if no -cert and no -subject given");
|
||||
goto err;
|
||||
}
|
||||
if (!opt_secret && ((opt_cert == NULL) != (opt_key == NULL))) {
|
||||
CMP_err("must give both -cert and -key options or neither");
|
||||
goto err;
|
||||
}
|
||||
if (opt_secret != NULL) {
|
||||
char *pass_string = get_passwd(opt_secret, "PBMAC");
|
||||
int res;
|
||||
|
||||
if (pass_string != NULL) {
|
||||
cleanse(opt_secret);
|
||||
res = OSSL_CMP_CTX_set1_secretValue(ctx,
|
||||
(unsigned char *)pass_string,
|
||||
strlen(pass_string));
|
||||
clear_free(pass_string);
|
||||
if (res == 0)
|
||||
goto err;
|
||||
}
|
||||
if (opt_cert != NULL || opt_key != NULL)
|
||||
CMP_warn("no signature-based protection used since -secret is given");
|
||||
}
|
||||
if (opt_ref != NULL
|
||||
&& !OSSL_CMP_CTX_set1_referenceValue(ctx, (unsigned char *)opt_ref,
|
||||
strlen(opt_ref)))
|
||||
goto err;
|
||||
|
||||
if (opt_key != NULL) {
|
||||
EVP_PKEY *pkey = load_key_pwd(opt_key, opt_keyform, opt_keypass, e,
|
||||
"private key for CMP client certificate");
|
||||
|
||||
if (pkey == NULL || !OSSL_CMP_CTX_set1_pkey(ctx, pkey)) {
|
||||
EVP_PKEY_free(pkey);
|
||||
goto err;
|
||||
}
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
if (opt_secret == NULL && opt_srvcert == NULL && opt_trusted == NULL) {
|
||||
CMP_err("missing -secret or -srvcert or -trusted");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_cert != NULL) {
|
||||
X509 *cert;
|
||||
STACK_OF(X509) *certs = NULL;
|
||||
int ok;
|
||||
|
||||
if (!load_certs_autofmt(opt_cert, &certs, 0, opt_keypass,
|
||||
"CMP client certificate (and optionally extra certs)"))
|
||||
/* opt_keypass is needed if opt_cert is an encrypted PKCS#12 file */
|
||||
goto err;
|
||||
|
||||
cert = sk_X509_delete(certs, 0);
|
||||
if (cert == NULL) {
|
||||
CMP_err("no client certificate found");
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
goto err;
|
||||
}
|
||||
ok = OSSL_CMP_CTX_set1_cert(ctx, cert);
|
||||
X509_free(cert);
|
||||
|
||||
if (ok) {
|
||||
/* add any remaining certs to the list of untrusted certs */
|
||||
STACK_OF(X509) *untrusted = OSSL_CMP_CTX_get0_untrusted_certs(ctx);
|
||||
ok = untrusted != NULL ?
|
||||
sk_X509_add1_certs(untrusted, certs, 0, 1 /* no dups */, 0) :
|
||||
OSSL_CMP_CTX_set1_untrusted_certs(ctx, certs);
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
if (!ok)
|
||||
goto oom;
|
||||
}
|
||||
|
||||
if (!setup_certs(opt_extracerts, "extra certificates for CMP", ctx,
|
||||
(add_X509_stack_fn_t)OSSL_CMP_CTX_set1_extraCertsOut,
|
||||
NULL))
|
||||
goto err;
|
||||
cleanse(opt_otherpass);
|
||||
|
||||
if (opt_unprotected_requests)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_UNPROTECTED_SEND, 1);
|
||||
|
||||
if (opt_digest != NULL) {
|
||||
int digest = OBJ_ln2nid(opt_digest);
|
||||
|
||||
if (digest == NID_undef) {
|
||||
CMP_err1("digest algorithm name not recognized: '%s'", opt_digest);
|
||||
goto err;
|
||||
}
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_DIGEST_ALGNID, digest);
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_OWF_ALGNID, digest);
|
||||
}
|
||||
|
||||
if (opt_mac != NULL) {
|
||||
int mac = OBJ_ln2nid(opt_mac);
|
||||
if (mac == NID_undef) {
|
||||
CMP_err1("MAC algorithm name not recognized: '%s'", opt_mac);
|
||||
goto err;
|
||||
}
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_MAC_ALGNID, mac);
|
||||
}
|
||||
return 1;
|
||||
|
||||
oom:
|
||||
CMP_err("out of memory");
|
||||
err:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up IR/CR/KUR/CertConf/RR specific parts of the OSSL_CMP_CTX
|
||||
* based on options from config file/CLI.
|
||||
* Returns pointer on success, NULL on error
|
||||
*/
|
||||
static int setup_request_ctx(OSSL_CMP_CTX *ctx, ENGINE *e)
|
||||
{
|
||||
if (opt_subject == NULL && opt_oldcert == NULL && opt_cert == NULL)
|
||||
CMP_warn("no -subject given, neither -oldcert nor -cert available as default");
|
||||
if (!set_name(opt_subject, OSSL_CMP_CTX_set1_subjectName, ctx, "subject")
|
||||
|| !set_name(opt_issuer, OSSL_CMP_CTX_set1_issuer, ctx, "issuer"))
|
||||
goto err;
|
||||
|
||||
if (opt_newkey != NULL) {
|
||||
const char *file = opt_newkey;
|
||||
const int format = opt_keyform;
|
||||
const char *pass = opt_newkeypass;
|
||||
const char *desc = "new private or public key for cert to be enrolled";
|
||||
EVP_PKEY *pkey = load_key_pwd(file, format, pass, e, NULL);
|
||||
int priv = 1;
|
||||
|
||||
if (pkey == NULL) {
|
||||
ERR_clear_error();
|
||||
pkey = load_pubkey(file, format, 0, pass, e, desc);
|
||||
priv = 0;
|
||||
}
|
||||
cleanse(opt_newkeypass);
|
||||
if (pkey == NULL || !OSSL_CMP_CTX_set0_newPkey(ctx, priv, pkey)) {
|
||||
EVP_PKEY_free(pkey);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_days > 0)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_VALIDITY_DAYS,
|
||||
opt_days);
|
||||
|
||||
if (opt_policies != NULL && opt_policy_oids != NULL) {
|
||||
CMP_err("cannot have policies both via -policies and via -policy_oids");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_reqexts != NULL || opt_policies != NULL) {
|
||||
X509V3_CTX ext_ctx;
|
||||
X509_EXTENSIONS *exts = sk_X509_EXTENSION_new_null();
|
||||
|
||||
if (exts == NULL)
|
||||
goto err;
|
||||
X509V3_set_ctx(&ext_ctx, NULL, NULL, NULL, NULL, 0);
|
||||
X509V3_set_nconf(&ext_ctx, conf);
|
||||
if (opt_reqexts != NULL
|
||||
&& !X509V3_EXT_add_nconf_sk(conf, &ext_ctx, opt_reqexts, &exts)) {
|
||||
CMP_err1("cannot load certificate request extension section '%s'",
|
||||
opt_reqexts);
|
||||
sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
|
||||
goto err;
|
||||
}
|
||||
if (opt_policies != NULL
|
||||
&& !X509V3_EXT_add_nconf_sk(conf, &ext_ctx, opt_policies, &exts)) {
|
||||
CMP_err1("cannot load policy cert request extension section '%s'",
|
||||
opt_policies);
|
||||
sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
|
||||
goto err;
|
||||
}
|
||||
OSSL_CMP_CTX_set0_reqExtensions(ctx, exts);
|
||||
}
|
||||
if (OSSL_CMP_CTX_reqExtensions_have_SAN(ctx) && opt_sans != NULL) {
|
||||
CMP_err("cannot have Subject Alternative Names both via -reqexts and via -sans");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!set_gennames(ctx, opt_sans, "Subject Alternative Name"))
|
||||
goto err;
|
||||
|
||||
if (opt_san_nodefault) {
|
||||
if (opt_sans != NULL)
|
||||
CMP_warn("-opt_san_nodefault has no effect when -sans is used");
|
||||
(void)OSSL_CMP_CTX_set_option(ctx,
|
||||
OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT, 1);
|
||||
}
|
||||
|
||||
if (opt_policy_oids_critical) {
|
||||
if (opt_policy_oids == NULL)
|
||||
CMP_warn("-opt_policy_oids_critical has no effect unless -policy_oids is given");
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_POLICIES_CRITICAL, 1);
|
||||
}
|
||||
|
||||
while (opt_policy_oids != NULL) {
|
||||
ASN1_OBJECT *policy;
|
||||
POLICYINFO *pinfo;
|
||||
char *next = next_item(opt_policy_oids);
|
||||
|
||||
if ((policy = OBJ_txt2obj(opt_policy_oids, 1)) == 0) {
|
||||
CMP_err1("unknown policy OID '%s'", opt_policy_oids);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((pinfo = POLICYINFO_new()) == NULL) {
|
||||
ASN1_OBJECT_free(policy);
|
||||
goto err;
|
||||
}
|
||||
pinfo->policyid = policy;
|
||||
|
||||
if (!OSSL_CMP_CTX_push0_policy(ctx, pinfo)) {
|
||||
CMP_err1("cannot add policy with OID '%s'", opt_policy_oids);
|
||||
POLICYINFO_free(pinfo);
|
||||
goto err;
|
||||
}
|
||||
opt_policy_oids = next;
|
||||
}
|
||||
|
||||
if (opt_popo >= OSSL_CRMF_POPO_NONE)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_POPO_METHOD, opt_popo);
|
||||
|
||||
if (opt_csr != NULL) {
|
||||
if (opt_cmd != CMP_P10CR) {
|
||||
CMP_warn("-csr option is ignored for command other than p10cr");
|
||||
} else {
|
||||
X509_REQ *csr =
|
||||
load_csr_autofmt(opt_csr, "PKCS#10 CSR for p10cr");
|
||||
|
||||
if (csr == NULL)
|
||||
goto err;
|
||||
if (!OSSL_CMP_CTX_set1_p10CSR(ctx, csr)) {
|
||||
X509_REQ_free(csr);
|
||||
goto oom;
|
||||
}
|
||||
X509_REQ_free(csr);
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_oldcert != NULL) {
|
||||
X509 *oldcert = load_cert_pwd(opt_oldcert, opt_keypass,
|
||||
"certificate to be updated/revoked");
|
||||
/* opt_keypass is needed if opt_oldcert is an encrypted PKCS#12 file */
|
||||
|
||||
if (oldcert == NULL)
|
||||
goto err;
|
||||
if (!OSSL_CMP_CTX_set1_oldCert(ctx, oldcert)) {
|
||||
X509_free(oldcert);
|
||||
goto oom;
|
||||
}
|
||||
X509_free(oldcert);
|
||||
}
|
||||
cleanse(opt_keypass);
|
||||
if (opt_revreason > CRL_REASON_NONE)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_REVOCATION_REASON,
|
||||
opt_revreason);
|
||||
|
||||
return 1;
|
||||
|
||||
oom:
|
||||
CMP_err("out of memory");
|
||||
err:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_opt_geninfo(OSSL_CMP_CTX *ctx)
|
||||
{
|
||||
long value;
|
||||
ASN1_OBJECT *type;
|
||||
ASN1_INTEGER *aint;
|
||||
ASN1_TYPE *val;
|
||||
OSSL_CMP_ITAV *itav;
|
||||
char *endstr;
|
||||
char *valptr = strchr(opt_geninfo, ':');
|
||||
|
||||
if (valptr == NULL) {
|
||||
CMP_err("missing ':' in -geninfo option");
|
||||
return 0;
|
||||
}
|
||||
valptr[0] = '\0';
|
||||
valptr++;
|
||||
|
||||
if (strncasecmp(valptr, "int:", 4) != 0) {
|
||||
CMP_err("missing 'int:' in -geninfo option");
|
||||
return 0;
|
||||
}
|
||||
valptr += 4;
|
||||
|
||||
value = strtol(valptr, &endstr, 10);
|
||||
if (endstr == valptr || *endstr != '\0') {
|
||||
CMP_err("cannot parse int in -geninfo option");
|
||||
return 0;
|
||||
}
|
||||
|
||||
type = OBJ_txt2obj(opt_geninfo, 1);
|
||||
if (type == NULL) {
|
||||
CMP_err("cannot parse OID in -geninfo option");
|
||||
return 0;
|
||||
}
|
||||
|
||||
aint = ASN1_INTEGER_new();
|
||||
if (aint == NULL || !ASN1_INTEGER_set(aint, value))
|
||||
goto oom;
|
||||
|
||||
val = ASN1_TYPE_new();
|
||||
if (val == NULL) {
|
||||
ASN1_INTEGER_free(aint);
|
||||
goto oom;
|
||||
}
|
||||
ASN1_TYPE_set(val, V_ASN1_INTEGER, aint);
|
||||
itav = OSSL_CMP_ITAV_create(type, val);
|
||||
if (itav == NULL) {
|
||||
ASN1_TYPE_free(val);
|
||||
goto oom;
|
||||
}
|
||||
|
||||
if (!OSSL_CMP_CTX_push0_geninfo_ITAV(ctx, itav)) {
|
||||
OSSL_CMP_ITAV_free(itav);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
||||
oom:
|
||||
CMP_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* set up the client-side OSSL_CMP_CTX based on options from config file/CLI
|
||||
* while parsing options and checking their consistency.
|
||||
* Prints reason for error to bio_err.
|
||||
* Returns 1 on success, 0 on error
|
||||
*/
|
||||
static int setup_client_ctx(OSSL_CMP_CTX *ctx, ENGINE *e)
|
||||
{
|
||||
int ret = 0;
|
||||
char server_buf[200] = { '\0' };
|
||||
char proxy_buf[200] = { '\0' };
|
||||
char *proxy_host = NULL;
|
||||
char *proxy_port_str = NULL;
|
||||
|
||||
if (opt_server == NULL) {
|
||||
CMP_err("missing server address[:port]");
|
||||
goto err;
|
||||
} else if ((server_port =
|
||||
parse_addr(&opt_server, server_port, "server")) < 0) {
|
||||
goto err;
|
||||
}
|
||||
if (server_port != 0)
|
||||
BIO_snprintf(server_port_s, sizeof(server_port_s), "%d", server_port);
|
||||
if (!OSSL_CMP_CTX_set1_server(ctx, opt_server)
|
||||
|| !OSSL_CMP_CTX_set_serverPort(ctx, server_port)
|
||||
|| !OSSL_CMP_CTX_set1_serverPath(ctx, opt_path))
|
||||
goto oom;
|
||||
if (opt_proxy != NULL && !OSSL_CMP_CTX_set1_proxy(ctx, opt_proxy))
|
||||
goto oom;
|
||||
if (opt_no_proxy != NULL && !OSSL_CMP_CTX_set1_no_proxy(ctx, opt_no_proxy))
|
||||
goto oom;
|
||||
(void)BIO_snprintf(server_buf, sizeof(server_buf), "http%s://%s%s%s/%s",
|
||||
opt_tls_used ? "s" : "", opt_server,
|
||||
server_port == 0 ? "" : ":", server_port_s,
|
||||
opt_path == NULL ? "" :
|
||||
opt_path[0] == '/' ? opt_path + 1 : opt_path);
|
||||
|
||||
if (opt_proxy != NULL)
|
||||
(void)BIO_snprintf(proxy_buf, sizeof(proxy_buf), " via %s", opt_proxy);
|
||||
CMP_info2("will contact %s%s", server_buf, proxy_buf);
|
||||
|
||||
if (!transform_opts())
|
||||
goto err;
|
||||
|
||||
if (opt_cmd == CMP_IR || opt_cmd == CMP_CR || opt_cmd == CMP_KUR) {
|
||||
if (opt_newkey == NULL && opt_key == NULL && opt_csr == NULL) {
|
||||
CMP_err("missing -newkey (or -key) to be certified");
|
||||
goto err;
|
||||
}
|
||||
if (opt_certout == NULL) {
|
||||
CMP_err("-certout not given, nowhere to save certificate");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (opt_cmd == CMP_KUR) {
|
||||
char *ref_cert = opt_oldcert != NULL ? opt_oldcert : opt_cert;
|
||||
|
||||
if (ref_cert == NULL) {
|
||||
CMP_err("missing -oldcert option for certificate to be updated");
|
||||
goto err;
|
||||
}
|
||||
if (opt_subject != NULL)
|
||||
CMP_warn2("-subject '%s' given, which overrides the subject of '%s' in KUR",
|
||||
opt_subject, ref_cert);
|
||||
}
|
||||
if (opt_cmd == CMP_RR && opt_oldcert == NULL) {
|
||||
CMP_err("missing certificate to be revoked");
|
||||
goto err;
|
||||
}
|
||||
if (opt_cmd == CMP_P10CR && opt_csr == NULL) {
|
||||
CMP_err("missing PKCS#10 CSR for p10cr");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_recipient == NULL && opt_srvcert == NULL && opt_issuer == NULL
|
||||
&& opt_oldcert == NULL && opt_cert == NULL)
|
||||
CMP_warn("missing -recipient, -srvcert, -issuer, -oldcert or -cert; recipient will be set to \"NULL-DN\"");
|
||||
|
||||
if (opt_infotype_s != NULL) {
|
||||
char id_buf[100] = "id-it-";
|
||||
|
||||
strncat(id_buf, opt_infotype_s, sizeof(id_buf) - strlen(id_buf) - 1);
|
||||
if ((opt_infotype = OBJ_sn2nid(id_buf)) == NID_undef) {
|
||||
CMP_err("unknown OID name in -infotype option");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!setup_verification_ctx(ctx))
|
||||
goto err;
|
||||
|
||||
if (opt_msg_timeout >= 0) /* must do this before setup_ssl_ctx() */
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_MSG_TIMEOUT,
|
||||
opt_msg_timeout);
|
||||
if (opt_total_timeout >= 0)
|
||||
(void)OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_TOTAL_TIMEOUT,
|
||||
opt_total_timeout);
|
||||
|
||||
if (opt_reqin != NULL && opt_rspin != NULL)
|
||||
CMP_warn("-reqin is ignored since -rspin is present");
|
||||
if (opt_reqin_new_tid && opt_reqin == NULL)
|
||||
CMP_warn("-reqin_new_tid is ignored since -reqin is not present");
|
||||
if (opt_reqin != NULL || opt_reqout != NULL
|
||||
|| opt_rspin != NULL || opt_rspout != NULL || opt_use_mock_srv)
|
||||
(void)OSSL_CMP_CTX_set_transfer_cb(ctx, read_write_req_resp);
|
||||
|
||||
if ((opt_tls_cert != NULL || opt_tls_key != NULL
|
||||
|| opt_tls_keypass != NULL || opt_tls_extra != NULL
|
||||
|| opt_tls_trusted != NULL || opt_tls_host != NULL)
|
||||
&& !opt_tls_used)
|
||||
CMP_warn("TLS options(s) given but not -tls_used");
|
||||
if (opt_tls_used) {
|
||||
#ifdef OPENSSL_NO_SOCK
|
||||
BIO_printf(bio_err, "Cannot use TLS - sockets not supported\n");
|
||||
goto err;
|
||||
#else
|
||||
APP_HTTP_TLS_INFO *info;
|
||||
|
||||
if (opt_tls_cert != NULL
|
||||
|| opt_tls_key != NULL || opt_tls_keypass != NULL) {
|
||||
if (opt_tls_key == NULL) {
|
||||
CMP_err("missing -tls_key option");
|
||||
goto err;
|
||||
} else if (opt_tls_cert == NULL) {
|
||||
CMP_err("missing -tls_cert option");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (opt_use_mock_srv) {
|
||||
CMP_err("cannot use TLS options together with -use_mock_srv");
|
||||
goto err;
|
||||
}
|
||||
if ((info = OPENSSL_zalloc(sizeof(*info))) == NULL)
|
||||
goto err;
|
||||
(void)OSSL_CMP_CTX_set_http_cb_arg(ctx, info);
|
||||
/* info will be freed along with CMP ctx */
|
||||
info->server = opt_server;
|
||||
info->port = server_port_s;
|
||||
info->use_proxy = opt_proxy != NULL;
|
||||
info->timeout = OSSL_CMP_CTX_get_option(ctx, OSSL_CMP_OPT_MSG_TIMEOUT);
|
||||
info->ssl_ctx = setup_ssl_ctx(ctx, e);
|
||||
if (info->ssl_ctx == NULL)
|
||||
goto err;
|
||||
(void)OSSL_CMP_CTX_set_http_cb(ctx, app_http_tls_cb);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!setup_protection_ctx(ctx, e))
|
||||
goto err;
|
||||
|
||||
if (!setup_request_ctx(ctx, e))
|
||||
goto err;
|
||||
|
||||
if (!set_name(opt_recipient, OSSL_CMP_CTX_set1_recipient, ctx, "recipient")
|
||||
|| !set_name(opt_expect_sender, OSSL_CMP_CTX_set1_expected_sender,
|
||||
ctx, "expected sender"))
|
||||
goto err;
|
||||
|
||||
if (opt_geninfo != NULL && !handle_opt_geninfo(ctx))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
OPENSSL_free(proxy_host);
|
||||
OPENSSL_free(proxy_port_str);
|
||||
return ret;
|
||||
oom:
|
||||
CMP_err("out of memory");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* write out the given certificate to the output specified by bio.
|
||||
* Depending on options use either PEM or DER format.
|
||||
* Returns 1 on success, 0 on error
|
||||
*/
|
||||
static int write_cert(BIO *bio, X509 *cert)
|
||||
{
|
||||
if ((opt_certform == FORMAT_PEM && PEM_write_bio_X509(bio, cert))
|
||||
|| (opt_certform == FORMAT_ASN1 && i2d_X509_bio(bio, cert)))
|
||||
return 1;
|
||||
if (opt_certform != FORMAT_PEM && opt_certform != FORMAT_ASN1)
|
||||
BIO_printf(bio_err,
|
||||
"error: unsupported type '%s' for writing certificates\n",
|
||||
opt_certform_s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* writes out a stack of certs to the given file.
|
||||
* Depending on options use either PEM or DER format,
|
||||
* where DER does not make much sense for writing more than one cert!
|
||||
* Returns number of written certificates on success, 0 on error.
|
||||
*/
|
||||
static int save_certs(OSSL_CMP_CTX *ctx,
|
||||
STACK_OF(X509) *certs, char *destFile, char *desc)
|
||||
{
|
||||
BIO *bio = NULL;
|
||||
int i;
|
||||
int n = sk_X509_num(certs);
|
||||
|
||||
CMP_info3("received %d %s certificate(s), saving to file '%s'",
|
||||
n, desc, destFile);
|
||||
if (n > 1 && opt_certform != FORMAT_PEM)
|
||||
CMP_warn("saving more than one certificate in non-PEM format");
|
||||
|
||||
if (destFile == NULL || (bio = BIO_new(BIO_s_file())) == NULL
|
||||
|| !BIO_write_filename(bio, (char *)destFile)) {
|
||||
CMP_err1("could not open file '%s' for writing", destFile);
|
||||
n = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (!write_cert(bio, sk_X509_value(certs, i))) {
|
||||
CMP_err1("cannot write certificate to file '%s'", destFile);
|
||||
n = -1;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
err:
|
||||
BIO_free(bio);
|
||||
return n;
|
||||
}
|
||||
|
||||
static void print_itavs(STACK_OF(OSSL_CMP_ITAV) *itavs)
|
||||
{
|
||||
OSSL_CMP_ITAV *itav = NULL;
|
||||
char buf[128];
|
||||
int i;
|
||||
int n = sk_OSSL_CMP_ITAV_num(itavs); /* itavs == NULL leads to 0 */
|
||||
|
||||
if (n == 0) {
|
||||
CMP_info("genp contains no ITAV");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
itav = sk_OSSL_CMP_ITAV_value(itavs, i);
|
||||
OBJ_obj2txt(buf, 128, OSSL_CMP_ITAV_get0_type(itav), 0);
|
||||
CMP_info1("genp contains ITAV of type: %s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
static char opt_item[SECTION_NAME_MAX + 1];
|
||||
/* get previous name from a comma-separated list of names */
|
||||
static const char *prev_item(const char *opt, const char *end)
|
||||
{
|
||||
const char *beg;
|
||||
size_t len;
|
||||
|
||||
if (end == opt)
|
||||
return NULL;
|
||||
beg = end;
|
||||
while (beg != opt && beg[-1] != ',' && !isspace(beg[-1]))
|
||||
beg--;
|
||||
len = end - beg;
|
||||
if (len > SECTION_NAME_MAX)
|
||||
len = SECTION_NAME_MAX;
|
||||
strncpy(opt_item, beg, len);
|
||||
opt_item[SECTION_NAME_MAX] = '\0'; /* avoid gcc v8 O3 stringop-truncation */
|
||||
opt_item[len] = '\0';
|
||||
if (len > SECTION_NAME_MAX)
|
||||
CMP_warn2("using only first %d characters of section name starting with \"%s\"",
|
||||
SECTION_NAME_MAX, opt_item);
|
||||
while (beg != opt && (beg[-1] == ',' || isspace(beg[-1])))
|
||||
beg--;
|
||||
return beg;
|
||||
}
|
||||
|
||||
/* get str value for name from a comma-separated hierarchy of config sections */
|
||||
static char *conf_get_string(const CONF *src_conf, const char *groups,
|
||||
const char *name)
|
||||
{
|
||||
char *res = NULL;
|
||||
const char *end = groups + strlen(groups);
|
||||
|
||||
while ((end = prev_item(groups, end)) != NULL) {
|
||||
if ((res = NCONF_get_string(src_conf, opt_item, name)) != NULL)
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/* get long val for name from a comma-separated hierarchy of config sections */
|
||||
static int conf_get_number_e(const CONF *conf_, const char *groups,
|
||||
const char *name, long *result)
|
||||
{
|
||||
char *str = conf_get_string(conf_, groups, name);
|
||||
char *tailptr;
|
||||
long res;
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
return 0;
|
||||
|
||||
res = strtol(str, &tailptr, 10);
|
||||
if (res == LONG_MIN || res == LONG_MAX || *tailptr != '\0')
|
||||
return 0;
|
||||
|
||||
*result = res;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* use the command line option table to read values from the CMP section
|
||||
* of openssl.cnf. Defaults are taken from the config file, they can be
|
||||
* overwritten on the command line.
|
||||
*/
|
||||
static int read_config(void)
|
||||
{
|
||||
unsigned int i;
|
||||
long num = 0;
|
||||
char *txt = NULL;
|
||||
const OPTIONS *opt;
|
||||
int provider_option;
|
||||
int verification_option;
|
||||
|
||||
/*
|
||||
* starting with offset OPT_SECTION because OPT_CONFIG and OPT_SECTION would
|
||||
* not make sense within the config file. They have already been handled.
|
||||
*/
|
||||
for (i = OPT_SECTION - OPT_HELP, opt = &cmp_options[OPT_SECTION];
|
||||
opt->name; i++, opt++) {
|
||||
if (!strcmp(opt->name, OPT_SECTION_STR)
|
||||
|| !strcmp(opt->name, OPT_MORE_STR)) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
provider_option = (OPT_PROV__FIRST <= opt->retval
|
||||
&& opt->retval < OPT_PROV__LAST);
|
||||
verification_option = (OPT_V__FIRST <= opt->retval
|
||||
&& opt->retval < OPT_V__LAST);
|
||||
if (provider_option || verification_option)
|
||||
i--;
|
||||
if (cmp_vars[i].txt == NULL) {
|
||||
CMP_err1("internal: cmp_vars array too short, i=%d", i);
|
||||
return 0;
|
||||
}
|
||||
switch (opt->valtype) {
|
||||
case '-':
|
||||
case 'n':
|
||||
case 'l':
|
||||
if (!conf_get_number_e(conf, opt_section, opt->name, &num)) {
|
||||
ERR_clear_error();
|
||||
continue; /* option not provided */
|
||||
}
|
||||
break;
|
||||
/*
|
||||
* do not use '<' in cmp_options. Incorrect treatment
|
||||
* somewhere in args_verify() can wrongly set badarg = 1
|
||||
*/
|
||||
case '<':
|
||||
case 's':
|
||||
case 'M':
|
||||
txt = conf_get_string(conf, opt_section, opt->name);
|
||||
if (txt == NULL) {
|
||||
ERR_clear_error();
|
||||
continue; /* option not provided */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CMP_err2("internal: unsupported type '%c' for option '%s'",
|
||||
opt->valtype, opt->name);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
if (provider_option || verification_option) {
|
||||
int conf_argc = 1;
|
||||
char *conf_argv[3];
|
||||
char arg1[82];
|
||||
|
||||
BIO_snprintf(arg1, 81, "-%s", (char *)opt->name);
|
||||
conf_argv[0] = prog;
|
||||
conf_argv[1] = arg1;
|
||||
if (opt->valtype == '-') {
|
||||
if (num != 0)
|
||||
conf_argc = 2;
|
||||
} else {
|
||||
conf_argc = 3;
|
||||
conf_argv[2] = conf_get_string(conf, opt_section, opt->name);
|
||||
/* not NULL */
|
||||
}
|
||||
if (conf_argc > 1) {
|
||||
(void)opt_init(conf_argc, conf_argv, cmp_options);
|
||||
|
||||
if (provider_option
|
||||
? !opt_provider(opt_next())
|
||||
: !opt_verify(opt_next(), vpm)) {
|
||||
CMP_err2("for option '%s' in config file section '%s'",
|
||||
opt->name, opt_section);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (opt->valtype) {
|
||||
case '-':
|
||||
case 'n':
|
||||
if (num < INT_MIN || INT_MAX < num) {
|
||||
BIO_printf(bio_err,
|
||||
"integer value out of range for option '%s'\n",
|
||||
opt->name);
|
||||
return 0;
|
||||
}
|
||||
*cmp_vars[i].num = (int)num;
|
||||
break;
|
||||
case 'l':
|
||||
*cmp_vars[i].num_long = num;
|
||||
break;
|
||||
default:
|
||||
if (txt != NULL && txt[0] == '\0')
|
||||
txt = NULL; /* reset option on empty string input */
|
||||
*cmp_vars[i].txt = txt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *opt_str(char *opt)
|
||||
{
|
||||
char *arg = opt_arg();
|
||||
|
||||
if (arg[0] == '\0') {
|
||||
CMP_warn1("argument of -%s option is empty string, resetting option",
|
||||
opt);
|
||||
arg = NULL;
|
||||
} else if (arg[0] == '-') {
|
||||
CMP_warn1("argument of -%s option starts with hyphen", opt);
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
static int opt_nat(void)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (opt_int(opt_arg(), &result) && result < 0)
|
||||
BIO_printf(bio_err, "error: argument '%s' must not be negative\n",
|
||||
opt_arg());
|
||||
return result;
|
||||
}
|
||||
|
||||
/* returns 1 on success, 0 on error, -1 on -help (i.e., stop with success) */
|
||||
static int get_opts(int argc, char **argv)
|
||||
{
|
||||
OPTION_CHOICE o;
|
||||
|
||||
prog = opt_init(argc, argv, cmp_options);
|
||||
|
||||
while ((o = opt_next()) != OPT_EOF) {
|
||||
switch (o) {
|
||||
case OPT_EOF:
|
||||
case OPT_ERR:
|
||||
goto opt_err;
|
||||
case OPT_HELP:
|
||||
opt_help(cmp_options);
|
||||
return -1;
|
||||
case OPT_CONFIG: /* has already been handled */
|
||||
break;
|
||||
case OPT_SECTION: /* has already been handled */
|
||||
break;
|
||||
case OPT_SERVER:
|
||||
opt_server = opt_str("server");
|
||||
break;
|
||||
case OPT_PROXY:
|
||||
opt_proxy = opt_str("proxy");
|
||||
break;
|
||||
case OPT_NO_PROXY:
|
||||
opt_no_proxy = opt_str("no_proxy");
|
||||
break;
|
||||
case OPT_PATH:
|
||||
opt_path = opt_str("path");
|
||||
break;
|
||||
case OPT_MSG_TIMEOUT:
|
||||
if ((opt_msg_timeout = opt_nat()) < 0)
|
||||
goto opt_err;
|
||||
break;
|
||||
case OPT_TOTAL_TIMEOUT:
|
||||
if ((opt_total_timeout = opt_nat()) < 0)
|
||||
goto opt_err;
|
||||
break;
|
||||
case OPT_TLS_USED:
|
||||
opt_tls_used = 1;
|
||||
break;
|
||||
case OPT_TLS_CERT:
|
||||
opt_tls_cert = opt_str("tls_cert");
|
||||
break;
|
||||
case OPT_TLS_KEY:
|
||||
opt_tls_key = opt_str("tls_key");
|
||||
break;
|
||||
case OPT_TLS_KEYPASS:
|
||||
opt_tls_keypass = opt_str("tls_keypass");
|
||||
break;
|
||||
case OPT_TLS_EXTRA:
|
||||
opt_tls_extra = opt_str("tls_extra");
|
||||
break;
|
||||
case OPT_TLS_TRUSTED:
|
||||
opt_tls_trusted = opt_str("tls_trusted");
|
||||
break;
|
||||
case OPT_TLS_HOST:
|
||||
opt_tls_host = opt_str("tls_host");
|
||||
break;
|
||||
case OPT_REF:
|
||||
opt_ref = opt_str("ref");
|
||||
break;
|
||||
case OPT_SECRET:
|
||||
opt_secret = opt_str("secret");
|
||||
break;
|
||||
case OPT_CERT:
|
||||
opt_cert = opt_str("cert");
|
||||
break;
|
||||
case OPT_KEY:
|
||||
opt_key = opt_str("key");
|
||||
break;
|
||||
case OPT_KEYPASS:
|
||||
opt_keypass = opt_str("keypass");
|
||||
break;
|
||||
case OPT_DIGEST:
|
||||
opt_digest = opt_str("digest");
|
||||
break;
|
||||
case OPT_MAC:
|
||||
opt_mac = opt_str("mac");
|
||||
break;
|
||||
case OPT_EXTRACERTS:
|
||||
opt_extracerts = opt_str("extracerts");
|
||||
break;
|
||||
case OPT_UNPROTECTED_REQUESTS:
|
||||
opt_unprotected_requests = 1;
|
||||
break;
|
||||
|
||||
case OPT_TRUSTED:
|
||||
opt_trusted = opt_str("trusted");
|
||||
break;
|
||||
case OPT_UNTRUSTED:
|
||||
opt_untrusted = opt_str("untrusted");
|
||||
break;
|
||||
case OPT_SRVCERT:
|
||||
opt_srvcert = opt_str("srvcert");
|
||||
break;
|
||||
case OPT_RECIPIENT:
|
||||
opt_recipient = opt_str("recipient");
|
||||
break;
|
||||
case OPT_EXPECT_SENDER:
|
||||
opt_expect_sender = opt_str("expect_sender");
|
||||
break;
|
||||
case OPT_IGNORE_KEYUSAGE:
|
||||
opt_ignore_keyusage = 1;
|
||||
break;
|
||||
case OPT_UNPROTECTED_ERRORS:
|
||||
opt_unprotected_errors = 1;
|
||||
break;
|
||||
case OPT_EXTRACERTSOUT:
|
||||
opt_extracertsout = opt_str("extracertsout");
|
||||
break;
|
||||
case OPT_CACERTSOUT:
|
||||
opt_cacertsout = opt_str("cacertsout");
|
||||
break;
|
||||
|
||||
case OPT_V_CASES:
|
||||
if (!opt_verify(o, vpm))
|
||||
goto opt_err;
|
||||
break;
|
||||
case OPT_CMD:
|
||||
opt_cmd_s = opt_str("cmd");
|
||||
break;
|
||||
case OPT_INFOTYPE:
|
||||
opt_infotype_s = opt_str("infotype");
|
||||
break;
|
||||
case OPT_GENINFO:
|
||||
opt_geninfo = opt_str("geninfo");
|
||||
break;
|
||||
|
||||
case OPT_NEWKEY:
|
||||
opt_newkey = opt_str("newkey");
|
||||
break;
|
||||
case OPT_NEWKEYPASS:
|
||||
opt_newkeypass = opt_str("newkeypass");
|
||||
break;
|
||||
case OPT_SUBJECT:
|
||||
opt_subject = opt_str("subject");
|
||||
break;
|
||||
case OPT_ISSUER:
|
||||
opt_issuer = opt_str("issuer");
|
||||
break;
|
||||
case OPT_DAYS:
|
||||
if ((opt_days = opt_nat()) < 0)
|
||||
goto opt_err;
|
||||
break;
|
||||
case OPT_REQEXTS:
|
||||
opt_reqexts = opt_str("reqexts");
|
||||
break;
|
||||
case OPT_SANS:
|
||||
opt_sans = opt_str("sans");
|
||||
break;
|
||||
case OPT_SAN_NODEFAULT:
|
||||
opt_san_nodefault = 1;
|
||||
break;
|
||||
case OPT_POLICIES:
|
||||
opt_policies = opt_str("policies");
|
||||
break;
|
||||
case OPT_POLICY_OIDS:
|
||||
opt_policy_oids = opt_str("policy_oids");
|
||||
break;
|
||||
case OPT_POLICY_OIDS_CRITICAL:
|
||||
opt_policy_oids_critical = 1;
|
||||
break;
|
||||
case OPT_POPO:
|
||||
if (!opt_int(opt_arg(), &opt_popo)
|
||||
|| opt_popo < OSSL_CRMF_POPO_NONE
|
||||
|| opt_popo > OSSL_CRMF_POPO_KEYENC) {
|
||||
CMP_err("invalid popo spec. Valid values are -1 .. 2");
|
||||
goto opt_err;
|
||||
}
|
||||
break;
|
||||
case OPT_CSR:
|
||||
opt_csr = opt_arg();
|
||||
break;
|
||||
case OPT_OUT_TRUSTED:
|
||||
opt_out_trusted = opt_str("out_trusted");
|
||||
break;
|
||||
case OPT_IMPLICIT_CONFIRM:
|
||||
opt_implicit_confirm = 1;
|
||||
break;
|
||||
case OPT_DISABLE_CONFIRM:
|
||||
opt_disable_confirm = 1;
|
||||
break;
|
||||
case OPT_CERTOUT:
|
||||
opt_certout = opt_str("certout");
|
||||
break;
|
||||
case OPT_OLDCERT:
|
||||
opt_oldcert = opt_str("oldcert");
|
||||
break;
|
||||
case OPT_REVREASON:
|
||||
if (!opt_int(opt_arg(), &opt_revreason)
|
||||
|| opt_revreason < CRL_REASON_NONE
|
||||
|| opt_revreason > CRL_REASON_AA_COMPROMISE
|
||||
|| opt_revreason == 7) {
|
||||
CMP_err("invalid revreason. Valid values are -1 .. 6, 8 .. 10");
|
||||
goto opt_err;
|
||||
}
|
||||
break;
|
||||
case OPT_CERTFORM:
|
||||
opt_certform_s = opt_str("certform");
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
opt_keyform_s = opt_str("keyform");
|
||||
break;
|
||||
case OPT_CERTSFORM:
|
||||
opt_certsform_s = opt_str("certsform");
|
||||
break;
|
||||
case OPT_OTHERPASS:
|
||||
opt_otherpass = opt_str("otherpass");
|
||||
break;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
case OPT_ENGINE:
|
||||
opt_engine = opt_str("engine");
|
||||
break;
|
||||
#endif
|
||||
case OPT_PROV_CASES:
|
||||
if (!opt_provider(o))
|
||||
goto opt_err;
|
||||
break;
|
||||
|
||||
case OPT_BATCH:
|
||||
opt_batch = 1;
|
||||
break;
|
||||
case OPT_REPEAT:
|
||||
opt_repeat = opt_nat();
|
||||
break;
|
||||
case OPT_REQIN:
|
||||
opt_reqin = opt_str("reqin");
|
||||
break;
|
||||
case OPT_REQIN_NEW_TID:
|
||||
opt_reqin_new_tid = 1;
|
||||
break;
|
||||
case OPT_REQOUT:
|
||||
opt_reqout = opt_str("reqout");
|
||||
break;
|
||||
case OPT_RSPIN:
|
||||
opt_rspin = opt_str("rspin");
|
||||
break;
|
||||
case OPT_RSPOUT:
|
||||
opt_rspout = opt_str("rspout");
|
||||
break;
|
||||
case OPT_USE_MOCK_SRV:
|
||||
opt_use_mock_srv = 1;
|
||||
break;
|
||||
case OPT_PORT:
|
||||
opt_port = opt_str("port");
|
||||
break;
|
||||
case OPT_MAX_MSGS:
|
||||
if ((opt_max_msgs = opt_nat()) < 0)
|
||||
goto opt_err;
|
||||
break;
|
||||
case OPT_SRV_REF:
|
||||
opt_srv_ref = opt_str("srv_ref");
|
||||
break;
|
||||
case OPT_SRV_SECRET:
|
||||
opt_srv_secret = opt_str("srv_secret");
|
||||
break;
|
||||
case OPT_SRV_CERT:
|
||||
opt_srv_cert = opt_str("srv_cert");
|
||||
break;
|
||||
case OPT_SRV_KEY:
|
||||
opt_srv_key = opt_str("srv_key");
|
||||
break;
|
||||
case OPT_SRV_KEYPASS:
|
||||
opt_srv_keypass = opt_str("srv_keypass");
|
||||
break;
|
||||
case OPT_SRV_TRUSTED:
|
||||
opt_srv_trusted = opt_str("srv_trusted");
|
||||
break;
|
||||
case OPT_SRV_UNTRUSTED:
|
||||
opt_srv_untrusted = opt_str("srv_untrusted");
|
||||
break;
|
||||
case OPT_RSP_CERT:
|
||||
opt_rsp_cert = opt_str("rsp_cert");
|
||||
break;
|
||||
case OPT_RSP_EXTRACERTS:
|
||||
opt_rsp_extracerts = opt_str("rsp_extracerts");
|
||||
break;
|
||||
case OPT_RSP_CAPUBS:
|
||||
opt_rsp_capubs = opt_str("rsp_capubs");
|
||||
break;
|
||||
case OPT_POLL_COUNT:
|
||||
opt_poll_count = opt_nat();
|
||||
break;
|
||||
case OPT_CHECK_AFTER:
|
||||
opt_check_after = opt_nat();
|
||||
break;
|
||||
case OPT_GRANT_IMPLICITCONF:
|
||||
opt_grant_implicitconf = 1;
|
||||
break;
|
||||
case OPT_PKISTATUS:
|
||||
opt_pkistatus = opt_nat();
|
||||
break;
|
||||
case OPT_FAILURE:
|
||||
opt_failure = opt_nat();
|
||||
break;
|
||||
case OPT_FAILUREBITS:
|
||||
opt_failurebits = opt_nat();
|
||||
break;
|
||||
case OPT_STATUSSTRING:
|
||||
opt_statusstring = opt_str("statusstring");
|
||||
break;
|
||||
case OPT_SEND_ERROR:
|
||||
opt_send_error = 1;
|
||||
break;
|
||||
case OPT_SEND_UNPROTECTED:
|
||||
opt_send_unprotected = 1;
|
||||
break;
|
||||
case OPT_SEND_UNPROT_ERR:
|
||||
opt_send_unprot_err = 1;
|
||||
break;
|
||||
case OPT_ACCEPT_UNPROTECTED:
|
||||
opt_accept_unprotected = 1;
|
||||
break;
|
||||
case OPT_ACCEPT_UNPROT_ERR:
|
||||
opt_accept_unprot_err = 1;
|
||||
break;
|
||||
case OPT_ACCEPT_RAVERIFIED:
|
||||
opt_accept_raverified = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
argv = opt_rest();
|
||||
if (argc != 0) {
|
||||
CMP_err1("unknown parameter %s", argv[0]);
|
||||
goto opt_err;
|
||||
}
|
||||
return 1;
|
||||
|
||||
opt_err:
|
||||
CMP_err1("use -help for summary of '%s' options", prog);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmp_main(int argc, char **argv)
|
||||
{
|
||||
char *configfile = NULL;
|
||||
int i;
|
||||
X509 *newcert = NULL;
|
||||
ENGINE *e = NULL;
|
||||
char mock_server[] = "mock server:1";
|
||||
int ret = 0; /* default: failure */
|
||||
|
||||
if (argc <= 1) {
|
||||
opt_help(cmp_options);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle OPT_CONFIG and OPT_SECTION upfront to take effect for other opts
|
||||
*/
|
||||
for (i = 1; i < argc - 1; i++) {
|
||||
if (*argv[i] == '-') {
|
||||
if (!strcmp(argv[i] + 1, cmp_options[OPT_CONFIG - OPT_HELP].name))
|
||||
opt_config = argv[i + 1];
|
||||
else if (!strcmp(argv[i] + 1,
|
||||
cmp_options[OPT_SECTION - OPT_HELP].name))
|
||||
opt_section = argv[i + 1];
|
||||
}
|
||||
}
|
||||
if (opt_section[0] == '\0') /* empty string */
|
||||
opt_section = DEFAULT_SECTION;
|
||||
|
||||
vpm = X509_VERIFY_PARAM_new();
|
||||
if (vpm == NULL) {
|
||||
CMP_err("out of memory");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* read default values for options from config file */
|
||||
configfile = opt_config != NULL ? opt_config : default_config_file;
|
||||
if (configfile && configfile[0] != '\0' /* non-empty string */
|
||||
&& (configfile != default_config_file
|
||||
|| access(configfile, F_OK) != -1)) {
|
||||
CMP_info1("using OpenSSL configuration file '%s'", configfile);
|
||||
conf = app_load_config(configfile);
|
||||
if (conf == NULL) {
|
||||
goto err;
|
||||
} else {
|
||||
if (strcmp(opt_section, CMP_SECTION) == 0) { /* default */
|
||||
if (!NCONF_get_section(conf, opt_section))
|
||||
CMP_info2("no [%s] section found in config file '%s';"
|
||||
" will thus use just [default] and unnamed section if present",
|
||||
opt_section, configfile);
|
||||
} else {
|
||||
const char *end = opt_section + strlen(opt_section);
|
||||
while ((end = prev_item(opt_section, end)) != NULL) {
|
||||
if (!NCONF_get_section(conf, opt_item)) {
|
||||
CMP_err2("no [%s] section found in config file '%s'",
|
||||
opt_item, configfile);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!read_config())
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
(void)BIO_flush(bio_err); /* prevent interference with opt_help() */
|
||||
|
||||
ret = get_opts(argc, argv);
|
||||
if (ret <= 0)
|
||||
goto err;
|
||||
ret = 0;
|
||||
|
||||
if (opt_batch) {
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
UI_METHOD *ui_fallback_method;
|
||||
# ifndef OPENSSL_NO_UI_CONSOLE
|
||||
ui_fallback_method = UI_OpenSSL();
|
||||
# else
|
||||
ui_fallback_method = (UI_METHOD *)UI_null();
|
||||
# endif
|
||||
UI_method_set_reader(ui_fallback_method, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (opt_engine != NULL)
|
||||
e = setup_engine_methods(opt_engine, 0 /* not: ENGINE_METHOD_ALL */, 0);
|
||||
|
||||
if (opt_port != NULL) {
|
||||
if (opt_use_mock_srv) {
|
||||
CMP_err("cannot use both -port and -use_mock_srv options");
|
||||
goto err;
|
||||
}
|
||||
if (opt_server != NULL) {
|
||||
CMP_err("cannot use both -port and -server options");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if ((cmp_ctx = OSSL_CMP_CTX_new()) == NULL) {
|
||||
CMP_err("out of memory");
|
||||
goto err;
|
||||
}
|
||||
if (!OSSL_CMP_CTX_set_log_cb(cmp_ctx, print_to_bio_out)) {
|
||||
CMP_err1("cannot set up error reporting and logging for %s", prog);
|
||||
goto err;
|
||||
}
|
||||
if ((opt_use_mock_srv || opt_port != NULL)) {
|
||||
OSSL_CMP_SRV_CTX *srv_ctx;
|
||||
|
||||
if ((srv_ctx = setup_srv_ctx(e)) == NULL)
|
||||
goto err;
|
||||
OSSL_CMP_CTX_set_transfer_cb_arg(cmp_ctx, srv_ctx);
|
||||
if (!OSSL_CMP_CTX_set_log_cb(OSSL_CMP_SRV_CTX_get0_cmp_ctx(srv_ctx),
|
||||
print_to_bio_out)) {
|
||||
CMP_err1("cannot set up error reporting and logging for %s", prog);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (opt_port != NULL) { /* act as very basic CMP HTTP server */
|
||||
#ifdef OPENSSL_NO_SOCK
|
||||
BIO_printf(bio_err, "Cannot act as server - sockets not supported\n");
|
||||
#else
|
||||
BIO *acbio;
|
||||
BIO *cbio = NULL;
|
||||
int msgs = 0;
|
||||
|
||||
if ((acbio = http_server_init_bio(prog, opt_port)) == NULL)
|
||||
goto err;
|
||||
while (opt_max_msgs <= 0 || msgs < opt_max_msgs) {
|
||||
char *path = NULL;
|
||||
OSSL_CMP_MSG *req = NULL;
|
||||
OSSL_CMP_MSG *resp = NULL;
|
||||
|
||||
ret = http_server_get_asn1_req(ASN1_ITEM_rptr(OSSL_CMP_MSG),
|
||||
(ASN1_VALUE **)&req, &path,
|
||||
&cbio, acbio, prog, 0, 0);
|
||||
if (ret == 0)
|
||||
continue;
|
||||
if (ret++ == -1)
|
||||
break; /* fatal error */
|
||||
|
||||
ret = 0;
|
||||
msgs++;
|
||||
if (req != NULL) {
|
||||
if (strcmp(path, "") != 0 && strcmp(path, "pkix/") != 0) {
|
||||
(void)http_server_send_status(cbio, 404, "Not Found");
|
||||
CMP_err1("Expecting empty path or 'pkix/' but got '%s'",
|
||||
path);
|
||||
OPENSSL_free(path);
|
||||
OSSL_CMP_MSG_free(req);
|
||||
goto cont;
|
||||
}
|
||||
OPENSSL_free(path);
|
||||
resp = OSSL_CMP_CTX_server_perform(cmp_ctx, req);
|
||||
OSSL_CMP_MSG_free(req);
|
||||
if (resp == NULL) {
|
||||
(void)http_server_send_status(cbio,
|
||||
500, "Internal Server Error");
|
||||
break; /* treated as fatal error */
|
||||
}
|
||||
ret = http_server_send_asn1_resp(cbio, "application/pkixcmp",
|
||||
ASN1_ITEM_rptr(OSSL_CMP_MSG),
|
||||
(const ASN1_VALUE *)resp);
|
||||
OSSL_CMP_MSG_free(resp);
|
||||
if (!ret)
|
||||
break; /* treated as fatal error */
|
||||
} else {
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
}
|
||||
cont:
|
||||
BIO_free_all(cbio);
|
||||
cbio = NULL;
|
||||
}
|
||||
BIO_free_all(cbio);
|
||||
BIO_free_all(acbio);
|
||||
#endif
|
||||
goto err;
|
||||
}
|
||||
/* else act as CMP client */
|
||||
|
||||
if (opt_use_mock_srv) {
|
||||
if (opt_server != NULL) {
|
||||
CMP_err("cannot use both -use_mock_srv and -server options");
|
||||
goto err;
|
||||
}
|
||||
if (opt_proxy != NULL) {
|
||||
CMP_err("cannot use both -use_mock_srv and -proxy options");
|
||||
goto err;
|
||||
}
|
||||
opt_server = mock_server;
|
||||
opt_proxy = "API";
|
||||
} else {
|
||||
if (opt_server == NULL) {
|
||||
CMP_err("missing -server option");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!setup_client_ctx(cmp_ctx, e)) {
|
||||
CMP_err("cannot set up CMP context");
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < opt_repeat; i++) {
|
||||
/* everything is ready, now connect and perform the command! */
|
||||
switch (opt_cmd) {
|
||||
case CMP_IR:
|
||||
newcert = OSSL_CMP_exec_IR_ses(cmp_ctx);
|
||||
if (newcert == NULL)
|
||||
goto err;
|
||||
break;
|
||||
case CMP_KUR:
|
||||
newcert = OSSL_CMP_exec_KUR_ses(cmp_ctx);
|
||||
if (newcert == NULL)
|
||||
goto err;
|
||||
break;
|
||||
case CMP_CR:
|
||||
newcert = OSSL_CMP_exec_CR_ses(cmp_ctx);
|
||||
if (newcert == NULL)
|
||||
goto err;
|
||||
break;
|
||||
case CMP_P10CR:
|
||||
newcert = OSSL_CMP_exec_P10CR_ses(cmp_ctx);
|
||||
if (newcert == NULL)
|
||||
goto err;
|
||||
break;
|
||||
case CMP_RR:
|
||||
if (OSSL_CMP_exec_RR_ses(cmp_ctx) == NULL)
|
||||
goto err;
|
||||
break;
|
||||
case CMP_GENM:
|
||||
{
|
||||
STACK_OF(OSSL_CMP_ITAV) *itavs;
|
||||
|
||||
if (opt_infotype != NID_undef) {
|
||||
OSSL_CMP_ITAV *itav =
|
||||
OSSL_CMP_ITAV_create(OBJ_nid2obj(opt_infotype), NULL);
|
||||
if (itav == NULL)
|
||||
goto err;
|
||||
OSSL_CMP_CTX_push0_genm_ITAV(cmp_ctx, itav);
|
||||
}
|
||||
|
||||
if ((itavs = OSSL_CMP_exec_GENM_ses(cmp_ctx)) == NULL)
|
||||
goto err;
|
||||
print_itavs(itavs);
|
||||
sk_OSSL_CMP_ITAV_pop_free(itavs, OSSL_CMP_ITAV_free);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
/* print PKIStatusInfo (this is in case there has been no error) */
|
||||
int status = OSSL_CMP_CTX_get_status(cmp_ctx);
|
||||
char *buf = app_malloc(OSSL_CMP_PKISI_BUFLEN, "PKIStatusInfo buf");
|
||||
const char *string =
|
||||
OSSL_CMP_CTX_snprint_PKIStatus(cmp_ctx, buf,
|
||||
OSSL_CMP_PKISI_BUFLEN);
|
||||
|
||||
CMP_print(bio_err,
|
||||
status == OSSL_CMP_PKISTATUS_accepted ? "info" :
|
||||
status == OSSL_CMP_PKISTATUS_rejection ? "server error" :
|
||||
status == OSSL_CMP_PKISTATUS_waiting ? "internal error"
|
||||
: "warning",
|
||||
"received from %s %s %s", opt_server,
|
||||
string != NULL ? string : "<unknown PKIStatus>", "");
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
|
||||
if (opt_cacertsout != NULL) {
|
||||
STACK_OF(X509) *certs = OSSL_CMP_CTX_get1_caPubs(cmp_ctx);
|
||||
|
||||
if (sk_X509_num(certs) > 0
|
||||
&& save_certs(cmp_ctx, certs, opt_cacertsout, "CA") < 0) {
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
goto err;
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
}
|
||||
|
||||
if (opt_extracertsout != NULL) {
|
||||
STACK_OF(X509) *certs = OSSL_CMP_CTX_get1_extraCertsIn(cmp_ctx);
|
||||
if (sk_X509_num(certs) > 0
|
||||
&& save_certs(cmp_ctx, certs, opt_extracertsout,
|
||||
"extra") < 0) {
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
goto err;
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
}
|
||||
|
||||
if (opt_certout != NULL && newcert != NULL) {
|
||||
STACK_OF(X509) *certs = sk_X509_new_null();
|
||||
|
||||
if (certs == NULL || !sk_X509_push(certs, newcert)
|
||||
|| save_certs(cmp_ctx, certs, opt_certout,
|
||||
"enrolled") < 0) {
|
||||
sk_X509_free(certs);
|
||||
goto err;
|
||||
}
|
||||
sk_X509_free(certs);
|
||||
}
|
||||
if (!OSSL_CMP_CTX_reinit(cmp_ctx))
|
||||
goto err;
|
||||
}
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
/* in case we ended up here on error without proper cleaning */
|
||||
cleanse(opt_keypass);
|
||||
cleanse(opt_newkeypass);
|
||||
cleanse(opt_otherpass);
|
||||
cleanse(opt_tls_keypass);
|
||||
cleanse(opt_secret);
|
||||
cleanse(opt_srv_keypass);
|
||||
cleanse(opt_srv_secret);
|
||||
|
||||
if (ret != 1)
|
||||
OSSL_CMP_CTX_print_errors(cmp_ctx);
|
||||
|
||||
ossl_cmp_mock_srv_free(OSSL_CMP_CTX_get_transfer_cb_arg(cmp_ctx));
|
||||
{
|
||||
APP_HTTP_TLS_INFO *http_tls_info =
|
||||
OSSL_CMP_CTX_get_http_cb_arg(cmp_ctx);
|
||||
|
||||
if (http_tls_info != NULL) {
|
||||
SSL_CTX_free(http_tls_info->ssl_ctx);
|
||||
OPENSSL_free(http_tls_info);
|
||||
}
|
||||
}
|
||||
X509_STORE_free(OSSL_CMP_CTX_get_certConf_cb_arg(cmp_ctx));
|
||||
OSSL_CMP_CTX_free(cmp_ctx);
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
release_engine(e);
|
||||
|
||||
NCONF_free(conf); /* must not do as long as opt_... variables are used */
|
||||
OSSL_CMP_log_close();
|
||||
|
||||
return ret == 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
/*
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Siemens AG 2018-2020
|
||||
*
|
||||
* 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 atf
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include "apps.h"
|
||||
#include "cmp_mock_srv.h"
|
||||
|
||||
#include <openssl/cmp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/cmperr.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(OSSL_CMP_ITAV)
|
||||
DEFINE_STACK_OF(ASN1_UTF8STRING)
|
||||
|
||||
/* the context for the CMP mock server */
|
||||
typedef struct
|
||||
{
|
||||
X509 *certOut; /* certificate to be returned in cp/ip/kup msg */
|
||||
STACK_OF(X509) *chainOut; /* chain of certOut to add to extraCerts field */
|
||||
STACK_OF(X509) *caPubsOut; /* certs to return in caPubs field of ip msg */
|
||||
OSSL_CMP_PKISI *statusOut; /* status for ip/cp/kup/rp msg unless polling */
|
||||
int sendError; /* send error response also on valid requests */
|
||||
OSSL_CMP_MSG *certReq; /* ir/cr/p10cr/kur remembered while polling */
|
||||
int certReqId; /* id of last ir/cr/kur, used for polling */
|
||||
int pollCount; /* number of polls before actual cert response */
|
||||
int checkAfterTime; /* time the client should wait between polling */
|
||||
} mock_srv_ctx;
|
||||
|
||||
|
||||
static void mock_srv_ctx_free(mock_srv_ctx *ctx)
|
||||
{
|
||||
if (ctx == NULL)
|
||||
return;
|
||||
|
||||
OSSL_CMP_PKISI_free(ctx->statusOut);
|
||||
X509_free(ctx->certOut);
|
||||
sk_X509_pop_free(ctx->chainOut, X509_free);
|
||||
sk_X509_pop_free(ctx->caPubsOut, X509_free);
|
||||
OSSL_CMP_MSG_free(ctx->certReq);
|
||||
OPENSSL_free(ctx);
|
||||
}
|
||||
|
||||
static mock_srv_ctx *mock_srv_ctx_new(void)
|
||||
{
|
||||
mock_srv_ctx *ctx = OPENSSL_zalloc(sizeof(mock_srv_ctx));
|
||||
|
||||
if (ctx == NULL)
|
||||
goto err;
|
||||
|
||||
if ((ctx->statusOut = OSSL_CMP_PKISI_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
ctx->certReqId = -1;
|
||||
|
||||
/* all other elements are initialized to 0 or NULL, respectively */
|
||||
return ctx;
|
||||
err:
|
||||
mock_srv_ctx_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (cert == NULL || X509_up_ref(cert)) {
|
||||
X509_free(ctx->certOut);
|
||||
ctx->certOut = cert;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set1_chainOut(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
STACK_OF(X509) *chain)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
STACK_OF(X509) *chain_copy = NULL;
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (chain != NULL && (chain_copy = X509_chain_up_ref(chain)) == NULL)
|
||||
return 0;
|
||||
sk_X509_pop_free(ctx->chainOut, X509_free);
|
||||
ctx->chainOut = chain_copy;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set1_caPubsOut(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
STACK_OF(X509) *caPubs)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
STACK_OF(X509) *caPubs_copy = NULL;
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (caPubs != NULL && (caPubs_copy = X509_chain_up_ref(caPubs)) == NULL)
|
||||
return 0;
|
||||
sk_X509_pop_free(ctx->caPubsOut, X509_free);
|
||||
ctx->caPubsOut = caPubs_copy;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set_statusInfo(OSSL_CMP_SRV_CTX *srv_ctx, int status,
|
||||
int fail_info, const char *text)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
OSSL_CMP_PKISI *si;
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if ((si = OSSL_CMP_STATUSINFO_new(status, fail_info, text)) == NULL)
|
||||
return 0;
|
||||
OSSL_CMP_PKISI_free(ctx->statusOut);
|
||||
ctx->statusOut = si;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set_send_error(OSSL_CMP_SRV_CTX *srv_ctx, int val)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
ctx->sendError = val != 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set_pollCount(OSSL_CMP_SRV_CTX *srv_ctx, int count)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (count < 0) {
|
||||
CMPerr(0, CMP_R_INVALID_ARGS);
|
||||
return 0;
|
||||
}
|
||||
ctx->pollCount = count;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ossl_cmp_mock_srv_set_checkAfterTime(OSSL_CMP_SRV_CTX *srv_ctx, int sec)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
ctx->checkAfterTime = sec;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static OSSL_CMP_PKISI *process_cert_request(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *cert_req,
|
||||
int certReqId,
|
||||
const OSSL_CRMF_MSG *crm,
|
||||
const X509_REQ *p10cr,
|
||||
X509 **certOut,
|
||||
STACK_OF(X509) **chainOut,
|
||||
STACK_OF(X509) **caPubs)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
OSSL_CMP_PKISI *si = NULL;
|
||||
|
||||
if (ctx == NULL || cert_req == NULL
|
||||
|| certOut == NULL || chainOut == NULL || caPubs == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return NULL;
|
||||
}
|
||||
if (ctx->sendError) {
|
||||
CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*certOut = NULL;
|
||||
*chainOut = NULL;
|
||||
*caPubs = NULL;
|
||||
ctx->certReqId = certReqId;
|
||||
if (ctx->pollCount > 0) {
|
||||
ctx->pollCount--;
|
||||
OSSL_CMP_MSG_free(ctx->certReq);
|
||||
if ((ctx->certReq = OSSL_CMP_MSG_dup(cert_req)) == NULL)
|
||||
return NULL;
|
||||
return OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_waiting, 0, NULL);
|
||||
}
|
||||
if (ctx->certOut != NULL
|
||||
&& (*certOut = X509_dup(ctx->certOut)) == NULL)
|
||||
/* TODO better return a cert produced from data in request template */
|
||||
goto err;
|
||||
if (ctx->chainOut != NULL
|
||||
&& (*chainOut = X509_chain_up_ref(ctx->chainOut)) == NULL)
|
||||
goto err;
|
||||
if (ctx->caPubsOut != NULL
|
||||
&& (*caPubs = X509_chain_up_ref(ctx->caPubsOut)) == NULL)
|
||||
goto err;
|
||||
if (ctx->statusOut != NULL
|
||||
&& (si = OSSL_CMP_PKISI_dup(ctx->statusOut)) == NULL)
|
||||
goto err;
|
||||
return si;
|
||||
|
||||
err:
|
||||
X509_free(*certOut);
|
||||
*certOut = NULL;
|
||||
sk_X509_pop_free(*chainOut, X509_free);
|
||||
*chainOut = NULL;
|
||||
sk_X509_pop_free(*caPubs, X509_free);
|
||||
*caPubs = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static OSSL_CMP_PKISI *process_rr(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *rr,
|
||||
const X509_NAME *issuer,
|
||||
const ASN1_INTEGER *serial)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL || rr == NULL || issuer == NULL || serial == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return NULL;
|
||||
}
|
||||
if (ctx->sendError || ctx->certOut == NULL) {
|
||||
CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* accept revocation only for the certificate we sent in ir/cr/kur */
|
||||
if (X509_NAME_cmp(issuer, X509_get_issuer_name(ctx->certOut)) != 0
|
||||
|| ASN1_INTEGER_cmp(serial,
|
||||
X509_get0_serialNumber(ctx->certOut)) != 0) {
|
||||
CMPerr(0, CMP_R_REQUEST_NOT_ACCEPTED);
|
||||
return NULL;
|
||||
}
|
||||
return OSSL_CMP_PKISI_dup(ctx->statusOut);
|
||||
}
|
||||
|
||||
static int process_genm(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *genm,
|
||||
const STACK_OF(OSSL_CMP_ITAV) *in,
|
||||
STACK_OF(OSSL_CMP_ITAV) **out)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL || genm == NULL || in == NULL || out == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (ctx->sendError) {
|
||||
CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out = sk_OSSL_CMP_ITAV_deep_copy(in, OSSL_CMP_ITAV_dup,
|
||||
OSSL_CMP_ITAV_free);
|
||||
return *out != NULL;
|
||||
}
|
||||
|
||||
static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
|
||||
const OSSL_CMP_PKISI *statusInfo,
|
||||
const ASN1_INTEGER *errorCode,
|
||||
const OSSL_CMP_PKIFREETEXT *errorDetails)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
char buf[OSSL_CMP_PKISI_BUFLEN];
|
||||
char *sibuf;
|
||||
int i;
|
||||
|
||||
if (ctx == NULL || error == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "mock server received error:\n");
|
||||
|
||||
if (statusInfo == NULL) {
|
||||
BIO_printf(bio_err, "pkiStatusInfo absent\n");
|
||||
} else {
|
||||
sibuf = OSSL_CMP_snprint_PKIStatusInfo(statusInfo, buf, sizeof(buf));
|
||||
BIO_printf(bio_err, "pkiStatusInfo: %s\n",
|
||||
sibuf != NULL ? sibuf: "<invalid>");
|
||||
}
|
||||
|
||||
if (errorCode == NULL)
|
||||
BIO_printf(bio_err, "errorCode absent\n");
|
||||
else
|
||||
BIO_printf(bio_err, "errorCode: %ld\n", ASN1_INTEGER_get(errorCode));
|
||||
|
||||
if (sk_ASN1_UTF8STRING_num(errorDetails) <= 0) {
|
||||
BIO_printf(bio_err, "errorDetails absent\n");
|
||||
} else {
|
||||
/* TODO could use sk_ASN1_UTF8STRING2text() if exported */
|
||||
BIO_printf(bio_err, "errorDetails: ");
|
||||
for (i = 0; i < sk_ASN1_UTF8STRING_num(errorDetails); i++) {
|
||||
if (i > 0)
|
||||
BIO_printf(bio_err, ", ");
|
||||
BIO_printf(bio_err, "\"");
|
||||
ASN1_STRING_print(bio_err,
|
||||
sk_ASN1_UTF8STRING_value(errorDetails, i));
|
||||
BIO_printf(bio_err, "\"");
|
||||
}
|
||||
BIO_printf(bio_err, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int process_certConf(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *certConf, int certReqId,
|
||||
const ASN1_OCTET_STRING *certHash,
|
||||
const OSSL_CMP_PKISI *si)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
ASN1_OCTET_STRING *digest;
|
||||
|
||||
if (ctx == NULL || certConf == NULL || certHash == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (ctx->sendError || ctx->certOut == NULL) {
|
||||
CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (certReqId != ctx->certReqId) {
|
||||
/* in case of error, invalid reqId -1 */
|
||||
CMPerr(0, CMP_R_BAD_REQUEST_ID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((digest = X509_digest_sig(ctx->certOut)) == NULL)
|
||||
return 0;
|
||||
if (ASN1_OCTET_STRING_cmp(certHash, digest) != 0) {
|
||||
ASN1_OCTET_STRING_free(digest);
|
||||
CMPerr(0, CMP_R_CERTHASH_UNMATCHED);
|
||||
return 0;
|
||||
}
|
||||
ASN1_OCTET_STRING_free(digest);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int process_pollReq(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *pollReq, int certReqId,
|
||||
OSSL_CMP_MSG **certReq, int64_t *check_after)
|
||||
{
|
||||
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
|
||||
|
||||
if (ctx == NULL || pollReq == NULL
|
||||
|| certReq == NULL || check_after == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (ctx->sendError || ctx->certReq == NULL) {
|
||||
*certReq = NULL;
|
||||
CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctx->pollCount == 0) {
|
||||
*certReq = ctx->certReq;
|
||||
ctx->certReq = NULL;
|
||||
*check_after = 0;
|
||||
} else {
|
||||
ctx->pollCount--;
|
||||
*certReq = NULL;
|
||||
*check_after = ctx->checkAfterTime;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(void)
|
||||
{
|
||||
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new();
|
||||
mock_srv_ctx *ctx = mock_srv_ctx_new();
|
||||
|
||||
if (srv_ctx != NULL && ctx != NULL
|
||||
&& OSSL_CMP_SRV_CTX_init(srv_ctx, ctx, process_cert_request,
|
||||
process_rr, process_genm, process_error,
|
||||
process_certConf, process_pollReq))
|
||||
return srv_ctx;
|
||||
|
||||
mock_srv_ctx_free(ctx);
|
||||
OSSL_CMP_SRV_CTX_free(srv_ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx)
|
||||
{
|
||||
if (srv_ctx != NULL)
|
||||
mock_srv_ctx_free(OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx));
|
||||
OSSL_CMP_SRV_CTX_free(srv_ctx);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Siemens AG 2018-2020
|
||||
*
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OSSL_APPS_CMP_MOCK_SRV_H
|
||||
# define OSSL_APPS_CMP_MOCK_SRV_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# ifndef OPENSSL_NO_CMP
|
||||
|
||||
# include <openssl/cmp.h>
|
||||
|
||||
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(void);
|
||||
void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx);
|
||||
|
||||
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);
|
||||
int ossl_cmp_mock_srv_set1_chainOut(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
STACK_OF(X509) *chain);
|
||||
int ossl_cmp_mock_srv_set1_caPubsOut(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
STACK_OF(X509) *caPubs);
|
||||
int ossl_cmp_mock_srv_set_statusInfo(OSSL_CMP_SRV_CTX *srv_ctx, int status,
|
||||
int fail_info, const char *text);
|
||||
int ossl_cmp_mock_srv_set_send_error(OSSL_CMP_SRV_CTX *srv_ctx, int val);
|
||||
int ossl_cmp_mock_srv_set_pollCount(OSSL_CMP_SRV_CTX *srv_ctx, int count);
|
||||
int ossl_cmp_mock_srv_set_checkAfterTime(OSSL_CMP_SRV_CTX *srv_ctx, int sec);
|
||||
|
||||
# endif /* !defined(OPENSSL_NO_CMP) */
|
||||
#endif /* !defined(OSSL_APPS_CMP_MOCK_SRV_H) */
|
||||
+25
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2008-2020 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
|
||||
@@ -23,6 +23,12 @@
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/cms.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(CMS_SignerInfo)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(GENERAL_NAMES)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
|
||||
static int cms_cb(int ok, X509_STORE_CTX *ctx);
|
||||
static void receipt_request_print(CMS_ContentInfo *cms);
|
||||
@@ -190,7 +196,7 @@ const OPTIONS cms_options[] = {
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (ENGINE, other values ignored)"},
|
||||
{"keyopt", OPT_KEYOPT, 's', "Set public key parameters as n:v pairs"},
|
||||
|
||||
OPT_SECTION("Mail header"),
|
||||
@@ -570,7 +576,7 @@ int cms_main(int argc, char **argv)
|
||||
if (operation == SMIME_ENCRYPT) {
|
||||
if (encerts == NULL && (encerts = sk_X509_new_null()) == NULL)
|
||||
goto end;
|
||||
cert = load_cert(opt_arg(), FORMAT_PEM,
|
||||
cert = load_cert(opt_arg(), FORMAT_UNDEF,
|
||||
"recipient certificate file");
|
||||
if (cert == NULL)
|
||||
goto end;
|
||||
@@ -664,12 +670,18 @@ int cms_main(int argc, char **argv)
|
||||
goto opthelp;
|
||||
}
|
||||
|
||||
if (flags & CMS_CADES) {
|
||||
if (flags & CMS_NOATTR) {
|
||||
if ((flags & CMS_CADES) != 0) {
|
||||
if ((flags & CMS_NOATTR) != 0) {
|
||||
BIO_puts(bio_err, "Incompatible options: "
|
||||
"CAdES required signed attributes\n");
|
||||
goto opthelp;
|
||||
}
|
||||
if (operation == SMIME_VERIFY
|
||||
&& (flags & (CMS_NO_SIGNER_CERT_VERIFY | CMS_NO_ATTR_VERIFY)) != 0) {
|
||||
BIO_puts(bio_err, "Incompatible options: CAdES validation require"
|
||||
" certs and signed attributes validations\n");
|
||||
goto opthelp;
|
||||
}
|
||||
}
|
||||
|
||||
if (operation & SMIME_SIGNERS) {
|
||||
@@ -750,7 +762,7 @@ int cms_main(int argc, char **argv)
|
||||
if ((encerts = sk_X509_new_null()) == NULL)
|
||||
goto end;
|
||||
while (*argv) {
|
||||
if ((cert = load_cert(*argv, FORMAT_PEM,
|
||||
if ((cert = load_cert(*argv, FORMAT_UNDEF,
|
||||
"recipient certificate file")) == NULL)
|
||||
goto end;
|
||||
sk_X509_push(encerts, cert);
|
||||
@@ -768,7 +780,7 @@ int cms_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (recipfile != NULL && (operation == SMIME_DECRYPT)) {
|
||||
if ((recip = load_cert(recipfile, FORMAT_PEM,
|
||||
if ((recip = load_cert(recipfile, FORMAT_UNDEF,
|
||||
"recipient certificate file")) == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -776,7 +788,7 @@ int cms_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (originatorfile != NULL) {
|
||||
if ((originator = load_cert(originatorfile, FORMAT_PEM,
|
||||
if ((originator = load_cert(originatorfile, FORMAT_UNDEF,
|
||||
"originator certificate file")) == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -784,7 +796,7 @@ int cms_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (operation == SMIME_SIGN_RECEIPT) {
|
||||
if ((signer = load_cert(signerfile, FORMAT_PEM,
|
||||
if ((signer = load_cert(signerfile, FORMAT_UNDEF,
|
||||
"receipt signer certificate file")) == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -1013,7 +1025,8 @@ int cms_main(int argc, char **argv)
|
||||
signerfile = sk_OPENSSL_STRING_value(sksigners, i);
|
||||
keyfile = sk_OPENSSL_STRING_value(skkeys, i);
|
||||
|
||||
signer = load_cert(signerfile, FORMAT_PEM, "signer certificate");
|
||||
signer = load_cert(signerfile, FORMAT_UNDEF,
|
||||
"signer certificate");
|
||||
if (signer == NULL) {
|
||||
ret = 2;
|
||||
goto end;
|
||||
@@ -1108,7 +1121,8 @@ int cms_main(int argc, char **argv)
|
||||
goto end;
|
||||
} else if (operation == SMIME_VERIFY) {
|
||||
if (CMS_verify(cms, other, store, indata, out, flags) > 0) {
|
||||
BIO_printf(bio_err, "Verification successful\n");
|
||||
BIO_printf(bio_err, "%s Verification successful\n",
|
||||
(flags & CMS_CADES) ? "CAdES" : "CMS");
|
||||
} else {
|
||||
BIO_printf(bio_err, "Verification failure\n");
|
||||
if (verify_retcode)
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -34,9 +34,9 @@ const OPTIONS crl_options[] = {
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"inform", OPT_INFORM, 'F', "Input format; default PEM"},
|
||||
{"inform", OPT_INFORM, 'F', "CRL input format (DER or PEM); has no effect"},
|
||||
{"key", OPT_KEY, '<', "CRL signing Private key to use"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Private key file format (PEM or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Private key file format (DER/PEM/P12); has no effect"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "output file - default stdout"},
|
||||
@@ -46,7 +46,7 @@ const OPTIONS crl_options[] = {
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
{"hash_old", OPT_HASH_OLD, '-', "Print old-style (MD5) hash value"},
|
||||
#endif
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
|
||||
OPT_SECTION("CRL"),
|
||||
@@ -122,7 +122,7 @@ int crl_main(int argc, char **argv)
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &keyformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &keyformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_KEY:
|
||||
@@ -205,7 +205,7 @@ int crl_main(int argc, char **argv)
|
||||
if (argc != 0)
|
||||
goto opthelp;
|
||||
|
||||
x = load_crl(infile, informat);
|
||||
x = load_crl(infile, informat, "CRL");
|
||||
if (x == NULL)
|
||||
goto end;
|
||||
|
||||
@@ -250,7 +250,7 @@ int crl_main(int argc, char **argv)
|
||||
BIO_puts(bio_err, "Missing CRL signing key\n");
|
||||
goto end;
|
||||
}
|
||||
newcrl = load_crl(crldiff, informat);
|
||||
newcrl = load_crl(crldiff, informat, "other CRL");
|
||||
if (!newcrl)
|
||||
goto end;
|
||||
pkey = load_key(keyfile, keyformat, 0, NULL, NULL, "CRL signing key");
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -19,6 +19,11 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_INFO)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <openssl/hmac.h>
|
||||
#include <ctype.h>
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#undef BUFSIZE
|
||||
#define BUFSIZE 1024*8
|
||||
|
||||
@@ -62,7 +64,7 @@ const OPTIONS dgst_options[] = {
|
||||
{"c", OPT_C, '-', "Print the digest with separating colons"},
|
||||
{"r", OPT_R, '-', "Print the digest in coreutils format"},
|
||||
{"out", OPT_OUT, '>', "Output to filename rather than stdout"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format (PEM or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format (ENGINE, other values ignored)"},
|
||||
{"hex", OPT_HEX, '-', "Print as hex dump"},
|
||||
{"binary", OPT_BINARY, '-', "Print in binary form"},
|
||||
{"d", OPT_DEBUG, '-', "Print debug info"},
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR
|
||||
Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL
|
||||
/1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC
|
||||
-----END DH PARAMETERS-----
|
||||
|
||||
These are the 1024-bit DH parameters from "Internet Key Exchange
|
||||
Protocol Version 2 (IKEv2)": https://tools.ietf.org/html/rfc5996
|
||||
|
||||
See https://tools.ietf.org/html/rfc2412 for how they were generated.
|
||||
@@ -1,14 +0,0 @@
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIIBCAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb
|
||||
IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft
|
||||
awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT
|
||||
mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh
|
||||
fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq
|
||||
5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAg==
|
||||
-----END DH PARAMETERS-----
|
||||
|
||||
These are the 2048-bit DH parameters from "More Modular Exponential
|
||||
(MODP) Diffie-Hellman groups for Internet Key Exchange (IKE)":
|
||||
https://tools.ietf.org/html/rfc3526
|
||||
|
||||
See https://tools.ietf.org/html/rfc2412 for how they were generated.
|
||||
@@ -1,19 +0,0 @@
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIICCAKCAgEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb
|
||||
IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft
|
||||
awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT
|
||||
mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh
|
||||
fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq
|
||||
5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM
|
||||
fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq
|
||||
ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI
|
||||
ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O
|
||||
+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI
|
||||
HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0BjGZ//////////8CAQI=
|
||||
-----END DH PARAMETERS-----
|
||||
|
||||
These are the 4096-bit DH parameters from "More Modular Exponential
|
||||
(MODP) Diffie-Hellman groups for Internet Key Exchange (IKE)":
|
||||
https://tools.ietf.org/html/rfc3526
|
||||
|
||||
See https://tools.ietf.org/html/rfc2412 for how they were generated.
|
||||
+114
-103
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -7,34 +7,35 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
# define OPENSSL_SUPPRESS_DEPRECATED
|
||||
#endif
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DH
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/dh.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
# include <openssl/dsa.h>
|
||||
# endif
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
# include <openssl/dsa.h>
|
||||
#endif
|
||||
|
||||
# define DEFBITS 2048
|
||||
#define DEFBITS 2048
|
||||
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int dh_cb(int p, int n, BN_GENCB *cb);
|
||||
#endif
|
||||
static int gendh_cb(EVP_PKEY_CTX *ctx);
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -50,13 +51,13 @@ const OPTIONS dhparam_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"check", OPT_CHECK, '-', "Check the DH parameters"},
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{"dsaparam", OPT_DSAPARAM, '-',
|
||||
"Read or generate DSA parameters, convert to DH"},
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
@@ -83,10 +84,12 @@ const OPTIONS dhparam_options[] = {
|
||||
int dhparam_main(int argc, char **argv)
|
||||
{
|
||||
BIO *in = NULL, *out = NULL;
|
||||
DH *dh = NULL;
|
||||
DH *dh = NULL, *alloc_dh = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *prog;
|
||||
ENGINE *e = NULL;
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
int dsaparam = 0;
|
||||
#endif
|
||||
int i, text = 0, C = 0, ret = 1, num = 0, g = 0;
|
||||
@@ -130,7 +133,11 @@ int dhparam_main(int argc, char **argv)
|
||||
break;
|
||||
case OPT_DSAPARAM:
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
# ifdef OPENSSL_NO_DEPRECATED_3_0
|
||||
BIO_printf(bio_err, "The dsaparam option is deprecated.\n");
|
||||
# else
|
||||
dsaparam = 1;
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
case OPT_C:
|
||||
@@ -167,13 +174,13 @@ int dhparam_main(int argc, char **argv)
|
||||
if (g && !num)
|
||||
num = DEFBITS;
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (dsaparam && g) {
|
||||
BIO_printf(bio_err,
|
||||
"generator may not be chosen for DSA parameters\n");
|
||||
"Error, generator may not be chosen for DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
out = bio_open_default(outfile, 'w', outformat);
|
||||
if (out == NULL)
|
||||
@@ -185,18 +192,16 @@ int dhparam_main(int argc, char **argv)
|
||||
|
||||
if (num) {
|
||||
|
||||
BN_GENCB *cb;
|
||||
cb = BN_GENCB_new();
|
||||
if (cb == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
BN_GENCB_set(cb, dh_cb, bio_err);
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (dsaparam) {
|
||||
DSA *dsa = DSA_new();
|
||||
BN_GENCB *cb = BN_GENCB_new();
|
||||
|
||||
if (cb == NULL)
|
||||
goto end;
|
||||
|
||||
BN_GENCB_set(cb, dh_cb, bio_err);
|
||||
|
||||
BIO_printf(bio_err,
|
||||
"Generating DSA parameters, %d bit long prime\n", num);
|
||||
@@ -205,40 +210,52 @@ int dhparam_main(int argc, char **argv)
|
||||
cb)) {
|
||||
DSA_free(dsa);
|
||||
BN_GENCB_free(cb);
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Error, unable to generate DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
dh = DSA_dup_DH(dsa);
|
||||
dh = alloc_dh = DSA_dup_DH(dsa);
|
||||
DSA_free(dsa);
|
||||
if (dh == NULL) {
|
||||
BN_GENCB_free(cb);
|
||||
ERR_print_errors(bio_err);
|
||||
BN_GENCB_free(cb);
|
||||
if (dh == NULL)
|
||||
goto end;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ctx = EVP_PKEY_CTX_new_from_name(NULL, "DH", NULL);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, DH key generation context allocation failed\n");
|
||||
goto end;
|
||||
}
|
||||
} else
|
||||
# endif
|
||||
{
|
||||
dh = DH_new();
|
||||
EVP_PKEY_CTX_set_cb(ctx, gendh_cb);
|
||||
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
|
||||
BIO_printf(bio_err,
|
||||
"Generating DH parameters, %d bit long safe prime, generator %d\n",
|
||||
num, g);
|
||||
BIO_printf(bio_err, "This is going to take a long time\n");
|
||||
if (dh == NULL || !DH_generate_parameters_ex(dh, num, g, cb)) {
|
||||
BN_GENCB_free(cb);
|
||||
ERR_print_errors(bio_err);
|
||||
if (!EVP_PKEY_paramgen_init(ctx)) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, unable to initialise DH param generation\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, num)) {
|
||||
BIO_printf(bio_err, "Error, unable to set DH prime length\n");
|
||||
goto end;
|
||||
}
|
||||
if (!EVP_PKEY_paramgen(ctx, &pkey)) {
|
||||
BIO_printf(bio_err, "Error, DH generation failed\n");
|
||||
goto end;
|
||||
}
|
||||
dh = EVP_PKEY_get0_DH(pkey);
|
||||
}
|
||||
|
||||
BN_GENCB_free(cb);
|
||||
} else {
|
||||
|
||||
in = bio_open_default(infile, 'r', informat);
|
||||
if (in == NULL)
|
||||
goto end;
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (dsaparam) {
|
||||
DSA *dsa;
|
||||
|
||||
@@ -248,76 +265,54 @@ int dhparam_main(int argc, char **argv)
|
||||
dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL);
|
||||
|
||||
if (dsa == NULL) {
|
||||
BIO_printf(bio_err, "unable to load DSA parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Error, unable to load DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
dh = DSA_dup_DH(dsa);
|
||||
dh = alloc_dh = DSA_dup_DH(dsa);
|
||||
DSA_free(dsa);
|
||||
if (dh == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (dh == NULL)
|
||||
goto end;
|
||||
}
|
||||
} else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
if (informat == FORMAT_ASN1) {
|
||||
/*
|
||||
* We have no PEM header to determine what type of DH params it
|
||||
* is. We'll just try both.
|
||||
*/
|
||||
dh = d2i_DHparams_bio(in, NULL);
|
||||
dh = alloc_dh = ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, in, NULL);
|
||||
/* BIO_reset() returns 0 for success for file BIOs only!!! */
|
||||
if (dh == NULL && BIO_reset(in) == 0)
|
||||
dh = d2i_DHxparams_bio(in, NULL);
|
||||
dh = alloc_dh = ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, in, NULL);
|
||||
} else {
|
||||
/* informat == FORMAT_PEM */
|
||||
dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
|
||||
dh = alloc_dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (dh == NULL) {
|
||||
BIO_printf(bio_err, "unable to load DH parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Error, unable to load DH parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/* dh != NULL */
|
||||
}
|
||||
|
||||
if (text) {
|
||||
DHparams_print(out, dh);
|
||||
}
|
||||
if (text)
|
||||
EVP_PKEY_print_params(out, pkey, 4, NULL);
|
||||
|
||||
if (check) {
|
||||
if (!DH_check(dh, &i)) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (!EVP_PKEY_param_check(ctx) /* DH_check(dh, &i) */) {
|
||||
BIO_printf(bio_err, "Error, invalid parameters generated\n");
|
||||
goto end;
|
||||
}
|
||||
if (i & DH_CHECK_P_NOT_PRIME)
|
||||
BIO_printf(bio_err, "WARNING: p value is not prime\n");
|
||||
if (i & DH_CHECK_P_NOT_SAFE_PRIME)
|
||||
BIO_printf(bio_err, "WARNING: p value is not a safe prime\n");
|
||||
if (i & DH_CHECK_Q_NOT_PRIME)
|
||||
BIO_printf(bio_err, "WARNING: q value is not a prime\n");
|
||||
if (i & DH_CHECK_INVALID_Q_VALUE)
|
||||
BIO_printf(bio_err, "WARNING: q value is invalid\n");
|
||||
if (i & DH_CHECK_INVALID_J_VALUE)
|
||||
BIO_printf(bio_err, "WARNING: j value is invalid\n");
|
||||
if (i & DH_UNABLE_TO_CHECK_GENERATOR)
|
||||
BIO_printf(bio_err,
|
||||
"WARNING: unable to check the generator value\n");
|
||||
if (i & DH_NOT_SUITABLE_GENERATOR)
|
||||
BIO_printf(bio_err, "WARNING: the g value is not a generator\n");
|
||||
if (i == 0)
|
||||
BIO_printf(bio_err, "DH parameters appear to be ok.\n");
|
||||
if (num != 0 && i != 0) {
|
||||
BIO_printf(bio_err, "DH parameters appear to be ok.\n");
|
||||
if (num != 0) {
|
||||
/*
|
||||
* We have generated parameters but DH_check() indicates they are
|
||||
* invalid! This should never happen!
|
||||
*/
|
||||
BIO_printf(bio_err, "ERROR: Invalid parameters generated\n");
|
||||
BIO_printf(bio_err, "Error, invalid parameters generated\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
@@ -326,8 +321,9 @@ int dhparam_main(int argc, char **argv)
|
||||
int len, bits;
|
||||
const BIGNUM *pbn, *gbn;
|
||||
|
||||
len = DH_size(dh);
|
||||
bits = DH_bits(dh);
|
||||
dh = EVP_PKEY_get0_DH(pkey);
|
||||
len = EVP_PKEY_size(pkey);
|
||||
bits = EVP_PKEY_size(pkey);
|
||||
DH_get0_pqg(dh, &pbn, NULL, &gbn);
|
||||
data = app_malloc(len, "print a BN");
|
||||
|
||||
@@ -365,36 +361,51 @@ int dhparam_main(int argc, char **argv)
|
||||
DH_get0_pqg(dh, NULL, &q, NULL);
|
||||
if (outformat == FORMAT_ASN1) {
|
||||
if (q != NULL)
|
||||
i = i2d_DHxparams_bio(out, dh);
|
||||
i = ASN1_i2d_bio_of(DH, i2d_DHxparams, out, dh);
|
||||
else
|
||||
i = i2d_DHparams_bio(out, dh);
|
||||
i = ASN1_i2d_bio_of(DH, i2d_DHparams, out, dh);
|
||||
} else if (q != NULL) {
|
||||
i = PEM_write_bio_DHxparams(out, dh);
|
||||
} else {
|
||||
i = PEM_write_bio_DHparams(out, dh);
|
||||
}
|
||||
if (!i) {
|
||||
BIO_printf(bio_err, "unable to write DH parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Error, unable to write DH parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
DH_free(alloc_dh);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DH_free(dh);
|
||||
EVP_PKEY_free(pkey);
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
release_engine(e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dh_cb(int p, int n, BN_GENCB *cb)
|
||||
static int common_dh_cb(int p, BIO *b)
|
||||
{
|
||||
static const char symbols[] = ".+*\n";
|
||||
char c = (p >= 0 && (size_t)p < sizeof(symbols) - 1) ? symbols[p] : '?';
|
||||
|
||||
BIO_write(BN_GENCB_get_arg(cb), &c, 1);
|
||||
(void)BIO_flush(BN_GENCB_get_arg(cb));
|
||||
BIO_write(b, &c, 1);
|
||||
(void)BIO_flush(b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static int dh_cb(int p, int n, BN_GENCB *cb)
|
||||
{
|
||||
return common_dh_cb(p, BN_GENCB_get_arg(cb));
|
||||
}
|
||||
#endif
|
||||
|
||||
static int gendh_cb(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
return common_dh_cb(EVP_PKEY_CTX_get_keygen_info(ctx, 0),
|
||||
EVP_PKEY_CTX_get_app_data(ctx));
|
||||
}
|
||||
+36
-46
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -7,27 +7,21 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use the deprecated DSA_print */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <time.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/dsa.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/bn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -43,18 +37,18 @@ const OPTIONS dsa_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_RC4
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
{"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
|
||||
{"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
|
||||
{"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, DER PEM PVK"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER/PEM/PVK); has no effect"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
|
||||
@@ -76,15 +70,16 @@ int dsa_main(int argc, char **argv)
|
||||
BIO *out = NULL;
|
||||
DSA *dsa = NULL;
|
||||
ENGINE *e = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
const EVP_CIPHER *enc = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *prog;
|
||||
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
|
||||
OPTION_CHOICE o;
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, noout = 0;
|
||||
int i, modulus = 0, pubin = 0, pubout = 0, ret = 1;
|
||||
# ifndef OPENSSL_NO_RC4
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
int pvk_encr = 2;
|
||||
# endif
|
||||
#endif
|
||||
int private = 0;
|
||||
|
||||
prog = opt_init(argc, argv, dsa_options);
|
||||
@@ -169,19 +164,13 @@ int dsa_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "read DSA key\n");
|
||||
{
|
||||
EVP_PKEY *pkey;
|
||||
if (pubin)
|
||||
pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
|
||||
else
|
||||
pkey = load_key(infile, informat, 1, passin, e, "Private Key");
|
||||
|
||||
if (pubin)
|
||||
pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
|
||||
else
|
||||
pkey = load_key(infile, informat, 1, passin, e, "Private Key");
|
||||
|
||||
if (pkey != NULL) {
|
||||
dsa = EVP_PKEY_get1_DSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
}
|
||||
if (pkey != NULL)
|
||||
dsa = EVP_PKEY_get1_DSA(pkey);
|
||||
|
||||
if (dsa == NULL) {
|
||||
BIO_printf(bio_err, "unable to load Key\n");
|
||||
@@ -195,7 +184,8 @@ int dsa_main(int argc, char **argv)
|
||||
|
||||
if (text) {
|
||||
assert(pubin || private);
|
||||
if (!DSA_print(out, dsa, 0)) {
|
||||
if ((pubin && EVP_PKEY_print_public(out, pkey, 0, NULL) <= 0)
|
||||
|| (!pubin && EVP_PKEY_print_private(out, pkey, 0, NULL) <= 0)) {
|
||||
perror(outfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -230,7 +220,7 @@ int dsa_main(int argc, char **argv)
|
||||
i = PEM_write_bio_DSAPrivateKey(out, dsa, enc,
|
||||
NULL, 0, NULL, passout);
|
||||
}
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
|
||||
EVP_PKEY *pk;
|
||||
pk = EVP_PKEY_new();
|
||||
@@ -245,13 +235,13 @@ int dsa_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
assert(private);
|
||||
# ifdef OPENSSL_NO_RC4
|
||||
# ifdef OPENSSL_NO_RC4
|
||||
BIO_printf(bio_err, "PVK format not supported\n");
|
||||
EVP_PKEY_free(pk);
|
||||
goto end;
|
||||
# else
|
||||
# else
|
||||
i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
|
||||
# endif
|
||||
# endif
|
||||
} else if (pubin || pubout) {
|
||||
i = i2b_PublicKey_bio(out, pk);
|
||||
} else {
|
||||
@@ -259,7 +249,7 @@ int dsa_main(int argc, char **argv)
|
||||
i = i2b_PrivateKey_bio(out, pk);
|
||||
}
|
||||
EVP_PKEY_free(pk);
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
BIO_printf(bio_err, "bad output format specified for outfile\n");
|
||||
goto end;
|
||||
@@ -272,10 +262,10 @@ int dsa_main(int argc, char **argv)
|
||||
ret = 0;
|
||||
end:
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(pkey);
|
||||
DSA_free(dsa);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passin);
|
||||
OPENSSL_free(passout);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+79
-66
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -7,30 +7,24 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/dsa.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
static int dsa_cb(int p, int n, BN_GENCB *cb);
|
||||
static int gendsa_cb(EVP_PKEY_CTX *ctx);
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -44,9 +38,9 @@ const OPTIONS dsaparam_options[] = {
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
@@ -72,9 +66,9 @@ const OPTIONS dsaparam_options[] = {
|
||||
int dsaparam_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
DSA *dsa = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
BN_GENCB *cb = NULL;
|
||||
EVP_PKEY *params = NULL, *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
int numbits = -1, num = 0, genkey = 0;
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, noout = 0, C = 0;
|
||||
int ret = 1, i, text = 0, private = 0;
|
||||
@@ -153,6 +147,12 @@ int dsaparam_main(int argc, char **argv)
|
||||
if (out == NULL)
|
||||
goto end;
|
||||
|
||||
ctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, DSA parameter generation context allocation failed\n");
|
||||
goto end;
|
||||
}
|
||||
if (numbits > 0) {
|
||||
if (numbits > OPENSSL_DSA_MAX_MODULUS_BITS)
|
||||
BIO_printf(bio_err,
|
||||
@@ -160,48 +160,49 @@ int dsaparam_main(int argc, char **argv)
|
||||
" Your key size is %d! Larger key size may behave not as expected.\n",
|
||||
OPENSSL_DSA_MAX_MODULUS_BITS, numbits);
|
||||
|
||||
cb = BN_GENCB_new();
|
||||
if (cb == NULL) {
|
||||
BIO_printf(bio_err, "Error allocating BN_GENCB object\n");
|
||||
goto end;
|
||||
}
|
||||
BN_GENCB_set(cb, dsa_cb, bio_err);
|
||||
dsa = DSA_new();
|
||||
if (dsa == NULL) {
|
||||
BIO_printf(bio_err, "Error allocating DSA object\n");
|
||||
goto end;
|
||||
}
|
||||
EVP_PKEY_CTX_set_cb(ctx, gendsa_cb);
|
||||
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
|
||||
if (verbose) {
|
||||
BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
|
||||
num);
|
||||
BIO_printf(bio_err, "This could take some time\n");
|
||||
}
|
||||
if (!DSA_generate_parameters_ex(dsa, num, NULL, 0, NULL, NULL, cb)) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (EVP_PKEY_paramgen_init(ctx) <= 0) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, DSA key generation paramgen init failed\n");
|
||||
goto end;
|
||||
}
|
||||
if (!EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num)) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, DSA key generation setting bit length failed\n");
|
||||
goto end;
|
||||
}
|
||||
if (EVP_PKEY_paramgen(ctx, ¶ms) <= 0) {
|
||||
BIO_printf(bio_err, "Error, DSA key generation failed\n");
|
||||
goto end;
|
||||
}
|
||||
} else if (informat == FORMAT_ASN1) {
|
||||
dsa = d2i_DSAparams_bio(in, NULL);
|
||||
params = d2i_KeyParams_bio(EVP_PKEY_DSA, NULL, in);
|
||||
} else {
|
||||
dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL);
|
||||
params = PEM_read_bio_Parameters(in, NULL);
|
||||
}
|
||||
if (dsa == NULL) {
|
||||
BIO_printf(bio_err, "unable to load DSA parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
if (params == NULL) {
|
||||
BIO_printf(bio_err, "Error, unable to load DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (text) {
|
||||
DSAparams_print(out, dsa);
|
||||
EVP_PKEY_print_params(out, params, 0, NULL);
|
||||
}
|
||||
|
||||
if (C) {
|
||||
const BIGNUM *p = NULL, *q = NULL, *g = NULL;
|
||||
BIGNUM *p = NULL, *q = NULL, *g = NULL;
|
||||
unsigned char *data;
|
||||
int len, bits_p;
|
||||
|
||||
DSA_get0_pqg(dsa, &p, &q, &g);
|
||||
EVP_PKEY_get_bn_param(params, "p", &p);
|
||||
EVP_PKEY_get_bn_param(params, "q", &q);
|
||||
EVP_PKEY_get_bn_param(params, "g", &g);
|
||||
len = BN_num_bytes(p);
|
||||
bits_p = BN_num_bits(p);
|
||||
|
||||
@@ -237,53 +238,65 @@ int dsaparam_main(int argc, char **argv)
|
||||
|
||||
if (!noout) {
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i = i2d_DSAparams_bio(out, dsa);
|
||||
i = i2d_KeyParams_bio(out, params);
|
||||
else
|
||||
i = PEM_write_bio_DSAparams(out, dsa);
|
||||
i = PEM_write_bio_Parameters(out, params);
|
||||
if (!i) {
|
||||
BIO_printf(bio_err, "unable to write DSA parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Error, unable to write DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (genkey) {
|
||||
DSA *dsakey;
|
||||
|
||||
if ((dsakey = DSAparams_dup(dsa)) == NULL)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
ctx = EVP_PKEY_CTX_new(params, NULL);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, DSA key generation context allocation failed\n");
|
||||
goto end;
|
||||
if (!DSA_generate_key(dsakey)) {
|
||||
ERR_print_errors(bio_err);
|
||||
DSA_free(dsakey);
|
||||
}
|
||||
if (!EVP_PKEY_keygen_init(ctx)) {
|
||||
BIO_printf(bio_err,
|
||||
"Error, unable to initialise for key generation\n");
|
||||
goto end;
|
||||
}
|
||||
if (!EVP_PKEY_keygen(ctx, &pkey)) {
|
||||
BIO_printf(bio_err, "Error, unable to generate key\n");
|
||||
goto end;
|
||||
}
|
||||
assert(private);
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i = i2d_DSAPrivateKey_bio(out, dsakey);
|
||||
i = i2d_PrivateKey_bio(out, pkey);
|
||||
else
|
||||
i = PEM_write_bio_DSAPrivateKey(out, dsakey, NULL, NULL, 0, NULL,
|
||||
NULL);
|
||||
DSA_free(dsakey);
|
||||
i = PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, NULL);
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
BN_GENCB_free(cb);
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
EVP_PKEY_free(pkey);
|
||||
EVP_PKEY_free(params);
|
||||
release_engine(e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dsa_cb(int p, int n, BN_GENCB *cb)
|
||||
static int gendsa_cb(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
static const char symbols[] = ".+*\n";
|
||||
char c = (p >= 0 && (size_t)p < sizeof(symbols) - 1) ? symbols[p] : '?';
|
||||
int p;
|
||||
char c;
|
||||
BIO *b;
|
||||
|
||||
if (!verbose)
|
||||
return 1;
|
||||
|
||||
BIO_write(BN_GENCB_get_arg(cb), &c, 1);
|
||||
(void)BIO_flush(BN_GENCB_get_arg(cb));
|
||||
b = EVP_PKEY_CTX_get_app_data(ctx);
|
||||
p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
|
||||
c = (p >= 0 && (size_t)p < sizeof(symbols) - 1) ? symbols[p] : '?';
|
||||
|
||||
BIO_write(b, &c, 1);
|
||||
(void)BIO_flush(b);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2020 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
|
||||
@@ -8,19 +8,16 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_EC
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/pem.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
static OPT_PAIR conv_forms[] = {
|
||||
{"compressed", POINT_CONVERSION_COMPRESSED},
|
||||
@@ -46,13 +43,13 @@ typedef enum OPTION_choice {
|
||||
const OPTIONS ec_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input file"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format - DER or PEM"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER/PEM/P12/ENGINE)"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"check", OPT_CHECK, '-', "check key consistency"},
|
||||
@@ -291,4 +288,3 @@ int ec_main(int argc, char **argv)
|
||||
OPENSSL_free(passout);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+16
-22
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -9,22 +9,19 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_EC
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/ec.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -39,9 +36,9 @@ const OPTIONS ecparam_options[] = {
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"list_curves", OPT_LIST_CURVES, '-',
|
||||
"Prints a list of all curve 'short names'"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
{"genkey", OPT_GENKEY, '-', "Generate ec key"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
@@ -308,7 +305,6 @@ int ecparam_main(int argc, char **argv)
|
||||
size_t buf_len = 0, tmp_len = 0;
|
||||
const EC_POINT *point;
|
||||
int is_prime, len = 0;
|
||||
const EC_METHOD *meth = EC_GROUP_method_of(group);
|
||||
|
||||
if ((ec_p = BN_new()) == NULL
|
||||
|| (ec_a = BN_new()) == NULL
|
||||
@@ -320,7 +316,7 @@ int ecparam_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
is_prime = (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field);
|
||||
is_prime = (EC_GROUP_get_field_type(group) == NID_X9_62_prime_field);
|
||||
if (!is_prime) {
|
||||
BIO_printf(bio_err, "Can only handle X9.62 prime fields\n");
|
||||
goto end;
|
||||
@@ -473,5 +469,3 @@ int ecparam_main(int argc, char **argv)
|
||||
BIO_free_all(out);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -538,7 +538,7 @@ int enc_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
/* wiping secret data as we no longer need it */
|
||||
OPENSSL_cleanse(hkey, strlen(hkey));
|
||||
cleanse(hkey);
|
||||
}
|
||||
|
||||
if ((benc = BIO_new(BIO_f_cipher())) == NULL)
|
||||
|
||||
+13
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2020 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
|
||||
@@ -8,19 +8,19 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_ENGINE
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/engine.h>
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/store.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/store.h>
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
DEFINE_STACK_OF_CSTRING()
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -491,4 +491,3 @@ int engine_main(int argc, char **argv)
|
||||
BIO_free_all(out);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+22
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2019-2020 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
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#define BUFSIZE 4096
|
||||
#define DEFAULT_MAC_NAME "HMAC"
|
||||
#define DEFAULT_FIPS_SECTION "fips_check_section"
|
||||
@@ -31,12 +33,13 @@ static OSSL_CALLBACK self_test_events;
|
||||
static char *self_test_corrupt_desc = NULL;
|
||||
static char *self_test_corrupt_type = NULL;
|
||||
static int self_test_log = 1;
|
||||
static int quiet = 0;
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_IN, OPT_OUT, OPT_MODULE,
|
||||
OPT_PROV_NAME, OPT_SECTION_NAME, OPT_MAC_NAME, OPT_MACOPT, OPT_VERIFY,
|
||||
OPT_NO_LOG, OPT_CORRUPT_DESC, OPT_CORRUPT_TYPE
|
||||
OPT_NO_LOG, OPT_CORRUPT_DESC, OPT_CORRUPT_TYPE, OPT_QUIET
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS fipsinstall_options[] = {
|
||||
@@ -60,6 +63,7 @@ const OPTIONS fipsinstall_options[] = {
|
||||
{"noout", OPT_NO_LOG, '-', "Disable logging of self test events"},
|
||||
{"corrupt_desc", OPT_CORRUPT_DESC, 's', "Corrupt a self test by description"},
|
||||
{"corrupt_type", OPT_CORRUPT_TYPE, 's', "Corrupt a self test by type"},
|
||||
{"quiet", OPT_QUIET, '-', "No messages, just exit status"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -287,7 +291,7 @@ int fipsinstall_main(int argc, char **argv)
|
||||
case OPT_ERR:
|
||||
opthelp:
|
||||
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
|
||||
goto end;
|
||||
goto cleanup;
|
||||
case OPT_HELP:
|
||||
opt_help(fipsinstall_options);
|
||||
ret = 0;
|
||||
@@ -298,6 +302,9 @@ opthelp:
|
||||
case OPT_OUT:
|
||||
out_fname = opt_arg();
|
||||
break;
|
||||
case OPT_QUIET:
|
||||
quiet = 1;
|
||||
/* FALLTHROUGH */
|
||||
case OPT_NO_LOG:
|
||||
self_test_log = 0;
|
||||
break;
|
||||
@@ -359,7 +366,7 @@ opthelp:
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx = EVP_MAC_CTX_new(mac);
|
||||
ctx = EVP_MAC_new_ctx(mac);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err, "Unable to create MAC CTX for module check\n");
|
||||
goto end;
|
||||
@@ -373,7 +380,7 @@ opthelp:
|
||||
if (params == NULL)
|
||||
goto end;
|
||||
|
||||
if (!EVP_MAC_CTX_set_params(ctx, params)) {
|
||||
if (!EVP_MAC_set_ctx_params(ctx, params)) {
|
||||
BIO_printf(bio_err, "MAC parameter error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ok = 0;
|
||||
@@ -383,7 +390,7 @@ opthelp:
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx2 = EVP_MAC_CTX_dup(ctx);
|
||||
ctx2 = EVP_MAC_dup_ctx(ctx);
|
||||
if (ctx2 == NULL) {
|
||||
BIO_printf(bio_err, "Unable to create MAC CTX for install indicator\n");
|
||||
goto end;
|
||||
@@ -405,7 +412,8 @@ opthelp:
|
||||
if (!verify_config(in_fname, section_name, module_mac, module_mac_len,
|
||||
install_mac, install_mac_len))
|
||||
goto end;
|
||||
BIO_printf(bio_out, "VERIFY PASSED\n");
|
||||
if (!quiet)
|
||||
BIO_printf(bio_out, "VERIFY PASSED\n");
|
||||
} else {
|
||||
|
||||
conf = generate_config_and_load(prov_name, section_name, module_mac,
|
||||
@@ -424,23 +432,26 @@ opthelp:
|
||||
module_mac_len, install_mac,
|
||||
install_mac_len))
|
||||
goto end;
|
||||
BIO_printf(bio_out, "INSTALL PASSED\n");
|
||||
if (!quiet)
|
||||
BIO_printf(bio_out, "INSTALL PASSED\n");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
if (ret == 1) {
|
||||
BIO_printf(bio_err, "%s FAILED\n", verify ? "VERIFY" : "INSTALL");
|
||||
if (!quiet)
|
||||
BIO_printf(bio_err, "%s FAILED\n", verify ? "VERIFY" : "INSTALL");
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
BIO_free(fout);
|
||||
BIO_free(mem_bio);
|
||||
BIO_free(module_bio);
|
||||
sk_OPENSSL_STRING_free(opts);
|
||||
EVP_MAC_free(mac);
|
||||
EVP_MAC_CTX_free(ctx2);
|
||||
EVP_MAC_CTX_free(ctx);
|
||||
EVP_MAC_free_ctx(ctx2);
|
||||
EVP_MAC_free_ctx(ctx);
|
||||
OPENSSL_free(read_buffer);
|
||||
free_config_and_unload(conf);
|
||||
return ret;
|
||||
|
||||
+45
-24
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -7,26 +7,20 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/dsa.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -39,9 +33,9 @@ const OPTIONS gendsa_options[] = {
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output the key to the specified file"},
|
||||
@@ -61,6 +55,8 @@ int gendsa_main(int argc, char **argv)
|
||||
ENGINE *e = NULL;
|
||||
BIO *out = NULL, *in = NULL;
|
||||
DSA *dsa = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
const EVP_CIPHER *enc = NULL;
|
||||
char *dsaparams = NULL;
|
||||
char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
|
||||
@@ -142,14 +138,38 @@ int gendsa_main(int argc, char **argv)
|
||||
" Your key size is %d! Larger key size may behave not as expected.\n",
|
||||
OPENSSL_DSA_MAX_MODULUS_BITS, BN_num_bits(p));
|
||||
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "unable to allocate PKEY\n");
|
||||
goto end;
|
||||
}
|
||||
if (!EVP_PKEY_set1_DSA(pkey, dsa)) {
|
||||
BIO_printf(bio_err, "unable to associate DSA parameters with PKEY\n");
|
||||
goto end;
|
||||
}
|
||||
ctx = EVP_PKEY_CTX_new(pkey, NULL);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err, "unable to create PKEY context\n");
|
||||
goto end;
|
||||
}
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL;
|
||||
if (EVP_PKEY_keygen_init(ctx) <= 0) {
|
||||
BIO_printf(bio_err, "unable to set up for key generation\n");
|
||||
goto end;
|
||||
}
|
||||
if (verbose)
|
||||
BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(p));
|
||||
if (!DSA_generate_key(dsa))
|
||||
if (EVP_PKEY_keygen(ctx, &pkey) <= 0) {
|
||||
BIO_printf(bio_err, "unable to generate key\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
assert(private);
|
||||
if (!PEM_write_bio_DSAPrivateKey(out, dsa, enc, NULL, 0, NULL, passout))
|
||||
if (!PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, passout)) {
|
||||
BIO_printf(bio_err, "unable to output generated key\n");
|
||||
goto end;
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (ret != 0)
|
||||
@@ -158,8 +178,9 @@ int gendsa_main(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
EVP_PKEY_free(pkey);
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passout);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
|
||||
+30
-27
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -8,27 +8,24 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_RSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/rsa.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/rand.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
# define DEFBITS 2048
|
||||
# define DEFPRIMES 2
|
||||
#define DEFBITS 2048
|
||||
#define DEFPRIMES 2
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
@@ -36,7 +33,10 @@ static int genrsa_cb(int p, int n, BN_GENCB *cb);
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_3, OPT_F4, OPT_ENGINE,
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OPT_3,
|
||||
#endif
|
||||
OPT_F4, OPT_ENGINE,
|
||||
OPT_OUT, OPT_PASSOUT, OPT_CIPHER, OPT_PRIMES, OPT_VERBOSE,
|
||||
OPT_R_ENUM, OPT_PROV_ENUM
|
||||
} OPTION_CHOICE;
|
||||
@@ -46,14 +46,16 @@ const OPTIONS genrsa_options[] = {
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"3", OPT_3, '-', "Use 3 for the E value"},
|
||||
{"F4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
{"f4", OPT_F4, '-', "Use F4 (0x10001) for the E value"},
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
{"3", OPT_3, '-', "(deprecated) Use 3 for the E value"},
|
||||
#endif
|
||||
{"F4", OPT_F4, '-', "Use the Fermat number F4 (0x10001) for the E value"},
|
||||
{"f4", OPT_F4, '-', "Use the Fermat number F4 (0x10001) for the E value"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output the key to specified file"},
|
||||
@@ -103,9 +105,11 @@ opthelp:
|
||||
ret = 0;
|
||||
opt_help(genrsa_options);
|
||||
goto end;
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
case OPT_3:
|
||||
f4 = 3;
|
||||
break;
|
||||
#endif
|
||||
case OPT_F4:
|
||||
f4 = RSA_F4;
|
||||
break;
|
||||
@@ -224,4 +228,3 @@ static int genrsa_cb(int p, int n, BN_GENCB *cb)
|
||||
(void)BIO_flush(BN_GENCB_get_arg(cb));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
+34
-46
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -12,8 +12,10 @@
|
||||
|
||||
# include "e_os.h" /* struct timeval for DTLS */
|
||||
# include "internal/nelem.h"
|
||||
# include "internal/sockets.h" /* for openssl_fdset() */
|
||||
# include <assert.h>
|
||||
|
||||
# include <stdarg.h>
|
||||
# include <sys/types.h>
|
||||
# ifndef OPENSSL_NO_POSIX_IO
|
||||
# include <sys/stat.h>
|
||||
@@ -28,26 +30,18 @@
|
||||
# include <openssl/txt_db.h>
|
||||
# include <openssl/engine.h>
|
||||
# include <openssl/ocsp.h>
|
||||
# include <openssl/http.h>
|
||||
# include <signal.h>
|
||||
# include "apps_ui.h"
|
||||
# include "opt.h"
|
||||
# include "fmt.h"
|
||||
# include "platform.h"
|
||||
|
||||
/* also in include/internal/sockets.h */
|
||||
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
|
||||
# define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
|
||||
# else
|
||||
# define openssl_fdset(a,b) FD_SET(a, b)
|
||||
# endif
|
||||
|
||||
/*
|
||||
* quick macro when you need to pass an unsigned char instead of a char.
|
||||
* this is true for some implementations of the is*() functions, for
|
||||
* example.
|
||||
*/
|
||||
#define _UC(c) ((unsigned char)(c))
|
||||
# define _UC(c) ((unsigned char)(c))
|
||||
|
||||
void app_RAND_load_conf(CONF *c, const char *section);
|
||||
void app_RAND_write(void);
|
||||
@@ -91,7 +85,7 @@ int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data);
|
||||
|
||||
int chopup_args(ARGS *arg, char *buf);
|
||||
int dump_cert_text(BIO *out, X509 *x);
|
||||
void print_name(BIO *out, const char *title, X509_NAME *nm,
|
||||
void print_name(BIO *out, const char *title, const X509_NAME *nm,
|
||||
unsigned long lflags);
|
||||
void print_bignum_var(BIO *, const BIGNUM *, const char*,
|
||||
int, unsigned char *);
|
||||
@@ -102,18 +96,28 @@ int set_cert_ex(unsigned long *flags, const char *arg);
|
||||
int set_name_ex(unsigned long *flags, const char *arg);
|
||||
int set_ext_copy(int *copy_type, const char *arg);
|
||||
int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
|
||||
char *get_passwd(const char *pass, const char *desc);
|
||||
int app_passwd(const char *arg1, const char *arg2, char **pass1, char **pass2);
|
||||
int add_oid_section(CONF *conf);
|
||||
X509 *load_cert(const char *file, int format, const char *cert_descrip);
|
||||
X509_CRL *load_crl(const char *infile, int format);
|
||||
EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *key_descrip);
|
||||
EVP_PKEY *load_pubkey(const char *file, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *key_descrip);
|
||||
X509_REQ *load_csr(const char *file, int format, const char *desc);
|
||||
X509 *load_cert_pass(const char *uri, int maybe_stdin,
|
||||
const char *pass, const char *desc);
|
||||
/* the format parameter is meanwhile not needed anymore and thus ignored */
|
||||
X509 *load_cert(const char *uri, int format, const char *desc);
|
||||
X509_CRL *load_crl(const char *uri, int format, const char *desc);
|
||||
void cleanse(char *str);
|
||||
void clear_free(char *str);
|
||||
EVP_PKEY *load_key(const char *uri, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *desc);
|
||||
EVP_PKEY *load_pubkey(const char *uri, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *desc);
|
||||
int load_certs(const char *file, STACK_OF(X509) **certs, int format,
|
||||
const char *pass, const char *cert_descrip);
|
||||
const char *pass, const char *desc);
|
||||
int load_crls(const char *file, STACK_OF(X509_CRL) **crls, int format,
|
||||
const char *pass, const char *cert_descrip);
|
||||
const char *pass, const char *desc);
|
||||
int load_key_cert_crl(const char *uri, int maybe_stdin,
|
||||
const char *pass, const char *desc,
|
||||
EVP_PKEY **ppkey, X509 **pcert, X509_CRL **pcrl);
|
||||
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore);
|
||||
@@ -122,7 +126,7 @@ __owur int ctx_set_verify_locations(SSL_CTX *ctx,
|
||||
const char *CApath, int noCApath,
|
||||
const char *CAstore, int noCAstore);
|
||||
|
||||
#ifndef OPENSSL_NO_CT
|
||||
# ifndef OPENSSL_NO_CT
|
||||
|
||||
/*
|
||||
* Sets the file to load the Certificate Transparency log list from.
|
||||
@@ -131,9 +135,10 @@ __owur int ctx_set_verify_locations(SSL_CTX *ctx,
|
||||
*/
|
||||
__owur int ctx_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
|
||||
|
||||
#endif
|
||||
# endif
|
||||
|
||||
ENGINE *setup_engine(const char *engine, int debug);
|
||||
ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug);
|
||||
# define setup_engine(e, debug) setup_engine_methods(e, (unsigned int)-1, debug)
|
||||
void release_engine(ENGINE *e);
|
||||
|
||||
# ifndef OPENSSL_NO_OCSP
|
||||
@@ -174,6 +179,7 @@ typedef struct ca_db_st {
|
||||
# endif
|
||||
} CA_DB;
|
||||
|
||||
void app_bail_out(char *fmt, ...);
|
||||
void* app_malloc(int sz, const char *what);
|
||||
BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai);
|
||||
int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial,
|
||||
@@ -197,12 +203,17 @@ X509_NAME *parse_name(const char *str, long chtype, int multirdn);
|
||||
void policies_print(X509_STORE_CTX *ctx);
|
||||
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value);
|
||||
int x509_ctrl_string(X509 *x, const char *value);
|
||||
int x509_req_ctrl_string(X509_REQ *x, const char *value);
|
||||
int init_gen_str(EVP_PKEY_CTX **pctx,
|
||||
const char *algname, ENGINE *e, int do_param);
|
||||
int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts);
|
||||
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
|
||||
int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts);
|
||||
int do_X509_REQ_verify(X509_REQ *x, EVP_PKEY *pkey,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts);
|
||||
int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts);
|
||||
|
||||
@@ -217,30 +228,6 @@ void print_cert_checks(BIO *bio, X509 *x,
|
||||
|
||||
void store_setup_crl_download(X509_STORE *st);
|
||||
|
||||
typedef struct app_http_tls_info_st {
|
||||
const char *server;
|
||||
const char *port;
|
||||
int use_proxy;
|
||||
long timeout;
|
||||
SSL_CTX *ssl_ctx;
|
||||
} APP_HTTP_TLS_INFO;
|
||||
BIO *app_http_tls_cb(BIO *hbio, /* APP_HTTP_TLS_INFO */ void *arg,
|
||||
int connect, int detail);
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
|
||||
const char *proxy_port, SSL_CTX *ssl_ctx,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
long timeout, const char *expected_content_type,
|
||||
const ASN1_ITEM *it);
|
||||
ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
|
||||
const char *path, const char *proxy,
|
||||
const char *proxy_port, SSL_CTX *ctx,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
const char *content_type,
|
||||
ASN1_VALUE *req, const ASN1_ITEM *req_it,
|
||||
long timeout, const ASN1_ITEM *rsp_it);
|
||||
# endif
|
||||
|
||||
# define EXT_COPY_NONE 0
|
||||
# define EXT_COPY_ADD 1
|
||||
# define EXT_COPY_ALL 2
|
||||
@@ -281,5 +268,6 @@ extern VERIFY_CB_ARGS verify_args;
|
||||
OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts,
|
||||
const OSSL_PARAM *paramdefs);
|
||||
void app_params_free(OSSL_PARAM *params);
|
||||
void app_providers_cleanup(void);
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2019-2020 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
|
||||
@@ -26,6 +26,7 @@ typedef struct function_st {
|
||||
int (*func)(int argc, char *argv[]);
|
||||
const OPTIONS *help;
|
||||
const char *deprecated_alternative;
|
||||
const char *deprecated_version;
|
||||
} FUNCTION;
|
||||
|
||||
DEFINE_LHASH_OF(FUNCTION);
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 1995-2020 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OSSL_HTTP_SERVER_H
|
||||
# define OSSL_HTTP_SERVER_H
|
||||
|
||||
# include "apps.h"
|
||||
|
||||
# ifndef HAVE_FORK
|
||||
# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS)
|
||||
# define HAVE_FORK 0
|
||||
# else
|
||||
# define HAVE_FORK 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if HAVE_FORK
|
||||
# undef NO_FORK
|
||||
# else
|
||||
# define NO_FORK
|
||||
# endif
|
||||
|
||||
# if !defined(NO_FORK) && !defined(OPENSSL_NO_SOCK) \
|
||||
&& !defined(OPENSSL_NO_POSIX_IO)
|
||||
# define HTTP_DAEMON
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include <syslog.h>
|
||||
# include <signal.h>
|
||||
# define MAXERRLEN 1000 /* limit error text sent to syslog to 1000 bytes */
|
||||
# else
|
||||
# undef LOG_INFO
|
||||
# undef LOG_WARNING
|
||||
# undef LOG_ERR
|
||||
# define LOG_INFO 0
|
||||
# define LOG_WARNING 1
|
||||
# define LOG_ERR 2
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* Log a message to syslog if multi-threaded HTTP_DAEMON, else to bio_err
|
||||
* prog: the name of the current app
|
||||
* level: the severity of the message, e.g., LOG_ERR
|
||||
* fmt: message with potential extra parameters like with printf()
|
||||
* returns nothing
|
||||
*/
|
||||
void log_message(const char *prog, int level, const char *fmt, ...);
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
/*-
|
||||
* Initialize an HTTP server by setting up its listening BIO
|
||||
* prog: the name of the current app
|
||||
* port: the port to listen on
|
||||
* returns a BIO for accepting requests, NULL on error
|
||||
*/
|
||||
BIO *http_server_init_bio(const char *prog, const char *port);
|
||||
|
||||
/*-
|
||||
* Accept an ASN.1-formatted HTTP request
|
||||
* it: the expected request ASN.1 type
|
||||
* preq: pointer to variable where to place the parsed request
|
||||
* pcbio: pointer to variable where to place the BIO for sending the response to
|
||||
* ppath: pointer to variable where to place the request path, or NULL
|
||||
* acbio: the listening bio (typically as returned by http_server_init_bio())
|
||||
* prog: the name of the current app
|
||||
* accept_get: whether to accept GET requests (in addition to POST requests)
|
||||
* timeout: connection timeout (in seconds), or 0 for none/infinite
|
||||
* returns 0 in case caller should retry, then *preq == *ppath == *pcbio == NULL
|
||||
* returns -1 on fatal error; also then holds *preq == *ppath == *pcbio == NULL
|
||||
* returns 1 otherwise. In this case it is guaranteed that *pcbio != NULL while
|
||||
* *ppath == NULL and *preq == NULL if and only if the request is invalid,
|
||||
* On return value 1 the caller is responsible for sending an HTTP response,
|
||||
* using http_server_send_asn1_resp() or http_server_send_status().
|
||||
* The caller must free any non-NULL *preq, *ppath, and *pcbio pointers.
|
||||
*/
|
||||
int http_server_get_asn1_req(const ASN1_ITEM *it, ASN1_VALUE **preq,
|
||||
char **ppath, BIO **pcbio, BIO *acbio,
|
||||
const char *prog, int accept_get, int timeout);
|
||||
|
||||
/*-
|
||||
* Send an ASN.1-formatted HTTP response
|
||||
* cbio: destination BIO (typically as returned by http_server_get_asn1_req())
|
||||
* note: cbio should not do an encoding that changes the output length
|
||||
* content_type: string identifying the type of the response
|
||||
* it: the response ASN.1 type
|
||||
* valit: the response ASN.1 type
|
||||
* resp: the response to send
|
||||
* returns 1 on success, 0 on failure
|
||||
*/
|
||||
int http_server_send_asn1_resp(BIO *cbio, const char *content_type,
|
||||
const ASN1_ITEM *it, const ASN1_VALUE *resp);
|
||||
|
||||
/*-
|
||||
* Send a trivial HTTP response, typically to report an error or OK
|
||||
* cbio: destination BIO (typically as returned by http_server_get_asn1_req())
|
||||
* status: the status code to send
|
||||
* reason: the corresponding human-readable string
|
||||
* returns 1 on success, 0 on failure
|
||||
*/
|
||||
int http_server_send_status(BIO *cbio, int status, const char *reason);
|
||||
|
||||
# endif
|
||||
|
||||
# ifdef HTTP_DAEMON
|
||||
extern int multi;
|
||||
extern int acfd;
|
||||
|
||||
void socket_timeout(int signum);
|
||||
void spawn_loop(const char *prog);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
+8
-6
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
@@ -132,9 +132,9 @@
|
||||
{ "xchain_build", OPT_X_CHAIN_BUILD, '-', \
|
||||
"build certificate chain for the extended certificates"}, \
|
||||
{ "xcertform", OPT_X_CERTFORM, 'F', \
|
||||
"format of Extended certificate (PEM or DER) PEM default " }, \
|
||||
"format of Extended certificate (PEM/DER/P12); has no effect" }, \
|
||||
{ "xkeyform", OPT_X_KEYFORM, 'F', \
|
||||
"format of Extended certificate's key (PEM or DER) PEM default"}
|
||||
"format of Extended certificate's key (DER/PEM/P12); has no effect"}
|
||||
|
||||
# define OPT_X_CASES \
|
||||
OPT_X__FIRST: case OPT_X__LAST: break; \
|
||||
@@ -275,8 +275,8 @@
|
||||
|
||||
# define OPT_PROV_OPTIONS \
|
||||
OPT_SECTION("Provider"), \
|
||||
{ "provider", OPT_PROV_PROVIDER, 's', "Provder to load (can be specified multiple times)" }, \
|
||||
{ "provider_path", OPT_PROV_PROVIDER_PATH, 's', "Provider load path" }
|
||||
{ "provider_path", OPT_PROV_PROVIDER_PATH, 's', "Provider load path (must be before 'provider' argument if required)" }, \
|
||||
{ "provider", OPT_PROV_PROVIDER, 's', "Provider to load (can be specified multiple times)" }
|
||||
|
||||
# define OPT_PROV_CASES \
|
||||
OPT_PROV__FIRST: case OPT_PROV__LAST: break; \
|
||||
@@ -342,6 +342,7 @@ char *opt_init(int ac, char **av, const OPTIONS * o);
|
||||
int opt_next(void);
|
||||
void opt_begin(void);
|
||||
int opt_format(const char *s, unsigned long flags, int *result);
|
||||
const char *format2str(int format);
|
||||
int opt_int(const char *arg, int *result);
|
||||
int opt_ulong(const char *arg, unsigned long *result);
|
||||
int opt_long(const char *arg, long *result);
|
||||
@@ -370,6 +371,7 @@ int opt_provider(int i);
|
||||
void opt_help(const OPTIONS * list);
|
||||
void opt_print(const OPTIONS * opt, int doingparams, int width);
|
||||
int opt_format_error(const char *s, unsigned long flags);
|
||||
void print_format_error(int format, unsigned long flags);
|
||||
int opt_isdir(const char *name);
|
||||
int opt_printf_stderr(const char *fmt, ...);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -32,6 +32,7 @@ int init_client(int *sock, const char *host, const char *port,
|
||||
const char *bindhost, const char *bindport,
|
||||
int family, int type, int protocol);
|
||||
int should_retry(int i);
|
||||
void do_ssl_shutdown(SSL *ssl);
|
||||
|
||||
long bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
||||
int argi, long argl, long ret);
|
||||
|
||||
+7
-5
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <openssl/kdf.h>
|
||||
#include <openssl/params.h>
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_KDFOPT, OPT_BIN, OPT_KEYLEN, OPT_OUT,
|
||||
@@ -102,7 +104,7 @@ opthelp:
|
||||
goto opthelp;
|
||||
}
|
||||
|
||||
ctx = EVP_KDF_CTX_new(kdf);
|
||||
ctx = EVP_KDF_new_ctx(kdf);
|
||||
if (ctx == NULL)
|
||||
goto err;
|
||||
|
||||
@@ -114,7 +116,7 @@ opthelp:
|
||||
if (params == NULL)
|
||||
goto err;
|
||||
|
||||
if (!EVP_KDF_CTX_set_params(ctx, params)) {
|
||||
if (!EVP_KDF_set_ctx_params(ctx, params)) {
|
||||
BIO_printf(bio_err, "KDF parameter error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ok = 0;
|
||||
@@ -159,7 +161,7 @@ err:
|
||||
OPENSSL_clear_free(dkm_bytes, dkm_len);
|
||||
sk_OPENSSL_STRING_free(opts);
|
||||
EVP_KDF_free(kdf);
|
||||
EVP_KDF_CTX_free(ctx);
|
||||
EVP_KDF_free_ctx(ctx);
|
||||
BIO_free(out);
|
||||
OPENSSL_free(hexout);
|
||||
return ret;
|
||||
|
||||
@@ -10,12 +10,17 @@
|
||||
#include "apps.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#include <openssl/safestack.h>
|
||||
|
||||
DEFINE_STACK_OF(OSSL_PROVIDER)
|
||||
|
||||
/*
|
||||
* See comments in opt_verify for explanation of this.
|
||||
*/
|
||||
enum prov_range { OPT_PROV_ENUM };
|
||||
|
||||
static STACK_OF(OSSL_PROVIDER) *app_providers = NULL;
|
||||
|
||||
static int opt_provider_load(const char *provider)
|
||||
{
|
||||
OSSL_PROVIDER *prov;
|
||||
@@ -26,9 +31,27 @@ static int opt_provider_load(const char *provider)
|
||||
opt_getprog(), provider);
|
||||
return 0;
|
||||
}
|
||||
if (app_providers == NULL)
|
||||
app_providers = sk_OSSL_PROVIDER_new_null();
|
||||
if (app_providers == NULL
|
||||
|| !sk_OSSL_PROVIDER_push(app_providers, prov)) {
|
||||
app_providers_cleanup();
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void provider_free(OSSL_PROVIDER *prov)
|
||||
{
|
||||
OSSL_PROVIDER_unload(prov);
|
||||
}
|
||||
|
||||
void app_providers_cleanup(void)
|
||||
{
|
||||
sk_OSSL_PROVIDER_pop_free(app_providers, provider_free);
|
||||
app_providers = NULL;
|
||||
}
|
||||
|
||||
static int opt_provider_path(const char *path)
|
||||
{
|
||||
if (path != NULL && *path == '\0')
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright 2020 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
|
||||
/*
|
||||
* X509_ctrl_str() is sorely lacking in libcrypto, but is still needed to
|
||||
* allow the application to process verification options in a manner similar
|
||||
* to signature or other options that pass through EVP_PKEY_CTX_ctrl_str(),
|
||||
* for uniformity.
|
||||
*
|
||||
* As soon as more stuff is added, the code will need serious rework. For
|
||||
* the moment, it only handles the FIPS 196 / SM2 distinguishing ID.
|
||||
*/
|
||||
#ifdef EVP_PKEY_CTRL_SET1_ID
|
||||
static ASN1_OCTET_STRING *mk_octet_string(void *value, size_t value_n)
|
||||
{
|
||||
ASN1_OCTET_STRING *v = ASN1_OCTET_STRING_new();
|
||||
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err, "error: allocation failed\n");
|
||||
} else if (!ASN1_OCTET_STRING_set(v, value, value_n)) {
|
||||
ASN1_OCTET_STRING_free(v);
|
||||
v = NULL;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int x509_ctrl(void *object, int cmd, void *value, size_t value_n)
|
||||
{
|
||||
switch (cmd) {
|
||||
#ifdef EVP_PKEY_CTRL_SET1_ID
|
||||
case EVP_PKEY_CTRL_SET1_ID:
|
||||
{
|
||||
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
|
||||
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"error: setting distinguishing ID in certificate failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_set0_distinguishing_id(object, v);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -2; /* typical EVP_PKEY return for "unsupported" */
|
||||
}
|
||||
|
||||
static int x509_req_ctrl(void *object, int cmd, void *value, size_t value_n)
|
||||
{
|
||||
switch (cmd) {
|
||||
#ifdef EVP_PKEY_CTRL_SET1_ID
|
||||
case EVP_PKEY_CTRL_SET1_ID:
|
||||
{
|
||||
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
|
||||
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"error: setting distinguishing ID in certificate signing request failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_REQ_set0_distinguishing_id(object, v);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -2; /* typical EVP_PKEY return for "unsupported" */
|
||||
}
|
||||
|
||||
static int do_x509_ctrl_string(int (*ctrl)(void *object, int cmd,
|
||||
void *value, size_t value_n),
|
||||
void *object, const char *value)
|
||||
{
|
||||
int rv = 0;
|
||||
char *stmp, *vtmp = NULL;
|
||||
size_t vtmp_len = 0;
|
||||
int cmd = 0; /* Will get command values that make sense somehow */
|
||||
|
||||
stmp = OPENSSL_strdup(value);
|
||||
if (stmp == NULL)
|
||||
return -1;
|
||||
vtmp = strchr(stmp, ':');
|
||||
if (vtmp != NULL) {
|
||||
*vtmp = 0;
|
||||
vtmp++;
|
||||
vtmp_len = strlen(vtmp);
|
||||
}
|
||||
|
||||
if (strcmp(stmp, "distid") == 0) {
|
||||
#ifdef EVP_PKEY_CTRL_SET1_ID
|
||||
cmd = EVP_PKEY_CTRL_SET1_ID; /* ... except we put it in X509 */
|
||||
#endif
|
||||
} else if (strcmp(stmp, "hexdistid") == 0) {
|
||||
if (vtmp != NULL) {
|
||||
void *hexid;
|
||||
long hexid_len = 0;
|
||||
|
||||
hexid = OPENSSL_hexstr2buf((const char *)vtmp, &hexid_len);
|
||||
OPENSSL_free(stmp);
|
||||
stmp = vtmp = hexid;
|
||||
vtmp_len = (size_t)hexid_len;
|
||||
}
|
||||
#ifdef EVP_PKEY_CTRL_SET1_ID
|
||||
cmd = EVP_PKEY_CTRL_SET1_ID; /* ... except we put it in X509 */
|
||||
#endif
|
||||
}
|
||||
|
||||
rv = ctrl(object, cmd, vtmp, vtmp_len);
|
||||
|
||||
OPENSSL_free(stmp);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int x509_ctrl_string(X509 *x, const char *value)
|
||||
{
|
||||
return do_x509_ctrl_string(x509_ctrl, x, value);
|
||||
}
|
||||
|
||||
int x509_req_ctrl_string(X509_REQ *x, const char *value)
|
||||
{
|
||||
return do_x509_ctrl_string(x509_req_ctrl, x, value);
|
||||
}
|
||||
+292
-436
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/store.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/ui.h>
|
||||
#include <openssl/safestack.h>
|
||||
@@ -57,6 +58,17 @@ static int WIN32_rename(const char *from, const char *to);
|
||||
|
||||
#define PASS_SOURCE_SIZE_MAX 4
|
||||
|
||||
DEFINE_STACK_OF(CONF)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509_INFO)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF(X509_POLICY_NODE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(DIST_POINT)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned long flag;
|
||||
@@ -198,6 +210,24 @@ int wrap_password_callback(char *buf, int bufsiz, int verify, void *userdata)
|
||||
|
||||
static char *app_get_pass(const char *arg, int keepbio);
|
||||
|
||||
char *get_passwd(const char *pass, const char *desc)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
if (desc == NULL)
|
||||
desc = "<unknown>";
|
||||
if (!app_passwd(pass, NULL, &result, NULL))
|
||||
BIO_printf(bio_err, "Error getting password for %s\n", desc);
|
||||
if (pass != NULL && result == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Trying plain input string (better precede with 'pass:')\n");
|
||||
result = OPENSSL_strdup(pass);
|
||||
if (result == NULL)
|
||||
BIO_printf(bio_err, "Out of memory getting password for %s\n", desc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int app_passwd(const char *arg1, const char *arg2, char **pass1, char **pass2)
|
||||
{
|
||||
int same = arg1 != NULL && arg2 != NULL && strcmp(arg1, arg2) == 0;
|
||||
@@ -401,276 +431,158 @@ int add_oid_section(CONF *conf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int load_pkcs12(BIO *in, const char *desc,
|
||||
pem_password_cb *pem_cb, PW_CB_DATA *cb_data,
|
||||
EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca)
|
||||
X509 *load_cert_pass(const char *uri, int maybe_stdin,
|
||||
const char *pass, const char *desc)
|
||||
{
|
||||
const char *pass;
|
||||
char tpass[PEM_BUFSIZE];
|
||||
int len, ret = 0;
|
||||
PKCS12 *p12;
|
||||
p12 = d2i_PKCS12_bio(in, NULL);
|
||||
if (p12 == NULL) {
|
||||
BIO_printf(bio_err, "Error loading PKCS12 file for %s\n", desc);
|
||||
goto die;
|
||||
}
|
||||
/* See if an empty password will do */
|
||||
if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0)) {
|
||||
pass = "";
|
||||
} else {
|
||||
if (pem_cb == NULL)
|
||||
pem_cb = (pem_password_cb *)password_callback;
|
||||
len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
|
||||
if (len < 0) {
|
||||
BIO_printf(bio_err, "Passphrase callback error for %s\n", desc);
|
||||
goto die;
|
||||
}
|
||||
if (len < PEM_BUFSIZE)
|
||||
tpass[len] = 0;
|
||||
if (!PKCS12_verify_mac(p12, tpass, len)) {
|
||||
BIO_printf(bio_err,
|
||||
"Mac verify error (wrong password?) in PKCS12 file for %s\n",
|
||||
desc);
|
||||
goto die;
|
||||
}
|
||||
pass = tpass;
|
||||
}
|
||||
ret = PKCS12_parse(p12, pass, pkey, cert, ca);
|
||||
die:
|
||||
PKCS12_free(p12);
|
||||
return ret;
|
||||
}
|
||||
X509 *cert = NULL;
|
||||
|
||||
X509 *load_cert(const char *file, int format, const char *cert_descrip)
|
||||
{
|
||||
X509 *x = NULL;
|
||||
BIO *cert;
|
||||
|
||||
if (format == FORMAT_HTTP) {
|
||||
#if !defined(OPENSSL_NO_SOCK)
|
||||
x = X509_load_http(file, NULL, NULL, 0 /* timeout */);
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
if (file == NULL) {
|
||||
unbuffer(stdin);
|
||||
cert = dup_bio_in(format);
|
||||
} else {
|
||||
cert = bio_open_default(file, 'r', format);
|
||||
}
|
||||
if (cert == NULL)
|
||||
goto end;
|
||||
|
||||
if (format == FORMAT_ASN1) {
|
||||
x = d2i_X509_bio(cert, NULL);
|
||||
} else if (format == FORMAT_PEM) {
|
||||
x = PEM_read_bio_X509_AUX(cert, NULL,
|
||||
(pem_password_cb *)password_callback, NULL);
|
||||
} else if (format == FORMAT_PKCS12) {
|
||||
if (!load_pkcs12(cert, cert_descrip, NULL, NULL, NULL, &x, NULL))
|
||||
goto end;
|
||||
} else {
|
||||
BIO_printf(bio_err, "bad input format specified for %s\n", cert_descrip);
|
||||
goto end;
|
||||
}
|
||||
end:
|
||||
if (x == NULL) {
|
||||
BIO_printf(bio_err, "unable to load certificate\n");
|
||||
if (desc == NULL)
|
||||
desc = "certificate";
|
||||
(void)load_key_cert_crl(uri, maybe_stdin, pass, desc, NULL, &cert, NULL);
|
||||
if (cert == NULL) {
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
BIO_free(cert);
|
||||
return x;
|
||||
return cert;
|
||||
}
|
||||
|
||||
X509_CRL *load_crl(const char *infile, int format)
|
||||
/* the format parameter is meanwhile not needed anymore and thus ignored */
|
||||
X509 *load_cert(const char *uri, int format, const char *desc)
|
||||
{
|
||||
X509_CRL *x = NULL;
|
||||
BIO *in = NULL;
|
||||
return load_cert_pass(uri, 1, NULL, desc);
|
||||
}
|
||||
|
||||
if (format == FORMAT_HTTP) {
|
||||
#if !defined(OPENSSL_NO_SOCK)
|
||||
x = X509_CRL_load_http(infile, NULL, NULL, 0 /* timeout */);
|
||||
#endif
|
||||
return x;
|
||||
/* the format parameter is meanwhile not needed anymore and thus ignored */
|
||||
X509_CRL *load_crl(const char *uri, int format, const char *desc)
|
||||
{
|
||||
X509_CRL *crl = NULL;
|
||||
|
||||
if (desc == NULL)
|
||||
desc = "CRL";
|
||||
(void)load_key_cert_crl(uri, 0, NULL, desc, NULL, NULL, &crl);
|
||||
if (crl == NULL) {
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
return crl;
|
||||
}
|
||||
|
||||
in = bio_open_default(infile, 'r', format);
|
||||
X509_REQ *load_csr(const char *file, int format, const char *desc)
|
||||
{
|
||||
X509_REQ *req = NULL;
|
||||
BIO *in;
|
||||
|
||||
if (desc == NULL)
|
||||
desc = "CSR";
|
||||
in = bio_open_default(file, 'r', format);
|
||||
if (in == NULL)
|
||||
goto end;
|
||||
if (format == FORMAT_ASN1) {
|
||||
x = d2i_X509_CRL_bio(in, NULL);
|
||||
} else if (format == FORMAT_PEM) {
|
||||
x = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
|
||||
} else {
|
||||
BIO_printf(bio_err, "bad input format specified for input crl\n");
|
||||
goto end;
|
||||
}
|
||||
if (x == NULL) {
|
||||
BIO_printf(bio_err, "unable to load CRL\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (format == FORMAT_ASN1)
|
||||
req = d2i_X509_REQ_bio(in, NULL);
|
||||
else if (format == FORMAT_PEM)
|
||||
req = PEM_read_bio_X509_REQ(in, NULL, NULL, NULL);
|
||||
else
|
||||
print_format_error(format, OPT_FMT_PEMDER);
|
||||
|
||||
end:
|
||||
if (req == NULL) {
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
BIO_free(in);
|
||||
return x;
|
||||
return req;
|
||||
}
|
||||
|
||||
EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *key_descrip)
|
||||
void cleanse(char *str)
|
||||
{
|
||||
if (str != NULL)
|
||||
OPENSSL_cleanse(str, strlen(str));
|
||||
}
|
||||
|
||||
void clear_free(char *str)
|
||||
{
|
||||
if (str != NULL)
|
||||
OPENSSL_clear_free(str, strlen(str));
|
||||
}
|
||||
|
||||
EVP_PKEY *load_key(const char *uri, int format, int may_stdin,
|
||||
const char *pass, ENGINE *e, const char *desc)
|
||||
{
|
||||
BIO *key = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
PW_CB_DATA cb_data;
|
||||
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = file;
|
||||
if (desc == NULL)
|
||||
desc = "private key";
|
||||
|
||||
if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE)) {
|
||||
BIO_printf(bio_err, "no keyfile specified\n");
|
||||
goto end;
|
||||
}
|
||||
if (format == FORMAT_ENGINE) {
|
||||
if (e == NULL) {
|
||||
BIO_printf(bio_err, "no engine specified\n");
|
||||
BIO_printf(bio_err, "No engine specified for loading %s\n", desc);
|
||||
} else {
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
PW_CB_DATA cb_data;
|
||||
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = uri;
|
||||
if (ENGINE_init(e)) {
|
||||
pkey = ENGINE_load_private_key(e, file,
|
||||
pkey = ENGINE_load_private_key(e, uri,
|
||||
(UI_METHOD *)get_ui_method(),
|
||||
&cb_data);
|
||||
ENGINE_finish(e);
|
||||
}
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "cannot load %s from engine\n", key_descrip);
|
||||
BIO_printf(bio_err, "Cannot load %s from engine\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
#else
|
||||
BIO_printf(bio_err, "engines not supported\n");
|
||||
BIO_printf(bio_err, "Engines not supported for loading %s\n", desc);
|
||||
#endif
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
if (file == NULL && maybe_stdin) {
|
||||
unbuffer(stdin);
|
||||
key = dup_bio_in(format);
|
||||
} else {
|
||||
key = bio_open_default(file, 'r', format);
|
||||
(void)load_key_cert_crl(uri, may_stdin, pass, desc, &pkey, NULL, NULL);
|
||||
}
|
||||
if (key == NULL)
|
||||
goto end;
|
||||
if (format == FORMAT_ASN1) {
|
||||
pkey = d2i_PrivateKey_bio(key, NULL);
|
||||
} else if (format == FORMAT_PEM) {
|
||||
pkey = PEM_read_bio_PrivateKey(key, NULL, wrap_password_callback, &cb_data);
|
||||
} else if (format == FORMAT_PKCS12) {
|
||||
if (!load_pkcs12(key, key_descrip, wrap_password_callback, &cb_data,
|
||||
&pkey, NULL, NULL))
|
||||
goto end;
|
||||
#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) && !defined (OPENSSL_NO_RC4)
|
||||
} else if (format == FORMAT_MSBLOB) {
|
||||
pkey = b2i_PrivateKey_bio(key);
|
||||
} else if (format == FORMAT_PVK) {
|
||||
pkey = b2i_PVK_bio(key, wrap_password_callback, &cb_data);
|
||||
#endif
|
||||
} else {
|
||||
BIO_printf(bio_err, "bad input format specified for key file\n");
|
||||
goto end;
|
||||
}
|
||||
end:
|
||||
BIO_free(key);
|
||||
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "unable to load %s\n", key_descrip);
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
return pkey;
|
||||
}
|
||||
|
||||
EVP_PKEY *load_pubkey(const char *file, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *key_descrip)
|
||||
EVP_PKEY *load_pubkey(const char *uri, int format, int maybe_stdin,
|
||||
const char *pass, ENGINE *e, const char *desc)
|
||||
{
|
||||
BIO *key = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
PW_CB_DATA cb_data;
|
||||
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = file;
|
||||
if (desc == NULL)
|
||||
desc = "public key";
|
||||
|
||||
if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE)) {
|
||||
BIO_printf(bio_err, "no keyfile specified\n");
|
||||
goto end;
|
||||
}
|
||||
if (format == FORMAT_ENGINE) {
|
||||
if (e == NULL) {
|
||||
BIO_printf(bio_err, "no engine specified\n");
|
||||
BIO_printf(bio_err, "No engine specified for loading %s\n", desc);
|
||||
} else {
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
pkey = ENGINE_load_public_key(e, file, (UI_METHOD *)get_ui_method(),
|
||||
PW_CB_DATA cb_data;
|
||||
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = uri;
|
||||
pkey = ENGINE_load_public_key(e, uri, (UI_METHOD *)get_ui_method(),
|
||||
&cb_data);
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "cannot load %s from engine\n", key_descrip);
|
||||
BIO_printf(bio_err, "Cannot load %s from engine\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
#else
|
||||
BIO_printf(bio_err, "engines not supported\n");
|
||||
BIO_printf(bio_err, "Engines not supported for loading %s\n", desc);
|
||||
#endif
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
if (file == NULL && maybe_stdin) {
|
||||
unbuffer(stdin);
|
||||
key = dup_bio_in(format);
|
||||
} else {
|
||||
key = bio_open_default(file, 'r', format);
|
||||
(void)load_key_cert_crl(uri, maybe_stdin, pass, desc, &pkey,
|
||||
NULL, NULL);
|
||||
}
|
||||
if (key == NULL)
|
||||
goto end;
|
||||
if (format == FORMAT_ASN1) {
|
||||
pkey = d2i_PUBKEY_bio(key, NULL);
|
||||
} else if (format == FORMAT_ASN1RSA) {
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
RSA *rsa;
|
||||
rsa = d2i_RSAPublicKey_bio(key, NULL);
|
||||
if (rsa) {
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey != NULL)
|
||||
EVP_PKEY_set1_RSA(pkey, rsa);
|
||||
RSA_free(rsa);
|
||||
} else
|
||||
#else
|
||||
BIO_printf(bio_err, "RSA keys not supported\n");
|
||||
#endif
|
||||
pkey = NULL;
|
||||
} else if (format == FORMAT_PEMRSA) {
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
RSA *rsa;
|
||||
rsa = PEM_read_bio_RSAPublicKey(key, NULL,
|
||||
(pem_password_cb *)password_callback,
|
||||
&cb_data);
|
||||
if (rsa != NULL) {
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey != NULL)
|
||||
EVP_PKEY_set1_RSA(pkey, rsa);
|
||||
RSA_free(rsa);
|
||||
} else
|
||||
#else
|
||||
BIO_printf(bio_err, "RSA keys not supported\n");
|
||||
#endif
|
||||
pkey = NULL;
|
||||
} else if (format == FORMAT_PEM) {
|
||||
pkey = PEM_read_bio_PUBKEY(key, NULL,
|
||||
(pem_password_cb *)password_callback,
|
||||
&cb_data);
|
||||
#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA)
|
||||
} else if (format == FORMAT_MSBLOB) {
|
||||
pkey = b2i_PublicKey_bio(key);
|
||||
#endif
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc);
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
end:
|
||||
BIO_free(key);
|
||||
if (pkey == NULL)
|
||||
BIO_printf(bio_err, "unable to load %s\n", key_descrip);
|
||||
return pkey;
|
||||
}
|
||||
|
||||
@@ -690,7 +602,7 @@ static int load_certs_crls(const char *file, int format,
|
||||
cb_data.prompt_info = file;
|
||||
|
||||
if (format != FORMAT_PEM) {
|
||||
BIO_printf(bio_err, "bad input format specified for %s\n", desc);
|
||||
BIO_printf(bio_err, "Bad input format specified for %s\n", desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -749,23 +661,30 @@ static int load_certs_crls(const char *file, int format,
|
||||
sk_X509_CRL_pop_free(*pcrls, X509_CRL_free);
|
||||
*pcrls = NULL;
|
||||
}
|
||||
BIO_printf(bio_err, "unable to load %s\n",
|
||||
pcerts ? "certificates" : "CRLs");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "Unable to load %s\n", desc != NULL ? desc :
|
||||
pcerts != NULL ? "certificates" : "CRLs");
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void app_bail_out(char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
BIO_vprintf(bio_err, fmt, args);
|
||||
va_end(args);
|
||||
ERR_print_errors(bio_err);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void* app_malloc(int sz, const char *what)
|
||||
{
|
||||
void *vp = OPENSSL_malloc(sz);
|
||||
|
||||
if (vp == NULL) {
|
||||
BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n",
|
||||
opt_getprog(), sz, what);
|
||||
ERR_print_errors(bio_err);
|
||||
exit(1);
|
||||
}
|
||||
if (vp == NULL)
|
||||
app_bail_out("%s: Could not allocate %d bytes for %s\n",
|
||||
opt_getprog(), sz, what);
|
||||
return vp;
|
||||
}
|
||||
|
||||
@@ -787,6 +706,102 @@ int load_crls(const char *file, STACK_OF(X509_CRL) **crls, int format,
|
||||
return load_certs_crls(file, format, pass, desc, NULL, crls);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load those types of credentials for which the result pointer is not NULL.
|
||||
* Reads from stdio if uri is NULL and maybe_stdin is nonzero.
|
||||
* For each type the first credential found in the store is loaded.
|
||||
* May yield partial result even if rv == 0.
|
||||
*/
|
||||
int load_key_cert_crl(const char *uri, int maybe_stdin,
|
||||
const char *pass, const char *desc,
|
||||
EVP_PKEY **ppkey, X509 **pcert, X509_CRL **pcrl)
|
||||
{
|
||||
PW_CB_DATA uidata;
|
||||
OSSL_STORE_CTX *ctx = NULL;
|
||||
int ret = 0;
|
||||
/* TODO make use of the engine reference 'eng' when loading pkeys */
|
||||
|
||||
if (ppkey != NULL)
|
||||
*ppkey = NULL;
|
||||
if (pcert != NULL)
|
||||
*pcert = NULL;
|
||||
if (pcrl != NULL)
|
||||
*pcrl = NULL;
|
||||
|
||||
if (desc == NULL)
|
||||
desc = "key/certificate/CRL";
|
||||
uidata.password = pass;
|
||||
uidata.prompt_info = uri;
|
||||
|
||||
if (uri == NULL) {
|
||||
BIO *bio;
|
||||
|
||||
if (!maybe_stdin) {
|
||||
BIO_printf(bio_err, "No filename or uri specified for loading %s\n",
|
||||
desc);
|
||||
goto end;
|
||||
}
|
||||
unbuffer(stdin);
|
||||
bio = BIO_new_fp(stdin, 0);
|
||||
if (bio != NULL)
|
||||
ctx = OSSL_STORE_attach(bio, NULL, "file", NULL,
|
||||
get_ui_method(), &uidata, NULL, NULL);
|
||||
uri = "<stdin>";
|
||||
} else {
|
||||
ctx = OSSL_STORE_open(uri, get_ui_method(), &uidata, NULL, NULL);
|
||||
}
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err, "Could not open file or uri %s for loading %s\n",
|
||||
uri, desc);
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);
|
||||
int type = info == NULL ? 0 : OSSL_STORE_INFO_get_type(info);
|
||||
const char *infostr =
|
||||
info == NULL ? NULL : OSSL_STORE_INFO_type_string(type);
|
||||
int err = 0;
|
||||
|
||||
if (info == NULL) {
|
||||
if (OSSL_STORE_eof(ctx))
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case OSSL_STORE_INFO_PKEY:
|
||||
if (ppkey != NULL && *ppkey == NULL)
|
||||
err = ((*ppkey = OSSL_STORE_INFO_get1_PKEY(info)) == NULL);
|
||||
break;
|
||||
case OSSL_STORE_INFO_CERT:
|
||||
if (pcert != NULL && *pcert == NULL)
|
||||
err = ((*pcert = OSSL_STORE_INFO_get1_CERT(info)) == NULL);
|
||||
break;
|
||||
case OSSL_STORE_INFO_CRL:
|
||||
if (pcrl != NULL && *pcrl == NULL)
|
||||
err = ((*pcrl = OSSL_STORE_INFO_get1_CRL(info)) == NULL);
|
||||
break;
|
||||
default:
|
||||
/* skip any other type */
|
||||
break;
|
||||
}
|
||||
OSSL_STORE_INFO_free(info);
|
||||
if (err) {
|
||||
BIO_printf(bio_err, "Could not read %s of %s from %s\n",
|
||||
infostr, desc, uri);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
OSSL_STORE_close(ctx);
|
||||
if (!ret)
|
||||
ERR_print_errors(bio_err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
|
||||
/* Return error for unknown extensions */
|
||||
#define X509V3_EXT_DEFAULT 0
|
||||
@@ -968,7 +983,7 @@ static int set_table_opts(unsigned long *flags, const char *arg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_name(BIO *out, const char *title, X509_NAME *nm,
|
||||
void print_name(BIO *out, const char *title, const X509_NAME *nm,
|
||||
unsigned long lflags)
|
||||
{
|
||||
char *buf;
|
||||
@@ -1083,6 +1098,7 @@ X509_STORE *setup_verify(const char *CAfile, int noCAfile,
|
||||
ERR_clear_error();
|
||||
return store;
|
||||
end:
|
||||
ERR_print_errors(bio_err);
|
||||
X509_STORE_free(store);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1103,36 +1119,35 @@ static ENGINE *try_load_engine(const char *engine)
|
||||
}
|
||||
#endif
|
||||
|
||||
ENGINE *setup_engine(const char *engine, int debug)
|
||||
ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (engine != NULL) {
|
||||
if (strcmp(engine, "auto") == 0) {
|
||||
BIO_printf(bio_err, "enabling auto ENGINE support\n");
|
||||
if (id != NULL) {
|
||||
if (strcmp(id, "auto") == 0) {
|
||||
BIO_printf(bio_err, "Enabling auto ENGINE support\n");
|
||||
ENGINE_register_all_complete();
|
||||
return NULL;
|
||||
}
|
||||
if ((e = ENGINE_by_id(engine)) == NULL
|
||||
&& (e = try_load_engine(engine)) == NULL) {
|
||||
BIO_printf(bio_err, "invalid engine \"%s\"\n", engine);
|
||||
if ((e = ENGINE_by_id(id)) == NULL
|
||||
&& (e = try_load_engine(id)) == NULL) {
|
||||
BIO_printf(bio_err, "Invalid engine \"%s\"\n", id);
|
||||
ERR_print_errors(bio_err);
|
||||
return NULL;
|
||||
}
|
||||
if (debug) {
|
||||
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0);
|
||||
}
|
||||
ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, (void *)get_ui_method(),
|
||||
0, 1);
|
||||
if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
|
||||
BIO_printf(bio_err, "can't use that engine\n");
|
||||
if (debug)
|
||||
(void)ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0);
|
||||
if (!ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0,
|
||||
(void *)get_ui_method(), 0, 1)
|
||||
|| !ENGINE_set_default(e, methods)) {
|
||||
BIO_printf(bio_err, "Cannot use engine \"%s\"\n", ENGINE_get_id(e));
|
||||
ERR_print_errors(bio_err);
|
||||
ENGINE_free(e);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "engine \"%s\" set.\n", ENGINE_get_id(e));
|
||||
BIO_printf(bio_err, "Engine \"%s\" set.\n", ENGINE_get_id(e));
|
||||
}
|
||||
#endif
|
||||
return e;
|
||||
@@ -1211,14 +1226,13 @@ BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai)
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
} else {
|
||||
if (!a2i_ASN1_INTEGER(in, ai, buf, 1024)) {
|
||||
BIO_printf(bio_err, "unable to load number from %s\n",
|
||||
BIO_printf(bio_err, "Unable to load number from %s\n",
|
||||
serialfile);
|
||||
goto err;
|
||||
}
|
||||
ret = ASN1_INTEGER_to_BN(ai, NULL);
|
||||
if (ret == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"error converting number from bin to BIGNUM\n");
|
||||
BIO_printf(bio_err, "Error converting number from bin to BIGNUM\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1228,6 +1242,7 @@ BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai)
|
||||
ai = NULL;
|
||||
}
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_free(in);
|
||||
ASN1_INTEGER_free(ai);
|
||||
return ret;
|
||||
@@ -1247,7 +1262,7 @@ int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial
|
||||
else
|
||||
j = strlen(serialfile) + strlen(suffix) + 1;
|
||||
if (j >= BSIZE) {
|
||||
BIO_printf(bio_err, "file name too long\n");
|
||||
BIO_printf(bio_err, "File name too long\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1262,7 +1277,6 @@ int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial
|
||||
}
|
||||
out = BIO_new_file(buf[0], "w");
|
||||
if (out == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1278,6 +1292,8 @@ int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial
|
||||
ai = NULL;
|
||||
}
|
||||
err:
|
||||
if (!ret)
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_free_all(out);
|
||||
ASN1_INTEGER_free(ai);
|
||||
return ret;
|
||||
@@ -1294,7 +1310,7 @@ int rotate_serial(const char *serialfile, const char *new_suffix,
|
||||
if (i > j)
|
||||
j = i;
|
||||
if (j + 1 >= BSIZE) {
|
||||
BIO_printf(bio_err, "file name too long\n");
|
||||
BIO_printf(bio_err, "File name too long\n");
|
||||
goto err;
|
||||
}
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
@@ -1310,19 +1326,20 @@ int rotate_serial(const char *serialfile, const char *new_suffix,
|
||||
#endif
|
||||
) {
|
||||
BIO_printf(bio_err,
|
||||
"unable to rename %s to %s\n", serialfile, buf[1]);
|
||||
"Unable to rename %s to %s\n", serialfile, buf[1]);
|
||||
perror("reason");
|
||||
goto err;
|
||||
}
|
||||
if (rename(buf[0], serialfile) < 0) {
|
||||
BIO_printf(bio_err,
|
||||
"unable to rename %s to %s\n", buf[0], serialfile);
|
||||
"Unable to rename %s to %s\n", buf[0], serialfile);
|
||||
perror("reason");
|
||||
rename(buf[1], serialfile);
|
||||
goto err;
|
||||
}
|
||||
return 1;
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1363,17 +1380,14 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
|
||||
#endif
|
||||
|
||||
in = BIO_new_file(dbfile, "r");
|
||||
if (in == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (in == NULL)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_POSIX_IO
|
||||
BIO_get_fp(in, &dbfp);
|
||||
if (fstat(fileno(dbfp), &dbst) == -1) {
|
||||
ERR_raise_data(ERR_LIB_SYS, errno,
|
||||
"calling fstat(%s)", dbfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
#endif
|
||||
@@ -1410,6 +1424,7 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
|
||||
#endif
|
||||
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
NCONF_free(dbattr_conf);
|
||||
TXT_DB_free(tmpdb);
|
||||
BIO_free_all(in);
|
||||
@@ -1425,20 +1440,23 @@ int index_index(CA_DB *db)
|
||||
LHASH_HASH_FN(index_serial),
|
||||
LHASH_COMP_FN(index_serial))) {
|
||||
BIO_printf(bio_err,
|
||||
"error creating serial number index:(%ld,%ld,%ld)\n",
|
||||
"Error creating serial number index:(%ld,%ld,%ld)\n",
|
||||
db->db->error, db->db->arg1, db->db->arg2);
|
||||
return 0;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (db->attributes.unique_subject
|
||||
&& !TXT_DB_create_index(db->db, DB_name, index_name_qual,
|
||||
LHASH_HASH_FN(index_name),
|
||||
LHASH_COMP_FN(index_name))) {
|
||||
BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\n",
|
||||
BIO_printf(bio_err, "Error creating name index:(%ld,%ld,%ld)\n",
|
||||
db->db->error, db->db->arg1, db->db->arg2);
|
||||
return 0;
|
||||
goto err;
|
||||
}
|
||||
return 1;
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int save_index(const char *dbfile, const char *suffix, CA_DB *db)
|
||||
@@ -1449,7 +1467,7 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
|
||||
|
||||
j = strlen(dbfile) + strlen(suffix);
|
||||
if (j + 6 >= BSIZE) {
|
||||
BIO_printf(bio_err, "file name too long\n");
|
||||
BIO_printf(bio_err, "File name too long\n");
|
||||
goto err;
|
||||
}
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
@@ -1464,7 +1482,7 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
|
||||
out = BIO_new_file(buf[0], "w");
|
||||
if (out == NULL) {
|
||||
perror(dbfile);
|
||||
BIO_printf(bio_err, "unable to open '%s'\n", dbfile);
|
||||
BIO_printf(bio_err, "Unable to open '%s'\n", dbfile);
|
||||
goto err;
|
||||
}
|
||||
j = TXT_DB_write(out, db->db);
|
||||
@@ -1475,7 +1493,7 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
|
||||
out = BIO_new_file(buf[1], "w");
|
||||
if (out == NULL) {
|
||||
perror(buf[2]);
|
||||
BIO_printf(bio_err, "unable to open '%s'\n", buf[2]);
|
||||
BIO_printf(bio_err, "Unable to open '%s'\n", buf[2]);
|
||||
goto err;
|
||||
}
|
||||
BIO_printf(out, "unique_subject = %s\n",
|
||||
@@ -1484,6 +1502,7 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
|
||||
|
||||
return 1;
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1498,7 +1517,7 @@ int rotate_index(const char *dbfile, const char *new_suffix,
|
||||
if (i > j)
|
||||
j = i;
|
||||
if (j + 6 >= BSIZE) {
|
||||
BIO_printf(bio_err, "file name too long\n");
|
||||
BIO_printf(bio_err, "File name too long\n");
|
||||
goto err;
|
||||
}
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
@@ -1519,12 +1538,12 @@ int rotate_index(const char *dbfile, const char *new_suffix,
|
||||
&& errno != ENOTDIR
|
||||
#endif
|
||||
) {
|
||||
BIO_printf(bio_err, "unable to rename %s to %s\n", dbfile, buf[1]);
|
||||
BIO_printf(bio_err, "Unable to rename %s to %s\n", dbfile, buf[1]);
|
||||
perror("reason");
|
||||
goto err;
|
||||
}
|
||||
if (rename(buf[0], dbfile) < 0) {
|
||||
BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], dbfile);
|
||||
BIO_printf(bio_err, "Unable to rename %s to %s\n", buf[0], dbfile);
|
||||
perror("reason");
|
||||
rename(buf[1], dbfile);
|
||||
goto err;
|
||||
@@ -1534,14 +1553,14 @@ int rotate_index(const char *dbfile, const char *new_suffix,
|
||||
&& errno != ENOTDIR
|
||||
#endif
|
||||
) {
|
||||
BIO_printf(bio_err, "unable to rename %s to %s\n", buf[4], buf[3]);
|
||||
BIO_printf(bio_err, "Unable to rename %s to %s\n", buf[4], buf[3]);
|
||||
perror("reason");
|
||||
rename(dbfile, buf[0]);
|
||||
rename(buf[1], dbfile);
|
||||
goto err;
|
||||
}
|
||||
if (rename(buf[2], buf[4]) < 0) {
|
||||
BIO_printf(bio_err, "unable to rename %s to %s\n", buf[2], buf[4]);
|
||||
BIO_printf(bio_err, "Unable to rename %s to %s\n", buf[2], buf[4]);
|
||||
perror("reason");
|
||||
rename(buf[3], buf[4]);
|
||||
rename(dbfile, buf[0]);
|
||||
@@ -1550,6 +1569,7 @@ int rotate_index(const char *dbfile, const char *new_suffix,
|
||||
}
|
||||
return 1;
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1611,7 +1631,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
|
||||
goto err;
|
||||
}
|
||||
|
||||
while (*cp) {
|
||||
while (*cp != '\0') {
|
||||
char *bp = work;
|
||||
char *typestr = bp;
|
||||
unsigned char *valstr;
|
||||
@@ -1620,12 +1640,12 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
|
||||
nextismulti = 0;
|
||||
|
||||
/* Collect the type */
|
||||
while (*cp && *cp != '=')
|
||||
while (*cp != '\0' && *cp != '=')
|
||||
*bp++ = *cp++;
|
||||
if (*cp == '\0') {
|
||||
BIO_printf(bio_err,
|
||||
"%s: Hit end of string before finding the '='\n",
|
||||
opt_getprog());
|
||||
"%s: Hit end of string before finding the '='\n",
|
||||
opt_getprog());
|
||||
goto err;
|
||||
}
|
||||
*bp++ = '\0';
|
||||
@@ -1633,14 +1653,14 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
|
||||
|
||||
/* Collect the value. */
|
||||
valstr = (unsigned char *)bp;
|
||||
for (; *cp && *cp != '/'; *bp++ = *cp++) {
|
||||
for (; *cp != '\0' && *cp != '/'; *bp++ = *cp++) {
|
||||
if (canmulti && *cp == '+') {
|
||||
nextismulti = 1;
|
||||
break;
|
||||
}
|
||||
if (*cp == '\\' && *++cp == '\0') {
|
||||
BIO_printf(bio_err,
|
||||
"%s: escape character at end of string\n",
|
||||
"%s: Escape character at end of string\n",
|
||||
opt_getprog());
|
||||
goto err;
|
||||
}
|
||||
@@ -1648,7 +1668,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
|
||||
*bp++ = '\0';
|
||||
|
||||
/* If not at EOS (must be + or /), move forward. */
|
||||
if (*cp)
|
||||
if (*cp != '\0')
|
||||
++cp;
|
||||
|
||||
/* Parse */
|
||||
@@ -1667,6 +1687,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
|
||||
if (!X509_NAME_add_entry_by_NID(n, nid, chtype,
|
||||
valstr, strlen((char *)valstr),
|
||||
-1, ismulti ? -1 : 0)) {
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_printf(bio_err, "%s: Error adding name attribute \"/%s=%s\"\n",
|
||||
opt_getprog(), typestr ,valstr);
|
||||
goto err;
|
||||
@@ -1889,18 +1910,18 @@ static X509_CRL *load_crl_crldp(STACK_OF(DIST_POINT) *crldp)
|
||||
DIST_POINT *dp = sk_DIST_POINT_value(crldp, i);
|
||||
urlptr = get_dp_url(dp);
|
||||
if (urlptr)
|
||||
return load_crl(urlptr, FORMAT_HTTP);
|
||||
return load_crl(urlptr, FORMAT_HTTP, "CRL via CDP");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Example of downloading CRLs from CRLDP: not usable for real world as it
|
||||
* always downloads, doesn't support non-blocking I/O and doesn't cache
|
||||
* anything.
|
||||
* Example of downloading CRLs from CRLDP:
|
||||
* not usable for real world as it always downloads and doesn't cache anything.
|
||||
*/
|
||||
|
||||
static STACK_OF(X509_CRL) *crls_http_cb(X509_STORE_CTX *ctx, X509_NAME *nm)
|
||||
static STACK_OF(X509_CRL) *crls_http_cb(const X509_STORE_CTX *ctx,
|
||||
const X509_NAME *nm)
|
||||
{
|
||||
X509 *x;
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
@@ -1933,137 +1954,6 @@ void store_setup_crl_download(X509_STORE *st)
|
||||
X509_STORE_set_lookup_crls_cb(st, crls_http_cb);
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
static const char *tls_error_hint(void)
|
||||
{
|
||||
unsigned long err = ERR_peek_error();
|
||||
|
||||
if (ERR_GET_LIB(err) != ERR_LIB_SSL)
|
||||
err = ERR_peek_last_error();
|
||||
if (ERR_GET_LIB(err) != ERR_LIB_SSL)
|
||||
return NULL;
|
||||
|
||||
switch (ERR_GET_REASON(err)) {
|
||||
case SSL_R_WRONG_VERSION_NUMBER:
|
||||
return "The server does not support (a suitable version of) TLS";
|
||||
case SSL_R_UNKNOWN_PROTOCOL:
|
||||
return "The server does not support HTTPS";
|
||||
case SSL_R_CERTIFICATE_VERIFY_FAILED:
|
||||
return "Cannot authenticate server via its TLS certificate, likely due to mismatch with our trusted TLS certs or missing revocation status";
|
||||
case SSL_AD_REASON_OFFSET + TLS1_AD_UNKNOWN_CA:
|
||||
return "Server did not accept our TLS certificate, likely due to mismatch with server's trust anchor or missing revocation status";
|
||||
case SSL_AD_REASON_OFFSET + SSL3_AD_HANDSHAKE_FAILURE:
|
||||
return "TLS handshake failure. Possibly the server requires our TLS certificate but did not receive it";
|
||||
default: /* no error or no hint available for error */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* HTTP callback function that supports TLS connection also via HTTPS proxy */
|
||||
BIO *app_http_tls_cb(BIO *hbio, void *arg, int connect, int detail)
|
||||
{
|
||||
APP_HTTP_TLS_INFO *info = (APP_HTTP_TLS_INFO *)arg;
|
||||
SSL_CTX *ssl_ctx = info->ssl_ctx;
|
||||
SSL *ssl;
|
||||
BIO *sbio = NULL;
|
||||
|
||||
if (connect && detail) { /* connecting with TLS */
|
||||
if ((info->use_proxy
|
||||
&& !OSSL_HTTP_proxy_connect(hbio, info->server, info->port,
|
||||
NULL, NULL, /* no proxy credentials */
|
||||
info->timeout, bio_err, opt_getprog()))
|
||||
|| (sbio = BIO_new(BIO_f_ssl())) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (ssl_ctx == NULL || (ssl = SSL_new(ssl_ctx)) == NULL) {
|
||||
BIO_free(sbio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SSL_set_tlsext_host_name(ssl, info->server);
|
||||
|
||||
SSL_set_connect_state(ssl);
|
||||
BIO_set_ssl(sbio, ssl, BIO_CLOSE);
|
||||
|
||||
hbio = BIO_push(sbio, hbio);
|
||||
} else if (!connect && !detail) { /* disconnecting after error */
|
||||
const char *hint = tls_error_hint();
|
||||
if (hint != NULL)
|
||||
ERR_add_error_data(1, hint);
|
||||
/*
|
||||
* If we pop sbio and BIO_free() it this may lead to libssl double free.
|
||||
* Rely on BIO_free_all() done by OSSL_HTTP_transfer() in http_client.c
|
||||
*/
|
||||
}
|
||||
return hbio;
|
||||
}
|
||||
|
||||
ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
|
||||
const char *proxy_port, SSL_CTX *ssl_ctx,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
long timeout, const char *expected_content_type,
|
||||
const ASN1_ITEM *it)
|
||||
{
|
||||
APP_HTTP_TLS_INFO info;
|
||||
char *server;
|
||||
char *port;
|
||||
int use_ssl;
|
||||
ASN1_VALUE *resp = NULL;
|
||||
|
||||
if (url == NULL || it == NULL) {
|
||||
HTTPerr(0, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!OSSL_HTTP_parse_url(url, &server, &port, NULL /* ppath */, &use_ssl))
|
||||
return NULL;
|
||||
if (use_ssl && ssl_ctx == NULL) {
|
||||
HTTPerr(0, ERR_R_PASSED_NULL_PARAMETER);
|
||||
ERR_add_error_data(1, "missing SSL_CTX");
|
||||
goto end;
|
||||
}
|
||||
|
||||
info.server = server;
|
||||
info.port = port;
|
||||
info.use_proxy = proxy != NULL;
|
||||
info.timeout = timeout;
|
||||
info.ssl_ctx = ssl_ctx;
|
||||
resp = OSSL_HTTP_get_asn1(url, proxy, proxy_port,
|
||||
NULL, NULL, app_http_tls_cb, &info,
|
||||
headers, 0 /* maxline */, 0 /* max_resp_len */,
|
||||
timeout, expected_content_type, it);
|
||||
end:
|
||||
OPENSSL_free(server);
|
||||
OPENSSL_free(port);
|
||||
return resp;
|
||||
|
||||
}
|
||||
|
||||
ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
|
||||
const char *path, const char *proxy,
|
||||
const char *proxy_port, SSL_CTX *ssl_ctx,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
const char *content_type,
|
||||
ASN1_VALUE *req, const ASN1_ITEM *req_it,
|
||||
long timeout, const ASN1_ITEM *rsp_it)
|
||||
{
|
||||
APP_HTTP_TLS_INFO info;
|
||||
|
||||
info.server = host;
|
||||
info.port = port;
|
||||
info.use_proxy = proxy != NULL;
|
||||
info.timeout = timeout;
|
||||
info.ssl_ctx = ssl_ctx;
|
||||
return OSSL_HTTP_post_asn1(host, port, path, ssl_ctx != NULL,
|
||||
proxy, proxy_port,
|
||||
NULL, NULL, app_http_tls_cb, &info,
|
||||
headers, content_type, req, req_it,
|
||||
0 /* maxline */,
|
||||
0 /* max_resp_len */, timeout, NULL, rsp_it);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Platform-specific sections
|
||||
*/
|
||||
@@ -2214,40 +2104,6 @@ double app_tminterval(int stop, int usertime)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#elif defined(OPENSSL_SYSTEM_VMS)
|
||||
# include <time.h>
|
||||
# include <times.h>
|
||||
|
||||
double app_tminterval(int stop, int usertime)
|
||||
{
|
||||
static clock_t tmstart;
|
||||
double ret = 0;
|
||||
clock_t now;
|
||||
# ifdef __TMS
|
||||
struct tms rus;
|
||||
|
||||
now = times(&rus);
|
||||
if (usertime)
|
||||
now = rus.tms_utime;
|
||||
# else
|
||||
if (usertime)
|
||||
now = clock(); /* sum of user and kernel times */
|
||||
else {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
now = (clock_t)((unsigned long long)tv.tv_sec * CLK_TCK +
|
||||
(unsigned long long)tv.tv_usec * (1000000 / CLK_TCK)
|
||||
);
|
||||
}
|
||||
# endif
|
||||
if (stop == TM_START)
|
||||
tmstart = now;
|
||||
else
|
||||
ret = (now - tmstart) / (double)(CLK_TCK);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#elif defined(_SC_CLK_TCK) /* by means of unistd.h */
|
||||
# include <sys/times.h>
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ ENDIF
|
||||
|
||||
# Source for libapps
|
||||
$LIBAPPSSRC=apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c \
|
||||
columns.c app_params.c names.c app_provider.c
|
||||
columns.c app_params.c names.c app_provider.c app_x509.c http_server.c
|
||||
|
||||
IF[{- !$disabled{apps} -}]
|
||||
LIBS{noinst}=../libapps.a
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
* Copyright 1995-2020 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* Very basic HTTP server */
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
|
||||
/*
|
||||
* On VMS, you need to define this to get the declaration of fileno(). The
|
||||
* value 2 is to make sure no function defined in POSIX-2 is left undefined.
|
||||
*/
|
||||
# define _POSIX_C_SOURCE 2
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "http_server.h"
|
||||
#include "internal/sockets.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
int multi = 0; /* run multiple responder processes */
|
||||
|
||||
#ifdef HTTP_DAEMON
|
||||
int acfd = (int) INVALID_SOCKET;
|
||||
#endif
|
||||
|
||||
#ifdef HTTP_DAEMON
|
||||
static int print_syslog(const char *str, size_t len, void *levPtr)
|
||||
{
|
||||
int level = *(int *)levPtr;
|
||||
int ilen = len > MAXERRLEN ? MAXERRLEN : len;
|
||||
|
||||
syslog(level, "%.*s", ilen, str);
|
||||
|
||||
return ilen;
|
||||
}
|
||||
#endif
|
||||
|
||||
void log_message(const char *prog, int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
#ifdef HTTP_DAEMON
|
||||
if (multi) {
|
||||
char buf[1024];
|
||||
|
||||
if (vsnprintf(buf, sizeof(buf), fmt, ap) > 0)
|
||||
syslog(level, "%s", buf);
|
||||
if (level >= LOG_ERR)
|
||||
ERR_print_errors_cb(print_syslog, &level);
|
||||
}
|
||||
#endif
|
||||
if (!multi) {
|
||||
BIO_printf(bio_err, "%s: ", prog);
|
||||
BIO_vprintf(bio_err, fmt, ap);
|
||||
BIO_printf(bio_err, "\n");
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifdef HTTP_DAEMON
|
||||
void socket_timeout(int signum)
|
||||
{
|
||||
if (acfd != (int)INVALID_SOCKET)
|
||||
(void)shutdown(acfd, SHUT_RD);
|
||||
}
|
||||
|
||||
static void killall(int ret, pid_t *kidpids)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < multi; ++i)
|
||||
if (kidpids[i] != 0)
|
||||
(void)kill(kidpids[i], SIGTERM);
|
||||
OPENSSL_free(kidpids);
|
||||
sleep(1);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static int termsig = 0;
|
||||
|
||||
static void noteterm(int sig)
|
||||
{
|
||||
termsig = sig;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop spawning up to `multi` child processes, only child processes return
|
||||
* from this function. The parent process loops until receiving a termination
|
||||
* signal, kills extant children and exits without returning.
|
||||
*/
|
||||
void spawn_loop(const char *prog)
|
||||
{
|
||||
pid_t *kidpids = NULL;
|
||||
int status;
|
||||
int procs = 0;
|
||||
int i;
|
||||
|
||||
openlog(prog, LOG_PID, LOG_DAEMON);
|
||||
|
||||
if (setpgid(0, 0)) {
|
||||
syslog(LOG_ERR, "fatal: error detaching from parent process group: %s",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
kidpids = app_malloc(multi * sizeof(*kidpids), "child PID array");
|
||||
for (i = 0; i < multi; ++i)
|
||||
kidpids[i] = 0;
|
||||
|
||||
signal(SIGINT, noteterm);
|
||||
signal(SIGTERM, noteterm);
|
||||
|
||||
while (termsig == 0) {
|
||||
pid_t fpid;
|
||||
|
||||
/*
|
||||
* Wait for a child to replace when we're at the limit.
|
||||
* Slow down if a child exited abnormally or waitpid() < 0
|
||||
*/
|
||||
while (termsig == 0 && procs >= multi) {
|
||||
if ((fpid = waitpid(-1, &status, 0)) > 0) {
|
||||
for (i = 0; i < procs; ++i) {
|
||||
if (kidpids[i] == fpid) {
|
||||
kidpids[i] = 0;
|
||||
--procs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
syslog(LOG_ERR, "fatal: internal error: "
|
||||
"no matching child slot for pid: %ld",
|
||||
(long) fpid);
|
||||
killall(1, kidpids);
|
||||
}
|
||||
if (status != 0) {
|
||||
if (WIFEXITED(status))
|
||||
syslog(LOG_WARNING, "child process: %ld, exit status: %d",
|
||||
(long)fpid, WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
syslog(LOG_WARNING, "child process: %ld, term signal %d%s",
|
||||
(long)fpid, WTERMSIG(status),
|
||||
# ifdef WCOREDUMP
|
||||
WCOREDUMP(status) ? " (core dumped)" :
|
||||
# endif
|
||||
"");
|
||||
sleep(1);
|
||||
}
|
||||
break;
|
||||
} else if (errno != EINTR) {
|
||||
syslog(LOG_ERR, "fatal: waitpid(): %s", strerror(errno));
|
||||
killall(1, kidpids);
|
||||
}
|
||||
}
|
||||
if (termsig)
|
||||
break;
|
||||
|
||||
switch (fpid = fork()) {
|
||||
case -1: /* error */
|
||||
/* System critically low on memory, pause and try again later */
|
||||
sleep(30);
|
||||
break;
|
||||
case 0: /* child */
|
||||
OPENSSL_free(kidpids);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
if (termsig)
|
||||
_exit(0);
|
||||
if (RAND_poll() <= 0) {
|
||||
syslog(LOG_ERR, "fatal: RAND_poll() failed");
|
||||
_exit(1);
|
||||
}
|
||||
return;
|
||||
default: /* parent */
|
||||
for (i = 0; i < multi; ++i) {
|
||||
if (kidpids[i] == 0) {
|
||||
kidpids[i] = fpid;
|
||||
procs++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
syslog(LOG_ERR, "fatal: internal error: no free child slots");
|
||||
killall(1, kidpids);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The loop above can only break on termsig */
|
||||
syslog(LOG_INFO, "terminating on signal: %d", termsig);
|
||||
killall(0, kidpids);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
BIO *http_server_init_bio(const char *prog, const char *port)
|
||||
{
|
||||
BIO *acbio = NULL, *bufbio;
|
||||
|
||||
bufbio = BIO_new(BIO_f_buffer());
|
||||
if (bufbio == NULL)
|
||||
goto err;
|
||||
acbio = BIO_new(BIO_s_accept());
|
||||
if (acbio == NULL
|
||||
|| BIO_set_bind_mode(acbio, BIO_BIND_REUSEADDR) < 0
|
||||
|| BIO_set_accept_port(acbio, port) < 0) {
|
||||
log_message(prog, LOG_ERR, "Error setting up accept BIO");
|
||||
goto err;
|
||||
}
|
||||
|
||||
BIO_set_accept_bios(acbio, bufbio);
|
||||
bufbio = NULL;
|
||||
if (BIO_do_accept(acbio) <= 0) {
|
||||
log_message(prog, LOG_ERR, "Error starting accept");
|
||||
goto err;
|
||||
}
|
||||
|
||||
return acbio;
|
||||
|
||||
err:
|
||||
BIO_free_all(acbio);
|
||||
BIO_free(bufbio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode %xx URL-decoding in-place. Ignores malformed sequences.
|
||||
*/
|
||||
static int urldecode(char *p)
|
||||
{
|
||||
unsigned char *out = (unsigned char *)p;
|
||||
unsigned char *save = out;
|
||||
|
||||
for (; *p; p++) {
|
||||
if (*p != '%') {
|
||||
*out++ = *p;
|
||||
} else if (isxdigit(_UC(p[1])) && isxdigit(_UC(p[2]))) {
|
||||
/* Don't check, can't fail because of ixdigit() call. */
|
||||
*out++ = (OPENSSL_hexchar2int(p[1]) << 4)
|
||||
| OPENSSL_hexchar2int(p[2]);
|
||||
p += 2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*out = '\0';
|
||||
return (int)(out - save);
|
||||
}
|
||||
|
||||
int http_server_get_asn1_req(const ASN1_ITEM *it, ASN1_VALUE **preq,
|
||||
char **ppath, BIO **pcbio, BIO *acbio,
|
||||
const char *prog, int accept_get, int timeout)
|
||||
{
|
||||
BIO *cbio = NULL, *getbio = NULL, *b64 = NULL;
|
||||
int len;
|
||||
char reqbuf[2048], inbuf[2048];
|
||||
char *meth, *url, *end;
|
||||
ASN1_VALUE *req;
|
||||
int ret = 1;
|
||||
|
||||
*preq = NULL;
|
||||
if (ppath != NULL)
|
||||
*ppath = NULL;
|
||||
*pcbio = NULL;
|
||||
|
||||
/* Connection loss before accept() is routine, ignore silently */
|
||||
if (BIO_do_accept(acbio) <= 0)
|
||||
return 0;
|
||||
|
||||
cbio = BIO_pop(acbio);
|
||||
*pcbio = cbio;
|
||||
if (cbio == NULL) {
|
||||
/* Cannot call http_server_send_status(cbio, ...) */
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
# ifdef HTTP_DAEMON
|
||||
if (timeout > 0) {
|
||||
(void)BIO_get_fd(cbio, &acfd);
|
||||
alarm(timeout);
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Read the request line. */
|
||||
len = BIO_gets(cbio, reqbuf, sizeof(reqbuf));
|
||||
if (len <= 0) {
|
||||
log_message(prog, LOG_INFO,
|
||||
"Request line read error or empty request");
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
|
||||
meth = reqbuf;
|
||||
url = meth + 3;
|
||||
if ((accept_get && strncmp(meth, "GET ", 4) == 0)
|
||||
|| (url++, strncmp(meth, "POST ", 5) == 0)) {
|
||||
/* Expecting (GET|POST) {sp} /URL {sp} HTTP/1.x */
|
||||
*(url++) = '\0';
|
||||
while (*url == ' ')
|
||||
url++;
|
||||
if (*url != '/') {
|
||||
log_message(prog, LOG_INFO,
|
||||
"Invalid %s -- URL does not begin with '/': %s",
|
||||
meth, url);
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
url++;
|
||||
|
||||
/* Splice off the HTTP version identifier. */
|
||||
for (end = url; *end != '\0'; end++)
|
||||
if (*end == ' ')
|
||||
break;
|
||||
if (strncmp(end, " HTTP/1.", 7) != 0) {
|
||||
log_message(prog, LOG_INFO,
|
||||
"Invalid %s -- bad HTTP/version string: %s",
|
||||
meth, end + 1);
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
*end = '\0';
|
||||
|
||||
/*-
|
||||
* Skip "GET / HTTP..." requests often used by load-balancers.
|
||||
* 'url' was incremented above to point to the first byte *after*
|
||||
* the leading slash, so in case 'GET / ' it is now an empty string.
|
||||
*/
|
||||
if (strlen(meth) == 3 && url[0] == '\0') {
|
||||
(void)http_server_send_status(cbio, 200, "OK");
|
||||
goto out;
|
||||
}
|
||||
|
||||
len = urldecode(url);
|
||||
if (len < 0) {
|
||||
log_message(prog, LOG_INFO,
|
||||
"Invalid %s request -- bad URL encoding: %s",
|
||||
meth, url);
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
if (strlen(meth) == 3) { /* GET */
|
||||
if ((getbio = BIO_new_mem_buf(url, len)) == NULL
|
||||
|| (b64 = BIO_new(BIO_f_base64())) == NULL) {
|
||||
log_message(prog, LOG_ERR,
|
||||
"Could not allocate base64 bio with size = %d",
|
||||
len);
|
||||
goto fatal;
|
||||
}
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
getbio = BIO_push(b64, getbio);
|
||||
}
|
||||
} else {
|
||||
log_message(prog, LOG_INFO,
|
||||
"HTTP request does not start with GET/POST: %s", reqbuf);
|
||||
/* TODO provide better diagnosis in case client tries TLS */
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* chop any further/duplicate leading or trailing '/' */
|
||||
while (*url == '/')
|
||||
url++;
|
||||
while (end >= url + 2 && end[-2] == '/' && end[-1] == '/')
|
||||
end--;
|
||||
*end = '\0';
|
||||
|
||||
/* Read and skip past the headers. */
|
||||
for (;;) {
|
||||
len = BIO_gets(cbio, inbuf, sizeof(inbuf));
|
||||
if (len <= 0) {
|
||||
log_message(prog, LOG_ERR,
|
||||
"Error skipping remaining HTTP headers");
|
||||
(void)http_server_send_status(cbio, 400, "Bad Request");
|
||||
goto out;
|
||||
}
|
||||
if ((inbuf[0] == '\r') || (inbuf[0] == '\n'))
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef HTTP_DAEMON
|
||||
/* Clear alarm before we close the client socket */
|
||||
alarm(0);
|
||||
timeout = 0;
|
||||
# endif
|
||||
|
||||
/* Try to read and parse request */
|
||||
req = ASN1_item_d2i_bio(it, getbio != NULL ? getbio : cbio, NULL);
|
||||
if (req == NULL) {
|
||||
log_message(prog, LOG_ERR, "Error parsing request");
|
||||
} else if (ppath != NULL && (*ppath = OPENSSL_strdup(url)) == NULL) {
|
||||
log_message(prog, LOG_ERR,
|
||||
"Out of memory allocating %d bytes", strlen(url) + 1);
|
||||
ASN1_item_free(req, it);
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
*preq = req;
|
||||
|
||||
out:
|
||||
BIO_free_all(getbio);
|
||||
# ifdef HTTP_DAEMON
|
||||
if (timeout > 0)
|
||||
alarm(0);
|
||||
acfd = (int)INVALID_SOCKET;
|
||||
# endif
|
||||
return ret;
|
||||
|
||||
fatal:
|
||||
(void)http_server_send_status(cbio, 500, "Internal Server Error");
|
||||
if (ppath != NULL) {
|
||||
OPENSSL_free(*ppath);
|
||||
*ppath = NULL;
|
||||
}
|
||||
BIO_free_all(cbio);
|
||||
*pcbio = NULL;
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* assumes that cbio does not do an encoding that changes the output length */
|
||||
int http_server_send_asn1_resp(BIO *cbio, const char *content_type,
|
||||
const ASN1_ITEM *it, const ASN1_VALUE *resp)
|
||||
{
|
||||
int ret = BIO_printf(cbio, "HTTP/1.0 200 OK\r\nContent-type: %s\r\n"
|
||||
"Content-Length: %d\r\n\r\n", content_type,
|
||||
ASN1_item_i2d(resp, NULL, it)) > 0
|
||||
&& ASN1_item_i2d_bio(it, cbio, resp) > 0;
|
||||
|
||||
(void)BIO_flush(cbio);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int http_server_send_status(BIO *cbio, int status, const char *reason)
|
||||
{
|
||||
int ret = BIO_printf(cbio, "HTTP/1.0 %d %s\r\n\r\n", status, reason) > 0;
|
||||
|
||||
(void)BIO_flush(cbio);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2019-2020 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
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <openssl/safestack.h>
|
||||
#include "names.h"
|
||||
|
||||
DEFINE_STACK_OF_CSTRING()
|
||||
|
||||
#ifdef _WIN32
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
+45
-19
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2020 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
|
||||
@@ -209,6 +209,7 @@ int opt_format(const char *s, unsigned long flags, int *result)
|
||||
{
|
||||
switch (*s) {
|
||||
default:
|
||||
opt_printf_stderr("%s: Bad format \"%s\"\n", prog, s);
|
||||
return 0;
|
||||
case 'D':
|
||||
case 'd':
|
||||
@@ -275,6 +276,7 @@ int opt_format(const char *s, unsigned long flags, int *result)
|
||||
return opt_format_error(s, flags);
|
||||
*result = FORMAT_PKCS12;
|
||||
} else {
|
||||
opt_printf_stderr("%s: Bad format \"%s\"\n", prog, s);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -282,6 +284,41 @@ int opt_format(const char *s, unsigned long flags, int *result)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return string representing the given format. */
|
||||
const char *format2str(int format)
|
||||
{
|
||||
switch (format) {
|
||||
default:
|
||||
return "(undefined)";
|
||||
case FORMAT_PEM:
|
||||
return "PEM";
|
||||
case FORMAT_ASN1:
|
||||
return "DER";
|
||||
case FORMAT_TEXT:
|
||||
return "TEXT";
|
||||
case FORMAT_NSS:
|
||||
return "NSS";
|
||||
case FORMAT_SMIME:
|
||||
return "SMIME";
|
||||
case FORMAT_MSBLOB:
|
||||
return "MSBLOB";
|
||||
case FORMAT_ENGINE:
|
||||
return "ENGINE";
|
||||
case FORMAT_HTTP:
|
||||
return "HTTP";
|
||||
case FORMAT_PKCS12:
|
||||
return "P12";
|
||||
case FORMAT_PVK:
|
||||
return "PVK";
|
||||
}
|
||||
}
|
||||
|
||||
/* Print an error message about unsuitable/unsupported format requested. */
|
||||
void print_format_error(int format, unsigned long flags)
|
||||
{
|
||||
(void)opt_format_error(format2str(format), flags);
|
||||
}
|
||||
|
||||
/* Parse a cipher name, put it in *EVP_CIPHER; return 0 on failure, else 1. */
|
||||
int opt_cipher(const char *name, const EVP_CIPHER **cipherp)
|
||||
{
|
||||
@@ -705,40 +742,29 @@ int opt_next(void)
|
||||
break;
|
||||
case 'p':
|
||||
case 'n':
|
||||
if (!opt_int(arg, &ival)
|
||||
|| (o->valtype == 'p' && ival <= 0)) {
|
||||
if (!opt_int(arg, &ival))
|
||||
return -1;
|
||||
if (o->valtype == 'p' && ival <= 0) {
|
||||
opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n",
|
||||
prog, arg, o->name);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
if (!opt_imax(arg, &imval)) {
|
||||
opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
|
||||
prog, arg, o->name);
|
||||
if (!opt_imax(arg, &imval))
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
if (!opt_umax(arg, &umval)) {
|
||||
opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
|
||||
prog, arg, o->name);
|
||||
if (!opt_umax(arg, &umval))
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (!opt_long(arg, &lval)) {
|
||||
opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
|
||||
prog, arg, o->name);
|
||||
if (!opt_long(arg, &lval))
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
if (!opt_ulong(arg, &ulval)) {
|
||||
opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n",
|
||||
prog, arg, o->name);
|
||||
if (!opt_ulong(arg, &ulval))
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
case 'E':
|
||||
|
||||
+11
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -26,6 +26,11 @@
|
||||
|
||||
#define COOKIE_SECRET_LENGTH 16
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509_NAME)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
VERIFY_CB_ARGS verify_args = { -1, 0, X509_V_OK, 0 };
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
@@ -190,7 +195,7 @@ static STRINT_PAIR cert_type_list[] = {
|
||||
{"RSA fixed ECDH", TLS_CT_RSA_FIXED_ECDH},
|
||||
{"ECDSA fixed ECDH", TLS_CT_ECDSA_FIXED_ECDH},
|
||||
{"GOST01 Sign", TLS_CT_GOST01_SIGN},
|
||||
{"GOST12 Sign", TLS_CT_GOST12_SIGN},
|
||||
{"GOST12 Sign", TLS_CT_GOST12_IANA_SIGN},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -782,7 +787,7 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
|
||||
BIO_printf(bio_err, "HMAC not found\n");
|
||||
goto end;
|
||||
}
|
||||
ctx = EVP_MAC_CTX_new(hmac);
|
||||
ctx = EVP_MAC_new_ctx(hmac);
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err, "HMAC context allocation failed\n");
|
||||
goto end;
|
||||
@@ -791,7 +796,7 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
|
||||
*p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, cookie_secret,
|
||||
COOKIE_SECRET_LENGTH);
|
||||
*p = OSSL_PARAM_construct_end();
|
||||
if (!EVP_MAC_CTX_set_params(ctx, params)) {
|
||||
if (!EVP_MAC_set_ctx_params(ctx, params)) {
|
||||
BIO_printf(bio_err, "HMAC context parameter setting failed\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -1089,11 +1094,11 @@ int args_excert(int opt, SSL_EXCERT **pexc)
|
||||
exc->build_chain = 1;
|
||||
break;
|
||||
case OPT_X_CERTFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &exc->certform))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &exc->certform))
|
||||
return 0;
|
||||
break;
|
||||
case OPT_X_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &exc->keyform))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &exc->keyform))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
+22
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -392,4 +392,25 @@ int do_server(int *accept_sock, const char *host, const char *port,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void do_ssl_shutdown(SSL *ssl)
|
||||
{
|
||||
int ret;
|
||||
|
||||
do {
|
||||
/* We only do unidirectional shutdown */
|
||||
ret = SSL_shutdown(ssl);
|
||||
if (ret < 0) {
|
||||
switch (SSL_get_error(ssl, ret)) {
|
||||
case SSL_ERROR_WANT_READ:
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
case SSL_ERROR_WANT_ASYNC:
|
||||
case SSL_ERROR_WANT_ASYNC_JOB:
|
||||
/* We just do busy waiting. Nothing clever */
|
||||
continue;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
} while (ret < 0);
|
||||
}
|
||||
|
||||
#endif /* OPENSSL_NO_SOCK */
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "opt.h"
|
||||
#include "names.h"
|
||||
|
||||
DEFINE_STACK_OF_CSTRING()
|
||||
|
||||
static int verbose = 0;
|
||||
|
||||
static void legacy_cipher_fn(const EVP_CIPHER *c,
|
||||
|
||||
+7
-5
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* 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
|
||||
* https://www.openssl.org/source/license.html
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/params.h>
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#undef BUFSIZE
|
||||
#define BUFSIZE 1024*8
|
||||
|
||||
@@ -112,7 +114,7 @@ opthelp:
|
||||
goto opthelp;
|
||||
}
|
||||
|
||||
ctx = EVP_MAC_CTX_new(mac);
|
||||
ctx = EVP_MAC_new_ctx(mac);
|
||||
if (ctx == NULL)
|
||||
goto err;
|
||||
|
||||
@@ -124,7 +126,7 @@ opthelp:
|
||||
if (params == NULL)
|
||||
goto err;
|
||||
|
||||
if (!EVP_MAC_CTX_set_params(ctx, params)) {
|
||||
if (!EVP_MAC_set_ctx_params(ctx, params)) {
|
||||
BIO_printf(bio_err, "MAC parameter error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ok = 0;
|
||||
@@ -197,7 +199,7 @@ err:
|
||||
sk_OPENSSL_STRING_free(opts);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
EVP_MAC_CTX_free(ctx);
|
||||
EVP_MAC_free_ctx(ctx);
|
||||
EVP_MAC_free(mac);
|
||||
return ret;
|
||||
}
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 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
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_TOSEQ, OPT_IN, OPT_OUT,
|
||||
|
||||
+204
-462
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2001-2020 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
|
||||
@@ -9,65 +9,36 @@
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_OCSP
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
# ifdef OPENSSL_SYS_VMS
|
||||
# define _XOPEN_SOURCE_EXTENDED/* So fd_set and friends get properly defined
|
||||
* on OpenVMS */
|
||||
# endif
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
/* So fd_set and friends get properly defined on OpenVMS */
|
||||
# define _XOPEN_SOURCE_EXTENDED
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <time.h>
|
||||
# include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Needs to be included before the openssl headers */
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include "internal/sockets.h"
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/rand.h>
|
||||
#include "apps.h"
|
||||
#include "http_server.h"
|
||||
#include "progs.h"
|
||||
#include "internal/sockets.h"
|
||||
#include <openssl/e_os2.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#ifndef HAVE_FORK
|
||||
# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS)
|
||||
# define HAVE_FORK 0
|
||||
# else
|
||||
# define HAVE_FORK 1
|
||||
# endif
|
||||
#endif
|
||||
DEFINE_STACK_OF(OCSP_CERTID)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#if HAVE_FORK
|
||||
# undef NO_FORK
|
||||
#else
|
||||
# define NO_FORK
|
||||
#endif
|
||||
|
||||
# if !defined(NO_FORK) && !defined(OPENSSL_NO_SOCK) \
|
||||
&& !defined(OPENSSL_NO_POSIX_IO)
|
||||
# define OCSP_DAEMON
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include <syslog.h>
|
||||
# include <signal.h>
|
||||
# define MAXERRLEN 1000 /* limit error text sent to syslog to 1000 bytes */
|
||||
# else
|
||||
# undef LOG_INFO
|
||||
# undef LOG_WARNING
|
||||
# undef LOG_ERR
|
||||
# define LOG_INFO 0
|
||||
# define LOG_WARNING 1
|
||||
# define LOG_ERR 2
|
||||
# endif
|
||||
|
||||
# if defined(OPENSSL_SYS_VXWORKS)
|
||||
#if defined(OPENSSL_SYS_VXWORKS)
|
||||
/* not supported */
|
||||
int setpgid(pid_t pid, pid_t pgid)
|
||||
{
|
||||
@@ -80,9 +51,9 @@ pid_t fork(void)
|
||||
errno = ENOSYS;
|
||||
return (pid_t) -1;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
/* Maximum leeway in validity period: default 5 minutes */
|
||||
# define MAX_VALIDITY_PERIOD (5 * 60)
|
||||
#define MAX_VALIDITY_PERIOD (5 * 60)
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,
|
||||
const EVP_MD *cert_id_md, X509 *issuer,
|
||||
@@ -103,20 +74,21 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
const EVP_MD *resp_md);
|
||||
|
||||
static char **lookup_serial(CA_DB *db, ASN1_INTEGER *ser);
|
||||
static BIO *init_responder(const char *port);
|
||||
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, int timeout);
|
||||
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
|
||||
static void log_message(int level, const char *fmt, ...);
|
||||
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
|
||||
int timeout);
|
||||
static int send_ocsp_response(BIO *cbio, const OCSP_RESPONSE *resp);
|
||||
static char *prog;
|
||||
static int multi = 0;
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
static int acfd = (int) INVALID_SOCKET;
|
||||
#ifdef HTTP_DAEMON
|
||||
static int index_changed(CA_DB *);
|
||||
static void spawn_loop(void);
|
||||
static int print_syslog(const char *str, size_t len, void *levPtr);
|
||||
static void socket_timeout(int signum);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
static OCSP_RESPONSE *query_responder(BIO *cbio, const char *host,
|
||||
const char *path,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
OCSP_REQUEST *req, int req_timeout);
|
||||
#endif
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -160,9 +132,9 @@ const OPTIONS ocsp_options[] = {
|
||||
"Connection timeout (in seconds) to the OCSP responder"},
|
||||
{"resp_no_certs", OPT_RESP_NO_CERTS, '-',
|
||||
"Don't include any certificates in response"},
|
||||
# ifdef OCSP_DAEMON
|
||||
#ifdef HTTP_DAEMON
|
||||
{"multi", OPT_MULTI, 'p', "run multiple responder processes"},
|
||||
# endif
|
||||
#endif
|
||||
{"no_certs", OPT_NO_CERTS, '-',
|
||||
"Don't include any certificates in signed request"},
|
||||
{"badsig", OPT_BADSIG, '-',
|
||||
@@ -269,7 +241,7 @@ int ocsp_main(int argc, char **argv)
|
||||
int noCAfile = 0, noCApath = 0, noCAstore = 0;
|
||||
int accept_count = -1, add_nonce = 1, noverify = 0, use_ssl = -1;
|
||||
int vpmtouched = 0, badsig = 0, i, ignore_err = 0, nmin = 0, ndays = -1;
|
||||
int req_text = 0, resp_text = 0, ret = 1;
|
||||
int req_text = 0, resp_text = 0, res, ret = 1;
|
||||
int req_timeout = -1;
|
||||
long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
|
||||
unsigned long sign_flags = 0, verify_flags = 0, rflags = 0;
|
||||
@@ -309,8 +281,7 @@ int ocsp_main(int argc, char **argv)
|
||||
OPENSSL_free(tport);
|
||||
OPENSSL_free(tpath);
|
||||
thost = tport = tpath = NULL;
|
||||
if (!OSSL_HTTP_parse_url(opt_arg(),
|
||||
&host, &port, &path, &use_ssl)) {
|
||||
if (!OCSP_parse_url(opt_arg(), &host, &port, &path, &use_ssl)) {
|
||||
BIO_printf(bio_err, "%s Error parsing URL\n", prog);
|
||||
goto end;
|
||||
}
|
||||
@@ -439,7 +410,8 @@ int ocsp_main(int argc, char **argv)
|
||||
path = opt_arg();
|
||||
break;
|
||||
case OPT_ISSUER:
|
||||
issuer = load_cert(opt_arg(), FORMAT_PEM, "issuer certificate");
|
||||
issuer = load_cert(opt_arg(), FORMAT_UNDEF,
|
||||
"issuer certificate");
|
||||
if (issuer == NULL)
|
||||
goto end;
|
||||
if (issuers == NULL) {
|
||||
@@ -451,7 +423,7 @@ int ocsp_main(int argc, char **argv)
|
||||
break;
|
||||
case OPT_CERT:
|
||||
X509_free(cert);
|
||||
cert = load_cert(opt_arg(), FORMAT_PEM, "certificate");
|
||||
cert = load_cert(opt_arg(), FORMAT_UNDEF, "certificate");
|
||||
if (cert == NULL)
|
||||
goto end;
|
||||
if (cert_id_md == NULL)
|
||||
@@ -538,9 +510,9 @@ int ocsp_main(int argc, char **argv)
|
||||
trailing_md = 1;
|
||||
break;
|
||||
case OPT_MULTI:
|
||||
# ifdef OCSP_DAEMON
|
||||
#ifdef HTTP_DAEMON
|
||||
multi = atoi(opt_arg());
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
case OPT_PROV_CASES:
|
||||
if (!opt_provider(o))
|
||||
@@ -582,15 +554,21 @@ int ocsp_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (req == NULL && port != NULL) {
|
||||
acbio = init_responder(port);
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
acbio = http_server_init_bio(prog, port);
|
||||
if (acbio == NULL)
|
||||
goto end;
|
||||
#else
|
||||
BIO_printf(bio_err, "Cannot act as server - sockets not supported\n");
|
||||
goto end;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rsignfile != NULL) {
|
||||
if (rkeyfile == NULL)
|
||||
rkeyfile = rsignfile;
|
||||
rsigner = load_cert(rsignfile, FORMAT_PEM, "responder certificate");
|
||||
rsigner = load_cert(rsignfile, FORMAT_UNDEF,
|
||||
"responder certificate");
|
||||
if (rsigner == NULL) {
|
||||
BIO_printf(bio_err, "Error loading responder certificate\n");
|
||||
goto end;
|
||||
@@ -628,20 +606,20 @@ int ocsp_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
#ifdef HTTP_DAEMON
|
||||
if (multi && acbio != NULL)
|
||||
spawn_loop();
|
||||
spawn_loop(prog);
|
||||
if (acbio != NULL && req_timeout > 0)
|
||||
signal(SIGALRM, socket_timeout);
|
||||
#endif
|
||||
|
||||
if (acbio != NULL)
|
||||
log_message(LOG_INFO, "waiting for OCSP client connections...");
|
||||
log_message(prog, LOG_INFO, "waiting for OCSP client connections...");
|
||||
|
||||
redo_accept:
|
||||
|
||||
if (acbio != NULL) {
|
||||
# ifdef OCSP_DAEMON
|
||||
#ifdef HTTP_DAEMON
|
||||
if (index_changed(rdb)) {
|
||||
CA_DB *newrdb = load_index(ridx_filename, NULL);
|
||||
|
||||
@@ -650,21 +628,24 @@ redo_accept:
|
||||
rdb = newrdb;
|
||||
} else {
|
||||
free_index(newrdb);
|
||||
log_message(LOG_ERR, "error reloading updated index: %s",
|
||||
log_message(prog, LOG_ERR, "error reloading updated index: %s",
|
||||
ridx_filename);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
req = NULL;
|
||||
if (!do_responder(&req, &cbio, acbio, req_timeout))
|
||||
res = do_responder(&req, &cbio, acbio, req_timeout);
|
||||
if (res == 0)
|
||||
goto redo_accept;
|
||||
|
||||
if (req == NULL) {
|
||||
resp =
|
||||
OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST,
|
||||
NULL);
|
||||
send_ocsp_response(cbio, resp);
|
||||
if (res == 1) {
|
||||
resp =
|
||||
OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST,
|
||||
NULL);
|
||||
send_ocsp_response(cbio, resp);
|
||||
}
|
||||
goto done_resp;
|
||||
}
|
||||
}
|
||||
@@ -684,7 +665,7 @@ redo_accept:
|
||||
if (signfile != NULL) {
|
||||
if (keyfile == NULL)
|
||||
keyfile = signfile;
|
||||
signer = load_cert(signfile, FORMAT_PEM, "signer certificate");
|
||||
signer = load_cert(signfile, FORMAT_UNDEF, "signer certificate");
|
||||
if (signer == NULL) {
|
||||
BIO_printf(bio_err, "Error loading signer certificate\n");
|
||||
goto end;
|
||||
@@ -724,16 +705,16 @@ redo_accept:
|
||||
if (cbio != NULL)
|
||||
send_ocsp_response(cbio, resp);
|
||||
} else if (host != NULL) {
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
resp = process_responder(req, host, path,
|
||||
port, use_ssl, headers, req_timeout);
|
||||
if (resp == NULL)
|
||||
goto end;
|
||||
# else
|
||||
#else
|
||||
BIO_printf(bio_err,
|
||||
"Error creating connect BIO - sockets not supported.\n");
|
||||
"Error creating connect BIO - sockets not supported\n");
|
||||
goto end;
|
||||
# endif
|
||||
#endif
|
||||
} else if (respin != NULL) {
|
||||
derbio = bio_open_default(respin, 'r', FORMAT_ASN1);
|
||||
if (derbio == NULL)
|
||||
@@ -871,41 +852,7 @@ redo_accept:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
log_message(int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
# ifdef OCSP_DAEMON
|
||||
if (multi) {
|
||||
char buf[1024];
|
||||
if (vsnprintf(buf, sizeof(buf), fmt, ap) > 0) {
|
||||
syslog(level, "%s", buf);
|
||||
}
|
||||
if (level >= LOG_ERR)
|
||||
ERR_print_errors_cb(print_syslog, &level);
|
||||
}
|
||||
# endif
|
||||
if (!multi) {
|
||||
BIO_printf(bio_err, "%s: ", prog);
|
||||
BIO_vprintf(bio_err, fmt, ap);
|
||||
BIO_printf(bio_err, "\n");
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
|
||||
static int print_syslog(const char *str, size_t len, void *levPtr)
|
||||
{
|
||||
int level = *(int *)levPtr;
|
||||
int ilen = (len > MAXERRLEN) ? MAXERRLEN : len;
|
||||
|
||||
syslog(level, "%.*s", ilen, str);
|
||||
|
||||
return ilen;
|
||||
}
|
||||
#ifdef HTTP_DAEMON
|
||||
|
||||
static int index_changed(CA_DB *rdb)
|
||||
{
|
||||
@@ -923,132 +870,7 @@ static int index_changed(CA_DB *rdb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void killall(int ret, pid_t *kidpids)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < multi; ++i)
|
||||
if (kidpids[i] != 0)
|
||||
(void)kill(kidpids[i], SIGTERM);
|
||||
OPENSSL_free(kidpids);
|
||||
sleep(1);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static int termsig = 0;
|
||||
|
||||
static void noteterm (int sig)
|
||||
{
|
||||
termsig = sig;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop spawning up to `multi` child processes, only child processes return
|
||||
* from this function. The parent process loops until receiving a termination
|
||||
* signal, kills extant children and exits without returning.
|
||||
*/
|
||||
static void spawn_loop(void)
|
||||
{
|
||||
pid_t *kidpids = NULL;
|
||||
int status;
|
||||
int procs = 0;
|
||||
int i;
|
||||
|
||||
openlog(prog, LOG_PID, LOG_DAEMON);
|
||||
|
||||
if (setpgid(0, 0)) {
|
||||
syslog(LOG_ERR, "fatal: error detaching from parent process group: %s",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
kidpids = app_malloc(multi * sizeof(*kidpids), "child PID array");
|
||||
for (i = 0; i < multi; ++i)
|
||||
kidpids[i] = 0;
|
||||
|
||||
signal(SIGINT, noteterm);
|
||||
signal(SIGTERM, noteterm);
|
||||
|
||||
while (termsig == 0) {
|
||||
pid_t fpid;
|
||||
|
||||
/*
|
||||
* Wait for a child to replace when we're at the limit.
|
||||
* Slow down if a child exited abnormally or waitpid() < 0
|
||||
*/
|
||||
while (termsig == 0 && procs >= multi) {
|
||||
if ((fpid = waitpid(-1, &status, 0)) > 0) {
|
||||
for (i = 0; i < procs; ++i) {
|
||||
if (kidpids[i] == fpid) {
|
||||
kidpids[i] = 0;
|
||||
--procs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
syslog(LOG_ERR, "fatal: internal error: "
|
||||
"no matching child slot for pid: %ld",
|
||||
(long) fpid);
|
||||
killall(1, kidpids);
|
||||
}
|
||||
if (status != 0) {
|
||||
if (WIFEXITED(status))
|
||||
syslog(LOG_WARNING, "child process: %ld, exit status: %d",
|
||||
(long)fpid, WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
syslog(LOG_WARNING, "child process: %ld, term signal %d%s",
|
||||
(long)fpid, WTERMSIG(status),
|
||||
#ifdef WCOREDUMP
|
||||
WCOREDUMP(status) ? " (core dumped)" :
|
||||
#endif
|
||||
"");
|
||||
sleep(1);
|
||||
}
|
||||
break;
|
||||
} else if (errno != EINTR) {
|
||||
syslog(LOG_ERR, "fatal: waitpid(): %s", strerror(errno));
|
||||
killall(1, kidpids);
|
||||
}
|
||||
}
|
||||
if (termsig)
|
||||
break;
|
||||
|
||||
switch(fpid = fork()) {
|
||||
case -1: /* error */
|
||||
/* System critically low on memory, pause and try again later */
|
||||
sleep(30);
|
||||
break;
|
||||
case 0: /* child */
|
||||
OPENSSL_free(kidpids);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
if (termsig)
|
||||
_exit(0);
|
||||
if (RAND_poll() <= 0) {
|
||||
syslog(LOG_ERR, "fatal: RAND_poll() failed");
|
||||
_exit(1);
|
||||
}
|
||||
return;
|
||||
default: /* parent */
|
||||
for (i = 0; i < multi; ++i) {
|
||||
if (kidpids[i] == 0) {
|
||||
kidpids[i] = fpid;
|
||||
procs++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= multi) {
|
||||
syslog(LOG_ERR, "fatal: internal error: no free child slots");
|
||||
killall(1, kidpids);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The loop above can only break on termsig */
|
||||
syslog(LOG_INFO, "terminating on signal: %d", termsig);
|
||||
killall(0, kidpids);
|
||||
}
|
||||
# endif
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,
|
||||
const EVP_MD *cert_id_md, X509 *issuer,
|
||||
@@ -1081,7 +903,7 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,
|
||||
STACK_OF(OCSP_CERTID) *ids)
|
||||
{
|
||||
OCSP_CERTID *id;
|
||||
X509_NAME *iname;
|
||||
const X509_NAME *iname;
|
||||
ASN1_BIT_STRING *ikey;
|
||||
ASN1_INTEGER *sno;
|
||||
|
||||
@@ -1334,243 +1156,163 @@ static char **lookup_serial(CA_DB *db, ASN1_INTEGER *ser)
|
||||
return rrow;
|
||||
}
|
||||
|
||||
/* Quick and dirty OCSP server: read in and parse input request */
|
||||
|
||||
static BIO *init_responder(const char *port)
|
||||
{
|
||||
# ifdef OPENSSL_NO_SOCK
|
||||
BIO_printf(bio_err,
|
||||
"Error setting up accept BIO - sockets not supported.\n");
|
||||
return NULL;
|
||||
# else
|
||||
BIO *acbio = NULL, *bufbio = NULL;
|
||||
|
||||
bufbio = BIO_new(BIO_f_buffer());
|
||||
if (bufbio == NULL)
|
||||
goto err;
|
||||
acbio = BIO_new(BIO_s_accept());
|
||||
if (acbio == NULL
|
||||
|| BIO_set_bind_mode(acbio, BIO_BIND_REUSEADDR) < 0
|
||||
|| BIO_set_accept_port(acbio, port) < 0) {
|
||||
log_message(LOG_ERR, "Error setting up accept BIO");
|
||||
goto err;
|
||||
}
|
||||
|
||||
BIO_set_accept_bios(acbio, bufbio);
|
||||
bufbio = NULL;
|
||||
if (BIO_do_accept(acbio) <= 0) {
|
||||
log_message(LOG_ERR, "Error starting accept");
|
||||
goto err;
|
||||
}
|
||||
|
||||
return acbio;
|
||||
|
||||
err:
|
||||
BIO_free_all(acbio);
|
||||
BIO_free(bufbio);
|
||||
return NULL;
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
/*
|
||||
* Decode %xx URL-decoding in-place. Ignores mal-formed sequences.
|
||||
*/
|
||||
static int urldecode(char *p)
|
||||
{
|
||||
unsigned char *out = (unsigned char *)p;
|
||||
unsigned char *save = out;
|
||||
|
||||
for (; *p; p++) {
|
||||
if (*p != '%')
|
||||
*out++ = *p;
|
||||
else if (isxdigit(_UC(p[1])) && isxdigit(_UC(p[2]))) {
|
||||
/* Don't check, can't fail because of ixdigit() call. */
|
||||
*out++ = (OPENSSL_hexchar2int(p[1]) << 4)
|
||||
| OPENSSL_hexchar2int(p[2]);
|
||||
p += 2;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
*out = '\0';
|
||||
return (int)(out - save);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
static void socket_timeout(int signum)
|
||||
{
|
||||
if (acfd != (int)INVALID_SOCKET)
|
||||
(void)shutdown(acfd, SHUT_RD);
|
||||
}
|
||||
# endif
|
||||
|
||||
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
|
||||
int timeout)
|
||||
{
|
||||
# ifdef OPENSSL_NO_SOCK
|
||||
return 0;
|
||||
# else
|
||||
int len;
|
||||
OCSP_REQUEST *req = NULL;
|
||||
char inbuf[2048], reqbuf[2048];
|
||||
char *p, *q;
|
||||
BIO *cbio = NULL, *getbio = NULL, *b64 = NULL;
|
||||
const char *client;
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
return http_server_get_asn1_req(ASN1_ITEM_rptr(OCSP_RESPONSE),
|
||||
(ASN1_VALUE **)preq, NULL, pcbio, acbio,
|
||||
prog, 1 /* accept_get */, timeout);
|
||||
#else
|
||||
BIO_printf(bio_err,
|
||||
"Error getting OCSP request - sockets not supported\n");
|
||||
*preq = NULL;
|
||||
|
||||
/* Connection loss before accept() is routine, ignore silently */
|
||||
if (BIO_do_accept(acbio) <= 0)
|
||||
return 0;
|
||||
|
||||
cbio = BIO_pop(acbio);
|
||||
*pcbio = cbio;
|
||||
client = BIO_get_peer_name(cbio);
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
if (timeout > 0) {
|
||||
(void) BIO_get_fd(cbio, &acfd);
|
||||
alarm(timeout);
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Read the request line. */
|
||||
len = BIO_gets(cbio, reqbuf, sizeof(reqbuf));
|
||||
if (len <= 0)
|
||||
goto out;
|
||||
|
||||
if (strncmp(reqbuf, "GET ", 4) == 0) {
|
||||
/* Expecting GET {sp} /URL {sp} HTTP/1.x */
|
||||
for (p = reqbuf + 4; *p == ' '; ++p)
|
||||
continue;
|
||||
if (*p != '/') {
|
||||
log_message(LOG_INFO, "Invalid request -- bad URL: %s", client);
|
||||
goto out;
|
||||
}
|
||||
p++;
|
||||
|
||||
/* Splice off the HTTP version identifier. */
|
||||
for (q = p; *q; q++)
|
||||
if (*q == ' ')
|
||||
break;
|
||||
if (strncmp(q, " HTTP/1.", 8) != 0) {
|
||||
log_message(LOG_INFO,
|
||||
"Invalid request -- bad HTTP version: %s", client);
|
||||
goto out;
|
||||
}
|
||||
*q = '\0';
|
||||
|
||||
/*
|
||||
* Skip "GET / HTTP..." requests often used by load-balancers. Note:
|
||||
* 'p' was incremented above to point to the first byte *after* the
|
||||
* leading slash, so with 'GET / ' it is now an empty string.
|
||||
*/
|
||||
if (p[0] == '\0')
|
||||
goto out;
|
||||
|
||||
len = urldecode(p);
|
||||
if (len <= 0) {
|
||||
log_message(LOG_INFO,
|
||||
"Invalid request -- bad URL encoding: %s", client);
|
||||
goto out;
|
||||
}
|
||||
if ((getbio = BIO_new_mem_buf(p, len)) == NULL
|
||||
|| (b64 = BIO_new(BIO_f_base64())) == NULL) {
|
||||
log_message(LOG_ERR, "Could not allocate base64 bio: %s", client);
|
||||
goto out;
|
||||
}
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
getbio = BIO_push(b64, getbio);
|
||||
} else if (strncmp(reqbuf, "POST ", 5) != 0) {
|
||||
log_message(LOG_INFO, "Invalid request -- bad HTTP verb: %s", client);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Read and skip past the headers. */
|
||||
for (;;) {
|
||||
len = BIO_gets(cbio, inbuf, sizeof(inbuf));
|
||||
if (len <= 0)
|
||||
goto out;
|
||||
if ((inbuf[0] == '\r') || (inbuf[0] == '\n'))
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef OCSP_DAEMON
|
||||
/* Clear alarm before we close the client socket */
|
||||
alarm(0);
|
||||
timeout = 0;
|
||||
# endif
|
||||
|
||||
/* Try to read OCSP request */
|
||||
if (getbio != NULL) {
|
||||
req = d2i_OCSP_REQUEST_bio(getbio, NULL);
|
||||
BIO_free_all(getbio);
|
||||
} else {
|
||||
req = d2i_OCSP_REQUEST_bio(cbio, NULL);
|
||||
}
|
||||
|
||||
if (req == NULL)
|
||||
log_message(LOG_ERR, "Error parsing OCSP request");
|
||||
|
||||
*preq = req;
|
||||
|
||||
out:
|
||||
# ifdef OCSP_DAEMON
|
||||
if (timeout > 0)
|
||||
alarm(0);
|
||||
acfd = (int)INVALID_SOCKET;
|
||||
# endif
|
||||
return 1;
|
||||
# endif
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
|
||||
static int send_ocsp_response(BIO *cbio, const OCSP_RESPONSE *resp)
|
||||
{
|
||||
char http_resp[] =
|
||||
"HTTP/1.0 200 OK\r\nContent-type: application/ocsp-response\r\n"
|
||||
"Content-Length: %d\r\n\r\n";
|
||||
if (cbio == NULL)
|
||||
return 0;
|
||||
BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
|
||||
i2d_OCSP_RESPONSE_bio(cbio, resp);
|
||||
(void)BIO_flush(cbio);
|
||||
return 1;
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
return http_server_send_asn1_resp(cbio, "application/ocsp-response",
|
||||
ASN1_ITEM_rptr(OCSP_RESPONSE),
|
||||
(const ASN1_VALUE *)resp);
|
||||
#else
|
||||
BIO_printf(bio_err,
|
||||
"Error sending OCSP response - sockets not supported\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
static OCSP_RESPONSE *query_responder(BIO *cbio, const char *host,
|
||||
const char *path,
|
||||
const STACK_OF(CONF_VALUE) *headers,
|
||||
OCSP_REQUEST *req, int req_timeout)
|
||||
{
|
||||
int fd;
|
||||
int rv;
|
||||
int i;
|
||||
int add_host = 1;
|
||||
OCSP_REQ_CTX *ctx = NULL;
|
||||
OCSP_RESPONSE *rsp = NULL;
|
||||
fd_set confds;
|
||||
struct timeval tv;
|
||||
|
||||
if (req_timeout != -1)
|
||||
BIO_set_nbio(cbio, 1);
|
||||
|
||||
rv = BIO_do_connect(cbio);
|
||||
|
||||
if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
|
||||
BIO_puts(bio_err, "Error connecting BIO\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (BIO_get_fd(cbio, &fd) < 0) {
|
||||
BIO_puts(bio_err, "Can't get connection fd\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (req_timeout != -1 && rv <= 0) {
|
||||
FD_ZERO(&confds);
|
||||
openssl_fdset(fd, &confds);
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = req_timeout;
|
||||
rv = select(fd + 1, NULL, (void *)&confds, NULL, &tv);
|
||||
if (rv == 0) {
|
||||
BIO_puts(bio_err, "Timeout on connect\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ctx = OCSP_sendreq_new(cbio, path, NULL, -1);
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < sk_CONF_VALUE_num(headers); i++) {
|
||||
CONF_VALUE *hdr = sk_CONF_VALUE_value(headers, i);
|
||||
if (add_host == 1 && strcasecmp("host", hdr->name) == 0)
|
||||
add_host = 0;
|
||||
if (!OCSP_REQ_CTX_add1_header(ctx, hdr->name, hdr->value))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (add_host == 1 && OCSP_REQ_CTX_add1_header(ctx, "Host", host) == 0)
|
||||
goto err;
|
||||
|
||||
if (!OCSP_REQ_CTX_set1_req(ctx, req))
|
||||
goto err;
|
||||
|
||||
for (;;) {
|
||||
rv = OCSP_sendreq_nbio(&rsp, ctx);
|
||||
if (rv != -1)
|
||||
break;
|
||||
if (req_timeout == -1)
|
||||
continue;
|
||||
FD_ZERO(&confds);
|
||||
openssl_fdset(fd, &confds);
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = req_timeout;
|
||||
if (BIO_should_read(cbio)) {
|
||||
rv = select(fd + 1, (void *)&confds, NULL, NULL, &tv);
|
||||
} else if (BIO_should_write(cbio)) {
|
||||
rv = select(fd + 1, NULL, (void *)&confds, NULL, &tv);
|
||||
} else {
|
||||
BIO_puts(bio_err, "Unexpected retry condition\n");
|
||||
goto err;
|
||||
}
|
||||
if (rv == 0) {
|
||||
BIO_puts(bio_err, "Timeout on request\n");
|
||||
break;
|
||||
}
|
||||
if (rv == -1) {
|
||||
BIO_puts(bio_err, "Select error\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
err:
|
||||
OCSP_REQ_CTX_free(ctx);
|
||||
|
||||
return rsp;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
|
||||
const char *host, const char *path,
|
||||
const char *port, int use_ssl,
|
||||
STACK_OF(CONF_VALUE) *headers,
|
||||
int req_timeout)
|
||||
{
|
||||
BIO *cbio = NULL;
|
||||
SSL_CTX *ctx = NULL;
|
||||
OCSP_RESPONSE *resp = NULL;
|
||||
|
||||
cbio = BIO_new_connect(host);
|
||||
if (cbio == NULL) {
|
||||
BIO_printf(bio_err, "Error creating connect BIO\n");
|
||||
goto end;
|
||||
}
|
||||
if (port != NULL)
|
||||
BIO_set_conn_port(cbio, port);
|
||||
if (use_ssl == 1) {
|
||||
BIO *sbio;
|
||||
ctx = SSL_CTX_new(TLS_client_method());
|
||||
if (ctx == NULL) {
|
||||
BIO_printf(bio_err, "Error creating SSL context.\n");
|
||||
goto end;
|
||||
}
|
||||
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
|
||||
sbio = BIO_new_ssl(ctx, 1);
|
||||
cbio = BIO_push(sbio, cbio);
|
||||
}
|
||||
|
||||
resp = (OCSP_RESPONSE *)
|
||||
app_http_post_asn1(host, port, path, NULL, NULL /* no proxy used */,
|
||||
ctx, headers, "application/ocsp-request",
|
||||
(ASN1_VALUE *)req, ASN1_ITEM_rptr(OCSP_REQUEST),
|
||||
req_timeout, ASN1_ITEM_rptr(OCSP_RESPONSE));
|
||||
|
||||
resp = query_responder(cbio, host, path, headers, req, req_timeout);
|
||||
if (resp == NULL)
|
||||
BIO_printf(bio_err, "Error querying OCSP responder\n");
|
||||
|
||||
end:
|
||||
BIO_free_all(cbio);
|
||||
SSL_CTX_free(ctx);
|
||||
return resp;
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
+56
-53
@@ -171,27 +171,9 @@ unstructuredName = An optional company name
|
||||
|
||||
basicConstraints=CA:FALSE
|
||||
|
||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
||||
# the certificate can be used for anything *except* object signing.
|
||||
|
||||
# This is OK for an SSL server.
|
||||
# nsCertType = server
|
||||
|
||||
# For an object signing certificate this would be used.
|
||||
# nsCertType = objsign
|
||||
|
||||
# For normal client use this is typical
|
||||
# nsCertType = client, email
|
||||
|
||||
# and for everything including object signing:
|
||||
# nsCertType = client, email, objsign
|
||||
|
||||
# This is typical in keyUsage for a client certificate.
|
||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
|
||||
# This will be displayed in Netscape's comment listbox.
|
||||
nsComment = "OpenSSL Generated Certificate"
|
||||
|
||||
# PKIX recommendations harmless if included in all certificates.
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
@@ -206,13 +188,6 @@ authorityKeyIdentifier=keyid,issuer
|
||||
# Copy subject details
|
||||
# issuerAltName=issuer:copy
|
||||
|
||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
||||
#nsBaseUrl
|
||||
#nsRevocationUrl
|
||||
#nsRenewalUrl
|
||||
#nsCaPolicyUrl
|
||||
#nsSslServerName
|
||||
|
||||
# This is required for TSA certificates.
|
||||
# extendedKeyUsage = critical,timeStamping
|
||||
|
||||
@@ -242,9 +217,6 @@ basicConstraints = critical,CA:true
|
||||
# left out by default.
|
||||
# keyUsage = cRLSign, keyCertSign
|
||||
|
||||
# Some might want this also
|
||||
# nsCertType = sslCA, emailCA
|
||||
|
||||
# Include email address in subject alt name: another PKIX recommendation
|
||||
# subjectAltName=email:copy
|
||||
# Copy issuer details
|
||||
@@ -272,27 +244,9 @@ authorityKeyIdentifier=keyid:always
|
||||
|
||||
basicConstraints=CA:FALSE
|
||||
|
||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
||||
# the certificate can be used for anything *except* object signing.
|
||||
|
||||
# This is OK for an SSL server.
|
||||
# nsCertType = server
|
||||
|
||||
# For an object signing certificate this would be used.
|
||||
# nsCertType = objsign
|
||||
|
||||
# For normal client use this is typical
|
||||
# nsCertType = client, email
|
||||
|
||||
# and for everything including object signing:
|
||||
# nsCertType = client, email, objsign
|
||||
|
||||
# This is typical in keyUsage for a client certificate.
|
||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
|
||||
# This will be displayed in Netscape's comment listbox.
|
||||
nsComment = "OpenSSL Generated Certificate"
|
||||
|
||||
# PKIX recommendations harmless if included in all certificates.
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
@@ -307,13 +261,6 @@ authorityKeyIdentifier=keyid,issuer
|
||||
# Copy subject details
|
||||
# issuerAltName=issuer:copy
|
||||
|
||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
||||
#nsBaseUrl
|
||||
#nsRevocationUrl
|
||||
#nsRenewalUrl
|
||||
#nsCaPolicyUrl
|
||||
#nsSslServerName
|
||||
|
||||
# This really needs to be in place for it to be a proxy certificate.
|
||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
|
||||
|
||||
@@ -348,3 +295,59 @@ ess_cert_id_chain = no # Must the ESS cert id chain be included?
|
||||
# (optional, default: no)
|
||||
ess_cert_id_alg = sha1 # algorithm to compute certificate
|
||||
# identifier (optional, default: sha1)
|
||||
|
||||
[insta] # CMP using Insta Demo CA
|
||||
# Message transfer
|
||||
server = pki.certificate.fi:8700
|
||||
# proxy = # set this as far as needed, e.g., http://192.168.1.1:8080
|
||||
# tls_use = 0
|
||||
path = pkix/
|
||||
|
||||
# Server authentication
|
||||
recipient = "/C=FI/O=Insta Demo/CN=Insta Demo CA" # or set srvcert or issuer
|
||||
ignore_keyusage = 1 # potentially needed quirk
|
||||
unprotected_errors = 1 # potentially needed quirk
|
||||
extracertsout = insta.extracerts.pem
|
||||
|
||||
# Client authentication
|
||||
ref = 3078 # user identification
|
||||
secret = pass:insta # can be used for both client and server side
|
||||
|
||||
# Generic message options
|
||||
cmd = ir # default operation, can be overridden on cmd line with, e.g., kur
|
||||
|
||||
# Certificate enrollment
|
||||
subject = "/CN=openssl-cmp-test"
|
||||
newkey = insta.priv.pem
|
||||
out_trusted = insta.ca.crt
|
||||
certout = insta.cert.pem
|
||||
|
||||
[pbm] # Password-based protection for Insta CA
|
||||
# Server and client authentication
|
||||
ref = $insta::ref # 3078
|
||||
secret = $insta::secret # pass:insta
|
||||
|
||||
[signature] # Signature-based protection for Insta CA
|
||||
# Server authentication
|
||||
trusted = insta.ca.crt # does not include keyUsage digitalSignature
|
||||
|
||||
# Client authentication
|
||||
secret = # disable PBM
|
||||
key = $insta::newkey # insta.priv.pem
|
||||
cert = $insta::certout # insta.cert.pem
|
||||
|
||||
[ir]
|
||||
cmd = ir
|
||||
|
||||
[cr]
|
||||
cmd = cr
|
||||
|
||||
[kur]
|
||||
# Certificate update
|
||||
cmd = kur
|
||||
oldcert = $insta::certout # insta.cert.pem
|
||||
|
||||
[rr]
|
||||
# Certificate revocation
|
||||
cmd = rr
|
||||
oldcert = $insta::certout # insta.cert.pem
|
||||
+23
-123
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -30,9 +30,6 @@
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
/* Special sentinel to exit the program. */
|
||||
#define EXIT_THE_PROGRAM (-1)
|
||||
|
||||
/*
|
||||
* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with
|
||||
* the base prototypes (we cast each variable inside the function to the
|
||||
@@ -47,12 +44,15 @@ BIO *bio_in = NULL;
|
||||
BIO *bio_out = NULL;
|
||||
BIO *bio_err = NULL;
|
||||
|
||||
static void warn_deprecated(const char *pname,
|
||||
const char *deprecated_alternative)
|
||||
static void warn_deprecated(const FUNCTION *fp)
|
||||
{
|
||||
BIO_printf(bio_err, "The command %s is deprecated.", pname);
|
||||
if (strcmp(deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
|
||||
BIO_printf(bio_err, " Use '%s' instead.", deprecated_alternative);
|
||||
if (fp->deprecated_version != NULL)
|
||||
BIO_printf(bio_err, "The command %s was deprecated in version %s.",
|
||||
fp->name, fp->deprecated_version);
|
||||
else
|
||||
BIO_printf(bio_err, "The command %s is deprecated.", fp->name);
|
||||
if (strcmp(fp->deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
|
||||
BIO_printf(bio_err, " Use '%s' instead.", fp->deprecated_alternative);
|
||||
BIO_printf(bio_err, "\n");
|
||||
}
|
||||
|
||||
@@ -77,27 +77,6 @@ static void apps_shutdown(void)
|
||||
destroy_ui_method();
|
||||
}
|
||||
|
||||
static char *make_config_name(void)
|
||||
{
|
||||
const char *t;
|
||||
size_t len;
|
||||
char *p;
|
||||
|
||||
if ((t = getenv("OPENSSL_CONF")) != NULL)
|
||||
return OPENSSL_strdup(t);
|
||||
|
||||
t = X509_get_default_cert_area();
|
||||
len = strlen(t) + 1 + strlen(OPENSSL_CONF) + 1;
|
||||
p = app_malloc(len, "config filename buffer");
|
||||
strcpy(p, t);
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(p, "/");
|
||||
#endif
|
||||
strcat(p, OPENSSL_CONF);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_TRACE
|
||||
typedef struct tracedata_st {
|
||||
@@ -230,17 +209,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
FUNCTION f, *fp;
|
||||
LHASH_OF(FUNCTION) *prog = NULL;
|
||||
char *p, *pname;
|
||||
char buf[1024];
|
||||
const char *prompt;
|
||||
char *pname;
|
||||
ARGS arg;
|
||||
int first, n, i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
arg.argv = NULL;
|
||||
arg.size = 0;
|
||||
|
||||
/* Set up some of the environment. */
|
||||
default_config_file = make_config_name();
|
||||
bio_in = dup_bio_in(FORMAT_TEXT);
|
||||
bio_out = dup_bio_out(FORMAT_TEXT);
|
||||
bio_err = dup_bio_err(FORMAT_TEXT);
|
||||
@@ -258,11 +234,6 @@ int main(int argc, char *argv[])
|
||||
setup_trace(getenv("OPENSSL_TRACE"));
|
||||
#endif
|
||||
|
||||
if (getenv("OPENSSL_FIPS")) {
|
||||
BIO_printf(bio_err, "FIPS mode not supported.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!apps_startup()) {
|
||||
BIO_printf(bio_err,
|
||||
"FATAL: Startup failure (dev note: apps_startup() failed)\n");
|
||||
@@ -281,93 +252,26 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
pname = opt_progname(argv[0]);
|
||||
|
||||
default_config_file = CONF_get1_default_config_file();
|
||||
if (default_config_file == NULL)
|
||||
app_bail_out("%s: could not get default config file\n", pname);
|
||||
|
||||
/* first check the program name */
|
||||
f.name = pname;
|
||||
fp = lh_FUNCTION_retrieve(prog, &f);
|
||||
if (fp != NULL) {
|
||||
argv[0] = pname;
|
||||
if (fp->deprecated_alternative != NULL)
|
||||
warn_deprecated(pname, fp->deprecated_alternative);
|
||||
ret = fp->func(argc, argv);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* If there is stuff on the command line, run with that. */
|
||||
if (argc != 1) {
|
||||
if (fp == NULL) {
|
||||
/* We assume we've been called as 'openssl cmd' */
|
||||
argc--;
|
||||
argv++;
|
||||
ret = do_cmd(prog, argc, argv);
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* ok, lets enter interactive mode */
|
||||
for (;;) {
|
||||
ret = 0;
|
||||
/* Read a line, continue reading if line ends with \ */
|
||||
for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) {
|
||||
prompt = first ? "OpenSSL> " : "> ";
|
||||
p[0] = '\0';
|
||||
#ifndef READLINE
|
||||
fputs(prompt, stdout);
|
||||
fflush(stdout);
|
||||
if (!fgets(p, n, stdin))
|
||||
goto end;
|
||||
if (p[0] == '\0')
|
||||
goto end;
|
||||
i = strlen(p);
|
||||
if (i <= 1)
|
||||
break;
|
||||
if (p[i - 2] != '\\')
|
||||
break;
|
||||
i -= 2;
|
||||
p += i;
|
||||
n -= i;
|
||||
#else
|
||||
{
|
||||
extern char *readline(const char *);
|
||||
extern void add_history(const char *cp);
|
||||
char *text;
|
||||
/* If there's a command, run with that, otherwise "help". */
|
||||
ret = argc > 0
|
||||
? do_cmd(prog, argc, argv)
|
||||
: help_main(argc, argv);
|
||||
|
||||
text = readline(prompt);
|
||||
if (text == NULL)
|
||||
goto end;
|
||||
i = strlen(text);
|
||||
if (i == 0 || i > n)
|
||||
break;
|
||||
if (text[i - 1] != '\\') {
|
||||
p += strlen(strcpy(p, text));
|
||||
free(text);
|
||||
add_history(buf);
|
||||
break;
|
||||
}
|
||||
|
||||
text[i - 1] = '\0';
|
||||
p += strlen(strcpy(p, text));
|
||||
free(text);
|
||||
n -= i;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!chopup_args(&arg, buf)) {
|
||||
BIO_printf(bio_err, "Can't parse (no memory?)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
ret = do_cmd(prog, arg.argc, arg.argv);
|
||||
if (ret == EXIT_THE_PROGRAM) {
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
if (ret != 0)
|
||||
BIO_printf(bio_err, "error in %s\n", arg.argv[0]);
|
||||
(void)BIO_flush(bio_out);
|
||||
(void)BIO_flush(bio_err);
|
||||
}
|
||||
ret = 1;
|
||||
end:
|
||||
app_providers_cleanup();
|
||||
OPENSSL_free(default_config_file);
|
||||
lh_FUNCTION_free(prog);
|
||||
OPENSSL_free(arg.argv);
|
||||
@@ -482,7 +386,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
|
||||
}
|
||||
if (fp != NULL) {
|
||||
if (fp->deprecated_alternative != NULL)
|
||||
warn_deprecated(fp->name, fp->deprecated_alternative);
|
||||
warn_deprecated(fp);
|
||||
return fp->func(argc, argv);
|
||||
}
|
||||
if ((strncmp(argv[0], "no-", 3)) == 0) {
|
||||
@@ -498,10 +402,6 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
|
||||
BIO_printf(bio_out, "%s\n", argv[0] + 3);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(argv[0], "quit") == 0 || strcmp(argv[0], "q") == 0 ||
|
||||
strcmp(argv[0], "exit") == 0 || strcmp(argv[0], "bye") == 0)
|
||||
/* Special value to mean "exit the program. */
|
||||
return EXIT_THE_PROGRAM;
|
||||
|
||||
BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
|
||||
argv[0]);
|
||||
|
||||
+56
-53
@@ -171,27 +171,9 @@ unstructuredName = An optional company name
|
||||
|
||||
basicConstraints=CA:FALSE
|
||||
|
||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
||||
# the certificate can be used for anything *except* object signing.
|
||||
|
||||
# This is OK for an SSL server.
|
||||
# nsCertType = server
|
||||
|
||||
# For an object signing certificate this would be used.
|
||||
# nsCertType = objsign
|
||||
|
||||
# For normal client use this is typical
|
||||
# nsCertType = client, email
|
||||
|
||||
# and for everything including object signing:
|
||||
# nsCertType = client, email, objsign
|
||||
|
||||
# This is typical in keyUsage for a client certificate.
|
||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
|
||||
# This will be displayed in Netscape's comment listbox.
|
||||
nsComment = "OpenSSL Generated Certificate"
|
||||
|
||||
# PKIX recommendations harmless if included in all certificates.
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
@@ -206,13 +188,6 @@ authorityKeyIdentifier=keyid,issuer
|
||||
# Copy subject details
|
||||
# issuerAltName=issuer:copy
|
||||
|
||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
||||
#nsBaseUrl
|
||||
#nsRevocationUrl
|
||||
#nsRenewalUrl
|
||||
#nsCaPolicyUrl
|
||||
#nsSslServerName
|
||||
|
||||
# This is required for TSA certificates.
|
||||
# extendedKeyUsage = critical,timeStamping
|
||||
|
||||
@@ -242,9 +217,6 @@ basicConstraints = critical,CA:true
|
||||
# left out by default.
|
||||
# keyUsage = cRLSign, keyCertSign
|
||||
|
||||
# Some might want this also
|
||||
# nsCertType = sslCA, emailCA
|
||||
|
||||
# Include email address in subject alt name: another PKIX recommendation
|
||||
# subjectAltName=email:copy
|
||||
# Copy issuer details
|
||||
@@ -272,27 +244,9 @@ authorityKeyIdentifier=keyid:always
|
||||
|
||||
basicConstraints=CA:FALSE
|
||||
|
||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
||||
# the certificate can be used for anything *except* object signing.
|
||||
|
||||
# This is OK for an SSL server.
|
||||
# nsCertType = server
|
||||
|
||||
# For an object signing certificate this would be used.
|
||||
# nsCertType = objsign
|
||||
|
||||
# For normal client use this is typical
|
||||
# nsCertType = client, email
|
||||
|
||||
# and for everything including object signing:
|
||||
# nsCertType = client, email, objsign
|
||||
|
||||
# This is typical in keyUsage for a client certificate.
|
||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
|
||||
# This will be displayed in Netscape's comment listbox.
|
||||
nsComment = "OpenSSL Generated Certificate"
|
||||
|
||||
# PKIX recommendations harmless if included in all certificates.
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
@@ -307,13 +261,6 @@ authorityKeyIdentifier=keyid,issuer
|
||||
# Copy subject details
|
||||
# issuerAltName=issuer:copy
|
||||
|
||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
||||
#nsBaseUrl
|
||||
#nsRevocationUrl
|
||||
#nsRenewalUrl
|
||||
#nsCaPolicyUrl
|
||||
#nsSslServerName
|
||||
|
||||
# This really needs to be in place for it to be a proxy certificate.
|
||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
|
||||
|
||||
@@ -348,3 +295,59 @@ ess_cert_id_chain = no # Must the ESS cert id chain be included?
|
||||
# (optional, default: no)
|
||||
ess_cert_id_alg = sha1 # algorithm to compute certificate
|
||||
# identifier (optional, default: sha1)
|
||||
|
||||
[insta] # CMP using Insta Demo CA
|
||||
# Message transfer
|
||||
server = pki.certificate.fi:8700
|
||||
# proxy = # set this as far as needed, e.g., http://192.168.1.1:8080
|
||||
# tls_use = 0
|
||||
path = pkix/
|
||||
|
||||
# Server authentication
|
||||
recipient = "/C=FI/O=Insta Demo/CN=Insta Demo CA" # or set srvcert or issuer
|
||||
ignore_keyusage = 1 # potentially needed quirk
|
||||
unprotected_errors = 1 # potentially needed quirk
|
||||
extracertsout = insta.extracerts.pem
|
||||
|
||||
# Client authentication
|
||||
ref = 3078 # user identification
|
||||
secret = pass:insta # can be used for both client and server side
|
||||
|
||||
# Generic message options
|
||||
cmd = ir # default operation, can be overridden on cmd line with, e.g., kur
|
||||
|
||||
# Certificate enrollment
|
||||
subject = "/CN=openssl-cmp-test"
|
||||
newkey = insta.priv.pem
|
||||
out_trusted = insta.ca.crt
|
||||
certout = insta.cert.pem
|
||||
|
||||
[pbm] # Password-based protection for Insta CA
|
||||
# Server and client authentication
|
||||
ref = $insta::ref # 3078
|
||||
secret = $insta::secret # pass:insta
|
||||
|
||||
[signature] # Signature-based protection for Insta CA
|
||||
# Server authentication
|
||||
trusted = insta.ca.crt # does not include keyUsage digitalSignature
|
||||
|
||||
# Client authentication
|
||||
secret = # disable PBM
|
||||
key = $insta::newkey # insta.priv.pem
|
||||
cert = $insta::certout # insta.cert.pem
|
||||
|
||||
[ir]
|
||||
cmd = ir
|
||||
|
||||
[cr]
|
||||
cmd = cr
|
||||
|
||||
[kur]
|
||||
# Certificate update
|
||||
cmd = kur
|
||||
oldcert = $insta::certout # insta.cert.pem
|
||||
|
||||
[rr]
|
||||
# Certificate revocation
|
||||
cmd = rr
|
||||
oldcert = $insta::certout # insta.cert.pem
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2020 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
|
||||
|
||||
+29
-28
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 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
|
||||
@@ -8,25 +8,28 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#if defined(OPENSSL_NO_DES)
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/pkcs12.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
|
||||
# define NOKEYS 0x1
|
||||
# define NOCERTS 0x2
|
||||
# define INFO 0x4
|
||||
# define CLCERTS 0x8
|
||||
# define CACERTS 0x10
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(PKCS7)
|
||||
DEFINE_STACK_OF(PKCS12_SAFEBAG)
|
||||
DEFINE_STACK_OF(X509_ATTRIBUTE)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#define NOKEYS 0x1
|
||||
#define NOCERTS 0x2
|
||||
#define INFO 0x4
|
||||
#define CLCERTS 0x8
|
||||
#define CACERTS 0x10
|
||||
|
||||
#define PASSWD_BUF_SIZE 2048
|
||||
|
||||
@@ -64,9 +67,9 @@ typedef enum OPTION_choice {
|
||||
const OPTIONS pkcs12_options[] = {
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("CA"),
|
||||
{"CApath", OPT_CAPATH, '/', "PEM-format directory of CA's"},
|
||||
@@ -112,15 +115,15 @@ const OPTIONS pkcs12_options[] = {
|
||||
{"keysig", OPT_KEYSIG, '-', "Set MS key signature type"},
|
||||
|
||||
OPT_SECTION("Encryption"),
|
||||
# ifndef OPENSSL_NO_RC2
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{"descert", OPT_DESCERT, '-',
|
||||
"Encrypt output with 3DES (default RC2-40)"},
|
||||
{"certpbe", OPT_CERTPBE, 's',
|
||||
"Certificate PBE algorithm (default RC2-40)"},
|
||||
# else
|
||||
#else
|
||||
{"descert", OPT_DESCERT, '-', "Encrypt output with 3DES (the default)"},
|
||||
{"certpbe", OPT_CERTPBE, 's', "Certificate PBE algorithm (default 3DES)"},
|
||||
# endif
|
||||
#endif
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count for encryption key and MAC"},
|
||||
{"noiter", OPT_NOITER, '-', "Don't use encryption key iteration"},
|
||||
{"maciter", OPT_MACITER, '-', "Unused, kept for backwards compatibility"},
|
||||
@@ -141,11 +144,11 @@ int pkcs12_main(int argc, char **argv)
|
||||
char pass[PASSWD_BUF_SIZE] = "", macpass[PASSWD_BUF_SIZE] = "";
|
||||
int export_cert = 0, options = 0, chain = 0, twopass = 0, keytype = 0;
|
||||
int iter = PKCS12_DEFAULT_ITER, maciter = PKCS12_DEFAULT_ITER;
|
||||
# ifndef OPENSSL_NO_RC2
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
|
||||
# else
|
||||
#else
|
||||
int cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
# endif
|
||||
#endif
|
||||
int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
int ret = 1, macver = 1, add_lmk = 0, private = 0;
|
||||
int noprompt = 0;
|
||||
@@ -1008,5 +1011,3 @@ static int set_pbe(int *ppbe, const char *str)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <openssl/pkcs7.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOOUT,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 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
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
@@ -57,7 +57,7 @@ const OPTIONS pkey_options[] = {
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input key"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER or PEM)"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER/PEM/P12/ENGINE)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"pubin", OPT_PUBIN, '-',
|
||||
"Read public key from input (default is private key)"},
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
|
||||
+8
-22
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#define KEY_NONE 0
|
||||
#define KEY_PRIVKEY 1
|
||||
#define KEY_PUBKEY 2
|
||||
@@ -69,11 +71,11 @@ const OPTIONS pkeyutl_options[] = {
|
||||
{"inkey", OPT_INKEY, 's', "Input private key file"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"peerkey", OPT_PEERKEY, 's', "Peer key file used in key derivation"},
|
||||
{"peerform", OPT_PEERFORM, 'E', "Peer key format - default PEM"},
|
||||
{"peerform", OPT_PEERFORM, 'E', "Peer key format (DER/PEM/P12/ENGINE)"},
|
||||
{"certin", OPT_CERTIN, '-', "Input is a cert with a public key"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
{"sigfile", OPT_SIGFILE, '<', "Signature file (verify operation only)"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format (ENGINE, other values ignored)"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
@@ -155,11 +157,11 @@ int pkeyutl_main(int argc, char **argv)
|
||||
passinarg = opt_arg();
|
||||
break;
|
||||
case OPT_PEERFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &peerform))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &peerform))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &keyform))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &keyform))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_R_CASES:
|
||||
@@ -517,7 +519,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
|
||||
break;
|
||||
|
||||
case KEY_CERT:
|
||||
x = load_cert(keyfile, keyform, "Certificate");
|
||||
x = load_cert(keyfile, FORMAT_UNDEF, "Certificate");
|
||||
if (x) {
|
||||
pkey = X509_get_pubkey(x);
|
||||
X509_free(x);
|
||||
@@ -550,22 +552,6 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
|
||||
if (pkey == NULL)
|
||||
goto end;
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/* SM2 needs a special treatment */
|
||||
if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) {
|
||||
EC_KEY *eckey = NULL;
|
||||
const EC_GROUP *group = NULL;
|
||||
int nid;
|
||||
|
||||
if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL
|
||||
|| (group = EC_KEY_get0_group(eckey)) == NULL
|
||||
|| (nid = EC_GROUP_get_curve_name(group)) == 0)
|
||||
goto end;
|
||||
if (nid == NID_sm2
|
||||
&& !EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2))
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
*pkeysize = EVP_PKEY_size(pkey);
|
||||
ctx = EVP_PKEY_CTX_new(pkey, impl);
|
||||
if (ppkey != NULL)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 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
|
||||
|
||||
+30
-17
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 1995-2020 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
|
||||
@@ -92,35 +92,48 @@ EOF
|
||||
|
||||
my %cmd_disabler = (
|
||||
ciphers => "sock",
|
||||
genrsa => "rsa",
|
||||
gendsa => "dsa",
|
||||
dsaparam => "dsa",
|
||||
gendh => "dh",
|
||||
dhparam => "dh",
|
||||
ecparam => "ec",
|
||||
pkcs12 => "des",
|
||||
);
|
||||
my %cmd_deprecated = (
|
||||
rsa => [ "3_0", "pkey", "rsa" ],
|
||||
genrsa => [ "3_0", "genpkey", "rsa" ],
|
||||
rsautl => [ "3_0", "pkeyutl", "rsa" ],
|
||||
dhparam => [ "3_0", "pkeyparam", "dh" ],
|
||||
dsaparam => [ "3_0", "pkeyparam", "dsa" ],
|
||||
dsa => [ "3_0", "pkey", "dsa" ],
|
||||
gendsa => [ "3_0", "genpkey", "dsa" ],
|
||||
ec => [ "3_0", "pkey", "ec" ],
|
||||
ecparam => [ "3_0", "pkeyparam", "ec" ],
|
||||
# The format of this table is:
|
||||
# [0] = alternative command to use instead
|
||||
# [1] = deprecented in this version
|
||||
# [2] = preprocessor conditional for exclusing irrespective of deprecation
|
||||
# rsa => [ "pkey", "3_0", "rsa" ],
|
||||
# genrsa => [ "genpkey", "3_0", "rsa" ],
|
||||
rsautl => [ "pkeyutl", "3_0", "rsa" ],
|
||||
# dhparam => [ "pkeyparam", "3_0", "dh" ],
|
||||
# dsaparam => [ "pkeyparam", "3_0", "dsa" ],
|
||||
# dsa => [ "pkey", "3_0", "dsa" ],
|
||||
# gendsa => [ "genpkey", "3_0", "dsa" ],
|
||||
# ec => [ "pkey", "3_0", "ec" ],
|
||||
# ecparam => [ "pkeyparam", "3_0", "ec" ],
|
||||
);
|
||||
|
||||
print "FUNCTION functions[] = {\n";
|
||||
foreach my $cmd ( @ARGV ) {
|
||||
my $str =
|
||||
" {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options, NULL},\n";
|
||||
" {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options, NULL, NULL},\n";
|
||||
if ($cmd =~ /^s_/) {
|
||||
print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
|
||||
} elsif (my $deprecated = $cmd_deprecated{$cmd}) {
|
||||
my @dep = @{$deprecated};
|
||||
print "#if ";
|
||||
if ($dep[2]) {
|
||||
print "!defined(OPENSSL_NO_" . uc($dep[2]) . ") && ";
|
||||
my $daltprg = $dep[0];
|
||||
my $dver = $dep[1];
|
||||
my $dsys = $dep[2];
|
||||
print "#if !defined(OPENSSL_NO_DEPRECATED_" . $dver . ")";
|
||||
if ($dsys) {
|
||||
print " && !defined(OPENSSL_NO_" . uc($dsys) . ")";
|
||||
}
|
||||
print "!defined(OPENSSL_NO_DEPRECATED_" . $dep[0] . ")";
|
||||
my $dalt = "\"" . $dep[1] . "\"";
|
||||
$str =~ s/NULL/$dalt/;
|
||||
$dver =~ s/_/./g;
|
||||
my $dalt = "\"" . $daltprg . "\", \"" . $dver . "\"";
|
||||
$str =~ s/NULL, NULL/$dalt/;
|
||||
print "\n${str}#endif\n";
|
||||
} elsif (grep { $cmd eq $_ } @disablables) {
|
||||
print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2019-2020 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
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <openssl/core.h>
|
||||
#include <openssl/core_numbers.h>
|
||||
|
||||
DEFINE_STACK_OF_CSTRING()
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_V = 100, OPT_VV, OPT_VVV
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2020 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
|
||||
|
||||
+14
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -42,6 +42,8 @@
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/x509.h>
|
||||
|
||||
DEFINE_STACK_OF(X509_INFO)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
# ifndef PATH_MAX
|
||||
# define PATH_MAX 4096
|
||||
@@ -233,7 +235,7 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
|
||||
{
|
||||
STACK_OF (X509_INFO) *inf = NULL;
|
||||
X509_INFO *x;
|
||||
X509_NAME *name = NULL;
|
||||
const X509_NAME *name = NULL;
|
||||
BIO *b;
|
||||
const char *ext;
|
||||
unsigned char digest[EVP_MAX_MD_SIZE];
|
||||
@@ -274,11 +276,19 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
|
||||
if (x->x509 != NULL) {
|
||||
type = TYPE_CERT;
|
||||
name = X509_get_subject_name(x->x509);
|
||||
X509_digest(x->x509, evpmd, digest, NULL);
|
||||
if (!X509_digest(x->x509, evpmd, digest, NULL)) {
|
||||
BIO_printf(bio_err, "out of memory\n");
|
||||
++errs;
|
||||
goto end;
|
||||
}
|
||||
} else if (x->crl != NULL) {
|
||||
type = TYPE_CRL;
|
||||
name = X509_CRL_get_issuer(x->crl);
|
||||
X509_CRL_digest(x->crl, evpmd, digest, NULL);
|
||||
if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) {
|
||||
BIO_printf(bio_err, "out of memory\n");
|
||||
++errs;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
++errs;
|
||||
goto end;
|
||||
|
||||
+108
-143
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -32,6 +32,8 @@
|
||||
# include <openssl/dsa.h>
|
||||
#endif
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#define BITS "default_bits"
|
||||
#define KEYFILE "default_keyfile"
|
||||
@@ -87,11 +89,11 @@ typedef enum OPTION_choice {
|
||||
OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_KEYGEN_ENGINE, OPT_KEY,
|
||||
OPT_PUBKEY, OPT_NEW, OPT_CONFIG, OPT_KEYFORM, OPT_IN, OPT_OUT,
|
||||
OPT_KEYOUT, OPT_PASSIN, OPT_PASSOUT, OPT_NEWKEY,
|
||||
OPT_PKEYOPT, OPT_SIGOPT, OPT_BATCH, OPT_NEWHDR, OPT_MODULUS,
|
||||
OPT_PKEYOPT, OPT_SIGOPT, OPT_VFYOPT, OPT_BATCH, OPT_NEWHDR, OPT_MODULUS,
|
||||
OPT_VERIFY, OPT_NODES, OPT_NOOUT, OPT_VERBOSE, OPT_UTF8,
|
||||
OPT_NAMEOPT, OPT_REQOPT, OPT_SUBJ, OPT_SUBJECT, OPT_TEXT, OPT_X509,
|
||||
OPT_MULTIVALUE_RDN, OPT_DAYS, OPT_SET_SERIAL, OPT_ADDEXT, OPT_EXTENSIONS,
|
||||
OPT_REQEXTS, OPT_PRECERT, OPT_MD, OPT_SM2ID, OPT_SM2HEXID,
|
||||
OPT_REQEXTS, OPT_PRECERT, OPT_MD,
|
||||
OPT_SECTION,
|
||||
OPT_R_ENUM, OPT_PROV_ENUM
|
||||
} OPTION_CHOICE;
|
||||
@@ -113,7 +115,7 @@ const OPTIONS req_options[] = {
|
||||
{"config", OPT_CONFIG, '<', "Request template file"},
|
||||
{"section", OPT_SECTION, 's', "Config section to use (default \"req\")"},
|
||||
{"utf8", OPT_UTF8, '-', "Input characters are UTF8 (default ASCII)"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
{"reqopt", OPT_REQOPT, 's', "Various request text options"},
|
||||
{"text", OPT_TEXT, '-', "Text form of request"},
|
||||
{"x509", OPT_X509, '-',
|
||||
@@ -135,7 +137,7 @@ const OPTIONS req_options[] = {
|
||||
|
||||
OPT_SECTION("Keys and Signing"),
|
||||
{"key", OPT_KEY, 's', "Private key to use"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key file format (ENGINE, other values ignored)"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"keyout", OPT_KEYOUT, '>', "File to send the key to"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password source"},
|
||||
@@ -143,13 +145,8 @@ const OPTIONS req_options[] = {
|
||||
{"newkey", OPT_NEWKEY, 's', "Specify as type:bits"},
|
||||
{"pkeyopt", OPT_PKEYOPT, 's', "Public key options as opt:value"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"vfyopt", OPT_VFYOPT, 's', "Verification parameter in n:v form"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate request"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate request"},
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
@@ -233,11 +230,11 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
|
||||
int req_main(int argc, char **argv)
|
||||
{
|
||||
ASN1_INTEGER *serial = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
BIO *out = NULL;
|
||||
ENGINE *e = NULL, *gen_eng = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *genctx = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *pkeyopts = NULL, *sigopts = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *pkeyopts = NULL, *sigopts = NULL, *vfyopts = NULL;
|
||||
LHASH_OF(OPENSSL_STRING) *addexts = NULL;
|
||||
X509 *x509ss = NULL;
|
||||
X509_REQ *req = NULL;
|
||||
@@ -260,9 +257,6 @@ int req_main(int argc, char **argv)
|
||||
int nodes = 0, newhdr = 0, subject = 0, pubkey = 0, precert = 0;
|
||||
long newkey = -1;
|
||||
unsigned long chtype = MBSTRING_ASC, reqflag = 0;
|
||||
unsigned char *sm2_id = NULL;
|
||||
size_t sm2_idlen = 0;
|
||||
int sm2_free = 0;
|
||||
|
||||
#ifndef OPENSSL_NO_DES
|
||||
cipher = EVP_des_ede3_cbc();
|
||||
@@ -359,6 +353,12 @@ int req_main(int argc, char **argv)
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_VFYOPT:
|
||||
if (!vfyopts)
|
||||
vfyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!vfyopts || !sk_OPENSSL_STRING_push(vfyopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_BATCH:
|
||||
batch = 1;
|
||||
break;
|
||||
@@ -446,29 +446,6 @@ int req_main(int argc, char **argv)
|
||||
goto opthelp;
|
||||
digest = md_alg;
|
||||
break;
|
||||
case OPT_SM2ID:
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id'\n");
|
||||
goto end;
|
||||
}
|
||||
sm2_id = (unsigned char *)opt_arg();
|
||||
sm2_idlen = strlen((const char *)sm2_id);
|
||||
break;
|
||||
case OPT_SM2HEXID:
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id'\n");
|
||||
goto end;
|
||||
}
|
||||
/* try to parse the input as hex string first */
|
||||
sm2_free = 1;
|
||||
sm2_id = OPENSSL_hexstr2buf(opt_arg(), (long *)&sm2_idlen);
|
||||
if (sm2_id == NULL) {
|
||||
BIO_printf(bio_err, "Invalid hex string input\n");
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
@@ -492,7 +469,7 @@ int req_main(int argc, char **argv)
|
||||
BIO_printf(bio_err, "Using configuration from %s\n", template);
|
||||
if ((req_conf = app_load_config(template)) == NULL)
|
||||
goto end;
|
||||
if (addext_bio) {
|
||||
if (addext_bio != NULL) {
|
||||
if (verbose)
|
||||
BIO_printf(bio_err,
|
||||
"Using additional configuration from command line\n");
|
||||
@@ -613,12 +590,9 @@ int req_main(int argc, char **argv)
|
||||
|
||||
if (keyfile != NULL) {
|
||||
pkey = load_key(keyfile, keyform, 0, passin, e, "Private Key");
|
||||
if (pkey == NULL) {
|
||||
/* load_key() has already printed an appropriate message */
|
||||
if (pkey == NULL)
|
||||
goto end;
|
||||
} else {
|
||||
app_RAND_load_conf(req_conf, section);
|
||||
}
|
||||
app_RAND_load_conf(req_conf, section);
|
||||
}
|
||||
|
||||
if (newreq && (pkey == NULL)) {
|
||||
@@ -738,18 +712,9 @@ int req_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!newreq) {
|
||||
in = bio_open_default(infile, 'r', informat);
|
||||
if (in == NULL)
|
||||
req = load_csr(infile, informat, "X509 request");
|
||||
if (req == NULL)
|
||||
goto end;
|
||||
|
||||
if (informat == FORMAT_ASN1)
|
||||
req = d2i_X509_REQ_bio(in, NULL);
|
||||
else
|
||||
req = PEM_read_bio_X509_REQ(in, NULL, NULL, NULL);
|
||||
if (req == NULL) {
|
||||
BIO_printf(bio_err, "unable to load X509 request\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (newreq || x509) {
|
||||
@@ -901,27 +866,7 @@ int req_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sm2_id != NULL) {
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING *v;
|
||||
|
||||
v = ASN1_OCTET_STRING_new();
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err, "error: SM2 ID allocation failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ASN1_OCTET_STRING_set(v, sm2_id, sm2_idlen)) {
|
||||
BIO_printf(bio_err, "error: setting SM2 ID failed\n");
|
||||
ASN1_OCTET_STRING_free(v);
|
||||
goto end;
|
||||
}
|
||||
|
||||
X509_REQ_set0_sm2_id(req, v);
|
||||
#endif
|
||||
}
|
||||
|
||||
i = X509_REQ_verify(req, tpubkey);
|
||||
i = do_X509_REQ_verify(req, tpubkey, vfyopts);
|
||||
|
||||
if (i < 0) {
|
||||
goto end;
|
||||
@@ -1029,20 +974,18 @@ int req_main(int argc, char **argv)
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (sm2_free)
|
||||
OPENSSL_free(sm2_id);
|
||||
if (ret) {
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
NCONF_free(req_conf);
|
||||
NCONF_free(addext_conf);
|
||||
BIO_free(addext_bio);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(pkey);
|
||||
EVP_PKEY_CTX_free(genctx);
|
||||
sk_OPENSSL_STRING_free(pkeyopts);
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
sk_OPENSSL_STRING_free(vfyopts);
|
||||
lh_OPENSSL_STRING_doall(addexts, exts_cleanup);
|
||||
lh_OPENSSL_STRING_free(addexts);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
@@ -1153,8 +1096,7 @@ static int prompt_info(X509_REQ *req,
|
||||
char *type, *value;
|
||||
const char *def;
|
||||
CONF_VALUE *v;
|
||||
X509_NAME *subj;
|
||||
subj = X509_REQ_get_subject_name(req);
|
||||
X509_NAME *subj = X509_REQ_get_subject_name(req);
|
||||
|
||||
if (!batch) {
|
||||
BIO_printf(bio_err,
|
||||
@@ -1239,8 +1181,7 @@ static int prompt_info(X509_REQ *req,
|
||||
return 0;
|
||||
}
|
||||
if (X509_NAME_entry_count(subj) == 0) {
|
||||
BIO_printf(bio_err,
|
||||
"error, no objects specified in config file\n");
|
||||
BIO_printf(bio_err, "error, no objects specified in config file\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1685,32 +1626,71 @@ static int genpkey_cb(EVP_PKEY_CTX *ctx)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_pkey_ctx_init(EVP_PKEY_CTX *pkctx, STACK_OF(OPENSSL_STRING) *opts)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (opts == NULL)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(opts); i++) {
|
||||
char *opt = sk_OPENSSL_STRING_value(opts, i);
|
||||
if (pkey_ctrl_string(pkctx, opt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", opt);
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_x509_init(X509 *x, STACK_OF(OPENSSL_STRING) *opts)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (opts == NULL)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(opts); i++) {
|
||||
char *opt = sk_OPENSSL_STRING_value(opts, i);
|
||||
if (x509_ctrl_string(x, opt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", opt);
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_x509_req_init(X509_REQ *x, STACK_OF(OPENSSL_STRING) *opts)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (opts == NULL)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(opts); i++) {
|
||||
char *opt = sk_OPENSSL_STRING_value(opts, i);
|
||||
if (x509_req_ctrl_string(x, opt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", opt);
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_sign_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey,
|
||||
const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
EVP_PKEY_CTX *pkctx = NULL;
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
int i, def_nid, ret = 0;
|
||||
int def_nid;
|
||||
|
||||
if (ctx == NULL)
|
||||
goto err;
|
||||
if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) {
|
||||
pctx = EVP_PKEY_CTX_new(pkey, NULL);
|
||||
if (pctx == NULL) {
|
||||
BIO_printf(bio_err, "memory allocation failure.\n");
|
||||
goto err;
|
||||
}
|
||||
/* set SM2 ID from sig options before calling the real init routine */
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++) {
|
||||
char *sigopt = sk_OPENSSL_STRING_value(sigopts, i);
|
||||
if (pkey_ctrl_string(pctx, sigopt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", sigopt);
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
EVP_MD_CTX_set_pkey_ctx(ctx, pctx);
|
||||
}
|
||||
return 0;
|
||||
/*
|
||||
* EVP_PKEY_get_default_digest_nid() returns 2 if the digest is mandatory
|
||||
* for this algorithm.
|
||||
@@ -1720,36 +1700,8 @@ static int do_sign_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey,
|
||||
/* The signing algorithm requires there to be no digest */
|
||||
md = NULL;
|
||||
}
|
||||
if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey))
|
||||
goto err;
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++) {
|
||||
char *sigopt = sk_OPENSSL_STRING_value(sigopts, i);
|
||||
if (pkey_ctrl_string(pkctx, sigopt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", sigopt);
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
if (!ret)
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void do_sign_cleanup(EVP_MD_CTX *ctx, EVP_PKEY *pkey)
|
||||
{
|
||||
/*
|
||||
* With SM2, do_sign_init() attached an EVP_PKEY_CTX to the EVP_MD_CTX,
|
||||
* and we have to free it explicitly.
|
||||
*/
|
||||
if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) {
|
||||
EVP_PKEY_CTX *pctx = EVP_MD_CTX_pkey_ctx(ctx);
|
||||
|
||||
EVP_MD_CTX_set_pkey_ctx(ctx, NULL);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
}
|
||||
return EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey)
|
||||
&& do_pkey_ctx_init(pkctx, sigopts);
|
||||
}
|
||||
|
||||
int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
@@ -1758,10 +1710,8 @@ int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
int rv = 0;
|
||||
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
|
||||
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0) {
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0)
|
||||
rv = (X509_sign_ctx(x, mctx) > 0);
|
||||
do_sign_cleanup(mctx, pkey);
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv;
|
||||
}
|
||||
@@ -1772,24 +1722,39 @@ int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
int rv = 0;
|
||||
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
|
||||
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0) {
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0)
|
||||
rv = (X509_REQ_sign_ctx(x, mctx) > 0);
|
||||
do_sign_cleanup(mctx, pkey);
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (do_x509_init(x, vfyopts) > 0)
|
||||
rv = (X509_verify(x, pkey) > 0);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int do_X509_REQ_verify(X509_REQ *x, EVP_PKEY *pkey,
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (do_x509_req_init(x, vfyopts) > 0)
|
||||
rv = (X509_REQ_verify(x, pkey) > 0);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts)
|
||||
{
|
||||
int rv = 0;
|
||||
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
|
||||
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0) {
|
||||
if (do_sign_init(mctx, pkey, md, sigopts) > 0)
|
||||
rv = (X509_CRL_sign_ctx(x, mctx) > 0);
|
||||
do_sign_cleanup(mctx, pkey);
|
||||
}
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv;
|
||||
}
|
||||
+57
-52
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -8,23 +8,20 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_RSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <time.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/rsa.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/bn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -42,13 +39,13 @@ const OPTIONS rsa_options[] = {
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"check", OPT_CHECK, '-', "Verify key consistency"},
|
||||
{"", OPT_CIPHER, '-', "Any supported cipher"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, 's', "Input file"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format, one of DER PEM"},
|
||||
{"inform", OPT_INFORM, 'f', "Input format (DER/PEM/P12/ENGINE"},
|
||||
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
|
||||
{"RSAPublicKey_in", OPT_RSAPUBKEY_IN, '-', "Input is an RSAPublicKey"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
@@ -63,12 +60,12 @@ const OPTIONS rsa_options[] = {
|
||||
{"text", OPT_TEXT, '-', "Print the key in text"},
|
||||
{"modulus", OPT_MODULUS, '-', "Print the RSA key modulus"},
|
||||
|
||||
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
OPT_SECTION("PVK"),
|
||||
{"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
|
||||
{"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
|
||||
{"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_PROV_OPTIONS,
|
||||
{NULL}
|
||||
@@ -79,15 +76,17 @@ int rsa_main(int argc, char **argv)
|
||||
ENGINE *e = NULL;
|
||||
BIO *out = NULL;
|
||||
RSA *rsa = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *pctx;
|
||||
const EVP_CIPHER *enc = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *prog;
|
||||
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
|
||||
int i, private = 0;
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, check = 0;
|
||||
int noout = 0, modulus = 0, pubin = 0, pubout = 0, ret = 1;
|
||||
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
int pvk_encr = 2;
|
||||
# endif
|
||||
#endif
|
||||
OPTION_CHOICE o;
|
||||
|
||||
prog = opt_init(argc, argv, rsa_options);
|
||||
@@ -140,9 +139,9 @@ int rsa_main(int argc, char **argv)
|
||||
case OPT_PVK_STRONG: /* pvk_encr:= 2 */
|
||||
case OPT_PVK_WEAK: /* pvk_encr:= 1 */
|
||||
case OPT_PVK_NONE: /* pvk_encr:= 0 */
|
||||
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
|
||||
pvk_encr = (o - OPT_PVK_NONE);
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
case OPT_NOOUT:
|
||||
noout = 1;
|
||||
@@ -181,30 +180,26 @@ int rsa_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
{
|
||||
EVP_PKEY *pkey;
|
||||
if (pubin) {
|
||||
int tmpformat = -1;
|
||||
|
||||
if (pubin) {
|
||||
int tmpformat = -1;
|
||||
if (pubin == 2) {
|
||||
if (informat == FORMAT_PEM)
|
||||
tmpformat = FORMAT_PEMRSA;
|
||||
else if (informat == FORMAT_ASN1)
|
||||
tmpformat = FORMAT_ASN1RSA;
|
||||
} else {
|
||||
tmpformat = informat;
|
||||
}
|
||||
|
||||
pkey = load_pubkey(infile, tmpformat, 1, passin, e, "Public Key");
|
||||
if (pubin == 2) {
|
||||
if (informat == FORMAT_PEM)
|
||||
tmpformat = FORMAT_PEMRSA;
|
||||
else if (informat == FORMAT_ASN1)
|
||||
tmpformat = FORMAT_ASN1RSA;
|
||||
} else {
|
||||
pkey = load_key(infile, informat, 1, passin, e, "Private Key");
|
||||
tmpformat = informat;
|
||||
}
|
||||
|
||||
if (pkey != NULL)
|
||||
rsa = EVP_PKEY_get1_RSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = load_pubkey(infile, tmpformat, 1, passin, e, "Public Key");
|
||||
} else {
|
||||
pkey = load_key(infile, informat, 1, passin, e, "Private Key");
|
||||
}
|
||||
|
||||
if (pkey != NULL)
|
||||
rsa = EVP_PKEY_get1_RSA(pkey);
|
||||
|
||||
if (rsa == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -216,7 +211,8 @@ int rsa_main(int argc, char **argv)
|
||||
|
||||
if (text) {
|
||||
assert(pubin || private);
|
||||
if (!RSA_print(out, rsa, 0)) {
|
||||
if ((pubin && EVP_PKEY_print_public(out, pkey, 0, NULL) <= 0)
|
||||
|| (!pubin && EVP_PKEY_print_private(out, pkey, 0, NULL) <= 0)) {
|
||||
perror(outfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -232,7 +228,16 @@ int rsa_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (check) {
|
||||
int r = RSA_check_key_ex(rsa, NULL);
|
||||
int r;
|
||||
|
||||
pctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL);
|
||||
if (pctx == NULL) {
|
||||
BIO_printf(out, "RSA unable to create PKEY context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
r = EVP_PKEY_check(pctx);
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
|
||||
if (r == 1) {
|
||||
BIO_printf(out, "RSA key ok\n");
|
||||
@@ -278,7 +283,7 @@ int rsa_main(int argc, char **argv)
|
||||
i = PEM_write_bio_RSAPrivateKey(out, rsa,
|
||||
enc, NULL, 0, NULL, passout);
|
||||
}
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
|
||||
EVP_PKEY *pk;
|
||||
pk = EVP_PKEY_new();
|
||||
@@ -293,13 +298,13 @@ int rsa_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
assert(private);
|
||||
# ifdef OPENSSL_NO_RC4
|
||||
# ifdef OPENSSL_NO_RC4
|
||||
BIO_printf(bio_err, "PVK format not supported\n");
|
||||
EVP_PKEY_free(pk);
|
||||
goto end;
|
||||
# else
|
||||
# else
|
||||
i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
|
||||
# endif
|
||||
# endif
|
||||
} else if (pubin || pubout) {
|
||||
i = i2b_PublicKey_bio(out, pk);
|
||||
} else {
|
||||
@@ -307,7 +312,7 @@ int rsa_main(int argc, char **argv)
|
||||
i = i2b_PrivateKey_bio(out, pk);
|
||||
}
|
||||
EVP_PKEY_free(pk);
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
BIO_printf(bio_err, "bad output format specified for outfile\n");
|
||||
goto end;
|
||||
@@ -321,9 +326,9 @@ int rsa_main(int argc, char **argv)
|
||||
end:
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(pkey);
|
||||
RSA_free(rsa);
|
||||
OPENSSL_free(passin);
|
||||
OPENSSL_free(passout);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+1
-3
@@ -1,5 +1,4 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
|
||||
MIISKAIBAAKCBAEAiQ2f1X6Bte1DKD0OoCBKEikzPW+5w3oXk3WwnE97Wxzy6wJZ
|
||||
ebbZC3CZKKBnJeBMrysPf+lK+9+fP6Vm8bp1wvbcSIA59BDrX6irFSuM/bdnkbuF
|
||||
MFlDjt+uVrxwoyqfPi2IPot1HQg3l5mdyBqcTWvbOnU2L9HZxJfPUCjfzdTMPrMY
|
||||
@@ -62,7 +61,7 @@ JH1/Qx7C/mTAMRsN5SkOthnGq0djCNWfPv/3JV0H67Uf5krFlnwLebrgfTYoPPdo
|
||||
yO7iBUNJzv6Qh22malLp4P8gzACkD7DGlSTnoB5cLwcjmDGg+i9WrUBbOiVTeQfZ
|
||||
kOj1o+Tz35ndpq/DDUVlqliB9krcxva+QHeJPH53EGI+YVg1nD+s/vUDZ3mQMGX9
|
||||
DQou2L8uU6RnWNv/BihGcL8QvS4Ty6QyPOUPpD3zc70JQAEcQk9BxQNaELgJX0IN
|
||||
22cYn22tYvElew9G41OpDqzBRcfbdJmKXQ2HcroShutYJQRGUpAXHk24fy6JVkIU
|
||||
2cYUn22tYvElew9G41OpDqzBRcfbdJmKXQ2HcroShutYJQRGUpAXHk24fy6JVkIU
|
||||
ojF5U6cwextMja1ZIIZgh9eugIRUeIE7319nQNDzuXWjRCcoBLA25P7wnpHWDRpz
|
||||
D9ovXCIvdja74lL5psqobV6L5+fbLPkSgXoImKR0LQKCAgAIC9Jk8kxumCyIVGCP
|
||||
PeM5Uby9M3GMuKrfYsn0Y5e97+kSJF1dpojTodBgR2KQar6eVrvXt+8uZCcIjfx8
|
||||
@@ -98,4 +97,3 @@ TwEgE67iOb2iIoUpon/NyP4LesMzvdpsu2JFlfz13PmmQ34mFI7tWvOb3NA5DP3c
|
||||
rMlMLtKfp2w8HlMZpsUlToNCx6CI+tJrohzcs3BAVAbjFAXRKWGijB1rxwyDdHPv
|
||||
I+/wJTNaRNPQ1M0SwtEL/zJd21y3KSPn4eL+GP3efhlDSjtlDvZqkdAUsU8=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
+19
-23
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2020 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
|
||||
@@ -8,25 +8,22 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_RSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <string.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/rsa.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <string.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
# define RSA_SIGN 1
|
||||
# define RSA_VERIFY 2
|
||||
# define RSA_ENCRYPT 3
|
||||
# define RSA_DECRYPT 4
|
||||
#define RSA_SIGN 1
|
||||
#define RSA_VERIFY 2
|
||||
#define RSA_ENCRYPT 3
|
||||
#define RSA_DECRYPT 4
|
||||
|
||||
# define KEY_PRIVKEY 1
|
||||
# define KEY_PUBKEY 2
|
||||
# define KEY_CERT 3
|
||||
#define KEY_PRIVKEY 1
|
||||
#define KEY_PUBKEY 2
|
||||
#define KEY_CERT 3
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
@@ -44,14 +41,14 @@ const OPTIONS rsautl_options[] = {
|
||||
{"verify", OPT_VERIFY, '-', "Verify with public key"},
|
||||
{"encrypt", OPT_ENCRYPT, '-', "Encrypt with public key"},
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt with private key"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"inkey", OPT_INKEY, 's', "Input key"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format (ENGINE, other values ignored)"},
|
||||
{"pubin", OPT_PUBIN, '-', "Input is an RSA public"},
|
||||
{"certin", OPT_CERTIN, '-', "Input is a cert carrying an RSA public key"},
|
||||
{"rev", OPT_REV, '-', "Reverse the order of the input buffer"},
|
||||
@@ -101,7 +98,7 @@ int rsautl_main(int argc, char **argv)
|
||||
ret = 0;
|
||||
goto end;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &keyformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &keyformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_IN:
|
||||
@@ -197,7 +194,7 @@ int rsautl_main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case KEY_CERT:
|
||||
x = load_cert(keyfile, keyformat, "Certificate");
|
||||
x = load_cert(keyfile, FORMAT_UNDEF, "Certificate");
|
||||
if (x) {
|
||||
pkey = X509_get_pubkey(x);
|
||||
X509_free(x);
|
||||
@@ -290,4 +287,3 @@ int rsautl_main(int argc, char **argv)
|
||||
OPENSSL_free(passin);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+199
-86
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2005 Nokia. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -56,6 +56,12 @@ typedef unsigned int u_int;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509_NAME)
|
||||
DEFINE_STACK_OF(SCT)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#undef BUFSIZZ
|
||||
#define BUFSIZZ 1024*8
|
||||
#define S_CLIENT_IRC_READ_TIMEOUT 8
|
||||
@@ -75,6 +81,7 @@ static void print_stuff(BIO *berr, SSL *con, int full);
|
||||
static int ocsp_resp_cb(SSL *s, void *arg);
|
||||
#endif
|
||||
static int ldap_ExtendedResponse_parse(const char *buf, long rem);
|
||||
static char *base64encode (const void *buf, size_t len);
|
||||
static int is_dNS_name(const char *host);
|
||||
|
||||
static int saved_errno;
|
||||
@@ -92,27 +99,6 @@ static int restore_errno(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void do_ssl_shutdown(SSL *ssl)
|
||||
{
|
||||
int ret;
|
||||
|
||||
do {
|
||||
/* We only do unidirectional shutdown */
|
||||
ret = SSL_shutdown(ssl);
|
||||
if (ret < 0) {
|
||||
switch (SSL_get_error(ssl, ret)) {
|
||||
case SSL_ERROR_WANT_READ:
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
case SSL_ERROR_WANT_ASYNC:
|
||||
case SSL_ERROR_WANT_ASYNC_JOB:
|
||||
/* We just do busy waiting. Nothing clever */
|
||||
continue;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
} while (ret < 0);
|
||||
}
|
||||
|
||||
/* Default PSK identity and key */
|
||||
static char *psk_identity = "Client_identity";
|
||||
|
||||
@@ -591,7 +577,7 @@ typedef enum OPTION_choice {
|
||||
OPT_READ_BUF, OPT_KEYLOG_FILE, OPT_EARLY_DATA, OPT_REQCAFILE,
|
||||
OPT_V_ENUM,
|
||||
OPT_X_ENUM,
|
||||
OPT_S_ENUM,
|
||||
OPT_S_ENUM, OPT_IGNORE_UNEXPECTED_EOF,
|
||||
OPT_FALLBACKSCSV, OPT_NOCMDS, OPT_PROXY, OPT_PROXY_USER, OPT_PROXY_PASS,
|
||||
OPT_DANE_TLSA_DOMAIN,
|
||||
#ifndef OPENSSL_NO_CT
|
||||
@@ -649,14 +635,17 @@ const OPTIONS s_client_options[] = {
|
||||
{"fallback_scsv", OPT_FALLBACKSCSV, '-', "Send the fallback SCSV"},
|
||||
|
||||
OPT_SECTION("Identity"),
|
||||
{"verify", OPT_VERIFY, 'p', "Turn on peer certificate verification"},
|
||||
{"cert", OPT_CERT, '<', "Certificate file to use, PEM format assumed"},
|
||||
{"cert", OPT_CERT, '<', "Client certificate file to use"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
"Certificate format (PEM or DER) PEM default"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"key", OPT_KEY, 's', "Private key file to use, if not in -cert file"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Key format (PEM, DER or engine) PEM default"},
|
||||
"Client certificate file format (PEM/DER/P12); has no effect"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"Client certificate chain file (in PEM format)"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build client certificate chain"},
|
||||
{"key", OPT_KEY, 's', "Private key file to use; default is: -cert file"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Key format (ENGINE, other values ignored)"},
|
||||
{"pass", OPT_PASS, 's', "Private key file pass phrase source"},
|
||||
{"verify", OPT_VERIFY, 'p', "Turn on peer certificate verification"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to store of CA's"},
|
||||
@@ -730,6 +719,8 @@ const OPTIONS s_client_options[] = {
|
||||
"Do not send the server name (SNI) extension in the ClientHello"},
|
||||
{"tlsextdebug", OPT_TLSEXTDEBUG, '-',
|
||||
"Hex dump of all TLS extensions received"},
|
||||
{"ignore_unexpected_eof", OPT_IGNORE_UNEXPECTED_EOF, '-',
|
||||
"Do not treat lack of close_notify from a peer as an error"},
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
{"status", OPT_STATUS, '-', "Request certificate status from server"},
|
||||
#endif
|
||||
@@ -801,8 +792,8 @@ const OPTIONS s_client_options[] = {
|
||||
{"verify_return_error", OPT_VERIFY_RET_ERROR, '-',
|
||||
"Close connection on verification error"},
|
||||
{"verify_quiet", OPT_VERIFY_QUIET, '-', "Restrict verify output to errors"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"Certificate chain file (in PEM format)"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
{"chainCApath", OPT_CHAINCAPATH, '/',
|
||||
"Use dir as certificate store path to build CA certificate chain"},
|
||||
{"chainCAstore", OPT_CHAINCASTORE, ':',
|
||||
@@ -813,9 +804,6 @@ const OPTIONS s_client_options[] = {
|
||||
"Use dir as certificate store path to verify CA certificate"},
|
||||
{"verifyCAstore", OPT_VERIFYCASTORE, ':',
|
||||
"CA store URI for certificate verification"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
OPT_X_OPTIONS,
|
||||
OPT_PROV_OPTIONS,
|
||||
|
||||
@@ -934,6 +922,7 @@ int s_client_main(int argc, char **argv)
|
||||
char *connectstr = NULL, *bindstr = NULL;
|
||||
char *cert_file = NULL, *key_file = NULL, *chain_file = NULL;
|
||||
char *chCApath = NULL, *chCAfile = NULL, *chCAstore = NULL, *host = NULL;
|
||||
char *thost = NULL, *tport = NULL;
|
||||
char *port = OPENSSL_strdup(PORT);
|
||||
char *bindhost = NULL, *bindport = NULL;
|
||||
char *passarg = NULL, *pass = NULL;
|
||||
@@ -949,7 +938,7 @@ int s_client_main(int argc, char **argv)
|
||||
int prexit = 0;
|
||||
int sdebug = 0;
|
||||
int reconnect = 0, verify = SSL_VERIFY_NONE, vpmtouched = 0;
|
||||
int ret = 1, in_init = 1, i, nbio_test = 0, sock = -1, k, width, state = 0;
|
||||
int ret = 1, in_init = 1, i, nbio_test = 0, s = -1, k, width, state = 0;
|
||||
int sbuf_len, sbuf_off, cmdletters = 1;
|
||||
int socket_family = AF_UNSPEC, socket_type = SOCK_STREAM, protocol = 0;
|
||||
int starttls_proto = PROTO_OFF, crl_format = FORMAT_PEM, crl_download = 0;
|
||||
@@ -1016,6 +1005,7 @@ int s_client_main(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
int sctp_label_bug = 0;
|
||||
#endif
|
||||
int ignore_unexpected_eof = 0;
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
@@ -1159,7 +1149,7 @@ int s_client_main(int argc, char **argv)
|
||||
sess_in = opt_arg();
|
||||
break;
|
||||
case OPT_CERTFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &cert_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &cert_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_CRLFORM:
|
||||
@@ -1195,6 +1185,9 @@ int s_client_main(int argc, char **argv)
|
||||
if (!args_excert(o, &exc))
|
||||
goto end;
|
||||
break;
|
||||
case OPT_IGNORE_UNEXPECTED_EOF:
|
||||
ignore_unexpected_eof = 1;
|
||||
break;
|
||||
case OPT_PREXIT:
|
||||
prexit = 1;
|
||||
break;
|
||||
@@ -1393,7 +1386,7 @@ int s_client_main(int argc, char **argv)
|
||||
fallback_scsv = 1;
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &key_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &key_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_PASS:
|
||||
@@ -1608,29 +1601,12 @@ int s_client_main(int argc, char **argv)
|
||||
goto opthelp;
|
||||
}
|
||||
#endif
|
||||
if (proxystr != NULL) {
|
||||
|
||||
if (connectstr != NULL) {
|
||||
int res;
|
||||
char *tmp_host = host, *tmp_port = port;
|
||||
if (connectstr == NULL) {
|
||||
BIO_printf(bio_err, "%s: -proxy requires use of -connect or target parameter\n", prog);
|
||||
goto opthelp;
|
||||
}
|
||||
res = BIO_parse_hostserv(proxystr, &host, &port, BIO_PARSE_PRIO_HOST);
|
||||
if (tmp_host != host)
|
||||
OPENSSL_free(tmp_host);
|
||||
if (tmp_port != port)
|
||||
OPENSSL_free(tmp_port);
|
||||
if (!res) {
|
||||
BIO_printf(bio_err,
|
||||
"%s: -proxy argument malformed or ambiguous\n", prog);
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
int res = 1;
|
||||
char *tmp_host = host, *tmp_port = port;
|
||||
if (connectstr != NULL)
|
||||
res = BIO_parse_hostserv(connectstr, &host, &port,
|
||||
BIO_PARSE_PRIO_HOST);
|
||||
|
||||
res = BIO_parse_hostserv(connectstr, &host, &port, BIO_PARSE_PRIO_HOST);
|
||||
if (tmp_host != host)
|
||||
OPENSSL_free(tmp_host);
|
||||
if (tmp_port != port)
|
||||
@@ -1643,6 +1619,35 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (proxystr != NULL) {
|
||||
int res;
|
||||
char *tmp_host = host, *tmp_port = port;
|
||||
|
||||
if (host == NULL || port == NULL) {
|
||||
BIO_printf(bio_err, "%s: -proxy requires use of -connect or target parameter\n", prog);
|
||||
goto opthelp;
|
||||
}
|
||||
|
||||
/* Retain the original target host:port for use in the HTTP proxy connect string */
|
||||
thost = OPENSSL_strdup(host);
|
||||
tport = OPENSSL_strdup(port);
|
||||
if (thost == NULL || tport == NULL) {
|
||||
BIO_printf(bio_err, "%s: out of memory\n", prog);
|
||||
goto end;
|
||||
}
|
||||
|
||||
res = BIO_parse_hostserv(proxystr, &host, &port, BIO_PARSE_PRIO_HOST);
|
||||
if (tmp_host != host)
|
||||
OPENSSL_free(tmp_host);
|
||||
if (tmp_port != port)
|
||||
OPENSSL_free(tmp_port);
|
||||
if (!res) {
|
||||
BIO_printf(bio_err,
|
||||
"%s: -proxy argument malformed or ambiguous\n", prog);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (bindstr != NULL) {
|
||||
int res;
|
||||
res = BIO_parse_hostserv(bindstr, &bindhost, &bindport,
|
||||
@@ -1708,18 +1713,14 @@ int s_client_main(int argc, char **argv)
|
||||
if (key_file != NULL) {
|
||||
key = load_key(key_file, key_format, 0, pass, e,
|
||||
"client certificate private key file");
|
||||
if (key == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (key == NULL)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (cert_file != NULL) {
|
||||
cert = load_cert(cert_file, cert_format, "client certificate file");
|
||||
if (cert == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (cert == NULL)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (chain_file != NULL) {
|
||||
@@ -1730,12 +1731,9 @@ int s_client_main(int argc, char **argv)
|
||||
|
||||
if (crl_file != NULL) {
|
||||
X509_CRL *crl;
|
||||
crl = load_crl(crl_file, crl_format);
|
||||
if (crl == NULL) {
|
||||
BIO_puts(bio_err, "Error loading CRL\n");
|
||||
ERR_print_errors(bio_err);
|
||||
crl = load_crl(crl_file, crl_format, "CRL");
|
||||
if (crl == NULL)
|
||||
goto end;
|
||||
}
|
||||
crls = sk_X509_CRL_new_null();
|
||||
if (crls == NULL || !sk_X509_CRL_push(crls, crl)) {
|
||||
BIO_puts(bio_err, "Error adding CRL\n");
|
||||
@@ -1798,6 +1796,9 @@ int s_client_main(int argc, char **argv)
|
||||
&& SSL_CTX_set_max_proto_version(ctx, max_version) == 0)
|
||||
goto end;
|
||||
|
||||
if (ignore_unexpected_eof)
|
||||
SSL_CTX_set_options(ctx, SSL_OP_IGNORE_UNEXPECTED_EOF);
|
||||
|
||||
if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
|
||||
BIO_printf(bio_err, "Error setting verify params\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -2099,16 +2100,16 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
re_start:
|
||||
if (init_client(&sock, host, port, bindhost, bindport, socket_family,
|
||||
if (init_client(&s, host, port, bindhost, bindport, socket_family,
|
||||
socket_type, protocol) == 0) {
|
||||
BIO_printf(bio_err, "connect:errno=%d\n", get_last_socket_error());
|
||||
BIO_closesocket(sock);
|
||||
BIO_closesocket(s);
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(bio_c_out, "CONNECTED(%08X)\n", sock);
|
||||
BIO_printf(bio_c_out, "CONNECTED(%08X)\n", s);
|
||||
|
||||
if (c_nbio) {
|
||||
if (!BIO_socket_nbio(sock, 1)) {
|
||||
if (!BIO_socket_nbio(s, 1)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@@ -2120,21 +2121,21 @@ int s_client_main(int argc, char **argv)
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
if (protocol == IPPROTO_SCTP)
|
||||
sbio = BIO_new_dgram_sctp(sock, BIO_NOCLOSE);
|
||||
sbio = BIO_new_dgram_sctp(s, BIO_NOCLOSE);
|
||||
else
|
||||
#endif
|
||||
sbio = BIO_new_dgram(sock, BIO_NOCLOSE);
|
||||
sbio = BIO_new_dgram(s, BIO_NOCLOSE);
|
||||
|
||||
if ((peer_info.addr = BIO_ADDR_new()) == NULL) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
BIO_closesocket(sock);
|
||||
BIO_closesocket(s);
|
||||
goto end;
|
||||
}
|
||||
if (!BIO_sock_info(sock, BIO_SOCK_INFO_ADDRESS, &peer_info)) {
|
||||
if (!BIO_sock_info(s, BIO_SOCK_INFO_ADDRESS, &peer_info)) {
|
||||
BIO_printf(bio_err, "getsockname:errno=%d\n",
|
||||
get_last_socket_error());
|
||||
BIO_ADDR_free(peer_info.addr);
|
||||
BIO_closesocket(sock);
|
||||
BIO_closesocket(s);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -2171,7 +2172,7 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
} else
|
||||
#endif /* OPENSSL_NO_DTLS */
|
||||
sbio = BIO_new_socket(sock, BIO_NOCLOSE);
|
||||
sbio = BIO_new_socket(s, BIO_NOCLOSE);
|
||||
|
||||
if (nbio_test) {
|
||||
BIO *test;
|
||||
@@ -2402,9 +2403,83 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case PROTO_CONNECT:
|
||||
if (!OSSL_HTTP_proxy_connect(sbio, host, port, proxyuser, proxypass,
|
||||
0 /* no timeout */, bio_err, prog))
|
||||
goto shut;
|
||||
{
|
||||
enum {
|
||||
error_proto, /* Wrong protocol, not even HTTP */
|
||||
error_connect, /* CONNECT failed */
|
||||
success
|
||||
} foundit = error_connect;
|
||||
BIO *fbio = BIO_new(BIO_f_buffer());
|
||||
|
||||
BIO_push(fbio, sbio);
|
||||
BIO_printf(fbio, "CONNECT %s HTTP/1.0\r\n", connectstr);
|
||||
/*
|
||||
* Workaround for broken proxies which would otherwise close
|
||||
* the connection when entering tunnel mode (eg Squid 2.6)
|
||||
*/
|
||||
BIO_printf(fbio, "Proxy-Connection: Keep-Alive\r\n");
|
||||
|
||||
/* Support for basic (base64) proxy authentication */
|
||||
if (proxyuser != NULL) {
|
||||
size_t l;
|
||||
char *proxyauth, *proxyauthenc;
|
||||
|
||||
l = strlen(proxyuser);
|
||||
if (proxypass != NULL)
|
||||
l += strlen(proxypass);
|
||||
proxyauth = app_malloc(l + 2, "Proxy auth string");
|
||||
BIO_snprintf(proxyauth, l + 2, "%s:%s", proxyuser,
|
||||
(proxypass != NULL) ? proxypass : "");
|
||||
proxyauthenc = base64encode(proxyauth, strlen(proxyauth));
|
||||
BIO_printf(fbio, "Proxy-Authorization: Basic %s\r\n",
|
||||
proxyauthenc);
|
||||
OPENSSL_clear_free(proxyauth, strlen(proxyauth));
|
||||
OPENSSL_clear_free(proxyauthenc, strlen(proxyauthenc));
|
||||
}
|
||||
|
||||
/* Terminate the HTTP CONNECT request */
|
||||
BIO_printf(fbio, "\r\n");
|
||||
(void)BIO_flush(fbio);
|
||||
/*
|
||||
* The first line is the HTTP response. According to RFC 7230,
|
||||
* it's formatted exactly like this:
|
||||
*
|
||||
* HTTP/d.d ddd Reason text\r\n
|
||||
*/
|
||||
mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
|
||||
if (mbuf_len < (int)strlen("HTTP/1.0 200")) {
|
||||
BIO_printf(bio_err,
|
||||
"%s: HTTP CONNECT failed, insufficient response "
|
||||
"from proxy (got %d octets)\n", prog, mbuf_len);
|
||||
(void)BIO_flush(fbio);
|
||||
BIO_pop(fbio);
|
||||
BIO_free(fbio);
|
||||
goto shut;
|
||||
}
|
||||
if (mbuf[8] != ' ') {
|
||||
BIO_printf(bio_err,
|
||||
"%s: HTTP CONNECT failed, incorrect response "
|
||||
"from proxy\n", prog);
|
||||
foundit = error_proto;
|
||||
} else if (mbuf[9] != '2') {
|
||||
BIO_printf(bio_err, "%s: HTTP CONNECT failed: %s ", prog,
|
||||
&mbuf[9]);
|
||||
} else {
|
||||
foundit = success;
|
||||
}
|
||||
if (foundit != error_proto) {
|
||||
/* Read past all following headers */
|
||||
do {
|
||||
mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
|
||||
} while (mbuf_len > 2);
|
||||
}
|
||||
(void)BIO_flush(fbio);
|
||||
BIO_pop(fbio);
|
||||
BIO_free(fbio);
|
||||
if (foundit != success) {
|
||||
goto shut;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROTO_IRC:
|
||||
{
|
||||
@@ -3122,8 +3197,8 @@ int s_client_main(int argc, char **argv)
|
||||
timeout.tv_usec = 500000; /* some extreme round-trip */
|
||||
do {
|
||||
FD_ZERO(&readfds);
|
||||
openssl_fdset(sock, &readfds);
|
||||
} while (select(sock + 1, &readfds, NULL, NULL, &timeout) > 0
|
||||
openssl_fdset(s, &readfds);
|
||||
} while (select(s + 1, &readfds, NULL, NULL, &timeout) > 0
|
||||
&& BIO_read(sbio, sbuf, BUFSIZZ) > 0);
|
||||
|
||||
BIO_closesocket(SSL_get_fd(con));
|
||||
@@ -3151,6 +3226,8 @@ int s_client_main(int argc, char **argv)
|
||||
OPENSSL_free(bindstr);
|
||||
OPENSSL_free(host);
|
||||
OPENSSL_free(port);
|
||||
OPENSSL_free(thost);
|
||||
OPENSSL_free(tport);
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
ssl_excert_free(exc);
|
||||
sk_OPENSSL_STRING_free(ssl_args);
|
||||
@@ -3159,8 +3236,7 @@ int s_client_main(int argc, char **argv)
|
||||
OPENSSL_clear_free(cbuf, BUFSIZZ);
|
||||
OPENSSL_clear_free(sbuf, BUFSIZZ);
|
||||
OPENSSL_clear_free(mbuf, BUFSIZZ);
|
||||
if (proxypass != NULL)
|
||||
OPENSSL_clear_free(proxypass, strlen(proxypass));
|
||||
clear_free(proxypass);
|
||||
release_engine(e);
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out = NULL;
|
||||
@@ -3174,6 +3250,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
X509 *peer = NULL;
|
||||
STACK_OF(X509) *sk;
|
||||
const SSL_CIPHER *c;
|
||||
EVP_PKEY *public_key;
|
||||
int i, istls13 = (SSL_version(s) == TLS1_3_VERSION);
|
||||
long verify_result;
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
@@ -3199,6 +3276,19 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
BIO_printf(bio, " i:");
|
||||
X509_NAME_print_ex(bio, X509_get_issuer_name(sk_X509_value(sk, i)), 0, get_nameopt());
|
||||
BIO_puts(bio, "\n");
|
||||
public_key = X509_get_pubkey(sk_X509_value(sk, i));
|
||||
if (public_key != NULL) {
|
||||
BIO_printf(bio, " a:PKEY: %s, %d (bit); sigalg: %s\n",
|
||||
OBJ_nid2sn(EVP_PKEY_base_id(public_key)),
|
||||
EVP_PKEY_bits(public_key),
|
||||
OBJ_nid2sn(X509_get_signature_nid(sk_X509_value(sk, i))));
|
||||
EVP_PKEY_free(public_key);
|
||||
}
|
||||
BIO_printf(bio, " v:NotBefore: ");
|
||||
ASN1_TIME_print(bio, X509_get0_notBefore(sk_X509_value(sk, i)));
|
||||
BIO_printf(bio, "; NotAfter: ");
|
||||
ASN1_TIME_print(bio, X509_get0_notAfter(sk_X509_value(sk, i)));
|
||||
BIO_puts(bio, "\n");
|
||||
if (c_showcerts)
|
||||
PEM_write_bio_X509(bio, sk_X509_value(sk, i));
|
||||
}
|
||||
@@ -3500,6 +3590,29 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* BASE64 encoder: used only for encoding basic proxy authentication credentials
|
||||
*/
|
||||
static char *base64encode (const void *buf, size_t len)
|
||||
{
|
||||
int i;
|
||||
size_t outl;
|
||||
char *out;
|
||||
|
||||
/* Calculate size of encoded data */
|
||||
outl = (len / 3);
|
||||
if (len % 3 > 0)
|
||||
outl++;
|
||||
outl <<= 2;
|
||||
out = app_malloc(outl + 1, "base64 encode buffer");
|
||||
|
||||
i = EVP_EncodeBlock((unsigned char *)out, buf, len);
|
||||
assert(i <= (int)outl);
|
||||
if (i < 0)
|
||||
*out = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Host dNS Name verifier: used for checking that the hostname is in dNS format
|
||||
* before setting it as SNI
|
||||
|
||||
+169
-93
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
* Copyright 2005 Nokia. All rights reserved.
|
||||
*
|
||||
@@ -60,6 +60,12 @@ typedef unsigned int u_int;
|
||||
#endif
|
||||
#include "internal/sockets.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(SSL_CIPHER)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static int not_resumable_sess_cb(SSL *s, int is_forward_secure);
|
||||
static int sv_body(int s, int stype, int prot, unsigned char *context);
|
||||
static int www_body(int s, int stype, int prot, unsigned char *context);
|
||||
@@ -103,6 +109,8 @@ static int keymatexportlen = 20;
|
||||
|
||||
static int async = 0;
|
||||
|
||||
static int use_sendfile = 0;
|
||||
|
||||
static const char *session_id_prefix = NULL;
|
||||
|
||||
#ifndef OPENSSL_NO_DTLS
|
||||
@@ -526,8 +534,8 @@ static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx,
|
||||
x = SSL_get_certificate(s);
|
||||
aia = X509_get1_ocsp(x);
|
||||
if (aia != NULL) {
|
||||
if (!OSSL_HTTP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
|
||||
&host, &port, &path, &use_ssl)) {
|
||||
if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
|
||||
&host, &port, &path, &use_ssl)) {
|
||||
BIO_puts(bio_err, "cert_status: can't parse AIA URL\n");
|
||||
goto err;
|
||||
}
|
||||
@@ -707,7 +715,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
|
||||
if (SSL_select_next_proto
|
||||
((unsigned char **)out, outlen, alpn_ctx->data, alpn_ctx->len, in,
|
||||
inlen) != OPENSSL_NPN_NEGOTIATED) {
|
||||
return SSL_TLSEXT_ERR_NOACK;
|
||||
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
||||
}
|
||||
|
||||
if (!s_quiet) {
|
||||
@@ -749,11 +757,11 @@ typedef enum OPTION_choice {
|
||||
OPT_SSL3, OPT_TLS1_3, OPT_TLS1_2, OPT_TLS1_1, OPT_TLS1, OPT_DTLS, OPT_DTLS1,
|
||||
OPT_DTLS1_2, OPT_SCTP, OPT_TIMEOUT, OPT_MTU, OPT_LISTEN, OPT_STATELESS,
|
||||
OPT_ID_PREFIX, OPT_SERVERNAME, OPT_SERVERNAME_FATAL,
|
||||
OPT_CERT2, OPT_KEY2, OPT_NEXTPROTONEG, OPT_ALPN,
|
||||
OPT_CERT2, OPT_KEY2, OPT_NEXTPROTONEG, OPT_ALPN, OPT_SENDFILE,
|
||||
OPT_SRTP_PROFILES, OPT_KEYMATEXPORT, OPT_KEYMATEXPORTLEN,
|
||||
OPT_KEYLOG_FILE, OPT_MAX_EARLY, OPT_RECV_MAX_EARLY, OPT_EARLY_DATA,
|
||||
OPT_S_NUM_TICKETS, OPT_ANTI_REPLAY, OPT_NO_ANTI_REPLAY, OPT_SCTP_LABEL_BUG,
|
||||
OPT_HTTP_SERVER_BINMODE,
|
||||
OPT_HTTP_SERVER_BINMODE, OPT_NOCANAMES, OPT_IGNORE_UNEXPECTED_EOF,
|
||||
OPT_R_ENUM,
|
||||
OPT_S_ENUM,
|
||||
OPT_V_ENUM,
|
||||
@@ -800,31 +808,35 @@ const OPTIONS s_server_options[] = {
|
||||
{"verify", OPT_VERIFY, 'n', "Turn on peer certificate verification"},
|
||||
{"Verify", OPT_UPPER_V_VERIFY, 'n',
|
||||
"Turn on peer certificate verification, must have a cert"},
|
||||
{"cert", OPT_CERT, '<', "Certificate file to use; default is " TEST_CERT},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
{"cert", OPT_CERT, '<', "Server certificate file to use; default is " TEST_CERT},
|
||||
{"cert2", OPT_CERT2, '<',
|
||||
"Certificate file to use for servername; default is" TEST_CERT2},
|
||||
{"key2", OPT_KEY2, '<',
|
||||
"-Private Key file to use for servername if not in -cert2"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
"Server certificate file format (PEM/DER/P12); has no effect"},
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"Server certificate chain file in PEM format"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build server certificate chain"},
|
||||
{"serverinfo", OPT_SERVERINFO, 's',
|
||||
"PEM serverinfo file for certificate"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
"Certificate format (PEM or DER) PEM default"},
|
||||
{"key", OPT_KEY, 's',
|
||||
"Private Key if not in -cert; default is " TEST_CERT},
|
||||
{"keyform", OPT_KEYFORM, 'f',
|
||||
"Key format (PEM, DER or ENGINE) PEM default"},
|
||||
"Private key file to use; default is -cert file or else" TEST_CERT},
|
||||
{"key2", OPT_KEY2, '<',
|
||||
"-Private Key file to use for servername if not in -cert2"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Key format (ENGINE, other values ignored)"},
|
||||
{"pass", OPT_PASS, 's', "Private key file pass phrase source"},
|
||||
{"dcert", OPT_DCERT, '<',
|
||||
"Second certificate file to use (usually for DSA)"},
|
||||
{"dhparam", OPT_DHPARAM, '<', "DH parameters file to use"},
|
||||
"Second server certificate file to use (usually for DSA)"},
|
||||
{"dcertform", OPT_DCERTFORM, 'F',
|
||||
"Second certificate format (PEM or DER) PEM default"},
|
||||
"Second server certificate file format (PEM/DER/P12); has no effect"},
|
||||
{"dcert_chain", OPT_DCERT_CHAIN, '<',
|
||||
"second server certificate chain file in PEM format"},
|
||||
{"dkey", OPT_DKEY, '<',
|
||||
"Second private key file to use (usually for DSA)"},
|
||||
{"dkeyform", OPT_DKEYFORM, 'F',
|
||||
"Second key format (PEM, DER or ENGINE) PEM default"},
|
||||
"Second key file format (ENGINE, other values ignored)"},
|
||||
{"dpass", OPT_DPASS, 's', "Second private key file pass phrase source"},
|
||||
{"dhparam", OPT_DHPARAM, '<', "DH parameters file to use"},
|
||||
{"servername", OPT_SERVERNAME, 's',
|
||||
"Servername for HostName TLS extension"},
|
||||
{"servername_fatal", OPT_SERVERNAME_FATAL, '-',
|
||||
@@ -838,6 +850,8 @@ const OPTIONS s_server_options[] = {
|
||||
"Disable caching and tickets if ephemeral (EC)DH is used"},
|
||||
{"www", OPT_WWW, '-', "Respond to a 'GET /' with a status page"},
|
||||
{"WWW", OPT_UPPER_WWW, '-', "Respond to a 'GET with the file ./path"},
|
||||
{"ignore_unexpected_eof", OPT_IGNORE_UNEXPECTED_EOF, '-',
|
||||
"Do not treat lack of close_notify from a peer as an error"},
|
||||
{"tlsextdebug", OPT_TLSEXTDEBUG, '-',
|
||||
"Hex dump of all TLS extensions received"},
|
||||
{"HTTP", OPT_HTTP, '-', "Like -WWW but ./path includes HTTP headers"},
|
||||
@@ -848,12 +862,17 @@ const OPTIONS s_server_options[] = {
|
||||
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
||||
"Export len bytes of keying material (default 20)"},
|
||||
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
||||
{"CRLform", OPT_CRLFORM, 'F', "CRL file format (PEM or DER); default PEM"},
|
||||
{"crl_download", OPT_CRL_DOWNLOAD, '-',
|
||||
"Download CRL from distribution points"},
|
||||
"Download CRLs from distribution points in certificate CDP entries"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
{"chainCApath", OPT_CHAINCAPATH, '/',
|
||||
"use dir as certificate store path to build CA certificate chain"},
|
||||
{"chainCAstore", OPT_CHAINCASTORE, ':',
|
||||
"use URI as certificate store to build CA certificate chain"},
|
||||
{"verifyCAfile", OPT_VERIFYCAFILE, '<',
|
||||
"CA file for certificate verification (PEM format)"},
|
||||
{"verifyCApath", OPT_VERIFYCAPATH, '/',
|
||||
"use dir as certificate store path to verify CA certificate"},
|
||||
{"verifyCAstore", OPT_VERIFYCASTORE, ':',
|
||||
@@ -861,13 +880,10 @@ const OPTIONS s_server_options[] = {
|
||||
{"no_cache", OPT_NO_CACHE, '-', "Disable session cache"},
|
||||
{"ext_cache", OPT_EXT_CACHE, '-',
|
||||
"Disable internal cache, setup and use external cache"},
|
||||
{"CRLform", OPT_CRLFORM, 'F', "CRL format (PEM or DER) PEM is default"},
|
||||
{"verify_return_error", OPT_VERIFY_RET_ERROR, '-',
|
||||
"Close connection on verification error"},
|
||||
{"verify_quiet", OPT_VERIFY_QUIET, '-',
|
||||
"No verify output except verify errors"},
|
||||
{"verifyCAfile", OPT_VERIFYCAFILE, '<',
|
||||
"CA file for certificate verification (PEM format)"},
|
||||
{"ign_eof", OPT_IGN_EOF, '-', "ignore input eof (default when -quiet)"},
|
||||
{"no_ign_eof", OPT_NO_IGN_EOF, '-', "Do not ignore input eof"},
|
||||
|
||||
@@ -937,6 +953,8 @@ const OPTIONS s_server_options[] = {
|
||||
{"anti_replay", OPT_ANTI_REPLAY, '-', "Switch on anti-replay protection (default)"},
|
||||
{"no_anti_replay", OPT_NO_ANTI_REPLAY, '-', "Switch off anti-replay protection"},
|
||||
{"http_server_binmode", OPT_HTTP_SERVER_BINMODE, '-', "opening files in binary mode when acting as http server (-WWW and -HTTP)"},
|
||||
{"no_ca_names", OPT_NOCANAMES, '-',
|
||||
"Disable TLS Extension CA Names"},
|
||||
{"stateless", OPT_STATELESS, '-', "Require TLSv1.3 cookies"},
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
{"ssl3", OPT_SSL3, '-', "Just talk SSLv3"},
|
||||
@@ -981,17 +999,13 @@ const OPTIONS s_server_options[] = {
|
||||
#endif
|
||||
{"alpn", OPT_ALPN, 's',
|
||||
"Set the advertised protocols for the ALPN extension (comma-separated list)"},
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
{"sendfile", OPT_SENDFILE, '-', "Use sendfile to response file with -WWW"},
|
||||
#endif
|
||||
|
||||
OPT_R_OPTIONS,
|
||||
OPT_S_OPTIONS,
|
||||
OPT_V_OPTIONS,
|
||||
{"cert_chain", OPT_CERT_CHAIN, '<',
|
||||
"certificate chain file in PEM format"},
|
||||
{"dcert_chain", OPT_DCERT_CHAIN, '<',
|
||||
"second certificate chain file in PEM format"},
|
||||
{"build_chain", OPT_BUILD_CHAIN, '-', "Build certificate chain"},
|
||||
{"chainCAfile", OPT_CHAINCAFILE, '<',
|
||||
"CA file for certificate chain (PEM format)"},
|
||||
OPT_X_OPTIONS,
|
||||
OPT_PROV_OPTIONS,
|
||||
{NULL}
|
||||
@@ -1078,9 +1092,11 @@ int s_server_main(int argc, char *argv[])
|
||||
const char *keylog_file = NULL;
|
||||
int max_early_data = -1, recv_max_early_data = -1;
|
||||
char *psksessf = NULL;
|
||||
int no_ca_names = 0;
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
int sctp_label_bug = 0;
|
||||
#endif
|
||||
int ignore_unexpected_eof = 0;
|
||||
|
||||
/* Init of few remaining global variables */
|
||||
local_argc = argc;
|
||||
@@ -1095,6 +1111,7 @@ int s_server_main(int argc, char *argv[])
|
||||
s_quiet = 0;
|
||||
s_brief = 0;
|
||||
async = 0;
|
||||
use_sendfile = 0;
|
||||
|
||||
cctx = SSL_CONF_CTX_new();
|
||||
vpm = X509_VERIFY_PARAM_new();
|
||||
@@ -1231,7 +1248,7 @@ int s_server_main(int argc, char *argv[])
|
||||
s_serverinfo_file = opt_arg();
|
||||
break;
|
||||
case OPT_CERTFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &s_cert_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &s_cert_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_KEY:
|
||||
@@ -1253,14 +1270,14 @@ int s_server_main(int argc, char *argv[])
|
||||
#endif
|
||||
break;
|
||||
case OPT_DCERTFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &s_dcert_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &s_dcert_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_DCERT:
|
||||
s_dcert_file = opt_arg();
|
||||
break;
|
||||
case OPT_DKEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &s_dkey_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &s_dkey_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_DPASS:
|
||||
@@ -1389,9 +1406,10 @@ int s_server_main(int argc, char *argv[])
|
||||
case OPT_STATUS_URL:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
s_tlsextstatus = 1;
|
||||
if (!OSSL_HTTP_parse_url(opt_arg(),
|
||||
&tlscstatp.host, &tlscstatp.port,
|
||||
&tlscstatp.path, &tlscstatp.use_ssl)) {
|
||||
if (!OCSP_parse_url(opt_arg(),
|
||||
&tlscstatp.host,
|
||||
&tlscstatp.port,
|
||||
&tlscstatp.path, &tlscstatp.use_ssl)) {
|
||||
BIO_printf(bio_err, "Error parsing URL\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -1562,7 +1580,9 @@ int s_server_main(int argc, char *argv[])
|
||||
session_id_prefix = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
engine = setup_engine(opt_arg(), 1);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
engine = setup_engine(opt_arg(), s_debug);
|
||||
#endif
|
||||
break;
|
||||
case OPT_R_CASES:
|
||||
if (!opt_rand(o))
|
||||
@@ -1643,6 +1663,17 @@ int s_server_main(int argc, char *argv[])
|
||||
case OPT_HTTP_SERVER_BINMODE:
|
||||
http_server_binmode = 1;
|
||||
break;
|
||||
case OPT_NOCANAMES:
|
||||
no_ca_names = 1;
|
||||
break;
|
||||
case OPT_SENDFILE:
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
use_sendfile = 1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_IGNORE_UNEXPECTED_EOF:
|
||||
ignore_unexpected_eof = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
@@ -1695,6 +1726,13 @@ int s_server_main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
if (use_sendfile && www <= 1) {
|
||||
BIO_printf(bio_err, "Can't use -sendfile without -WWW or -HTTP\n");
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!app_passwd(passarg, dpassarg, &pass, &dpass)) {
|
||||
BIO_printf(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
@@ -1712,18 +1750,14 @@ int s_server_main(int argc, char *argv[])
|
||||
if (nocert == 0) {
|
||||
s_key = load_key(s_key_file, s_key_format, 0, pass, engine,
|
||||
"server certificate private key file");
|
||||
if (s_key == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (s_key == NULL)
|
||||
goto end;
|
||||
}
|
||||
|
||||
s_cert = load_cert(s_cert_file, s_cert_format,
|
||||
"server certificate file");
|
||||
|
||||
if (s_cert == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (s_cert == NULL)
|
||||
goto end;
|
||||
}
|
||||
if (s_chain_file != NULL) {
|
||||
if (!load_certs(s_chain_file, &s_chain, FORMAT_PEM, NULL,
|
||||
"server certificate chain"))
|
||||
@@ -1733,18 +1767,14 @@ int s_server_main(int argc, char *argv[])
|
||||
if (tlsextcbp.servername != NULL) {
|
||||
s_key2 = load_key(s_key_file2, s_key_format, 0, pass, engine,
|
||||
"second server certificate private key file");
|
||||
if (s_key2 == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (s_key2 == NULL)
|
||||
goto end;
|
||||
}
|
||||
|
||||
s_cert2 = load_cert(s_cert_file2, s_cert_format,
|
||||
"second server certificate file");
|
||||
|
||||
if (s_cert2 == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (s_cert2 == NULL)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !defined(OPENSSL_NO_NEXTPROTONEG)
|
||||
@@ -1763,12 +1793,9 @@ int s_server_main(int argc, char *argv[])
|
||||
|
||||
if (crl_file != NULL) {
|
||||
X509_CRL *crl;
|
||||
crl = load_crl(crl_file, crl_format);
|
||||
if (crl == NULL) {
|
||||
BIO_puts(bio_err, "Error loading CRL\n");
|
||||
ERR_print_errors(bio_err);
|
||||
crl = load_crl(crl_file, crl_format, "CRL");
|
||||
if (crl == NULL)
|
||||
goto end;
|
||||
}
|
||||
crls = sk_X509_CRL_new_null();
|
||||
if (crls == NULL || !sk_X509_CRL_push(crls, crl)) {
|
||||
BIO_puts(bio_err, "Error adding CRL\n");
|
||||
@@ -1785,10 +1812,8 @@ int s_server_main(int argc, char *argv[])
|
||||
|
||||
s_dkey = load_key(s_dkey_file, s_dkey_format,
|
||||
0, dpass, engine, "second certificate private key file");
|
||||
if (s_dkey == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
if (s_dkey == NULL)
|
||||
goto end;
|
||||
}
|
||||
|
||||
s_dcert = load_cert(s_dcert_file, s_dcert_format,
|
||||
"second server certificate file");
|
||||
@@ -1849,7 +1874,6 @@ int s_server_main(int argc, char *argv[])
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
if (protocol == IPPROTO_SCTP && sctp_label_bug == 1)
|
||||
SSL_CTX_set_mode(ctx, SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG);
|
||||
@@ -1873,7 +1897,6 @@ int s_server_main(int argc, char *argv[])
|
||||
}
|
||||
BIO_printf(bio_err, "id_prefix '%s' set.\n", session_id_prefix);
|
||||
}
|
||||
SSL_CTX_set_quiet_shutdown(ctx, 1);
|
||||
if (exc != NULL)
|
||||
ssl_ctx_set_excert(ctx, exc);
|
||||
|
||||
@@ -1890,6 +1913,13 @@ int s_server_main(int argc, char *argv[])
|
||||
SSL_CTX_set_mode(ctx, SSL_MODE_ASYNC);
|
||||
}
|
||||
|
||||
if (no_ca_names) {
|
||||
SSL_CTX_set_options(ctx, SSL_OP_DISABLE_TLSEXT_CA_NAMES);
|
||||
}
|
||||
|
||||
if (ignore_unexpected_eof)
|
||||
SSL_CTX_set_options(ctx, SSL_OP_IGNORE_UNEXPECTED_EOF);
|
||||
|
||||
if (max_send_fragment > 0
|
||||
&& !SSL_CTX_set_max_send_fragment(ctx, max_send_fragment)) {
|
||||
BIO_printf(bio_err, "%s: Max send fragment size %u is out of permitted range\n",
|
||||
@@ -1958,7 +1988,7 @@ int s_server_main(int argc, char *argv[])
|
||||
BIO_printf(bio_s_out, "Setting secondary ctx parameters\n");
|
||||
|
||||
if (sdebug)
|
||||
ssl_ctx_security_debug(ctx, sdebug);
|
||||
ssl_ctx_security_debug(ctx2, sdebug);
|
||||
|
||||
if (session_id_prefix) {
|
||||
if (strlen(session_id_prefix) >= 32)
|
||||
@@ -1971,7 +2001,6 @@ int s_server_main(int argc, char *argv[])
|
||||
}
|
||||
BIO_printf(bio_err, "id_prefix '%s' set.\n", session_id_prefix);
|
||||
}
|
||||
SSL_CTX_set_quiet_shutdown(ctx2, 1);
|
||||
if (exc != NULL)
|
||||
ssl_ctx_set_excert(ctx2, exc);
|
||||
|
||||
@@ -2093,10 +2122,16 @@ int s_server_main(int argc, char *argv[])
|
||||
SSL_CTX_set_psk_server_callback(ctx, psk_server_cb);
|
||||
}
|
||||
|
||||
if (!SSL_CTX_use_psk_identity_hint(ctx, psk_identity_hint)) {
|
||||
BIO_printf(bio_err, "error setting PSK identity hint to context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
if (psk_identity_hint != NULL) {
|
||||
if (min_version == TLS1_3_VERSION) {
|
||||
BIO_printf(bio_s_out, "PSK warning: there is NO identity hint in TLSv1.3\n");
|
||||
} else {
|
||||
if (!SSL_CTX_use_psk_identity_hint(ctx, psk_identity_hint)) {
|
||||
BIO_printf(bio_err, "error setting PSK identity hint to context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (psksessf != NULL) {
|
||||
@@ -2753,7 +2788,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
|
||||
err:
|
||||
if (con != NULL) {
|
||||
BIO_printf(bio_s_out, "shutting down SSL\n");
|
||||
SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
|
||||
do_ssl_shutdown(con);
|
||||
SSL_free(con);
|
||||
}
|
||||
BIO_printf(bio_s_out, "CONNECTION CLOSED\n");
|
||||
@@ -3330,38 +3365,79 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
|
||||
"HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n");
|
||||
}
|
||||
/* send the file */
|
||||
for (;;) {
|
||||
i = BIO_read(file, buf, bufsize);
|
||||
if (i <= 0)
|
||||
break;
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
if (use_sendfile) {
|
||||
FILE *fp = NULL;
|
||||
int fd;
|
||||
struct stat st;
|
||||
off_t offset = 0;
|
||||
size_t filesize;
|
||||
|
||||
#ifdef RENEG
|
||||
total_bytes += i;
|
||||
BIO_printf(bio_err, "%d\n", i);
|
||||
if (total_bytes > 3 * 1024) {
|
||||
total_bytes = 0;
|
||||
BIO_printf(bio_err, "RENEGOTIATE\n");
|
||||
SSL_renegotiate(con);
|
||||
BIO_get_fp(file, &fp);
|
||||
fd = fileno(fp);
|
||||
if (fstat(fd, &st) < 0) {
|
||||
BIO_printf(io, "Error fstat '%s'\r\n", p);
|
||||
ERR_print_errors(io);
|
||||
goto write_error;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (j = 0; j < i;) {
|
||||
filesize = st.st_size;
|
||||
if (((int)BIO_flush(io)) < 0)
|
||||
goto write_error;
|
||||
|
||||
for (;;) {
|
||||
i = SSL_sendfile(con, fd, offset, filesize, 0);
|
||||
if (i < 0) {
|
||||
BIO_printf(io, "Error SSL_sendfile '%s'\r\n", p);
|
||||
ERR_print_errors(io);
|
||||
break;
|
||||
} else {
|
||||
offset += i;
|
||||
filesize -= i;
|
||||
}
|
||||
|
||||
if (filesize <= 0) {
|
||||
if (!s_quiet)
|
||||
BIO_printf(bio_err, "KTLS SENDFILE '%s' OK\n", p);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
for (;;) {
|
||||
i = BIO_read(file, buf, bufsize);
|
||||
if (i <= 0)
|
||||
break;
|
||||
|
||||
#ifdef RENEG
|
||||
static count = 0;
|
||||
if (++count == 13) {
|
||||
total_bytes += i;
|
||||
BIO_printf(bio_err, "%d\n", i);
|
||||
if (total_bytes > 3 * 1024) {
|
||||
total_bytes = 0;
|
||||
BIO_printf(bio_err, "RENEGOTIATE\n");
|
||||
SSL_renegotiate(con);
|
||||
}
|
||||
#endif
|
||||
k = BIO_write(io, &(buf[j]), i - j);
|
||||
if (k <= 0) {
|
||||
if (!BIO_should_retry(io)
|
||||
&& !SSL_waiting_for_async(con))
|
||||
goto write_error;
|
||||
else {
|
||||
BIO_printf(bio_s_out, "rwrite W BLOCK\n");
|
||||
|
||||
for (j = 0; j < i;) {
|
||||
#ifdef RENEG
|
||||
static count = 0;
|
||||
if (++count == 13)
|
||||
SSL_renegotiate(con);
|
||||
#endif
|
||||
k = BIO_write(io, &(buf[j]), i - j);
|
||||
if (k <= 0) {
|
||||
if (!BIO_should_retry(io)
|
||||
&& !SSL_waiting_for_async(con)) {
|
||||
goto write_error;
|
||||
} else {
|
||||
BIO_printf(bio_s_out, "rwrite W BLOCK\n");
|
||||
}
|
||||
} else {
|
||||
j += k;
|
||||
}
|
||||
} else {
|
||||
j += k;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3381,7 +3457,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
|
||||
}
|
||||
end:
|
||||
/* make sure we re-use sessions */
|
||||
SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
|
||||
do_ssl_shutdown(con);
|
||||
|
||||
err:
|
||||
OPENSSL_free(buf);
|
||||
@@ -3535,7 +3611,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
|
||||
}
|
||||
end:
|
||||
/* make sure we re-use sessions */
|
||||
SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
|
||||
do_ssl_shutdown(con);
|
||||
|
||||
err:
|
||||
|
||||
@@ -3550,7 +3626,7 @@ static int generate_session_id(SSL *ssl, unsigned char *id,
|
||||
{
|
||||
unsigned int count = 0;
|
||||
unsigned int session_id_prefix_len = strlen(session_id_prefix);
|
||||
|
||||
|
||||
do {
|
||||
if (RAND_bytes(id, *id_len) <= 0)
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -86,7 +86,7 @@ const OPTIONS s_time_options[] = {
|
||||
{"www", OPT_WWW, 's', "Fetch specified page from the site"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
{"cert", OPT_CERT, '<', "Cert file to use, PEM format assumed"},
|
||||
{"key", OPT_KEY, '<', "File with key, PEM; default is -cert file"},
|
||||
{"cafile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
|
||||
+8
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 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
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
|
||||
static int smime_cb(int ok, X509_STORE_CTX *ctx);
|
||||
|
||||
@@ -60,7 +63,7 @@ const OPTIONS smime_options[] = {
|
||||
"Output format SMIME (default), PEM or DER"},
|
||||
{"inkey", OPT_INKEY, 's',
|
||||
"Input private key (if not signer or recipient)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Input private key format (ENGINE, other values ignored)"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
@@ -426,7 +429,7 @@ int smime_main(int argc, char **argv)
|
||||
if (encerts == NULL)
|
||||
goto end;
|
||||
while (*argv != NULL) {
|
||||
cert = load_cert(*argv, FORMAT_PEM,
|
||||
cert = load_cert(*argv, FORMAT_UNDEF,
|
||||
"recipient certificate file");
|
||||
if (cert == NULL)
|
||||
goto end;
|
||||
@@ -445,7 +448,7 @@ int smime_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (recipfile != NULL && (operation == SMIME_DECRYPT)) {
|
||||
if ((recip = load_cert(recipfile, FORMAT_PEM,
|
||||
if ((recip = load_cert(recipfile, FORMAT_UNDEF,
|
||||
"recipient certificate file")) == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
@@ -545,7 +548,7 @@ int smime_main(int argc, char **argv)
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(sksigners); i++) {
|
||||
signerfile = sk_OPENSSL_STRING_value(sksigners, i);
|
||||
keyfile = sk_OPENSSL_STRING_value(skkeys, i);
|
||||
signer = load_cert(signerfile, FORMAT_PEM,
|
||||
signer = load_cert(signerfile, FORMAT_UNDEF,
|
||||
"signer certificate");
|
||||
if (signer == NULL)
|
||||
goto end;
|
||||
|
||||
+352
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -16,6 +16,7 @@
|
||||
#define ECDH_SECONDS 10
|
||||
#define EdDSA_SECONDS 10
|
||||
#define SM2_SECONDS 10
|
||||
#define FFDH_SECONDS 10
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
@@ -98,6 +99,9 @@
|
||||
# include <openssl/rsa.h>
|
||||
# include "./testrsa.h"
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
# include <openssl/dh.h>
|
||||
#endif
|
||||
#include <openssl/x509.h>
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
# include <openssl/dsa.h>
|
||||
@@ -125,6 +129,7 @@
|
||||
#define MAX_MISALIGNMENT 63
|
||||
#define MAX_ECDH_SIZE 256
|
||||
#define MISALIGN 64
|
||||
#define MAX_FFDH_SIZE 1024
|
||||
|
||||
typedef struct openssl_speed_sec_st {
|
||||
int sym;
|
||||
@@ -134,6 +139,7 @@ typedef struct openssl_speed_sec_st {
|
||||
int ecdh;
|
||||
int eddsa;
|
||||
int sm2;
|
||||
int ffdh;
|
||||
} openssl_speed_sec_t;
|
||||
|
||||
static volatile int run = 0;
|
||||
@@ -435,6 +441,22 @@ static const OPT_PAIR rsa_choices[RSA_NUM] = {
|
||||
static double rsa_results[RSA_NUM][2]; /* 2 ops: sign then verify */
|
||||
#endif /* OPENSSL_NO_RSA */
|
||||
|
||||
#ifndef OPENSSL_NO_DH
|
||||
enum ff_params_t {
|
||||
R_FFDH_2048, R_FFDH_3072, R_FFDH_4096, R_FFDH_6144, R_FFDH_8192, FFDH_NUM
|
||||
};
|
||||
|
||||
static const OPT_PAIR ffdh_choices[FFDH_NUM] = {
|
||||
{"ffdh2048", R_FFDH_2048},
|
||||
{"ffdh3072", R_FFDH_3072},
|
||||
{"ffdh4096", R_FFDH_4096},
|
||||
{"ffdh6144", R_FFDH_6144},
|
||||
{"ffdh8192", R_FFDH_8192},
|
||||
};
|
||||
|
||||
static double ffdh_results[FFDH_NUM][1]; /* 1 op: derivation */
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
enum ec_curves_t {
|
||||
R_EC_P160, R_EC_P192, R_EC_P224, R_EC_P256, R_EC_P384, R_EC_P521,
|
||||
@@ -553,6 +575,7 @@ typedef struct loopargs_st {
|
||||
EC_KEY *ecdsa[ECDSA_NUM];
|
||||
EVP_PKEY_CTX *ecdh_ctx[EC_NUM];
|
||||
EVP_MD_CTX *eddsa_ctx[EdDSA_NUM];
|
||||
EVP_MD_CTX *eddsa_ctx2[EdDSA_NUM];
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
EVP_MD_CTX *sm2_ctx[SM2_NUM];
|
||||
EVP_MD_CTX *sm2_vfy_ctx[SM2_NUM];
|
||||
@@ -561,6 +584,11 @@ typedef struct loopargs_st {
|
||||
unsigned char *secret_a;
|
||||
unsigned char *secret_b;
|
||||
size_t outlen[EC_NUM];
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
EVP_PKEY_CTX *ffdh_ctx[FFDH_NUM];
|
||||
unsigned char *secret_ff_a;
|
||||
unsigned char *secret_ff_b;
|
||||
#endif
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
@@ -1067,6 +1095,24 @@ static int RSA_verify_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_DH
|
||||
static long ffdh_c[FFDH_NUM][1];
|
||||
|
||||
static int FFDH_derive_key_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
EVP_PKEY_CTX *ffdh_ctx = tempargs->ffdh_ctx[testnum];
|
||||
unsigned char *derived_secret = tempargs->secret_ff_a;
|
||||
size_t outlen = MAX_FFDH_SIZE;
|
||||
int count;
|
||||
|
||||
for (count = 0; COND(ffdh_c[testnum][0]); count++)
|
||||
EVP_PKEY_derive(ffdh_ctx, derived_secret, &outlen);
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static long dsa_c[DSA_NUM][2];
|
||||
static int DSA_sign_loop(void *args)
|
||||
@@ -1197,7 +1243,7 @@ static int EdDSA_verify_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
EVP_MD_CTX **edctx = tempargs->eddsa_ctx;
|
||||
EVP_MD_CTX **edctx = tempargs->eddsa_ctx2;
|
||||
unsigned char *eddsasig = tempargs->buf2;
|
||||
size_t eddsasigsize = tempargs->sigsize;
|
||||
int ret, count;
|
||||
@@ -1463,7 +1509,8 @@ int speed_main(int argc, char **argv)
|
||||
#endif
|
||||
openssl_speed_sec_t seconds = { SECONDS, RSA_SECONDS, DSA_SECONDS,
|
||||
ECDSA_SECONDS, ECDH_SECONDS,
|
||||
EdDSA_SECONDS, SM2_SECONDS };
|
||||
EdDSA_SECONDS, SM2_SECONDS,
|
||||
FFDH_SECONDS };
|
||||
|
||||
/* What follows are the buffers and key material. */
|
||||
#if !defined(OPENSSL_NO_RC5) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
@@ -1521,6 +1568,23 @@ int speed_main(int argc, char **argv)
|
||||
uint8_t rsa_doit[RSA_NUM] = { 0 };
|
||||
int primes = RSA_DEFAULT_PRIME_NUM;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
typedef struct ffdh_params_st {
|
||||
const char *name;
|
||||
unsigned int nid;
|
||||
unsigned int bits;
|
||||
} FFDH_PARAMS;
|
||||
|
||||
static const FFDH_PARAMS ffdh_params[FFDH_NUM] = {
|
||||
{"ffdh2048", NID_ffdhe2048, 2048},
|
||||
{"ffdh3072", NID_ffdhe3072, 3072},
|
||||
{"ffdh4096", NID_ffdhe4096, 4096},
|
||||
{"ffdh6144", NID_ffdhe6144, 6144},
|
||||
{"ffdh8192", NID_ffdhe8192, 8192}
|
||||
};
|
||||
uint8_t ffdh_doit[FFDH_NUM] = { 0 };
|
||||
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static const unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 };
|
||||
uint8_t dsa_doit[DSA_NUM] = { 0 };
|
||||
@@ -1718,7 +1782,7 @@ int speed_main(int argc, char **argv)
|
||||
case OPT_SECONDS:
|
||||
seconds.sym = seconds.rsa = seconds.dsa = seconds.ecdsa
|
||||
= seconds.ecdh = seconds.eddsa
|
||||
= seconds.sm2 = atoi(opt_arg());
|
||||
= seconds.sm2 = seconds.ffdh = atoi(opt_arg());
|
||||
break;
|
||||
case OPT_BYTES:
|
||||
lengths_single = atoi(opt_arg());
|
||||
@@ -1765,6 +1829,18 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
if (strncmp(algo, "ffdh", 4) == 0) {
|
||||
if (algo[4] == '\0') {
|
||||
memset(ffdh_doit, 1, sizeof(ffdh_doit));
|
||||
continue;
|
||||
}
|
||||
if (opt_found(algo, ffdh_choices, &i)) {
|
||||
ffdh_doit[i] = 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (strncmp(algo, "dsa", 3) == 0) {
|
||||
if (algo[3] == '\0') {
|
||||
@@ -1899,6 +1975,10 @@ int speed_main(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_EC
|
||||
loopargs[i].secret_a = app_malloc(MAX_ECDH_SIZE, "ECDH secret a");
|
||||
loopargs[i].secret_b = app_malloc(MAX_ECDH_SIZE, "ECDH secret b");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
loopargs[i].secret_ff_a = app_malloc(MAX_FFDH_SIZE, "FFDH secret a");
|
||||
loopargs[i].secret_ff_b = app_malloc(MAX_FFDH_SIZE, "FFDH secret b");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1914,9 +1994,21 @@ int speed_main(int argc, char **argv)
|
||||
if (argc == 0 && !doit[D_EVP] && !doit[D_EVP_HMAC] && !doit[D_EVP_CMAC]) {
|
||||
memset(doit, 1, sizeof(doit));
|
||||
doit[D_EVP] = doit[D_EVP_HMAC] = doit[D_EVP_CMAC] = 0;
|
||||
#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
doit[D_MDC2] = 0;
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
doit[D_MD4] = 0;
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_RMD160) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
doit[D_RMD160] = 0;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
memset(rsa_doit, 1, sizeof(rsa_doit));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
memset(ffdh_doit, 1, sizeof(ffdh_doit));
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
memset(dsa_doit, 1, sizeof(dsa_doit));
|
||||
#endif
|
||||
@@ -2108,7 +2200,7 @@ int speed_main(int argc, char **argv)
|
||||
c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
# if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
rsa_c[R_RSA_512][0] = count / 2000;
|
||||
rsa_c[R_RSA_512][1] = count / 400;
|
||||
for (i = 1; i < RSA_NUM; i++) {
|
||||
@@ -2258,6 +2350,19 @@ int speed_main(int argc, char **argv)
|
||||
# endif
|
||||
# endif /* OPENSSL_NO_EC */
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
ffdh_c[R_FFDH_2048][0] = count / 1000;
|
||||
for (i = R_FFDH_3072; i <= R_FFDH_8192; i++) {
|
||||
ffdh_c[i][0] = ffdh_c[i - 1][0] / 2;
|
||||
if (ffdh_doit[i] <= 1 && ffdh_c[i][0] == 0) {
|
||||
ffdh_doit[i] = 0;
|
||||
} else {
|
||||
if (ffdh_c[i][0] == 0)
|
||||
ffdh_c[i][0] = 1;
|
||||
}
|
||||
}
|
||||
# endif /* OPENSSL_NO_DH */
|
||||
|
||||
# else
|
||||
/* not worth fixing */
|
||||
# error "You cannot disable DES on systems without SIGALRM."
|
||||
@@ -3047,7 +3152,6 @@ int speed_main(int argc, char **argv)
|
||||
rsa_count = 1;
|
||||
} else {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
EC_KEY_precompute_mult(loopargs[i].ecdsa[testnum], NULL);
|
||||
/* Perform ECDSA signature test */
|
||||
EC_KEY_generate_key(loopargs[i].ecdsa[testnum]);
|
||||
st = ECDSA_sign(0, loopargs[i].buf, 20, loopargs[i].buf2,
|
||||
@@ -3284,6 +3388,11 @@ int speed_main(int argc, char **argv)
|
||||
st = 0;
|
||||
break;
|
||||
}
|
||||
loopargs[i].eddsa_ctx2[testnum] = EVP_MD_CTX_new();
|
||||
if (loopargs[i].eddsa_ctx2[testnum] == NULL) {
|
||||
st = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ed_pctx = EVP_PKEY_CTX_new_id(ed_curves[testnum].nid, NULL))
|
||||
== NULL
|
||||
@@ -3301,6 +3410,13 @@ int speed_main(int argc, char **argv)
|
||||
EVP_PKEY_free(ed_pkey);
|
||||
break;
|
||||
}
|
||||
if (!EVP_DigestVerifyInit(loopargs[i].eddsa_ctx2[testnum], NULL,
|
||||
NULL, NULL, ed_pkey)) {
|
||||
st = 0;
|
||||
EVP_PKEY_free(ed_pkey);
|
||||
break;
|
||||
}
|
||||
|
||||
EVP_PKEY_free(ed_pkey);
|
||||
}
|
||||
if (st == 0) {
|
||||
@@ -3338,10 +3454,9 @@ int speed_main(int argc, char **argv)
|
||||
eddsa_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
}
|
||||
|
||||
/* Perform EdDSA verification test */
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
st = EVP_DigestVerify(loopargs[i].eddsa_ctx[testnum],
|
||||
st = EVP_DigestVerify(loopargs[i].eddsa_ctx2[testnum],
|
||||
loopargs[i].buf2, loopargs[i].sigsize,
|
||||
loopargs[i].buf, 20);
|
||||
if (st != 1)
|
||||
@@ -3465,7 +3580,7 @@ int speed_main(int argc, char **argv)
|
||||
d = Time_F(STOP);
|
||||
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R8:%ld:%u:%s:%.2f\n" :
|
||||
mr ? "+R10:%ld:%u:%s:%.2f\n" :
|
||||
"%ld %u bits %s signs in %.2fs \n",
|
||||
count, sm2_curves[testnum].bits,
|
||||
sm2_curves[testnum].name, d);
|
||||
@@ -3494,7 +3609,7 @@ int speed_main(int argc, char **argv)
|
||||
count = run_benchmark(async_jobs, SM2_verify_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R9:%ld:%u:%s:%.2f\n"
|
||||
mr ? "+R11:%ld:%u:%s:%.2f\n"
|
||||
: "%ld %u bits %s verify in %.2fs\n",
|
||||
count, sm2_curves[testnum].bits,
|
||||
sm2_curves[testnum].name, d);
|
||||
@@ -3509,8 +3624,188 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
|
||||
#ifndef OPENSSL_NO_DH
|
||||
for (testnum = 0; testnum < FFDH_NUM; testnum++) {
|
||||
int ffdh_checks = 1;
|
||||
|
||||
if (!ffdh_doit[testnum])
|
||||
continue;
|
||||
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
EVP_PKEY *pkey_A = NULL;
|
||||
EVP_PKEY *pkey_B = NULL;
|
||||
EVP_PKEY_CTX *ffdh_ctx = NULL;
|
||||
EVP_PKEY_CTX *test_ctx = NULL;
|
||||
size_t secret_size;
|
||||
size_t test_out;
|
||||
|
||||
/* Ensure that the error queue is empty */
|
||||
if (ERR_peek_error()) {
|
||||
BIO_printf(bio_err,
|
||||
"WARNING: the error queue contains previous unhandled errors.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
|
||||
pkey_A = EVP_PKEY_new();
|
||||
if (!pkey_A) {
|
||||
BIO_printf(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
pkey_B = EVP_PKEY_new();
|
||||
if (!pkey_B) {
|
||||
BIO_printf(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ffdh_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_DH, NULL);
|
||||
if (!ffdh_ctx) {
|
||||
BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_keygen_init(ffdh_ctx) <= 0) {
|
||||
BIO_printf(bio_err, "Error while initialising EVP_PKEY_CTX.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (EVP_PKEY_CTX_set_dh_nid(ffdh_ctx, ffdh_params[testnum].nid) <= 0) {
|
||||
BIO_printf(bio_err, "Error setting DH key size for keygen.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_keygen(ffdh_ctx, &pkey_A) <= 0 ||
|
||||
EVP_PKEY_keygen(ffdh_ctx, &pkey_B) <= 0) {
|
||||
BIO_printf(bio_err, "FFDH key generation failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
EVP_PKEY_CTX_free(ffdh_ctx);
|
||||
|
||||
/* check if the derivation works correctly both ways so that
|
||||
* we know if future derive calls will fail, and we can skip
|
||||
* error checking in benchmarked code */
|
||||
ffdh_ctx = EVP_PKEY_CTX_new(pkey_A, NULL);
|
||||
if (!ffdh_ctx) {
|
||||
BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (EVP_PKEY_derive_init(ffdh_ctx) <= 0) {
|
||||
BIO_printf(bio_err, "FFDH derivation context init failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (EVP_PKEY_derive_set_peer(ffdh_ctx, pkey_B) <= 0) {
|
||||
BIO_printf(bio_err, "Assigning peer key for derivation failed.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (EVP_PKEY_derive(ffdh_ctx, NULL, &secret_size) <= 0) {
|
||||
BIO_printf(bio_err, "Checking size of shared secret failed.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (secret_size > MAX_FFDH_SIZE) {
|
||||
BIO_printf(bio_err, "Assertion failure: shared secret too large.\n");
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (EVP_PKEY_derive(ffdh_ctx,
|
||||
loopargs[i].secret_ff_a,
|
||||
&secret_size) <= 0) {
|
||||
BIO_printf(bio_err, "Shared secret derive failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
/* Now check from side B */
|
||||
test_ctx = EVP_PKEY_CTX_new(pkey_B, NULL);
|
||||
if (!test_ctx) {
|
||||
BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
if (!EVP_PKEY_derive_init(test_ctx) ||
|
||||
!EVP_PKEY_derive_set_peer(test_ctx, pkey_A) ||
|
||||
!EVP_PKEY_derive(test_ctx, NULL, &test_out) ||
|
||||
!EVP_PKEY_derive(test_ctx, loopargs[i].secret_ff_b, &test_out) ||
|
||||
test_out != secret_size) {
|
||||
BIO_printf(bio_err, "FFDH computation failure.\n");
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* compare the computed secrets */
|
||||
if (CRYPTO_memcmp(loopargs[i].secret_ff_a,
|
||||
loopargs[i].secret_ff_b, secret_size)) {
|
||||
BIO_printf(bio_err, "FFDH computations don't match.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count = 1;
|
||||
ffdh_checks = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
loopargs[i].ffdh_ctx[testnum] = ffdh_ctx;
|
||||
|
||||
EVP_PKEY_free(pkey_A);
|
||||
pkey_A = NULL;
|
||||
EVP_PKEY_free(pkey_B);
|
||||
pkey_B = NULL;
|
||||
EVP_PKEY_CTX_free(test_ctx);
|
||||
test_ctx = NULL;
|
||||
}
|
||||
if (ffdh_checks != 0) {
|
||||
pkey_print_message("", "ffdh", ffdh_c[testnum][0],
|
||||
ffdh_params[testnum].bits, seconds.ffdh);
|
||||
Time_F(START);
|
||||
count =
|
||||
run_benchmark(async_jobs, FFDH_derive_key_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
BIO_printf(bio_err,
|
||||
mr ? "+R12:%ld:%d:%.2f\n" :
|
||||
"%ld %u-bits FFDH ops in %.2fs\n", count,
|
||||
ffdh_params[testnum].bits, d);
|
||||
ffdh_results[testnum][0] = (double)count / d;
|
||||
rsa_count = count;
|
||||
};
|
||||
if (rsa_count <= 1) {
|
||||
/* if longer than 10s, don't do any more */
|
||||
stop_it(ffdh_doit, testnum);
|
||||
}
|
||||
}
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
#ifndef NO_FORK
|
||||
show_res:
|
||||
#endif
|
||||
@@ -3676,7 +3971,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (mr)
|
||||
printf("+F6:%u:%u:%s:%f:%f\n",
|
||||
printf("+F7:%u:%u:%s:%f:%f\n",
|
||||
k, sm2_curves[k].bits, sm2_curves[k].name,
|
||||
sm2_results[k][0], sm2_results[k][1]);
|
||||
else
|
||||
@@ -3687,6 +3982,26 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
# endif
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
#ifndef OPENSSL_NO_DH
|
||||
testnum = 1;
|
||||
for (k = 0; k < FFDH_NUM; k++) {
|
||||
if (!ffdh_doit[k])
|
||||
continue;
|
||||
if (testnum && !mr) {
|
||||
printf("%23sop op/s\n", " ");
|
||||
testnum = 0;
|
||||
}
|
||||
if (mr)
|
||||
printf("+F8:%u:%u:%f:%f\n",
|
||||
k, ffdh_params[k].bits,
|
||||
ffdh_results[k][0], 1.0 / ffdh_results[k][0]);
|
||||
|
||||
else
|
||||
printf("%4u bits ffdh %8.4fs %8.1f\n",
|
||||
ffdh_params[k].bits,
|
||||
1.0 / ffdh_results[k][0], ffdh_results[k][0]);
|
||||
}
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -3700,6 +4015,13 @@ int speed_main(int argc, char **argv)
|
||||
for (k = 0; k < RSA_NUM; k++)
|
||||
RSA_free(loopargs[i].rsa_key[k]);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
OPENSSL_free(loopargs[i].secret_ff_a);
|
||||
OPENSSL_free(loopargs[i].secret_ff_b);
|
||||
for (k = 0; k < FFDH_NUM; k++) {
|
||||
EVP_PKEY_CTX_free(loopargs[i].ffdh_ctx[k]);
|
||||
}
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
for (k = 0; k < DSA_NUM; k++)
|
||||
DSA_free(loopargs[i].dsa_key[k]);
|
||||
@@ -3709,8 +4031,10 @@ int speed_main(int argc, char **argv)
|
||||
EC_KEY_free(loopargs[i].ecdsa[k]);
|
||||
for (k = 0; k < EC_NUM; k++)
|
||||
EVP_PKEY_CTX_free(loopargs[i].ecdh_ctx[k]);
|
||||
for (k = 0; k < EdDSA_NUM; k++)
|
||||
for (k = 0; k < EdDSA_NUM; k++) {
|
||||
EVP_MD_CTX_free(loopargs[i].eddsa_ctx[k]);
|
||||
EVP_MD_CTX_free(loopargs[i].eddsa_ctx2[k]);
|
||||
}
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
for (k = 0; k < SM2_NUM; k++) {
|
||||
EVP_PKEY_CTX *pctx = NULL;
|
||||
@@ -3969,6 +4293,7 @@ static int do_multi(int multi, int size_num)
|
||||
p = buf + 4;
|
||||
k = atoi(sstrsep(&p, sep));
|
||||
sstrsep(&p, sep);
|
||||
sstrsep(&p, sep);
|
||||
|
||||
d = atof(sstrsep(&p, sep));
|
||||
sm2_results[k][0] += d;
|
||||
@@ -3977,7 +4302,20 @@ static int do_multi(int multi, int size_num)
|
||||
sm2_results[k][1] += d;
|
||||
}
|
||||
# endif /* OPENSSL_NO_SM2 */
|
||||
# endif
|
||||
# endif /* OPENSSL_NO_EC */
|
||||
# ifndef OPENSSL_NO_DH
|
||||
else if (strncmp(buf, "+F8:", 4) == 0) {
|
||||
int k;
|
||||
double d;
|
||||
|
||||
p = buf + 4;
|
||||
k = atoi(sstrsep(&p, sep));
|
||||
sstrsep(&p, sep);
|
||||
|
||||
d = atof(sstrsep(&p, sep));
|
||||
ffdh_results[k][0] += d;
|
||||
}
|
||||
# endif /* OPENSSL_NO_DH */
|
||||
|
||||
else if (strncmp(buf, "+H:", 3) == 0) {
|
||||
;
|
||||
|
||||
+11
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 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
|
||||
@@ -40,7 +40,7 @@ const OPTIONS spkac_options[] = {
|
||||
OPT_SECTION("Input"),
|
||||
{"in", OPT_IN, '<', "Input file"},
|
||||
{"key", OPT_KEY, '<', "Create SPKAC using private key"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format - default PEM (PEM, DER, or ENGINE)"},
|
||||
{"keyform", OPT_KEYFORM, 'f', "Private key file format (ENGINE, other values ignored)"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"challenge", OPT_CHALLENGE, 's', "Challenge string"},
|
||||
{"spkac", OPT_SPKAC, 's', "Alternative SPKAC name"},
|
||||
@@ -145,8 +145,15 @@ int spkac_main(int argc, char **argv)
|
||||
if (challenge != NULL)
|
||||
ASN1_STRING_set(spki->spkac->challenge,
|
||||
challenge, (int)strlen(challenge));
|
||||
NETSCAPE_SPKI_set_pubkey(spki, pkey);
|
||||
NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
|
||||
if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) {
|
||||
BIO_printf(bio_err, "Error setting public key\n");
|
||||
goto end;
|
||||
}
|
||||
i = NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
|
||||
if (i <= 0) {
|
||||
BIO_printf(bio_err, "Error signing SPKAC\n");
|
||||
goto end;
|
||||
}
|
||||
spkstr = NETSCAPE_SPKI_b64_encode(spki);
|
||||
if (spkstr == NULL)
|
||||
goto end;
|
||||
|
||||
+18
-22
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2004, EdelKey Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -12,28 +12,25 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_SRP
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <openssl/conf.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/txt_db.h>
|
||||
# include <openssl/buffer.h>
|
||||
# include <openssl/srp.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/txt_db.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/srp.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
|
||||
# define BASE_SECTION "srp"
|
||||
# define CONFIG_FILE "openssl.cnf"
|
||||
#define BASE_SECTION "srp"
|
||||
#define CONFIG_FILE "openssl.cnf"
|
||||
|
||||
|
||||
# define ENV_DATABASE "srpvfile"
|
||||
# define ENV_DEFAULT_SRP "default_srp"
|
||||
#define ENV_DATABASE "srpvfile"
|
||||
#define ENV_DEFAULT_SRP "default_srp"
|
||||
|
||||
static int get_index(CA_DB *db, char *id, char type)
|
||||
{
|
||||
@@ -204,9 +201,9 @@ const OPTIONS srp_options[] = {
|
||||
{"verbose", OPT_VERBOSE, '-', "Talk a lot while doing things"},
|
||||
{"config", OPT_CONFIG, '<', "A config file"},
|
||||
{"name", OPT_NAME, 's', "The particular srp definition to use"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
OPT_SECTION("Action"),
|
||||
{"add", OPT_ADD, '-', "Add a user and srp verifier"},
|
||||
@@ -625,4 +622,3 @@ int srp_main(int argc, char **argv)
|
||||
release_engine(e);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2020 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 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
|
||||
@@ -8,29 +8,26 @@
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_TS
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "apps.h"
|
||||
# include "progs.h"
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <openssl/rand.h>
|
||||
# include <openssl/ts.h>
|
||||
# include <openssl/bn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/ts.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
/* Request nonce length, in bits (must be a multiple of 8). */
|
||||
# define NONCE_LENGTH 64
|
||||
#define NONCE_LENGTH 64
|
||||
|
||||
/* Name of config entry that defines the OID file. */
|
||||
# define ENV_OID_FILE "oid_file"
|
||||
#define ENV_OID_FILE "oid_file"
|
||||
|
||||
/* Is |EXACTLY_ONE| of three pointers set? */
|
||||
# define EXACTLY_ONE(a, b, c) \
|
||||
#define EXACTLY_ONE(a, b, c) \
|
||||
(( a && !b && !c) || \
|
||||
( b && !a && !c) || \
|
||||
( c && !a && !b))
|
||||
@@ -94,14 +91,14 @@ const OPTIONS ts_options[] = {
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"config", OPT_CONFIG, '<', "Configuration file"},
|
||||
{"section", OPT_SECTION, 's', "Section to use within config file"},
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
# endif
|
||||
#endif
|
||||
{"inkey", OPT_INKEY, 's', "File with private key for reply"},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"chain", OPT_CHAIN, '<', "File with signer CA chain"},
|
||||
{"CApath", OPT_CAPATH, '/', "Path to trusted CA files"},
|
||||
{"CAfile", OPT_CAFILE, '<', "File with trusted CA certs"},
|
||||
{"CApath", OPT_CAPATH, '/', "Path to trusted CA files"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to trusted CA store"},
|
||||
{"untrusted", OPT_UNTRUSTED, '<', "File with untrusted certs"},
|
||||
{"token_in", OPT_TOKEN_IN, '-', "Input is a PKCS#7 file"},
|
||||
@@ -146,11 +143,11 @@ static char* opt_helplist[] = {
|
||||
" [-signer tsa_cert.pem] [-inkey private_key.pem]",
|
||||
" [-chain certs_file.pem] [-tspolicy oid]",
|
||||
" [-in file] [-token_in] [-out file] [-token_out]",
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
" [-text] [-engine id]",
|
||||
# else
|
||||
#else
|
||||
" [-text]",
|
||||
# endif
|
||||
#endif
|
||||
"",
|
||||
" openssl ts -verify -CApath dir -CAfile file.pem -CAstore uri",
|
||||
" -untrusted file.pem [-data file] [-digest hexstring]",
|
||||
@@ -699,10 +696,10 @@ static TS_RESP *create_response(CONF *conf, const char *section, const char *eng
|
||||
goto end;
|
||||
if (!TS_CONF_set_serial(conf, section, serial_cb, resp_ctx))
|
||||
goto end;
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (!TS_CONF_set_crypto_device(conf, section, engine))
|
||||
goto end;
|
||||
# endif
|
||||
#endif
|
||||
if (!TS_CONF_set_signer_cert(conf, section, signer, resp_ctx))
|
||||
goto end;
|
||||
if (!TS_CONF_set_certs(conf, section, chain, resp_ctx))
|
||||
@@ -1013,4 +1010,3 @@ static int verify_cb(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
return ok;
|
||||
}
|
||||
#endif /* ndef OPENSSL_NO_TS */
|
||||
+38
-67
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -18,11 +18,15 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static int cb(int ok, X509_STORE_CTX *ctx);
|
||||
static int check(X509_STORE *ctx, const char *file,
|
||||
STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
|
||||
STACK_OF(X509_CRL) *crls, int show_chain,
|
||||
unsigned char *sm2id, size_t sm2idlen);
|
||||
STACK_OF(OPENSSL_STRING) *opts);
|
||||
static int v_verbose = 0, vflags = 0;
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
@@ -30,8 +34,8 @@ typedef enum OPTION_choice {
|
||||
OPT_ENGINE, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
|
||||
OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
|
||||
OPT_UNTRUSTED, OPT_TRUSTED, OPT_CRLFILE, OPT_CRL_DOWNLOAD, OPT_SHOW_CHAIN,
|
||||
OPT_V_ENUM, OPT_NAMEOPT,
|
||||
OPT_VERBOSE, OPT_SM2ID, OPT_SM2HEXID,
|
||||
OPT_V_ENUM, OPT_NAMEOPT, OPT_VFYOPT,
|
||||
OPT_VERBOSE,
|
||||
OPT_PROV_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
@@ -45,34 +49,29 @@ const OPTIONS verify_options[] = {
|
||||
#endif
|
||||
{"verbose", OPT_VERBOSE, '-',
|
||||
"Print extra information about the operations being performed."},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
|
||||
OPT_SECTION("Certificate chain"),
|
||||
{"CApath", OPT_CAPATH, '/', "A directory of trusted certificates"},
|
||||
{"trusted", OPT_TRUSTED, '<', "A file of trusted certificates"},
|
||||
{"CAfile", OPT_CAFILE, '<', "A file of trusted certificates"},
|
||||
{"CApath", OPT_CAPATH, '/', "A directory of files with trusted certificates"},
|
||||
{"CAstore", OPT_CASTORE, ':', "URI to a store of trusted certificates"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
"Do not load the default certificates file"},
|
||||
"Do not load the default trusted certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
"Do not load trusted certificates from the default directory"},
|
||||
{"no-CAstore", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates store"},
|
||||
"Do not load trusted certificates from the default certificates store"},
|
||||
{"untrusted", OPT_UNTRUSTED, '<', "A file of untrusted certificates"},
|
||||
{"trusted", OPT_TRUSTED, '<', "A file of trusted certificates"},
|
||||
{"CRLfile", OPT_CRLFILE, '<',
|
||||
"File containing one or more CRL's (in PEM format) to load"},
|
||||
{"crl_download", OPT_CRL_DOWNLOAD, '-',
|
||||
"Attempt to download CRL information for this certificate"},
|
||||
"Try downloading CRL information for certificates via their CDP entries"},
|
||||
{"show_chain", OPT_SHOW_CHAIN, '-',
|
||||
"Display information about the certificate chain"},
|
||||
|
||||
OPT_V_OPTIONS,
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
{"sm2-id", OPT_SM2ID, 's',
|
||||
"Specify an ID string to verify an SM2 certificate"},
|
||||
{"sm2-hex-id", OPT_SM2HEXID, 's',
|
||||
"Specify a hex ID string to verify an SM2 certificate"},
|
||||
#endif
|
||||
{"vfyopt", OPT_VFYOPT, 's', "Verification parameter in n:v form"},
|
||||
|
||||
OPT_PROV_OPTIONS,
|
||||
|
||||
@@ -86,15 +85,13 @@ int verify_main(int argc, char **argv)
|
||||
ENGINE *e = NULL;
|
||||
STACK_OF(X509) *untrusted = NULL, *trusted = NULL;
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *vfyopts = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
const char *prog, *CApath = NULL, *CAfile = NULL, *CAstore = NULL;
|
||||
int noCApath = 0, noCAfile = 0, noCAstore = 0;
|
||||
int vpmtouched = 0, crl_download = 0, show_chain = 0, i = 0, ret = 1;
|
||||
OPTION_CHOICE o;
|
||||
unsigned char *sm2_id = NULL;
|
||||
size_t sm2_idlen = 0;
|
||||
int sm2_free = 0;
|
||||
|
||||
if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
|
||||
goto end;
|
||||
@@ -104,6 +101,7 @@ int verify_main(int argc, char **argv)
|
||||
switch (o) {
|
||||
case OPT_EOF:
|
||||
case OPT_ERR:
|
||||
opthelp:
|
||||
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
|
||||
goto end;
|
||||
case OPT_HELP:
|
||||
@@ -186,32 +184,15 @@ int verify_main(int argc, char **argv)
|
||||
if (!set_nameopt(opt_arg()))
|
||||
goto end;
|
||||
break;
|
||||
case OPT_VFYOPT:
|
||||
if (!vfyopts)
|
||||
vfyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!vfyopts || !sk_OPENSSL_STRING_push(vfyopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_VERBOSE:
|
||||
v_verbose = 1;
|
||||
break;
|
||||
case OPT_SM2ID:
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id' \n");
|
||||
goto end;
|
||||
}
|
||||
sm2_id = (unsigned char *)opt_arg();
|
||||
sm2_idlen = strlen((const char *)sm2_id);
|
||||
break;
|
||||
case OPT_SM2HEXID:
|
||||
if (sm2_id != NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"Use one of the options 'sm2-hex-id' or 'sm2-id' \n");
|
||||
goto end;
|
||||
}
|
||||
/* try to parse the input as hex string first */
|
||||
sm2_free = 1;
|
||||
sm2_id = OPENSSL_hexstr2buf(opt_arg(), (long *)&sm2_idlen);
|
||||
if (sm2_id == NULL) {
|
||||
BIO_printf(bio_err, "Invalid hex string input\n");
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
case OPT_PROV_CASES:
|
||||
if (!opt_provider(o))
|
||||
goto end;
|
||||
@@ -244,23 +225,22 @@ int verify_main(int argc, char **argv)
|
||||
ret = 0;
|
||||
if (argc < 1) {
|
||||
if (check(store, NULL, untrusted, trusted, crls, show_chain,
|
||||
sm2_id, sm2_idlen) != 1)
|
||||
vfyopts) != 1)
|
||||
ret = -1;
|
||||
} else {
|
||||
for (i = 0; i < argc; i++)
|
||||
if (check(store, argv[i], untrusted, trusted, crls,
|
||||
show_chain, sm2_id, sm2_idlen) != 1)
|
||||
if (check(store, argv[i], untrusted, trusted, crls, show_chain,
|
||||
vfyopts) != 1)
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
end:
|
||||
if (sm2_free)
|
||||
OPENSSL_free(sm2_id);
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
X509_STORE_free(store);
|
||||
sk_X509_pop_free(untrusted, X509_free);
|
||||
sk_X509_pop_free(trusted, X509_free);
|
||||
sk_X509_CRL_pop_free(crls, X509_CRL_free);
|
||||
sk_OPENSSL_STRING_free(vfyopts);
|
||||
release_engine(e);
|
||||
return (ret < 0 ? 2 : ret);
|
||||
}
|
||||
@@ -268,7 +248,7 @@ int verify_main(int argc, char **argv)
|
||||
static int check(X509_STORE *ctx, const char *file,
|
||||
STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
|
||||
STACK_OF(X509_CRL) *crls, int show_chain,
|
||||
unsigned char *sm2id, size_t sm2idlen)
|
||||
STACK_OF(OPENSSL_STRING) *opts)
|
||||
{
|
||||
X509 *x = NULL;
|
||||
int i = 0, ret = 0;
|
||||
@@ -276,28 +256,19 @@ static int check(X509_STORE *ctx, const char *file,
|
||||
STACK_OF(X509) *chain = NULL;
|
||||
int num_untrusted;
|
||||
|
||||
x = load_cert(file, FORMAT_PEM, "certificate file");
|
||||
x = load_cert(file, FORMAT_UNDEF, "certificate file");
|
||||
if (x == NULL)
|
||||
goto end;
|
||||
|
||||
if (sm2id != NULL) {
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING *v;
|
||||
|
||||
v = ASN1_OCTET_STRING_new();
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err, "error: SM2 ID allocation failed\n");
|
||||
goto end;
|
||||
if (opts != NULL) {
|
||||
for (i = 0; i < sk_OPENSSL_STRING_num(opts); i++) {
|
||||
char *opt = sk_OPENSSL_STRING_value(opts, i);
|
||||
if (x509_ctrl_string(x, opt) <= 0) {
|
||||
BIO_printf(bio_err, "parameter error \"%s\"\n", opt);
|
||||
ERR_print_errors(bio_err);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ASN1_OCTET_STRING_set(v, sm2id, sm2idlen)) {
|
||||
BIO_printf(bio_err, "error: setting SM2 ID failed\n");
|
||||
ASN1_OCTET_STRING_free(v);
|
||||
goto end;
|
||||
}
|
||||
|
||||
X509_set0_sm2_id(x, v);
|
||||
#endif
|
||||
}
|
||||
|
||||
csc = X509_STORE_CTX_new();
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
|
||||
+38
-31
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -28,12 +28,18 @@
|
||||
# include <openssl/dsa.h>
|
||||
#endif
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
#undef POSTFIX
|
||||
#define POSTFIX ".srl"
|
||||
#define DEF_DAYS 30
|
||||
|
||||
static int callb(int ok, X509_STORE_CTX *ctx);
|
||||
static int sign(X509 *x, EVP_PKEY *pkey, EVP_PKEY *fkey, int days, int clrext,
|
||||
static int sign(X509 *x, EVP_PKEY *pkey, EVP_PKEY *fkey,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
int days, int clrext,
|
||||
const EVP_MD *digest, CONF *conf, const char *section,
|
||||
int preserve_dates);
|
||||
static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *digest,
|
||||
@@ -48,7 +54,7 @@ static int print_x509v3_exts(BIO *bio, X509 *x, const char *exts);
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_INFORM, OPT_OUTFORM, OPT_KEYFORM, OPT_REQ, OPT_CAFORM,
|
||||
OPT_CAKEYFORM, OPT_SIGOPT, OPT_DAYS, OPT_PASSIN, OPT_EXTFILE,
|
||||
OPT_CAKEYFORM, OPT_VFYOPT, OPT_SIGOPT, OPT_DAYS, OPT_PASSIN, OPT_EXTFILE,
|
||||
OPT_EXTENSIONS, OPT_IN, OPT_OUT, OPT_SIGNKEY, OPT_CA, OPT_CAKEY,
|
||||
OPT_CASERIAL, OPT_SET_SERIAL, OPT_NEW, OPT_FORCE_PUBKEY, OPT_SUBJ,
|
||||
OPT_ADDTRUST, OPT_ADDREJECT, OPT_SETALIAS, OPT_CERTOPT, OPT_NAMEOPT,
|
||||
@@ -72,14 +78,15 @@ const OPTIONS x509_options[] = {
|
||||
#endif
|
||||
|
||||
{"inform", OPT_INFORM, 'f',
|
||||
"Input format - default PEM (one of DER or PEM)"},
|
||||
"CSR input format (DER or PEM) - default PEM"},
|
||||
{"in", OPT_IN, '<', "Input file - default stdin"},
|
||||
{"passin", OPT_PASSIN, 's', "Private key password/pass-phrase source"},
|
||||
{"outform", OPT_OUTFORM, 'f',
|
||||
"Output format - default PEM (one of DER or PEM)"},
|
||||
"Output format (DER or PEM) - default PEM"},
|
||||
{"out", OPT_OUT, '>', "Output file - default stdout"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Private key format (ENGINE, other values ignored)"},
|
||||
{"req", OPT_REQ, '-', "Input is a certificate request, sign and output"},
|
||||
{"vfyopt", OPT_VFYOPT, 's', "Verification parameter in n:v form"},
|
||||
|
||||
OPT_SECTION("Output"),
|
||||
{"serial", OPT_SERIAL, '-', "Print serial number value"},
|
||||
@@ -114,7 +121,7 @@ const OPTIONS x509_options[] = {
|
||||
{"issuer_hash_old", OPT_ISSUER_HASH_OLD, '-',
|
||||
"Print old-style (MD5) subject hash value"},
|
||||
#endif
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"},
|
||||
{"nameopt", OPT_NAMEOPT, 's', "Certificate subject/issuer name printing options"},
|
||||
|
||||
OPT_SECTION("Certificate"),
|
||||
{"startdate", OPT_STARTDATE, '-', "Set notBefore field"},
|
||||
@@ -145,8 +152,8 @@ const OPTIONS x509_options[] = {
|
||||
{"extfile", OPT_EXTFILE, '<', "File with X509V3 extensions to add"},
|
||||
OPT_R_OPTIONS,
|
||||
OPT_PROV_OPTIONS,
|
||||
{"CAform", OPT_CAFORM, 'F', "CA format - default PEM"},
|
||||
{"CAkeyform", OPT_CAKEYFORM, 'E', "CA key format - default PEM"},
|
||||
{"CAform", OPT_CAFORM, 'F', "CA cert format (PEM/DER/P12); has no effect"},
|
||||
{"CAkeyform", OPT_CAKEYFORM, 'E', "CA key format (ENGINE, other values ignored)"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"CAcreateserial", OPT_CACREATESERIAL, '-',
|
||||
"Create serial number file if it does not exist"},
|
||||
@@ -174,7 +181,7 @@ int x509_main(int argc, char **argv)
|
||||
const unsigned long chtype = MBSTRING_ASC;
|
||||
const int multirdn = 0;
|
||||
STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *sigopts = NULL, *vfyopts = NULL;
|
||||
X509 *x = NULL, *xca = NULL;
|
||||
X509_REQ *req = NULL, *rq = NULL;
|
||||
X509_STORE *ctx = NULL;
|
||||
@@ -221,7 +228,7 @@ int x509_main(int argc, char **argv)
|
||||
ret = 0;
|
||||
goto end;
|
||||
case OPT_INFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &informat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &informat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_IN:
|
||||
@@ -232,15 +239,15 @@ int x509_main(int argc, char **argv)
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &keyformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &keyformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_CAFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &CAformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &CAformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_CAKEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &CAkeyformat))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_ANY, &CAkeyformat))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_OUT:
|
||||
@@ -256,6 +263,12 @@ int x509_main(int argc, char **argv)
|
||||
if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_VFYOPT:
|
||||
if (!vfyopts)
|
||||
vfyopts = sk_OPENSSL_STRING_new_null();
|
||||
if (!vfyopts || !sk_OPENSSL_STRING_push(vfyopts, opt_arg()))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_DAYS:
|
||||
if (preserve_dates)
|
||||
goto opthelp;
|
||||
@@ -559,24 +572,16 @@ int x509_main(int argc, char **argv)
|
||||
|
||||
if (reqfile) {
|
||||
EVP_PKEY *pkey;
|
||||
BIO *in;
|
||||
|
||||
in = bio_open_default(infile, 'r', informat);
|
||||
if (in == NULL)
|
||||
req = load_csr(infile, informat, "certificate request input");
|
||||
if (req == NULL)
|
||||
goto end;
|
||||
req = PEM_read_bio_X509_REQ(in, NULL, NULL, NULL);
|
||||
BIO_free(in);
|
||||
|
||||
if (req == NULL) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((pkey = X509_REQ_get0_pubkey(req)) == NULL) {
|
||||
BIO_printf(bio_err, "error unpacking public key\n");
|
||||
goto end;
|
||||
}
|
||||
i = X509_REQ_verify(req, pkey);
|
||||
i = do_X509_REQ_verify(req, pkey, vfyopts);
|
||||
if (i < 0) {
|
||||
BIO_printf(bio_err, "Request self-signature verification error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -626,7 +631,7 @@ int x509_main(int argc, char **argv)
|
||||
if (!X509_set_pubkey(x, fkey != NULL ? fkey : X509_REQ_get0_pubkey(req)))
|
||||
goto end;
|
||||
} else {
|
||||
x = load_cert(infile, informat, "Certificate");
|
||||
x = load_cert(infile, FORMAT_UNDEF, "Certificate");
|
||||
if (x == NULL)
|
||||
goto end;
|
||||
if (fkey != NULL && !X509_set_pubkey(x, fkey))
|
||||
@@ -848,8 +853,8 @@ int x509_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!sign(x, Upkey, fkey, days, clrext, digest, extconf,
|
||||
extsect, preserve_dates))
|
||||
if (!sign(x, Upkey, fkey, sigopts, days, clrext, digest,
|
||||
extconf, extsect, preserve_dates))
|
||||
goto end;
|
||||
} else if (CA_flag == i) {
|
||||
BIO_printf(bio_err, "Getting CA Private Key\n");
|
||||
@@ -949,6 +954,7 @@ int x509_main(int argc, char **argv)
|
||||
EVP_PKEY_free(CApkey);
|
||||
EVP_PKEY_free(fkey);
|
||||
sk_OPENSSL_STRING_free(sigopts);
|
||||
sk_OPENSSL_STRING_free(vfyopts);
|
||||
X509_REQ_free(rq);
|
||||
ASN1_INTEGER_free(sno);
|
||||
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
||||
@@ -1106,11 +1112,12 @@ static int callb(int ok, X509_STORE_CTX *ctx)
|
||||
}
|
||||
|
||||
/* self-issue; self-sign unless a forced public key (fkey) is given */
|
||||
static int sign(X509 *x, EVP_PKEY *pkey, EVP_PKEY *fkey, int days, int clrext,
|
||||
static int sign(X509 *x, EVP_PKEY *pkey, EVP_PKEY *fkey,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
int days, int clrext,
|
||||
const EVP_MD *digest, CONF *conf, const char *section,
|
||||
int preserve_dates)
|
||||
{
|
||||
|
||||
if (!X509_set_issuer_name(x, X509_get_subject_name(x)))
|
||||
goto err;
|
||||
if (!preserve_dates && !set_cert_times(x, NULL, NULL, days))
|
||||
@@ -1129,7 +1136,7 @@ static int sign(X509 *x, EVP_PKEY *pkey, EVP_PKEY *fkey, int days, int clrext,
|
||||
if (!X509V3_EXT_add_nconf(conf, &ctx, section, x))
|
||||
goto err;
|
||||
}
|
||||
if (!X509_sign(x, pkey, digest))
|
||||
if (!do_X509_sign(x, pkey, digest, sigopts))
|
||||
goto err;
|
||||
return 1;
|
||||
err:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user