diff --git a/CHANGES b/CHANGES index e3d57b328c58..f2fc31a25c54 100644 --- a/CHANGES +++ b/CHANGES @@ -1,11488 +1,11533 @@ OpenSSL CHANGES _______________ This is a high-level summary of the most important changes. For a full list of changes, see the git commit log; for example, https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + Changes between 1.0.2m and 1.0.2n [7 Dec 2017] + + *) Read/write after SSL object in error state + + OpenSSL 1.0.2 (starting from version 1.0.2b) introduced an "error state" + mechanism. The intent was that if a fatal error occurred during a handshake + then OpenSSL would move into the error state and would immediately fail if + you attempted to continue the handshake. This works as designed for the + explicit handshake functions (SSL_do_handshake(), SSL_accept() and + SSL_connect()), however due to a bug it does not work correctly if + SSL_read() or SSL_write() is called directly. In that scenario, if the + handshake fails then a fatal error will be returned in the initial function + call. If SSL_read()/SSL_write() is subsequently called by the application + for the same SSL object then it will succeed and the data is passed without + being decrypted/encrypted directly from the SSL/TLS record layer. + + In order to exploit this issue an application bug would have to be present + that resulted in a call to SSL_read()/SSL_write() being issued after having + already received a fatal error. + + This issue was reported to OpenSSL by David Benjamin (Google). + (CVE-2017-3737) + [Matt Caswell] + + *) rsaz_1024_mul_avx2 overflow bug on x86_64 + + There is an overflow bug in the AVX2 Montgomery multiplication procedure + used in exponentiation with 1024-bit moduli. No EC algorithms are affected. + Analysis suggests that attacks against RSA and DSA as a result of this + defect would be very difficult to perform and are not believed likely. + Attacks against DH1024 are considered just feasible, because most of the + work necessary to deduce information about a private key may be performed + offline. The amount of resources required for such an attack would be + significant. However, for an attack on TLS to be meaningful, the server + would have to share the DH1024 private key among multiple clients, which is + no longer an option since CVE-2016-0701. + + This only affects processors that support the AVX2 but not ADX extensions + like Intel Haswell (4th generation). + + This issue was reported to OpenSSL by David Benjamin (Google). The issue + was originally found via the OSS-Fuzz project. + (CVE-2017-3738) + [Andy Polyakov] + Changes between 1.0.2l and 1.0.2m [2 Nov 2017] *) bn_sqrx8x_internal carry bug on x86_64 There is a carry propagating bug in the x86_64 Montgomery squaring procedure. No EC algorithms are affected. Analysis suggests that attacks against RSA and DSA as a result of this defect would be very difficult to perform and are not believed likely. Attacks against DH are considered just feasible (although very difficult) because most of the work necessary to deduce information about a private key may be performed offline. The amount of resources required for such an attack would be very significant and likely only accessible to a limited number of attackers. An attacker would additionally need online access to an unpatched system using the target private key in a scenario with persistent DH parameters and a private key that is shared between multiple clients. This only affects processors that support the BMI1, BMI2 and ADX extensions like Intel Broadwell (5th generation) and later or AMD Ryzen. This issue was reported to OpenSSL by the OSS-Fuzz project. (CVE-2017-3736) [Andy Polyakov] *) Malformed X.509 IPAddressFamily could cause OOB read If an X.509 certificate has a malformed IPAddressFamily extension, OpenSSL could do a one-byte buffer overread. The most likely result would be an erroneous display of the certificate in text format. This issue was reported to OpenSSL by the OSS-Fuzz project. (CVE-2017-3735) [Rich Salz] 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] *) Truncated packet could crash via OOB read If one side of an SSL/TLS path is running on a 32-bit host and a specific cipher is being used, then a truncated packet can cause that host to perform an out-of-bounds read, usually resulting in a crash. This issue was reported to OpenSSL by Robert Święcki of Google. (CVE-2017-3731) [Andy Polyakov] *) BN_mod_exp may produce incorrect results on x86_64 There is a carry propagating bug in the x86_64 Montgomery squaring procedure. No EC algorithms are affected. Analysis suggests that attacks against RSA and DSA as a result of this defect would be very difficult to perform and are not believed likely. Attacks against DH are considered just feasible (although very difficult) because most of the work necessary to deduce information about a private key may be performed offline. The amount of resources required for such an attack would be very significant and likely only accessible to a limited number of attackers. An attacker would additionally need online access to an unpatched system using the target private key in a scenario with persistent DH parameters and a private key that is shared between multiple clients. For example this can occur by default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very similar to CVE-2015-3193 but must be treated as a separate problem. This issue was reported to OpenSSL by the OSS-Fuzz project. (CVE-2017-3732) [Andy Polyakov] *) Montgomery multiplication may produce incorrect results There is a carry propagating bug in the Broadwell-specific Montgomery multiplication procedure that handles input lengths divisible by, but longer than 256 bits. Analysis suggests that attacks against RSA, DSA and DH private keys are impossible. This is because the subroutine in question is not used in operations with the private key itself and an input of the attacker's direct choice. Otherwise the bug can manifest itself as transient authentication and key negotiation failures or reproducible erroneous outcome of public-key operations with specially crafted input. Among EC algorithms only Brainpool P-512 curves are affected and one presumably can attack ECDH key negotiation. Impact was not analyzed in detail, because pre-requisites for attack are considered unlikely. Namely multiple clients have to choose the curve in question and the server has to share the private key among them, neither of which is default behaviour. Even then only clients that chose the curve will be affected. This issue was publicly reported as transient failures and was not initially recognized as a security issue. Thanks to Richard Morgan for providing reproducible case. (CVE-2016-7055) [Andy Polyakov] *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to prevent issues where no progress is being made and the peer continually sends unrecognised record types, using up resources processing them. [Matt Caswell] Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check A bug fix which included a CRL sanity check was added to OpenSSL 1.1.0 but was omitted from OpenSSL 1.0.2i. As a result any attempt to use CRLs in OpenSSL 1.0.2i will crash with a null pointer exception. This issue only affects the OpenSSL 1.0.2i (CVE-2016-7052) [Matt Caswell] Changes between 1.0.2h and 1.0.2i [22 Sep 2016] *) OCSP Status Request extension unbounded memory growth A malicious client can send an excessively large OCSP Status Request extension. If that client continually requests renegotiation, sending a large OCSP Status Request extension each time, then there will be unbounded memory growth on the server. This will eventually lead to a Denial Of Service attack through memory exhaustion. Servers with a default configuration are vulnerable even if they do not support OCSP. Builds using the "no-ocsp" build time option are not affected. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-6304) [Matt Caswell] *) In order to mitigate the SWEET32 attack, the DES ciphers were moved from HIGH to MEDIUM. This issue was reported to OpenSSL Karthikeyan Bhargavan and Gaetan Leurent (INRIA) (CVE-2016-2183) [Rich Salz] *) OOB write in MDC2_Update() An overflow can occur in MDC2_Update() either if called directly or through the EVP_DigestUpdate() function using MDC2. If an attacker is able to supply very large amounts of input data after a previous call to EVP_EncryptUpdate() with a partial block then a length check can overflow resulting in a heap corruption. The amount of data needed is comparable to SIZE_MAX which is impractical on most platforms. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-6303) [Stephen Henson] *) Malformed SHA512 ticket DoS If a server uses SHA512 for TLS session ticket HMAC it is vulnerable to a DoS attack where a malformed ticket will result in an OOB read which will ultimately crash. The use of SHA512 in TLS session tickets is comparatively rare as it requires a custom server callback and ticket lookup mechanism. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-6302) [Stephen Henson] *) OOB write in BN_bn2dec() The function BN_bn2dec() does not check the return value of BN_div_word(). This can cause an OOB write if an application uses this function with an overly large BIGNUM. This could be a problem if an overly large certificate or CRL is printed out from an untrusted source. TLS is not affected because record limits will reject an oversized certificate before it is parsed. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-2182) [Stephen Henson] *) OOB read in TS_OBJ_print_bio() The function TS_OBJ_print_bio() misuses OBJ_obj2txt(): the return value is the total length the OID text representation would use and not the amount of data written. This will result in OOB reads when large OIDs are presented. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-2180) [Stephen Henson] *) Pointer arithmetic undefined behaviour Avoid some undefined pointer arithmetic A common idiom in the codebase is to check limits in the following manner: "p + len > limit" Where "p" points to some malloc'd data of SIZE bytes and limit == p + SIZE "len" here could be from some externally supplied data (e.g. from a TLS message). The rules of C pointer arithmetic are such that "p + len" is only well defined where len <= SIZE. Therefore the above idiom is actually undefined behaviour. For example this could cause problems if some malloc implementation provides an address for "p" such that "p + len" actually overflows for values of len that are too big and therefore p + len < limit. This issue was reported to OpenSSL by Guido Vranken (CVE-2016-2177) [Matt Caswell] *) Constant time flag not preserved in DSA signing Operations in the DSA signing algorithm should run in constant time in order to avoid side channel attacks. A flaw in the OpenSSL DSA implementation means that a non-constant time codepath is followed for certain operations. This has been demonstrated through a cache-timing attack to be sufficient for an attacker to recover the private DSA key. This issue was reported by César Pereida (Aalto University), Billy Brumley (Tampere University of Technology), and Yuval Yarom (The University of Adelaide and NICTA). (CVE-2016-2178) [César Pereida] *) DTLS buffered message DoS In a DTLS connection where handshake messages are delivered out-of-order those messages that OpenSSL is not yet ready to process will be buffered for later use. Under certain circumstances, a flaw in the logic means that those messages do not get removed from the buffer even though the handshake has been completed. An attacker could force up to approx. 15 messages to remain in the buffer when they are no longer required. These messages will be cleared when the DTLS connection is closed. The default maximum size for a message is 100k. Therefore the attacker could force an additional 1500k to be consumed per connection. By opening many simulataneous connections an attacker could cause a DoS attack through memory exhaustion. This issue was reported to OpenSSL by Quan Luo. (CVE-2016-2179) [Matt Caswell] *) DTLS replay protection DoS A flaw in the DTLS replay attack protection mechanism means that records that arrive for future epochs update the replay protection "window" before the MAC for the record has been validated. This could be exploited by an attacker by sending a record for the next epoch (which does not have to decrypt or have a valid MAC), with a very large sequence number. This means that all subsequent legitimate packets are dropped causing a denial of service for a specific DTLS connection. This issue was reported to OpenSSL by the OCAP audit team. (CVE-2016-2181) [Matt Caswell] *) Certificate message OOB reads In OpenSSL 1.0.2 and earlier some missing message length checks can result in OOB reads of up to 2 bytes beyond an allocated buffer. There is a theoretical DoS risk but this has not been observed in practice on common platforms. The messages affected are client certificate, client certificate request and server certificate. As a result the attack can only be performed against a client or a server which enables client authentication. This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.) (CVE-2016-6306) [Stephen Henson] Changes between 1.0.2g and 1.0.2h [3 May 2016] *) Prevent padding oracle in AES-NI CBC MAC check A MITM attacker can use a padding oracle attack to decrypt traffic when the connection uses an AES CBC cipher and the server support AES-NI. This issue was introduced as part of the fix for Lucky 13 padding attack (CVE-2013-0169). The padding check was rewritten to be in constant time by making sure that always the same bytes are read and compared against either the MAC or padding bytes. But it no longer checked that there was enough data to have both the MAC and padding bytes. This issue was reported by Juraj Somorovsky using TLS-Attacker. (CVE-2016-2107) [Kurt Roeckx] *) Fix EVP_EncodeUpdate overflow An overflow can occur in the EVP_EncodeUpdate() function which is used for Base64 encoding of binary data. If an attacker is able to supply very large amounts of input data then a length check can overflow resulting in a heap 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 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 with large amounts of untrusted data may also be vulnerable. This issue was reported by Guido Vranken. (CVE-2016-2105) [Matt Caswell] *) Fix EVP_EncryptUpdate overflow An overflow can occur in the EVP_EncryptUpdate() function. If an attacker is able to supply very large amounts of input data after a previous call to EVP_EncryptUpdate() with a partial block then a length check can overflow resulting in a heap corruption. Following an analysis of all OpenSSL internal usage of the EVP_EncryptUpdate() function all usage is one of two forms. The first form is where the EVP_EncryptUpdate() call is known to be the first called function after an EVP_EncryptInit(), and therefore that specific call must be safe. The second form is where the length passed to EVP_EncryptUpdate() can be seen from the code to be some small value and therefore there is no possibility of an overflow. Since all instances are one of these two forms, it is believed that there can be no overflows in internal code due to this problem. It should be noted that EVP_DecryptUpdate() can call EVP_EncryptUpdate() in certain code paths. Also EVP_CipherUpdate() is a synonym for EVP_EncryptUpdate(). All instances of these calls have also been analysed too and it is believed there are no instances in internal usage where an overflow could occur. This issue was reported by Guido Vranken. (CVE-2016-2106) [Matt Caswell] *) Prevent ASN.1 BIO excessive memory allocation When ASN.1 data is read from a BIO using functions such as d2i_CMS_bio() a short invalid encoding can casuse allocation of large amounts of memory potentially consuming excessive resources or exhausting memory. Any application parsing untrusted data through d2i BIO functions is affected. The memory based functions such as d2i_X509() are *not* affected. Since the memory based functions are used by the TLS library, TLS applications are not affected. This issue was reported by Brian Carpenter. (CVE-2016-2109) [Stephen Henson] *) EBCDIC overread ASN1 Strings that are over 1024 bytes can cause an overread in applications using the X509_NAME_oneline() function on EBCDIC systems. This could result in arbitrary stack data being returned in the buffer. This issue was reported by Guido Vranken. (CVE-2016-2176) [Matt Caswell] *) Modify behavior of ALPN to invoke callback after SNI/servername callback, such that updates to the SSL_CTX affect ALPN. [Todd Short] *) Remove LOW from the DEFAULT cipher list. This removes singles DES from the default. [Kurt Roeckx] *) Only remove the SSLv2 methods with the no-ssl2-method option. When the methods are enabled and ssl2 is disabled the methods return NULL. [Kurt Roeckx] 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 provide any "EXPORT" or "LOW" strength ciphers. [Viktor Dukhovni] * Disable SSLv2 default build, default negotiation and weak ciphers. SSLv2 is by default disabled at build-time. Builds that are not configured with "enable-ssl2" will not support SSLv2. Even if "enable-ssl2" is used, users who want to negotiate SSLv2 via the version-flexible SSLv23_method() will need to explicitly call either of: SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2); or SSL_clear_options(ssl, SSL_OP_NO_SSLv2); as appropriate. Even if either of those is used, or the application explicitly uses the version-specific SSLv2_method() or its client and server variants, SSLv2 ciphers vulnerable to exhaustive search key recovery have been removed. Specifically, the SSLv2 40-bit EXPORT ciphers, and SSLv2 56-bit DES are no longer available. (CVE-2016-0800) [Viktor Dukhovni] *) Fix a double-free in DSA code A double free bug was discovered when OpenSSL parses malformed DSA private keys and could lead to a DoS attack or memory corruption for applications that receive DSA private keys from untrusted sources. This scenario is considered rare. This issue was reported to OpenSSL by Adam Langley(Google/BoringSSL) using libFuzzer. (CVE-2016-0705) [Stephen Henson] *) Disable SRP fake user seed to address a server memory leak. Add a new method SRP_VBASE_get1_by_user that handles the seed properly. SRP_VBASE_get_by_user had inconsistent memory management behaviour. In order to fix an unavoidable memory leak, SRP_VBASE_get_by_user was changed to ignore the "fake user" SRP seed, even if the seed is configured. Users should use SRP_VBASE_get1_by_user instead. Note that in SRP_VBASE_get1_by_user, caller must free the returned value. Note also that even though configuring the SRP seed attempts to hide invalid usernames by continuing the handshake with fake credentials, this behaviour is not constant time and no strong guarantees are made that the handshake is indistinguishable from that of a valid user. (CVE-2016-0798) [Emilia Käsper] *) Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption In the BN_hex2bn function the number of hex digits is calculated using an int value |i|. Later |bn_expand| is called with a value of |i * 4|. For large values of |i| this can result in |bn_expand| not allocating any memory because |i * 4| is negative. This can leave the internal BIGNUM data field as NULL leading to a subsequent NULL ptr deref. For very large values of |i|, the calculation |i * 4| could be a positive value smaller than |i|. In this case memory is allocated to the internal BIGNUM data field, but it is insufficiently sized leading to heap corruption. A similar issue exists in BN_dec2bn. This could have security consequences if BN_hex2bn/BN_dec2bn is ever called by user applications with very large untrusted hex/dec data. This is anticipated to be a rare occurrence. All OpenSSL internal usage of these functions use data that is not expected to be untrusted, e.g. config file data or application command line arguments. If user developed applications generate config file data based on untrusted data then it is possible that this could also lead to security consequences. This is also anticipated to be rare. This issue was reported to OpenSSL by Guido Vranken. (CVE-2016-0797) [Matt Caswell] *) 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 string and cause an OOB read when printing very long strings. Additionally the internal |doapr_outch| function can attempt to write to an OOB memory location (at an offset from the NULL pointer) in the event of a memory allocation failure. In 1.0.2 and below this could be caused where the size of a buffer to be allocated is greater than INT_MAX. E.g. this could be in processing a very long "%s" format string. Memory leaks can also occur. 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 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 untrusted sources. OpenSSL command line applications could also be vulnerable where they print out ASN.1 data, or if untrusted data is passed as command line arguments. Libssl is not considered directly vulnerable. Additionally certificates etc received via remote connections via libssl are also unlikely to be able to trigger these issues because of message size limits enforced within libssl. This issue was reported to OpenSSL Guido Vranken. (CVE-2016-0799) [Matt Caswell] *) Side channel attack on modular exponentiation A side-channel attack was found which makes use of cache-bank conflicts on the Intel Sandy-Bridge microarchitecture which could lead to the recovery of RSA keys. The ability to exploit this issue is limited as it relies on an attacker who has control of code in a thread running on the same hyper-threaded core as the victim thread which is performing decryptions. 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. (CVE-2016-0702) [Andy Polyakov] *) Change the req app to generate a 2048-bit RSA/DSA key by default, if no keysize is specified with default_bits. This fixes an omission in an earlier change that changed all RSA/DSA key generation apps to use 2048 bits by default. [Emilia Käsper] 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" primes. More recently (in version 1.0.2) support was provided for generating X9.42 style parameter files such as those required for RFC 5114 support. The primes used in such files may not be "safe". Where an application is using DH configured with parameters based on primes that are not "safe" then an attacker could use this fact to find a peer's private DH exponent. This attack requires that the attacker complete multiple handshakes in which the peer uses the same private DH exponent. For example this could be used to discover a TLS server's private DH exponent if it's reusing the private DH exponent or it's using a static DH ciphersuite. OpenSSL provides the option SSL_OP_SINGLE_DH_USE for ephemeral DH (DHE) in TLS. It is not on by default. If the option is not set then the server reuses the same private DH exponent for the life of the server process and would be vulnerable to this attack. It is believed that many popular applications do set this option and would therefore not be at risk. The fix for this issue adds an additional check where a "q" parameter is available (as is the case in X9.42 based parameters). This detects the only known attack, and is the only possible defense for static DH ciphersuites. This could have some performance impact. Additionally the SSL_OP_SINGLE_DH_USE option has been switched on by default and cannot be disabled. This could have some performance impact. This issue was reported to OpenSSL by Antonio Sanso (Adobe). (CVE-2016-0701) [Matt Caswell] *) SSLv2 doesn't block disabled ciphers A malicious client can negotiate SSLv2 ciphers that have been disabled on the server and complete SSLv2 handshakes even if all SSLv2 ciphers have been disabled, provided that the SSLv2 protocol was not also disabled via SSL_OP_NO_SSLv2. This issue was reported to OpenSSL on 26th December 2015 by Nimrod Aviram and Sebastian Schinzel. (CVE-2015-3197) [Viktor Dukhovni] *) Reject DH handshakes with parameters shorter than 1024 bits. [Kurt Roeckx] Changes between 1.0.2d and 1.0.2e [3 Dec 2015] *) BN_mod_exp may produce incorrect results on x86_64 There is a carry propagating bug in the x86_64 Montgomery squaring procedure. No EC algorithms are affected. Analysis suggests that attacks against RSA and DSA as a result of this defect would be very difficult to perform and are not believed likely. Attacks against DH are considered just feasible (although very difficult) because most of the work necessary to deduce information about a private key may be performed offline. The amount of resources required for such an attack would be very significant and likely only accessible to a limited number of attackers. An attacker would additionally need online access to an unpatched system using the target private key in a scenario with persistent DH parameters and a private key that is shared between multiple clients. For example this can occur by default in OpenSSL DHE based SSL/TLS ciphersuites. This issue was reported to OpenSSL by Hanno Böck. (CVE-2015-3193) [Andy Polyakov] *) Certificate verify crash with missing PSS parameter The signature verification routines will crash with a NULL pointer dereference if presented with an ASN.1 signature using the RSA PSS algorithm and absent mask generation function parameter. Since these routines are used to verify certificate signature algorithms this can be used to crash any certificate verification operation and exploited in a DoS attack. Any application which performs certificate verification is vulnerable including OpenSSL clients and servers which enable client authentication. This issue was reported to OpenSSL by Loïc Jonas Etienne (Qnective AG). (CVE-2015-3194) [Stephen Henson] *) X509_ATTRIBUTE memory leak When presented with a malformed X509_ATTRIBUTE structure OpenSSL will leak memory. This structure is used by the PKCS#7 and CMS routines so any application which reads PKCS#7 or CMS data from untrusted sources is affected. SSL/TLS is not affected. This issue was reported to OpenSSL by Adam Langley (Google/BoringSSL) using libFuzzer. (CVE-2015-3195) [Stephen Henson] *) Rewrite EVP_DecodeUpdate (base64 decoding) to fix several bugs. This changes the decoding behaviour for some invalid messages, though the change is mostly in the more lenient direction, and legacy behaviour is preserved as much as possible. [Emilia Käsper] *) In DSA_generate_parameters_ex, if the provided seed is too short, use a random seed, as already documented. [Rich Salz and Ismo Puustinen ] Changes between 1.0.2c and 1.0.2d [9 Jul 2015] *) Alternate chains certificate forgery During certificate verfification, OpenSSL will attempt to find an alternative certificate chain if the first attempt to build such a chain fails. An error in the implementation of this logic can mean that an attacker could cause certain checks on untrusted certificates to be bypassed, such as the CA flag, enabling them to use a valid leaf certificate to act as a CA and "issue" an invalid certificate. This issue was reported to OpenSSL by Adam Langley/David Benjamin (Google/BoringSSL). (CVE-2015-1793) [Matt Caswell] *) Race condition handling PSK identify hint If PSK identity hints are received by a multi-threaded client then the values are wrongly updated in the parent SSL_CTX structure. This can result in a race condition potentially leading to a double free of the identify hint data. (CVE-2015-3196) [Stephen Henson] 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 restored. Changes between 1.0.2a and 1.0.2b [11 Jun 2015] *) Malformed ECParameters causes infinite loop When processing an ECParameters structure OpenSSL enters an infinite loop if the curve specified is over a specially malformed binary polynomial field. This can be used to perform denial of service against any system which processes public keys, certificate requests or certificates. This includes TLS clients and TLS servers with client authentication enabled. This issue was reported to OpenSSL by Joseph Barr-Pixton. (CVE-2015-1788) [Andy Polyakov] *) Exploitable out-of-bounds read in X509_cmp_time X509_cmp_time does not properly check the length of the ASN1_TIME string and can read a few bytes out of bounds. In addition, X509_cmp_time accepts an arbitrary number of fractional seconds in the time string. An attacker can use this to craft malformed certificates and CRLs of various sizes and potentially cause a segmentation fault, resulting in a DoS on applications that verify certificates or CRLs. TLS clients that verify CRLs are affected. TLS clients and servers with client authentication enabled may be affected if they use custom verification callbacks. This issue was reported to OpenSSL by Robert Swiecki (Google), and independently by Hanno Böck. (CVE-2015-1789) [Emilia Käsper] *) PKCS7 crash with missing EnvelopedContent The PKCS#7 parsing code does not handle missing inner EncryptedContent correctly. An attacker can craft malformed ASN.1-encoded PKCS#7 blobs with missing content and trigger a NULL pointer dereference on parsing. Applications that decrypt PKCS#7 data or otherwise parse PKCS#7 structures from untrusted sources are affected. OpenSSL clients and servers are not affected. This issue was reported to OpenSSL by Michal Zalewski (Google). (CVE-2015-1790) [Emilia Käsper] *) CMS verify infinite loop with unknown hash function When verifying a signedData message the CMS code can enter an infinite loop if presented with an unknown hash function OID. This can be used to perform denial of service against any system which verifies signedData messages using the CMS code. This issue was reported to OpenSSL by Johannes Bauer. (CVE-2015-1792) [Stephen Henson] *) Race condition handling NewSessionTicket If a NewSessionTicket is received by a multi-threaded client when attempting to reuse a previous ticket then a race condition can occur potentially leading to a double free of the ticket data. (CVE-2015-1791) [Matt Caswell] *) Removed support for the two export grade static DH ciphersuites EXP-DH-RSA-DES-CBC-SHA and EXP-DH-DSS-DES-CBC-SHA. These two ciphersuites were newly added (along with a number of other static DH ciphersuites) to 1.0.2. However the two export ones have *never* worked since they were introduced. It seems strange in any case to be adding new export ciphersuites, and given "logjam" it also does not seem correct to fix them. [Matt Caswell] *) Only support 256-bit or stronger elliptic curves with the 'ecdh_auto' setting (server) or by default (client). Of supported curves, prefer P-256 (both). [Emilia Kasper] *) Reject DH handshakes with parameters shorter than 768 bits. [Kurt Roeckx and Emilia Kasper] Changes between 1.0.2 and 1.0.2a [19 Mar 2015] *) ClientHello sigalgs DoS fix If a client connects to an OpenSSL 1.0.2 server and renegotiates with an invalid signature algorithms extension a NULL pointer dereference will occur. This can be exploited in a DoS attack against the server. This issue was was reported to OpenSSL by David Ramos of Stanford University. (CVE-2015-0291) [Stephen Henson and Matt Caswell] *) Multiblock corrupted pointer fix OpenSSL 1.0.2 introduced the "multiblock" performance improvement. This feature only applies on 64 bit x86 architecture platforms that support AES NI instructions. A defect in the implementation of "multiblock" can cause OpenSSL's internal write buffer to become incorrectly set to NULL when using non-blocking IO. Typically, when the user application is using a socket BIO for writing, this will only result in a failed connection. However if some other BIO is used then it is likely that a segmentation fault will be triggered, thus enabling a potential DoS attack. This issue was reported to OpenSSL by Daniel Danner and Rainer Mueller. (CVE-2015-0290) [Matt Caswell] *) Segmentation fault in DTLSv1_listen fix The DTLSv1_listen function is intended to be stateless and processes the initial ClientHello from many peers. It is common for user code to loop over the call to DTLSv1_listen until a valid ClientHello is received with an associated cookie. A defect in the implementation of DTLSv1_listen means that state is preserved in the SSL object from one invocation to the next that can lead to a segmentation fault. Errors processing the initial ClientHello can trigger this scenario. An example of such an error could be that a DTLS1.0 only client is attempting to connect to a DTLS1.2 only server. This issue was reported to OpenSSL by Per Allansson. (CVE-2015-0207) [Matt Caswell] *) Segmentation fault in ASN1_TYPE_cmp fix The function ASN1_TYPE_cmp will crash with an invalid read if an attempt is made to compare ASN.1 boolean types. Since ASN1_TYPE_cmp is used to check certificate signature algorithm consistency this can be used to crash any certificate verification operation and exploited in a DoS attack. Any application which performs certificate verification is vulnerable including OpenSSL clients and servers which enable client authentication. (CVE-2015-0286) [Stephen Henson] *) Segmentation fault for invalid PSS parameters fix The signature verification routines will crash with a NULL pointer dereference if presented with an ASN.1 signature using the RSA PSS algorithm and invalid parameters. Since these routines are used to verify certificate signature algorithms this can be used to crash any certificate verification operation and exploited in a DoS attack. Any application which performs certificate verification is vulnerable including OpenSSL clients and servers which enable client authentication. This issue was was reported to OpenSSL by Brian Carpenter. (CVE-2015-0208) [Stephen Henson] *) ASN.1 structure reuse memory corruption fix Reusing a structure in ASN.1 parsing may allow an attacker to cause memory corruption via an invalid write. Such reuse is and has been strongly discouraged and is believed to be rare. Applications that parse structures containing CHOICE or ANY DEFINED BY components may be affected. Certificate parsing (d2i_X509 and related functions) are however not affected. OpenSSL clients and servers are not affected. (CVE-2015-0287) [Stephen Henson] *) PKCS7 NULL pointer dereferences fix The PKCS#7 parsing code does not handle missing outer ContentInfo correctly. An attacker can craft malformed ASN.1-encoded PKCS#7 blobs with missing content and trigger a NULL pointer dereference on parsing. Applications that verify PKCS#7 signatures, decrypt PKCS#7 data or otherwise parse PKCS#7 structures from untrusted sources are affected. OpenSSL clients and servers are not affected. This issue was reported to OpenSSL by Michal Zalewski (Google). (CVE-2015-0289) [Emilia Käsper] *) DoS via reachable assert in SSLv2 servers fix A malicious client can trigger an OPENSSL_assert (i.e., an abort) in servers that both support SSLv2 and enable export cipher suites by sending a specially crafted SSLv2 CLIENT-MASTER-KEY message. This issue was discovered by Sean Burford (Google) and Emilia Käsper (OpenSSL development team). (CVE-2015-0293) [Emilia Käsper] *) Empty CKE with client auth and DHE fix If client auth is used then a server can seg fault in the event of a DHE ciphersuite being selected and a zero length ClientKeyExchange message being sent by the client. This could be exploited in a DoS attack. (CVE-2015-1787) [Matt Caswell] *) Handshake with unseeded PRNG fix Under certain conditions an OpenSSL 1.0.2 client can complete a handshake with an unseeded PRNG. The conditions are: - The client is on a platform where the PRNG has not been seeded automatically, and the user has not seeded manually - A protocol specific client method version has been used (i.e. not SSL_client_methodv23) - A ciphersuite is used that does not require additional random data from the PRNG beyond the initial ClientHello client random (e.g. PSK-RC4-SHA). If the handshake succeeds then the client random that has been used will have been generated from a PRNG with insufficient entropy and therefore the output may be predictable. For example using the following command with an unseeded openssl will succeed on an unpatched platform: openssl s_client -psk 1a2b3c4d -tls1_2 -cipher PSK-RC4-SHA (CVE-2015-0285) [Matt Caswell] *) Use After Free following d2i_ECPrivatekey error fix A malformed EC private key file consumed via the d2i_ECPrivateKey function could cause a use after free condition. This, in turn, could cause a double free in several private key parsing functions (such as d2i_PrivateKey or EVP_PKCS82PKEY) and could lead to a DoS attack or memory corruption for applications that receive EC private keys from untrusted sources. This scenario is considered rare. This issue was discovered by the BoringSSL project and fixed in their commit 517073cd4b. (CVE-2015-0209) [Matt Caswell] *) X509_to_X509_REQ NULL pointer deref fix The function X509_to_X509_REQ will crash with a NULL pointer dereference if the certificate key is invalid. This function is rarely used in practice. This issue was discovered by Brian Carpenter. (CVE-2015-0288) [Stephen Henson] *) Removed the export ciphers from the DEFAULT ciphers [Kurt Roeckx] Changes between 1.0.1l and 1.0.2 [22 Jan 2015] *) Change RSA and DH/DSA key generation apps to generate 2048-bit keys by default. [Kurt Roeckx] *) Facilitate "universal" ARM builds targeting range of ARM ISAs, e.g. ARMv5 through ARMv8, as opposite to "locking" it to single one. So far those who have to target multiple plaforms would compromise and argue that binary targeting say ARMv5 would still execute on ARMv8. "Universal" build resolves this compromise by providing near-optimal performance even on newer platforms. [Andy Polyakov] *) Accelerated NIST P-256 elliptic curve implementation for x86_64 (other platforms pending). [Shay Gueron & Vlad Krasnov (Intel Corp), Andy Polyakov] *) Add support for the SignedCertificateTimestampList certificate and OCSP response extensions from RFC6962. [Rob Stradling] *) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.) for corner cases. (Certain input points at infinity could lead to bogus results, with non-infinity inputs mapped to infinity too.) [Bodo Moeller] *) Initial support for PowerISA 2.0.7, first implemented in POWER8. This covers AES, SHA256/512 and GHASH. "Initial" means that most common cases are optimized and there still is room for further improvements. Vector Permutation AES for Altivec is also added. [Andy Polyakov] *) Add support for little-endian ppc64 Linux target. [Marcelo Cerri (IBM)] *) Initial support for AMRv8 ISA crypto extensions. This covers AES, SHA1, SHA256 and GHASH. "Initial" means that most common cases are optimized and there still is room for further improvements. Both 32- and 64-bit modes are supported. [Andy Polyakov, Ard Biesheuvel (Linaro)] *) Improved ARMv7 NEON support. [Andy Polyakov] *) Support for SPARC Architecture 2011 crypto extensions, first implemented in SPARC T4. This covers AES, DES, Camellia, SHA1, SHA256/512, MD5, GHASH and modular exponentiation. [Andy Polyakov, David Miller] *) Accelerated modular exponentiation for Intel processors, a.k.a. RSAZ. [Shay Gueron & Vlad Krasnov (Intel Corp)] *) Support for new and upcoming Intel processors, including AVX2, BMI and SHA ISA extensions. This includes additional "stitched" implementations, AESNI-SHA256 and GCM, and multi-buffer support for TLS encrypt. This work was sponsored by Intel Corp. [Andy Polyakov] *) Support for DTLS 1.2. This adds two sets of DTLS methods: DTLS_*_method() supports both DTLS 1.2 and 1.0 and should use whatever version the peer supports and DTLSv1_2_*_method() which supports DTLS 1.2 only. [Steve Henson] *) Use algorithm specific chains in SSL_CTX_use_certificate_chain_file(): this fixes a limiation in previous versions of OpenSSL. [Steve Henson] *) Extended RSA OAEP support via EVP_PKEY API. Options to specify digest, MGF1 digest and OAEP label. [Steve Henson] *) Add EVP support for key wrapping algorithms, to avoid problems with existing code the flag EVP_CIPHER_CTX_WRAP_ALLOW has to be set in the EVP_CIPHER_CTX or an error is returned. Add AES and DES3 wrap algorithms and include tests cases. [Steve Henson] *) Add functions to allocate and set the fields of an ECDSA_METHOD structure. [Douglas E. Engert, Steve Henson] *) New functions OPENSSL_gmtime_diff and ASN1_TIME_diff to find the difference in days and seconds between two tm or ASN1_TIME structures. [Steve Henson] *) Add -rev test option to s_server to just reverse order of characters received by client and send back to server. Also prints an abbreviated summary of the connection parameters. [Steve Henson] *) New option -brief for s_client and s_server to print out a brief summary of connection parameters. [Steve Henson] *) Add callbacks for arbitrary TLS extensions. [Trevor Perrin and Ben Laurie] *) New option -crl_download in several openssl utilities to download CRLs from CRLDP extension in certificates. [Steve Henson] *) New options -CRL and -CRLform for s_client and s_server for CRLs. [Steve Henson] *) New function X509_CRL_diff to generate a delta CRL from the difference of two full CRLs. Add support to "crl" utility. [Steve Henson] *) New functions to set lookup_crls function and to retrieve X509_STORE from X509_STORE_CTX. [Steve Henson] *) Print out deprecated issuer and subject unique ID fields in certificates. [Steve Henson] *) Extend OCSP I/O functions so they can be used for simple general purpose HTTP as well as OCSP. New wrapper function which can be used to download CRLs using the OCSP API. [Steve Henson] *) Delegate command line handling in s_client/s_server to SSL_CONF APIs. [Steve Henson] *) SSL_CONF* functions. These provide a common framework for application configuration using configuration files or command lines. [Steve Henson] *) SSL/TLS tracing code. This parses out SSL/TLS records using the message callback and prints the results. Needs compile time option "enable-ssl-trace". New options to s_client and s_server to enable tracing. [Steve Henson] *) New ctrl and macro to retrieve supported points extensions. Print out extension in s_server and s_client. [Steve Henson] *) New functions to retrieve certificate signature and signature OID NID. [Steve Henson] *) Add functions to retrieve and manipulate the raw cipherlist sent by a client to OpenSSL. [Steve Henson] *) New Suite B modes for TLS code. These use and enforce the requirements of RFC6460: restrict ciphersuites, only permit Suite B algorithms and only use Suite B curves. The Suite B modes can be set by using the strings "SUITEB128", "SUITEB192" or "SUITEB128ONLY" for the cipherstring. [Steve Henson] *) New chain verification flags for Suite B levels of security. Check algorithms are acceptable when flags are set in X509_verify_cert. [Steve Henson] *) Make tls1_check_chain return a set of flags indicating checks passed by a certificate chain. Add additional tests to handle client certificates: checks for matching certificate type and issuer name comparison. [Steve Henson] *) If an attempt is made to use a signature algorithm not in the peer preference list abort the handshake. If client has no suitable signature algorithms in response to a certificate request do not use the certificate. [Steve Henson] *) If server EC tmp key is not in client preference list abort handshake. [Steve Henson] *) Add support for certificate stores in CERT structure. This makes it possible to have different stores per SSL structure or one store in the parent SSL_CTX. Include distint stores for certificate chain verification and chain building. New ctrl SSL_CTRL_BUILD_CERT_CHAIN to build and store a certificate chain in CERT structure: returing an error if the chain cannot be built: this will allow applications to test if a chain is correctly configured. 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 mask based on the current session, check mask when sending client hello and checking the requested ciphersuite. [Steve Henson] *) New ctrls to retrieve and set certificate types in a certificate request message. Print out received values in s_client. If certificate types is not set with custom values set sensible values based on supported signature algorithms. [Steve Henson] *) Support for distinct client and server supported signature algorithms. [Steve Henson] *) Add certificate callback. If set this is called whenever a certificate is required by client or server. An application can decide which certificate chain to present based on arbitrary criteria: for example supported signature algorithms. Add very simple example to s_server. This fixes many of the problems and restrictions of the existing client certificate callback: for example you can now clear an existing certificate and specify the whole chain. [Steve Henson] *) Add new "valid_flags" field to CERT_PKEY structure which determines what the certificate can be used for (if anything). Set valid_flags field in new tls1_check_chain function. Simplify ssl_set_cert_masks which used to have similar checks in it. Add new "cert_flags" field to CERT structure and include a "strict mode". This enforces some TLS certificate requirements (such as only permitting certificate signature algorithms contained in the supported algorithms extension) which some implementations ignore: this option should be used with caution as it could cause interoperability issues. [Steve Henson] *) Update and tidy signature algorithm extension processing. Work out shared signature algorithms based on preferences and peer algorithms and print them out in s_client and s_server. Abort handshake if no shared signature algorithms. [Steve Henson] *) Add new functions to allow customised supported signature algorithms for SSL and SSL_CTX structures. Add options to s_client and s_server to support them. [Steve Henson] *) New function SSL_certs_clear() to delete all references to certificates from an SSL structure. Before this once a certificate had been added it couldn't be removed. [Steve Henson] *) Integrate hostname, email address and IP address checking with certificate verification. New verify options supporting checking in opensl utility. [Steve Henson] *) Fixes and wildcard matching support to hostname and email checking functions. Add manual page. [Florian Weimer (Red Hat Product Security Team)] *) New functions to check a hostname email or IP address against a certificate. Add options x509 utility to print results of checks against a certificate. [Steve Henson] *) Fix OCSP checking. [Rob Stradling and Ben Laurie] *) Initial experimental support for explicitly trusted non-root CAs. OpenSSL still tries to build a complete chain to a root but if an intermediate CA has a trust setting included that is used. The first setting is used: whether to trust (e.g., -addtrust option to the x509 utility) or reject. [Steve Henson] *) Add -trusted_first option which attempts to find certificates in the trusted store even if an untrusted chain is also supplied. [Steve Henson] *) MIPS assembly pack updates: support for MIPS32r2 and SmartMIPS ASE, platform support for Linux and Android. [Andy Polyakov] *) Support for linux-x32, ILP32 environment in x86_64 framework. [Andy Polyakov] *) Experimental multi-implementation support for FIPS capable OpenSSL. When in FIPS mode the approved implementations are used as normal, when not in FIPS mode the internal unapproved versions are used instead. This means that the FIPS capable OpenSSL isn't forced to use the (often lower perfomance) FIPS implementations outside FIPS mode. [Steve Henson] *) Transparently support X9.42 DH parameters when calling PEM_read_bio_DHparameters. This means existing applications can handle the new parameter format automatically. [Steve Henson] *) Initial experimental support for X9.42 DH parameter format: mainly to support use of 'q' parameter for RFC5114 parameters. [Steve Henson] *) Add DH parameters from RFC5114 including test data to dhtest. [Steve Henson] *) Support for automatic EC temporary key parameter selection. If enabled the most preferred EC parameters are automatically used instead of hardcoded fixed parameters. Now a server just has to call: SSL_CTX_set_ecdh_auto(ctx, 1) and the server will automatically support ECDH and use the most appropriate parameters. [Steve Henson] *) Enhance and tidy EC curve and point format TLS extension code. Use static structures instead of allocation if default values are used. New ctrls to set curves we wish to support and to retrieve shared curves. Print out shared curves in s_server. New options to s_server and s_client to set list of supported curves. [Steve Henson] *) New ctrls to retrieve supported signature algorithms and supported curve values as an array of NIDs. Extend openssl utility to print out received values. [Steve Henson] *) Add new APIs EC_curve_nist2nid and EC_curve_nid2nist which convert between NIDs and the more common NIST names such as "P-256". Enhance ecparam utility and ECC method to recognise the NIST names for curves. [Steve Henson] *) Enhance SSL/TLS certificate chain handling to support different chains for each certificate instead of one chain in the parent SSL_CTX. [Steve Henson] *) Support for fixed DH ciphersuite client authentication: where both server and client use DH certificates with common parameters. [Steve Henson] *) Support for fixed DH ciphersuites: those requiring DH server certificates. [Steve Henson] *) New function i2d_re_X509_tbs for re-encoding the TBS portion of the certificate. Note: Related 1.0.2-beta specific macros X509_get_cert_info, X509_CINF_set_modified, X509_CINF_get_issuer, X509_CINF_get_extensions and X509_CINF_get_signature were reverted post internal team review. 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] *) 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 dereference. This could lead to a Denial Of Service attack. Thanks to Markus Stenberg of Cisco Systems, Inc. for reporting this issue. (CVE-2014-3571) [Steve Henson] *) Fix DTLS memory leak in dtls1_buffer_record. A memory leak can occur in the dtls1_buffer_record function under certain conditions. In particular this could occur if an attacker sent repeated DTLS records with the same sequence number but for the next epoch. The memory leak could be exploited by an attacker in a Denial of Service attack through memory exhaustion. Thanks to Chris Mueller for reporting this issue. (CVE-2015-0206) [Matt Caswell] *) Fix issue where no-ssl3 configuration sets method to NULL. When openssl is built with the no-ssl3 option and a SSL v3 ClientHello is received the ssl method would be set to NULL which could later result in a NULL pointer dereference. Thanks to Frank Schmirler for reporting this issue. (CVE-2014-3569) [Kurt Roeckx] *) Abort handshake if server key exchange message is omitted for ephemeral ECDH ciphersuites. Thanks to Karthikeyan Bhargavan of the PROSECCO team at INRIA for reporting this issue. (CVE-2014-3572) [Steve Henson] *) Remove non-export ephemeral RSA code on client and server. This code violated the TLS standard by allowing the use of temporary RSA keys in non-export ciphersuites and could be used by a server to effectively downgrade the RSA key length used to a value smaller than the server certificate. Thanks for Karthikeyan Bhargavan of the PROSECCO team at INRIA or reporting this issue. (CVE-2015-0204) [Steve Henson] *) Fixed issue where DH client certificates are accepted without verification. An OpenSSL server will accept a DH certificate for client authentication without the certificate verify message. This effectively allows a client to authenticate without the use of a private key. This only affects servers which trust a client certificate authority which issues certificates containing DH keys: these are extremely rare and hardly ever encountered. Thanks for Karthikeyan Bhargavan of the PROSECCO team at INRIA or reporting this issue. (CVE-2015-0205) [Steve Henson] *) Ensure that the session ID context of an SSL is updated when its SSL_CTX is updated via SSL_set_SSL_CTX. The session ID context is typically set from the parent SSL_CTX, and can vary with the CTX. [Adam Langley] *) Fix various certificate fingerprint issues. By using non-DER or invalid encodings outside the signed portion of a certificate the fingerprint can be changed without breaking the signature. Although no details of the signed portion of the certificate can be changed this can cause problems with some applications: e.g. those using the certificate fingerprint for blacklists. 1. Reject signatures with non zero unused bits. If the BIT STRING containing the signature has non zero unused bits reject the signature. All current signature algorithms require zero unused bits. 2. Check certificate algorithm consistency. Check the AlgorithmIdentifier inside TBS matches the one in the certificate signature. NB: this will result in signature failure errors for some broken certificates. Thanks to Konrad Kraszewski from Google for reporting this issue. 3. Check DSA/ECDSA signatures use DER. Reencode DSA/ECDSA signatures and compare with the original received signature. Return an error if there is a mismatch. This will reject various cases including garbage after signature (thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS program for discovering this case) and use of BER or invalid ASN.1 INTEGERs (negative or with leading zeroes). Further analysis was conducted and fixes were developed by Stephen Henson of the OpenSSL core team. (CVE-2014-8275) [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) [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. [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.) [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. 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] *) SRTP Memory Leak. A flaw in the DTLS SRTP extension parsing code allows an attacker, who sends a carefully crafted handshake message, to cause OpenSSL to fail to free up to 64k of memory causing a memory leak. This could be exploited in a Denial Of Service attack. This issue affects OpenSSL 1.0.1 server implementations for both SSL/TLS and DTLS regardless of whether SRTP is used or configured. Implementations of OpenSSL that have been compiled with OPENSSL_NO_SRTP defined are not affected. The fix was developed by the OpenSSL team. (CVE-2014-3513) [OpenSSL team] *) Session Ticket Memory Leak. When an OpenSSL SSL/TLS/DTLS server receives a session ticket the integrity of that ticket is first verified. In the event of a session ticket integrity check failing, OpenSSL will fail to free memory causing a memory leak. By sending a large number of invalid session tickets an attacker could exploit this issue in a Denial Of Service attack. (CVE-2014-3567) [Steve Henson] *) Build option no-ssl3 is incomplete. When OpenSSL is configured with "no-ssl3" as a build option, servers could accept and complete a SSL 3.0 handshake, and clients could be configured to send them. (CVE-2014-3568) [Akamai and the OpenSSL team] *) Add support for TLS_FALLBACK_SCSV. Client applications doing fallback retries should call SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV). (CVE-2014-3566) [Adam Langley, Bodo Moeller] *) Add additional DigestInfo checks. Reencode DigestInto in DER and check against the original when verifying RSA signature: this will reject any improperly encoded DigestInfo structures. 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] *) Fix SRP buffer overrun vulnerability. Invalid parameters passed to the SRP code can be overrun an internal buffer. Add sanity check that g, A, B < N to SRP code. Thanks to Sean Devlin and Watson Ladd of Cryptography Services, NCC Group for discovering this issue. (CVE-2014-3512) [Steve Henson] *) A flaw in the OpenSSL SSL/TLS server code causes the server to negotiate TLS 1.0 instead of higher protocol versions when the ClientHello message is badly fragmented. This allows a man-in-the-middle attacker to force a downgrade to TLS 1.0 even if both the server and the client support a higher protocol version, by modifying the client's TLS records. Thanks to David Benjamin and Adam Langley (Google) for discovering and researching this issue. (CVE-2014-3511) [David Benjamin] *) OpenSSL DTLS clients enabling anonymous (EC)DH ciphersuites are subject to a denial of service attack. A malicious server can crash the client with a null pointer dereference (read) by specifying an anonymous (EC)DH ciphersuite and sending carefully crafted handshake messages. Thanks to Felix Gröbert (Google) for discovering and researching this issue. (CVE-2014-3510) [Emilia Käsper] *) By sending carefully crafted DTLS packets an attacker could cause openssl to leak memory. This can be exploited through a Denial of Service attack. Thanks to Adam Langley for discovering and researching this issue. (CVE-2014-3507) [Adam Langley] *) An attacker can force openssl to consume large amounts of memory whilst processing DTLS handshake messages. This can be exploited through a Denial of Service attack. Thanks to Adam Langley for discovering and researching this issue. (CVE-2014-3506) [Adam Langley] *) An attacker can force an error condition which causes openssl to crash whilst processing DTLS packets due to memory being freed twice. This can be exploited through a Denial of Service attack. Thanks to Adam Langley and Wan-Teh Chang for discovering and researching this issue. (CVE-2014-3505) [Adam Langley] *) If a multithreaded client connects to a malicious server using a resumed session and the server sends an ec point format extension it could write up to 255 bytes to freed memory. Thanks to Gabor Tyukasz (LogMeIn Inc) for discovering and researching this issue. (CVE-2014-3509) [Gabor Tyukasz] *) A malicious server can crash an OpenSSL client with a null pointer dereference (read) by specifying an SRP ciphersuite even though it was not properly negotiated with the client. This can be exploited through a Denial of Service attack. Thanks to Joonas Kuorilehto and Riku Hietamäki (Codenomicon) for discovering and researching this issue. (CVE-2014-5139) [Steve Henson] *) A flaw in OBJ_obj2txt may cause pretty printing functions such as X509_name_oneline, X509_name_print_ex et al. to leak some information from the stack. Applications may be affected if they echo pretty printing output to the attacker. Thanks to Ivan Fratric (Google) for discovering this issue. (CVE-2014-3508) [Emilia Käsper, and Steve Henson] *) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.) for corner cases. (Certain input points at infinity could lead to bogus results, with non-infinity inputs mapped to infinity too.) [Bodo Moeller] 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 SSL/TLS clients and servers. Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for discovering and researching this issue. (CVE-2014-0224) [KIKUCHI Masashi, Steve Henson] *) Fix DTLS recursion flaw. By sending an invalid DTLS handshake to an OpenSSL DTLS client the code can be made to recurse eventually crashing in a DoS attack. Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue. (CVE-2014-0221) [Imre Rad, Steve Henson] *) Fix DTLS invalid fragment vulnerability. A buffer overrun attack can be triggered by sending invalid DTLS fragments to an OpenSSL DTLS client or server. This is potentially exploitable to run arbitrary code on a vulnerable client or server. Thanks to Jüri Aedla for reporting this issue. (CVE-2014-0195) [Jüri Aedla, Steve Henson] *) Fix bug in TLS code where clients enable anonymous ECDH ciphersuites are subject to a denial of service attack. Thanks to Felix Gröbert and Ivan Fratric at Google for discovering this issue. (CVE-2014-3470) [Felix Gröbert, Ivan Fratric, Steve Henson] *) Harmonize version and its documentation. -f flag is used to display compilation flags. [mancha ] *) Fix eckey_priv_encode so it immediately returns an error upon a failure in i2d_ECPrivateKey. Thanks to Ted Unangst for feedback on this issue. [mancha ] *) Fix some double frees. These are not thought to be exploitable. [mancha ] 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 server. Thanks for Neel Mehta of Google Security for discovering this bug and to Adam Langley and Bodo Moeller for preparing the fix (CVE-2014-0160) [Adam Langley, Bodo Moeller] *) 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 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] *) TLS pad extension: draft-agl-tls-padding-03 Workaround for the "TLS hang bug" (see FAQ and PR#2771): if the TLS client Hello record length value would otherwise be > 255 and 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] *) Fix for TLS record tampering bug. A carefully crafted invalid handshake could crash OpenSSL with a NULL pointer exception. Thanks to Anton Johansson for reporting this issues. (CVE-2013-4353) *) Keep original DTLS digest and encryption contexts in retransmission structures so we can use the previous session parameters if they need to be resent. (CVE-2013-6450) [Steve Henson] *) Add option SSL_OP_SAFARI_ECDHE_ECDSA_BUG (part of SSL_OP_ALL) which avoids preferring ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. Safari on OS X 10.8..10.8.3 advertises support for several ECDHE-ECDSA ciphers, but fails to negotiate them. The bug is fixed in OS X 10.8.4, but Apple have ruled out both hot fixing 10.8..10.8.3 and forcing users to upgrade to 10.8.4 or newer. [Rob Stradling, Adam Langley] 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] *) 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/ 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 Adam Langley and Emilia Käsper for the initial patch. (CVE-2013-0169) [Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson] *) Fix flaw in AESNI handling of TLS 1.2 and 1.1 records for CBC mode ciphersuites which can be exploited in a denial of service attack. Thanks go to and to Adam Langley for discovering and detecting this bug and to Wolfgang Ettlinger for independently discovering this issue. (CVE-2012-2686) [Adam Langley] *) Return an error when checking OCSP signatures when key is NULL. This fixes a DoS attack. (CVE-2013-0166) [Steve Henson] *) Make openssl verify return errors. [Chris Palmer and Ben Laurie] *) 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. [Rob Stradling ] *) Fix possible deadlock when decoding public keys. [Steve Henson] *) Don't use TLS 1.0 record version number in initial client hello if renegotiating. [Steve Henson] 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. Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic fuzzing as a service testing platform. (CVE-2012-2333) [Steve Henson] *) Initialise tkeylen properly when encrypting CMS messages. Thanks to Solar Designer of Openwall for reporting this issue. [Steve Henson] *) In FIPS mode don't try to use composite ciphers as they are not approved. [Steve Henson] 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 mean any application compiled against OpenSSL 1.0.0 headers setting SSL_OP_ALL would also set SSL_OP_NO_TLSv1_1, unintentionally disablng TLS 1.1 also. Fix this by changing the value of SSL_OP_NO_TLSv1_1 to 0x10000000L Any application which was previously compiled against OpenSSL 1.0.1 or 1.0.1a headers and which cares about SSL_OP_NO_TLSv1_1 will need to be recompiled as a result. Letting be results in inability to disable specifically TLS 1.1 and in client context, in unlike event, limit maximum offered version to TLS 1.0 [see below]. [Steve Henson] *) In order to ensure interoperabilty SSL_OP_NO_protocolX does not disable just protocol X, but all protocols above X *if* there are protocols *below* X still enabled. In more practical terms it means that if application wants to disable TLS1.0 in favor of TLS1.1 and above, it's not sufficient to pass SSL_OP_NO_TLSv1, one has to pass SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3|SSL_OP_NO_SSLv2. This applies to client side. [Andy Polyakov] 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 in CRYPTO_realloc_clean. Thanks to Tavis Ormandy, Google Security Team, for discovering this issue and to Adam Langley for fixing it. (CVE-2012-2110) [Adam Langley (Google), Tavis Ormandy, Google Security Team] *) Don't allow TLS 1.2 SHA-256 ciphersuites in TLS 1.0, 1.1 connections. [Adam Langley] *) Workarounds for some broken servers that "hang" if a client hello record length exceeds 255 bytes. 1. Do not use record version number > TLS 1.0 in initial client hello: some (but not all) hanging servers will now work. 2. If we set OPENSSL_MAX_TLS1_2_CIPHER_LENGTH this will truncate the number of ciphers sent in the client hello. This should be set to an even number, such as 50, for example by passing: -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 to config or Configure. Most broken servers should now work. 3. If all else fails setting OPENSSL_NO_TLS1_2_CLIENT will disable TLS 1.2 client support entirely. [Steve Henson] *) Fix SEGV in Vector Permutation AES module observed in OpenSSH. [Andy Polyakov] 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. [Steve Henson] *) The format used for MDC2 RSA signatures is inconsistent between EVP and the RSA_sign/RSA_verify functions. This was made more apparent when OpenSSL used RSA_sign/RSA_verify for some RSA signatures in particular those which went through EVP_PKEY_METHOD in 1.0.0 and later. Detect the correct format in RSA_verify so both forms transparently work. [Steve Henson] *) Some servers which support TLS 1.0 can choke if we initially indicate support for TLS 1.2 and later renegotiate using TLS 1.0 in the RSA encrypted premaster secret. As a workaround use the maximum pemitted client version in client hello, this should keep such servers happy and still work with previous versions of OpenSSL. [Steve Henson] *) Add support for TLS/DTLS heartbeats. [Robin Seggelmann ] *) Add support for SCTP. [Robin Seggelmann ] *) Improved PRNG seeding for VOS. [Paul Green ] *) 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; [Andy Polyakov] *) Make TLS-SRP code conformant with RFC 5054 API cleanup (removal of unnecessary code) [Peter Sylvester ] *) Add TLS key material exporter from RFC 5705. [Eric Rescorla] *) Add DTLS-SRTP negotiation from RFC 5764. [Eric Rescorla] *) Add Next Protocol Negotiation, 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. [Adam Langley and Ben Laurie] *) Add optional 64-bit optimized implementations of elliptic curves NIST-P224, NIST-P256, NIST-P521, with constant-time single point multiplication on typical inputs. Compiler support for the nonstandard type __uint128_t is required to use this (present in gcc 4.4 and later, for 64-bit builds). Code made available under Apache License version 2.0. Specify "enable-ec_nistp_64_gcc_128" on the Configure (or config) command line to include this in your build of OpenSSL, and run "make depend" (or "make update"). This enables the following EC_METHODs: EC_GFp_nistp224_method() EC_GFp_nistp256_method() EC_GFp_nistp521_method() EC_GROUP_new_by_curve_name() will automatically use these (while EC_GROUP_new_curve_GFp() currently prefers the more flexible implementations). [Emilia Käsper, Adam Langley, Bodo Moeller (Google)] *) Use type ossl_ssize_t instad of ssize_t which isn't available on all platforms. Move ssize_t definition from e_os.h to the public header file e_os2.h as it now appears in public header file cms.h [Steve Henson] *) New -sigopt option to the ca, req and x509 utilities. Additional signature parameters can be passed using this option and in particular PSS. [Steve Henson] *) Add RSA PSS signing function. This will generate and set the appropriate AlgorithmIdentifiers for PSS based on those in the corresponding EVP_MD_CTX structure. No application support yet. [Steve Henson] *) Support for companion algorithm specific ASN1 signing routines. New function ASN1_item_sign_ctx() signs a pre-initialised EVP_MD_CTX structure and sets AlgorithmIdentifiers based on the appropriate parameters. [Steve Henson] *) Add new algorithm specific ASN1 verification initialisation function to EVP_PKEY_ASN1_METHOD: this is not in EVP_PKEY_METHOD since the ASN1 handling will be the same no matter what EVP_PKEY_METHOD is used. Add a PSS handler to support verification of PSS signatures: checked against a number of sample certificates. [Steve Henson] *) Add signature printing for PSS. Add PSS OIDs. [Steve Henson, Martin Kaiser ] *) Add algorithm specific signature printing. An individual ASN1 method can now print out signatures instead of the standard hex dump. More complex signatures (e.g. PSS) can print out more meaningful information. Include DSA version that prints out the signature parameters r, s. [Steve Henson] *) Password based recipient info support for CMS library: implementing RFC3211. [Steve Henson] *) Split password based encryption into PBES2 and PBKDF2 functions. This neatly separates the code into cipher and PBE sections and is required for some algorithms that split PBES2 into separate pieces (such as password based CMS). [Steve Henson] *) Session-handling fixes: - Fix handling of connections that are resuming with a session ID, but also support Session Tickets. - Fix a bug that suppressed issuing of a new ticket if the client presented a ticket with an expired session. - Try to set the ticket lifetime hint to something reasonable. - Make tickets shorter by excluding irrelevant information. - On the client side, don't ignore renewed tickets. [Adam Langley, Bodo Moeller (Google)] *) Fix PSK session representation. [Bodo Moeller] *) Add RC4-MD5 and AESNI-SHA1 "stitched" implementations. This work was sponsored by Intel. [Andy Polyakov] *) 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 inlclude GCM and add a special AESGCM string for GCM only. [Steve Henson] *) Expand range of ctrls for AES GCM. Permit setting invocation field on decrypt and retrieval of invocation field only on encrypt. [Steve Henson] *) Add HMAC ECC ciphersuites from RFC5289. Include SHA384 PRF support. As required by RFC5289 these ciphersuites cannot be used if for versions of TLS earlier than 1.2. [Steve Henson] *) For FIPS capable OpenSSL interpret a NULL default public key method as unset and return the appopriate default but do *not* set the default. This means we can return the appopriate method in applications that swicth between FIPS and non-FIPS modes. [Steve Henson] *) Redirect HMAC and CMAC operations to FIPS module in FIPS mode. If an ENGINE is used then we cannot handle that in the FIPS module so we keep original code iff non-FIPS operations are allowed. [Steve Henson] *) Add -attime option to openssl utilities. [Peter Eckersley , Ben Laurie and Steve Henson] *) Redirect DSA and DH operations to FIPS module in FIPS mode. [Steve Henson] *) Redirect ECDSA and ECDH operations to FIPS module in FIPS mode. Also use FIPS EC methods unconditionally for now. [Steve Henson] *) New build option no-ec2m to disable characteristic 2 code. [Steve Henson] *) Backport libcrypto audit of return value checking from 1.1.0-dev; not all cases can be covered as some introduce binary incompatibilities. [Steve Henson] *) Redirect RSA operations to FIPS module including keygen, encrypt, decrypt, sign and verify. Block use of non FIPS RSA methods. [Steve Henson] *) Add similar low level API blocking to ciphers. [Steve Henson] *) 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. [Steve Henson] *) Redirect cipher operations to FIPS module for FIPS builds. [Steve Henson] *) Redirect digest operations to FIPS module for FIPS builds. [Steve Henson] *) Update build system to add "fips" flag which will link in fipscanister.o for static and shared library builds embedding a signature if needed. [Steve Henson] *) Output TLS supported curves in preference order instead of numerical order. This is currently hardcoded for the highest order curves first. This should be configurable so applications can judge speed vs strength. [Steve Henson] *) Add TLS v1.2 server support for client authentication. [Steve Henson] *) Add support for FIPS mode in ssl library: disable SSLv3, non-FIPS ciphers and enable MD5. [Steve Henson] *) Functions FIPS_mode_set() and FIPS_mode() which call the underlying FIPS modules versions. [Steve Henson] *) Add TLS v1.2 client side support for client authentication. Keep cache of handshake records longer as we don't know the hash algorithm to use until after the certificate request message is received. [Steve Henson] *) Initial TLS v1.2 client support. Add a default signature algorithms extension including all the algorithms we support. Parse new signature format in client key exchange. Relax some ECC signing restrictions for TLS v1.2 as indicated in RFC5246. [Steve Henson] *) Add server support for TLS v1.2 signature algorithms extension. Switch to new signature format when needed using client digest preference. All server ciphersuites should now work correctly in TLS v1.2. No client support yet and no support for client certificates. [Steve Henson] *) Initial TLS v1.2 support. Add new SHA256 digest to ssl code, switch to SHA256 for PRF when using TLS v1.2 and later. Add new SHA256 based ciphersuites. At present only RSA key exchange ciphersuites work with TLS v1.2. Add new option for TLS v1.2 replacing the old and obsolete SSL_OP_PKCS1_CHECK flags with SSL_OP_NO_TLSv1_2. New TLSv1.2 methods and version checking. [Steve Henson] *) New option OPENSSL_NO_SSL_INTERN. If an application can be compiled with this defined it will not be affected by any changes to ssl internal structures. Add several utility functions to allow openssl application to work with OPENSSL_NO_SSL_INTERN defined. [Steve Henson] *) Add SRP support. [Tom Wu and Ben Laurie] *) Add functions to copy EVP_PKEY_METHOD and retrieve flags and id. [Steve Henson] *) Permit abbreviated handshakes when renegotiating using the function SSL_renegotiate_abbreviated(). [Robin Seggelmann ] *) Add call to ENGINE_register_all_complete() to ENGINE_load_builtin_engines(), so some implementations get used automatically instead of needing explicit application support. [Steve Henson] *) Add support for TLS key exporter as described in RFC5705. [Robin Seggelmann , Steve Henson] *) Initial TLSv1.1 support. Since TLSv1.1 is very similar to TLS v1.0 only a few changes are required: Add SSL_OP_NO_TLSv1_1 flag. Add TLSv1_1 methods. Update version checking logic to handle version 1.1. Add explicit IV handling (ported from DTLS code). Add command line options to s_client/s_server. [Steve Henson] 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 content decryption and always return the same error. Note: this attack needs on average 2^20 messages so it only affects automated senders. The old behaviour can be reenabled in the CMS code by setting the CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where an MMA defence is not necessary. Thanks to Ivan Nestlerode for discovering this issue. (CVE-2012-0884) [Steve Henson] *) Fix CVE-2011-4619: make sure we really are receiving a client hello before rejecting multiple SGC restarts. Thanks to Ivan Nestlerode for discovering this bug. [Steve Henson] 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 Development, Cisco Systems, Inc. for discovering this bug and preparing a fix. (CVE-2012-0050) [Antonio Martin] 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 which enables an efficient plaintext recovery attack against 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 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 and Michael Tuexen for preparing the fix. (CVE-2011-4108) [Robin Seggelmann, Michael Tuexen] *) Clear bytes used for block padding of SSL 3.0 records. (CVE-2011-4576) [Adam Langley (Google)] *) Only allow one SGC handshake restart for SSL/TLS. Thanks to George Kadianakis for discovering this issue and Adam Langley for preparing the fix. (CVE-2011-4619) [Adam Langley (Google)] *) Check parameters are not NULL in GOST ENGINE. (CVE-2012-0027) [Andrey Kulikov ] *) Prevent malformed RFC3779 data triggering an assertion failure. Thanks to Andrew Chi, BBN Technologies, for discovering the flaw and Rob Austein for fixing it. (CVE-2011-4577) [Rob Austein ] *) Improved PRNG seeding for VOS. [Paul Green ] *) Fix ssl_ciph.c set-up race. [Adam Langley (Google)] *) Fix spurious failures in ecdsatest.c. [Emilia Käsper (Google)] *) Fix the BIO_f_buffer() implementation (which was mixing different interpretations of the '..._len' fields). [Adam Langley (Google)] *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concurrent threads won't reuse the same blinding coefficients. This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING lock to call BN_BLINDING_invert_ex, and avoids one use of BN_BLINDING_update for each BN_BLINDING structure (previously, the last update always remained unused). [Emilia Käsper (Google)] *) In ssl3_clear, preserve s3->init_extra along with s3->rbuf. [Bob Buckholz (Google)] 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) [Kaspar Brand ] *) Fix SSL memory handling for (EC)DH ciphersuites, in particular for multi-threaded use of ECDH. (CVE-2011-3210) [Adam Langley (Google)] *) Fix x509_name_ex_d2i memory leak on bad inputs. [Bodo Moeller] *) Remove hard coded ecdsaWithSHA1 signature tests in ssl code and check signature public key algorithm by using OID xref utilities instead. Before this you could only use some ECC ciphersuites with SHA1 only. [Steve Henson] *) 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 [Billy Bob Brumley and Nicola Tuveri] Changes between 1.0.0c and 1.0.0d [8 Feb 2011] *) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014 [Neel Mehta, Adam Langley, Bodo Moeller (Google)] *) Fix bug in string printing code: if *any* escaping is enabled we must escape the escape character (backslash) or the resulting string is ambiguous. [Steve Henson] 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. Thanks to Martin Rex for discovering this bug. CVE-2010-4180 [Steve Henson] *) Fixed J-PAKE implementation error, originally discovered by Sebastien Martini, further info and confirmation from Stefan Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4252 [Ben Laurie] 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 be shared by multiple threads. CVE-2010-3864 [Steve Henson] *) Fix WIN32 build system to correctly link an ENGINE directory into a DLL. [Steve Henson] 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 ] 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 case ENGINEs want to include additional functionality. [Steve Henson] *) Tolerate yet another broken PKCS#8 key format: private key value negative. [Steve Henson] *) Add new -subject_hash_old and -issuer_hash_old options to x509 utility to output hashes compatible with older versions of OpenSSL. [Willy Weisz ] *) Fix compression algorithm handling: if resuming a session use the compression algorithm of the resumed session instead of determining it from client hello again. Don't allow server to change algorithm. [Steve Henson] *) Add load_crls() function to apps tidying load_certs() too. Add option to verify utility to allow additional CRLs to be included. [Steve Henson] *) Update OCSP request code to permit adding custom headers to the request: some responders need this. [Steve Henson] *) The function EVP_PKEY_sign() returns <=0 on error: check return code correctly. [Julia Lawall ] *) Update verify callback code in apps/s_cb.c and apps/verify.c, it needlessly dereferenced structures, used obsolete functions and didn't handle all updated verify codes correctly. [Steve Henson] *) Disable MD2 in the default configuration. [Steve Henson] *) In BIO_pop() and BIO_push() use the ctrl argument (which was NULL) to indicate the initial BIO being pushed or popped. This makes it possible to determine whether the BIO is the one explicitly called or as a result of the ctrl being passed down the chain. Fix BIO_pop() and SSL BIOs so it handles reference counts correctly and doesn't zero out the I/O bio when it is not being explicitly popped. WARNING: applications which included workarounds for the old buggy behaviour will need to be modified or they could free up already freed BIOs. [Steve Henson] *) Extend the uni2asc/asc2uni => OPENSSL_uni2asc/OPENSSL_asc2uni renaming to all platforms (within the 0.9.8 branch, this was done conditionally on Netware platforms to avoid a name clash). [Guenter ] *) Add ECDHE and PSK support to DTLS. [Michael Tuexen ] *) Add CHECKED_STACK_OF macro to safestack.h, otherwise safestack can't be used on C++. [Steve Henson] *) 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 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. [Steve Henson] *) If no SSLv2 ciphers are used don't use an SSLv2 compatible client hello: this allows the use of compression and extensions. Change default cipher string to remove SSLv2 ciphersuites. This effectively avoids ancient SSLv2 by default unless an application cipher string requests it. [Steve Henson] *) Alter match criteria in PKCS12_parse(). It used to try to use local key ids to find matching certificates and keys but some PKCS#12 files don't follow the (somewhat unwritten) rules and this strategy fails. Now just gather all certificates together and the first private key then look for the first certificate that matches the key. [Steve Henson] *) Support use of registered digest and cipher names for dgst and cipher commands instead of having to add each one as a special case. So now you can do: openssl sha256 foo as well as: openssl dgst -sha256 foo and this works for ENGINE based algorithms too. [Steve Henson] *) Update Gost ENGINE to support parameter files. [Victor B. Wagner ] *) Support GeneralizedTime in ca utility. [Oliver Martin , Steve Henson] *) Enhance the hash format used for certificate directory links. The new form uses the canonical encoding (meaning equivalent names will work even if they aren't identical) and uses SHA1 instead of MD5. This form is incompatible with the older format and as a result c_rehash should be used to rebuild symbolic links. [Steve Henson] *) Make PKCS#8 the default write format for private keys, replacing the traditional format. This form is standardised, more secure and doesn't include an implicit MD5 dependency. [Steve Henson] *) Add a $gcc_devteam_warn option to Configure. The idea is that any code committed to OpenSSL should pass this lot as a minimum. [Steve Henson] *) Add session ticket override functionality for use by EAP-FAST. [Jouni Malinen ] *) Modify HMAC functions to return a value. Since these can be implemented in an ENGINE errors can occur. [Steve Henson] *) Type-checked OBJ_bsearch_ex. [Ben Laurie] *) Type-checked OBJ_bsearch. Also some constification necessitated by type-checking. Still to come: TXT_DB, bsearch(?), OBJ_bsearch_ex, qsort, CRYPTO_EX_DATA, ASN1_VALUE, ASN1_STRING, CONF_VALUE. [Ben Laurie] *) 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 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. [Steve Henson] *) Delta CRL support. New use deltas option which will attempt to locate and search any appropriate delta CRLs available. This work was sponsored by Google. [Steve Henson] *) Support for CRLs partitioned by reason code. Reorganise CRL processing code and add additional score elements. Validate alternate CRL paths as part of the CRL checking and indicate a new error "CRL path validation error" in this case. Applications wanting additional details can use the verify callback and check the new "parent" field. If this is not NULL CRL path validation is taking place. Existing applications wont see this because it requires extended CRL support which is off by default. This work was sponsored by Google. [Steve Henson] *) Support for freshest CRL extension. This work was sponsored by Google. [Steve Henson] *) Initial indirect CRL support. Currently only supported in the CRLs passed directly and not via lookup. Process certificate issuer CRL entry extension and lookup CRL entries by bother issuer name and serial number. Check and process CRL issuer entry in IDP extension. This work was sponsored by Google. [Steve Henson] *) Add support for distinct certificate and CRL paths. The CRL issuer certificate is validated separately in this case. Only enabled if an extended CRL support flag is set: this flag will enable additional CRL functionality in future. This work was sponsored by Google. [Steve Henson] *) Add support for policy mappings extension. This work was sponsored by Google. [Steve Henson] *) Fixes to pathlength constraint, self issued certificate handling, policy processing to align with RFC3280 and PKITS tests. This work was sponsored by Google. [Steve Henson] *) Support for name constraints certificate extension. DN, email, DNS and URI types are currently supported. This work was sponsored by Google. [Steve Henson] *) To cater for systems that provide a pointer-based thread ID rather than numeric, deprecate the current numeric thread ID mechanism and replace it with a structure and associated callback type. This mechanism allows a numeric "hash" to be extracted from a thread ID in either case, and on platforms where pointers are larger than 'long', mixing is done to help ensure the numeric 'hash' is usable even if it can't be guaranteed unique. The default mechanism is to use "&errno" as a pointer-based thread ID to distinguish between threads. Applications that want to provide their own thread IDs should now use CRYPTO_THREADID_set_callback() to register a callback that will call either CRYPTO_THREADID_set_numeric() or CRYPTO_THREADID_set_pointer(). Note that ERR_remove_state() is now deprecated, because it is tied to the assumption that thread IDs are numeric. ERR_remove_state(0) to free the current thread's error state should be replaced by ERR_remove_thread_state(NULL). (This new approach replaces the functions CRYPTO_set_idptr_callback(), CRYPTO_get_idptr_callback(), and CRYPTO_thread_idptr() that existed in OpenSSL 0.9.9-dev between June 2006 and August 2008. Also, if an application was previously providing a numeric thread callback that was inappropriate for distinguishing threads, then uniqueness might have been obtained with &errno that happened immediately in the intermediate development versions of OpenSSL; this is no longer the case, the numeric thread callback will now override the automatic use of &errno.) [Geoff Thorpe, with help from Bodo Moeller] *) Initial support for different CRL issuing certificates. This covers a simple case where the self issued certificates in the chain exist and the real CRL issuer is higher in the existing chain. This work was sponsored by Google. [Steve Henson] *) Removed effectively defunct crypto/store from the build. [Ben Laurie] *) Revamp of STACK to provide stronger type-checking. Still to come: TXT_DB, bsearch(?), OBJ_bsearch, qsort, CRYPTO_EX_DATA, ASN1_VALUE, ASN1_STRING, CONF_VALUE. [Ben Laurie] *) Add a new SSL_MODE_RELEASE_BUFFERS mode flag to release unused buffer RAM on SSL connections. This option can save about 34k per idle SSL. [Nick Mathewson] *) Revamp of LHASH to provide stronger type-checking. Still to come: STACK, TXT_DB, bsearch, qsort. [Ben Laurie] *) Initial support for Cryptographic Message Syntax (aka CMS) based on RFC3850, RFC3851 and RFC3852. New cms directory and cms utility, support for data, signedData, compressedData, digestedData and encryptedData, envelopedData types included. Scripts to check against RFC4134 examples draft and interop and consistency checks of many content types and variants. [Steve Henson] *) Add options to enc utility to support use of zlib compression BIO. [Steve Henson] *) Extend mk1mf to support importing of options and assembly language files from Configure script, currently only included in VC-WIN32. The assembly language rules can now optionally generate the source files from the associated perl scripts. [Steve Henson] *) Implement remaining functionality needed to support GOST ciphersuites. Interop testing has been performed using CryptoPro implementations. [Victor B. Wagner ] *) s390x assembler pack. [Andy Polyakov] *) ARMv4 assembler pack. ARMv4 refers to v4 and later ISA, not CPU "family." [Andy Polyakov] *) Implement Opaque PRF Input TLS extension as specified in draft-rescorla-tls-opaque-prf-input-00.txt. Since this is not an official specification yet and no extension type assignment by IANA exists, this extension (for now) will have to be explicitly enabled when building OpenSSL by providing the extension number to use. For example, specify an option -DTLSEXT_TYPE_opaque_prf_input=0x9527 to the "config" or "Configure" script to enable the extension, assuming extension number 0x9527 (which is a completely arbitrary and unofficial assignment based on the MD5 hash of the Internet Draft). Note that by doing so, you potentially lose interoperability with other TLS implementations since these might be using the same extension number for other purposes. SSL_set_tlsext_opaque_prf_input(ssl, src, len) is used to set the opaque PRF input value to use in the handshake. This will create an interal copy of the length-'len' string at 'src', and will return non-zero for success. To get more control and flexibility, provide a callback function by using SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) where int (*cb)(SSL *, void *peerinput, size_t len, void *arg); void *arg; Callback function 'cb' will be called in handshakes, and is expected to use SSL_set_tlsext_opaque_prf_input() as appropriate. Argument 'arg' is for application purposes (the value as given to SSL_CTX_set_tlsext_opaque_prf_input_callback_arg() will directly be provided to the callback function). The callback function has to return non-zero to report success: usually 1 to use opaque PRF input just if possible, or 2 to enforce use of the opaque PRF input. In the latter case, the library will abort the handshake if opaque PRF input is not successfully negotiated. Arguments 'peerinput' and 'len' given to the callback function will always be NULL and 0 in the case of a client. A server will see the client's opaque PRF input through these variables if available (NULL and 0 otherwise). Note that if the server provides an opaque PRF input, the length must be the same as the length of the client's opaque PRF input. Note that the callback function will only be called when creating a new session (session resumption can resume whatever was previously negotiated), and will not be called in SSL 2.0 handshakes; thus, SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) or 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 ] *) Add RFC4507 support to OpenSSL. This includes the corrections in RFC4507bis. The encrypted ticket format is an encrypted encoded SSL_SESSION structure, that way new session features are automatically supported. If a client application caches session in an SSL_SESSION structure support is transparent because tickets are now stored in the encoded SSL_SESSION. The SSL_CTX structure automatically generates keys for ticket protection in servers so again support should be possible with no application modification. If a client or server wishes to disable RFC4507 support then the option SSL_OP_NO_TICKET can be set. Add a TLS extension debugging callback to allow the contents of any client or server extensions to be examined. This work was sponsored by Google. [Steve Henson] *) Final changes to avoid use of pointer pointer casts in OpenSSL. OpenSSL should now compile cleanly on gcc 4.2 [Peter Hartley , Steve Henson] *) Update SSL library to use new EVP_PKEY MAC API. Include generic MAC support including streaming MAC support: this is required for GOST ciphersuite support. [Victor B. Wagner , Steve Henson] *) Add option -stream to use PKCS#7 streaming in smime utility. New function i2d_PKCS7_bio_stream() and PEM_write_PKCS7_bio_stream() to output in BER and PEM format. [Steve Henson] *) Experimental support for use of HMAC via EVP_PKEY interface. This 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. [Steve Henson] *) New option -sigopt to dgst utility. Update dgst to use EVP_Digest{Sign,Verify}*. These two changes make it possible to use alternative signing paramaters such as X9.31 or PSS in the dgst utility. [Steve Henson] *) Change ssl_cipher_apply_rule(), the internal function that does the work each time a ciphersuite string requests enabling ("foo+bar"), moving ("+foo+bar"), disabling ("-foo+bar", or removing ("!foo+bar") a class of ciphersuites: Now it maintains the order of disabled ciphersuites such that those ciphersuites that most recently went from enabled to disabled not only stay in order with respect to each other, but also have higher priority than other disabled ciphersuites the next time ciphersuites are enabled again. This means that you can now say, e.g., "PSK:-PSK:HIGH" to enable the same ciphersuites as with "HIGH" alone, but in a specific order where the PSK ciphersuites come first (since they are the most recently disabled ciphersuites when "HIGH" is parsed). Also, change ssl_create_cipher_list() (using this new funcionality) such that between otherwise identical cihpersuites, ephemeral ECDH is preferred over ephemeral DH in the default order. [Bodo Moeller] *) Change ssl_create_cipher_list() so that it automatically arranges the ciphersuites in reasonable order before starting to process the rule string. Thus, the definition for "DEFAULT" (SSL_DEFAULT_CIPHER_LIST) now is just "ALL:!aNULL:!eNULL", but remains equivalent to "AES:ALL:!aNULL:!eNULL:+aECDH:+kRSA:+RC4:@STRENGTH". This makes it much easier to arrive at a reasonable default order in applications for which anonymous ciphers are OK (meaning that you can't actually use DEFAULT). [Bodo Moeller; suggested by Victor Duchovni] *) Split the SSL/TLS algorithm mask (as used for ciphersuite string processing) into multiple integers instead of setting "SSL_MKEY_MASK" bits, "SSL_AUTH_MASK" bits, "SSL_ENC_MASK", "SSL_MAC_MASK", and "SSL_SSL_MASK" bits all in a single integer. (These masks as well as the individual bit definitions are hidden away into the non-exported interface ssl/ssl_locl.h, so this change to the definition of the SSL_CIPHER structure shouldn't affect applications.) This give us more bits for each of these categories, so there is no longer a need to coagulate AES128 and AES256 into a single algorithm bit, and to coagulate Camellia128 and Camellia256 into a single algorithm bit, which has led to all kinds of kludges. Thus, among other things, the kludge introduced in 0.9.7m and 0.9.8e for masking out AES256 independently of AES128 or masking out Camellia256 independently of AES256 is not needed here in 0.9.9. With the change, we also introduce new ciphersuite aliases that so far were missing: "AES128", "AES256", "CAMELLIA128", and "CAMELLIA256". [Bodo Moeller] *) Add support for dsa-with-SHA224 and dsa-with-SHA256. Use the leftmost N bytes of the signature input if the input is larger than the prime q (with N being the size in bytes of q). [Nils Larsch] *) Very *very* experimental PKCS#7 streaming encoder support. Nothing uses it yet and it is largely untested. [Steve Henson] *) Add support for the ecdsa-with-SHA224/256/384/512 signature types. [Nils Larsch] *) Initial incomplete changes to avoid need for function casts in OpenSSL some compilers (gcc 4.2 and later) reject their use. Safestack is reimplemented. Update ASN1 to avoid use of legacy functions. [Steve Henson] *) Win32/64 targets are linked with Winsock2. [Andy Polyakov] *) Add an X509_CRL_METHOD structure to allow CRL processing to be redirected to external functions. This can be used to increase CRL handling efficiency especially when CRLs are very large by (for example) storing the CRL revoked certificates in a database. [Steve Henson] *) Overhaul of by_dir code. Add support for dynamic loading of CRLs so new CRLs added to a directory can be used. New command line option -verify_return_error to s_client and s_server. This causes real errors to be returned by the verify callback instead of carrying on no matter what. This reflects the way a "real world" verify callback would behave. [Steve Henson] *) GOST engine, supporting several GOST algorithms and public key formats. Kindly donated by Cryptocom. [Cryptocom] *) Partial support for Issuing Distribution Point CRL extension. CRLs partitioned by DP are handled but no indirect CRL or reason partitioning (yet). Complete overhaul of CRL handling: now the most suitable CRL is selected via a scoring technique which handles IDP and AKID in CRLs. [Steve Henson] *) New X509_STORE_CTX callbacks lookup_crls() and lookup_certs() which will ultimately be used for all verify operations: this will remove the X509_STORE dependency on certificate verification and allow alternative lookup methods. X509_STORE based implementations of these two callbacks. [Steve Henson] *) Allow multiple CRLs to exist in an X509_STORE with matching issuer names. Modify get_crl() to find a valid (unexpired) CRL if possible. [Steve Henson] *) New function X509_CRL_match() to check if two CRLs are identical. Normally this would be called X509_CRL_cmp() but that name is already used by a function that just compares CRL issuer names. Cache several CRL extensions in X509_CRL structure and cache CRLDP in X509. [Steve Henson] *) Store a "canonical" representation of X509_NAME structure (ASN1 Name) this maps equivalent X509_NAME structures into a consistent structure. Name comparison can then be performed rapidly using memcmp(). [Steve Henson] *) Non-blocking OCSP request processing. Add -timeout option to ocsp utility. [Steve Henson] *) Allow digests to supply their own micalg string for S/MIME type using the ctrl EVP_MD_CTRL_MICALG. [Steve Henson] *) During PKCS7 signing pass the PKCS7 SignerInfo structure to the EVP_PKEY_METHOD before and after signing via the EVP_PKEY_CTRL_PKCS7_SIGN ctrl. It can then customise the structure before and/or after signing if necessary. [Steve Henson] *) New function OBJ_add_sigid() to allow application defined signature OIDs to be added to OpenSSLs internal tables. New function OBJ_sigid_free() to free up any added signature OIDs. [Steve Henson] *) New functions EVP_CIPHER_do_all(), EVP_CIPHER_do_all_sorted(), EVP_MD_do_all() and EVP_MD_do_all_sorted() to enumerate internal digest and cipher tables. New options added to openssl utility: list-message-digest-algorithms and list-cipher-algorithms. [Steve Henson] *) Change the array representation of binary polynomials: the list of degrees of non-zero coefficients is now terminated with -1. Previously it was terminated with 0, which was also part of the value; thus, the array representation was not applicable to polynomials where t^0 has coefficient zero. This change makes the array representation useful in a more general context. [Douglas Stebila] *) Various modifications and fixes to SSL/TLS cipher string handling. For ECC, the code now distinguishes between fixed ECDH with RSA certificates on the one hand and with ECDSA certificates on the other hand, since these are separate ciphersuites. The unused code for Fortezza ciphersuites has been removed. For consistency with EDH, ephemeral ECDH is now called "EECDH" (not "ECDHE"). For consistency with the code for DH certificates, use of ECDH certificates is now considered ECDH authentication, not RSA or ECDSA authentication (the latter is merely the CA's signing algorithm and not actively used in the protocol). The temporary ciphersuite alias "ECCdraft" is no longer available, and ECC ciphersuites are no longer excluded from "ALL" and "DEFAULT". The following aliases now exist for RFC 4492 ciphersuites, most of these by analogy with the DH case: kECDHr - ECDH cert, signed with RSA kECDHe - ECDH cert, signed with ECDSA kECDH - ECDH cert (signed with either RSA or ECDSA) kEECDH - ephemeral ECDH ECDH - ECDH cert or ephemeral ECDH aECDH - ECDH cert aECDSA - ECDSA cert ECDSA - ECDSA cert 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. Use correct micalg parameters depending on digest(s) in signed message. [Steve Henson] *) Add engine support for EVP_PKEY_ASN1_METHOD. Add functions to process an ENGINE asn1 method. Support ENGINE lookups in the ASN1 code. [Steve Henson] *) Initial engine support for EVP_PKEY_METHOD. New functions to permit an engine to register a method. Add ENGINE lookups for methods and functional reference processing. [Steve Henson] *) New functions EVP_Digest{Sign,Verify)*. These are enchance versions of EVP_{Sign,Verify}* which allow an application to customise the signature process. [Steve Henson] *) New -resign option to smime utility. This adds one or more signers to an existing PKCS#7 signedData structure. Also -md option to use an alternative message digest algorithm for signing. [Steve Henson] *) Tidy up PKCS#7 routines and add new functions to make it easier to create PKCS7 structures containing multiple signers. Update smime application to support multiple signers. [Steve Henson] *) New -macalg option to pkcs12 utility to allow setting of an alternative digest MAC. [Steve Henson] *) Initial support for PKCS#5 v2.0 PRFs other than default SHA1 HMAC. Reorganize PBE internals to lookup from a static table using NIDs, add support for HMAC PBE OID translation. Add a EVP_CIPHER ctrl: EVP_CTRL_PBE_PRF_NID this allows a cipher to specify an alternative PRF which will be automatically used with PBES2. [Steve Henson] *) Replace the algorithm specific calls to generate keys in "req" with the new API. [Steve Henson] *) Update PKCS#7 enveloped data routines to use new API. This is now supported by any public key method supporting the encrypt operation. A ctrl is added to allow the public key algorithm to examine or modify the PKCS#7 RecipientInfo structure if it needs to: for RSA this is a no op. [Steve Henson] *) Add a ctrl to asn1 method to allow a public key algorithm to express a default digest type to use. In most cases this will be SHA1 but some algorithms (such as GOST) need to specify an alternative digest. The return value indicates how strong the prefernce is 1 means optional and 2 is mandatory (that is it is the only supported type). Modify ASN1_item_sign() to accept a NULL digest argument to indicate it should use the default md. Update openssl utilities to use the default digest type for signing if it is not explicitly indicated. [Steve Henson] *) Use OID cross reference table in ASN1_sign() and ASN1_verify(). New EVP_MD flag EVP_MD_FLAG_PKEY_METHOD_SIGNATURE. This uses the relevant signing method from the key type. This effectively removes the link between digests and public key types. [Steve Henson] *) Add an OID cross reference table and utility functions. Its purpose is to translate between signature OIDs such as SHA1WithrsaEncryption and SHA1, rsaEncryption. This will allow some of the algorithm specific hackery needed to use the correct OID to be removed. [Steve Henson] *) Remove algorithm specific dependencies when setting PKCS7_SIGNER_INFO structures for PKCS7_sign(). They are now set up by the relevant public key ASN1 method. [Steve Henson] *) Add provisional EC pkey method with support for ECDSA and ECDH. [Steve Henson] *) Add support for key derivation (agreement) in the API, DH method and pkeyutl. [Steve Henson] *) Add DSA pkey method and DH pkey methods, extend DH ASN1 method to support public and private key formats. As a side effect these add additional command line functionality not previously available: DSA signatures can be generated and verified using pkeyutl and DH key support and generation in pkey, genpkey. [Steve Henson] *) BeOS support. [Oliver Tappe ] *) New make target "install_html_docs" installs HTML renditions of the manual pages. [Oliver Tappe ] *) New utility "genpkey" this is analagous to "genrsa" etc except it can generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to support key and parameter generation and add initial key generation functionality for RSA. [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. [Steve Henson] *) Initial definitions for EVP_PKEY_METHOD. This will be a high level public key API, doesn't do much yet. [Steve Henson] *) New function EVP_PKEY_asn1_get0_info() to retrieve information about public key algorithms. New option to openssl utility: "list-public-key-algorithms" to print out info. [Steve Henson] *) Implement the Supported Elliptic Curves Extension for ECC ciphersuites from draft-ietf-tls-ecc-12.txt. [Douglas Stebila] *) Don't free up OIDs in OBJ_cleanup() if they are in use by EVP_MD or EVP_CIPHER structures to avoid later problems in EVP_cleanup(). [Steve Henson] *) New utilities pkey and pkeyparam. These are similar to algorithm specific utilities such as rsa, dsa, dsaparam etc except they process any key type. [Steve Henson] *) Transfer public key printing routines to EVP_PKEY_ASN1_METHOD. New functions EVP_PKEY_print_public(), EVP_PKEY_print_private(), EVP_PKEY_print_param() to print public key data from an EVP_PKEY structure. [Steve Henson] *) Initial support for pluggable public key ASN1. De-spaghettify the public key ASN1 handling. Move public and private key ASN1 handling to a new EVP_PKEY_ASN1_METHOD structure. Relocate algorithm specific handling to a single module within the relevant algorithm directory. Add functions to allow (near) opaque processing of public and private key structures. [Steve Henson] *) Implement the Supported Point Formats Extension for ECC ciphersuites from draft-ietf-tls-ecc-12.txt. [Douglas Stebila] *) Add initial support for RFC 4279 PSK TLS ciphersuites. Add members for the psk identity [hint] and the psk callback functions to the SSL_SESSION, SSL and SSL_CTX structure. New ciphersuites: PSK-RC4-SHA, PSK-3DES-EDE-CBC-SHA, PSK-AES128-CBC-SHA, PSK-AES256-CBC-SHA New functions: SSL_CTX_use_psk_identity_hint SSL_get_psk_identity_hint 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 and response verification functionality. [Zoltán Glózik , The OpenTSA Project] *) 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 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. New functions (subject to change): SSL_get_servername() SSL_get_servername_type() SSL_set_SSL_CTX() New CTRL codes and macros (subject to change): SSL_CTRL_SET_TLSEXT_SERVERNAME_CB - SSL_CTX_set_tlsext_servername_callback() SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG - SSL_CTX_set_tlsext_servername_arg() SSL_CTRL_SET_TLSEXT_HOSTNAME - SSL_set_tlsext_host_name() openssl s_client has a new '-servername ...' option. openssl s_server has new options '-servername_host ...', '-cert2 ...', '-key2 ...', '-servername_fatal' (subject to change). This allows testing the HostName extension for a specific single host name ('-cert' and '-key' remain fallbacks for handshakes without HostName negotiation). If the unrecogninzed_name alert has to be sent, this by default is a warning; it becomes fatal with the '-servername_fatal' option. [Peter Sylvester, Remy Allais, Christophe Renou] *) Whirlpool hash implementation is added. [Andy Polyakov] *) BIGNUM code on 64-bit SPARCv9 targets is switched from bn(64,64) to bn(64,32). Because of instruction set limitations it doesn't have any negative impact on performance. This was done mostly in order to make it possible to share assembler modules, such as bn_mul_mont implementations, between 32- and 64-bit builds without hassle. [Andy Polyakov] *) Move code previously exiled into file crypto/ec/ec2_smpt.c to ec2_smpl.c, and no longer require the OPENSSL_EC_BIN_PT_COMP macro. [Bodo Moeller] *) New candidate for BIGNUM assembler implementation, bn_mul_mont, dedicated Montgomery multiplication procedure, is introduced. BN_MONT_CTX is modified to allow bn_mul_mont to reach for higher "64-bit" performance on certain 32-bit targets. [Andy Polyakov] *) New option SSL_OP_NO_COMP to disable use of compression selectively in SSL structures. New SSL ctrl to set maximum send fragment size. Save memory by seeting the I/O buffer sizes dynamically instead of using the maximum available value. [Steve Henson] *) New option -V for 'openssl ciphers'. This prints the ciphersuite code in addition to the text details. [Bodo Moeller] *) Very, very preliminary EXPERIMENTAL support for printing of general ASN1 structures. This currently produces rather ugly output and doesn't handle several customised structures at all. [Steve Henson] *) Integrated support for PVK file format and some related formats such as MS PUBLICKEYBLOB and PRIVATEKEYBLOB. Command line switches to support these in the 'rsa' and 'dsa' utilities. [Steve Henson] *) Support for PKCS#1 RSAPublicKey format on rsa utility command line. [Steve Henson] *) Remove the ancient ASN1_METHOD code. This was only ever used in one place for the (very old) "NETSCAPE" format certificates which are now handled using new ASN1 code equivalents. [Steve Henson] *) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD pointer and make the SSL_METHOD parameter in SSL_CTX_new, SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'. [Nils Larsch] *) Modify CRL distribution points extension code to print out previously unsupported fields. Enhance extension setting code to allow setting of all fields. [Steve Henson] *) Add print and set support for Issuing Distribution Point CRL extension. [Steve Henson] *) Change 'Configure' script to enable Camellia by default. [NTT] 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 - OpenSSL 0.9.8m if 'short' is a 16-bit type, - OpenSSL 0.9.8f if 'short' is longer than 16 bits, the previous behavior could result in a read attempt at NULL when receiving specific incorrect SSL/TLS records once record payload protection is active. (CVE-2010-0740) [Bodo Moeller, Adam Langley ] *) Fix for CVE-2010-0433 where some kerberos enabled versions of OpenSSL could be crashed if the relevant tables were not present (e.g. chrooted). [Tomas Hoger ] Changes between 0.9.8l and 0.9.8m [25 Feb 2010] *) Always check bn_wexpend() return values for failure. (CVE-2009-3245) [Martin Olsson, Neel Mehta] *) Fix X509_STORE locking: Every 'objs' access requires a lock (to accommodate for stack sorting, always a write lock!). [Bodo Moeller] *) On some versions of WIN32 Heap32Next is very slow. This can cause excessive delays in the RAND_poll(): over a minute. As a workaround include a time check in the inner Heap32Next loop too. [Steve Henson] *) The code that handled flushing of data in SSL/TLS originally used the BIO_CTRL_INFO ctrl to see if any data was pending first. This caused the problem outlined in PR#1949. The fix suggested there however can trigger problems with buggy BIO_CTRL_WPENDING (e.g. some versions of Apache). So instead simplify the code to flush unconditionally. This should be fine since flushing with no data to flush is a no op. [Steve Henson] *) Handle TLS versions 2.0 and later properly and correctly use the highest version of TLS/SSL supported. Although TLS >= 2.0 is some way off ancient servers have a habit of sticking around for a while... [Steve Henson] *) Modify compression code so it frees up structures without using the ex_data callbacks. This works around a problem where some applications call CRYPTO_cleanup_all_ex_data() before application exit (e.g. when restarting) then use compression (e.g. SSL with compression) later. This results in significant per-connection memory leaks and has caused some security issues including CVE-2008-1678 and CVE-2009-4355. [Steve Henson] *) Constify crypto/cast (i.e., ): a CAST_KEY doesn't change when encrypting or decrypting. [Bodo Moeller] *) Add option SSL_OP_LEGACY_SERVER_CONNECT which will allow clients to connect and renegotiate with servers which do not support RI. Until RI is more widely deployed this option is enabled by default. [Steve Henson] *) Add "missing" ssl ctrls to clear options and mode. [Steve Henson] *) If client attempts to renegotiate and doesn't support RI respond with a no_renegotiation alert as required by RFC5746. Some renegotiating TLS clients will continue a connection gracefully when they receive the alert. Unfortunately OpenSSL mishandled this alert and would hang waiting for a server hello which it will never receive. Now we treat a received no_renegotiation alert as a fatal error. This is because applications requesting a renegotiation might well expect it to succeed and would have no code in place to handle the server denying it so the only safe thing to do is to terminate the connection. [Steve Henson] *) Add ctrl macro SSL_get_secure_renegotiation_support() which returns 1 if peer supports secure renegotiation and 0 otherwise. Print out peer renegotiation support in s_client/s_server. [Steve Henson] *) Replace the highly broken and deprecated SPKAC certification method with the updated NID creation version. This should correctly handle UTF8. [Steve Henson] *) Implement RFC5746. Re-enable renegotiation but require the extension as needed. Unfortunately, SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION turns out to be a bad idea. It has been replaced by SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION which can be set with SSL_CTX_set_options(). This is really not recommended unless you know what you are doing. [Eric Rescorla , Ben Laurie, Steve Henson] *) Fixes to stateless session resumption handling. Use initial_ctx when issuing and attempting to decrypt tickets in case it has changed during servername handling. Use a non-zero length session ID when attempting stateless session resumption: this makes it possible to determine if a resumption has occurred immediately after receiving server hello (several places in OpenSSL subtly assume this) instead of later in the handshake. [Steve Henson] *) The functions ENGINE_ctrl(), OPENSSL_isservice(), CMS_get1_RecipientRequest() and RAND_bytes() can return <=0 on error fixes for a few places where the return code is not checked correctly. [Julia Lawall ] *) Add --strict-warnings option to Configure script to include devteam warnings in other configurations. [Steve Henson] *) Add support for --libdir option and LIBDIR variable in makefiles. This makes it possible to install openssl libraries in locations which have names other than "lib", for example "/usr/lib64" which some systems need. [Steve Henson, based on patch from Jeremy Utley] *) Don't allow the use of leading 0x80 in OIDs. This is a violation of X690 8.9.12 and can produce some misleading textual output of OIDs. [Steve Henson, reported by Dan Kaminsky] *) Delete MD2 from algorithm tables. This follows the recommendation in several standards that it is not used in new applications due to several cryptographic weaknesses. For binary compatibility reasons the MD2 API is still compiled in by default. [Steve Henson] *) Add compression id to {d2i,i2d}_SSL_SESSION so it is correctly saved and restored. [Steve Henson] *) Rename uni2asc and asc2uni functions to OPENSSL_uni2asc and OPENSSL_asc2uni conditionally on Netware platforms to avoid a name clash. [Guenter ] *) Fix the server certificate chain building code to use X509_verify_cert(), it used to have an ad-hoc builder which was unable to cope with anything other than a simple chain. [David Woodhouse , Steve Henson] *) Don't check self signed certificate signatures in X509_verify_cert() by default (a flag can override this): it just wastes time without adding any security. As a useful side effect self signed root CAs with non-FIPS digests are now usable in FIPS mode. [Steve Henson] *) In dtls1_process_out_of_seq_message() the check if the current message is already buffered was missing. For every new message was memory allocated, allowing an attacker to perform an denial of service attack with sending out of seq handshake messages until there is no memory left. Additionally every future messege was buffered, even if the sequence number made no sense and would be part of another handshake. So only messages with sequence numbers less than 10 in advance will be buffered. (CVE-2009-1378) [Robin Seggelmann, discovered by Daniel Mentz] *) Records are buffered if they arrive with a future epoch to be processed after finishing the corresponding handshake. There is currently no limitation to this buffer allowing an attacker to perform a DOS attack with sending records with future epochs until there is no memory left. This patch adds the pqueue_size() function to detemine the size of a buffer and limits the record buffer to 100 entries. (CVE-2009-1377) [Robin Seggelmann, discovered by Daniel Mentz] *) Keep a copy of frag->msg_header.frag_len so it can be used after the parent structure is freed. (CVE-2009-1379) [Daniel Mentz] *) Handle non-blocking I/O properly in SSL_shutdown() call. [Darryl Miles ] *) Add 2.5.4.* OIDs [Ilya O. ] 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 renegotiation. Renegotiation can be re-enabled by setting SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION in s3->flags at run-time. This is really not recommended unless you know what you're doing. [Ben Laurie] 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 zeroing past the valid field. (CVE-2009-0789) [Paolo Ganci ] *) Fix bug where return value of CMS_SignerInfo_verify_content() was not checked correctly. This would allow some invalid signed attributes to appear to verify correctly. (CVE-2009-0591) [Ivan Nestlerode ] *) Reject UniversalString and BMPString types with invalid lengths. This prevents a crash in ASN1_STRING_print_ex() which assumes the strings have a legal length. (CVE-2009-0590) [Steve Henson] *) Set S/MIME signing as the default purpose rather than setting it unconditionally. This allows applications to override it at the store level. [Steve Henson] *) Permit restricted recursion of ASN1 strings. This is needed in practice to handle some structures. [Steve Henson] *) Improve efficiency of mem_gets: don't search whole buffer each time for a '\n' [Jeremy Shapiro ] *) New -hex option for openssl rand. [Matthieu Herrb] *) Print out UTF8String and NumericString when parsing ASN1. [Steve Henson] *) Support NumericString type for name components. [Steve Henson] *) Allow CC in the environment to override the automatically chosen compiler. Note that nothing is done to ensure flags work with the chosen compiler. [Ben Laurie] Changes between 0.9.8i and 0.9.8j [07 Jan 2009] *) Properly check EVP_VerifyFinal() and similar return values (CVE-2008-5077). [Ben Laurie, Bodo Moeller, Google Security Team] *) Enable TLS extensions by default. [Ben Laurie] *) Allow the CHIL engine to be loaded, whether the application is multithreaded or not. (This does not release the developer from the obligation to set up the dynamic locking callbacks.) [Sander Temme ] *) Use correct exit code if there is an error in dgst command. [Steve Henson; problem pointed out by Roland Dirlewanger] *) Tweak Configure so that you need to say "experimental-jpake" to enable JPAKE, and need to use -DOPENSSL_EXPERIMENTAL_JPAKE in applications. [Bodo Moeller] *) Add experimental JPAKE support, including demo authentication in s_client and s_server. [Ben Laurie] *) Set the comparison function in v3_addr_canonize(). [Rob Austein ] *) Add support for XMPP STARTTLS in s_client. [Philip Paeps ] *) Change the server-side SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG behavior to ensure that even with this option, only ciphersuites in the server's preference list will be accepted. (Note that the option applies only when resuming a session, so the earlier behavior was just about the algorithm choice for symmetric cryptography.) [Bodo Moeller] 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). [PR #1679] *) Fix a state transitition in s3_srvr.c and d1_srvr.c (was using SSL3_ST_CW_CLNT_HELLO_B, should be ..._ST_SW_SRVR_...). [Nagendra Modadugu] *) The fix in 0.9.8c that supposedly got rid of unsafe double-checked locking was incomplete for RSA blinding, addressing just one layer of what turns out to have been doubly unsafe triple-checked locking. 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: - Avoid size_t integer overflow in HASH_UPDATE (md32_common.h). - Avoid a buffer overflow in d2i_SSL_SESSION() (ssl_asn1.c). (NB: This would require knowledge of the secret session ticket key to exploit, in which case you'd be SOL either way.) - Change bn_nist.c so that it will properly handle input BIGNUMs outside the expected range. - 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 the load fails. Useful for distros. [Ben Laurie and the FreeBSD team] *) Add support for Local Machine Keyset attribute in PKCS#12 files. [Steve Henson] *) Fix BN_GF2m_mod_arr() top-bit cleanup code. [Huang Ying] *) Expand ENGINE to support engine supplied SSL client certificate functions. This work was sponsored by Logica. [Steve Henson] *) Add CryptoAPI ENGINE to support use of RSA and DSA keys held in Windows keystores. Support for SSL/TLS client authentication too. Not compiled unless enable-capieng specified to Configure. This work was sponsored by Logica. [Steve Henson] *) Fix bug in X509_ATTRIBUTE creation: dont set attribute using ASN1_TYPE_set1 if MBSTRING flag set. This bug would crash certain attribute creation routines such as certifcate requests and PKCS#12 files. [Steve Henson] 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 cilent crash as found using the Codenomicon TLS test suite (CVE-2008-1672) [Steve Henson, Mark Cox] *) Fix double free in TLS server name extensions which could lead to a remote crash found by Codenomicon TLS test suite (CVE-2008-0891) [Joe Orton] *) Clear error queue in SSL_CTX_use_certificate_chain_file() Clear the error queue to ensure that error entries left from older function calls do not interfere with the correct operation. [Lutz Jaenicke, Erik de Castro Lopo] *) Remove root CA certificates of commercial CAs: The OpenSSL project does not recommend any specific CA and does not have any policy with respect to including or excluding any CA. Therefore it does not make any sense to ship an arbitrary selection of root CA certificates with the OpenSSL software. [Lutz Jaenicke] *) RSA OAEP patches to fix two separate invalid memory reads. The first one involves inputs when 'lzero' is greater than 'SHA_DIGEST_LENGTH' (it would read about SHA_DIGEST_LENGTH bytes before the beginning of from). The second one involves inputs where the 'db' section contains nothing but zeroes (there is a one-byte invalid read after the end of 'db'). [Ivan Nestlerode ] *) Partial backport from 0.9.9-dev: Introduce bn_mul_mont (dedicated Montgomery multiplication procedure) as a candidate for BIGNUM assembler implementation. While 0.9.9-dev uses assembler for various architectures, only x86_64 is available by default here in the 0.9.8 branch, and 32-bit x86 is available through a compile-time setting. To try the 32-bit x86 assembler implementation, use Configure option "enable-montasm" (which exists only for this backport). As "enable-montasm" for 32-bit x86 disclaims code stability anyway, in this constellation we activate additional code backported from 0.9.9-dev for further performance improvements, 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 TLS ticket cipher and HMAC keys rather than relying on hardcoded fixed values. This is useful for key rollover for example where several key sets may exist with different names. [Steve Henson] *) Reverse ENGINE-internal logic for caching default ENGINE handles. This was broken until now in 0.9.8 releases, such that the only way a registered ENGINE could be used (assuming it initialises successfully on the host) was to explicitly set it as the default for the relevant algorithms. This is in contradiction with 0.9.7 behaviour and the documentation. With this fix, when an ENGINE is registered into a given algorithm's table of implementations, the 'uptodate' flag is reset so that auto-discovery will be used next time a new context for that algorithm attempts to select an implementation. [Ian Lister (tweaked by Geoff Thorpe)] *) Backport of CMS code to OpenSSL 0.9.8. This differs from the 0.9.9 implemention in the following ways: Lack of EVP_PKEY_ASN1_METHOD means algorithm parameters have to be hard coded. Lack of BER streaming support means one pass streaming processing is only supported if data is detached: setting the streaming flag is ignored for embedded content. CMS support is disabled by default and must be explicitly enabled with the enable-cms configuration option. [Steve Henson] *) Update the GMP engine glue to do direct copies between BIGNUM and mpz_t when openssl and GMP use the same limb size. Otherwise the existing "conversion via a text string export" trick is still used. [Paul Sheer ] *) Zlib compression BIO. This is a filter BIO which compressed and uncompresses any data passed through it. [Steve Henson] *) Add AES_wrap_key() and AES_unwrap_key() functions to implement RFC3394 compatible AES key wrapping. [Steve Henson] *) Add utility functions to handle ASN1 structures. ASN1_STRING_set0(): sets string data without copying. X509_ALGOR_set0() and X509_ALGOR_get0(): set and retrieve X509_ALGOR (AlgorithmIdentifier) data. Attribute function X509at_get0_data_by_OBJ(): retrieves data from an X509_ATTRIBUTE structure optionally checking it occurs only once. ASN1_TYPE_set1(): set and ASN1_TYPE structure copying supplied data. [Steve Henson] *) Fix BN flag handling in RSA_eay_mod_exp() and BN_MONT_CTX_set() to get the expected BN_FLG_CONSTTIME behavior. [Bodo Moeller (Google)] *) Netware support: - fixed wrong usage of ioctlsocket() when build for LIBC BSD sockets - fixed do_tests.pl to run the test suite with CLIB builds too (CLIB_OPT) - added some more tests to do_tests.pl - fixed RunningProcess usage so that it works with newer LIBC NDKs too - removed usage of BN_LLONG for CLIB builds to avoid runtime dependency - added new Configure targets netware-clib-bsdsock, netware-clib-gcc, netware-clib-bsdsock-gcc, netware-libc-bsdsock-gcc - various changes to netware.pl to enable gcc-cross builds on Win32 platform - changed crypto/bio/b_sock.c to work with macro functions (CLIB BSD) - various changes to fix missing prototype warnings - fixed x86nasm.pl to create correct asm files for NASM COFF output - added AES, WHIRLPOOL and CPUID assembler code to build files - added missing AES assembler make rules to mk1mf.pl - fixed order of includes in apps/ocsp.c so that e_os.h settings apply [Guenter Knauf ] *) Implement certificate status request TLS extension defined in RFC3546. A client can set the appropriate parameters and receive the encoded OCSP response via a callback. A server can query the supplied parameters and set the encoded OCSP response in the callback. Add simplified examples to s_client and s_server. [Steve Henson] Changes between 0.9.8f and 0.9.8g [19 Oct 2007] *) Fix various bugs: + Binary incompatibility of ssl_ctx_st structure + DTLS interoperation with non-compliant servers + Don't call get_session_cb() without proposed session + Fix ia64 assembler code [Andy Polyakov, Steve Henson] 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 RFC 4347 compliant client to communicate with OpenSSL server. Unfortunately just fixing these incompatibilities would "cut off" pre-0.9.8f clients. To allow for hassle free upgrade post-0.9.8e server keeps tolerating non RFC compliant syntax. The opposite is not true, 0.9.8f client can not communicate with earlier server. This update even addresses CVE-2007-4995. [Andy Polyakov] *) Changes to avoid need for function casts in OpenSSL: some compilers (gcc 4.2 and later) reject their use. [Kurt Roeckx , Peter Hartley , Steve Henson] *) Add RFC4507 support to OpenSSL. This includes the corrections in RFC4507bis. The encrypted ticket format is an encrypted encoded SSL_SESSION structure, that way new session features are automatically supported. If a client application caches session in an SSL_SESSION structure support is transparent because tickets are now stored in the encoded SSL_SESSION. The SSL_CTX structure automatically generates keys for ticket protection in servers so again support should be possible with no application modification. If a client or server wishes to disable RFC4507 support then the option SSL_OP_NO_TICKET can be set. Add a TLS extension debugging callback to allow the contents of any client or server extensions to be examined. This work was sponsored by Google. [Steve Henson] *) 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 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. New functions (subject to change): SSL_get_servername() SSL_get_servername_type() SSL_set_SSL_CTX() New CTRL codes and macros (subject to change): SSL_CTRL_SET_TLSEXT_SERVERNAME_CB - SSL_CTX_set_tlsext_servername_callback() SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG - SSL_CTX_set_tlsext_servername_arg() SSL_CTRL_SET_TLSEXT_HOSTNAME - SSL_set_tlsext_host_name() openssl s_client has a new '-servername ...' option. openssl s_server has new options '-servername_host ...', '-cert2 ...', '-key2 ...', '-servername_fatal' (subject to change). This allows testing the HostName extension for a specific single host name ('-cert' and '-key' remain fallbacks for handshakes without HostName negotiation). If the unrecogninzed_name alert has to be sent, this by 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. [Steve Henson] *) Mitigate attack on final subtraction in Montgomery reduction. [Andy Polyakov] *) Fix crypto/ec/ec_mult.c to work properly with scalars of value 0 (which previously caused an internal error). [Bodo Moeller] *) Squeeze another 10% out of IGE mode when in != out. [Ben Laurie] *) AES IGE mode speedup. [Dean Gaudet (Google)] *) Add the Korean symmetric 128-bit cipher SEED (see 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" TLS_DHE_DSS_WITH_SEED_CBC_SHA = "DHE-DSS-SEED-SHA" TLS_DHE_RSA_WITH_SEED_CBC_SHA = "DHE-RSA-SEED-SHA" TLS_DH_anon_WITH_SEED_CBC_SHA = "ADH-SEED-SHA" To minimize changes between patchlevels in the OpenSSL 0.9.8 series, SEED remains excluded from compilation unless OpenSSL is configured with 'enable-seed'. [KISA, Bodo Moeller] *) 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, 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 BN_mod_inverse_no_branch() of BN_div() and BN_mod_inverse(), respectively, which are slower, but avoid the security-relevant conditional branches. These are automatically called by BN_div() and BN_mod_inverse() if the flag BN_FLG_CONSTTIME is set for one of the input BIGNUMs. Also, BN_is_bit_set() has been changed to remove a conditional branch. BN_FLG_CONSTTIME is the new name for the previous BN_FLG_EXP_CONSTTIME flag, since it now affects more than just modular exponentiation. (Since OpenSSL 0.9.7h, setting this flag in the exponent causes BN_mod_exp_mont() to use the alternative implementation in BN_mod_exp_mont_consttime().) The old name remains as a deprecated alias. Similary, RSA_FLAG_NO_EXP_CONSTTIME is replaced by a more general RSA_FLAG_NO_CONSTTIME flag since the RSA implementation now uses constant-time implementations for more than just exponentiation. Here too the old name is kept as a deprecated alias. 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 BN_BLINDING_new() and to BN_BLINDING_create_param() now 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 context matching (which matters if an application uses a single external cache for different purposes). Previously, out-of-context reuse was forbidden only if SSL_VERIFY_PEER was set. This did ensure strict client verification, but meant that, with applications using a single external cache for quite different requirements, clients could circumvent ciphersuite restrictions for a given session ID context by starting a session in a different context. [Bodo Moeller] *) Include "!eNULL" in SSL_DEFAULT_CIPHER_LIST to make sure that a ciphersuite string such as "DEFAULT:RSA" cannot enable authentication-only ciphersuites. [Bodo Moeller] *) Update the SSL_get_shared_ciphers() fix CVE-2006-3738 which was 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] *) Since AES128 and AES256 (and similarly Camellia128 and Camellia256) share a single mask bit in the logic of ssl/ssl_ciph.c, the code for masking out disabled ciphers needs a kludge to work properly if AES128 is available and AES256 isn't (or if Camellia128 is available and Camellia256 isn't). [Victor Duchovni] *) Fix the BIT STRING encoding generated by crypto/ec/ec_asn1.c (within i2d_ECPrivateKey, i2d_ECPKParameters, i2d_ECParameters): When a point or a seed is encoded in a BIT STRING, we need to prevent the removal of trailing zero bits to get the proper DER encoding. (By default, crypto/asn1/a_bitstr.c assumes the case of a NamedBitList, for which trailing 0 bits need to be removed.) [Bodo Moeller] *) Have SSL/TLS server implementation tolerate "mismatched" record protocol version while receiving ClientHello even if the ClientHello is fragmented. (The server can't insist on the particular protocol version it has chosen before the ServerHello message has informed the client about his choice.) [Bodo Moeller] *) Add RFC 3779 support. [Rob Austein for ARIN, Ben Laurie] *) Load error codes if they are not already present instead of using a static variable. This allows them to be cleanly unloaded and reloaded. Improve header file function name parsing. [Steve Henson] *) extend SMTP and IMAP protocol emulation in s_client to use EHLO or CAPABILITY handshake as required by RFCs. [Goetz Babin-Ebell] 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) [Steve Henson, Bodo Moeller] *) Fix ASN.1 parsing of certain invalid structures that can result in a denial of service. (CVE-2006-2937) [Steve Henson] *) Fix buffer overflow in SSL_get_shared_ciphers() function. (CVE-2006-3738) [Tavis Ormandy and Will Drewry, Google Security Team] *) Fix SSL client code which could crash if connecting to a malicious SSLv2 server. (CVE-2006-4343) [Tavis Ormandy and Will Drewry, Google Security Team] *) Since 0.9.8b, ciphersuite strings naming explicit ciphersuites match only those. Before that, "AES256-SHA" would be interpreted as a pattern and match "AES128-SHA" too (since AES128-SHA got the same strength classification in 0.9.7h) as we currently only have a single AES bit in the ciphersuite description bitmap. That change, however, also applied to ciphersuite strings such as "RC4-MD5" that intentionally matched multiple ciphersuites -- namely, SSL 2.0 ciphersuites in addition to the more common ones from SSL 3.0/TLS 1.0. So we change the selection algorithm again: Naming an explicit ciphersuite selects this one ciphersuite, and any other similar ciphersuite (same bitmap) from *other* protocol versions. Thus, "RC4-MD5" again will properly select both the SSL 2.0 ciphersuite and the SSL 3.0/TLS 1.0 ciphersuite. Since SSL 2.0 does not have any ciphersuites for which the 128/256 bit distinction would be relevant, this works for now. The proper fix will be to use different bits for AES128 and AES256, which would have avoided the problems from the beginning; however, bits are scarce, so we can only do this in a new release (not just a patchlevel) when we can change the SSL_CIPHER 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] *) Avoid PKCS #1 v1.5 signature attack discovered by Daniel Bleichenbacher (CVE-2006-4339) [Ben Laurie and Google Security Team] *) Add AES IGE and biIGE modes. [Ben Laurie] *) Change the Unix randomness entropy gathering to use poll() when possible instead of select(), since the latter has some undesirable limitations. [Darryl Miles via Richard Levitte and Bodo Moeller] *) Disable "ECCdraft" ciphersuites more thoroughly. Now special treatment in ssl/ssl_ciph.s makes sure that these ciphersuites cannot be implicitly activated as part of, e.g., the "AES" alias. However, please upgrade to OpenSSL 0.9.9[-dev] for non-experimental use of the ECC ciphersuites to get TLS extension support, which is required for curve and point format negotiation to avoid potential handshake problems. [Bodo Moeller] *) 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") The latter two were purportedly from draft-ietf-tls-56-bit-ciphersuites-0[01].txt, but do not really appear there. Also deactivate the remaining ciphersuites from draft-ietf-tls-56-bit-ciphersuites-01.txt. These are just as unofficial, and the ID has long expired. [Bodo Moeller] *) Fix RSA blinding Heisenbug (problems sometimes occured on dual-core machines) and other potential thread-safety issues. [Bodo Moeller] *) 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). Also, add Camellia TLS ciphersuites from RFC 4132. To minimize changes between patchlevels in the OpenSSL 0.9.8 series, Camellia remains excluded from compilation unless OpenSSL is configured with 'enable-camellia'. [NTT] *) Disable the padding bug check when compression is in use. The padding bug check assumes the first packet is of even length, this is not necessarily true if compresssion is enabled and can result in false positives causing handshake failure. The actual bug test is ancient code so it is hoped that implementations will either have fixed it by now or any which still have the bug do not support compression. [Steve Henson] 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. [Steve Henson] *) Link in manifests for VC++ if needed. [Austin Ziegler ] *) Update support for ECC-based TLS ciphersuites according to draft-ietf-tls-ecc-12.txt with proposed changes (but without TLS extensions, which are supported starting with the 0.9.9 branch, not in the OpenSSL 0.9.8 branch). [Douglas Stebila] *) New functions EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() to support opaque EVP_CIPHER_CTX handling. [Steve Henson] *) 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 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 can't be loaded. [Steve Henson] *) Several fixes and enhancements to the OID generation code. The old code sometimes allowed invalid OIDs (1.X for X >= 40 for example), couldn't handle numbers larger than ULONG_MAX, truncated printing and had a non standard OBJ_obj2txt() behaviour. [Steve Henson] *) Add support for building of engines under engine/ as shared libraries under VC++ build system. [Steve Henson] *) Corrected the numerous bugs in the Win32 path splitter in DSO. Hopefully, we will not see any false combination of paths any more. [Richard Levitte] 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 countermeasure against man-in-the-middle protocol-version rollback in the SSL 2.0 server implementation, which is a bad idea. (CVE-2005-2969) [Bodo Moeller; problem pointed out by Yutaka Oiwa (Research Center for Information Security, National Institute of Advanced Industrial Science and Technology [AIST], Japan)] *) Add two function to clear and return the verify parameter flags. [Steve Henson] *) Keep cipherlists sorted in the source instead of sorting them at runtime, thus removing the need for a lock. [Nils Larsch] *) Avoid some small subgroup attacks in Diffie-Hellman. [Nick Mathewson and Ben Laurie] *) Add functions for well-known primes. [Nick Mathewson] *) Extended Windows CE support. [Satoshi Nakamura and Andy Polyakov] *) Initialize SSL_METHOD structures at compile time instead of during runtime, thus removing the need for a lock. [Steve Henson] *) Make PKCS7_decrypt() work even if no certificate is supplied by attempting to decrypt each encrypted key in turn. Add support to smime utility. [Steve Henson] 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.] *) Add libcrypto.pc and libssl.pc for those who feel they need them. [Richard Levitte] *) Change CA.sh and CA.pl so they don't bundle the CSR and the private key into the same file any more. [Richard Levitte] *) Add initial support for Win64, both IA64 and AMD64/x64 flavors. [Andy Polyakov] *) Add -utf8 command line and config file option to 'ca'. [Stefan and Geoff Thorpe] *) Add attribute functions to EVP_PKEY structure. Modify PKCS12_create() to recognize a CSP name attribute and use it. Make -CSP option work again in pkcs12 utility. [Steve Henson] *) Add new functionality to the bn blinding code: - automatic re-creation of the BN_BLINDING parameters after a fixed number of uses (currently 32) - add new function for parameter creation - introduce flags to control the update behaviour of the BN_BLINDING parameters - hide BN_BLINDING structure Add a second BN_BLINDING slot to the RSA structure to improve performance when a single RSA object is shared among several threads. [Nils Larsch] *) Add support for DTLS. [Nagendra Modadugu and Ben Laurie] *) Add support for DER encoded private keys (SSL_FILETYPE_ASN1) to SSL_CTX_use_PrivateKey_file() and SSL_use_PrivateKey_file() [Walter Goulet] *) Remove buggy and incompletet DH cert support from ssl/ssl_rsa.c and ssl/s3_both.c [Nils Larsch] *) Use SHA-1 instead of MD5 as the default digest algorithm for the apps/openssl applications. [Nils Larsch] *) Compile clean with "-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror". Currently DEBUG_SAFESTACK must also be set. [Ben Laurie] *) Change ./Configure so that certain algorithms can be disabled by default. The new counterpiece to "no-xxx" is "enable-xxx". The patented RC5 and MDC2 algorithms will now be disabled unless "enable-rc5" and "enable-mdc2", respectively, are specified. (IDEA remains enabled despite being patented. This is because IDEA is frequently required for interoperability, and there is no license 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 sponsored by KTH (The Royal Institute of Technology in Stockholm) and EGEE (Enabling Grids for E-science in Europe). [Richard Levitte] *) RC4 performance overhaul on modern architectures/implementations, such as Intel P4, IA-64 and AMD64. [Andy Polyakov] *) New utility extract-section.pl. This can be used specify an alternative section number in a pod file instead of having to treat each file as a separate case in Makefile. This can be done by adding two lines to the pod file: =for comment openssl_section:XXX The blank line is mandatory. [Steve Henson] *) New arguments -certform, -keyform and -pass for s_client and s_server to allow alternative format key and certificate files and passphrase sources. [Steve Henson] *) New structure X509_VERIFY_PARAM which combines current verify parameters, update associated structures and add various utility functions. Add new policy related verify parameters, include policy checking in standard verify code. Enhance 'smime' application with extra parameters to support policy checking and print out. [Steve Henson] *) Add a new engine to support VIA PadLock ACE extensions in the VIA C3 Nehemiah processors. These extensions support AES encryption in hardware as well as RNG (though RNG support is currently disabled). [Michal Ludvig , with help from Andy Polyakov] *) Deprecate BN_[get|set]_params() functions (they were ignored internally). [Geoff Thorpe] *) New FIPS 180-2 algorithms, SHA-224/-256/-384/-512 are implemented. [Andy Polyakov and a number of other people] *) Improved PowerPC platform support. Most notably BIGNUM assembler implementation contributed by IBM. [Suresh Chari, Peter Waltenberg, Andy Polyakov] *) The new 'RSA_generate_key_ex' function now takes a BIGNUM for the public exponent rather than 'unsigned long'. There is a corresponding change to the new 'rsa_keygen' element of the RSA_METHOD structure. [Jelte Jansen, Geoff Thorpe] *) Functionality for creating the initial serial number file is now moved from CA.pl to the 'ca' utility with a new option -create_serial. (Before OpenSSL 0.9.7e, CA.pl used to initialize the serial number file to 1, which is bound to cause problems. To avoid the problems while respecting compatibility between different 0.9.7 patchlevels, 0.9.7e employed 'openssl x509 -next_serial' in CA.pl for serial number initialization. With the new release 0.9.8, we can fix the problem directly in the 'ca' utility.) [Steve Henson] *) Reduced header interdepencies by declaring more opaque objects in ossl_typ.h. As a consequence, including some headers (eg. engine.h) will give fewer recursive includes, which could break lazy source code - so this change is covered by the OPENSSL_NO_DEPRECATED symbol. As always, developers should define this symbol when building and using openssl to ensure they track the recommended behaviour, interfaces, [etc], but backwards-compatible behaviour prevails when this isn't defined. [Geoff Thorpe] *) New function X509_POLICY_NODE_print() which prints out policy nodes. [Steve Henson] *) Add new EVP function EVP_CIPHER_CTX_rand_key and associated functionality. This will generate a random key of the appropriate length based on the cipher context. The EVP_CIPHER can provide its own random key generation routine to support keys of a specific form. This is used in the des and 3des routines to generate a key of the correct parity. Update S/MIME code to use new functions and hence generate correct parity DES keys. Add EVP_CHECK_DES_KEY #define to return an error if the key is not valid (weak or incorrect parity). [Steve Henson] *) Add a local set of CRLs that can be used by X509_verify_cert() as well as looking them up. This is useful when the verified structure may contain CRLs, for example PKCS#7 signedData. Modify PKCS7_verify() to use any CRLs present unless the new PKCS7_NO_CRL flag is asserted. [Steve Henson] *) Extend ASN1 oid configuration module. It now additionally accepts the syntax: shortName = some long name, 1.2.3.4 [Steve Henson] *) Reimplemented the BN_CTX implementation. There is now no more static limitation on the number of variables it can handle nor the depth of the "stack" handling for BN_CTX_start()/BN_CTX_end() pairs. The stack information can now expand as required, and rather than having a single static array of bignums, BN_CTX now uses a linked-list of such arrays allowing it to expand on demand whilst maintaining the usefulness of BN_CTX's "bundling". [Geoff Thorpe] *) Add a missing BN_CTX parameter to the 'rsa_mod_exp' callback in RSA_METHOD to allow all RSA operations to function using a single BN_CTX. [Geoff Thorpe] *) Preliminary support for certificate policy evaluation and checking. This is initially intended to pass the tests outlined in "Conformance Testing of Relying Party Client Certificate Path Processing Logic" v1.07. [Steve Henson] *) bn_dup_expand() has been deprecated, it was introduced in 0.9.7 and remained unused and not that useful. A variety of other little bignum tweaks and fixes have also been made continuing on from the audit (see below). [Geoff Thorpe] *) Constify all or almost all d2i, c2i, s2i and r2i functions, along with associated ASN1, EVP and SSL functions and old ASN1 macros. [Richard Levitte] *) BN_zero() only needs to set 'top' and 'neg' to zero for correct results, and this should never fail. So the return value from the use of BN_set_word() (which can fail due to needless expansion) is now deprecated; if OPENSSL_NO_DEPRECATED is defined, BN_zero() is a void macro. [Geoff Thorpe] *) BN_CTX_get() should return zero-valued bignums, providing the same initialised value as BN_new(). [Geoff Thorpe, suggested by Ulf Möller] *) Support for inhibitAnyPolicy certificate extension. [Steve Henson] *) An audit of the BIGNUM code is underway, for which debugging code is enabled when BN_DEBUG is defined. This makes stricter enforcements on what is considered valid when processing BIGNUMs, and causes execution to assert() when a problem is discovered. If BN_DEBUG_RAND is defined, further steps are taken to deliberately pollute unused data in BIGNUM structures to try and expose faulty code further on. For now, openssl will (in its default mode of operation) continue to tolerate the inconsistent forms that it has tolerated in the past, but authors and packagers should consider trying openssl and their own applications when compiled with these debugging symbols defined. It will help highlight potential bugs in their own code, and will improve the test coverage for OpenSSL itself. At some point, these tighter rules will become openssl's default to improve maintainability, though the assert()s and other overheads will remain only in debugging configurations. See bn.h for more details. [Geoff Thorpe, Nils Larsch, Ulf Möller] *) BN_CTX_init() has been deprecated, as BN_CTX is an opaque structure that can only be obtained through BN_CTX_new() (which implicitly initialises it). The presence of this function only made it possible to overwrite an existing structure (and cause memory leaks). [Geoff Thorpe] *) Because of the callback-based approach for implementing LHASH as a template type, lh_insert() adds opaque objects to hash-tables and lh_doall() or lh_doall_arg() are typically used with a destructor callback 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 prototyped to have "const" restrictions on the object pointers they are given (and so aren't required to cast them away any more). [Geoff Thorpe] *) 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_***" aren't necessarily the greatest nomenclatures - but this is what was used internally to the implementation so I've used that for now. [Geoff Thorpe] *) Ensure that deprecated functions do not get compiled when OPENSSL_NO_DEPRECATED is defined. Some "openssl" subcommands and a few of the self-tests were still using deprecated key-generation functions so these have been updated also. [Geoff Thorpe] *) Reorganise PKCS#7 code to separate the digest location functionality into PKCS7_find_digest(), digest addtion into PKCS7_bio_add_digest(). New function PKCS7_set_digest() to set the digest type for PKCS#7 digestedData type. Add additional code to correctly generate the digestedData type and add support for this type in PKCS7 initialization functions. [Steve Henson] *) New function PKCS7_set0_type_other() this initializes a PKCS7 structure of type "other". [Steve Henson] *) Fix prime generation loop in crypto/bn/bn_prime.pl by making sure the loop does correctly stop and breaking ("division by zero") modulus operations are not performed. The (pre-generated) prime table crypto/bn/bn_prime.h was already correct, but it could not be re-generated on some platforms because of the "division by zero" situation in the script. [Ralf S. Engelschall] *) Update support for ECC-based TLS ciphersuites according to draft-ietf-tls-ecc-03.txt: the KDF1 key derivation function with SHA-1 now is only used for "small" curves (where the representation of a field element takes up to 24 bytes); for larger curves, the field element resulting from ECDH is directly used as premaster secret. [Douglas Stebila (Sun Microsystems Laboratories)] *) Add code for kP+lQ timings to crypto/ec/ectest.c, and add SEC2 curve secp160r1 to the tests. [Douglas Stebila (Sun Microsystems Laboratories)] *) Add the possibility to load symbols globally with DSO. [Götz Babin-Ebell via Richard Levitte] *) Add the functions ERR_set_mark() and ERR_pop_to_mark() for better control of the error stack. [Richard Levitte] *) Add support for STORE in ENGINE. [Richard Levitte] *) Add the STORE type. The intention is to provide a common interface to certificate and key stores, be they simple file-based stores, or HSM-type store, or LDAP stores, or... NOTE: The code is currently UNTESTED and isn't really used anywhere. [Richard Levitte] *) Add a generic structure called OPENSSL_ITEM. This can be used to pass a list of arguments to any function as well as provide a way for a function to pass data back to the caller. [Richard Levitte] *) Add the functions BUF_strndup() and BUF_memdup(). BUF_strndup() works like BUF_strdup() but can be used to duplicate a portion of a string. The copy gets NUL-terminated. BUF_memdup() duplicates a memory area. [Richard Levitte] *) Add the function sk_find_ex() which works like sk_find(), but will return an index to an element even if an exact match couldn't be found. The index is guaranteed to point at the element where the searched-for key would be inserted to preserve sorting order. [Richard Levitte] *) Add the function OBJ_bsearch_ex() which works like OBJ_bsearch() but takes an extra flags argument for optional functionality. Currently, the following flags are defined: OBJ_BSEARCH_VALUE_ON_NOMATCH This one gets OBJ_bsearch_ex() to return a pointer to the first element where the comparing function returns a negative or zero number. OBJ_BSEARCH_FIRST_VALUE_ON_MATCH This one gets OBJ_bsearch_ex() to return a pointer to the first element where the comparing function returns zero. This is useful if there are more than one element where the comparing function returns zero. [Richard Levitte] *) Make it possible to create self-signed certificates with 'openssl ca' in such a way that the self-signed certificate becomes part of the CA database and uses the same mechanisms for serial number generation as all other certificate signing. The new flag '-selfsign' enables this functionality. Adapt CA.sh and CA.pl.in. [Richard Levitte] *) Add functionality to check the public key of a certificate request against a given private. This is useful to check that a certificate request can be signed by that key (self-signing). [Richard Levitte] *) Make it possible to have multiple active certificates with the same subject in the CA index file. This is done only if the keyword 'unique_subject' is set to 'no' in the main CA section (default if 'CA_default') of the configuration file. The value is saved with the database itself in a separate index attribute file, named like the index file with '.attr' appended to the name. [Richard Levitte] *) Generate muti valued AVAs using '+' notation in config files for req and dirName. [Steve Henson] *) Support for nameConstraints certificate extension. [Steve Henson] *) Support for policyConstraints certificate extension. [Steve Henson] *) Support for policyMappings certificate extension. [Steve Henson] *) Make sure the default DSA_METHOD implementation only uses its dsa_mod_exp() and/or bn_mod_exp() handlers if they are non-NULL, and change its own handlers to be NULL so as to remove unnecessary indirection. This lets alternative implementations fallback to the default implementation more easily. [Geoff Thorpe] *) Support for directoryName in GeneralName related extensions in config files. [Steve Henson] *) Make it possible to link applications using Makefile.shared. Make that possible even when linking against static libraries! [Richard Levitte] *) Support for single pass processing for S/MIME signing. This now means that S/MIME signing can be done from a pipe, in addition cleartext signing (multipart/signed type) is effectively streaming and the signed data does not need to be all held in memory. This is done with a new flag PKCS7_STREAM. When this flag is set PKCS7_sign() only initializes the PKCS7 structure and the actual signing is done after the data is output (and digests calculated) in SMIME_write_PKCS7(). [Steve Henson] *) Add full support for -rpath/-R, both in shared libraries and applications, at least on the platforms where it's known how to do it. [Richard Levitte] *) In crypto/ec/ec_mult.c, implement fast point multiplication with precomputation, based on wNAF splitting: EC_GROUP_precompute_mult() will now compute a table of multiples of the generator that makes subsequent invocations of EC_POINTs_mul() or EC_POINT_mul() faster (notably in the case of a single point multiplication, scalar * generator). [Nils Larsch, Bodo Moeller] *) IPv6 support for certificate extensions. The various extensions which use the IP:a.b.c.d can now take IPv6 addresses using the formats of RFC1884 2.2 . IPv6 addresses are now also displayed correctly. [Steve Henson] *) Added an ENGINE that implements RSA by performing private key exponentiations with the GMP library. The conversions to and from GMP's mpz_t format aren't optimised nor are any montgomery forms cached, and on x86 it appears OpenSSL's own performance has caught up. However there are likely to be other architectures where GMP could provide a boost. This ENGINE is not built in by default, but it can be specified at Configure time and should be accompanied by the necessary linker additions, eg; ./config -DOPENSSL_USE_GMP -lgmp [Geoff Thorpe] *) "openssl engine" will not display ENGINE/DSO load failure errors when testing availability of engines with "-t" - the old behaviour is produced by increasing the feature's verbosity with "-tt". [Geoff Thorpe] *) ECDSA routines: under certain error conditions uninitialized BN objects could be freed. Solution: make sure initialization is performed early enough. (Reported and fix supplied by Nils Larsch via PR#459) [Lutz Jaenicke] *) Key-generation can now be implemented in RSA_METHOD, DSA_METHOD and DH_METHOD (eg. by ENGINE implementations) to override the normal software implementations. For DSA and DH, parameter generation can also be overriden by providing the appropriate method callbacks. [Geoff Thorpe] *) 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" 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 migrate to the new functions. Also, the new key-generation API functions operate on a caller-supplied key-structure and return success/failure rather than returning a key or NULL - this is to help make "keygen" another member function of RSA_METHOD etc. Example for using the new callback interface: int (*my_callback)(int a, int b, BN_GENCB *cb) = ...; void *my_arg = ...; BN_GENCB my_cb; BN_GENCB_set(&my_cb, my_callback, my_arg); return BN_is_prime_ex(some_bignum, BN_prime_checks, NULL, &cb); /* For the meaning of a, b in calls to my_callback(), see the * documentation of the function that calls the callback. * cb will point to my_cb; my_arg can be retrieved as cb->arg. * my_callback should return 1 if it wants BN_is_prime_ex() * to continue, or 0 to stop. */ [Geoff Thorpe] *) Change the ZLIB compression method to be stateful, and make it available to TLS with the number defined in draft-ietf-tls-compression-04.txt. [Richard Levitte] *) Add the ASN.1 structures and functions for CertificatePair, which is defined as follows (according to X.509_4thEditionDraftV6.pdf): CertificatePair ::= SEQUENCE { forward [0] Certificate OPTIONAL, reverse [1] Certificate OPTIONAL, -- at least one of the pair shall be present -- } Also implement the PEM functions to read and write certificate pairs, and defined the PEM tag as "CERTIFICATE PAIR". This needed to be defined, mostly for the sake of the LDAP attribute crossCertificatePair, but may prove useful elsewhere as well. [Richard Levitte] *) Make it possible to inhibit symlinking of shared libraries in Makefile.shared, for Cygwin's sake. [Richard Levitte] *) Extend the BIGNUM API by creating a function void BN_set_negative(BIGNUM *a, int neg); and a macro that behave like int BN_is_negative(const BIGNUM *a); to avoid the need to access 'a->neg' directly in applications. [Nils Larsch] *) Implement fast modular reduction for pseudo-Mersenne primes used in NIST curves (crypto/bn/bn_nist.c, crypto/ec/ecp_nist.c). EC_GROUP_new_curve_GFp() will now automatically use this if applicable. [Nils Larsch ] *) Add new lock type (CRYPTO_LOCK_BN). [Bodo Moeller] *) Change the ENGINE framework to automatically load engines dynamically from specific directories unless they could be found to already be built in or loaded. Move all the current engines except for the cryptodev one to a new directory engines/. The engines in engines/ are built as shared libraries if the "shared" options was given to ./Configure or ./config. Otherwise, they are inserted in libcrypto.a. /usr/local/ssl/engines is the default directory for dynamic engines, but that can be overriden at configure time through the usual use of --prefix and/or --openssldir, and at run time with the environment variable OPENSSL_ENGINES. [Geoff Thorpe and Richard Levitte] *) Add Makefile.shared, a helper makefile to build shared libraries. Addapt Makefile.org. [Richard Levitte] *) Add version info to Win32 DLLs. [Peter 'Luna' Runestig" ] *) Add new 'medium level' PKCS#12 API. Certificates and keys can be added using this API to created arbitrary PKCS#12 files while avoiding the low level API. New options to PKCS12_create(), key or cert can be NULL and will then be omitted from the output file. The encryption algorithm NIDs can be set to -1 for no encryption, the mac iteration count can be set to 0 to omit the mac. Enhance pkcs12 utility by making the -nokeys and -nocerts options work when creating a PKCS#12 file. New option -nomac to omit the mac, NONE can be set for an encryption algorithm. New code is modified to use the enhanced PKCS12_create() instead of the low level API. [Steve Henson] *) Extend ASN1 encoder to support indefinite length constructed encoding. This can output sequences tags and octet strings in this form. Modify pk7_asn1.c to support indefinite length encoding. This is experimental and needs additional code to be useful, such as an ASN1 bio and some enhanced streaming PKCS#7 code. Extend template encode functionality so that tagging is passed down to the template encoder. [Steve Henson] *) Let 'openssl req' fail if an argument to '-newkey' is not recognized instead of using RSA as a default. [Bodo Moeller] *) Add support for ECC-based ciphersuites from draft-ietf-tls-ecc-01.txt. As these are not official, they are not included in "ALL"; the "ECCdraft" ciphersuite group alias can be used to select them. [Vipul Gupta and Sumit Gupta (Sun Microsystems Laboratories)] *) Add ECDH engine support. [Nils Gura and Douglas Stebila (Sun Microsystems Laboratories)] *) Add ECDH in new directory crypto/ecdh/. [Douglas Stebila (Sun Microsystems Laboratories)] *) Let BN_rand_range() abort with an error after 100 iterations without success (which indicates a broken PRNG). [Bodo Moeller] *) Change BN_mod_sqrt() so that it verifies that the input value is really the square of the return value. (Previously, BN_mod_sqrt would show GIGO behaviour.) [Bodo Moeller] *) 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)] *) Extend the EC library for elliptic curves over binary fields (new files ec2_smpl.c, ec2_smpt.c, ec2_mult.c in crypto/ec/). New EC_METHOD: EC_GF2m_simple_method New API functions: EC_GROUP_new_curve_GF2m EC_GROUP_set_curve_GF2m EC_GROUP_get_curve_GF2m EC_POINT_set_affine_coordinates_GF2m EC_POINT_get_affine_coordinates_GF2m EC_POINT_set_compressed_coordinates_GF2m Point compression for binary fields is disabled by default for patent reasons (compile with OPENSSL_EC_BIN_PT_COMP defined to enable it). 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 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)] *) Optionally dispatch EC_POINT_mul(), EC_POINT_precompute_mult() through methods ('mul', 'precompute_mult'). The generic implementations (now internally called 'ec_wNAF_mul' and 'ec_wNAF_precomputed_mult') remain the default if these methods are undefined. [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)] *) New functions EC_GROUP_dup, EC_POINT_dup. (These simply call ..._new and ..._copy). [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 used) in the following functions [macros]: BN_GF2m_add BN_GF2m_sub [= BN_GF2m_add] BN_GF2m_mod [wrapper for BN_GF2m_mod_arr] BN_GF2m_mod_mul [wrapper for BN_GF2m_mod_mul_arr] BN_GF2m_mod_sqr [wrapper for BN_GF2m_mod_sqr_arr] BN_GF2m_mod_inv BN_GF2m_mod_exp [wrapper for BN_GF2m_mod_exp_arr] BN_GF2m_mod_sqrt [wrapper for BN_GF2m_mod_sqrt_arr] BN_GF2m_mod_solve_quad [wrapper for BN_GF2m_mod_solve_quad_arr] BN_GF2m_cmp [= BN_ucmp] (Note that only the 'mod' functions are actually for fields GF(2^m). BN_GF2m_add() is misnomer, but this is for the sake of consistency.) For some functions, an the irreducible polynomial defining a field can be given as an 'unsigned int[]' with strictly decreasing elements giving the indices of those bits that are set; i.e., p[] represents the polynomial f(t) = t^p[0] + t^p[1] + ... + t^p[k] where p[0] > p[1] > ... > p[k] = 0. This applies to the following functions: BN_GF2m_mod_arr BN_GF2m_mod_mul_arr BN_GF2m_mod_sqr_arr BN_GF2m_mod_inv_arr [wrapper for BN_GF2m_mod_inv] BN_GF2m_mod_div_arr [wrapper for BN_GF2m_mod_div] BN_GF2m_mod_exp_arr BN_GF2m_mod_sqrt_arr BN_GF2m_mod_solve_quad_arr BN_GF2m_poly2arr BN_GF2m_arr2poly Conversion can be performed by the following functions: BN_GF2m_poly2arr BN_GF2m_arr2poly bntest.c has additional tests for binary polynomial arithmetic. Two implementations for BN_GF2m_mod_div() are available. The default algorithm simply uses BN_GF2m_mod_inv() and BN_GF2m_mod_mul(). The alternative algorithm is compiled in only 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)] *) Add new error code 'ERR_R_DISABLED' that can be used when some functionality is disabled at compile-time. [Douglas Stebila ] *) Change default behaviour of 'openssl asn1parse' so that more information is visible when viewing, e.g., a certificate: Modify asn1_parse2 (crypto/asn1/asn1_par.c) so that in non-'dump' mode the content of non-printable OCTET STRINGs is output in a style similar to INTEGERs, but with '[HEX DUMP]' prepended to avoid the appearance of a printable string. [Nils Larsch ] *) Add 'asn1_flag' and 'asn1_form' member to EC_GROUP with access functions EC_GROUP_set_asn1_flag() EC_GROUP_get_asn1_flag() EC_GROUP_set_point_conversion_form() EC_GROUP_get_point_conversion_form() These control ASN1 encoding details: - Curves (i.e., groups) are encoded explicitly unless asn1_flag has been set to OPENSSL_EC_NAMED_CURVE. - Points are encoded in uncompressed form by default; options for asn1_for are as for point2oct, namely POINT_CONVERSION_COMPRESSED POINT_CONVERSION_UNCOMPRESSED POINT_CONVERSION_HYBRID Also add 'seed' and 'seed_len' members to EC_GROUP with access functions EC_GROUP_set_seed() EC_GROUP_get0_seed() EC_GROUP_get_seed_len() This is used only for ASN1 purposes (so far). [Nils Larsch ] *) Add 'field_type' member to EC_METHOD, which holds the NID of the appropriate field type OID. The new function EC_METHOD_get_field_type() returns this value. [Nils Larsch ] *) Add functions EC_POINT_point2bn() EC_POINT_bn2point() EC_POINT_point2hex() EC_POINT_hex2point() providing useful interfaces to EC_POINT_point2oct() and EC_POINT_oct2point(). [Nils Larsch ] *) Change internals of the EC library so that the functions EC_GROUP_set_generator() EC_GROUP_get_generator() EC_GROUP_get_order() EC_GROUP_get_cofactor() are implemented directly in crypto/ec/ec_lib.c and not dispatched to methods, which would lead to unnecessary code duplication when adding different types of curves. [Nils Larsch with input by Bodo Moeller] *) Implement compute_wNAF (crypto/ec/ec_mult.c) without BIGNUM arithmetic, and such that modified wNAFs are generated (which avoid length expansion in many cases). [Bodo Moeller] *) Add a function EC_GROUP_check_discriminant() (defined via EC_METHOD) that verifies that the curve discriminant is non-zero. Add a function EC_GROUP_check() that makes some sanity tests on a EC_GROUP, its generator and order. This includes EC_GROUP_check_discriminant(). [Nils Larsch ] *) Add ECDSA in new directory crypto/ecdsa/. Add applications 'openssl ecparam' and 'openssl ecdsa' (these are based on 'openssl dsaparam' and 'openssl dsa'). ECDSA support is also included in various other files across the library. Most notably, - 'openssl req' now has a '-newkey ecdsa:file' option; - EVP_PKCS82PKEY (crypto/evp/evp_pkey.c) now can handle ECDSA; - X509_PUBKEY_get (crypto/asn1/x_pubkey.c) and d2i_PublicKey (crypto/asn1/d2i_pu.c) have been modified to make them suitable for ECDSA where domain parameters must be extracted before the specific public key; - ECDSA engine support has been added. [Nils Larsch ] *) Include some named elliptic curves, and add OIDs from X9.62, SECG, and WAP/WTLS. Each curve can be obtained from the new function EC_GROUP_new_by_curve_name(), and the list of available named curves can be obtained with EC_get_builtin_curves(). Also add a 'curve_name' member to EC_GROUP objects, which can be accessed via EC_GROUP_set_curve_name() EC_GROUP_get_curve_name() [Nils Larsch ] *) Include "!eNULL" in SSL_DEFAULT_CIPHER_LIST to make sure that a ciphersuite string such as "DEFAULT:RSA" cannot enable authentication-only ciphersuites. [Bodo Moeller] *) Since AES128 and AES256 share a single mask bit in the logic of ssl/ssl_ciph.c, the code for masking out disabled ciphers needs a kludge to work properly if AES128 is available and AES256 isn't. [Victor Duchovni] *) Expand security boundary to match 1.1.1 module. [Steve Henson] *) Remove redundant features: hash file source, editing of test vectors modify fipsld to use external fips_premain.c signature. [Steve Henson] *) New perl script mkfipsscr.pl to create shell scripts or batch files to run algorithm test programs. [Steve Henson] *) Make algorithm test programs more tolerant of whitespace. [Steve Henson] *) Have SSL/TLS server implementation tolerate "mismatched" record protocol version while receiving ClientHello even if the ClientHello is fragmented. (The server can't insist on the particular protocol version it has chosen before the ServerHello message has informed the client about his choice.) [Bodo Moeller] *) Load error codes if they are not already present instead of using a static variable. This allows them to be cleanly unloaded and reloaded. [Steve Henson] 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) [Steve Henson, Bodo Moeller] *) Fix ASN.1 parsing of certain invalid structures that can result in a denial of service. (CVE-2006-2937) [Steve Henson] *) Fix buffer overflow in SSL_get_shared_ciphers() function. (CVE-2006-3738) [Tavis Ormandy and Will Drewry, Google Security Team] *) Fix SSL client code which could crash if connecting to a malicious SSLv2 server. (CVE-2006-4343) [Tavis Ormandy and Will Drewry, Google Security Team] *) Change ciphersuite string processing so that an explicit ciphersuite selects this one ciphersuite (so that "AES256-SHA" will no longer include "AES128-SHA"), and any other similar ciphersuite (same bitmap) from *other* protocol versions (so that "RC4-MD5" will still include both the SSL 2.0 ciphersuite and the SSL 3.0/TLS 1.0 ciphersuite). This is a backport combining changes from 0.9.8b and 0.9.8d. [Bodo Moeller] 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] *) Change the Unix randomness entropy gathering to use poll() when possible instead of select(), since the latter has some undesirable limitations. [Darryl Miles via Richard Levitte and Bodo Moeller] *) 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") The latter two were purportedly from draft-ietf-tls-56-bit-ciphersuites-0[01].txt, but do not really appear there. Also deactive the remaining ciphersuites from draft-ietf-tls-56-bit-ciphersuites-01.txt. These are just as unofficial, and the ID has long expired. [Bodo Moeller] *) Fix RSA blinding Heisenbug (problems sometimes occured on dual-core machines) and other potential thread-safety issues. [Bodo Moeller] 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. [Steve Henson] *) Fixes for VC++ 2005 build under Windows. [Steve Henson] *) Add new Windows build target VC-32-GMAKE for VC++. This uses GNU make from a Windows bash shell such as MSYS. It is autodetected from the "config" script when run from a VC++ environment. Modify standard VC++ build to use fipscanister.o from the GNU make build. [Steve Henson] 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. BEWARE! A program linked with a shared FIPSed libcrypto can't be safely run with a non-FIPSed libcrypto, as it may crash because of the difference induced by this change. [Andy Polyakov] 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 countermeasure against man-in-the-middle protocol-version rollback in the SSL 2.0 server implementation, which is a bad idea. (CVE-2005-2969) [Bodo Moeller; problem pointed out by Yutaka Oiwa (Research Center for Information Security, National Institute of Advanced Industrial 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. [Steve Henson] *) For DSA signing, unless DSA_FLAG_NO_EXP_CONSTTIME is set, perform the exponentiation using a fixed-length exponent. (Otherwise, the information leaked through timing could expose the secret key after many signatures; cf. Bleichenbacher's attack on DSA with biased k.) [Bodo Moeller] *) Make a new fixed-window mod_exp implementation the default for RSA, DSA, and DH private-key operations so that the sequence of squares and multiplies and the memory access pattern are independent of the particular secret key. This will mitigate cache-timing and potential related attacks. BN_mod_exp_mont_consttime() is the new exponentiation implementation, and this is automatically used by BN_mod_exp_mont() if the new flag BN_FLG_EXP_CONSTTIME is set for the exponent. RSA, DSA, and DH will use this BN flag for private exponents unless the flag 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 SSLv23_client_method() so that is uses the SSL 3.0/TLS 1.0 Client Hello message format if the SSL_OP_NO_SSLv2 option is set. (Previously, the SSL 2.0 backwards compatible Client Hello message format would be used even with SSL_OP_NO_SSLv2.) [Bodo Moeller] *) Add support for smime-type MIME parameter in S/MIME messages which some clients need. [Steve Henson] *) New function BN_MONT_CTX_set_locked() to set montgomery parameters in a threadsafe manner. Modify rsa code to use new function and add calls to dsa and dh code (which had race conditions before). [Steve Henson] *) Include the fixed error library code in the C error file definitions instead of fixing them up at runtime. This keeps the error code structures constant. [Steve Henson] 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.] *) Fixes for newer kerberos headers. NB: the casts are needed because the 'length' field is signed on one version and unsigned on another with no (?) obvious way to tell the difference, without these VC++ complains. Also the "definition" of FAR (blank) is no longer included nor is the error ENOMEM. KRB5_PRIVATE has to be set to 1 to pick up some needed definitions. [Steve Henson] *) Undo Cygwin change. [Ulf Möller] *) Added support for proxy certificates according to RFC 3820. Because they may be a security thread to unaware applications, they must be explicitely allowed in run-time. See docs/HOWTO/proxy_certificates.txt for further information. [Richard Levitte] 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 (SSL_RANDOM_VALUE - sizeof(time_t)) would be used which would result in less random data when sizeof(time_t) > 4 (some 64 bit platforms). This change has negligible security impact because: 1. Server and client random values still have 24 bytes of pseudo random data. 2. Server and client random values are sent in the clear in the initial handshake. 3. The master secret is derived using the premaster secret (48 bytes in size for static RSA ciphersuites) as well as client server and random values. The OpenSSL team would like to thank the UK NISCC for bringing this issue to our attention. [Stephen Henson, reported by UK NISCC] *) Use Windows randomness collection on Cygwin. [Ulf Möller] *) Fix hang in EGD/PRNGD query when communication socket is closed prematurely by EGD/PRNGD. [Darren Tucker via Lutz Jänicke, resolves #1014] *) Prompt for pass phrases when appropriate for PKCS12 input format. [Steve Henson] *) Back-port of selected performance improvements from development branch, as well as improved support for PowerPC platforms. [Andy Polyakov] *) Add lots of checks for memory allocation failure, error codes to indicate failure and freeing up memory if a failure occurs. [Nauticus Networks SSL Team , Steve Henson] *) Add new -passin argument to dgst. [Steve Henson] *) Perform some character comparisons of different types in X509_NAME_cmp: this is needed for some certificates that reencode DNs into UTF8Strings (in violation of RFC3280) and can't or wont issue name rollover certificates. [Steve Henson] *) Make an explicit check during certificate validation to see that the CA setting in each certificate on the chain is correct. As a 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) [Richard Levitte] 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 entries during signature checking and serial number lookup. Now the encoding is cached and the serial number sort performed under a lock. Add new STACK function sk_is_sorted(). [Steve Henson] *) Add Delta CRL to the extension code. [Steve Henson] *) Various fixes to s3_pkt.c so alerts are sent properly. [David Holmes ] *) Reduce the chances of duplicate issuer name and serial numbers (in violation of RFC3280) using the OpenSSL certificate creation utilities. This is done by creating a random 64 bit value for the initial serial number when a serial number file is created or when a self signed certificate is created using 'openssl req -x509'. The initial serial number file is created using 'openssl x509 -next_serial' in CA.pl rather than being initialized to 1. [Steve Henson] 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) [Joe Orton, Steve Henson] *) Fix flaw in SSL/TLS handshaking when using Kerberos ciphersuites (CVE-2004-0112) [Joe Orton, Steve Henson] *) Make it possible to have multiple active certificates with the same subject in the CA index file. This is done only if the keyword 'unique_subject' is set to 'no' in the main CA section (default if 'CA_default') of the configuration file. The value is saved with the database itself in a separate index attribute file, named like the index file with '.attr' appended to the name. [Richard Levitte] *) X509 verify fixes. Disable broken certificate workarounds when X509_V_FLAGS_X509_STRICT is set. Check CRL issuer has cRLSign set if keyUsage extension present. Don't accept CRLs with unhandled critical extensions: since verify currently doesn't process CRL extensions this rejects a CRL with *any* critical extensions. Add new verify error codes for these cases. [Steve Henson] *) When creating an OCSP nonce use an OCTET STRING inside the extnValue. A clarification of RFC2560 will require the use of OCTET STRINGs and some implementations cannot handle the current raw format. Since OpenSSL copies and compares OCSP nonces as opaque blobs without any attempt at parsing them this should not create any compatibility issues. [Steve Henson] *) New md flag EVP_MD_CTX_FLAG_REUSE this allows md_data to be reused when calling EVP_MD_CTX_copy_ex() to avoid calling OPENSSL_malloc(). Without this HMAC (and other) operations are several times slower than OpenSSL < 0.9.7. [Steve Henson] *) Print out GeneralizedTime and UTCTime in ASN1_STRING_print_ex(). [Peter Sylvester ] *) Use the correct content when signing type "other". [Steve Henson] Changes between 0.9.7b and 0.9.7c [30 Sep 2003] *) Fix various bugs revealed by running the NISCC test suite: Stop out of bounds reads in the ASN1 code when presented with invalid tags (CVE-2003-0543 and CVE-2003-0544). Free up ASN1_TYPE correctly if ANY type is invalid (CVE-2003-0545). 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 exiting on the first error in a request. [Steve Henson] *) In ssl3_accept() (ssl/s3_srvr.c) only accept a client certificate if the server requested one: as stated in TLS 1.0 and SSL 3.0 specifications. [Steve Henson] *) In ssl3_get_client_hello() (ssl/s3_srvr.c), tolerate additional extra data after the compression methods not only for TLS 1.0 but also for SSL 3.0 (as required by the specification). [Bodo Moeller; problem pointed out by Matthias Loepfe] *) Change X509_certificate_type() to mark the key as exported/exportable when it's 512 *bits* long, not 512 bytes. [Richard Levitte] *) Change AES_cbc_encrypt() so it outputs exact multiple of blocks during encryption. [Richard Levitte] *) Various fixes to base64 BIO and non blocking I/O. On write flushes were not handled properly if the BIO retried. On read data was not being buffered properly and had various logic bugs. This also affects blocking I/O when the data being decoded is a certain size. [Steve Henson] *) Various S/MIME bugfixes and compatibility changes: output correct application/pkcs7 MIME type if PKCS7_NOOLDMIMETYPE is set. Tolerate some broken signatures. Output CR+LF for EOL if PKCS7_CRLFEOL is set (this makes opening of files as .eml work). Correctly handle very long lines in MIME parser. [Steve Henson] 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 a protocol version number mismatch like a decryption error in ssl3_get_client_key_exchange (ssl/s3_srvr.c). [Bodo Moeller] *) Turn on RSA blinding by default in the default implementation to avoid a timing attack. Applications that don't want it can call RSA_blinding_off() or use the new flag RSA_FLAG_NO_BLINDING. They would be ill-advised to do so in most cases. [Ben Laurie, Steve Henson, Geoff Thorpe, Bodo Moeller] *) Change RSA blinding code so that it works when the PRNG is not seeded (in this case, the secret RSA exponent is abused as an unpredictable seed -- if it is not unpredictable, there is no point in blinding anyway). Make RSA blinding thread-safe by remembering the creator's thread ID in rsa->blinding and having all other threads use local one-time blinding factors (this requires more computation than sharing rsa->blinding, but avoids excessive locking; and if an RSA object is not shared between threads, blinding will still be very fast). [Bodo Moeller] *) Fixed a typo bug that would cause ENGINE_set_default() to set an ENGINE as defaults for all supported algorithms irrespective of the 'flags' parameter. 'flags' is now honoured, so applications should make sure they are passing it correctly. [Geoff Thorpe] *) Target "mingw" now allows native Windows code to be generated in the Cygwin environment as well as with the MinGW compiler. [Ulf Moeller] 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 incorrrect block cipher padding has been found. This is a countermeasure against active attacks where the attacker has to distinguish between bad padding and a MAC verification error. (CVE-2003-0078) [Bodo Moeller; problem pointed out by Brice Canvel (EPFL), Alain Hiltgen (UBS), Serge Vaudenay (EPFL), and Martin Vuagnoux (EPFL, Ilion)] *) Make the no-err option work as intended. The intention with no-err is not to have the whole error stack handling routines removed from libcrypto, it's only intended to remove all the function name and reason texts, thereby removing some of the footprint that may not be interesting if those errors aren't displayed anyway. NOTE: it's still possible for any application or module to have it's own set of error texts inserted. The routines are there, just not used by default when no-err is given. [Richard Levitte] *) Add support for FreeBSD on IA64. [dirk.meyer@dinoex.sub.org via Richard Levitte, resolves #454] *) Adjust DES_cbc_cksum() so it returns the same value as the MIT Kerberos function mit_des_cbc_cksum(). Before this change, the value returned by DES_cbc_cksum() was like the one from mit_des_cbc_cksum(), except the bytes were swapped. [Kevin Greaney and Richard Levitte] *) Allow an application to disable the automatic SSL chain building. Before this a rather primitive chain build was always performed in ssl3_output_cert_chain(): an application had no way to send the correct chain if the automatic operation produced an incorrect result. Now the chain builder is disabled if either: 1. Extra certificates are added via SSL_CTX_add_extra_chain_cert(). 2. The mode flag SSL_MODE_NO_AUTO_CHAIN is set. The reasoning behind this is that an application would not want the auto chain building to take place if extra chain certificates are present and it might also want a means of sending no additional certificates (for example the chain has two certificates and the root is omitted). [Steve Henson] *) Add the possibility to build without the ENGINE framework. [Steven Reddie via Richard Levitte] *) Under Win32 gmtime() can return NULL: check return value in OPENSSL_gmtime(). Add error code for case where gmtime() fails. [Steve Henson] *) DSA routines: under certain error conditions uninitialized BN objects could be freed. Solution: make sure initialization is performed early enough. (Reported and fix supplied by Ivan D Nestlerode , Nils Larsch via PR#459) [Lutz Jaenicke] *) Another fix for SSLv2 session ID handling: the session ID was incorrectly checked on reconnect on the client side, therefore session resumption could still fail with a "ssl session id is different" error. This behaviour is masked when SSL_OP_ALL is used due to SSL_OP_MICROSOFT_SESS_ID_BUG being set. Behaviour observed by Crispin Flowerday as followup to PR #377. [Lutz Jaenicke] *) IA-32 assembler support enhancements: unified ELF targets, support for SCO/Caldera platforms, fix for Cygwin shared build. [Andy Polyakov] *) Add support for FreeBSD on sparc64. As a consequence, support for FreeBSD on non-x86 processors is separate from x86 processors on the config script, much like the NetBSD support. [Richard Levitte & Kris Kennaway ] 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.] *) Fix session ID handling in SSLv2 client code: the SERVER FINISHED code (06) was taken as the first octet of the session ID and the last octet was ignored consequently. As a result SSLv2 client side session caching could not have worked due to the session ID mismatch between client and server. Behaviour observed by Crispin Flowerday as PR #377. [Lutz Jaenicke] *) Change the declaration of needed Kerberos libraries to use EX_LIBS instead of the special (and badly supported) LIBKRB5. LIBKRB5 is removed entirely. [Richard Levitte] *) The hw_ncipher.c engine requires dynamic locks. Unfortunately, it seems that in spite of existing for more than a year, many application author have done nothing to provide the necessary callbacks, which means that this particular engine will not work properly anywhere. This is a very unfortunate situation which forces us, in the name of usability, to give the hw_ncipher.c a static lock, which is part of libcrypto. NOTE: This is for the 0.9.7 series ONLY. This hack will never appear in 0.9.8 or later. We EXPECT application authors to have dealt properly with this when 0.9.8 is released (unless we actually make such changes in the libcrypto locking code that changes will have to be made anyway). [Richard Levitte] *) In asn1_d2i_read_bio() repeatedly call BIO_read() until all content octets have been read, EOF or an error occurs. Without this change some truncated ASN1 structures will not produce an error. [Steve Henson] *) Disable Heimdal support, since it hasn't been fully implemented. Still give the possibility to force the use of Heimdal, but with warnings and a request that patches get sent to openssl-dev. [Richard Levitte] *) Add the VC-CE target, introduce the WINCE sysname, and add INSTALL.WCE and appropriate conditionals to make it build. [Steven Reddie via Richard Levitte] *) Change the DLL names for Cygwin to cygcrypto-x.y.z.dll and cygssl-x.y.z.dll, where x, y and z are the major, minor and edit numbers of the version. [Corinna Vinschen and Richard Levitte] *) Introduce safe string copy and catenation functions (BUF_strlcpy() and BUF_strlcat()). [Ben Laurie (CHATS) and Richard Levitte] *) Avoid using fixed-size buffers for one-line DNs. [Ben Laurie (CHATS)] *) Add BUF_MEM_grow_clean() to avoid information leakage when resizing buffers containing secrets, and use where appropriate. [Ben Laurie (CHATS)] *) Avoid using fixed size buffers for configuration file location. [Ben Laurie (CHATS)] *) Avoid filename truncation for various CA files. [Ben Laurie (CHATS)] *) Use sizeof in preference to magic numbers. [Ben Laurie (CHATS)] *) Avoid filename truncation in cert requests. [Ben Laurie (CHATS)] *) Add assertions to check for (supposedly impossible) buffer overflows. [Ben Laurie (CHATS)] *) Don't cache truncated DNS entries in the local cache (this could potentially lead to a spoofing attack). [Ben Laurie (CHATS)] *) Fix various buffers to be large enough for hex/decimal representations in a platform independent manner. [Ben Laurie (CHATS)] *) Add CRYPTO_realloc_clean() to avoid information leakage when resizing buffers containing secrets, and use where appropriate. [Ben Laurie (CHATS)] *) Add BIO_indent() to avoid much slightly worrying code to do indents. [Ben Laurie (CHATS)] *) Convert sprintf()/BIO_puts() to BIO_printf(). [Ben Laurie (CHATS)] *) buffer_gets() could terminate with the buffer only half full. Fixed. [Ben Laurie (CHATS)] *) Add assertions to prevent user-supplied crypto functions from overflowing internal buffers by having large block sizes, etc. [Ben Laurie (CHATS)] *) New OPENSSL_assert() macro (similar to assert(), but enabled unconditionally). [Ben Laurie (CHATS)] *) Eliminate unused copy of key in RC4. [Ben Laurie (CHATS)] *) Eliminate unused and incorrectly sized buffers for IV in pem.h. [Ben Laurie (CHATS)] *) Fix off-by-one error in EGD path. [Ben Laurie (CHATS)] *) If RANDFILE path is too long, ignore instead of truncating. [Ben Laurie (CHATS)] *) Eliminate unused and incorrectly sized X.509 structure CBCParameter. [Ben Laurie (CHATS)] *) Eliminate unused and dangerous function knumber(). [Ben Laurie (CHATS)] *) Eliminate unused and dangerous structure, KSSL_ERR. [Ben Laurie (CHATS)] *) Protect against overlong session ID context length in an encoded session object. Since these are local, this does not appear to be exploitable. [Ben Laurie (CHATS)] *) Change from security patch (see 0.9.6e below) that did not affect the 0.9.6 release series: Remote buffer overflow in SSL3 protocol - an attacker could supply an oversized master key in Kerberos-enabled versions. (CVE-2002-0657) [Ben Laurie (CHATS)] *) Change the SSL kerb5 codes to match RFC 2712. [Richard Levitte] *) Make -nameopt work fully for req and add -reqopt switch. [Michael Bell , Steve Henson] *) The "block size" for block ciphers in CFB and OFB mode should be 1. [Steve Henson, reported by Yngve Nysaeter Pettersen ] *) Make sure tests can be performed even if the corresponding algorithms have been removed entirely. This was also the last step to make OpenSSL compilable with DJGPP under all reasonable conditions. [Richard Levitte, Doug Kaufman ] *) Add cipher selection rules COMPLEMENTOFALL and COMPLEMENTOFDEFAULT to allow version independent disabling of normally unselected ciphers, which may be activated as a side-effect of selecting a single cipher. (E.g., cipher list string "RSA" enables ciphersuites that are left out of "ALL" because they do not provide symmetric encryption. "RSA:!COMPLEMEMENTOFALL" avoids these unsafe ciphersuites.) [Lutz Jaenicke, Bodo Moeller] *) Add appropriate support for separate platform-dependent build directories. The recommended way to make a platform-dependent build directory is the following (tested on Linux), maybe with some local tweaks: # Place yourself outside of the OpenSSL source tree. In # this example, the environment variable OPENSSL_SOURCE # is assumed to contain the absolute OpenSSL source directory. mkdir -p objtree/"`uname -s`-`uname -r`-`uname -m`" cd objtree/"`uname -s`-`uname -r`-`uname -m`" (cd $OPENSSL_SOURCE; find . -type f) | while read F; do mkdir -p `dirname $F` ln -s $OPENSSL_SOURCE/$F $F done To be absolutely sure not to disturb the source tree, a "make clean" is a good thing. If it isn't successfull, don't worry about it, it probably means the source directory is very clean. [Richard Levitte] *) Make sure any ENGINE control commands make local copies of string pointers passed to them whenever necessary. Otherwise it is possible the caller may have overwritten (or deallocated) the original string data when a later ENGINE operation tries to use the stored values. [Götz Babin-Ebell ] *) Improve diagnostics in file reading and command-line digests. [Ben Laurie aided and abetted by Solar Designer ] *) Add AES modes CFB and OFB to the object database. Correct an error in AES-CFB decryption. [Richard Levitte] *) 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 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. [Steve Henson] *) Check the values of dna and dnb in bn_mul_recursive before calling bn_mul_comba (a non zero value means the a or b arrays do not contain n2 elements) and fallback to bn_mul_normal if either is not zero. [Steve Henson] *) Fix escaping of non-ASCII characters when using the -subj option of the "openssl req" command line tool. (Robert Joop ) [Lutz Jaenicke] *) Make object definitions compliant to LDAP (RFC2256): SN is the short form for "surname", serialNumber has no short form. Use "mail" as the short name for "rfc822Mailbox" according to RFC2798; therefore remove "mail" short name for "internet 7". The OID for unique identifiers in X509 certificates is x500UniqueIdentifier, not uniqueIdentifier. Some more OID additions. (Michael Bell ) [Lutz Jaenicke] *) Add an "init" command to the ENGINE config module and auto initialize ENGINEs. Without any "init" command the ENGINE will be initialized after all ctrl commands have been executed on it. If init=1 the ENGINE is initailized at that point (ctrls before that point are run on the uninitialized ENGINE and after on the initialized one). If init=0 then the ENGINE will not be iniatialized at all. [Steve Henson] *) Fix the 'app_verify_callback' interface so that the user-defined argument is actually passed to the callback: In the SSL_CTX_set_cert_verify_callback() prototype, the callback declaration has been changed from int (*cb)() into int (*cb)(X509_STORE_CTX *,void *); in ssl_verify_cert_chain (ssl/ssl_cert.c), the call i=s->ctx->app_verify_callback(&ctx) has been changed into i=s->ctx->app_verify_callback(&ctx, s->ctx->app_verify_arg). To update applications using SSL_CTX_set_cert_verify_callback(), a dummy argument can be added to their callback functions. [D. K. Smetters ] *) Added the '4758cca' ENGINE to support IBM 4758 cards. [Maurice Gittens , touchups by Geoff Thorpe] *) Add and OPENSSL_LOAD_CONF define which will cause OpenSSL_add_all_algorithms() to load the openssl.cnf config file. This allows older applications to transparently support certain OpenSSL features: such as crypto acceleration and dynamic ENGINE loading. Two new functions OPENSSL_add_all_algorithms_noconf() which will never load the config file and OPENSSL_add_all_algorithms_conf() which will always load it have also been added. [Steve Henson] *) Add the OFB, CFB and CTR (all with 128 bit feedback) to AES. Adjust NIDs and EVP layer. [Stephen Sprunk and Richard Levitte] *) Config modules support in openssl utility. Most commands now load modules from the config file, though in a few (such as version) this isn't done because it couldn't be used for anything. In the case of ca and req the config file used is the same as the utility itself: that is the -config command line option can be used to specify an alternative file. [Steve Henson] *) Move default behaviour from OPENSSL_config(). If appname is NULL use "openssl_conf" if filename is NULL use default openssl config file. [Steve Henson] *) Add an argument to OPENSSL_config() to allow the use of an alternative config section name. Add a new flag to tolerate a missing config file and move code to CONF_modules_load_file(). [Steve Henson] *) Support for crypto accelerator cards from Accelerated Encryption Processing, www.aep.ie. (Use engine 'aep') The support was copied from 0.9.6c [engine] and adapted/corrected to work with the new engine framework. [AEP Inc. and Richard Levitte] *) Support for SureWare crypto accelerator cards from Baltimore Technologies. (Use engine 'sureware') The support was copied from 0.9.6c [engine] and adapted to work with the new engine framework. [Richard Levitte] *) Have the CHIL engine fork-safe (as defined by nCipher) and actually make the newer ENGINE framework commands for the CHIL engine work. [Toomas Kiisk and Richard Levitte] *) Make it possible to produce shared libraries on ReliantUNIX. [Robert Dahlem via Richard Levitte] *) Add the configuration target debug-linux-ppro. Make 'openssl rsa' use the general key loading routines implemented in apps.c, and make those routines able to handle the key format FORMAT_NETSCAPE and the variant FORMAT_IISSGC. [Toomas Kiisk via Richard Levitte] *) Fix a crashbug and a logic bug in hwcrhk_load_pubkey(). [Toomas Kiisk via Richard Levitte] *) Add -keyform to rsautl, and document -engine. [Richard Levitte, inspired by Toomas Kiisk ] *) Change BIO_new_file (crypto/bio/bss_file.c) to use new BIO_R_NO_SUCH_FILE error code rather than the generic ERR_R_SYS_LIB error code if fopen() fails with ENOENT. [Ben Laurie] *) Add new functions ERR_peek_last_error ERR_peek_last_error_line ERR_peek_last_error_line_data. These are similar to ERR_peek_error ERR_peek_error_line ERR_peek_error_line_data, but report on the latest error recorded rather than the first one still in the error queue. [Ben Laurie, Bodo Moeller] *) default_algorithms option in ENGINE config module. This allows things like: default_algorithms = ALL default_algorithms = RSA, DSA, RAND, CIPHERS, DIGESTS [Steve Henson] *) Prelminary ENGINE config module. [Steve Henson] *) New experimental application configuration code. [Steve Henson] *) Change the AES code to follow the same name structure as all other symmetric ciphers, and behave the same way. Move everything to the directory crypto/aes, thereby obsoleting crypto/rijndael. [Stephen Sprunk and Richard Levitte] *) SECURITY: remove unsafe setjmp/signal interaction from ui_openssl.c. [Ben Laurie and Theo de Raadt] *) Add option to output public keys in req command. [Massimiliano Pala madwolf@openca.org] *) Use wNAFs in EC_POINTs_mul() for improved efficiency (up to about 10% better than before for P-192 and P-224). [Bodo Moeller] *) New functions/macros SSL_CTX_set_msg_callback(ctx, cb) SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_set_msg_callback(ssl, cb) SSL_set_msg_callback_arg(ssl, arg) to request calling a callback function void cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg) whenever a protocol message has been completely received (write_p == 0) or sent (write_p == 1). Here 'version' is the protocol version according to which the SSL library interprets the current protocol message (SSL2_VERSION, SSL3_VERSION, or TLS1_VERSION). 'content_type' is 0 in the case of SSL 2.0, or the content type as defined in the SSL 3.0/TLS 1.0 protocol specification (change_cipher_spec(20), alert(21), handshake(22)). 'buf' and 'len' point to the actual message, 'ssl' to the SSL object, and 'arg' is the application-defined value set by SSL[_CTX]_set_msg_callback_arg(). 'openssl s_client' and 'openssl s_server' have new '-msg' options to enable a callback that displays all protocol messages. [Bodo Moeller] *) Change the shared library support so shared libraries are built as soon as the corresponding static library is finished, and thereby get openssl and the test programs linked against the shared library. This still only happens when the keyword "shard" has been given to the configuration scripts. NOTE: shared library support is still an experimental thing, and backward binary compatibility is still not guaranteed. ["Maciej W. Rozycki" and Richard Levitte] *) Add support for Subject Information Access extension. [Peter Sylvester ] *) Make BUF_MEM_grow() behaviour more consistent: Initialise to zero additional bytes when new memory had to be allocated, not just when reusing an existing buffer. [Bodo Moeller] *) New command line and configuration option 'utf8' for the req command. This allows field values to be specified as UTF8 strings. [Steve Henson] *) Add -multi and -mr options to "openssl speed" - giving multiple parallel runs for the former and machine-readable output for the latter. [Ben Laurie] *) Add '-noemailDN' option to 'openssl ca'. This prevents inclusion of the e-mail address in the DN (i.e., it will go into a certificate extension only). The new configuration file option 'email_in_dn = no' has the same effect. [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 compatibility is desired. If OpenSSL 0.9.6c compatibility is desired, the des_* symbols will be mapped to DES_*, with one exception. Since we provide two compatibility mappings, the user needs to define the macro OPENSSL_DES_LIBDES_COMPATIBILITY if libdes compatibility is desired. The default (i.e., when that macro isn't defined) is OpenSSL 0.9.6c compatibility. There are also macros that enable and disable the support of old des functions altogether. Those are OPENSSL_ENABLE_OLD_DES_SUPPORT and OPENSSL_DISABLE_OLD_DES_SUPPORT. If none or both of those are defined, the default will apply: to support the old des routines. In either case, one must include openssl/des.h to get the correct definitions. Do not try to just include openssl/des_old.h, that 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 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. [Richard Levitte] *) Test for certificates which contain unsupported critical extensions. If such a certificate is found during a verify operation it is rejected by default: this behaviour can be overridden by either handling the new error X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION or by setting the verify flag X509_V_FLAG_IGNORE_CRITICAL. A new function X509_supported_extension() has also been added which returns 1 if a particular extension is supported. [Steve Henson] *) Modify the behaviour of EVP cipher functions in similar way to digests to retain compatibility with existing code. [Steve Henson] *) Modify the behaviour of EVP_DigestInit() and EVP_DigestFinal() to retain compatibility with existing code. In particular the 'ctx' parameter does not have to be to be initialized before the call to EVP_DigestInit() and it is tidied up after a call to EVP_DigestFinal(). New function EVP_DigestFinal_ex() which does not tidy up the ctx. Similarly function EVP_MD_CTX_copy() changed to not require the destination to be initialized valid and new function EVP_MD_CTX_copy_ex() added which requires the destination to be valid. Modify all the OpenSSL digest calls to use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex(). [Steve Henson] *) Change ssl3_get_message (ssl/s3_both.c) and the functions using it so that complete 'Handshake' protocol structures are kept in memory instead of overwriting 'msg_type' and 'length' with 'body' data. [Bodo Moeller] *) Add an implementation of SSL_add_dir_cert_subjects_to_stack for Win32. [Massimo Santin via Richard Levitte] *) Major restructuring to the underlying ENGINE code. This includes reduction of linker bloat, separation of pure "ENGINE" manipulation (initialisation, etc) from functionality dealing with implementations of specific crypto iterfaces. This change also introduces integrated support for symmetric ciphers and digest implementations - so ENGINEs can now accelerate these by providing EVP_CIPHER and EVP_MD implementations of their own. This is detailed in crypto/engine/README as it couldn't be adequately described here. However, there are a few API changes worth noting - some RSA, DSA, DH, and RAND functions that were changed in the original introduction of ENGINE code have now reverted back - the hooking from this code to ENGINE is now a good 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 - 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, ENGINE_cpy() has been removed as it cannot be consistently defined in the new code. [Geoff Thorpe] *) Change ASN1_GENERALIZEDTIME_check() to allow fractional seconds. [Steve Henson] *) Change mkdef.pl to sort symbols that get the same entry number, and make sure the automatically generated functions ERR_load_* become part of libeay.num as well. [Richard Levitte] *) New function SSL_renegotiate_pending(). This returns true once renegotiation has been requested (either SSL_renegotiate() call or HelloRequest/ClientHello receveived from the peer) and becomes false once a handshake has been completed. (For servers, SSL_renegotiate() followed by SSL_do_handshake() sends a HelloRequest, but does not ensure that a handshake takes place. SSL_renegotiate_pending() is useful for checking if the client has followed the request.) [Bodo Moeller] *) New SSL option SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION. By default, clients may request session resumption even during renegotiation (if session ID contexts permit); with this option, session resumption is possible only in the first handshake. SSL_OP_ALL is now 0x00000FFFL instead of 0x000FFFFFL. This makes more bits available for options that should not be part of SSL_OP_ALL (such as SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION). [Bodo Moeller] *) Add some demos for certificate and certificate request creation. [Steve Henson] *) Make maximum certificate chain size accepted from the peer application settable (SSL*_get/set_max_cert_list()), as proposed by "Douglas E. Engert" . [Lutz Jaenicke] *) Add support for shared libraries for Unixware-7 (Boyd Lynn Gerber ). [Lutz Jaenicke] *) Add a "destroy" handler to ENGINEs that allows structural cleanup to be done prior to destruction. Use this to unload error strings from ENGINEs that load their own error strings. NB: This adds two new API functions to "get" and "set" this destroy handler in an ENGINE. [Geoff Thorpe] *) Alter all existing ENGINE implementations (except "openssl" and "openbsd") to dynamically instantiate their own error strings. This makes them more flexible to be built both as statically-linked ENGINEs and self-contained shared-libraries loadable via the "dynamic" ENGINE. Also, add stub code to each that makes building them as self-contained shared-libraries easier (see README.ENGINE). [Geoff Thorpe] *) Add a "dynamic" ENGINE that provides a mechanism for binding ENGINE implementations into applications that are completely implemented in self-contained shared-libraries. The "dynamic" ENGINE exposes control commands that can be used to configure what shared-library to load and to control aspects of the way it is handled. Also, made an update to the README.ENGINE file that brings its information up-to-date and provides some information and instructions on the "dynamic" ENGINE (ie. how to use it, how to build "dynamic"-loadable ENGINEs, etc). [Geoff Thorpe] *) Make it possible to unload ranges of ERR strings with a new "ERR_unload_strings" function. [Geoff Thorpe] *) Add a copy() function to EVP_MD. [Ben Laurie] *) Make EVP_MD routines take a context pointer instead of just the md_data void pointer. [Ben Laurie] *) Add flags to EVP_MD and EVP_MD_CTX. EVP_MD_FLAG_ONESHOT indicates that the digest can only process a single chunk of data (typically because it is provided by a piece of hardware). EVP_MD_CTX_FLAG_ONESHOT indicates that the application is only going to provide a single chunk of data, and hence the framework needn't accumulate the data for oneshot drivers. [Ben Laurie] *) As with "ERR", make it possible to replace the underlying "ex_data" functions. This change also alters the storage and management of global ex_data state - it's now all inside ex_data.c and all "class" code (eg. RSA, BIO, SSL_CTX, etc) no longer stores its own STACKS and per-class index counters. The API functions that use this state have been changed to take a "class_index" rather than pointers to the class's local STACK and counter, and there is now an API function to dynamically create new classes. This centralisation allows us to (a) plug a lot of the thread-safety problems that existed, and (b) makes it possible to clean up all allocated state using "CRYPTO_cleanup_all_ex_data()". W.r.t. (b) such data would previously have always leaked in application code and workarounds were in place to make the memory debugging turn a blind eye to it. Application code that doesn't use this new function will still leak as before, but their memory debugging output will announce it now rather than letting it slide. Besides the addition of CRYPTO_cleanup_all_ex_data(), another API change induced by the "ex_data" overhaul is that X509_STORE_CTX_init() now has a return value to indicate success or failure. [Geoff Thorpe] *) Make it possible to replace the underlying "ERR" functions such that the global state (2 LHASH tables and 2 locks) is only used by the "default" implementation. This change also adds two functions to "get" and "set" the implementation prior to it being automatically set the first time any other ERR function takes place. Ie. an application can call "get", pass the return value to a module it has just loaded, and that module can call its own "set" function using that value. This means the module's "ERR" operations will use (and modify) the error state in the application and not in its own statically linked copy of OpenSSL code. [Geoff Thorpe] *) 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 to use these functions rather than manually incrementing the counts. Also rename "DSO_up()" function to more descriptive "DSO_up_ref()". [Geoff Thorpe] *) Add EVP test program. [Ben Laurie] *) Add symmetric cipher support to ENGINE. Expect the API to change! [Ben Laurie] *) New CRL functions: X509_CRL_set_version(), X509_CRL_set_issuer_name() X509_CRL_set_lastUpdate(), X509_CRL_set_nextUpdate(), X509_CRL_sort(), X509_REVOKED_set_serialNumber(), and X509_REVOKED_set_revocationDate(). These allow a CRL to be built without having to access X509_CRL fields directly. Modify 'ca' application to use new functions. [Steve Henson] *) Move SSL_OP_TLS_ROLLBACK_BUG out of the SSL_OP_ALL list of recommended bug workarounds. Rollback attack detection is a security feature. The problem will only arise on OpenSSL servers when TLSv1 is not available (sslv3_server_method() or SSL_OP_NO_TLSv1). Software authors not wanting to support TLSv1 will have special reasons for their choice and can explicitly enable this option. [Bodo Moeller, Lutz Jaenicke] *) Rationalise EVP so it can be extended: don't include a union of cipher/digest structures, add init/cleanup functions for EVP_MD_CTX (similar to those existing for EVP_CIPHER_CTX). Usage example: EVP_MD_CTX md; EVP_MD_CTX_init(&md); /* new function call */ EVP_DigestInit(&md, EVP_sha1()); EVP_DigestUpdate(&md, in, len); 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 correcting its structure. This means that calls to DES functions now have to pass a pointer to a des_key_schedule instead of a plain des_key_schedule (which was actually always a pointer anyway): E.g., des_key_schedule ks; des_set_key_checked(..., &ks); des_ncbc_encrypt(..., &ks, ...); (Note that a later change renames 'des_...' into 'DES_...'.) [Ben Laurie] *) Initial reduction of linker bloat: the use of some functions, such as PEM causes large amounts of unused functions to be linked in due to poor organisation. For example pem_all.c contains every PEM function which has a knock on effect of linking in large amounts of (unused) ASN1 code. Grouping together similar functions and splitting unrelated functions prevents this. [Steve Henson] *) Cleanup of EVP macros. [Ben Laurie] *) Change historical references to {NID,SN,LN}_des_ede and ede3 to add the correct _ecb suffix. [Ben Laurie] *) Add initial OCSP responder support to ocsp application. The revocation information is handled using the text based index use by the ca application. The responder can either handle requests generated internally, supplied in files (for example via a CGI script) or using an internal minimal server. [Steve Henson] *) Add configuration choices to get zlib compression for TLS. [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 ] 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 , Jeffrey Altman 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' values for each of the key sizes rather than having just parameters (and 'speed' generating keys each time). [Geoff Thorpe] *) Speed up EVP routines. Before: encrypt type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes des-cbc 4408.85k 5560.51k 5778.46k 5862.20k 5825.16k des-cbc 4389.55k 5571.17k 5792.23k 5846.91k 5832.11k des-cbc 4394.32k 5575.92k 5807.44k 5848.37k 5841.30k decrypt des-cbc 3482.66k 5069.49k 5496.39k 5614.16k 5639.28k des-cbc 3480.74k 5068.76k 5510.34k 5609.87k 5635.52k des-cbc 3483.72k 5067.62k 5504.60k 5708.01k 5724.80k After: encrypt des-cbc 4660.16k 5650.19k 5807.19k 5827.13k 5783.32k decrypt des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k [Ben Laurie] *) Added the OS2-EMX target. ["Brian Havard" and Richard Levitte] *) Rewrite apps to use NCONF routines instead of the old CONF. New functions to support NCONF routines in extension code. New function CONF_set_nconf() to allow functions which take an NCONF to also handle the old LHASH structure: this means that the old CONF compatible routines can be retained (in particular wrt extensions) without having to duplicate the code. New function X509V3_add_ext_nconf_sk to add extensions to a stack. [Steve Henson] *) Enhance the general user interface with mechanisms for inner control and with possibilities to have yes/no kind of prompts. [Richard Levitte] *) Change all calls to low level digest routines in the library and applications to use EVP. Add missing calls to HMAC_cleanup() and don't assume HMAC_CTX can be copied using memcpy(). [Verdon Walker , Steve Henson] *) Add the possibility to control engines through control names but with arbitrary arguments instead of just a string. Change the key loaders to take a UI_METHOD instead of a callback function pointer. NOTE: this breaks binary compatibility with earlier versions of OpenSSL [engine]. Adapt the nCipher code for these new conditions and add a card insertion callback. [Richard Levitte] *) Enhance the general user interface with mechanisms to better support dialog box interfaces, application-defined prompts, the possibility to use defaults (for example default passwords from somewhere else) and interrupts/cancellations. [Richard Levitte] *) Tidy up PKCS#12 attribute handling. Add support for the CSP name attribute in PKCS#12 files, add new -CSP option to pkcs12 utility. [Steve Henson] *) Fix a memory leak in 'sk_dup()' in the case reallocation fails. (Also tidy up some unnecessarily weird code in 'sk_new()'). [Geoff, reported by Diego Tartara ] *) Change the key loading routines for ENGINEs to use the same kind callback (pem_password_cb) as all other routines that need this kind of callback. [Richard Levitte] *) Increase ENTROPY_NEEDED to 32 bytes, as Rijndael can operate with 256 bit (=32 byte) keys. Of course seeding with more entropy bytes than this minimum value is recommended. [Lutz Jaenicke] *) New random seeder for OpenVMS, using the system process statistics that are easily reachable. [Richard Levitte] *) Windows apparently can't transparently handle global variables defined in DLLs. Initialisations such as: const ASN1_ITEM *it = &ASN1_INTEGER_it; wont compile. This is used by the any applications that need to declare their own ASN1 modules. This was fixed by adding the option EXPORT_VAR_AS_FN to all Win32 platforms, although this isn't strictly needed for static libraries under Win32. [Steve Henson] *) New functions X509_PURPOSE_set() and X509_TRUST_set() to handle setting of purpose and trust fields. New X509_STORE trust and purpose functions and tidy up setting in other SSL functions. [Steve Henson] *) Add copies of X509_STORE_CTX fields and callbacks to X509_STORE structure. These are inherited by X509_STORE_CTX when it is initialised. This allows various defaults to be set in the X509_STORE structure (such as flags for CRL checking and custom purpose or trust settings) for functions which only use X509_STORE_CTX internally such as S/MIME. Modify X509_STORE_CTX_purpose_inherit() so it only sets purposes and trust settings if they are not set in X509_STORE. This allows X509_STORE purposes and trust (in S/MIME for example) to override any set by default. Add command line options for CRL checking to smime, s_client and s_server applications. [Steve Henson] *) Initial CRL based revocation checking. If the CRL checking flag(s) are set then the CRL is looked up in the X509_STORE structure and its validity and signature checked, then if the certificate is found in the CRL the verify fails with a revoked error. Various new CRL related callbacks added to X509_STORE_CTX structure. Command line options added to 'verify' application to support this. This needs some additional work, such as being able to handle multiple CRLs with different times, extension based lookup (rather than just by subject name) and ultimately more complete V2 CRL extension handling. [Steve Henson] *) Add a general user interface API (crypto/ui/). This is designed to replace things like des_read_password and friends (backward compatibility functions using this new API are provided). The purpose is to remove prompting functions from the DES code section as well as provide for prompting through dialog boxes in a window system and the like. [Richard Levitte] *) Add "ex_data" support to ENGINE so implementations can add state at a per-structure level rather than having to store it globally. [Geoff] *) Make it possible for ENGINE structures to be copied when retrieved by ENGINE_by_id() if the ENGINE specifies a new flag: ENGINE_FLAGS_BY_ID_COPY. This causes the "original" ENGINE structure to act like a template, analogous to the RSA vs. RSA_METHOD type of separation. Because of this operational state can be localised to each ENGINE structure, despite the fact they all share the same "methods". New ENGINE structures returned in this case have no functional references and the return value is the single structural reference. This matches the single structural reference returned by ENGINE_by_id() normally, when it is incremented on the pre-existing ENGINE structure. [Geoff] *) Fix ASN1 decoder when decoding type ANY and V_ASN1_OTHER: since this needs to match any other type at all we need to manually clear the tag cache. [Steve Henson] *) Changes to the "openssl engine" utility to include; - verbosity levels ('-v', '-vv', and '-vvv') that provide information about an ENGINE's available control commands. - executing control commands from command line arguments using the '-pre' and '-post' switches. '-post' is only used if '-t' is specified and the ENGINE is successfully initialised. The syntax for the individual commands are colon-separated, for example; openssl engine chil -pre FORK_CHECK:0 -pre SO_PATH:/lib/test.so [Geoff] *) New dynamic control command support for ENGINEs. ENGINEs can now declare their own commands (numbers), names (strings), descriptions, and input types for run-time discovery by calling applications. A subset of these commands are implicitly classed as "executable" depending on their input type, and only these can be invoked through the new string-based API function ENGINE_ctrl_cmd_string(). (Eg. this can be based on user input, config files, etc). The distinction is that "executable" commands cannot return anything other than a boolean result and can only support numeric or string input, whereas some discoverable commands may only be for direct use through ENGINE_ctrl(), eg. supporting the exchange of binary data, function pointers, or other custom uses. The "executable" commands are to support parameterisations of ENGINE behaviour that can be unambiguously defined by ENGINEs and used consistently across any OpenSSL-based application. Commands have been added to all the existing hardware-supporting ENGINEs, noticeably "SO_PATH" to allow control over shared-library paths without source code alterations. [Geoff] *) Changed all ENGINE implementations to dynamically allocate their ENGINEs rather than declaring them statically. Apart from this being necessary with the removal of the ENGINE_FLAGS_MALLOCED distinction, this also allows the implementations to compile without using the internal engine_int.h header. [Geoff] *) Minor adjustment to "rand" code. RAND_get_rand_method() now returns a 'const' value. Any code that should be able to modify a RAND_METHOD should already have non-const pointers to it (ie. they should only modify their own ones). [Geoff] *) Made a variety of little tweaks to the ENGINE code. - "atalla" and "ubsec" string definitions were moved from header files to C code. "nuron" string definitions were placed in variables rather than hard-coded - allowing parameterisation of these values later on via ctrl() commands. - Removed unused "#if 0"'d code. - Fixed engine list iteration code so it uses ENGINE_free() to release structural references. - Constified the RAND_METHOD element of ENGINE structures. - Constified various get/set functions as appropriate and added missing functions (including a catch-all ENGINE_cpy that duplicates all ENGINE values onto a new ENGINE except reference counts/state). - Removed NULL parameter checks in get/set functions. Setting a method or function to NULL is a way of cancelling out a previously set value. Passing a NULL ENGINE parameter is just plain stupid anyway and doesn't justify the extra error symbols and code. - Deprecate the ENGINE_FLAGS_MALLOCED define and move the area for flags from engine_int.h to engine.h. - Changed prototypes for ENGINE handler functions (init(), finish(), ctrl(), key-load functions, etc) to take an (ENGINE*) parameter. [Geoff] *) Implement binary inversion algorithm for BN_mod_inverse in addition to the algorithm using long division. The binary algorithm can be used only if the modulus is odd. On 32-bit systems, it is faster only for relatively small moduli (roughly 20-30% for 128-bit moduli, roughly 5-15% for 256-bit moduli), so we use it only for moduli up to 450 bits. In 64-bit environments, the binary algorithm appears to be advantageous for much longer moduli; here we use it for moduli up to 2048 bits. [Bodo Moeller] *) Rewrite CHOICE field setting in ASN1_item_ex_d2i(). The old code could not support the combine flag in choice fields. [Steve Henson] *) Add a 'copy_extensions' option to the 'ca' utility. This copies extensions from a certificate request to the certificate. [Steve Henson] *) Allow multiple 'certopt' and 'nameopt' options to be separated by commas. Add 'namopt' and 'certopt' options to the 'ca' config file: this allows the display of the certificate about to be signed to be customised, to allow certain fields to be included or excluded and extension details. The old system didn't display multicharacter strings properly, omitted fields not in the policy and couldn't display additional details such as extensions. [Steve Henson] *) Function EC_POINTs_mul for multiple scalar multiplication of an arbitrary number of elliptic curve points \sum scalars[i]*points[i], optionally including the generator defined for the EC_GROUP: scalar*generator + \sum scalars[i]*points[i]. EC_POINT_mul is a simple wrapper function for the typical case that the point list has just one item (besides the optional generator). [Bodo Moeller] *) First EC_METHODs for curves over GF(p): EC_GFp_simple_method() uses the basic BN_mod_mul and BN_mod_sqr operations and provides various method functions that can also operate with faster implementations of modular arithmetic. EC_GFp_mont_method() reuses most functions that are part of EC_GFp_simple_method, but uses Montgomery arithmetic. [Bodo Moeller; point addition and point doubling implementation directly derived from source code provided by Lenka Fibikova ] *) Framework for elliptic curves (crypto/ec/ec.h, crypto/ec/ec_lcl.h, crypto/ec/ec_lib.c): Curves are EC_GROUP objects (with an optional group generator) based on EC_METHODs that are built into the library. Points are EC_POINT objects based on EC_GROUP objects. Most of the framework would be able to handle curves over arbitrary finite fields, but as there are no obvious types for fields other than GF(p), some functions are limited to that for now. [Bodo Moeller] *) Add the -HTTP option to s_server. It is similar to -WWW, but requires that the file contains a complete HTTP response. [Richard Levitte] *) Add the ec directory to mkdef.pl and mkfiles.pl. In mkdef.pl change the def and num file printf format specifier from "%-40sXXX" to "%-39s XXX". The latter will always guarantee a space after the field while the former will cause them to run together if the field is 40 of more characters long. [Steve Henson] *) Constify the cipher and digest 'method' functions and structures and modify related functions to take constant EVP_MD and EVP_CIPHER pointers. [Steve Henson] *) Hide BN_CTX structure details in bn_lcl.h instead of publishing them in . Also further increase BN_CTX_NUM to 32. [Bodo Moeller] *) Modify EVP_Digest*() routines so they now return values. Although the internal software routines can never fail additional hardware versions might. [Steve Henson] *) Clean up crypto/err/err.h and change some error codes to avoid conflicts: Previously ERR_R_FATAL was too small and coincided with ERR_LIB_PKCS7 (= ERR_R_PKCS7_LIB); it is now 64 instead of 32. ASN1 error codes ERR_R_NESTED_ASN1_ERROR ... ERR_R_MISSING_ASN1_EOS were 4 .. 9, conflicting with ERR_LIB_RSA (= ERR_R_RSA_LIB) ... ERR_LIB_PEM (= ERR_R_PEM_LIB). They are now 58 .. 63 (i.e., just below ERR_R_FATAL). Add new error code 'ERR_R_INTERNAL_ERROR'. [Bodo Moeller] *) Don't overuse locks in crypto/err/err.c: For data retrieval, CRYPTO_r_lock suffices. [Bodo Moeller] *) New option '-subj arg' for 'openssl req' and 'openssl ca'. This sets the subject name for a new request or supersedes the subject name in a given request. Formats that can be parsed are 'CN=Some Name, OU=myOU, C=IT' and 'CN=Some Name/OU=myOU/C=IT'. Add options '-batch' and '-verbose' to 'openssl req'. [Massimiliano Pala ] *) Introduce the possibility to access global variables through functions on platform were that's the best way to handle exporting global variables in shared libraries. To enable this functionality, one must configure with "EXPORT_VAR_AS_FN" or defined the C macro "OPENSSL_EXPORT_VAR_AS_FUNCTION" in crypto/opensslconf.h (the latter is normally done by Configure or something similar). To implement a global variable, use the macro OPENSSL_IMPLEMENT_GLOBAL in the source file (foo.c) like this: OPENSSL_IMPLEMENT_GLOBAL(int,foo)=1; OPENSSL_IMPLEMENT_GLOBAL(double,bar); To declare a global variable, use the macros OPENSSL_DECLARE_GLOBAL and OPENSSL_GLOBAL_REF in the header file (foo.h) like this: OPENSSL_DECLARE_GLOBAL(int,foo); #define foo OPENSSL_GLOBAL_REF(foo) OPENSSL_DECLARE_GLOBAL(double,bar); #define bar OPENSSL_GLOBAL_REF(bar) The #defines are very important, and therefore so is including the header file everywhere where the defined globals are used. The macro OPENSSL_EXPORT_VAR_AS_FUNCTION also affects the definition of ASN.1 items, but that structure is a bit different. The largest change is in util/mkdef.pl which has been enhanced with better and easier to understand logic to choose which symbols should go into the Windows .def files as well as a number of fixes and code cleanup (among others, algorithm keywords are now sorted lexicographically to avoid constant rewrites). [Richard Levitte] *) In BN_div() keep a copy of the sign of 'num' before writing the result to 'rm' because if rm==num the value will be overwritten and produce the wrong result if 'num' is negative: this caused problems with BN_mod() and BN_nnmod(). [Steve Henson] *) Function OCSP_request_verify(). This checks the signature on an OCSP request and verifies the signer certificate. The signer certificate is just checked for a generic purpose and OCSP request trust settings. [Steve Henson] *) Add OCSP_check_validity() function to check the validity of OCSP responses. OCSP responses are prepared in real time and may only be a few seconds old. Simply checking that the current time lies between thisUpdate and nextUpdate max reject otherwise valid responses caused by either OCSP responder or client clock inaccuracy. Instead we allow thisUpdate and nextUpdate to fall within a certain period of the current time. The age of the response can also optionally be checked. Two new options -validity_period and -status_age added to ocsp utility. [Steve Henson] *) If signature or public key algorithm is unrecognized print out its OID rather that just UNKNOWN. [Steve Henson] *) Change OCSP_cert_to_id() to tolerate a NULL subject certificate and OCSP_cert_id_new() a NULL serialNumber. This allows a partial certificate ID to be generated from the issuer certificate alone which can then be passed to OCSP_id_issuer_cmp(). [Steve Henson] *) New compilation option ASN1_ITEM_FUNCTIONS. This causes the new ASN1 modules to export functions returning ASN1_ITEM pointers instead of the ASN1_ITEM structures themselves. This adds several new macros which allow the underlying ASN1 function/structure to be accessed transparently. As a result code should not use ASN1_ITEM references directly (such as &X509_it) but instead use the relevant macros (such as ASN1_ITEM_rptr(X509)). This option is to allow use of the new ASN1 code on platforms where exporting structures is problematical (for example in shared libraries) but exporting functions returning pointers to structures is not. [Steve Henson] *) Add support for overriding the generation of SSL/TLS session IDs. These callbacks can be registered either in an SSL_CTX or per SSL. The purpose of this is to allow applications to control, if they wish, the arbitrary values chosen for use as session IDs, particularly as it can be useful for session caching in multiple-server environments. A command-line switch for testing this (and any client code that wishes to use such a feature) has been added to "s_server". [Geoff Thorpe, Lutz Jaenicke] *) Modify mkdef.pl to recognise and parse preprocessor conditionals of the form '#if defined(...) || defined(...) || ...' and '#if !defined(...) && !defined(...) && ...'. This also avoids the growing number of special cases it was previously handling. [Richard Levitte] *) 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 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 what is available. [Richard Levitte] *) New option -set_serial to 'req' and 'x509' this allows the serial number to use to be specified on the command line. Previously self signed certificates were hard coded with serial number 0 and the CA options of 'x509' had to use a serial number in a file which was auto incremented. [Steve Henson] *) New options to 'ca' utility to support V2 CRL entry extensions. Currently CRL reason, invalidity date and hold instruction are supported. Add new CRL extensions to V3 code and some new objects. [Steve Henson] *) New function EVP_CIPHER_CTX_set_padding() this is used to disable standard block padding (aka PKCS#5 padding) in the EVP API, which was previously mandatory. This means that the data is not padded in any way and so the total length much be a multiple of the block size, otherwise an error occurs. [Steve Henson] *) Initial (incomplete) OCSP SSL support. [Steve Henson] *) New function OCSP_parse_url(). This splits up a URL into its host, port and path components: primarily to parse OCSP URLs. New -url option to ocsp utility. [Steve Henson] *) New nonce behavior. The return value of OCSP_check_nonce() now reflects the various checks performed. Applications can decide whether to tolerate certain situations such as an absent nonce in a response when one was present in a request: the ocsp application just prints out a warning. New function OCSP_add1_basic_nonce() this is to allow responders to include a nonce in a response even if the request is nonce-less. [Steve Henson] *) 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) ] *) New OCSP verify flag OCSP_TRUSTOTHER. When set the "other" certificates passed by the function are trusted implicitly. If any of them signed the response then it is assumed to be valid and is not verified. [Steve Henson] *) In PKCS7_set_type() initialise content_type in PKCS7_ENC_CONTENT to data. This was previously part of the PKCS7 ASN1 code. This was causing problems with OpenSSL created PKCS#12 and PKCS#7 structures. [Steve Henson, reported by Kenneth R. Robinette ] *) Add CRYPTO_push_info() and CRYPTO_pop_info() calls to new ASN1 routines: without these tracing memory leaks is very painful. Fix leaks in PKCS12 and PKCS7 routines. [Steve Henson] *) Make X509_time_adj() cope with the new behaviour of ASN1_TIME_new(). Previously it initialised the 'type' argument to V_ASN1_UTCTIME which effectively meant GeneralizedTime would never be used. Now it is initialised to -1 but X509_time_adj() now has to check the value and use ASN1_TIME_set() if the value is not V_ASN1_UTCTIME or V_ASN1_GENERALIZEDTIME, without this it always uses GeneralizedTime. [Steve Henson, reported by Kenneth R. Robinette ] *) Fixes to BN_to_ASN1_INTEGER when bn is zero. This would previously result in a zero length in the ASN1_INTEGER structure which was not consistent with the structure when d2i_ASN1_INTEGER() was used and would cause ASN1_INTEGER_cmp() to fail. Enhance s2i_ASN1_INTEGER() to cope with hex and negative integers. Fix bug in i2a_ASN1_INTEGER() where it did not print out a minus for negative ASN1_INTEGER. [Steve Henson] *) Add summary printout to ocsp utility. The various functions which convert status values to strings have been renamed to: OCSP_response_status_str(), OCSP_cert_status_str() and OCSP_crl_reason_str() and are no longer static. New options to verify nonce values and to disable verification. OCSP response printout format cleaned up. [Steve Henson] *) Add additional OCSP certificate checks. These are those specified in RFC2560. This consists of two separate checks: the CA of the certificate being checked must either be the OCSP signer certificate or the issuer of the OCSP signer certificate. In the latter case the OCSP signer certificate must contain the OCSP signing extended key usage. This check is performed by attempting to match the OCSP signer or the OCSP signer CA to the issuerNameHash and issuerKeyHash in the OCSP_CERTID structures of the response. [Steve Henson] *) Initial OCSP certificate verification added to OCSP_basic_verify() and related routines. This uses the standard OpenSSL certificate verify routines to perform initial checks (just CA validity) and to obtain the certificate chain. Then additional checks will be performed on the chain. Currently the root CA is checked to see if it is explicitly trusted for OCSP signing. This is used to set a root CA as a global signing root: that is any certificate that chains to that CA is an acceptable OCSP signing certificate. [Steve Henson] *) New '-extfile ...' option to 'openssl ca' for reading X.509v3 extensions from a separate configuration file. As when reading extensions from the main configuration file, the '-extensions ...' option may be used for specifying the section to use. [Massimiliano Pala ] *) New OCSP utility. Allows OCSP requests to be generated or read. The request can be sent to a responder and the output parsed, outputed or printed in text form. Not complete yet: still needs to check the OCSP response validity. [Steve Henson] *) New subcommands for 'openssl ca': 'openssl ca -status ' 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 in the index file. [Massimiliano Pala ] *) New '-newreq-nodes' command option to CA.pl. This is like '-newreq', but calls 'openssl req' with the '-nodes' option so that the resulting key is not encrypted. [Damien Miller ] *) New configuration for the GNU Hurd. [Jonathan Bartlett via Richard Levitte] *) Initial code to implement OCSP basic response verify. This is currently incomplete. Currently just finds the signer's certificate and verifies the signature on the response. [Steve Henson] *) New SSLeay_version code SSLEAY_DIR to determine the compiled-in value of OPENSSLDIR. This is available via the new '-d' option to 'openssl version', and is also included in 'openssl version -a'. [Bodo Moeller] *) 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 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 settings for extended allocation functions, the following functions are provided: CRYPTO_set_mem_ex_functions CRYPTO_set_locked_mem_ex_functions CRYPTO_get_mem_ex_functions 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 extended allocation function is enabled. Similarly, CRYPTO_get_[locked_]mem_ex_functions writes 0 where a conventional allocation function is enabled. [Richard Levitte, Bodo Moeller] *) Finish off removing the remaining LHASH function pointer casts. There should no longer be any prototype-casting required when using the LHASH abstraction, and any casts that remain are "bugs". See the callback types and macros at the head of lhash.h for details (and "OBJ_cleanup" in crypto/objects/obj_dat.c as an example). [Geoff Thorpe] *) Add automatic query of EGD sockets in RAND_poll() for the unix variant. If /dev/[u]random devices are not available or do not return enough entropy, EGD style sockets (served by EGD or PRNGD) will automatically be queried. The locations /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool, and /etc/entropy will be queried once each in this sequence, quering stops when enough entropy was collected without querying more sockets. [Lutz Jaenicke] *) Change the Unix RAND_poll() variant to be able to poll several random devices, as specified by DEVRANDOM, until a sufficient amount of data has been collected. We spend at most 10 ms on each file (select timeout) and read in non-blocking mode. DEVRANDOM now defaults to the list "/dev/urandom", "/dev/random", "/dev/srandom" (previously it was just the string "/dev/urandom"), so on typical platforms the 10 ms delay will never occur. Also separate out the Unix variant to its own file, rand_unix.c. For VMS, there's a currently-empty rand_vms.c. [Richard Levitte] *) Move OCSP client related routines to ocsp_cl.c. These provide utility functions which an application needing to issue a request to an OCSP responder and analyse the response will typically need: as opposed to those which an OCSP responder itself would need which will be added later. OCSP_request_sign() signs an OCSP request with an API similar to PKCS7_sign(). OCSP_response_status() returns status of OCSP response. OCSP_response_get1_basic() extracts basic response from response. OCSP_resp_find_status(): finds and extracts status information from an OCSP_CERTID structure (which will be created when the request structure is built). These are built from lower level functions which work on OCSP_SINGLERESP structures but wont normally be used unless the application wishes to examine extensions in the OCSP response for example. Replace nonce routines with a pair of functions. OCSP_request_add1_nonce() adds a nonce value and optionally generates a random value. OCSP_check_nonce() checks the validity of the nonce in an OCSP response. [Steve Henson] *) Change function OCSP_request_add() to OCSP_request_add0_id(). This doesn't copy the supplied OCSP_CERTID and avoids the need to free up the newly created id. Change return type to OCSP_ONEREQ to return the internal OCSP_ONEREQ structure. This can then be used to add extensions to the request. Deleted OCSP_request_new(), since most of its functionality is now in OCSP_REQUEST_new() (and the case insensitive name clash) apart from the ability to set the request name which will be added elsewhere. [Steve Henson] *) Update OCSP API. Remove obsolete extensions argument from various functions. Extensions are now handled using the new OCSP extension code. New simple OCSP HTTP function which can be used to send requests and parse the response. [Steve Henson] *) Fix the PKCS#7 (S/MIME) code to work with new ASN1. Two new ASN1_ITEM structures help with sign and verify. PKCS7_ATTR_SIGN uses the special reorder version of SET OF to sort the attributes and reorder them to match the encoded order. This resolves a long standing problem: a verify on a PKCS7 structure just after signing it used to fail because the attribute order did not match the encoded order. PKCS7_ATTR_VERIFY does not reorder the attributes: it uses the received order. This is necessary to tolerate some broken software that does not order SET OF. This is handled by encoding as a SEQUENCE OF but using implicit tagging (with UNIVERSAL class) to produce the required SET OF. [Steve Henson] *) Have mk1mf.pl generate the macros OPENSSL_BUILD_SHLIBCRYPTO and OPENSSL_BUILD_SHLIBSSL and use them appropriately in the header files to get correct declarations of the ASN.1 item variables. [Richard Levitte] *) Rewrite of PKCS#12 code to use new ASN1 functionality. Replace many PKCS#12 macros with real functions. Fix two unrelated ASN1 bugs: asn1_check_tlen() would sometimes attempt to use 'ctx' when it was NULL and ASN1_TYPE was not dereferenced properly in asn1_ex_c2i(). New ASN1 macro: DECLARE_ASN1_ITEM() which just declares the relevant ASN1_ITEM and no wrapper functions. [Steve Henson] *) 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. [Steve Henson] *) Enhance mkdef.pl to be more accepting about spacing in C preprocessor lines, recognice more "algorithms" that can be deselected, and make it complain about algorithm deselection that isn't recognised. [Richard Levitte] *) New ASN1 functions to handle dup, sign, verify, digest, pack and unpack operations in terms of ASN1_ITEM. Modify existing wrappers to use new functions. Add NO_ASN1_OLD which can be set to remove some old style ASN1 functions: this can be used to determine if old code will still work when these eventually go away. [Steve Henson] *) New extension functions for OCSP structures, these follow the same conventions as certificates and CRLs. [Steve Henson] *) New function X509V3_add1_i2d(). This automatically encodes and adds an extension. Its behaviour can be customised with various flags to append, replace or delete. Various wrappers added for certifcates and CRLs. [Steve Henson] *) Fix to avoid calling the underlying ASN1 print routine when an extension cannot be parsed. Correct a typo in the OCSP_SERVICELOC extension. Tidy up print OCSP format. [Steve Henson] *) Make mkdef.pl parse some of the ASN1 macros and add apropriate entries for variables. [Steve Henson] *) Add functionality to apps/openssl.c for detecting locking problems: As the program is single-threaded, all we have to do is register a locking callback using an array for storing which locks are currently held by the program. [Bodo Moeller] *) Use a lock around the call to CRYPTO_get_ex_new_index() in SSL_get_ex_data_X509_STORE_idx(), which is used in ssl_verify_cert_chain() and thus can be called at any time during TLS/SSL handshakes so that thread-safety is essential. Unfortunately, the ex_data design is not at all suited for multi-threaded use, so it probably should be abolished. [Bodo Moeller] *) Added Broadcom "ubsec" ENGINE to OpenSSL. [Broadcom, tweaked and integrated by Geoff Thorpe] *) Move common extension printing code to new function X509V3_print_extensions(). Reorganise OCSP print routines and implement some needed OCSP ASN1 functions. Add OCSP extensions. [Steve Henson] *) New function X509_signature_print() to remove duplication in some print routines. [Steve Henson] *) Add a special meaning when SET OF and SEQUENCE OF flags are both set (this was treated exactly the same as SET OF previously). This is used to reorder the STACK representing the structure to match the encoding. This will be used to get round a problem where a PKCS7 structure which was signed could not be verified because the STACK order did not reflect the encoded order. [Steve Henson] *) Reimplement the OCSP ASN1 module using the new code. [Steve Henson] *) Update the X509V3 code to permit the use of an ASN1_ITEM structure for its ASN1 operations. The old style function pointers still exist for now but they will eventually go away. [Steve Henson] *) Merge in replacement ASN1 code from the ASN1 branch. This almost completely replaces the old ASN1 functionality with a table driven encoder and decoder which interprets an ASN1_ITEM structure describing the ASN1 module. Compatibility with the existing ASN1 API (i2d,d2i) is largely maintained. Almost all of the old asn1_mac.h macro based ASN1 has also been converted to the new form. [Steve Henson] *) Change BN_mod_exp_recp so that negative moduli are tolerated (the sign is ignored). Similarly, ignore the sign in BN_MONT_CTX_set so that BN_mod_exp_mont and BN_mod_exp_mont_word work for negative moduli. [Bodo Moeller] *) Fix BN_uadd and BN_usub: Always return non-negative results instead of not touching the result's sign bit. [Bodo Moeller] *) BN_div bugfix: If the result is 0, the sign (res->neg) must not be set. [Bodo Moeller] *) Changed the LHASH code to use prototypes for callbacks, and created macros to declare and implement thin (optionally static) functions that provide type-safety and avoid function pointer casting for the type-specific callbacks. [Geoff Thorpe] *) Added Kerberos Cipher Suites to be used with TLS, as written in RFC 2712. [Veers Staats , Jeffrey Altman , via Richard Levitte] *) Reformat the FAQ so the different questions and answers can be divided in sections depending on the subject. [Richard Levitte] *) Have the zlib compression code load ZLIB.DLL dynamically under Windows. [Richard Levitte] *) New function BN_mod_sqrt for computing square roots modulo a prime (using the probabilistic Tonelli-Shanks algorithm unless p == 3 (mod 4) or p == 5 (mod 8), which are cases that can be handled deterministically). [Lenka Fibikova , Bodo Moeller] *) Make BN_mod_inverse faster by explicitly handling small quotients in the Euclid loop. (Speed gain about 20% for small moduli [256 or 512 bits], about 30% for larger ones [1024 or 2048 bits].) [Bodo Moeller] *) New function BN_kronecker. [Bodo Moeller] *) Fix BN_gcd so that it works on negative inputs; the result is positive unless both parameters are zero. Previously something reasonably close to an infinite loop was possible because numbers could be growing instead of shrinking in the implementation of Euclid's algorithm. [Bodo Moeller] *) Fix BN_is_word() and BN_is_one() macros to take into account the sign of the number in question. Fix BN_is_word(a,w) to work correctly for w == 0. The old BN_is_word(a,w) macro is now called BN_abs_is_word(a,w) because its test if the absolute value of 'a' equals 'w'. Note that BN_abs_is_word does *not* handle w == 0 reliably; it exists mostly for use in the implementations of BN_is_zero(), BN_is_one(), and BN_is_word(). [Bodo Moeller] *) New function BN_swap. [Bodo Moeller] *) Use BN_nnmod instead of BN_mod in crypto/bn/bn_exp.c so that the exponentiation functions are more likely to produce reasonable results on negative inputs. [Bodo Moeller] *) Change BN_mod_mul so that the result is always non-negative. Previously, it could be negative if one of the factors was negative; I don't think anyone really wanted that behaviour. [Bodo Moeller] *) 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: BN_nnmod BN_mod_sqr BN_mod_add BN_mod_add_quick BN_mod_sub BN_mod_sub_quick BN_mod_lshift1 BN_mod_lshift1_quick BN_mod_lshift BN_mod_lshift_quick These functions always generate non-negative results. BN_nnmod otherwise is like BN_mod (if BN_mod computes a remainder r such that |m| < r < 0, BN_nnmod will output rem + |m| instead). BN_mod_XXX_quick(r, a, [b,] m) generates the same result as BN_mod_XXX(r, a, [b,] m, ctx), but requires that a [and b] be reduced modulo m. [Lenka Fibikova , Bodo Moeller] #if 0 The following entry accidentily appeared in the CHANGES file distributed with OpenSSL 0.9.7. The modifications described in it do *not* apply to OpenSSL 0.9.7. *) Remove a few calls to bn_wexpand() in BN_sqr() (the one in there was actually never needed) and in BN_mul(). The removal in BN_mul() required a small change in bn_mul_part_recursive() and the addition of the functions bn_cmp_part_words(), bn_sub_part_words() and bn_add_part_words(), which do the same thing as bn_cmp_words(), bn_sub_words() and bn_add_words() except they take arrays with differing sizes. [Richard Levitte] #endif *) In 'openssl passwd', verify passwords read from the terminal unless the '-salt' option is used (which usually means that verification would just waste user's time since the resulting hash is going to be compared with some given password hash) or the new '-noverify' option is used. This is an incompatible change, but it does not affect non-interactive use of 'openssl passwd' (passwords on the command line, '-stdin' option, '-in ...' option) and thus should not cause any problems. [Bodo Moeller] *) Remove all references to RSAref, since there's no more need for it. [Richard Levitte] *) Make DSO load along a path given through an environment variable (SHLIB_PATH) with shl_load(). [Richard Levitte] *) Constify the ENGINE code as a result of BIGNUM constification. Also constify the RSA code and most things related to it. In a few places, most notable in the depth of the ASN.1 code, ugly casts back to non-const were required (to be solved at a later time) [Richard Levitte] *) Make it so the openssl application has all engines loaded by default. [Richard Levitte] *) Constify the BIGNUM routines a little more. [Richard Levitte] *) Add the following functions: ENGINE_load_cswift() ENGINE_load_chil() ENGINE_load_atalla() ENGINE_load_nuron() ENGINE_load_builtin_engines() That way, an application can itself choose if external engines that are built-in in OpenSSL shall ever be used or not. The benefit is that applications won't have to be linked with libdl or other dso libraries unless it's really needed. Changed 'openssl engine' to load all engines on demand. Changed the engine header files to avoid the duplication of some declarations (they differed!). [Richard Levitte] *) 'openssl engine' can now list capabilities. [Richard Levitte] *) Better error reporting in 'openssl engine'. [Richard Levitte] *) Never call load_dh_param(NULL) in s_server. [Bodo Moeller] *) Add engine application. It can currently list engines by name and identity, and test if they are actually available. [Richard Levitte] *) Improve RPM specification file by forcing symbolic linking and making sure the installed documentation is also owned by root.root. [Damien Miller ] *) Give the OpenSSL applications more possibilities to make use of keys (public as well as private) handled by engines. [Richard Levitte] *) Add OCSP code that comes from CertCo. [Richard Levitte] *) Add VMS support for the Rijndael code. [Richard Levitte] *) Added untested support for Nuron crypto accelerator. [Ben Laurie] *) Add support for external cryptographic devices. This code was previously distributed separately as the "engine" branch. [Geoff Thorpe, Richard Levitte] *) Rework the filename-translation in the DSO code. It is now possible to have far greater control over how a "name" is turned into a filename depending on the operating environment and any oddities about the different shared library filenames on each system. [Geoff Thorpe] *) Support threads on FreeBSD-elf in Configure. [Richard Levitte] *) Fix for SHA1 assembly problem with MASM: it produces warnings about corrupt line number information when assembling with debugging information. This is caused by the overlapping of two sections. [Bernd Matthes , Steve Henson] *) 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 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, by providing a function pointer that is given a name instead of a BIO. For example, this could be used to load configuration data from an LDAP server. [Richard Levitte] *) Fix for non blocking accept BIOs. Added new I/O special reason BIO_RR_ACCEPT to cover this case. Previously use of accept BIOs with non blocking I/O was not possible because no retry code was implemented. Also added new SSL code SSL_WANT_ACCEPT to cover this case. [Steve Henson] *) Added the beginnings of Rijndael support. [Ben Laurie] *) Fix for bug in DirectoryString mask setting. Add support for X509_NAME_print_ex() in 'req' and X509_print_ex() function to allow certificate printing to more controllable, additional 'certopt' option to 'x509' to allow new printing options to be set. [Steve Henson] *) Clean old EAY MD5 hack from e_os.h. [Richard Levitte] 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] *) Fix additional bug revealed by the NISCC test suite: Stop bug triggering large recursion when presented with certain ASN.1 tags (CVE-2003-0851) [Steve Henson] Changes between 0.9.6j and 0.9.6k [30 Sep 2003] *) Fix various bugs revealed by running the NISCC test suite: Stop out of bounds reads in the ASN1 code when presented with invalid tags (CVE-2003-0543 and CVE-2003-0544). 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 if the server requested one: as stated in TLS 1.0 and SSL 3.0 specifications. [Steve Henson] *) In ssl3_get_client_hello() (ssl/s3_srvr.c), tolerate additional extra data after the compression methods not only for TLS 1.0 but also for SSL 3.0 (as required by the specification). [Bodo Moeller; problem pointed out by Matthias Loepfe] *) Change X509_certificate_type() to mark the key as exported/exportable when it's 512 *bits* long, not 512 bytes. [Richard Levitte] 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 a protocol version number mismatch like a decryption error in ssl3_get_client_key_exchange (ssl/s3_srvr.c). [Bodo Moeller] *) Turn on RSA blinding by default in the default implementation to avoid a timing attack. Applications that don't want it can call RSA_blinding_off() or use the new flag RSA_FLAG_NO_BLINDING. They would be ill-advised to do so in most cases. [Ben Laurie, Steve Henson, Geoff Thorpe, Bodo Moeller] *) Change RSA blinding code so that it works when the PRNG is not seeded (in this case, the secret RSA exponent is abused as an unpredictable seed -- if it is not unpredictable, there is no point in blinding anyway). Make RSA blinding thread-safe by remembering the creator's thread ID in rsa->blinding and having all other threads use local one-time blinding factors (this requires more computation than sharing rsa->blinding, but avoids excessive locking; and if an RSA object is not shared between threads, blinding will still be very fast). [Bodo Moeller] 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 incorrrect block cipher padding has been found. This is a countermeasure against active attacks where the attacker has to distinguish between bad padding and a MAC verification error. (CVE-2003-0078) [Bodo Moeller; problem pointed out by Brice Canvel (EPFL), Alain Hiltgen (UBS), Serge Vaudenay (EPFL), and Martin Vuagnoux (EPFL, Ilion)] 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 it's contents. This is done with a counter that will place alternating values in each byte. This can be used to solve two issues: 1) the removal of calls to memset() by highly optimizing compilers, and 2) cleansing with other values than 0, since those can be read through on certain media, for example a swap space on disk. [Geoff Thorpe] *) Bugfix: client side session caching did not work with external caching, because the session->cipher setting was not restored when reloading from the external cache. This problem was masked, when SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG (part of SSL_OP_ALL) was set. (Found by Steve Haslam .) [Lutz Jaenicke] *) Fix client_certificate (ssl/s2_clnt.c): The permissible total length of the REQUEST-CERTIFICATE message is 18 .. 34, not 17 .. 33. [Zeev Lieber ] *) Undo an undocumented change introduced in 0.9.6e which caused repeated calls to OpenSSL_add_all_ciphers() and OpenSSL_add_all_digests() to be ignored, even after calling EVP_cleanup(). [Richard Levitte] *) Change the default configuration reader to deal with last line not being properly terminated. [Richard Levitte] *) Change X509_NAME_cmp() so it applies the special rules on handling DN values that are of type PrintableString, as well as RDNs of type emailAddress where the value has the type ia5String. [stefank@valicert.com via Richard Levitte] *) Add a SSL_SESS_CACHE_NO_INTERNAL_STORE flag to take over half the job SSL_SESS_CACHE_NO_INTERNAL_LOOKUP was inconsistently doing, define a new flag (SSL_SESS_CACHE_NO_INTERNAL) to be the bitwise-OR of the two for use by the majority of applications wanting this behaviour, and update the docs. The documented behaviour and actual behaviour were inconsistent and had been changing anyway, so this is more a bug-fix than a behavioural change. [Geoff Thorpe, diagnosed by Nadav Har'El] *) Don't impose a 16-byte length minimum on session IDs in ssl/s3_clnt.c (the SSL 3.0 and TLS 1.0 specifications allow any length up to 32 bytes). [Bodo Moeller] *) Fix initialization code race conditions in SSLv23_method(), SSLv23_client_method(), SSLv23_server_method(), SSLv2_method(), SSLv2_client_method(), SSLv2_server_method(), SSLv3_method(), SSLv3_client_method(), SSLv3_server_method(), TLSv1_method(), TLSv1_client_method(), TLSv1_server_method(), ssl2_get_cipher_by_char(), ssl3_get_cipher_by_char(). [Patrick McCormick , Bodo Moeller] *) Reorder cleanup sequence in SSL_CTX_free(): only remove the ex_data after the cached sessions are flushed, as the remove_cb() might use ex_data contents. Bug found by Sam Varshavchik (see [openssl.org #212]). [Geoff Thorpe, Lutz Jaenicke] *) Fix typo in OBJ_txt2obj which incorrectly passed the content length, instead of the encoding length to d2i_ASN1_OBJECT. [Steve Henson] 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'). [Lynn Gazis ] 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 , Alon Kantor (and others), Steve Henson] *) Use proper error handling instead of 'assertions' in buffer overflow checks added in 0.9.6e. This prevents DoS (the assertions could call abort()). [Arne Ansper , Bodo Moeller] 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 negative or the content length exceeds the length of the supplied buffer. [Steve Henson, Adi Stav , James Yonan ] *) Fix cipher selection routines: ciphers without encryption had no flags for the cipher strength set and where therefore not handled correctly by the selection routines (PR #130). [Lutz Jaenicke] *) Fix EVP_dsa_sha macro. [Nils Larsch] *) New option SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS for disabling the SSL 3.0/TLS 1.0 CBC vulnerability countermeasure that was added in OpenSSL 0.9.6d. As the countermeasure turned out to be incompatible with some broken SSL implementations, the new option is part of SSL_OP_ALL. SSL_OP_ALL is usually employed when compatibility with weird SSL implementations is desired (e.g. '-bugs' option to 's_client' and 's_server'), so the new option is automatically set in many applications. [Bodo Moeller] *) Changes in security patch: Changes marked "(CHATS)" were sponsored by the Defense Advanced Research Projects Agency (DARPA) and Air Force Research Laboratory, Air Force Materiel Command, USAF, under agreement number F30602-01-2-0537. *) Add various sanity checks to asn1_get_length() to reject the ASN1 length bytes if they exceed sizeof(long), will appear negative or the content length exceeds the length of the supplied buffer. (CVE-2002-0659) [Steve Henson, Adi Stav , James Yonan ] *) Assertions for various potential buffer overflows, not known to happen in practice. [Ben Laurie (CHATS)] *) Various temporary buffers to hold ASCII versions of integers were too small for 64 bit platforms. (CVE-2002-0655) [Matthew Byng-Maddick and Ben Laurie (CHATS)> *) Remote buffer overflow in SSL3 protocol - an attacker could supply an oversized session ID to a client. (CVE-2002-0656) [Ben Laurie (CHATS)] *) Remote buffer overflow in SSL2 protocol - an attacker could supply an oversized client master key. (CVE-2002-0656) [Ben Laurie (CHATS)] 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 ; problem pointed out by Bodo Moeller] *) Check various X509_...() return values in apps/req.c. [Nils Larsch ] *) Fix BASE64 decode (EVP_DecodeUpdate) for data with CR/LF ended lines: an end-of-file condition would erronously be flagged, when the CRLF was just at the end of a processed block. The bug was discovered when processing data through a buffering memory BIO handing the data to a BASE64-decoding BIO. Bug fund and patch submitted by Pavel Tsekov and Nedelcho Stanev. [Lutz Jaenicke] *) Implement a countermeasure against a vulnerability recently found in CBC ciphersuites in SSL 3.0/TLS 1.0: Send an empty fragment before application data chunks to avoid the use of known IVs with data potentially chosen by the attacker. [Bodo Moeller] *) Fix length checks in ssl3_get_client_hello(). [Bodo Moeller] *) TLS/SSL library bugfix: use s->s3->in_read_app_data differently to prevent ssl3_read_internal() from incorrectly assuming that ssl3_read_bytes() found application data while handshake processing was enabled when in fact s->s3->in_read_app_data was merely automatically cleared during the initial handshake. [Bodo Moeller; problem pointed out by Arne Ansper ] *) Fix object definitions for Private and Enterprise: they were not recognized in their shortname (=lowercase) representation. Extend obj_dat.pl to issue an error when using undefined keywords instead of silently ignoring the problem (Svenning Sorensen ). [Lutz Jaenicke] *) Fix DH_generate_parameters() so that it works for 'non-standard' generators, i.e. generators other than 2 and 5. (Previously, the code did not properly initialise the 'add' and 'rem' values to BN_generate_prime().) In the new general case, we do not insist that 'generator' is actually a primitive root: This requirement is rather pointless; a generator of the order-q subgroup is just as good, if not better. [Bodo Moeller] *) Map new X509 verification errors to alerts. Discovered and submitted by Tom Wu . [Lutz Jaenicke] *) Fix ssl3_pending() (ssl/s3_lib.c) to prevent SSL_pending() from returning non-zero before the data has been completely received when using non-blocking I/O. [Bodo Moeller; problem pointed out by John Hughes] *) Some of the ciphers missed the strength entry (SSL_LOW etc). [Ben Laurie, Lutz Jaenicke] *) Fix bug in SSL_clear(): bad sessions were not removed (found by Yoram Zahavi ). [Lutz Jaenicke] *) Add information about CygWin 1.3 and on, and preserve proper configuration for the versions before that. [Corinna Vinschen and Richard Levitte] *) Make removal from session cache (SSL_CTX_remove_session()) more robust: check whether we deal with a copy of a session and do not delete from the cache in this case. Problem reported by "Izhar Shoshani Levi" . [Lutz Jaenicke] *) Do not store session data into the internal session cache, if it is never intended to be looked up (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP flag is set). Proposed by Aslam . [Lutz Jaenicke] *) Have ASN1_BIT_STRING_set_bit() really clear a bit when the requested value is 0. [Richard Levitte] *) [In 0.9.6d-engine release:] Fix a crashbug and a logic bug in hwcrhk_load_pubkey(). [Toomas Kiisk via Richard Levitte] *) Add the configuration target linux-s390x. [Neale Ferguson via Richard Levitte] *) The earlier bugfix for the SSL3_ST_SW_HELLO_REQ_C case of ssl3_accept (ssl/s3_srvr.c) incorrectly used a local flag variable as an indication that a ClientHello message has been received. As the flag value will be lost between multiple invocations of ssl3_accept when using non-blocking I/O, the function may not be aware that a handshake has actually taken place, thus preventing a new session from being added to the session cache. To avoid this problem, we now set s->new_session to 2 instead of using a local variable. [Lutz Jaenicke, Bodo Moeller] *) Bugfix: Return -1 from ssl3_get_server_done (ssl3/s3_clnt.c) if the SSL_R_LENGTH_MISMATCH error is detected. [Geoff Thorpe, Bodo Moeller] *) New 'shared_ldflag' column in Configure platform table. [Richard Levitte] *) Fix EVP_CIPHER_mode macro. ["Dan S. Camper" ] *) Fix ssl3_read_bytes (ssl/s3_pkt.c): To ignore messages of unknown type, we must throw them away by setting rr->length to 0. [D P Chang ] Changes between 0.9.6b and 0.9.6c [21 dec 2001] *) Fix BN_rand_range bug pointed out by Dominikus Scherkl . (The previous implementation worked incorrectly for those cases where range = 10..._2 and 3*range is two bits longer than range.) [Bodo Moeller] *) Only add signing time to PKCS7 structures if it is not already present. [Steve Henson] *) Fix crypto/objects/objects.h: "ld-ce" should be "id-ce", OBJ_ld_ce should be OBJ_id_ce. Also some ip-pda OIDs in crypto/objects/objects.txt were incorrect (cf. RFC 3039). [Matt Cooper, Frederic Giudicelli, Bodo Moeller] *) Release CRYPTO_LOCK_DYNLOCK when CRYPTO_destroy_dynlockid() returns early because it has nothing to do. [Andy Schneider ] *) [In 0.9.6c-engine release:] Fix mutex callback return values in crypto/engine/hw_ncipher.c. [Andy Schneider ] *) [In 0.9.6c-engine release:] Add support for Cryptographic Appliance's keyserver technology. (Use engine 'keyclient') [Cryptographic Appliances and Geoff Thorpe] *) Add a configuration entry for OS/390 Unix. The C compiler 'c89' is called via tools/c89.sh because arguments have to be rearranged (all '-L' options must appear before the first object modules). [Richard Shapiro ] *) [In 0.9.6c-engine release:] Add support for Broadcom crypto accelerator cards, backported from 0.9.7. [Broadcom, Nalin Dahyabhai , Mark Cox] *) [In 0.9.6c-engine release:] Add support for SureWare crypto accelerator cards from Baltimore Technologies. (Use engine 'sureware') [Baltimore Technologies and Mark Cox] *) [In 0.9.6c-engine release:] Add support for crypto accelerator cards from Accelerated Encryption Processing, www.aep.ie. (Use engine 'aep') [AEP Inc. and Mark Cox] *) Add a configuration entry for gcc on UnixWare. [Gary Benson ] *) Change ssl/s2_clnt.c and ssl/s2_srvr.c so that received handshake messages are stored in a single piece (fixed-length part and variable-length part combined) and fix various bugs found on the way. [Bodo Moeller] *) Disable caching in BIO_gethostbyname(), directly use gethostbyname() 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 *) Change ssl23_get_client_hello (ssl/s23_srvr.c) behaviour when faced with a pathologically small ClientHello fragment that does not contain client_version: Instead of aborting with an error, simply choose the highest available protocol version (i.e., TLS 1.0 unless it is disabled). In practice, ClientHello messages are never sent like this, but this change gives us strictly correct behaviour at least for TLS. [Bodo Moeller] *) Fix SSL handshake functions and SSL_clear() such that SSL_clear() never resets s->method to s->ctx->method when called from within one of the SSL handshake functions. [Bodo Moeller; problem pointed out by Niko Baric] *) In ssl3_get_client_hello (ssl/s3_srvr.c), generate a fatal alert (sent using the client's version number) if client_version is smaller than the protocol version in use. Also change ssl23_get_client_hello (ssl/s23_srvr.c) to select TLS 1.0 if the client demanded SSL 3.0 but only TLS 1.0 is enabled; then the client will at least see that alert. [Bodo Moeller] *) Fix ssl3_get_message (ssl/s3_both.c) to handle message fragmentation correctly. [Bodo Moeller] *) Avoid infinite loop in ssl3_get_message (ssl/s3_both.c) if a client receives HelloRequest while in a handshake. [Bodo Moeller; bug noticed by Andy Schneider ] *) Bugfix in ssl3_accept (ssl/s3_srvr.c): Case SSL3_ST_SW_HELLO_REQ_C should end in 'break', not 'goto end' which circuments various cleanups done in state SSL_ST_OK. But session related stuff must be disabled for SSL_ST_OK in the case that we just sent a HelloRequest. Also avoid some overhead by not calling ssl_init_wbio_buffer() before just sending a HelloRequest. [Bodo Moeller, Eric Rescorla ] *) Fix ssl/s3_enc.c, ssl/t1_enc.c and ssl/s3_pkt.c so that we don't reveal whether illegal block cipher padding was found or a MAC verification error occured. (Neither SSLerr() codes nor alerts are directly visible to potential attackers, but the information may leak via logfiles.) Similar changes are not required for the SSL 2.0 implementation because the number of padding bytes is sent in clear for SSL 2.0, and the extra bytes are just ignored. However ssl/s2_pkt.c failed to verify that the purported number of padding bytes is in the legal range. [Bodo Moeller] *) Add OpenUNIX-8 support including shared libraries (Boyd Lynn Gerber ). [Lutz Jaenicke] *) Improve RSA_padding_check_PKCS1_OAEP() check again to avoid 'wristwatch attack' using huge encoding parameters (cf. James H. Manger's CRYPTO 2001 paper). Note that the RSA_PKCS1_OAEP_PADDING case of RSA_private_decrypt() does not use encoding parameters and hence was not vulnerable. [Bodo Moeller] *) BN_sqr() bug fix. [Ulf Möller, reported by Jim Ellis ] *) Rabin-Miller test analyses assume uniformly distributed witnesses, so use BN_pseudo_rand_range() instead of using BN_pseudo_rand() followed by modular reduction. [Bodo Moeller; pointed out by Adam Young ] *) Add BN_pseudo_rand_range() with obvious functionality: BN_rand_range() equivalent based on BN_pseudo_rand() instead of BN_rand(). [Bodo Moeller] *) s3_srvr.c: allow sending of large client certificate lists (> 16 kB). This function was broken, as the check for a new client hello message to handle SGC did not allow these large messages. (Tracked down by "Douglas E. Engert" .) [Lutz Jaenicke] *) Add alert descriptions for TLSv1 to SSL_alert_desc_string[_long](). [Lutz Jaenicke] *) Fix buggy behaviour of BIO_get_num_renegotiates() and BIO_ctrl() for BIO_C_GET_WRITE_BUF_SIZE ("Stephen Hinton" ). [Lutz Jaenicke] *) Rework the configuration and shared library support for Tru64 Unix. The configuration part makes use of modern compiler features and still retains old compiler behavior for those that run older versions of the OS. The shared library support part includes a variant that uses the RPATH feature, and is available through the special configuration target "alpha-cc-rpath", which will never be selected automatically. [Tim Mooney via Richard Levitte] *) In ssl3_get_key_exchange (ssl/s3_clnt.c), call ssl3_get_message() with the same message size as in ssl3_get_certificate_request(). Otherwise, if no ServerKeyExchange message occurs, CertificateRequest messages might inadvertently be reject as too long. [Petr Lampa ] *) Enhanced support for IA-64 Unix platforms (well, Linux and HP-UX). [Andy Polyakov] *) Modified SSL library such that the verify_callback that has been set specificly for an SSL object with SSL_set_verify() is actually being used. Before the change, a verify_callback set with this function was ignored and the verify_callback() set in the SSL_CTX at the time of the call was used. New function X509_STORE_CTX_set_verify_cb() introduced to allow the necessary settings. [Lutz Jaenicke] *) Initialize static variable in crypto/dsa/dsa_lib.c and crypto/dh/dh_lib.c explicitly to NULL, as at least on Solaris 8 this seems not always to be done automatically (in contradiction to the requirements of the C standard). This made problems when used from OpenSSH. [Lutz Jaenicke] *) In OpenSSL 0.9.6a and 0.9.6b, crypto/dh/dh_key.c ignored dh->length and always used BN_rand_range(priv_key, dh->p). BN_rand_range() is not necessary for Diffie-Hellman, and this specific range makes Diffie-Hellman unnecessarily inefficient if dh->length (recommended exponent length) is much smaller than the length of dh->p. We could use BN_rand_range() if the order of the subgroup was stored in the DH structure, but we only have dh->length. So switch back to BN_rand(priv_key, l, ...) where 'l' is dh->length if this is defined, or BN_num_bits(dh->p)-1 otherwise. [Bodo Moeller] *) In RSA_eay_public_encrypt RSA_eay_private_decrypt RSA_eay_private_encrypt (signing) RSA_eay_public_decrypt (signature verification) (default implementations for RSA_public_encrypt, RSA_private_decrypt, RSA_private_encrypt, RSA_public_decrypt), always reject numbers >= n. [Bodo Moeller] *) In crypto/rand/md_rand.c, use a new short-time lock CRYPTO_LOCK_RAND2 to synchronize access to 'locking_thread'. This is necessary on systems where access to 'locking_thread' (an 'unsigned long' variable) is not atomic. [Bodo Moeller] *) In crypto/rand/md_rand.c, set 'locking_thread' to current thread's ID *before* setting the 'crypto_lock_rand' flag. The previous code had a race condition if 0 is a valid thread ID. [Travis Vitek ] *) Add support for shared libraries under Irix. [Albert Chin-A-Young ] *) Add configuration option to build on Linux on both big-endian and little-endian MIPS. [Ralf Baechle ] *) Add the possibility to create shared libraries on HP-UX. [Richard Levitte] 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 Markku-Juhani O. Saarinen : PRNG state recovery was possible based on the output of one PRNG request appropriately sized to gain knowledge on 'md' followed by enough consecutive 1-byte PRNG requests to traverse all of 'state'. 1. When updating 'md_local' (the current thread's copy of 'md') during PRNG output generation, hash all of the previous 'md_local' value, not just the half used for PRNG output. 2. Make the number of bytes from 'state' included into the hash independent from the number of PRNG bytes requested. The first measure alone would be sufficient to avoid Markku-Juhani's attack. (Actually it had never occurred to me that the half of 'md_local' used for chaining was the half from which PRNG output bytes were taken -- I had always assumed that the secret half would be used.) The second measure makes sure that additional data from 'state' is never mixed into 'md_local' in small portions; this heuristically further strengthens the PRNG. [Bodo Moeller] *) Fix crypto/bn/asm/mips3.s. [Andy Polyakov] *) When only the key is given to "enc", the IV is undefined. Print out an error message in this case. [Lutz Jaenicke] *) Handle special case when X509_NAME is empty in X509 printing routines. [Steve Henson] *) In dsa_do_verify (crypto/dsa/dsa_ossl.c), verify that r and s are positive and less than q. [Bodo Moeller] *) 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. [Paul Rose ] *) Verify that incoming data obeys the block size in ssl3_enc (ssl/s3_enc.c) and tls1_enc (ssl/t1_enc.c). [Bodo Moeller] *) Fix OAEP check. [Ulf Möller, Bodo Möller] *) The countermeasure against Bleichbacher's attack on PKCS #1 v1.5 RSA encryption was accidentally removed in s3_srvr.c in OpenSSL 0.9.5 when fixing the server behaviour for backwards-compatible 'client hello' messages. (Note that the attack is impractical against SSL 3.0 and TLS 1.0 anyway because length and version checking means that the probability of guessing a valid ciphertext is around 2^-40; see section 5 in Bleichenbacher's CRYPTO '98 paper.) Before 0.9.5, the countermeasure (hide the error by generating a random 'decryption result') did not work properly because ERR_clear_error() was missing, meaning that SSL_get_error() would detect the supposedly ignored error. Both problems are now fixed. [Bodo Moeller] *) In crypto/bio/bf_buff.c, increase DEFAULT_BUFFER_SIZE to 4096 (previously it was 1024). [Bodo Moeller] *) Fix for compatibility mode trust settings: ignore trust settings unless some valid trust or reject settings are present. [Steve Henson] *) Fix for blowfish EVP: its a variable length cipher. [Steve Henson] *) Fix various bugs related to DSA S/MIME verification. Handle missing parameters in DSA public key structures and return an error in the DSA routines if parameters are absent. [Steve Henson] *) In versions up to 0.9.6, RAND_file_name() resorted to file ".rnd" in the current directory if neither $RANDFILE nor $HOME was set. RAND_file_name() in 0.9.6a returned NULL in this case. This has caused some confusion to Windows users who haven't defined $HOME. Thus RAND_file_name() is changed again: e_os.h can define a DEFAULT_HOME, which will be used if $HOME is not set. For Windows, we use "C:"; on other platforms, we still require environment variables. *) Move 'if (!initialized) RAND_poll()' into regions protected by CRYPTO_LOCK_RAND. This is not strictly necessary, but avoids having multiple threads call RAND_poll() concurrently. [Bodo Moeller] *) In crypto/rand/md_rand.c, replace 'add_do_not_lock' flag by a combination of a flag and a thread ID variable. Otherwise while one thread is in ssleay_rand_bytes (which sets the flag), *other* threads can enter ssleay_add_bytes without obeying the CRYPTO_LOCK_RAND lock (and may even illegally release the lock that they do not hold after the first thread unsets add_do_not_lock). [Bodo Moeller] *) Change bctest again: '-x' expressions are not available in all versions of 'test'. [Bodo Moeller] Changes between 0.9.6 and 0.9.6a [5 Apr 2001] *) Fix a couple of memory leaks in PKCS7_dataDecode() [Steve Henson, reported by Heyun Zheng ] *) Change Configure and Makefiles to provide EXE_EXT, which will contain the default extension for executables, if any. Also, make the perl scripts that use symlink() to test if it really exists and use "cp" if it doesn't. All this made OpenSSL compilable and installable in CygWin. [Richard Levitte] *) Fix for asn1_GetSequence() for indefinite length constructed data. If SEQUENCE is length is indefinite just set c->slen to the total amount of data available. [Steve Henson, reported by shige@FreeBSD.org] [This change does not apply to 0.9.7.] *) Change bctest to avoid here-documents inside command substitution (workaround for FreeBSD /bin/sh bug). For compatibility with Ultrix, avoid shell functions (introduced in the bctest version that searches along $PATH). [Bodo Moeller] *) Rename 'des_encrypt' to 'des_encrypt1'. This avoids the clashes with des_encrypt() defined on some operating systems, like Solaris and UnixWare. [Richard Levitte] *) 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). [Ulf Moeller] *) MIPS assembler BIGNUM division bug fix. [Andy Polyakov] *) Disabled incorrect Alpha assembler code. [Richard Levitte] *) Fix PKCS#7 decode routines so they correctly update the length after reading an EOC for the EXPLICIT tag. [Steve Henson] [This change does not apply to 0.9.7.] *) Fix bug in PKCS#12 key generation routines. This was triggered if a 3DES key was generated with a 0 initial byte. Include PKCS12_BROKEN_KEYGEN compilation option to retain the old (but broken) behaviour. [Steve Henson] *) Enhance bctest to search for a working bc along $PATH and print it when found. [Tim Rice via Richard Levitte] *) Fix memory leaks in err.c: free err_data string if necessary; don't write to the wrong index in ERR_set_error_data. [Bodo Moeller] *) Implement ssl23_peek (analogous to ssl23_read), which previously did not exist. [Bodo Moeller] *) Replace rdtsc with _emit statements for VC++ version 5. [Jeremy Cooper ] *) Make it possible to reuse SSLv2 sessions. [Richard Levitte] *) In copy_email() check for >= 0 as a return value for X509_NAME_get_index_by_NID() since 0 is a valid index. [Steve Henson reported by Massimiliano Pala ] *) Avoid coredump with unsupported or invalid public keys by checking if X509_get_pubkey() fails in PKCS7_verify(). Fix memory leak when PKCS7_verify() fails with non detached data. [Steve Henson] *) Don't use getenv in library functions when run as setuid/setgid. New function OPENSSL_issetugid(). [Ulf Moeller] *) Avoid false positives in memory leak detection code (crypto/mem_dbg.c) due to incorrect handling of multi-threading: 1. Fix timing glitch in the MemCheck_off() portion of CRYPTO_mem_ctrl(). 2. Fix logical glitch in is_MemCheck_on() aka CRYPTO_is_mem_check_on(). 3. Count how many times MemCheck_off() has been called so that nested use can be treated correctly. This also avoids inband-signalling in the previous code (which relied on the assumption that thread ID 0 is impossible). [Bodo Moeller] *) Add "-rand" option also to s_client and s_server. [Lutz Jaenicke] *) Fix CPU detection on Irix 6.x. [Kurt Hockenbury and "Bruce W. Forsberg" ] *) Fix X509_NAME bug which produced incorrect encoding if X509_NAME was empty. [Steve Henson] [This change does not apply to 0.9.7.] *) Use the cached encoding of an X509_NAME structure rather than copying it. This is apparently the reason for the libsafe "errors" but the code is actually correct. [Steve Henson] *) Add new function BN_rand_range(), and fix DSA_sign_setup() to prevent Bleichenbacher's DSA attack. Extend BN_[pseudo_]rand: As before, top=1 forces the highest two bits to be set and top=0 forces the highest bit to be set; top=-1 is new and leaves the highest bit random. [Ulf Moeller, Bodo Moeller] *) 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). Instead, use NULL for the CONF pointer in CONF_get_string and CONF_get_number (which may use environment variables) and directly return NULL from CONF_get_section. [Bodo Moeller] *) Fix potential buffer overrun for EBCDIC. [Ulf Moeller] *) Tolerate nonRepudiation as being valid for S/MIME signing and certSign keyUsage if basicConstraints absent for a CA. [Steve Henson] *) Make SMIME_write_PKCS7() write mail header values with a format that is more generally accepted (no spaces before the semicolon), since some programs can't parse those values properly otherwise. Also make sure BIO's that break lines after each write do not create invalid headers. [Richard Levitte] *) Make the CRL encoding routines work with empty SEQUENCE OF. The macros previously used would not encode an empty SEQUENCE OF and break the signature. [Steve Henson] [This change does not apply to 0.9.7.] *) Zero the premaster secret after deriving the master secret in DH ciphersuites. [Steve Henson] *) Add some EVP_add_digest_alias registrations (as found in OpenSSL_add_all_digests()) to SSL_library_init() aka OpenSSL_add_ssl_algorithms(). This provides improved compatibility with peers using X.509 certificates with unconventional AlgorithmIdentifier OIDs. [Bodo Moeller] *) Fix for Irix with NO_ASM. ["Bruce W. Forsberg" ] *) ./config script fixes. [Ulf Moeller, Richard Levitte] *) Fix 'openssl passwd -1'. [Bodo Moeller] *) Change PKCS12_key_gen_asc() so it can cope with non null terminated strings whose length is passed in the passlen parameter, for example from PEM callbacks. This was done by adding an extra length parameter to asc2uni(). [Steve Henson, reported by ] *) Fix C code generated by 'openssl dsaparam -C': If a BN_bin2bn call failed, free the DSA structure. [Bodo Moeller] *) Fix to uni2asc() to cope with zero length Unicode strings. These are present in some PKCS#12 files. [Steve Henson] *) Increase s2->wbuf allocation by one byte in ssl2_new (ssl/s2_lib.c). Otherwise do_ssl_write (ssl/s2_pkt.c) will write beyond buffer limits when writing a 32767 byte record. [Bodo Moeller; problem reported by Eric Day ] *) 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], so they are meant to be shared between threads.) [Bodo Moeller, Geoff Thorpe; original patch submitted by "Reddie, Steven" ] *) Fix a deadlock in CRYPTO_mem_leaks(). [Bodo Moeller] *) Use better test patterns in bntest. [Ulf Möller] *) rand_win.c fix for Borland C. [Ulf Möller] *) BN_rshift bugfix for n == 0. [Bodo Moeller] *) Add a 'bctest' script that checks for some known 'bc' bugs so that 'make test' does not abort just because 'bc' is broken. [Bodo Moeller] *) Store verify_result within SSL_SESSION also for client side to avoid potential security hole. (Re-used sessions on the client side always resulted in verify_result==X509_V_OK, not using the original result of the server certificate verification.) [Lutz Jaenicke] *) Fix ssl3_pending: If the record in s->s3->rrec is not of type SSL3_RT_APPLICATION_DATA, return 0. Similarly, change ssl2_pending to return 0 if SSL_in_init(s) is true. [Bodo Moeller] *) Fix SSL_peek: Both ssl2_peek and ssl3_peek, which were totally broken in earlier releases, have been re-implemented by renaming the previous implementations of ssl2_read and ssl3_read to ssl2_read_internal and ssl3_read_internal, respectively, and adding 'peek' parameters to them. The new ssl[23]_{read,peek} functions are calls to ssl[23]_read_internal with the 'peek' flag set appropriately. A 'peek' parameter has also been added to ssl3_read_bytes, which does the actual work for ssl3_read_internal. [Bodo Moeller] *) Initialise "ex_data" member of RSA/DSA/DH structures prior to calling the method-specific "init()" handler. Also clean up ex_data after calling the method-specific "finish()" handler. Previously, this was happening the other way round. [Geoff Thorpe] *) Increase BN_CTX_NUM (the number of BIGNUMs in a BN_CTX) to 16. The previous value, 12, was not always sufficient for BN_mod_exp(). [Bodo Moeller] *) Make sure that shared libraries get the internal name engine with the full version number and not just 0. This should mark the shared libraries as not backward compatible. Of course, this should be changed again when we can guarantee backward binary compatibility. [Richard Levitte] *) Fix typo in get_cert_by_subject() in by_dir.c [Jean-Marc Desperrier ] *) Rework the system to generate shared libraries: - Make note of the expected extension for the shared libraries and if there is a need for symbolic links from for example libcrypto.so.0 to libcrypto.so.0.9.7. There is extended info in Configure for that. - Make as few rebuilds of the shared libraries as possible. - Still avoid linking the OpenSSL programs with the shared libraries. - When installing, install the shared libraries separately from the static ones. [Richard Levitte] *) Fix SSL_CTX_set_read_ahead macro to actually use its argument. Copy SSL_CTX's read_ahead flag to SSL object directly in SSL_new and not in SSL_clear because the latter is also used by the accept/connect functions; previously, the settings made by SSL_set_read_ahead would be lost during the handshake. [Bodo Moeller; problems reported by Anders Gertz ] *) Correct util/mkdef.pl to be selective about disabled algorithms. Previously, it would create entries for disableed algorithms no matter what. [Richard Levitte] *) Added several new manual pages for SSL_* function. [Lutz Jaenicke] 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 first two bytes of the ClientHello message, i.e. client_version. (Note that this is a pathologic case that probably has never happened in real life.) The previous approach was to use the version number from the record header as a substitute; but our protocol choice should not depend on that one because it is not authenticated by the Finished messages. [Bodo Moeller] *) More robust randomness gathering functions for Windows. [Jeffrey Altman ] *) For compatibility reasons if the flag X509_V_FLAG_ISSUER_CHECK is not set then we don't setup the error code for issuer check errors to avoid possibly overwriting other errors which the callback does handle. If an application does set the flag then we assume it knows what it is doing and can handle the new informational codes appropriately. [Steve Henson] *) Fix for a nasty bug in ASN1_TYPE handling. ASN1_TYPE is used for a general "ANY" type, as such it should be able to decode anything including tagged types. However it didn't check the class so it would wrongly interpret tagged types in the same way as their universal counterpart and unknown types were just rejected. Changed so that the tagged and unknown types are handled in the same way as a SEQUENCE: that is the encoding is stored intact. There is also a new type "V_ASN1_OTHER" which is used when the class is not universal, in this case we have no idea what the actual type is so we just lump them all together. [Steve Henson] *) On VMS, stdout may very well lead to a file that is written to in a record-oriented fashion. That means that every write() will write a separate record, which will be read separately by the programs trying to read from it. This can be very confusing. The solution is to put a BIO filter in the way that will buffer text until a linefeed is reached, and then write everything a line at a time, so every record written will be an actual line, not chunks of lines and not (usually doesn't happen, but I've seen it once) several lines in one record. BIO_f_linebuffer() is the answer. Currently, it's a VMS-only method, because that's where it has been tested well enough. [Richard Levitte] *) Remove 'optimized' squaring variant in BN_mod_mul_montgomery, it can return incorrect results. (Note: The buggy variant was not enabled in OpenSSL 0.9.5a, but it was in 0.9.6-beta[12].) [Bodo Moeller] *) Disable the check for content being present when verifying detached signatures in pk7_smime.c. Some versions of Netscape (wrongly) include zero length content when signing messages. [Steve Henson] *) New BIO_shutdown_wr macro, which invokes the BIO_C_SHUTDOWN_WR BIO_ctrl (for BIO pairs). [Bodo Möller] *) Add DSO method for VMS. [Richard Levitte] *) Bug fix: Montgomery multiplication could produce results with the wrong sign. [Ulf Möller] *) Add RPM specification openssl.spec and modify it to build three packages. The default package contains applications, application documentation and run-time libraries. The devel package contains include files, static libraries and function documentation. The doc package contains the contents of the doc directory. The original openssl.spec was provided by Damien Miller . [Richard Levitte] *) Add a large number of documentation files for many SSL routines. [Lutz Jaenicke ] *) Add a configuration entry for Sony News 4. [NAKAJI Hiroyuki ] *) Don't set the two most significant bits to one when generating a random number < q in the DSA library. [Ulf Möller] *) New SSL API mode 'SSL_MODE_AUTO_RETRY'. This disables the default behaviour that SSL_read may result in SSL_ERROR_WANT_READ (even if the underlying transport is blocking) if a handshake took place. (The default behaviour is needed by applications such as s_client and s_server that use select() to determine when to use SSL_read; but for applications that know in advance when to expect data, it just makes things more complicated.) [Bodo Moeller] *) Add RAND_egd_bytes(), which gives control over the number of bytes read from EGD. [Ben Laurie] *) Add a few more EBCDIC conditionals that make `req' and `x509' work better on such systems. [Martin Kraemer ] *) Add two demo programs for PKCS12_parse() and PKCS12_create(). Update PKCS12_parse() so it copies the friendlyName and the keyid to the certificates aux info. [Steve Henson] *) Fix bug in PKCS7_verify() which caused an infinite loop if there was more than one signature. [Sven Uszpelkat ] *) Major change in util/mkdef.pl to include extra information about each symbol, as well as presentig variables as well as functions. This change means that there's n more need to rebuild the .num files when some algorithms are excluded. [Richard Levitte] *) Allow the verify time to be set by an application, rather than always using the current time. [Steve Henson] *) Phase 2 verify code reorganisation. The certificate verify code now looks up an issuer certificate by a number of criteria: subject name, authority key id and key usage. It also verifies self signed certificates by the same criteria. The main comparison function is X509_check_issued() which performs these checks. Lot of changes were necessary in order to support this without completely rewriting the lookup code. Authority and subject key identifier are now cached. The LHASH 'certs' is X509_STORE has now been replaced by a STACK_OF(X509_OBJECT). This is mainly because an LHASH can't store or retrieve multiple objects with the same hash value. As a result various functions (which were all internal use only) have changed to handle the new X509_STORE structure. This will break anything that messed round with X509_STORE internally. The functions X509_STORE_add_cert() now checks for an exact match, rather than just subject name. The X509_STORE API doesn't directly support the retrieval of multiple certificates matching a given criteria, however this can be worked round by performing a lookup first (which will fill the cache with candidate certificates) and then examining the cache for matches. This is probably the best we can do without throwing out X509_LOOKUP entirely (maybe later...). The X509_VERIFY_CTX structure has been enhanced considerably. All certificate lookup operations now go via a get_issuer() callback. Although this currently uses an X509_STORE it can be replaced by custom lookups. This is a simple way to bypass the X509_STORE hackery necessary to make this work and makes it possible to use more efficient techniques in future. A very simple version which uses a simple STACK for its trusted certificate store is also provided using X509_STORE_CTX_trusted_stack(). The verify_cb() and verify() callbacks now have equivalents in the X509_STORE_CTX structure. X509_STORE_CTX also has a 'flags' field which can be used to customise the verify behaviour. [Steve Henson] *) Add new PKCS#7 signing option PKCS7_NOSMIMECAP which excludes S/MIME capabilities. [Steve Henson] *) When a certificate request is read in keep a copy of the original encoding of the signed data and use it when outputing again. Signatures then use the original encoding rather than a decoded, encoded version which may cause problems if the request is improperly encoded. [Steve Henson] *) For consistency with other BIO_puts implementations, call buffer_write(b, ...) directly in buffer_puts instead of calling BIO_write(b, ...). In BIO_puts, increment b->num_write as in BIO_write. [Peter.Sylvester@EdelWeb.fr] *) Fix BN_mul_word for the case where the word is 0. (We have to use BN_zero, we may not return a BIGNUM with an array consisting of words set to zero.) [Bodo Moeller] *) Avoid calling abort() from within the library when problems are detected, except if preprocessor symbols have been defined (such as REF_CHECK, BN_DEBUG etc.). [Bodo Moeller] *) New openssl application 'rsautl'. This utility can be used for low level RSA operations. DER public key BIO/fp routines also added. [Steve Henson] *) New Configure entry and patches for compiling on QNX 4. [Andreas Schneider ] *) A demo state-machine implementation was sponsored by Nuron (http://www.nuron.com/) and is now available in demos/state_machine. [Ben Laurie] *) New options added to the 'dgst' utility for signature generation and verification. [Steve Henson] *) Unrecognized PKCS#7 content types are now handled via a catch all ASN1_TYPE structure. This allows unsupported types to be stored as a "blob" and an application can encode and decode it manually. [Steve Henson] *) Fix various signed/unsigned issues to make a_strex.c compile under VC++. [Oscar Jacobsson ] *) ASN1 fixes. i2d_ASN1_OBJECT was not returning the correct length if passed a buffer. ASN1_INTEGER_to_BN failed if passed a NULL BN and its argument was negative. [Steve Henson, pointed out by Sven Heiberg ] *) Modification to PKCS#7 encoding routines to output definite length encoding. Since currently the whole structures are in memory there's not real point in using indefinite length constructed encoding. However if OpenSSL is compiled with the flag PKCS7_INDEFINITE_ENCODING the old form is used. [Steve Henson] *) Added BIO_vprintf() and BIO_vsnprintf(). [Richard Levitte] *) Added more prefixes to parse for in the the strings written through a logging bio, to cover all the levels that are available through syslog. The prefixes are now: PANIC, EMERG, EMR => LOG_EMERG ALERT, ALR => LOG_ALERT CRIT, CRI => LOG_CRIT ERROR, ERR => LOG_ERR WARNING, WARN, WAR => LOG_WARNING NOTICE, NOTE, NOT => LOG_NOTICE INFO, INF => LOG_INFO DEBUG, DBG => LOG_DEBUG 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: 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 argument "reconf" or "reconfigure". The command line arguments are stored in Makefile.ssl in the variable CONFIGURE_ARGS, and are retrieved from there when reconfiguring. [Richard Levitte] *) MD4 implemented. [Assar Westerlund , Richard Levitte] *) Add the arguments -CAfile and -CApath to the pkcs12 utility. [Richard Levitte] *) The obj_dat.pl script was messing up the sorting of object names. The reason was that it compared the quoted version of strings as a result "OCSP" > "OCSP Signing" because " > SPACE. Changed script to store unquoted versions of names and add quotes on output. It was also omitting some names from the lookup table if they were given a default value (that is if SN is missing it is given the same value as LN and vice versa), these are now added on the grounds that if an object has a name we should be able to look it up. Finally added warning output when duplicate short or long names are found. [Steve Henson] *) Changes needed for Tandem NSK. [Scott Uroff ] *) Fix SSL 2.0 rollback checking: Due to an off-by-one error in RSA_padding_check_SSLv23(), special padding was never detected and thus the SSL 3.0/TLS 1.0 countermeasure against protocol version rollback attacks was not effective. In s23_clnt.c, don't use special rollback-attack detection padding (RSA_SSLV23_PADDING) if SSL 2.0 is the only protocol enabled in the client; similarly, in s23_srvr.c, don't do the rollback check if SSL 2.0 is the only protocol enabled in the server. [Bodo Moeller] *) Make it possible to get hexdumps of unprintable data with 'openssl asn1parse'. By implication, the functions ASN1_parse_dump() and BIO_dump_indent() are added. [Richard Levitte] *) New functions ASN1_STRING_print_ex() and X509_NAME_print_ex() these print out strings and name structures based on various flags including RFC2253 support and proper handling of multibyte characters. Added options to the 'x509' utility to allow the various flags to be set. [Steve Henson] *) Various fixes to use ASN1_TIME instead of ASN1_UTCTIME. Also change the functions X509_cmp_current_time() and X509_gmtime_adj() work with an ASN1_TIME structure, this will enable certificates using GeneralizedTime in validity dates to be checked. [Steve Henson] *) Make the NEG_PUBKEY_BUG code (which tolerates invalid negative public key encodings) on by default, NO_NEG_PUBKEY_BUG can be set to disable it. [Steve Henson] *) New function c2i_ASN1_OBJECT() which acts on ASN1_OBJECT content octets. An i2c_ASN1_OBJECT is unnecessary because the encoding can be trivially obtained from the structure. [Steve Henson] *) crypto/err.c locking bugfix: Use write locks (CRYPTO_w_[un]lock), not read locks (CRYPTO_r_[un]lock). [Bodo Moeller] *) A first attempt at creating official support for shared libraries through configuration. I've kept it so the default is static libraries only, and the OpenSSL programs are always statically linked for now, but there are preparations for dynamic linking in place. This has been tested on Linux and Tru64. [Richard Levitte] *) Randomness polling function for Win9x, as described in: Peter Gutmann, Software Generation of Practically Strong Random Numbers. [Ulf Möller] *) Fix so PRNG is seeded in req if using an already existing DSA key. [Steve Henson] *) New options to smime application. -inform and -outform allow alternative formats for the S/MIME message including PEM and DER. The -content option allows the content to be specified separately. This should allow things like Netscape form signing output easier to verify. [Steve Henson] *) Fix the ASN1 encoding of tags using the 'long form'. [Steve Henson] *) 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 are needed because all other string types have virtually identical handling apart from the tag. By having versions of the ASN1 functions that just operate on content octets IMPLICIT tagging can be handled properly. It also allows the ASN1_ENUMERATED code to be cut down because ASN1_ENUMERATED and ASN1_INTEGER are identical apart from the tag. [Steve Henson] *) Change the handling of OID objects as follows: - New object identifiers are inserted in objects.txt, following the syntax given in objects.README. - objects.pl is used to process obj_mac.num and create a new obj_mac.h. - obj_dat.pl is used to create a new obj_dat.h, using the data in obj_mac.h. This is currently kind of a hack, and the perl code in objects.pl isn't very elegant, but it works as I intended. The simplest way to check that it worked correctly is to look in obj_dat.h and check the array nid_objs and make sure the objects haven't moved around (this is important!). Additions are OK, as well as consistent name changes. [Richard Levitte] *) Add BSD-style MD5-based passwords to 'openssl passwd' (option '-1'). [Bodo Moeller] *) Addition of the command line parameter '-rand file' to 'openssl req'. The given file adds to whatever has already been seeded into the random pool through the RANDFILE configuration file option or environment variable, or the default random state file. [Richard Levitte] *) mkstack.pl now sorts each macro group into lexical order. Previously the output order depended on the order the files appeared in the directory, resulting in needless rewriting of safestack.h . [Steve Henson] *) Patches to make OpenSSL compile under Win32 again. Mostly work arounds for the VC++ problem that it treats func() as func(void). Also stripped out the parts of mkdef.pl that added extra typesafe functions: these no longer exist. [Steve Henson] *) 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_(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 then the non typesafe macros are used instead. Also modified the mkstack.pl script to handle the new form. Needs testing to see if which (if any) compilers it chokes and maybe make DEBUG_SAFESTACK the default if no major problems. Similar behaviour for ASN1_SET_OF and PKCS12_STACK_OF. [Steve Henson] *) When some versions of IIS use the 'NET' form of private key the key derivation algorithm is different. Normally MD5(password) is used as a 128 bit RC4 key. In the modified case MD5(MD5(password) + "SGCKEYSALT") is used insted. Added some new functions i2d_RSA_NET(), d2i_RSA_NET() etc which are the same as the old Netscape_RSA functions except they have an additional 'sgckey' parameter which uses the modified algorithm. Also added an -sgckey command line option to the rsa utility. Thanks to Adrian Peck for posting details of the modified algorithm to openssl-dev. [Steve Henson] *) The evp_local.h macros were using 'c.##kname' which resulted in invalid expansion on some systems (SCO 5.0.5 for example). Corrected to 'c.kname'. [Phillip Porch ] *) New X509_get1_email() and X509_REQ_get1_email() functions that return a STACK of email addresses from a certificate or request, these look in the subject name and the subject alternative name extensions and omit any duplicate addresses. [Steve Henson] *) Re-implement BN_mod_exp2_mont using independent (and larger) windows. This makes DSA verification about 2 % faster. [Bodo Moeller] *) 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 exponents (as measured by "openssl speed rsa2048"). [Bodo Moeller] *) Rename memory handling macros to avoid conflicts with other software: Malloc => OPENSSL_malloc Malloc_locked => OPENSSL_malloc_locked Realloc => OPENSSL_realloc Free => OPENSSL_free [Richard Levitte] *) New function BN_mod_exp_mont_word for small bases (roughly 15% faster than BN_mod_exp_mont, i.e. 7% for a full DH exchange). [Bodo Moeller] *) CygWin32 support. [John Jarvie ] *) The type-safe stack code has been rejigged. It is now only compiled in when OpenSSL is configured with the DEBUG_SAFESTACK option and by default all type-specific stack functions are "#define"d back to standard stack functions. This results in more streamlined output but retains the type-safety checking possibilities of the original approach. [Geoff Thorpe] *) The STACK code has been cleaned up, and certain type declarations that didn't make a lot of sense have been brought in line. This has 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 be prototyped with "const" parameters anyway. [Geoff Thorpe] *) When generating bytes for the first time in md_rand.c, 'stir the pool' by seeding with STATE_SIZE dummy bytes (with zero entropy count). (The PRNG state consists of two parts, the large pool 'state' and 'md', where all of 'md' is used each time the PRNG is used, but 'state' is used only indexed by a cyclic counter. As entropy may not be well distributed from the beginning, 'md' is important as a chaining variable. However, the output function chains only half of 'md', i.e. 80 bits. ssleay_rand_add, on the other hand, chains all of 'md', and seeding with STATE_SIZE dummy bytes will result in all of 'state' being rewritten, with the new values depending on virtually all of 'md'. This overcomes the 80 bit limitation.) [Bodo Moeller] *) In ssl/s2_clnt.c and ssl/s3_clnt.c, call ERR_clear_error() when the handshake is continued after ssl_verify_cert_chain(); otherwise, if SSL_VERIFY_NONE is set, remaining error codes can lead to 'unexplainable' connection aborts later. [Bodo Moeller; problem tracked down by Lutz Jaenicke] *) Major EVP API cipher revision. Add hooks for extra EVP features. This allows various cipher parameters to be set in the EVP interface. Support added for variable key length ciphers via the EVP_CIPHER_CTX_set_key_length() function and setting of RC2 and RC5 parameters. Modify EVP_OpenInit() and EVP_SealInit() to cope with variable key length ciphers. Remove lots of duplicated code from the EVP library. For example *every* cipher init() function handles the 'iv' in the same way according to the cipher mode. They also all do nothing if the 'key' parameter is NULL and for CFB and OFB modes they zero ctx->num. New functionality allows removal of S/MIME code RC2 hack. Most of the routines have the same form and so can be declared in terms of macros. By shifting this to the top level EVP_CipherInit() it can be removed from all individual ciphers. If the cipher wants to handle IVs or keys differently it can set the EVP_CIPH_CUSTOM_IV or EVP_CIPH_ALWAYS_CALL_INIT flags. Change lots of functions like EVP_EncryptUpdate() to now return a value: although software versions of the algorithms cannot fail any installed hardware versions can. [Steve Henson] *) Implement SSL_OP_TLS_ROLLBACK_BUG: In ssl3_get_client_key_exchange, if this option is set, tolerate broken clients that send the negotiated protocol version number instead of the requested protocol version number. [Bodo Moeller] *) 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). [Bodo Moeller; problem reported by Amit Chopra] *) Add missing DSA library text string. Work around for some IIS key files with invalid SEQUENCE encoding. [Steve Henson] *) Add a document (doc/standards.txt) that list all kinds of standards and so on that are implemented in OpenSSL. [Richard Levitte] *) Enhance c_rehash script. Old version would mishandle certificates with the same subject name hash and wouldn't handle CRLs at all. Added -fingerprint option to crl utility, to support new c_rehash features. [Steve Henson] *) Eliminate non-ANSI declarations in crypto.h and stack.h. [Ulf Möller] *) Fix for SSL server purpose checking. Server checking was rejecting certificates which had extended key usage present but no ssl client purpose. [Steve Henson, reported by Rene Grosser ] *) Make PKCS#12 code work with no password. The PKCS#12 spec is a little unclear about how a blank password is handled. Since the password in encoded as a BMPString with terminating double NULL a zero length password would end up as just the double NULL. However no password at all is different and is handled differently in the PKCS#12 key generation code. NS treats a blank password as zero length. MSIE treats it as no password on export: but it will try both on import. We now do the same: PKCS12_parse() tries zero length and no password if the password is set to "" or NULL (NULL is now a valid password: it wasn't before) as does the pkcs12 application. [Steve Henson] *) Bugfixes in apps/x509.c: Avoid a memory leak; and don't use perror when PEM_read_bio_X509_REQ fails, the error message must be obtained from the error queue. [Bodo Moeller] *) Avoid 'thread_hash' memory leak in crypto/err/err.c by freeing it in ERR_remove_state if appropriate, and change ERR_get_state accordingly to avoid race conditions (this is necessary because thread_hash is no longer constant once set). [Bodo Moeller] *) Bugfix for linux-elf makefile.one. [Ulf Möller] *) RSA_get_default_method() will now cause a default RSA_METHOD to be chosen if one doesn't exist already. Previously this was only set during a call to RSA_new() or RSA_new_method(NULL) meaning it was possible for RSA_get_default_method() to return NULL. [Geoff Thorpe] *) Added native name translation to the existing DSO code that will convert (if the flag to do so is set) filenames that are sufficiently small and have no path information into a canonical native form. Eg. "blah" converted to "libblah.so" or "blah.dll" etc. [Geoff Thorpe] *) New function ERR_error_string_n(e, buf, len) which is like ERR_error_string(e, buf), but writes at most 'len' bytes including the 0 terminator. For ERR_error_string_n, 'buf' may not be NULL. [Damien Miller , Bodo Moeller] *) 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 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_*, or "the configuration storage API"... The new configuration file reading functions are: NCONF_new, NCONF_free, NCONF_load, NCONF_load_fp, NCONF_load_bio, NCONF_get_section, NCONF_get_string, NCONF_get_numbre NCONF_default, NCONF_WIN32 NCONF_dump_fp, NCONF_dump_bio 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, which is useful for debugging. All other functions take the same arguments as the old CONF_* functions wth the exception of the first that must be a `CONF *' instead of a `LHASH *'. To make it easer to use the new classes with the old CONF_* functions, the function CONF_set_default_method is provided. [Richard Levitte] *) Add '-tls1' option to 'openssl ciphers', which was already mentioned in the documentation but had not been implemented. (This option is not yet really useful because even the additional experimental TLS 1.0 ciphers are currently treated as SSL 3.0 ciphers.) [Bodo Moeller] *) Initial DSO code added into libcrypto for letting OpenSSL (and OpenSSL-based applications) load shared libraries and bind to them in a portable way. [Geoff Thorpe, with contributions from Richard Levitte] Changes between 0.9.5 and 0.9.5a [1 Apr 2000] *) Make sure _lrotl and _lrotr are only used with MSVC. *) Use lock CRYPTO_LOCK_RAND correctly in ssleay_rand_status (the default implementation of RAND_status). *) Rename openssl x509 option '-crlext', which was added in 0.9.5, to '-clrext' (= clear extensions), as intended and documented. [Bodo Moeller; inconsistency pointed out by Michael Attili ] *) Fix for HMAC. It wasn't zeroing the rest of the block if the key length was larger than the MD block size. [Steve Henson, pointed out by Yost William ] *) Modernise PKCS12_parse() so it uses STACK_OF(X509) for its ca argument fix a leak when the ca argument was passed as NULL. Stop X509_PUBKEY_set() using the passed key: if the passed key was a private key the result of X509_print(), for example, would be to print out all the private key components. [Steve Henson] *) 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 ] *) Fix so V_ASN1_APP_CHOOSE works again: however its use is strongly discouraged. [Steve Henson, pointed out by Brian Korver ] *) For easily testing in shell scripts whether some command 'openssl XXX' exists, the new pseudo-command 'openssl no-XXX' returns with exit code 0 iff no command of the given name is available. 'no-XXX' is printed in this case, 'XXX' otherwise. In both cases, the output goes to stdout and nothing is printed to stderr. Additional arguments are always ignored. Since for each cipher there is a command of the same name, the 'no-cipher' compilation switches can be tested this way. ('openssl no-XXX' is not able to detect pseudo-commands such as 'quit', 'list-XXX-commands', or 'no-XXX' itself.) [Bodo Moeller] *) Update test suite so that 'make test' succeeds in 'no-rsa' configuration. [Bodo Moeller] *) For SSL_[CTX_]set_tmp_dh, don't create a DH key if SSL_OP_SINGLE_DH_USE is set; it will be thrown away anyway because each handshake creates its own key. ssl_cert_dup, which is used by SSL_new, now copies DH keys in addition to parameters -- in previous versions (since OpenSSL 0.9.3) the 'default key' from SSL_CTX_set_tmp_dh would always be lost, meanining you effectivly got SSL_OP_SINGLE_DH_USE when using this macro. [Bodo Moeller] *) New s_client option -ign_eof: EOF at stdin is ignored, and 'Q' and 'R' lose their special meanings (quit/renegotiate). This is part of what -quiet does; unlike -quiet, -ign_eof does not suppress any output. [Richard Levitte] *) Add compatibility options to the purpose and trust code. The purpose X509_PURPOSE_ANY is "any purpose" which automatically accepts a certificate or CA, this was the previous behaviour, with all the associated security issues. X509_TRUST_COMPAT is the old trust behaviour: only and automatically trust self signed roots in certificate store. A new trust setting X509_TRUST_DEFAULT is used to specify that a purpose has no associated trust setting and it should instead use the value in the default purpose. [Steve Henson] *) Fix the PKCS#8 DSA private key code so it decodes keys again and fix a memory leak. [Steve Henson] *) In util/mkerr.pl (which implements 'make errors'), preserve reason strings from the previous version of the .c file, as the default to have only downcase letters (and digits) in automatically generated reasons codes is not always appropriate. [Bodo Moeller] *) In ERR_load_ERR_strings(), build an ERR_LIB_SYS error reason table using strerror. Previously, ERR_reason_error_string() returned library names as reason strings for SYSerr; but SYSerr is a special case where small numbers are errno values, not library numbers. [Bodo Moeller] *) Add '-dsaparam' option to 'openssl dhparam' application. This converts DSA parameters into DH parameters. (When creating parameters, DSA_generate_parameters is used.) [Bodo Moeller] *) Include 'length' (recommended exponent length) in C code generated by 'openssl dhparam -C'. [Bodo Moeller] *) The second argument to set_label in perlasm was already being used so couldn't be used as a "file scope" flag. Moved to third argument which was free. [Steve Henson] *) In PEM_ASN1_write_bio and some other functions, use RAND_pseudo_bytes instead of RAND_bytes for encryption IVs and salts. [Bodo Moeller] *) Include RAND_status() into RAND_METHOD instead of implementing it only for md_rand.c Otherwise replacing the PRNG by calling RAND_set_rand_method would be impossible. [Bodo Moeller] *) Don't let DSA_generate_key() enter an infinite loop if the random number generation fails. [Bodo Moeller] *) New 'rand' application for creating pseudo-random output. [Bodo Moeller] *) Added configuration support for Linux/IA64 [Rolf Haberrecker ] *) Assembler module support for Mingw32. [Ulf Möller] *) Shared library support for HPUX (in shlib/). [Lutz Jaenicke and Anonymous] *) Shared library support for Solaris gcc. [Lutz Behnke ] 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(). [Steve Henson] *) In bntest.c don't call BN_rand with zero bits argument. [Steve Henson, pointed out by Andrew W. Gray ] *) BN_mul bugfix: In bn_mul_part_recursion() only the a>a[n] && b>b[n] case was implemented. This caused BN_div_recp() to fail occasionally. [Ulf Möller] *) Add an optional second argument to the set_label() in the perl assembly language builder. If this argument exists and is set to 1 it signals that the assembler should use a symbol whose scope is the entire file, not just the current function. This is needed with MASM which uses the format label:: for this scope. [Steve Henson, pointed out by Peter Runestig ] *) Change the ASN1 types so they are typedefs by default. Before almost all types were #define'd to ASN1_STRING which was causing STACK_OF() problems: you couldn't declare STACK_OF(ASN1_UTF8STRING) for example. [Steve Henson] *) 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 data structure without incrementing reference counters. (Some of the existing 'get' functions increment a reference counter, some don't.) Similarly, 'set1' and 'add1' functions increase reference counters or duplicate objects. [Steve Henson] *) Allow for the possibility of temp RSA key generation failure: the code used to assume it always worked and crashed on failure. [Steve Henson] *) Fix potential buffer overrun problem in BIO_printf(). [Ulf Möller, using public domain code by Patrick Powell; problem pointed out by David Sacerdote ] *) Support EGD . New functions RAND_egd() and RAND_status(). In the command line application, the EGD socket can be specified like a seed file using RANDFILE or -rand. [Ulf Möller] *) Allow the string CERTIFICATE to be tolerated in PKCS#7 structures. Some CAs (e.g. Verisign) distribute certificates in this form. [Steve Henson] *) Remove the SSL_ALLOW_ADH compile option and set the default cipher list to exclude them. This means that no special compilation option is needed to use anonymous DH: it just needs to be included in the cipher list. [Steve Henson] *) Change the EVP_MD_CTX_type macro so its meaning consistent with EVP_MD_type. The old functionality is available in a new macro called EVP_MD_md(). Change code that uses it and update docs. [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 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] *) (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 must be defined. E.g., #define OPENSSL_ALGORITHM_DEFINES #include defines all pertinent NO_ symbols, such as NO_IDEA, NO_RSA, etc. [Richard Levitte, Ulf and Bodo Möller] *) Bugfix: Tolerate fragmentation and interleaving in the SSL 3/TLS record layer. [Bodo Moeller] *) Change the 'other' type in certificate aux info to a STACK_OF X509_ALGOR. Although not an AlgorithmIdentifier as such it has the required ASN1 format: arbitrary types determined by an OID. [Steve Henson] *) Add some PEM_write_X509_REQ_NEW() functions and a command line argument to 'req'. This is not because the function is newer or better than others it just uses the work 'NEW' in the certificate request header lines. Some software needs this. [Steve Henson] *) Reorganise password command line arguments: now passwords can be obtained from various sources. Delete the PEM_cb function and make it the default behaviour: i.e. if the callback is NULL and the usrdata argument is not NULL interpret it as a null terminated pass phrase. If usrdata and the callback are NULL then the pass phrase is prompted for as usual. [Steve Henson] *) Add support for the Compaq Atalla crypto accelerator. If it is installed, the support is automatically enabled. The resulting binaries will autodetect the card and use it if present. [Ben Laurie and Compaq Inc.] *) Work around for Netscape hang bug. This sends certificate request and server done in one record. Since this is perfectly legal in the SSL/TLS protocol it isn't a "bug" option and is on by default. See the bugs/SSLv3 entry for more info. [Steve Henson] *) HP-UX tune-up: new unified configs, HP C compiler bug workaround. [Andy Polyakov] *) Add -rand argument to smime and pkcs12 applications and read/write of seed file. [Steve Henson] *) New 'passwd' tool for crypt(3) and apr1 password hashes. [Bodo Moeller] *) Add command line password options to the remaining applications. [Steve Henson] *) Bug fix for BN_div_recp() for numerators with an even number of bits. [Ulf Möller] *) More tests in bntest.c, and changed test_bn output. [Ulf Möller] *) ./config recognizes MacOS X now. [Andy Polyakov] *) Bug fix for BN_div() when the first words of num and divsor are equal (it gave wrong results if (rem=(n1-q*d0)&BN_MASK2) < d0). [Ulf Möller] *) Add support for various broken PKCS#8 formats, and command line options to produce them. [Steve Henson] *) New functions BN_CTX_start(), BN_CTX_get() and BT_CTX_end() to get temporary BIGNUMs from a BN_CTX. [Ulf Möller] *) Correct return values in BN_mod_exp_mont() and BN_mod_exp2_mont() for p == 0. [Ulf Möller] *) 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 link with digests. This never worked becayse SSLeay_add_all_digests() and SSLeay_add_all_ciphers() were in the same source file so calling one would link with the other. They are now in separate source files. [Steve Henson] *) Add a new -notext option to 'ca' and a -pubkey option to 'spkac'. [Steve Henson] *) Use a less unusual form of the Miller-Rabin primality test (it used a binary algorithm for exponentiation integrated into the Miller-Rabin loop, our standard modexp algorithms are faster). [Bodo Moeller] *) Support for the EBCDIC character set completed. [Martin Kraemer ] *) Source code cleanups: use const where appropriate, eliminate casts, use void * instead of char * in lhash. [Ulf Möller] *) Bugfix: ssl3_send_server_key_exchange was not restartable (the state was not changed to SSL3_ST_SW_KEY_EXCH_B, and because of this the server could overwrite ephemeral keys that the client has already seen). [Bodo Moeller] *) Turn DSA_is_prime into a macro that calls BN_is_prime, using 50 iterations of the Rabin-Miller test. DSA_generate_parameters now uses BN_is_prime_fasttest (with 50 iterations of the Rabin-Miller test as required by the appendix to FIPS PUB 186[-1]) instead of DSA_is_prime. As BN_is_prime_fasttest includes trial division, DSA parameter generation becomes much faster. This implies a change for the callback functions in DSA_is_prime and DSA_generate_parameters: The callback function is called once for each positive witness in the Rabin-Miller test, not just occasionally in the inner loop; and the parameters to the callback function now provide an iteration count for the outer loop rather than for the current invocation of the inner loop. DSA_generate_parameters additionally can call the callback function with an 'iteration count' of -1, meaning that a candidate has passed the trial division test (when q is generated from an application-provided seed, trial division is skipped). [Bodo Moeller] *) New function BN_is_prime_fasttest that optionally does trial division before starting the Rabin-Miller test and has an additional BN_CTX * argument (whereas BN_is_prime always has to allocate at least one BN_CTX). 'callback(1, -1, cb_arg)' is called when a number has passed the trial division stage. [Bodo Moeller] *) Fix for bug in CRL encoding. The validity dates weren't being handled as ASN1_TIME. [Steve Henson] *) New -pkcs12 option to CA.pl script to write out a PKCS#12 file. [Steve Henson] *) New function BN_pseudo_rand(). [Ulf Möller] *) Clean up BN_mod_mul_montgomery(): replace the broken (and unreadable) bignum version of BN_from_montgomery() with the working code from SSLeay 0.9.0 (the word based version is faster anyway), and clean up the comments. [Ulf Möller] *) Avoid a race condition in s2_clnt.c (function get_server_hello) that made it impossible to use the same SSL_SESSION data structure in SSL2 clients in multiple threads. [Bodo Moeller] *) The return value of RAND_load_file() no longer counts bytes obtained by stat(). RAND_load_file(..., -1) is new and uses the complete file to seed the PRNG (previously an explicit byte count was required). [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. [Steve Henson] *) Make BN_generate_prime() return NULL on error if ret!=NULL. [Ulf Möller] *) Retain source code compatibility for BN_prime_checks macro: BN_is_prime(..., BN_prime_checks, ...) now uses BN_prime_checks_for_size to determine the appropriate number of Rabin-Miller iterations. [Ulf Möller] *) Diffie-Hellman uses "safe" primes: DH_check() return code renamed to DH_CHECK_P_NOT_SAFE_PRIME. (Check if this is true? OpenPGP calls them "strong".) [Ulf Möller] *) Merge the functionality of "dh" and "gendh" programs into a new program "dhparam". The old programs are retained for now but will handle DH keys (instead of parameters) in future. [Steve Henson] *) Make the ciphers, s_server and s_client programs check the return values when a new cipher list is set. [Steve Henson] *) Enhance the SSL/TLS cipher mechanism to correctly handle the TLS 56bit ciphers. Before when the 56bit ciphers were enabled the sorting was wrong. The syntax for the cipher sorting has been extended to support sorting by cipher-strength (using the strength_bits hard coded in the tables). The new command is "@STRENGTH" (see also doc/apps/ciphers.pod). Fix a bug in the cipher-command parser: when supplying a cipher command string with an "undefined" symbol (neither command nor alphanumeric [A-Za-z0-9], ssl_set_cipher_list used to hang in an endless loop. Now an error is flagged. Due to the strength-sorting extension, the code of the ssl_create_cipher_list() function was completely rearranged. I hope that the readability was also increased :-) [Lutz Jaenicke ] *) Minor change to 'x509' utility. The -CAcreateserial option now uses 1 for the first serial number and places 2 in the serial number file. This avoids problems when the root CA is created with serial number zero and the first user certificate has the same issuer name and serial number as the root CA. [Steve Henson] *) Fixes to X509_ATTRIBUTE utilities, change the 'req' program so it uses the new code. Add documentation for this stuff. [Steve Henson] *) Changes to X509_ATTRIBUTE utilities. These have been renamed from X509_*() to X509at_*() on the grounds that they don't handle X509 structures and behave in an analagous way to the X509v3 functions: they shouldn't be called directly but wrapper functions should be used instead. So we also now have some wrapper functions that call the X509at functions when passed certificate requests. (TO DO: similar things can be done with PKCS#7 signed and unsigned attributes, PKCS#12 attributes and a few other things. Some of these need some d2i or i2d and print functionality because they handle more complex structures.) [Steve Henson] *) 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. [Kris Kennaway , modified by Ulf Möller] *) Precautions against using the PRNG uninitialized: RAND_bytes() now has a return value which indicates the quality of the random data (1 = ok, 0 = not seeded). Also an error is recorded on the thread's error queue. New function RAND_pseudo_bytes() generates output that is guaranteed to be unique but not unpredictable. RAND_add is like RAND_seed, but takes an extra argument for an entropy estimate (RAND_seed always assumes full entropy). [Ulf Möller] *) Do more iterations of Rabin-Miller probable prime test (specifically, 3 for 1024-bit primes, 6 for 512-bit primes, 12 for 256-bit primes instead of only 2 for all lengths; see BN_prime_checks_for_size definition in crypto/bn/bn_prime.c for the complete table). This guarantees a false-positive rate of at most 2^-80 for random input. [Bodo Moeller] *) Rewrite ssl3_read_n (ssl/s3_pkt.c) avoiding a couple of bugs. [Bodo Moeller] *) New function X509_CTX_rget_chain() (renamed to X509_CTX_get1_chain in the 0.9.5 release), this returns the chain from an X509_CTX structure with a dup of the stack and all the X509 reference counts upped: so the stack will exist after X509_CTX_cleanup() has been called. Modify pkcs12.c to use this. Also make SSL_SESSION_print() print out the verify return code. [Steve Henson] *) Add manpage for the pkcs12 command. Also change the default behaviour so MAC iteration counts are used unless the new -nomaciter option is used. This improves file security and only older versions of MSIE (4.0 for example) need it. [Steve Henson] *) Honor the no-xxx Configure options when creating .DEF files. [Ulf Möller] *) Add PKCS#10 attributes to field table: challengePassword, unstructuredName and unstructuredAddress. These are taken from draft PKCS#9 v2.0 but are compatible with v1.2 provided no international characters are used. More changes to X509_ATTRIBUTE code: allow the setting of types based on strings. Remove the 'loc' parameter when adding attributes because these will be a SET OF encoding which is sorted in ASN1 order. [Steve Henson] *) Initial changes to the 'req' utility to allow request generation automation. This will allow an application to just generate a template file containing all the field values and have req construct the request. Initial support for X509_ATTRIBUTE handling. Stacks of these are used all over the place including certificate requests and PKCS#7 structures. They are currently handled manually where necessary with some primitive wrappers for PKCS#7. The new functions behave in a manner analogous to the X509 extension functions: they allow attributes to be looked up by NID and added. Later something similar to the X509V3 code would be desirable to automatically handle the encoding, decoding and printing of the more complex types. The string types like challengePassword can be handled by the string table functions. Also modified the multi byte string table handling. Now there is a 'global mask' which masks out certain types. The table itself can use the flag STABLE_NO_MASK to ignore the mask setting: this is useful when for example there is only one permissible type (as in countryName) and using the mask might result in no valid types at all. [Steve Henson] *) Clean up 'Finished' handling, and add functions SSL_get_finished and SSL_get_peer_finished to allow applications to obtain the latest Finished messages sent to the peer or expected from the peer, respectively. (SSL_get_peer_finished is usually the Finished message actually received from the peer, otherwise the protocol will be aborted.) As the Finished message are message digests of the complete handshake (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can be used for external authentication procedures when the authentication provided by SSL/TLS is not desired or is not enough. [Bodo Moeller] *) Enhanced support for Alpha Linux is added. Now ./config checks if the host supports BWX extension and if Compaq C is present on the $PATH. Just exploiting of the BWX extension results in 20-30% performance kick for some algorithms, e.g. DES and RC4 to mention a couple. Compaq C in turn generates ~20% faster code for MD5 and SHA1. [Andy Polyakov] *) Add support for MS "fast SGC". This is arguably a violation of the SSL3/TLS protocol. Netscape SGC does two handshakes: the first with weak crypto and after checking the certificate is SGC a second one with strong crypto. MS SGC stops the first handshake after receiving the server certificate message and sends a second client hello. Since a server will typically do all the time consuming operations before expecting any further messages from the client (server key exchange is the most expensive) there is little difference between the two. To get OpenSSL to support MS SGC we have to permit a second client hello message after we have sent server done. In addition we have to reset the MAC if we do get this second client hello. [Steve Henson] *) Add a function 'd2i_AutoPrivateKey()' this will automatically decide if a DER encoded private key is RSA or DSA traditional format. Changed d2i_PrivateKey_bio() to use it. This is only needed for the "traditional" format DER encoded private key. Newer code should use PKCS#8 format which has the key type encoded in the ASN1 structure. Added DER private key support to pkcs8 application. [Steve Henson] *) SSL 3/TLS 1 servers now don't request certificates when an anonymous ciphersuites has been selected (as required by the SSL 3/TLS 1 specifications). Exception: When SSL_VERIFY_FAIL_IF_NO_PEER_CERT is set, we interpret this as a request to violate the specification (the worst that can happen is a handshake failure, and 'correct' behaviour would result in a handshake failure anyway). [Bodo Moeller] *) In SSL_CTX_add_session, take into account that there might be multiple SSL_SESSION structures with the same session ID (e.g. when two threads concurrently obtain them from an external cache). The internal cache can handle only one SSL_SESSION with a given ID, so if there's a conflict, we now throw out the old one to achieve consistency. [Bodo Moeller] *) Add OIDs for idea and blowfish in CBC mode. This will allow both to be used in PKCS#5 v2.0 and S/MIME. Also add checking to some routines that use cipher OIDs: some ciphers do not have OIDs defined and so they cannot be used for S/MIME and PKCS#5 v2.0 for example. [Steve Henson] *) Simplify the trust setting structure and code. Now we just have two sequences of OIDs for trusted and rejected settings. These will typically have values the same as the extended key usage extension and any application specific purposes. The trust checking code now has a default behaviour: it will just check for an object with the same NID as the passed id. Functions can be provided to override either the default behaviour or the behaviour for a given id. SSL client, server and email already have functions in place for compatibility: they check the NID and also return "trusted" if the certificate is self signed. [Steve Henson] *) Add d2i,i2d bio/fp functions for PrivateKey: these convert the traditional format into an EVP_PKEY structure. [Steve Henson] *) Add a password callback function PEM_cb() which either prompts for a password if usr_data is NULL or otherwise assumes it is a null terminated password. Allow passwords to be passed on command line environment or config files in a few more utilities. [Steve Henson] *) Add a bunch of DER and PEM functions to handle PKCS#8 format private keys. Add some short names for PKCS#8 PBE algorithms and allow them to be specified on the command line for the pkcs8 and pkcs12 utilities. Update documentation. [Steve Henson] *) Support for ASN1 "NULL" type. This could be handled before by using ASN1_TYPE but there wasn't any function that would try to read a NULL and produce an error if it couldn't. For compatibility we also have ASN1_NULL_new() and ASN1_NULL_free() functions but these are faked and don't allocate anything because they don't need to. [Steve Henson] *) Initial support for MacOS is now provided. Examine INSTALL.MacOS for details. [Andy Polyakov, Roy Woods ] *) Rebuild of the memory allocation routines used by OpenSSL code and possibly others as well. The purpose is to make an interface that provide hooks so anyone can build a separate set of allocation and deallocation routines to be used by OpenSSL, for example memory pool implementations, or something else, which was previously hard since Malloc(), Realloc() and Free() were defined as macros having the values malloc, realloc and free, respectively (except for Win32 compilations). The same is provided for memory debugging code. OpenSSL already comes with functionality to find memory leaks, but this gives people a chance to debug other memory problems. With these changes, a new set of functions and macros have appeared: CRYPTO_set_mem_debug_functions() [F] CRYPTO_get_mem_debug_functions() [F] CRYPTO_dbg_set_options() [F] CRYPTO_dbg_get_options() [F] CRYPTO_malloc_debug_init() [M] The memory debug functions are NULL by default, unless the library is compiled with CRYPTO_MDEBUG or friends is defined. If someone wants to debug memory anyway, CRYPTO_malloc_debug_init() (which gives the standard debugging functions that come with OpenSSL) or CRYPTO_set_mem_debug_functions() (tells OpenSSL to use functions provided by the library user) must be used. When the standard debugging functions are used, CRYPTO_dbg_set_options can be used to request additional information: CRYPTO_dbg_set_options(V_CYRPTO_MDEBUG_xxx) corresponds to setting the CRYPTO_MDEBUG_xxx macro when compiling the library. Also, things like CRYPTO_set_mem_functions will always give the expected result (the new set of functions is used for allocation and deallocation) at all times, regardless of platform and compiler options. To finish it up, some functions that were never use in any other way than through macros have a new API and new semantic: CRYPTO_dbg_malloc() CRYPTO_dbg_realloc() CRYPTO_dbg_free() All macros of value have retained their old syntax. [Richard Levitte and Bodo Moeller] *) Some S/MIME fixes. The OID for SMIMECapabilities was wrong, the ordering of SMIMECapabilities wasn't in "strength order" and there was a missing NULL in the AlgorithmIdentifier for the SHA1 signature algorithm. [Steve Henson] *) Some ASN1 types with illegal zero length encoding (INTEGER, ENUMERATED and OBJECT IDENTIFIER) choked the ASN1 routines. [Frans Heymans , modified by Steve Henson] *) Merge in my S/MIME library for OpenSSL. This provides a simple S/MIME API on top of the PKCS#7 code, a MIME parser (with enough functionality to handle multipart/signed properly) and a utility called 'smime' to call all this stuff. This is based on code I originally wrote for Celo who have kindly allowed it to be included in OpenSSL. [Steve Henson] *) Add variants des_set_key_checked and des_set_key_unchecked of des_set_key (aka des_key_sched). Global variable des_check_key decides which of these is called by des_set_key; this way des_check_key behaves as it always did, but applications and the library itself, which was buggy for des_check_key == 1, have a cleaner way to pick the version they need. [Bodo Moeller] *) New function PKCS12_newpass() which changes the password of a PKCS12 structure. [Steve Henson] *) Modify X509_TRUST and X509_PURPOSE so it also uses a static and dynamic mix. In both cases the ids can be used as an index into the table. Also modified the X509_TRUST_add() and X509_PURPOSE_add() functions so they accept a list of the field values and the application doesn't need to directly manipulate the X509_TRUST structure. [Steve Henson] *) Modify the ASN1_STRING_TABLE stuff so it also uses bsearch and doesn't need initialising. [Steve Henson] *) Modify the way the V3 extension code looks up extensions. This now works in a similar way to the object code: we have some "standard" extensions in a static table which is searched with OBJ_bsearch() and the application can add dynamic ones if needed. The file crypto/x509v3/ext_dat.h now has the info: this file needs to be updated whenever a new extension is added to the core code and kept in ext_nid order. There is a simple program 'tabtest.c' which checks this. New extensions are not added too often so this file can readily be maintained manually. 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] 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(). [Steve Henson] *) Modify enc utility's salting as follows: make salting the default. Add a magic header, so unsalted files fail gracefully instead of just decrypting to garbage. This is because not salting is a big security hole, so people should be discouraged from doing it. [Ben Laurie] *) Fixes and enhancements to the 'x509' utility. It allowed a message digest to be passed on the command line but it only used this parameter when signing a certificate. Modified so all relevant operations are affected by the digest parameter including the -fingerprint and -x509toreq options. Also -x509toreq choked if a DSA key was used because it didn't fix the digest. [Steve Henson] *) Initial certificate chain verify code. Currently tests the untrusted certificates for consistency with the verify purpose (which is set when the X509_STORE_CTX structure is set up) and checks the pathlength. There is a NO_CHAIN_VERIFY compilation option to keep the old behaviour: this is because it will reject chains with invalid extensions whereas every previous version of OpenSSL and SSLeay made no checks at all. Trust code: checks the root CA for the relevant trust settings. Trust settings have an initial value consistent with the verify purpose: e.g. if the verify purpose is for SSL client use it expects the CA to be trusted for SSL client use. However the default value can be changed to permit custom trust settings: one example of this would be to only trust certificates from a specific "secure" set of CAs. Also added X509_STORE_CTX_new() and X509_STORE_CTX_free() functions which should be used for version portability: especially since the verify structure is likely to change more often now. SSL integration. Add purpose and trust to SSL_CTX and SSL and functions to set them. If not set then assume SSL clients will verify SSL servers and vice versa. Two new options to the verify program: -untrusted allows a set of untrusted certificates to be passed in and -purpose which sets the intended purpose of the certificate. If a purpose is set then the new chain verify code is used to check extension consistency. [Steve Henson] *) Support for the authority information access extension. [Steve Henson] *) Modify RSA and DSA PEM read routines to transparently handle PKCS#8 format private keys. New *_PUBKEY_* functions that handle public keys in a format compatible with certificate SubjectPublicKeyInfo structures. Unfortunately there were already functions called *_PublicKey_* which used various odd formats so these are retained for compatibility: however the DSA variants were never in a public release so they have been deleted. Changed dsa/rsa utilities to handle the new format: note no releases ever handled public keys so we should be OK. The primary motivation for this change is to avoid the same fiasco that dogs private keys: there are several incompatible private key formats some of which are standard and some OpenSSL specific and require various evil hacks to allow partial transparent handling and even then it doesn't work with DER formats. Given the option anything other than PKCS#8 should be dumped: but the other formats have to stay in the name of compatibility. With public keys and the benefit of hindsight one standard format is used which works with EVP_PKEY, RSA or DSA structures: though 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 reference count of the added key (they don't "swallow" the supplied key). [Steve Henson] *) Fixes to crypto/x509/by_file.c the code to read in certificates and CRLs would fail if the file contained no certificates or no CRLs: added a new function to read in both types and return the number read: this means that if none are read it will be an error. The DER versions of the certificate and CRL reader would always fail because it isn't possible to mix certificates and CRLs in DER format without choking one or the other routine. Changed this to just read a certificate: this is the best we can do. Also modified the code in apps/verify.c to take notice of return codes: it was previously attempting to read in certificates from NULL pointers and ignoring any errors: this is one reason why the cert and CRL reader seemed to work. It doesn't check return codes from the default certificate routines: these may well fail if the certificates aren't installed. [Steve Henson] *) Code to support otherName option in GeneralName. [Steve Henson] *) First update to verify code. Change the verify utility so it warns if it is passed a self signed certificate: for consistency with the normal behaviour. X509_verify has been modified to it will now verify a self signed certificate if *exactly* the same certificate appears in the store: it was previously impossible to trust a single self signed certificate. This means that: openssl verify ss.pem now gives a warning about a self signed certificate but openssl verify -CAfile ss.pem ss.pem is OK. [Steve Henson] *) For servers, store verify_result in SSL_SESSION data structure (and add it to external session representation). This is needed when client certificate verifications fails, but an application-provided verification callback (set by SSL_CTX_set_cert_verify_callback) allows accepting the session anyway (i.e. leaves x509_store_ctx->error != X509_V_OK but returns 1): When the session is reused, we have to set ssl->verify_result to the appropriate error code to avoid security holes. [Bodo Moeller, problem pointed out by Lutz Jaenicke] *) Fix a bug in the new PKCS#7 code: it didn't consider the case in PKCS7_dataInit() where the signed PKCS7 structure didn't contain any existing data because it was being created. [Po-Cheng Chen , slightly modified by Steve Henson] *) Add a salt to the key derivation routines in enc.c. This forms the first 8 bytes of the encrypted file. Also add a -S option to allow a salt to be input on the command line. [Steve Henson] *) New function X509_cmp(). Oddly enough there wasn't a function to compare two certificates. We do this by working out the SHA1 hash and comparing that. X509_cmp() will be needed by the trust code. [Steve Henson] *) SSL_get1_session() is like SSL_get_session(), but increments the reference count in the SSL_SESSION returned. [Geoff Thorpe ] *) Fix for 'req': it was adding a null to request attributes. Also change the X509_LOOKUP and X509_INFO code to handle certificate auxiliary information. [Steve Henson] *) Add support for 40 and 64 bit RC2 and RC4 algorithms: document the 'enc' command. [Steve Henson] *) Add the possibility to add extra information to the memory leak detecting output, to form tracebacks, showing from where each allocation was originated: CRYPTO_push_info("constant string") adds the string plus current file name and line number to a per-thread stack, CRYPTO_pop_info() does the obvious, CRYPTO_remove_all_info() is like calling CYRPTO_pop_info() until the stack is empty. Also updated memory leak detection code to be multi-thread-safe. [Richard Levitte] *) Add options -text and -noout to pkcs7 utility and delete the encryption options which never did anything. Update docs. [Steve Henson] *) Add options to some of the utilities to allow the pass phrase to be included on either the command line (not recommended on OSes like Unix) or read from the environment. Update the manpages and fix a few bugs. [Steve Henson] *) Add a few manpages for some of the openssl commands. [Steve Henson] *) Fix the -revoke option in ca. It was freeing up memory twice, leaking and not finding already revoked certificates. [Steve Henson] *) Extensive changes to support certificate auxiliary information. This involves the use of X509_CERT_AUX structure and X509_AUX functions. An X509_AUX function such as PEM_read_X509_AUX() can still read in a certificate file in the usual way but it will also read in any additional "auxiliary information". By doing things this way a fair degree of compatibility can be retained: existing certificates can have this information added using the new 'x509' options. Current auxiliary information includes an "alias" and some trust settings. The trust settings will ultimately be used in enhanced certificate chain verification routines: currently a certificate can only be trusted if it is self signed and then it is trusted for all purposes. [Steve Henson] *) 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% performance improvement for 1024 bit RSA signs. [Mark Cox] *) Hack to fix PKCS#7 decryption when used with some unorthodox RC2 handling. Most clients have the effective key size in bits equal to the key length in bits: so a 40 bit RC2 key uses a 40 bit (5 byte) key. A few however don't do this and instead use the size of the decrypted key to determine the RC2 key length and the AlgorithmIdentifier to determine the effective key length. In this case the effective key length can still be 40 bits but the key length can be 168 bits for example. This is fixed by manually forcing an RC2 key into the EVP_PKEY structure because the EVP code can't currently handle unusual RC2 key sizes: it always assumes the key length and effective key length are equal. [Steve Henson] *) Add a bunch of functions that should simplify the creation of X509_NAME structures. Now you should be able to do: X509_NAME_add_entry_by_txt(nm, "CN", MBSTRING_ASC, "Steve", -1, -1, 0); and have it automatically work out the correct field type and fill in the structures. The more adventurous can try: X509_NAME_add_entry_by_txt(nm, field, MBSTRING_UTF8, str, -1, -1, 0); and it will (hopefully) work out the correct multibyte encoding. [Steve Henson] *) Change the 'req' utility to use the new field handling and multibyte copy routines. Before the DN field creation was handled in an ad hoc way in req, ca, and x509 which was rather broken and didn't support BMPStrings or UTF8Strings. Since some software doesn't implement BMPStrings or UTF8Strings yet, they can be enabled using the config file using the dirstring_type option. See the new comment in the default openssl.cnf for more info. [Steve Henson] *) Make crypto/rand/md_rand.c more robust: - Assure unique random numbers after fork(). - Make sure that concurrent threads access the global counter and md serializably so that we never lose entropy in them or use exactly the same state in multiple threads. Access to the large state is not always serializable because the additional locking could be a performance killer, and md should be large enough anyway. [Bodo Moeller] *) New file apps/app_rand.c with commonly needed functionality for handling the random seed file. Use the random seed file in some applications that previously did not: ca, dsaparam -genkey (which also ignored its '-rand' option), s_client, s_server, x509 (when signing). Except on systems with /dev/urandom, it is crucial to have a random seed file at least for key creation, DSA signing, and for DH exchanges; for RSA signatures we could do without one. gendh and gendsa (unlike genrsa) used to read only the first byte of each file listed in the '-rand' option. The function as previously found in genrsa is now in app_rand.c and is used by all programs that support '-rand'. [Bodo Moeller] *) In RAND_write_file, use mode 0600 for creating files; don't just chmod when it may be too late. [Bodo Moeller] *) Report an error from X509_STORE_load_locations when X509_LOOKUP_load_file or X509_LOOKUP_add_dir failed. [Bill Perry] *) New function ASN1_mbstring_copy() this copies a string in either ASCII, Unicode, Universal (4 bytes per character) or UTF8 format into an ASN1_STRING type. A mask of permissible types is passed and it chooses the "minimal" type to use or an error if not type is suitable. [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) should *NOT* in order to be "shared library friendly". [Steve Henson] *) Add various functions that can check a certificate's extensions to see if it usable for various purposes such as SSL client, server or S/MIME and CAs of these types. This is currently VERY EXPERIMENTAL but will ultimately be used for certificate chain verification. Also added a -purpose flag to x509 utility to print out all the purposes. [Steve Henson] *) Add a CRYPTO_EX_DATA to X509 certificate structure and associated functions. [Steve Henson] *) 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. [Steve Henson] *) RC4 tune-up featuring 30-40% performance improvement on most RISC platforms. See crypto/rc4/rc4_enc.c for further details. [Andy Polyakov] *) New -noout option to asn1parse. This causes no output to be produced its main use is when combined with -strparse and -out to extract data from a file (which may not be in ASN.1 format). [Steve Henson] *) Fix for pkcs12 program. It was hashing an invalid certificate pointer when producing the local key id. [Richard Levitte ] *) New option -dhparam in s_server. This allows a DH parameter file to be stated explicitly. If it is not stated then it tries the first server certificate file. The previous behaviour hard coded the filename "server.pem". [Steve Henson] *) Add -pubin and -pubout options to the rsa and dsa commands. These allow a public key to be input or output. For example: openssl rsa -in key.pem -pubout -out pubkey.pem Also added necessary DSA public key functions to handle this. [Steve Henson] *) Fix so PKCS7_dataVerify() doesn't crash if no certificates are contained in the message. This was handled by allowing X509_find_by_issuer_and_serial() to tolerate a NULL passed to it. [Steve Henson, reported by Sampo Kellomaki ] *) Fix for bug in d2i_ASN1_bytes(): other ASN1 functions add an extra null to the end of the strings whereas this didn't. This would cause problems if strings read with d2i_ASN1_bytes() were later modified. [Steve Henson, reported by Arne Ansper ] *) Fix for base64 decode bug. When a base64 bio reads only one line of data and it contains EOF it will end up returning an error. This is caused by input 46 bytes long. The cause is due to the way base64 BIOs find the start of base64 encoded data. They do this by trying a trial decode on each line until they find one that works. When they do a flag is set and it starts again knowing it can pass all the data directly through the decoder. Unfortunately it doesn't reset the context it uses. This means that if EOF is reached an attempt is made to pass two EOFs through the context and this causes the resulting error. This can also cause other problems as well. As is 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) ] *) 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 tty (for keypresses and to see if data could be written). Win32 only supports select() on sockets so we select() with a 1s timeout on the sockets and then see if any characters are waiting to be read, if none are present then we retry, we also assume we can always write data to the tty. This isn't nice because the code then blocks until we've received a complete line of data and it is effectively polling the keyboard at 1s intervals: however it's quite a bit better than not working at all :-) A dedicated Windows application might handle this with an event loop for example. [Steve Henson] *) Enhance RSA_METHOD structure. Now there are two extra methods, rsa_sign and rsa_verify. When the RSA_FLAGS_SIGN_VER option is set these functions will be called when RSA_sign() and RSA_verify() are used. This is useful if rsa_pub_dec() and rsa_priv_enc() equivalents are not available. For this to work properly RSA_public_decrypt() and RSA_private_encrypt() should *not* be used: RSA_sign() and RSA_verify() must be used instead. This necessitated the support of an extra signature type NID_md5_sha1 for SSL signatures and modifications to the SSL library to use it instead of calling RSA_public_decrypt() and RSA_private_encrypt(). [Steve Henson] *) Add new -verify -CAfile and -CApath options to the crl program, these will lookup a CRL issuers certificate and verify the signature in a similar way to the verify program. Tidy up the crl program so it no longer accesses structures directly. Make the ASN1 CRL parsing a bit less strict. It will now permit CRL extensions even if it is not a V2 CRL: this will allow it to tolerate some broken CRLs. [Steve Henson] *) Initialize all non-automatic variables each time one of the openssl sub-programs is started (this is necessary as they may be started multiple times from the "OpenSSL>" prompt). [Lennart Bang, Bodo Moeller] *) Preliminary compilation option RSA_NULL which disables RSA crypto without removing all other RSA functionality (this is what NO_RSA does). This is so (for example) those in the US can disable those operations covered by the RSA patent while allowing storage and parsing of RSA keys and RSA key generation. [Steve Henson] *) Non-copying interface to BIO pairs. (still largely untested) [Bodo Moeller] *) New function ANS1_tag2str() to convert an ASN1 tag to a descriptive ASCII string. This was handled independently in various places before. [Steve Henson] *) New functions UTF8_getc() and UTF8_putc() that parse and generate UTF8 strings a character at a time. [Steve Henson] *) Use client_version from client hello to select the protocol (s23_srvr.c) and for RSA client key exchange verification (s3_srvr.c), as required by the SSL 3.0/TLS 1.0 specifications. [Bodo Moeller] *) Add various utility functions to handle SPKACs, these were previously handled by poking round in the structure internals. Added new function NETSCAPE_SPKI_print() to print out SPKAC and a new utility 'spkac' to print, verify and generate SPKACs. Based on an original idea from Massimiliano Pala but extensively modified. [Steve Henson] *) RIPEMD160 is operational on all platforms and is back in 'make test'. [Andy Polyakov] *) Allow the config file extension section to be overwritten on the command line. Based on an original idea from Massimiliano Pala . The new option is called -extensions and can be applied to ca, req and x509. Also -reqexts to override the request extensions in req and -crlexts to override the crl extensions in ca. [Steve Henson] *) Add new feature to the SPKAC handling in ca. Now you can include the same field multiple times by preceding it by "XXXX." for example: 1.OU="Unit name 1" 2.OU="Unit name 2" this is the same syntax as used in the req config file. [Steve Henson] *) Allow certificate extensions to be added to certificate requests. These are specified in a 'req_extensions' option of the req section of the config file. They can be printed out with the -text option to req but are otherwise ignored at present. [Steve Henson] *) Fix a horrible bug in enc_read() in crypto/evp/bio_enc.c: if the first data read consists of only the final block it would not decrypted because EVP_CipherUpdate() would correctly report zero bytes had been decrypted. A misplaced 'break' also meant the decrypted final block might not be copied until the next read. [Steve Henson] *) Initial support for DH_METHOD. Again based on RSA_METHOD. Also added a few extra parameters to the DH structure: these will be useful if for example we want the value of 'q' or implement X9.42 DH. [Steve Henson] *) Initial support for DSA_METHOD. This is based on the RSA_METHOD and provides hooks that allow the default DSA functions or functions on a "per key" basis to be replaced. This allows hardware acceleration and hardware key storage to be handled without major modification to the library. Also added low level modexp hooks and CRYPTO_EX structure and associated functions. [Steve Henson] *) Add a new flag to memory BIOs, BIO_FLAG_MEM_RDONLY. This marks the BIO as "read only": it can't be written to and the buffer it points to will not be freed. Reading from a read only BIO is much more efficient than a normal memory BIO. This was added because there are several times when an area of memory needs to be read from a BIO. The previous method was to create a memory BIO and write the data to it, this results in two copies of the data and an O(n^2) reading algorithm. There is a new function BIO_new_mem_buf() which creates a read only memory BIO from an area of memory. Also modified the PKCS#7 routines to use read only memory BIOs. [Steve Henson] *) Bugfix: ssl23_get_client_hello did not work properly when called in state SSL23_ST_SR_CLNT_HELLO_B, i.e. when the first 7 bytes of a SSLv2-compatible client hello for SSLv3 or TLSv1 could be read, but a retry condition occured while trying to read the rest. [Bodo Moeller] *) The PKCS7_ENC_CONTENT_new() function was setting the content type as NID_pkcs7_encrypted by default: this was wrong since this should almost always be NID_pkcs7_data. Also modified the PKCS7_set_type() to handle the encrypted data type: this is a more sensible place to put it and it allows the PKCS#12 code to be tidied up that duplicated this functionality. [Steve Henson] *) Changed obj_dat.pl script so it takes its input and output files on the command line. This should avoid shell escape redirection problems under Win32. [Steve Henson] *) Initial support for certificate extension requests, these are included in things like Xenroll certificate requests. Included functions to allow extensions to be obtained and added. [Steve Henson] *) -crlf option to s_client and s_server for sending newlines as CRLF (as required by many protocols). [Bodo Moeller] 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. [Andrija Antonijevic ] *) Fix -startdate and -enddate (which was missing) arguments to 'ca' program. [Steve Henson] *) New function DSA_dup_DH, which duplicates DSA parameters/keys as DH parameters/keys (q is lost during that conversion, but the resulting DH parameters contain its length). 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 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 utter importance to use SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_DH_USE); or SSL_set_options(s_ctx, SSL_OP_SINGLE_DH_USE); when such DH parameters are used, because otherwise small subgroup attacks may become possible! [Bodo Moeller] *) Avoid memory leak in i2d_DHparams. [Bodo Moeller] *) Allow the -k option to be used more than once in the enc program: this allows the same encrypted message to be read by multiple recipients. [Steve Henson] *) New function OBJ_obj2txt(buf, buf_len, a, no_name), this converts an ASN1_OBJECT to a text string. If the "no_name" parameter is set then it will always use the numerical form of the OID, even if it has a short or long name. [Steve Henson] *) Added an extra RSA flag: RSA_FLAG_EXT_PKEY. Previously the rsa_mod_exp method only got called if p,q,dmp1,dmq1,iqmp components were present, otherwise bn_mod_exp was called. In the case of hardware keys for example no private key components need be present and it might store extra data in the RSA structure, which cannot be accessed from bn_mod_exp. By setting RSA_FLAG_EXT_PKEY rsa_mod_exp will always be called for private key operations. [Steve Henson] *) Added support for SPARC Linux. [Andy Polyakov] *) pem_password_cb function type incompatibly changed from typedef int pem_password_cb(char *buf, int size, int rwflag); 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 additional void * argument, which is just handed through whenever the password callback is called. [Damien Miller ; tiny changes by Bodo Moeller] New function SSL_CTX_set_default_passwd_cb_userdata. Compatibility note: As many C implementations push function arguments onto the stack in reverse order, the new library version is likely to interoperate with programs that have been compiled with the old pem_password_cb definition (PEM_whatever takes some data that happens to be on the stack as its last argument, and the callback just ignores this garbage); but there is no guarantee whatsoever that this will work. *) The -DPLATFORM="\"$(PLATFORM)\"" definition and the similar -DCFLAGS=... (both in crypto/Makefile.ssl for use by crypto/cversion.c) caused problems not only on Windows, but also on some Unix platforms. To avoid problematic command lines, these definitions are now in an auto-generated file crypto/buildinf.h (created by crypto/Makefile.ssl for standard "make" builds, by util/mk1mf.pl for "mk1mf" builds). [Bodo Moeller] *) MIPS III/IV assembler module is reimplemented. [Andy Polyakov] *) More DES library cleanups: remove references to srand/rand and delete an unused file. [Ulf Möller] *) Add support for the the free Netwide assembler (NASM) under Win32, since not many people have MASM (ml) and it can be hard to obtain. This is currently experimental but it seems to work OK and pass all the tests. Check out INSTALL.W32 for info. [Steve Henson] *) Fix memory leaks in s3_clnt.c: All non-anonymous SSL3/TLS1 connections without temporary keys kept an extra copy of the server key, and connections with temporary keys did not free everything in case of an error. [Bodo Moeller] *) New function RSA_check_key and new openssl rsa option -check for verifying the consistency of RSA keys. [Ulf Moeller, Bodo Moeller] *) Various changes to make Win32 compile work: 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__sort to DEF file generator and do make update. [Steve Henson] *) Add a debugging option to PKCS#5 v2 key generation function: when you #define DEBUG_PKCS5V2 passwords, salts, iteration counts and derived keys are printed to stderr. [Steve Henson] *) Copy the flags in ASN1_STRING_dup(). [Roman E. Pavlov ] *) The x509 application mishandled signing requests containing DSA keys when the signing key was also DSA and the parameters didn't match. It was supposed to omit the parameters when they matched the signing key: the verifying software was then supposed to automatically use the CA's parameters if they were absent from the end user certificate. Omitting parameters is no longer recommended. The test was also the wrong way round! This was probably due to unusual behaviour in EVP_cmp_parameters() which returns 1 if the parameters match. This meant that parameters were omitted when they *didn't* match and the certificate was useless. Certificates signed with 'ca' didn't have this bug. [Steve Henson, reported by Doug Erickson ] *) Memory leak checking (-DCRYPTO_MDEBUG) had some problems. The interface is as follows: Applications can use CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) aka MemCheck_start(), CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) aka MemCheck_stop(); "off" is now the default. The library internally uses CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) aka MemCheck_off(), CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE) aka MemCheck_on() to disable memory-checking temporarily. Some inconsistent states that previously were possible (and were even the default) are now avoided. -DCRYPTO_MDEBUG_TIME is new and additionally stores the current time with each memory chunk allocated; this is occasionally more helpful than just having a counter. -DCRYPTO_MDEBUG_THREAD is also new and adds the thread ID. -DCRYPTO_MDEBUG_ALL enables all of the above, plus any future extensions. [Bodo Moeller] *) Introduce "mode" for SSL structures (with defaults in SSL_CTX), which largely parallels "options", but is for changing API behaviour, whereas "options" are about protocol behaviour. Initial "mode" flags are: SSL_MODE_ENABLE_PARTIAL_WRITE Allow SSL_write to report success when a single record has been written. SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER Don't insist that SSL_write retries use the same buffer location. (But all of the contents must be copied!) [Bodo Moeller] *) Bugfix: SSL_set_options ignored its parameter, only SSL_CTX_set_options worked. *) Fix problems with no-hmac etc. [Ulf Möller, pointed out by Brian Wellington ] *) New functions RSA_get_default_method(), RSA_set_method() and RSA_get_method(). These allows replacement of RSA_METHODs without having to mess around with the internals of an RSA structure. [Steve Henson] *) Fix memory leaks in DSA_do_sign and DSA_is_prime. Also really enable memory leak checks in openssl.c and in some test programs. [Chad C. Mulligan, Bodo Moeller] *) Fix a bug in d2i_ASN1_INTEGER() and i2d_ASN1_INTEGER() which can mess up the length of negative integers. This has now been simplified to just 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 ] *) Add a new function PKCS7_signatureVerify. This allows the verification of a PKCS#7 signature but with the signing certificate passed to the function itself. This contrasts with PKCS7_dataVerify which assumes the certificate is present in the PKCS#7 structure. This isn't always the case: certificates can be omitted from a PKCS#7 structure and be distributed by "out of band" means (such as a certificate database). [Steve Henson] *) 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. [Steve Henson] *) mk1mf.pl (used by Windows builds) did not properly read the options set by Configure in the top level Makefile, and Configure was not even able to write more than one option correctly. Fixed, now "no-idea no-rc5 -DCRYPTO_MDEBUG" etc. works as intended. [Bodo Moeller] *) New functions CONF_load_bio() and CONF_load_fp() to allow a config file to be loaded from a BIO or FILE pointer. The BIO version will for example allow memory BIOs to contain config info. [Steve Henson] *) New function "CRYPTO_num_locks" that returns CRYPTO_NUM_LOCKS. Whoever hopes to achieve shared-library compatibility across versions must use this, not the compile-time macro. (Exercise 0.9.4: Which is the minimum library version required by such programs?) Note: All this applies only to multi-threaded programs, others don't need locks. [Bodo Moeller] *) Add missing case to s3_clnt.c state machine -- one of the new SSL tests through a BIO pair triggered the default case, i.e. SSLerr(...,SSL_R_UNKNOWN_STATE). [Bodo Moeller] *) New "BIO pair" concept (crypto/bio/bss_bio.c) so that applications can use the SSL library even if none of the specific BIOs is appropriate. [Bodo Moeller] *) Fix a bug in i2d_DSAPublicKey() which meant it returned the wrong value for the encoded length. [Jeon KyoungHo ] *) Add initial documentation of the X509V3 functions. [Steve Henson] *) Add a new pair of functions PEM_write_PKCS8PrivateKey() and PEM_write_bio_PKCS8PrivateKey() that are equivalent to PEM_write_PrivateKey() and PEM_write_bio_PrivateKey() but use the more secure PKCS#8 private key format with a high iteration count. [Steve Henson] *) Fix determination of Perl interpreter: A perl or perl5 _directory_ in $PATH was also accepted as the interpreter. [Ralf S. Engelschall] *) Fix demos/sign/sign.c: well there wasn't anything strictly speaking wrong with it but it was very old and did things like calling PEM_ASN1_read() directly and used MD5 for the hash not to mention some unusual formatting. [Steve Henson] *) Fix demos/selfsign.c: it used obsolete and deleted functions, changed to use the new extension code. [Steve Henson] *) Implement the PEM_read/PEM_write functions in crypto/pem/pem_all.c with macros. This should make it easier to change their form, add extra arguments etc. Fix a few PEM prototypes which didn't have cipher as a constant. [Steve Henson] *) Add to configuration table a new entry that can specify an alternative name for unistd.h (for pre-POSIX systems); we need this for NeXTstep, according to Mark Crispin . [Bodo Moeller] #if 0 *) DES CBC did not update the IV. Weird. [Ben Laurie] #else des_cbc_encrypt does not update the IV, but des_ncbc_encrypt does. Changing the behaviour of the former might break existing programs -- where IV updating is needed, des_ncbc_encrypt can be used. #endif *) When bntest is run from "make test" it drives bc to check its calculations, as well as internally checking them. If an internal check fails, it needs to cause bc to give a non-zero result or make test carries on without noticing the failure. Fixed. [Ben Laurie] *) DES library cleanups. [Ulf Möller] *) Add support for PKCS#5 v2.0 PBE algorithms. This will permit PKCS#8 to be used with any cipher unlike PKCS#5 v1.5 which can at most handle 64 bit ciphers. NOTE: although the key derivation function has been verified against some published test vectors it has not been extensively tested yet. Added a -v2 "cipher" option to pkcs8 application to allow the use of v2.0. [Steve Henson] *) Instead of "mkdir -p", which is not fully portable, use new Perl script "util/mkdir-p.pl". [Bodo Moeller] *) Rewrite the way password based encryption (PBE) is handled. It used to assume that the ASN1 AlgorithmIdentifier parameter was a PBEParameter structure. This was true for the PKCS#5 v1.5 and PKCS#12 PBE algorithms but doesn't apply to PKCS#5 v2.0 where it can be something else. Now the 'parameter' field of the AlgorithmIdentifier is passed to the underlying key generation function so it must do its own ASN1 parsing. This has also changed the EVP_PBE_CipherInit() function which now has a 'parameter' argument instead of literal salt and iteration count values and the function EVP_PBE_ALGOR_CipherInit() has been deleted. [Steve Henson] *) Support for PKCS#5 v1.5 compatible password based encryption algorithms and PKCS#8 functionality. New 'pkcs8' application linked to openssl. Needed to change the PEM_STRING_EVP_PKEY value which was just "PRIVATE KEY" because this clashed with PKCS#8 unencrypted string. Since this value was just used as a "magic string" and not used directly its value doesn't matter. [Steve Henson] *) Introduce some semblance of const correctness to BN. Shame C doesn't support mutable. [Ben Laurie] *) "linux-sparc64" configuration (ultrapenguin). [Ray Miller ] "linux-sparc" configuration. [Christian Forster ] *) config now generates no-xxx options for missing ciphers. [Ulf Möller] *) Support the EBCDIC character set (work in progress). File ebcdic.c not yet included because it has a different license. [Martin Kraemer ] *) Support BS2000/OSD-POSIX. [Martin Kraemer ] *) Make callbacks for key generation use void * instead of char *. [Ben Laurie] *) Make S/MIME samples compile (not yet tested). [Ben Laurie] *) Additional typesafe stacks. [Ben Laurie] *) New configuration variants "bsdi-elf-gcc" (BSD/OS 4.x). [Bodo Moeller] Changes between 0.9.3 and 0.9.3a [29 May 1999] *) New configuration variant "sco5-gcc". *) Updated some demos. [Sean O Riordain, Wade Scholine] *) Add missing BIO_free at exit of pkcs12 application. [Wu Zhigang] *) Fix memory leak in conf.c. [Steve Henson] *) Updates for Win32 to assembler version of MD5. [Steve Henson] *) Set #! path to perl in apps/der_chop to where we found it instead of using a fixed path. [Bodo Moeller] *) SHA library changes for irix64-mips4-cc. [Andy Polyakov] *) Improvements for VMS support. [Richard Levitte] 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. [Andy Polyakov ] *) New functions sk_num, sk_value and sk_set to replace the previous macros. These are required because of the typesafe stack would otherwise break existing code. If old code used a structure member which used to be STACK and is now STACK_OF (for example cert in a PKCS7_SIGNED structure) with sk_num or sk_value it would produce an error because the num, data members are not present in STACK_OF. Now it just produces a warning. sk_set replaces the old method of assigning a value to sk_value (e.g. sk_value(x, i) = y) which the library used in a few cases. Any code that does this will no longer work (and should use sk_set instead) but this could be regarded as a "questionable" behaviour anyway. [Steve Henson] *) Fix most of the other PKCS#7 bugs. The "experimental" code can now correctly handle encrypted S/MIME data. [Steve Henson] *) Change type of various DES function arguments from des_cblock (which means, in function argument declarations, pointer to char) to des_cblock * (meaning pointer to array with 8 char elements), which allows the compiler to do more typechecking; it was like that back in SSLeay, but with lots of ugly casts. Introduce new type const_des_cblock. [Bodo Moeller] *) Reorganise the PKCS#7 library and get rid of some of the more obvious problems: find RecipientInfo structure that matches recipient certificate and initialise the ASN1 structures properly based on passed cipher. [Steve Henson] *) Belatedly make the BN tests actually check the results. [Ben Laurie] *) Fix the encoding and decoding of negative ASN1 INTEGERS and conversion to and from BNs: it was completely broken. New compilation option NEG_PUBKEY_BUG to allow for some broken certificates that encode public key elements as negative integers. [Steve Henson] *) Reorganize and speed up MD5. [Andy Polyakov ] *) VMS support. [Richard Levitte ] *) New option -out to asn1parse to allow the parsed structure to be output to a file. This is most useful when combined with the -strparse option to examine the output of things like OCTET STRINGS. [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 in many applications because usually everything *appeared* to work as intended anyway -- now it really works as intended). [Bodo Moeller] *) Move openssl.cnf out of lib/. [Ulf Möller] *) 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+ [Ralf S. Engelschall] *) Various fixes to the EVP and PKCS#7 code. It may now be able to handle PKCS#7 enveloped data properly. [Sebastian Akerman , modified by Steve] *) 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 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?), we have solved a couple of bugs of the earlier code where s->cert was used as if it could not have been shared with other SSL structures. 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) does not influence s as it used to. In order to clean up things more thoroughly, inside SSL_SESSION we don't use CERT any longer, but a new structure SESS_CERT that holds per-session data (if available); currently, this is the peer's certificate chain and, for clients, the server's certificate and temporary key. CERT holds only those values that can have meaningful defaults in an SSL_CTX. [Bodo Moeller] *) New function X509V3_EXT_i2d() to create an X509_EXTENSION structure from the internal representation. Various PKCS#7 fixes: remove some evil casts and set the enc_dig_alg field properly based on the signing key type. [Steve Henson] *) Allow PKCS#12 password to be set from the command line or the environment. Let 'ca' get its config file name from the environment variables "OPENSSL_CONF" or "SSLEAY_CONF" (for consistency with 'req' and 'x509'). [Steve Henson] *) Allow certificate policies extension to use an IA5STRING for the organization field. This is contrary to the PKIX definition but VeriSign uses it and IE5 only recognises this form. Document 'x509' extension option. [Steve Henson] *) Add PEDANTIC compiler flag to allow compilation with gcc -pedantic, without disallowing inline assembler and the like for non-pedantic builds. [Ben Laurie] *) Support Borland C++ builder. [Janez Jere , modified by Ulf Möller] *) Support Mingw32. [Ulf Möller] *) SHA-1 cleanups and performance enhancements. [Andy Polyakov ] *) Sparc v8plus assembler for the bignum library. [Andy Polyakov ] *) Accept any -xxx and +xxx compiler options in Configure. [Ulf Möller] *) Update HPUX configuration. [Anonymous] *) Add missing sk__unshift() function to safestack.h [Ralf S. Engelschall] *) New function SSL_CTX_use_certificate_chain_file that sets the "extra_cert"s in addition to the certificate. (This makes sense only for "PEM" format files, as chains as a whole are not DER-encoded.) [Bodo Moeller] *) Support verify_depth from the SSL API. x509_vfy.c had what can be considered an off-by-one-error: Its depth (which was not part of the external interface) was actually counting the number of certificates in a chain; now it really counts the depth. [Bodo Moeller] *) Bugfix in crypto/x509/x509_cmp.c: The SSLerr macro was used instead of X509err, which often resulted in confusing error messages since the error codes are not globally unique (e.g. an alleged error in ssl3_accept when a certificate didn't match the private key). *) New function SSL_CTX_set_session_id_context that allows to set a default value (so that you don't need SSL_set_session_id_context for each connection using the SSL_CTX). [Bodo Moeller] *) OAEP decoding bug fix. [Ulf Möller] *) Support INSTALL_PREFIX for package builders, as proposed by David Harris. [Bodo Moeller] *) New Configure options "threads" and "no-threads". For systems where the proper compiler options are known (currently Solaris and Linux), "threads" is the default. [Bodo Moeller] *) New script util/mklink.pl as a faster substitute for util/mklink.sh. [Bodo Moeller] *) Install various scripts to $(OPENSSLDIR)/misc, not to $(INSTALLTOP)/bin -- they shouldn't clutter directories such as /usr/local/bin. [Bodo Moeller] *) "make linux-shared" to build shared libraries. [Niels Poppe ] *) New Configure option no- (rsa, idea, rc5, ...). [Ulf Möller] *) Add the PKCS#12 API documentation to openssl.txt. Preliminary support for extension adding in x509 utility. [Steve Henson] *) Remove NOPROTO sections and error code comments. [Ulf Möller] *) Partial rewrite of the DEF file generator to now parse the ANSI prototypes. [Steve Henson] *) New Configure options --prefix=DIR and --openssldir=DIR. [Ulf Möller] *) Complete rewrite of the error code script(s). It is all now handled by one script at the top level which handles error code gathering, header rewriting and C source file generation. It should be much better than the old method: it now uses a modified version of Ulf's parser to read the ANSI prototypes in all header files (thus the old K&R definitions aren't needed for error creation any more) and do a better job of translating function codes into names. The old 'ASN1 error code imbedded in a comment' is no longer necessary and it doesn't use .err files which have now been deleted. Also the error code call doesn't have to appear all on one line (which resulted in some large lines...). [Steve Henson] *) Change #include filenames from to . [Bodo Moeller] *) Change behaviour of ssl2_read when facing length-0 packets: Don't return 0 (which usually indicates a closed connection), but continue reading. [Bodo Moeller] *) Fix some race conditions. [Bodo Moeller] *) Add support for CRL distribution points extension. Add Certificate Policies and CRL distribution points documentation. [Steve Henson] *) Move the autogenerated header file parts to crypto/opensslconf.h. [Ulf Möller] *) Fix new 56-bit DES export ciphersuites: they were using 7 bytes instead of 8 of keying material. Merlin has also confirmed interop with this fix between OpenSSL and Baltimore C/SSL 2.0 and J/SSL 2.0. [Merlin Hughes ] *) Fix lots of warnings. [Richard Levitte ] *) In add_cert_dir() in crypto/x509/by_dir.c, break out of the loop if the directory spec didn't end with a LIST_SEPARATOR_CHAR. [Richard Levitte ] *) Fix problems with sizeof(long) == 8. [Andy Polyakov ] *) Change functions to ANSI C. [Ulf Möller] *) Fix typos in error codes. [Martin Kraemer , Ulf Möller] *) Remove defunct assembler files from Configure. [Ulf Möller] *) SPARC v8 assembler BIGNUM implementation. [Andy Polyakov ] *) Support for Certificate Policies extension: both print and set. Various additions to support the r2i method this uses. [Steve Henson] *) A lot of constification, and fix a bug in X509_NAME_oneline() that could return a const string when you are expecting an allocated buffer. [Ben Laurie] *) Add support for ASN1 types UTF8String and VISIBLESTRING, also the CHOICE types DirectoryString and DisplayText. [Steve Henson] *) Add code to allow r2i extensions to access the configuration database, add an LHASH database driver and add several ctx helper functions. [Steve Henson] *) Fix an evil bug in bn_expand2() which caused various BN functions to fail when they extended the size of a BIGNUM. [Steve Henson] *) Various utility functions to handle SXNet extension. Modify mkdef.pl to support typesafe stack. [Steve Henson] *) Fix typo in SSL_[gs]et_options(). [Nils Frostberg ] *) Delete various functions and files that belonged to the (now obsolete) old X509V3 handling code. [Steve Henson] *) New Configure option "rsaref". [Ulf Möller] *) Don't auto-generate pem.h. [Bodo Moeller] *) Introduce type-safe ASN.1 SETs. [Ben Laurie] *) Convert various additional casted stacks to type-safe STACK_OF() variants. [Ben Laurie, Ralf S. Engelschall, Steve Henson] *) Introduce type-safe STACKs. This will almost certainly break lots of code that links with OpenSSL (well at least cause lots of warnings), but fear not: the conversion is trivial, and it eliminates loads of evil casts. A few STACKed things have been converted already. Feel free to convert more. In the fullness of time, I'll do away with the STACK type altogether. [Ben Laurie] *) Add `openssl ca -revoke ' facility which revokes a certificate specified in 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 , 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'. [Ralf S. Engelschall] *) Make sure a corresponding plain text error message exists for the X509_V_ERR_CERT_REVOKED/23 error number which can occur when a verify callback function determined that a certificate was revoked. [Ralf S. Engelschall] *) Bugfix: In test/testenc, don't test "openssl " for ciphers that were excluded, e.g. by -DNO_IDEA. Also, test all available cipers 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. [Bodo Moeller] *) Bugfix: s_client occasionally would sleep in select() when it should have checked SSL_pending() first. [Bodo Moeller] *) New functions DSA_do_sign and DSA_do_verify to provide access to the raw DSA values prior to ASN.1 encoding. [Ulf Möller] *) Tweaks to Configure [Niels Poppe ] *) Add support for PKCS#5 v2.0 ASN1 PBES2 structures. No other support, yet... [Steve Henson] *) New variables $(RANLIB) and $(PERL) in the Makefiles. [Ulf Möller] *) New config option to avoid instructions that are illegal on the 80386. The default code is faster, but requires at least a 486. [Ulf Möller] *) Got rid of old SSL2_CLIENT_VERSION (inconsistently used) and SSL2_SERVER_VERSION (not used at all) macros, which are now the same as SSL2_VERSION anyway. [Bodo Moeller] *) New "-showcerts" option for s_client. [Bodo Moeller] *) Still more PKCS#12 integration. Add pkcs12 application to openssl application. Various cleanups and fixes. [Steve Henson] *) More PKCS#12 integration. Add new pkcs12 directory with Makefile.ssl and modify error routines to work internally. Add error codes and PBE init to library startup routines. [Steve Henson] *) Further PKCS#12 integration. Added password based encryption, PKCS#8 and packing functions to asn1 and evp. Changed function names and error codes along the way. [Steve Henson] *) PKCS12 integration: and so it begins... First of several patches to slowly integrate PKCS#12 functionality into OpenSSL. Add PKCS#12 objects to objects.h [Steve Henson] *) Add a new 'indent' option to some X509V3 extension code. Initial ASN1 and display support for Thawte strong extranet extension. [Steve Henson] *) Add LinuxPPC support. [Jeff Dubrule ] *) Get rid of redundant BN file bn_mulw.c, and rename bn_div64 to bn_div_words in alpha.s. [Hannes Reinecke and Ben Laurie] *) Make sure the RSA OAEP test is skipped under -DRSAref because OAEP isn't supported when OpenSSL is built with RSAref. [Ulf Moeller ] *) Move definitions of IS_SET/IS_SEQUENCE inside crypto/asn1/asn1.h so they no longer are missing under -DNOPROTO. [Soren S. Jorvang ] 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! [Ben Laurie] *) Fix a security hole, that allows sessions to be reused in the wrong context thus bypassing client cert protection! All software that uses client certs and session caches in multiple contexts NEEDS PATCHING to allow session reuse! A fuller solution is in the works. [Ben Laurie, problem pointed out by Holger Reif, Bodo Moeller (and ???)] *) Some more source tree cleanups (removed obsolete files crypto/bf/asm/bf586.pl, test/test.txt and crypto/sha/asm/f.s; changed permission on "config" script to be executable) and a fix for the INSTALL document. [Ulf Moeller ] *) Remove some legacy and erroneous uses of malloc, free instead of Malloc, Free. [Lennart Bang , with minor changes by Steve] *) Make rsa_oaep_test return non-zero on error. [Ulf Moeller ] *) Add support for native Solaris shared libraries. Configure solaris-sparc-sc4-pic, make, then run shlib/solaris-sc4.sh. It'd be nice if someone would make that last step automatic. [Matthias Loepfe ] *) ctx_size was not built with the right compiler during "make links". Fixed. [Ben Laurie] *) Change the meaning of 'ALL' in the cipher list. It now means "everything except NULL ciphers". This means the default cipher list will no longer enable NULL ciphers. They need to be specifically enabled e.g. with the string "DEFAULT:eNULL". [Steve Henson] *) Fix to RSA private encryption routines: if p < q then it would occasionally produce an invalid result. This will only happen with externally generated keys because OpenSSL (and SSLeay) ensure p > q. [Steve Henson] *) Be less restrictive and allow also `perl util/perlpath.pl /path/to/bin/perl' in addition to `perl util/perlpath.pl /path/to/bin', because this way one can also use an interpreter named `perl5' (which is usually the name of Perl 5.xxx on platforms where an Perl 4.x is still installed as `perl'). [Matthias Loepfe ] *) Let util/clean-depend.pl work also with older Perl 5.00x versions. [Matthias Loepfe ] *) Fix Makefile.org so CC,CFLAG etc are passed to 'make links' add advapi32.lib to Win32 build and change the pem test comparision to fc.exe (thanks to Ulrich Kroener for the suggestion). Fix misplaced ASNI prototypes and declarations in evp.h and crypto/des/ede_cbcm_enc.c. [Steve Henson] *) DES quad checksum was broken on big-endian architectures. Fixed. [Ben Laurie] *) Comment out two functions in bio.h that aren't implemented. Fix up the Win32 test batch file so it (might) work again. The Win32 test batch file is horrible: I feel ill.... [Steve Henson] *) Move various #ifdefs around so NO_SYSLOG, NO_DIRENT etc are now selected in e_os.h. Audit of header files to check ANSI and non ANSI sections: 10 functions were absent from non ANSI section and not exported from Windows DLLs. Fixed up libeay.num for new functions. [Steve Henson] *) Make `openssl version' output lines consistent. [Ralf S. Engelschall] *) Fix Win32 symbol export lists for BIO functions: Added BIO_get_ex_new_index, BIO_get_ex_num, BIO_get_ex_data and BIO_set_ex_data to ms/libeay{16,32}.def. [Ralf S. Engelschall] *) Second round of fixing the OpenSSL perl/ stuff. It now at least compiled fine under Unix and passes some trivial tests I've now added. But the whole stuff is horribly incomplete, so a README.1ST with a disclaimer was added to make sure no one expects that this stuff really works in the OpenSSL 0.9.2 release. Additionally I've started to clean the XS sources up and fixed a few little bugs and inconsistencies in OpenSSL.{pm,xs} and openssl_bio.xs. [Ralf S. Engelschall] *) Fix the generation of two part addresses in perl. [Kenji Miyake , integrated by Ben Laurie] *) Add config entry for Linux on MIPS. [John Tobey ] *) Make links whenever Configure is run, unless we are on Windoze. [Ben Laurie] *) Permit extensions to be added to CRLs using crl_section in openssl.cnf. Currently only issuerAltName and AuthorityKeyIdentifier make any sense in CRLs. [Steve Henson] *) 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 everytime: One now can use ``perl Configure :
'', i.e. platform ids are allowed to have details appended to them (seperated by colons). This is treated as there would be a static pre-configured entry in Configure's %table under key with value
and ``perl Configure '' 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:::"'' now, which overrides the FreeBSD-elf entry on-the-fly. [Ralf S. Engelschall] *) Disable new TLS1 ciphersuites by default: they aren't official yet. [Ben Laurie] *) Allow DSO flags like -fpic, -fPIC, -KPIC etc. to be specified on the `perl Configure ...' command line. This way one can compile OpenSSL libraries with Position Independent Code (PIC) which is needed for linking it into DSOs. [Ralf S. Engelschall] *) Remarkably, export ciphers were totally broken and no-one had noticed! Fixed. [Ben Laurie] *) Cleaned up the LICENSE document: The official contact for any license questions now is the OpenSSL core team under openssl-core@openssl.org. And add a paragraph about the dual-license situation to make sure people recognize that _BOTH_ the OpenSSL license _AND_ the SSLeay license apply to the OpenSSL toolkit. [Ralf S. Engelschall] *) General source tree makefile cleanups: Made `making xxx in yyy...' display consistent in the source tree and replaced `/bin/rm' by `rm'. Additonally cleaned up the `make links' target: Remove unnecessary semicolons, subsequent redundant removes, inline point.sh into mklink.sh to speed processing and no longer clutter the display with confusing stuff. Instead only the actually done links are displayed. [Ralf S. Engelschall] *) Permit null encryption ciphersuites, used for authentication only. It used to be necessary to set the preprocessor define SSL_ALLOW_ENULL to do this. It is now necessary to set SSL_FORBID_ENULL to prevent the use of null encryption. [Ben Laurie] *) Add a bunch of fixes to the PKCS#7 stuff. It used to sometimes reorder signed attributes when verifying signatures (this would break them), the detached data encoding was wrong and public keys obtained using X509_get_pubkey() weren't freed. [Steve Henson] *) Add text documentation for the BUFFER functions. Also added a work around to a Win95 console bug. This was triggered by the password read stuff: the last character typed gets carried over to the next fread(). If you were generating a new cert request using 'req' for example then the last character of the passphrase would be CR which would then enter the first field as blank. [Steve Henson] *) 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. [Ralf S. Engelschall] *) Remove confusing variables in function signatures in files ssl/ssl_lib.c and ssl/ssl.h. [Lennart Bong ] *) Don't install bss_file.c under PREFIX/include/ [Lennart Bong ] *) Get the Win32 compile working again. Modify mkdef.pl so it can handle functions that return function pointers and has support for NT specific stuff. Fix mk1mf.pl and VC-32.pl to support NT differences also. Various #ifdef WIN32 and WINNTs sprinkled about the place and some changes from unsigned to signed types: this was killing the Win32 compile. [Steve Henson] *) Add new certificate file to stack functions, SSL_add_dir_cert_subjects_to_stack() and SSL_add_file_cert_subjects_to_stack(). These largely supplant SSL_load_client_CA_file(), and can be used to add multiple certs easily to a stack (usually this is then handed to SSL_CTX_set_client_CA_list()). This means that Apache-SSL and similar packages don't have to mess around to add as many CAs as they want to the preferred list. [Ben Laurie] *) 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 openssl.doxy as the configuration file. [Ben Laurie] *) Get rid of remaining C++-style comments which strict C compilers hate. [Ralf S. Engelschall, pointed out by Carlos Amengual] *) Changed BN_RECURSION in bn_mont.c to BN_RECURSION_MONT so it is not compiled in by default: it has problems with large keys. [Steve Henson] *) Add a bunch of SSL_xxx() functions for configuring the temporary RSA and DH private keys and/or callback functions which directly correspond to their SSL_CTX_xxx() counterparts but work on a per-connection basis. This is needed for applications which have to configure certificates on a per-connection basis (e.g. Apache+mod_ssl) instead of a per-context basis (e.g. s_server). For the RSA certificate situation is makes no difference, but for the DSA certificate situation this fixes the "no shared cipher" problem where the OpenSSL cipher selection procedure failed because the temporary keys were not overtaken from the context and the API provided no way to reconfigure them. The new functions now let applications reconfigure the stuff and they are in detail: SSL_need_tmp_RSA, SSL_set_tmp_rsa, SSL_set_tmp_dh, SSL_set_tmp_rsa_callback and SSL_set_tmp_dh_callback. Additionally a new non-public-API function ssl_cert_instantiate() is used as a helper function and also to reduce code redundancy inside ssl_rsa.c. [Ralf S. Engelschall] *) Move s_server -dcert and -dkey options out of the undocumented feature area because they are useful for the DSA situation and should be recognized by the users. [Ralf S. Engelschall] *) Fix the cipher decision scheme for export ciphers: the export bits are *not* within SSL_MKEY_MASK or SSL_AUTH_MASK, they are within SSL_EXP_MASK. So, the original variable has to be used instead of the already masked variable. [Richard Levitte ] *) Fix 'port' variable from `int' to `unsigned int' in crypto/bio/b_sock.c [Richard Levitte ] *) 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 *'. [Richard Levitte ] *) Don't hard-code path to Perl interpreter on shebang line of Configure script. Instead use the usual Shell->Perl transition trick. [Ralf S. Engelschall] *) Make `openssl x509 -noout -modulus' functional also for DSA certificates (in addition to RSA certificates) to match the behaviour of `openssl dsa -noout -modulus' as it's already the case for `openssl rsa -noout -modulus'. For RSA the -modulus is the real "modulus" while for DSA currently the public key is printed (a decision which was already done by `openssl dsa -modulus' in the past) which serves a similar purpose. Additionally the NO_RSA no longer completely removes the whole -modulus option; it now only avoids using the RSA stuff. Same applies to NO_DSA now, too. [Ralf S. Engelschall] *) Add Arne Ansper's reliable BIO - this is an encrypted, block-digested BIO. See the source (crypto/evp/bio_ok.c) for more info. [Arne Ansper ] *) Dump the old yucky req code that tried (and failed) to allow raw OIDs to be added. Now both 'req' and 'ca' can use new objects defined in the config file. [Steve Henson] *) Add cool BIO that does syslog (or event log on NT). [Arne Ansper , integrated by Ben Laurie] *) Add support for new TLS ciphersuites, TLS_RSA_EXPORT56_WITH_RC4_56_MD5, TLS_RSA_EXPORT56_WITH_RC2_CBC_56_MD5 and TLS_RSA_EXPORT56_WITH_DES_CBC_SHA, as specified in "56-bit Export Cipher Suites For TLS", draft-ietf-tls-56-bit-ciphersuites-00.txt. [Ben Laurie] *) Add preliminary config info for new extension code. [Steve Henson] *) Make RSA_NO_PADDING really use no padding. [Ulf Moeller ] *) Generate errors when private/public key check is done. [Ben Laurie] *) Overhaul for 'crl' utility. New function X509_CRL_print. Partial support for some CRL extensions and new objects added. [Steve Henson] *) Really fix the ASN1 IMPLICIT bug this time... Partial support for private key usage extension and fuller support for authority key id. [Steve Henson] *) Add OAEP encryption for the OpenSSL crypto library. OAEP is the improved padding method for RSA, which is recommended for new applications in PKCS #1 v2.0 (RFC 2437, October 1998). OAEP (Optimal Asymmetric Encryption Padding) has better theoretical foundations than the ad-hoc padding used in PKCS #1 v1.5. It is secure against Bleichbacher's attack on RSA. [Ulf Moeller , reformatted, corrected and integrated by Ben Laurie] *) Updates to the new SSL compression code [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)] *) Fix so that the version number in the master secret, when passed via RSA, checks that if TLS was proposed, but we roll back to SSLv3 (because the server will not accept higher), that the version number is 0x03,0x01, not 0x03,0x00 [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)] *) Run extensive memory leak checks on SSL apps. Fixed *lots* of memory leaks in ssl/ relating to new X509_get_pubkey() behaviour. Also fixes in apps/ and an unrelated leak in crypto/dsa/dsa_vrf.c [Steve Henson] *) Support for RAW extensions where an arbitrary extension can be created by including its DER encoding. See apps/openssl.cnf for an example. [Steve Henson] *) Make sure latest Perl versions don't interpret some generated C array code as Perl array code in the crypto/err/err_genc.pl script. [Lars Weber <3weber@informatik.uni-hamburg.de>] *) Modify ms/do_ms.bat to not generate assembly language makefiles since not many people have the assembler. Various Win32 compilation fixes and update to the INSTALL.W32 file with (hopefully) more accurate Win32 build instructions. [Steve Henson] *) Modify configure script 'Configure' to automatically create crypto/date.h file under Win32 and also build pem.h from pem.org. New script util/mkfiles.pl to create the MINFO file on environments that can't do a 'make files': perl util/mkfiles.pl >MINFO should work. [Steve Henson] *) Major rework of DES function declarations, in the pursuit of correctness and purity. As a result, many evil casts evaporated, and some weirdness, too. You may find this causes warnings in your code. Zapping your evil casts will probably fix them. Mostly. [Ben Laurie] *) Fix for a typo in asn1.h. Bug fix to object creation script obj_dat.pl. It considered a zero in an object definition to mean "end of object": none of the objects in objects.h have any zeros so it wasn't spotted. [Steve Henson, reported by Erwann ABALEA ] *) Add support for Triple DES Cipher Block Chaining with Output Feedback Masking (CBCM). In the absence of test vectors, the best I have been able to do is check that the decrypt undoes the encrypt, so far. Send me test vectors if you have them. [Ben Laurie] *) Correct calculation of key length for export ciphers (too much space was allocated for null ciphers). This has not been tested! [Ben Laurie] *) Modifications to the mkdef.pl for Win32 DEF file creation. The usage message is now correct (it understands "crypto" and "ssl" on its command line). There is also now an "update" option. This will update the util/ssleay.num and util/libeay.num files with any new functions. If you do a: perl util/mkdef.pl crypto ssl update it will update them. [Steve Henson] *) Overhauled the Perl interface (perl/*): - 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 their history because I've copied them in the repository) - removed obsolete files (the test scripts will be replaced by better Test::Harness variants in the future) [Ralf S. Engelschall] *) First cut for a very conservative source tree cleanup: 1. merge various obsolete readme texts into doc/ssleay.txt where we collect the old documents and readme texts. 2. remove the first part of files where I'm already sure that we no longer need them because of three reasons: either they are just temporary files which were left by Eric or they are preserved original files where I've verified that the diff is also available in the CVS via "cvs diff -rSSLeay_0_8_1b" or they were renamed (as it was definitely the case for the crypto/md/ stuff). [Ralf S. Engelschall] *) More extension code. Incomplete support for subject and issuer alt name, issuer and authority key id. Change the i2v function parameters and add an extra 'crl' parameter in the X509V3_CTX structure: guess what that's for :-) Fix to ASN1 macro which messed up IMPLICIT tag and add f_enum.c which adds a2i, i2a for ENUMERATED. [Steve Henson] *) Preliminary support for ENUMERATED type. This is largely copied from the INTEGER code. [Steve Henson] *) Add new function, EVP_MD_CTX_copy() to replace frequent use of memcpy. [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)] *) Make sure `make rehash' target really finds the `openssl' program. [Ralf S. Engelschall, Matthias Loepfe ] *) Squeeze another 7% of speed out of MD5 assembler, at least on a P2. I'd like to hear about it if this slows down other processors. [Ben Laurie] *) Add CygWin32 platform information to Configure script. [Alan Batie ] *) Fixed ms/32all.bat script: `no_asm' -> `no-asm' [Rainer W. Gerling ] *) New program nseq to manipulate netscape certificate sequences [Steve Henson] *) Modify crl2pkcs7 so it supports multiple -certfile arguments. Fix a few typos. [Steve Henson] *) Fixes to BN code. Previously the default was to define BN_RECURSION but the BN code had some problems that would cause failures when doing certificate verification and some other functions. [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)] *) Add ASN1 and PEM code to support netscape certificate sequences. [Steve Henson] *) Add ASN1 and PEM code to support netscape certificate sequences. [Steve Henson] *) Add several PKIX and private extended key usage OIDs. [Steve Henson] *) Modify the 'ca' program to handle the new extension code. Modify openssl.cnf for new extension format, add comments. [Steve Henson] *) More X509 V3 changes. Fix typo in v3_bitstr.c. Add support to 'req' and add a sample to openssl.cnf so req -x509 now adds appropriate CA extensions. [Steve Henson] *) Continued X509 V3 changes. Add to other makefiles, integrate with the error code, add initial support to X509_print() and x509 application. [Steve Henson] *) Takes a deep breath and start addding X509 V3 extension support code. Add files in crypto/x509v3. Move original stuff to crypto/x509v3/old. All this stuff is currently isolated and isn't even compiled yet. [Steve Henson] *) Continuing patches for GeneralizedTime. Fix up certificate and CRL ASN1 to use ASN1_TIME and modify print routines to use ASN1_TIME_print. Removed the versions check from X509 routines when loading extensions: this allows certain broken certificates that don't set the version properly to be processed. [Steve Henson] *) Deal with irritating shit to do with dependencies, in YAAHW (Yet Another Ad Hoc Way) - Makefile.ssls now all contain local dependencies, which can still be regenerated with "make depend". [Ben Laurie] *) Spelling mistake in C version of CAST-128. [Ben Laurie, reported by Jeremy Hylton ] *) Changes to the error generation code. The perl script err-code.pl now reads in the old error codes and retains the old numbers, only adding new ones if necessary. It also only changes the .err files if new codes are added. The makefiles have been modified to only insert errors when needed (to avoid needlessly modifying header files). This is done by only inserting errors if the .err file is newer than the auto generated C file. To rebuild all the error codes from scratch (the old behaviour) either modify crypto/Makefile.ssl to pass the -regen flag to err_code.pl or delete all the .err files. [Steve Henson] *) CAST-128 was incorrectly implemented for short keys. The C version has been fixed, but is untested. The assembler versions are also fixed, but new assembler HAS NOT BEEN GENERATED FOR WIN32 - the Makefile needs fixing to regenerate it if needed. [Ben Laurie, reported (with fix for C version) by Jun-ichiro itojun Hagino ] *) File was opened incorrectly in randfile.c. [Ulf Möller ] *) Beginning of support for GeneralizedTime. d2i, i2d, check and print functions. Also ASN1_TIME suite which is a CHOICE of UTCTime or GeneralizedTime. ASN1_TIME is the proper type used in certificates et al: it's just almost always a UTCTime. Note this patch adds new error codes so do a "make errors" if there are problems. [Steve Henson] *) Correct Linux 1 recognition in config. [Ulf Möller ] *) Remove pointless MD5 hash when using DSA keys in ca. [Anonymous ] *) Generate an error if given an empty string as a cert directory. Also generate an error if handed NULL (previously returned 0 to indicate an error, but didn't set one). [Ben Laurie, reported by Anonymous ] *) Add prototypes to SSL methods. Make SSL_write's buffer const, at last. [Ben Laurie] *) Fix the dummy function BN_ref_mod_exp() in rsaref.c to have the correct parameters. This was causing a warning which killed off the Win32 compile. [Steve Henson] *) Remove C++ style comments from crypto/bn/bn_local.h. [Neil Costigan ] *) The function OBJ_txt2nid was broken. It was supposed to return a nid based on a text string, looking up short and long names and finally "dot" format. The "dot" format stuff didn't work. Added new function OBJ_txt2obj to do the same but return an ASN1_OBJECT and rewrote OBJ_txt2nid to use it. OBJ_txt2obj can also return objects even if the OID is not part of the table. [Steve Henson] *) Add prototypes to X509 lookup/verify methods, fixing a bug in X509_LOOKUP_by_alias(). [Ben Laurie] *) Sort openssl functions by name. [Ben Laurie] *) Get the gendsa program working (hopefully) and add it to app list. Remove encryption from sample DSA keys (in case anyone is interested the password was "1234"). [Steve Henson] *) Make _all_ *_free functions accept a NULL pointer. [Frans Heymans ] *) If a DH key is generated in s3_srvr.c, don't blow it by trying to use NULL pointers. [Anonymous ] *) s_server should send the CAfile as acceptable CAs, not its own cert. [Bodo Moeller <3moeller@informatik.uni-hamburg.de>] *) Don't blow it for numeric -newkey arguments to apps/req. [Bodo Moeller <3moeller@informatik.uni-hamburg.de>] *) Temp key "for export" tests were wrong in s3_srvr.c. [Anonymous ] *) Add prototype for temp key callback functions SSL_CTX_set_tmp_{rsa,dh}_callback(). [Ben Laurie] *) Make DH_free() tolerate being passed a NULL pointer (like RSA_free() and DSA_free()). Make X509_PUBKEY_set() check for errors in d2i_PublicKey(). [Steve Henson] *) X509_name_add_entry() freed the wrong thing after an error. [Arne Ansper ] *) rsa_eay.c would attempt to free a NULL context. [Arne Ansper ] *) BIO_s_socket() had a broken should_retry() on Windoze. [Arne Ansper ] *) BIO_f_buffer() didn't pass on BIO_CTRL_FLUSH. [Arne Ansper ] *) Make sure the already existing X509_STORE->depth variable is initialized in X509_STORE_new(), but document the fact that this variable is still unused in the certificate verification process. [Ralf S. Engelschall] *) Fix the various library and apps files to free up pkeys obtained from X509_PUBKEY_get() et al. Also allow x509.c to handle netscape extensions. [Steve Henson] *) Fix reference counting in X509_PUBKEY_get(). This makes demos/maurice/example2.c work, amongst others, probably. [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 ' are no longer created. This way we have a single and consistent command line interface `openssl ', similar to `cvs '. [Ralf S. Engelschall, Paul Sutton and Ben Laurie] *) ca.c: move test for DSA keys inside #ifndef NO_DSA. Make pubkey BIT STRING wrapper always have zero unused bits. [Steve Henson] *) Add CA.pl, perl version of CA.sh, add extended key usage OID. [Steve Henson] *) Make the top-level INSTALL documentation easier to understand. [Paul Sutton] *) Makefiles updated to exit if an error occurs in a sub-directory make (including if user presses ^C) [Paul Sutton] *) Make Montgomery context stuff explicit in RSA data structure. [Ben Laurie] *) Fix build order of pem and err to allow for generated pem.h. [Ben Laurie] *) Fix renumbering bug in X509_NAME_delete_entry(). [Ben Laurie] *) Enhanced the err-ins.pl script so it makes the error library number global and can add a library name. This is needed for external ASN1 and other error libraries. [Steve Henson] *) Fixed sk_insert which never worked properly. [Steve Henson] *) Fix ASN1 macros so they can handle indefinite length construted EXPLICIT tags. Some non standard certificates use these: they can now be read in. [Steve Henson] *) Merged the various old/obsolete SSLeay documentation files (doc/xxx.doc) into a single doc/ssleay.txt bundle. This way the information is still preserved but no longer messes up this directory. Now it's new room for the new set of documenation files. [Ralf S. Engelschall] *) SETs were incorrectly DER encoded. This was a major pain, because they shared code with SEQUENCEs, which aren't coded the same. This means that almost everything to do with SETs or SEQUENCEs has either changed name or number of arguments. [Ben Laurie, based on a partial fix by GP Jayan ] *) Fix test data to work with the above. [Ben Laurie] *) Fix the RSA header declarations that hid a bug I fixed in 0.9.0b but was already fixed by Eric for 0.9.1 it seems. [Ben Laurie - pointed out by Ulf Möller ] *) Autodetect FreeBSD3. [Ben Laurie] *) Fix various bugs in Configure. This affects the following platforms: nextstep ncr-scde unixware-2.0 unixware-2.0-pentium sco5-cc. [Ben Laurie] *) Eliminate generated files from CVS. Reorder tests to regenerate files before they are needed. [Ben Laurie] *) Generate Makefile.ssl from Makefile.org (to keep CVS happy). [Ben Laurie] 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. [Ralf S. Engelschall] *) Some fixups to the top-level documents. [Paul Sutton] *) Fixed the nasty bug where rsaref.h was not found under compile-time because the symlink to include/ was missing. [Ralf S. Engelschall] *) Incorporated the popular no-RSA/DSA-only patches which allow to compile a RSA-free SSLeay. [Andrew Cooke / Interrader Ldt., Ralf S. Engelschall] *) Fixed nasty rehash problem under `make -f Makefile.ssl links' when "ssleay" is still not found. [Ralf S. Engelschall] *) Added more platforms to Configure: Cray T3E, HPUX 11, [Ralf S. Engelschall, Beckmann ] *) Updated the README file. [Ralf S. Engelschall] *) Added various .cvsignore files in the CVS repository subdirs to make a "cvs update" really silent. [Ralf S. Engelschall] *) Recompiled the error-definition header files and added missing symbols to the Win32 linker tables. [Ralf S. Engelschall] *) Cleaned up the top-level documents; o new files: CHANGES and LICENSE o merged VERSION, HISTORY* and README* files a CHANGES.SSLeay o merged COPYRIGHT into LICENSE o removed obsolete TODO file o renamed MICROSOFT to INSTALL.W32 [Ralf S. Engelschall] *) Removed dummy files from the 0.9.1b source tree: crypto/asn1/x crypto/bio/cd crypto/bio/fg crypto/bio/grep crypto/bio/vi crypto/bn/asm/......add.c crypto/bn/asm/a.out crypto/dsa/f crypto/md5/f crypto/pem/gmon.out crypto/perlasm/f crypto/pkcs7/build crypto/rsa/f crypto/sha/asm/f crypto/threads/f ms/zzz ssl/f ssl/f.mak test/f util/f.mak util/pl/f util/pl/f.mak crypto/bf/bf_locl.old apps/f [Ralf S. Engelschall] *) Added various platform portability fixes. [Mark J. Cox] *) The Genesis of the OpenSSL rpject: We start with the latest (unreleased) SSLeay version 0.9.1b which Eric A. Young and Tim J. Hudson created while they were working for C2Net until summer 1998. [The OpenSSL Project] Changes between 0.9.0b and 0.9.1b [not released] *) Updated a few CA certificates under certs/ [Eric A. Young] *) Changed some BIGNUM api stuff. [Eric A. Young] *) Various platform ports: OpenBSD, Ultrix, IRIX 64bit, NetBSD, DGUX x86, Linux Alpha, etc. [Eric A. Young] *) New COMP library [crypto/comp/] for SSL Record Layer Compression: RLE (dummy implemented) and ZLIB (really implemented when ZLIB is available). [Eric A. Young] *) Add -strparse option to asn1pars program which parses nested binary structures [Dr Stephen Henson ] *) Added "oid_file" to ssleay.cnf for "ca" and "req" programs. [Eric A. Young] *) DSA fix for "ca" program. [Eric A. Young] *) Added "-genkey" option to "dsaparam" program. [Eric A. Young] *) Added RIPE MD160 (rmd160) message digest. [Eric A. Young] *) Added -a (all) option to "ssleay version" command. [Eric A. Young] *) Added PLATFORM define which is the id given to Configure. [Eric A. Young] *) Added MemCheck_XXXX functions to crypto/mem.c for memory checking. [Eric A. Young] *) Extended the ASN.1 parser routines. [Eric A. Young] *) Extended BIO routines to support REUSEADDR, seek, tell, etc. [Eric A. Young] *) Added a BN_CTX to the BN library. [Eric A. Young] *) Fixed the weak key values in DES library [Eric A. Young] *) Changed API in EVP library for cipher aliases. [Eric A. Young] *) Added support for RC2/64bit cipher. [Eric A. Young] *) Converted the lhash library to the crypto/mem.c functions. [Eric A. Young] *) Added more recognized ASN.1 object ids. [Eric A. Young] *) Added more RSA padding checks for SSL/TLS. [Eric A. Young] *) Added BIO proxy/filter functionality. [Eric A. Young] *) Added extra_certs to SSL_CTX which can be used send extra CA certificates to the client in the CA cert chain sending process. It can be configured with SSL_CTX_add_extra_chain_cert(). [Eric A. Young] *) Now Fortezza is denied in the authentication phase because this is key exchange mechanism is not supported by SSLeay at all. [Eric A. Young] *) Additional PKCS1 checks. [Eric A. Young] *) Support the string "TLSv1" for all TLS v1 ciphers. [Eric A. Young] *) Added function SSL_get_ex_data_X509_STORE_CTX_idx() which gives the ex_data index of the SSL context in the X509_STORE_CTX ex_data. [Eric A. Young] *) Fixed a few memory leaks. [Eric A. Young] *) Fixed various code and comment typos. [Eric A. Young] *) A minor bug in ssl/s3_clnt.c where there would always be 4 0 bytes sent in the client random. [Edward Bishop ] diff --git a/Configure b/Configure index fd7988e2b3d9..60386d395987 100755 --- a/Configure +++ b/Configure @@ -1,2312 +1,2312 @@ : eval 'exec perl -S $0 ${1+"$@"}' if $running_under_some_shell; ## ## Configure -- OpenSSL source tree configuration script ## require 5.000; use strict; use File::Compare; # see INSTALL for instructions. my $usage="Usage: Configure [no- ...] [enable- ...] [experimental- ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n"; # Options: # # --openssldir install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the # --prefix option is given; /usr/local/ssl otherwise) # --prefix prefix for the OpenSSL include, lib and bin directories # (Default: the OPENSSLDIR directory) # # --install_prefix Additional prefix for package builders (empty by # default). This needn't be set in advance, you can # just as well use "make INSTALL_PREFIX=/whatever install". # # --with-krb5-dir Declare where Kerberos 5 lives. The libraries are expected # to live in the subdirectory lib/ and the header files in # include/. A value is required. # --with-krb5-lib Declare where the Kerberos 5 libraries live. A value is # required. # (Default: KRB5_DIR/lib) # --with-krb5-include Declare where the Kerberos 5 header files live. A # value is required. # (Default: KRB5_DIR/include) # --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently # supported values are "MIT" and "Heimdal". A value is required. # # --test-sanity Make a number of sanity checks on the data in this file. # This is a debugging tool for OpenSSL developers. # # --cross-compile-prefix Add specified prefix to binutils components. # # no-hw-xxx do not compile support for specific crypto hardware. # Generic OpenSSL-style methods relating to this support # are always compiled but return NULL if the hardware # support isn't compiled. # no-hw do not compile support for any crypto hardware. # [no-]threads [don't] try to create a library that is suitable for # multithreaded applications (default is "threads" if we # know how to do it) # [no-]shared [don't] try to create shared libraries when supported. # no-asm do not use assembler # no-dso do not compile in any native shared-library methods. This # will ensure that all methods just return NULL. # no-krb5 do not compile in any KRB5 library or code. # [no-]zlib [don't] compile support for zlib compression. # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. # 386 generate 80386 code in assembly modules # no-sse2 disables IA-32 SSE2 code in assembly modules, the above # mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # # DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items # provided to stack calls. Generates unique stack functions for # each possible stack type. # DES_PTR use pointer lookup vs arrays in the DES in crypto/des/des_locl.h # DES_RISC1 use different DES_ENCRYPT macro that helps reduce register # dependancies but needs to more registers, good for RISC CPU's # DES_RISC2 A different RISC variant. # DES_UNROLL unroll the inner DES loop, sometimes helps, somtimes hinders. # DES_INT use 'int' instead of 'long' for DES_LONG in crypto/des/des.h # This is used on the DEC Alpha where long is 8 bytes # and int is 4 # BN_LLONG use the type 'long long' in crypto/bn/bn.h # MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h # MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h # IDEA_SHORT use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h # IDEA_LONG use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h # RC2_SHORT use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h # RC2_LONG use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h # RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h # RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h # RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on # array lookups instead of pointer use. # RC4_CHUNK enables code that handles data aligned at long (natural CPU # word) boundary. # RC4_CHUNK_LL enables code that handles data aligned at long long boundary # (intended for 64-bit CPUs running 32-bit OS). # BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha). # BF_PTR2 intel specific version (generic version is more efficient). # # Following are set automatically by this script # # MD5_ASM use some extra md5 assember, # SHA1_ASM use some extra sha1 assember, must define L_ENDIAN for x86 # RMD160_ASM use some extra ripemd160 assember, # SHA256_ASM sha256_block is implemented in assembler # SHA512_ASM sha512_block is implemented in assembler # AES_ASM ASE_[en|de]crypt is implemented in assembler # Minimum warning options... any contributions to OpenSSL should at least get # past these. my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wundef -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED"; # TODO(openssl-team): fix problems and investigate if (at least) the following # warnings can also be enabled: # -Wconditional-uninitialized, -Wswitch-enum, -Wunused-macros, # -Wmissing-field-initializers, -Wmissing-variable-declarations, # -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align, # -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token # -Wextended-offsetof my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof"; # These are used in addition to $gcc_devteam_warn when the compiler is clang. # TODO(openssl-team): fix problems and investigate if (at least) the # following warnings can also be enabled: -Wconditional-uninitialized, # -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers, # -Wmissing-variable-declarations, # -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align, # -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token # -Wextended-offsetof my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments"; # Warn that "make depend" should be run? my $warn_make_depend = 0; my $strict_warnings = 0; my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL"; # MD2_CHAR slags pentium pros my $x86_gcc_opts="RC4_INDEX MD2_INT"; # MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT # Don't worry about these normally my $tcc="cc"; my $tflags="-fast -Xa"; my $tbn_mul=""; my $tlib="-lnsl -lsocket"; #$bits1="SIXTEEN_BIT "; #$bits2="THIRTY_TWO_BIT "; my $bits1="THIRTY_TWO_BIT "; my $bits2="SIXTY_FOUR_BIT "; my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o::des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o:"; my $x86_elf_asm="$x86_asm:elf"; my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o aesni-gcm-x86_64.o:"; my $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::ghash-ia64.o::void"; my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o::void"; my $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o:::::::::::::void"; my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o::void"; my $mips64_asm=":bn-mips.o mips-mont.o:::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::"; my $mips32_asm=$mips64_asm; $mips32_asm =~ s/\s*sha512\-mips\.o//; my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o:::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o:"; my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o::void"; my $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:"; my $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::32"; my $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::64"; my $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o:"; my $ppc32_asm=$ppc64_asm; my $no_asm="::::::::::::::::void"; # As for $BSDthreads. Idea is to maintain "collective" set of flags, # which would cover all BSD flavors. -pthread applies to them all, # but is treated differently. OpenBSD expands is as -D_POSIX_THREAD # -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r, # which has to be accompanied by explicit -D_THREAD_SAFE and # sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which # seems to be sufficient? my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT"; #config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $ec_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $modes_obj : $engines_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib my %table=( # File 'TABLE' (created by 'make TABLE') contains the data from this list, # formatted for better readability. #"b", "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::", #"bl-4c-2c", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::", #"bl-4c-ri", "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::", #"b2-is-ri-dp", "${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::", # Our development configs "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", "debug-ben", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::", "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", "debug-ben-debug-64", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::", "debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::", "debug-ben-darwin64","cc:$gcc_devteam_warn -g -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-ben-debug-64-clang", "clang:$gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Qunused-arguments -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::", "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", "debug-bodo", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", "debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", "debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o::des-586.o crypt586.o:aes_x86core.o aes_cbc.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::ghash-x86.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "dist", "cc:-O::(unknown)::::::", # Basic configs that should work on any (32 and less bit) box "gcc", "gcc:-O3::(unknown):::BN_LLONG:::", "cc", "cc:-O::(unknown)::::::", ####VOS Configurations "vos-gcc","gcc:-O3 -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", "debug-vos-gcc","gcc:-O0 -g -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", #### Solaris x86 with GNU C setups # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it # here because whenever GNU C instantiates an assembler template it # surrounds it with #APP #NO_APP comment pair which (at least Solaris # 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic" # error message. "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # -shared -static-libgcc might appear controversial, but modules taken # from static libgcc do not have relocations and linking them into our # shared objects doesn't have any negative side-effects. On the contrary, # doing so makes it possible to use gcc shared build with Sun C. Given # that gcc generates faster code [thanks to inline assembler], I would # actually recommend to consider using gcc shared build even with vendor # compiler:-) # "solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", #### Solaris x86 with Sun C setups "solaris-x86-cc","cc:-fast -xarch=generic -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", #### SPARC Solaris with GNU C setups "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv8-gcc","gcc:-mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc "solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", #### "debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### SPARC Solaris with Sun C setups # SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2. # SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8 # SC5.0 note: Compiler common patch 107357-01 or later is required! "solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", #### "debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### SunOS configs, assuming sparc for the gcc one. #"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::", "sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::", #### IRIX 5.x configs # -mips2 flag is added by ./config when appropriate. "irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "irix-cc", "cc:-O2 -use_readonly_const -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### IRIX 6.x configs # Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke # './Configure irix-cc -o32' manually. "irix-mips3-gcc","gcc:-mabi=n32 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32", "irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips64_asm}:n32:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32", # N64 ABI builds. "irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips64_asm}:64:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", #### Unified HP-UX ANSI C configs. # Special notes: # - Originally we were optimizing at +O4 level. It should be noted # that the only difference between +O3 and +O4 is global inter- # procedural analysis. As it has to be performed during the link # stage the compiler leaves behind certain pseudo-code in lib*.a # which might be release or even patch level specific. Generating # the machine code for and analyzing the *whole* program appears # to be *extremely* memory demanding while the performance gain is # actually questionable. The situation is intensified by the default # HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB # which is way too low for +O4. In other words, doesn't +O3 make # more sense? # - Keep in mind that the HP compiler by default generates code # suitable for execution on the host you're currently compiling at. # If the toolkit is ment to be used on various PA-RISC processors # consider './config +DAportable'. # - +DD64 is chosen in favour of +DA2.0W because it's meant to be # compatible with *future* releases. # - If you run ./Configure hpux-parisc-[g]cc manually don't forget to # pass -D_REENTRANT on HP-UX 10 and later. # - -DMD32_XARRAY triggers workaround for compiler bug we ran into in # 32-bit message digests. (For the moment of this writing) HP C # doesn't seem to "digest" too many local variables (they make "him" # chew forever:-). For more details look-up MD32_XARRAY comment in # crypto/sha/sha_lcl.h. # # # Since there is mention of this in shlib/hpux10-cc.sh "hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc1_1-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${parisc11_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1", "hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32", "hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o:::::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64", # More attempts at unified 10.X and 11.X targets for HP C compiler. # # Chris Ruemmler # Kevin Steves "hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-parisc1_1-cc","cc:+DA1.1 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${parisc11_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa1.1", "hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32", "hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${parisc20_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64", # HP/UX IA-64 targets "hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32", # Frank Geurts has patiently assisted with # with debugging of the following config. "hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux64", # GCC builds... "hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32", "hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux64", # Legacy HPUX 9.X configs... "hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "hpux-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### HP MPE/iX http://jazz.external.hp.com/src/openssl/ "MPE/iX-gcc", "gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::", # DEC Alpha OSF/1/Tru64 targets. # # "What's in a name? That which we call a rose # By any other word would smell as sweet." # # - William Shakespeare, "Romeo & Juliet", Act II, scene II. # # For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version # "osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so", "osf1-alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so", "tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared::-msym:.so", #### #### Variety of LINUX:-) #### # *-generic* is endian-neutral target, but ./config is free to # throw in -D[BL]_ENDIAN, whichever appropriate... "linux-generic32","gcc:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ppc", "gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ####################################################################### # Note that -march is not among compiler options in below linux-armv4 # target line. Not specifying one is intentional to give you choice to: # # a) rely on your compiler default by not specifying one; # b) specify your target platform explicitly for optimal performance, # e.g. -march=armv6 or -march=armv7-a; # c) build "universal" binary that targets *range* of platforms by # specifying minimum and maximum supported architecture; # # As for c) option. It actually makes no sense to specify maximum to be # less than ARMv7, because it's the least requirement for run-time # switch between platform-specific code paths. And without run-time # switch performance would be equivalent to one for minimum. Secondly, # there are some natural limitations that you'd have to accept and # respect. Most notably you can *not* build "universal" binary for # big-endian platform. This is because ARMv7 processor always picks # instructions in little-endian order. Another similar limitation is # that -mthumb can't "cross" -march=armv6t2 boundary, because that's # where it became Thumb-2. Well, this limitation is a bit artificial, # because it's not really impossible, but it's deemed too tricky to # support. And of course you have to be sure that your binutils are # actually up to the task of handling maximum target platform. With all # this in mind here is an example of how to configure "universal" build: # # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8 # "linux-armv4", "gcc: -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-aarch64","gcc: -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # Configure script adds minimally required -march for assembly support, # if no -march was specified at command line. mips32 and mips64 below # refer to contemporary MIPS Architecture specifications, MIPS32 and # MIPS64, rather than to kernel bitness. "linux-mips32", "gcc:-mabi=32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-mips64", "gcc:-mabi=n32 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:n32:dlfcn:linux-shared:-fPIC:-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32", "linux64-mips64", "gcc:-mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:64:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", #### IA-32 targets... "linux-ia32-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-elf", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-aout", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out", #### "linux-generic64","gcc:-O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ppc64", "gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-ppc64le","gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:$ppc64_asm:linux64le:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::", "linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-x86_64", "gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-x86_64-clang", "clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "debug-linux-x86_64-clang", "clang: -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", "linux-x32", "gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32", "linux64-s390x", "gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", #### So called "highgprs" target for z/Architecture CPUs # "Highgprs" is kernel feature first implemented in Linux 2.6.32, see # /proc/cpuinfo. The idea is to preserve most significant bits of # general purpose registers not only upon 32-bit process context # switch, but even on asynchronous signal delivery to such process. # This makes it possible to deploy 64-bit instructions even in legacy # application context and achieve better [or should we say adequate] # performance. The build is binary compatible with linux-generic32, # and the idea is to be able to install the resulting libcrypto.so # alongside generic one, e.g. as /lib/highgprs/libcrypto.so.x.y, for # ldconfig and run-time linker to autodiscover. Unfortunately it # doesn't work just yet, because of couple of bugs in glibc # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1... "linux32-s390x", "gcc:-m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$s390x_asm;$asm=~s/bn\-s390x\.o/bn_asm.o/;$asm}.":31:dlfcn:linux-shared:-fPIC:-m31:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/highgprs", #### SPARC Linux setups # Ray Miller has patiently # assisted with debugging of following two configs. "linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # it's a real mess with -mcpu=ultrasparc option under Linux, but # -Wa,-Av8plus should do the trick no matter what. "linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # GCC 3.1 is a requirement "linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", #### Alpha Linux with GNU C and Compaq C setups # Special notes: # - linux-alpha+bwx-gcc is ment to be used from ./config only. If you # ought to run './Configure linux-alpha+bwx-gcc' manually, do # complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever # which is appropriate. # - If you use ccc keep in mind that -fast implies -arch host and the # compiler is free to issue instructions which gonna make elder CPU # choke. If you wish to build "blended" toolkit, add -arch generic # *after* -fast and invoke './Configure linux-alpha-ccc' manually. # # # "linux-alpha-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}", "linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}", # Android: linux-* but without pointers to headers and libs. "android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### *BSD [do see comment about ${BSDthreads} above!] "BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86-elf", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-BSD-x86-elf", "gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-sparcv8", "gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-generic64","gcc:-O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it # simply *happens* to work around a compiler bug in gcc 3.3.3, # triggered by RIPEMD160 code. "BSD-sparc64", "gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-ia64", "gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "BSD-x86_64", "cc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "nextstep", "cc:-O -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", "nextstep3.3", "cc:-O3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", # NCR MP-RAS UNIX ver 02.03.01 "ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::", # QNX "qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:", "QNX6", "gcc:::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "QNX6-i386", "gcc:-DL_ENDIAN -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # BeOS "beos-x86-r5", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so", "beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so", #### SCO/Caldera targets. # # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc. # Now we only have blended unixware-* as it's the only one used by ./config. # If you want to optimize for particular microarchitecture, bypass ./config # and './Configure unixware-7 -Kpentium_pro' or whatever appropriate. # Note that not all targets include assembler support. Mostly because of # lack of motivation to support out-of-date platforms with out-of-date # compiler drivers and assemblers. Tim Rice has # patiently assisted to debug most of it. # # UnixWare 2.0x fails destest with -O. "unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", "unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::", "unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}-1:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # SCO 5 - Ben Laurie says the -O breaks the SCO cc. "sco5-cc", "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}-1:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### IBM's AIX. "aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", "aix-gcc", "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X32", "aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE # at build time. $OBJECT_MODE is respected at ./config stage! "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", # # Cray T90 and similar (SDSC) # It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT # defined. The T90 ints and longs are 8 bytes long, and apparently the # B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and # non L_ENDIAN code aligns the bytes in each word correctly. # # The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors: #'Taking the address of a bit field is not allowed. ' #'An expression with bit field exists as the operand of "sizeof" ' # (written by Wayne Schroeder ) # # j90 is considered the base machine type for unicos machines, # so this configuration is now called "cray-j90" ... "cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::", # # Cray T3E (Research Center Juelich, beckman@acl.lanl.gov) # # The BIT_FIELD_LIMITS define was written for the C90 (it seems). I added # another use. Basically, the problem is that the T3E uses some bit fields # for some st_addr stuff, and then sizeof and address-of fails # I could not use the ams/alpha.o option because the Cray assembler, 'cam' # did not like it. "cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::", # DGUX, 88100. "dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::", "dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::", "dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", # Sinix/ReliantUNIX RM400 # NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */ "ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:reliantunix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::", "SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::", # SIEMENS BS2000/OSD: an EBCDIC-based mainframe "BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::", # OS/390 Unix an EBCDIC-based Unix system on IBM mainframe # You need to compile using the c89.sh wrapper in the tools directory, because the # IBM compiler does not like the -L switch after any object modules. # "OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::", # Visual C targets # # Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64 "VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32", "VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32", "debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32", "debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32", # x86 Win32 target defaults to ANSI API, if you want UNICODE, complement # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE' -"VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", +"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", # Unified CE target -"debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", +"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", "VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", # Borland C++ 4.5 "BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32", # MinGW "mingw", "gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall::-D_MT:MINGW32:-lws2_32 -lgdi32 -lcrypt32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a", # As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll # compiled with one compiler with application compiled with another # compiler. It's possible to engage Applink support in mingw64 build, # but it's not done, because till mingw64 supports structured exception # handling, one can't seriously consider its binaries for using with # non-mingw64 run-time environment. And as mingw64 is always consistent # with itself, Applink is never engaged and can as well be omitted. "mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE::-D_MT:MINGW64:-lws2_32 -lgdi32 -lcrypt32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a", # UWIN "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", # Cygwin "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a", "Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a", # NetWare from David Ward (dsward@novell.com) # requires either MetroWerks NLM development tools, or gcc / nlmconv # NetWare defaults socket bio to WinSock sockets. However, # the builds can be configured to use BSD sockets instead. # netware-clib => legacy CLib c-runtime support "netware-clib", "mwccnlm::::::${x86_gcc_opts}::", "netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::", "netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::", "netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::", # netware-libc => LibC/NKS support "netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::", "netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::", "netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::", "netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::", # DJGPP "DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:", # Ultrix from Bernhard Simon "ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::", "ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::", # K&R C is no longer supported; you need gcc on old Ultrix installations ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::", ##### MacOS X (a.k.a. Rhapsody or Darwin) setup "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", "darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", # iPhoneOS/iOS "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ##### A/UX "aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", ##### Sony NEWS-OS 4.x "newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::", ##### GNU Hurd "hurd-x86", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC", ##### OS/2 EMX "OS2-EMX", "gcc::::::::", ##### VxWorks for various targets "vxworks-ppc60x","ccppc:-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common:::::", "vxworks-ppcgen","ccppc:-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon:::::", "vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", "vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::", "vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::", "vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", "vxworks-simlinux","ccpentium:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DL_ENDIAN -DCPU=SIMLINUX -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK:::VXWORKS:-r::${no_asm}::::::ranlibpentium:", "vxworks-mips","ccmips:-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DCPU=MIPS32 -msoft-float -mno-branch-likely -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip::-D_REENTRANT:VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon::${mips32_asm}:o32::::::ranlibmips:", ##### Compaq Non-Stop Kernel (Tandem) "tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::", # uClinux "uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::", "uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):SIXTY_FOUR_BIT_LONG:${no_asm}:$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::", ); my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A debug-VC-WIN64I debug-VC-WIN64A VC-NT VC-CE VC-WIN32 debug-VC-WIN32 BC-32 netware-clib netware-clib-bsdsock netware-libc netware-libc-bsdsock); my $idx = 0; my $idx_cc = $idx++; my $idx_cflags = $idx++; my $idx_unistd = $idx++; my $idx_thread_cflag = $idx++; my $idx_sys_id = $idx++; my $idx_lflags = $idx++; my $idx_bn_ops = $idx++; my $idx_cpuid_obj = $idx++; my $idx_bn_obj = $idx++; my $idx_ec_obj = $idx++; my $idx_des_obj = $idx++; my $idx_aes_obj = $idx++; my $idx_bf_obj = $idx++; my $idx_md5_obj = $idx++; my $idx_sha1_obj = $idx++; my $idx_cast_obj = $idx++; my $idx_rc4_obj = $idx++; my $idx_rmd160_obj = $idx++; my $idx_rc5_obj = $idx++; my $idx_wp_obj = $idx++; my $idx_cmll_obj = $idx++; my $idx_modes_obj = $idx++; my $idx_engines_obj = $idx++; my $idx_perlasm_scheme = $idx++; my $idx_dso_scheme = $idx++; my $idx_shared_target = $idx++; my $idx_shared_cflag = $idx++; my $idx_shared_ldflag = $idx++; my $idx_shared_extension = $idx++; my $idx_ranlib = $idx++; my $idx_arflags = $idx++; my $idx_multilib = $idx++; my $prefix=""; my $libdir=""; my $openssldir=""; my $exe_ext=""; my $install_prefix= "$ENV{'INSTALL_PREFIX'}"; my $cross_compile_prefix=""; my $fipsdir="/usr/local/ssl/fips-2.0"; my $fipslibdir=""; my $baseaddr="0xFB00000"; my $no_threads=0; my $threads=0; my $no_shared=0; # but "no-shared" is default my $zlib=1; # but "no-zlib" is default my $no_krb5=0; # but "no-krb5" is implied unless "--with-krb5-..." is used my $no_rfc3779=1; # but "no-rfc3779" is default my $no_asm=0; my $no_dso=0; my $no_gmp=0; my @skip=(); my $Makefile="Makefile"; my $des_locl="crypto/des/des_locl.h"; my $des ="crypto/des/des.h"; my $bn ="crypto/bn/bn.h"; my $md2 ="crypto/md2/md2.h"; my $rc4 ="crypto/rc4/rc4.h"; my $rc4_locl="crypto/rc4/rc4_locl.h"; my $idea ="crypto/idea/idea.h"; my $rc2 ="crypto/rc2/rc2.h"; my $bf ="crypto/bf/bf_locl.h"; my $bn_asm ="bn_asm.o"; my $des_enc="des_enc.o fcrypt_b.o"; my $aes_enc="aes_core.o aes_cbc.o"; my $bf_enc ="bf_enc.o"; my $cast_enc="c_enc.o"; my $rc4_enc="rc4_enc.o rc4_skey.o"; my $rc5_enc="rc5_enc.o"; my $md5_obj=""; my $sha1_obj=""; my $rmd160_obj=""; my $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o"; my $processor=""; my $default_ranlib; my $perl; my $fips=0; if (exists $ENV{FIPSDIR}) { $fipsdir = $ENV{FIPSDIR}; $fipsdir =~ s/\/$//; } # All of the following is disabled by default (RC5 was enabled before 0.9.8): my %disabled = ( # "what" => "comment" [or special keyword "experimental"] "ec_nistp_64_gcc_128" => "default", "gmp" => "default", "jpake" => "experimental", "libunbound" => "experimental", "md2" => "default", "rc5" => "default", "rfc3779" => "default", "sctp" => "default", "shared" => "default", "ssl-trace" => "default", "ssl2" => "default", "store" => "experimental", "unit-test" => "default", "weak-ssl-ciphers" => "default", "zlib" => "default", "zlib-dynamic" => "default" ); my @experimental = (); # This is what $depflags will look like with the above defaults # (we need this to see if we should advise the user to run "make depend"): my $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS"; # Explicit "no-..." options will be collected in %disabled along with the defaults. # To remove something from %disabled, use "enable-foo" (unless it's experimental). # For symmetry, "disable-foo" is a synonym for "no-foo". # For features called "experimental" here, a more explicit "experimental-foo" is needed to enable. # We will collect such requests in @experimental. # To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO. my $no_sse2=0; &usage if ($#ARGV < 0); my $flags; my $depflags; my $openssl_experimental_defines; my $openssl_algorithm_defines; my $openssl_thread_defines; my $openssl_sys_defines=""; my $openssl_other_defines; my $libs; my $libkrb5=""; my $target; my $options; my $symlink; my $make_depend=0; my %withargs=(); my @argvcopy=@ARGV; my $argvstring=""; my $argv_unprocessed=1; while($argv_unprocessed) { $flags=""; $depflags=""; $openssl_experimental_defines=""; $openssl_algorithm_defines=""; $openssl_thread_defines=""; $openssl_sys_defines=""; $openssl_other_defines=""; $libs=""; $target=""; $options=""; $symlink=1; $argv_unprocessed=0; $argvstring=join(' ',@argvcopy); PROCESS_ARGS: foreach (@argvcopy) { s /^-no-/no-/; # some people just can't read the instructions # rewrite some options in "enable-..." form s /^-?-?shared$/enable-shared/; s /^sctp$/enable-sctp/; s /^threads$/enable-threads/; s /^zlib$/enable-zlib/; s /^zlib-dynamic$/enable-zlib-dynamic/; if (/^no-(.+)$/ || /^disable-(.+)$/) { if (!($disabled{$1} eq "experimental")) { if ($1 eq "ssl") { $disabled{"ssl2"} = "option(ssl)"; $disabled{"ssl3"} = "option(ssl)"; } elsif ($1 eq "tls") { $disabled{"tls1"} = "option(tls)" } elsif ($1 eq "ssl3-method") { $disabled{"ssl3-method"} = "option(ssl)"; $disabled{"ssl3"} = "option(ssl)"; } else { $disabled{$1} = "option"; } } } elsif (/^enable-(.+)$/ || /^experimental-(.+)$/) { my $algo = $1; if ($disabled{$algo} eq "experimental") { die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n" unless (/^experimental-/); push @experimental, $algo; } delete $disabled{$algo}; $threads = 1 if ($algo eq "threads"); } elsif (/^--test-sanity$/) { exit(&test_sanity()); } elsif (/^--strict-warnings/) { $strict_warnings = 1; } elsif (/^reconfigure/ || /^reconf/) { if (open(IN,"<$Makefile")) { while () { chomp; if (/^CONFIGURE_ARGS=(.*)/) { $argvstring=$1; @argvcopy=split(' ',$argvstring); die "Incorrect data to reconfigure, please do a normal configuration\n" if (grep(/^reconf/,@argvcopy)); print "Reconfiguring with: $argvstring\n"; $argv_unprocessed=1; close(IN); last PROCESS_ARGS; } } close(IN); } die "Insufficient data to reconfigure, please do a normal configuration\n"; } elsif (/^386$/) { $processor=386; } elsif (/^fips$/) { $fips=1; } elsif (/^rsaref$/) { # No RSAref support any more since it's not needed. # The check for the option is there so scripts aren't # broken } elsif (/^[-+]/) { if (/^--prefix=(.*)$/) { $prefix=$1; } elsif (/^--libdir=(.*)$/) { $libdir=$1; } elsif (/^--openssldir=(.*)$/) { $openssldir=$1; } elsif (/^--install.prefix=(.*)$/) { $install_prefix=$1; } elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/) { $withargs{"krb5-".$1}=$2; } elsif (/^--with-zlib-lib=(.*)$/) { $withargs{"zlib-lib"}=$1; } elsif (/^--with-zlib-include=(.*)$/) { $withargs{"zlib-include"}="-I$1"; } elsif (/^--with-fipsdir=(.*)$/) { $fipsdir="$1"; } elsif (/^--with-fipslibdir=(.*)$/) { $fipslibdir="$1"; } elsif (/^--with-baseaddr=(.*)$/) { $baseaddr="$1"; } elsif (/^--cross-compile-prefix=(.*)$/) { $cross_compile_prefix=$1; } elsif (/^-[lL](.*)$/ or /^-Wl,/) { $libs.=$_." "; } else # common if (/^[-+]/), just pass down... { $_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei; $flags.=$_." "; } } elsif ($_ =~ /^([^:]+):(.+)$/) { eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string $target=$1; } else { die "target already defined - $target (offending arg: $_)\n" if ($target ne ""); $target=$_; } unless ($_ eq $target || /^no-/ || /^disable-/) { # "no-..." follows later after implied disactivations # have been derived. (Don't take this too seroiusly, # we really only write OPTIONS to the Makefile out of # nostalgia.) if ($options eq "") { $options = $_; } else { $options .= " ".$_; } } } } if ($processor eq "386") { $disabled{"sse2"} = "forced"; } if (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "") { $disabled{"krb5"} = "krb5-flavor not specified"; } if (!defined($disabled{"zlib-dynamic"})) { # "zlib-dynamic" was specifically enabled, so enable "zlib" delete $disabled{"zlib"}; } if (defined($disabled{"rijndael"})) { $disabled{"aes"} = "forced"; } if (defined($disabled{"des"})) { $disabled{"mdc2"} = "forced"; } if (defined($disabled{"ec"})) { $disabled{"ecdsa"} = "forced"; $disabled{"ecdh"} = "forced"; } # SSL 2.0 requires MD5 and RSA if (defined($disabled{"md5"}) || defined($disabled{"rsa"})) { $disabled{"ssl2"} = "forced"; } if ($fips && $fipslibdir eq "") { $fipslibdir = $fipsdir . "/lib/"; } # RSAX ENGINE sets default non-FIPS RSA method. if ($fips) { $disabled{"rsax"} = "forced"; } # SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH if (defined($disabled{"md5"}) || defined($disabled{"sha"}) || (defined($disabled{"rsa"}) && (defined($disabled{"dsa"}) || defined($disabled{"dh"})))) { $disabled{"ssl3"} = "forced"; $disabled{"tls1"} = "forced"; } if (defined($disabled{"ec"}) || defined($disabled{"dsa"}) || defined($disabled{"dh"})) { $disabled{"gost"} = "forced"; } # SRP and HEARTBEATS require TLSEXT if (defined($disabled{"tlsext"})) { $disabled{"srp"} = "forced"; $disabled{"heartbeats"} = "forced"; } if ($target eq "TABLE") { foreach $target (sort keys %table) { print_table_entry($target); } exit 0; } if ($target eq "LIST") { foreach (sort keys %table) { print; print "\n"; } exit 0; } if ($target =~ m/^CygWin32(-.*)$/) { $target = "Cygwin".$1; } print "Configuring for $target\n"; &usage if (!defined($table{$target})); foreach (sort (keys %disabled)) { $options .= " no-$_"; printf " no-%-12s %-10s", $_, "[$disabled{$_}]"; if (/^dso$/) { $no_dso = 1; } elsif (/^threads$/) { $no_threads = 1; } elsif (/^shared$/) { $no_shared = 1; } elsif (/^zlib$/) { $zlib = 0; } elsif (/^static-engine$/) { } elsif (/^zlib-dynamic$/) { } elsif (/^symlinks$/) { $symlink = 0; } elsif (/^sse2$/) { $no_sse2 = 1; } else { my ($ALGO, $algo); ($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/; if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/) { $openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n"; print " OPENSSL_NO_$ALGO"; if (/^err$/) { $flags .= "-DOPENSSL_NO_ERR "; } elsif (/^asm$/) { $no_asm = 1; } } else { $openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n"; print " OPENSSL_NO_$ALGO"; if (/^krb5$/) { $no_krb5 = 1; } else { push @skip, $algo; # fix-up crypto/directory name(s) @skip[$#skip]="whrlpool" if $algo eq "whirlpool"; print " (skip dir)"; $depflags .= " -DOPENSSL_NO_$ALGO"; } } } print "\n"; } my $exp_cflags = ""; foreach (sort @experimental) { my $ALGO; ($ALGO = $_) =~ tr/[a-z]/[A-Z]/; # opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined $openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n"; $exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO"; } my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds; $exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/); $exe_ext=".nlm" if ($target =~ /netware/); $exe_ext=".pm" if ($target =~ /vos/); $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq ""); $prefix=$openssldir if $prefix eq ""; $default_ranlib= &which("ranlib") or $default_ranlib="true"; $perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl") or $perl="perl"; my $make = $ENV{'MAKE'} || "make"; $cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq ""; chop $openssldir if $openssldir =~ /\/$/; chop $prefix if $prefix =~ /.\/$/; $openssldir=$prefix . "/ssl" if $openssldir eq ""; $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/; print "IsMK1MF=$IsMK1MF\n"; my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); my $cc = $fields[$idx_cc]; # Allow environment CC to override compiler... if($ENV{CC}) { $cc = $ENV{CC}; } my $cflags = $fields[$idx_cflags]; my $unistd = $fields[$idx_unistd]; my $thread_cflag = $fields[$idx_thread_cflag]; my $sys_id = $fields[$idx_sys_id]; my $lflags = $fields[$idx_lflags]; my $bn_ops = $fields[$idx_bn_ops]; my $cpuid_obj = $fields[$idx_cpuid_obj]; my $bn_obj = $fields[$idx_bn_obj]; my $ec_obj = $fields[$idx_ec_obj]; my $des_obj = $fields[$idx_des_obj]; my $aes_obj = $fields[$idx_aes_obj]; my $bf_obj = $fields[$idx_bf_obj]; my $md5_obj = $fields[$idx_md5_obj]; my $sha1_obj = $fields[$idx_sha1_obj]; my $cast_obj = $fields[$idx_cast_obj]; my $rc4_obj = $fields[$idx_rc4_obj]; my $rmd160_obj = $fields[$idx_rmd160_obj]; my $rc5_obj = $fields[$idx_rc5_obj]; my $wp_obj = $fields[$idx_wp_obj]; my $cmll_obj = $fields[$idx_cmll_obj]; my $modes_obj = $fields[$idx_modes_obj]; my $engines_obj = $fields[$idx_engines_obj]; my $perlasm_scheme = $fields[$idx_perlasm_scheme]; my $dso_scheme = $fields[$idx_dso_scheme]; my $shared_target = $fields[$idx_shared_target]; my $shared_cflag = $fields[$idx_shared_cflag]; my $shared_ldflag = $fields[$idx_shared_ldflag]; my $shared_extension = $fields[$idx_shared_extension]; my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib]; my $ar = $ENV{'AR'} || "ar"; my $arflags = $fields[$idx_arflags]; my $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres"; my $multilib = $fields[$idx_multilib]; # if $prefix/lib$multilib is not an existing directory, then # assume that it's not searched by linker automatically, in # which case adding $multilib suffix causes more grief than # we're ready to tolerate, so don't... $multilib="" if !-d "$prefix/lib$multilib"; $libdir="lib$multilib" if $libdir eq ""; $cflags = "$cflags$exp_cflags"; # '%' in $lflags is used to split flags to "pre-" and post-flags my ($prelflags,$postlflags)=split('%',$lflags); if (defined($postlflags)) { $lflags=$postlflags; } else { $lflags=$prelflags; undef $prelflags; } if ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m) { $cflags =~ s/\-mno\-cygwin\s*//; $shared_ldflag =~ s/\-mno\-cygwin\s*//; } if ($target =~ /linux.*\-mips/ && !$no_asm && $flags !~ /\-m(ips|arch=)/) { # minimally required architecture flags for assembly modules $cflags="-mips2 $cflags" if ($target =~ /mips32/); $cflags="-mips3 $cflags" if ($target =~ /mips64/); } my $no_shared_warn=0; my $no_user_cflags=0; if ($flags ne "") { $cflags="$flags$cflags"; } else { $no_user_cflags=1; } # Kerberos settings. The flavor must be provided from outside, either through # the script "config" or manually. if (!$no_krb5) { my ($lresolv, $lpath, $lext); if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/) { die "Sorry, Heimdal is currently not supported\n"; } ##### HACK to force use of Heimdal. ##### WARNING: Since we don't really have adequate support for Heimdal, ##### using this will break the build. You'll have to make ##### changes to the source, and if you do, please send ##### patches to openssl-dev@openssl.org if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/) { warn "Heimdal isn't really supported. Your build WILL break\n"; warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n"; $withargs{"krb5-dir"} = "/usr/heimdal" if $withargs{"krb5-dir"} eq ""; $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}. "/lib -lgssapi -lkrb5 -lcom_err" if $withargs{"krb5-lib"} eq "" && !$IsMK1MF; $cflags="-DKRB5_HEIMDAL $cflags"; } if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/) { $withargs{"krb5-dir"} = "/usr/kerberos" if $withargs{"krb5-dir"} eq ""; $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}. "/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto" if $withargs{"krb5-lib"} eq "" && !$IsMK1MF; $cflags="-DKRB5_MIT $cflags"; $withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//; if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/) { $cflags="-DKRB5_MIT_OLD11 $cflags"; } } LRESOLV: foreach $lpath ("/lib", "/usr/lib") { foreach $lext ("a", "so") { $lresolv = "$lpath/libresolv.$lext"; last LRESOLV if (-r "$lresolv"); $lresolv = ""; } } $withargs{"krb5-lib"} .= " -lresolv" if ("$lresolv" ne ""); $withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include" if $withargs{"krb5-include"} eq "" && $withargs{"krb5-dir"} ne ""; } # The DSO code currently always implements all functions so that no # applications will have to worry about that from a compilation point # of view. However, the "method"s may return zero unless that platform # has support compiled in for them. Currently each method is enabled # by a define "DSO_" ... we translate the "dso_scheme" config # string entry into using the following logic; my $dso_cflags; if (!$no_dso && $dso_scheme ne "") { $dso_scheme =~ tr/[a-z]/[A-Z]/; if ($dso_scheme eq "DLFCN") { $dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H"; } elsif ($dso_scheme eq "DLFCN_NO_H") { $dso_cflags = "-DDSO_DLFCN"; } else { $dso_cflags = "-DDSO_$dso_scheme"; } $cflags = "$dso_cflags $cflags"; } my $thread_cflags; my $thread_defines; if ($thread_cflag ne "(unknown)" && !$no_threads) { # If we know how to do it, support threads by default. $threads = 1; } if ($thread_cflag eq "(unknown)" && $threads) { # If the user asked for "threads", [s]he is also expected to # provide any system-dependent compiler options that are # necessary. if ($no_user_cflags) { print "You asked for multi-threading support, but didn't\n"; print "provide any system-specific compiler options\n"; exit(1); } $thread_cflags="-DOPENSSL_THREADS $cflags" ; $thread_defines .= "#define OPENSSL_THREADS\n"; } else { $thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags"; $thread_defines .= "#define OPENSSL_THREADS\n"; # my $def; # foreach $def (split ' ',$thread_cflag) # { # if ($def =~ s/^-D// && $def !~ /^_/) # { # $thread_defines .= "#define $def\n"; # } # } } $lflags="$libs$lflags" if ($libs ne ""); if ($no_asm) { $cpuid_obj=$bn_obj=$ec_obj= $des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj= $modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj=""; } if (!$no_shared) { $cast_obj=""; # CAST assembler is not PIC } if ($threads) { $cflags=$thread_cflags; $openssl_thread_defines .= $thread_defines; } if ($zlib) { $cflags = "-DZLIB $cflags"; if (defined($disabled{"zlib-dynamic"})) { if (defined($withargs{"zlib-lib"})) { $lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz"; } else { $lflags = "$lflags -lz"; } } else { $cflags = "-DZLIB_SHARED $cflags"; } } # You will find shlib_mark1 and shlib_mark2 explained in Makefile.org my $shared_mark = ""; if ($shared_target eq "") { $no_shared_warn = 1 if !$no_shared; $no_shared = 1; } if (!$no_shared) { if ($shared_cflag ne "") { $cflags = "$shared_cflag -DOPENSSL_PIC $cflags"; } } if (!$IsMK1MF) { # add {no-}static-engine to options to allow mkdef.pl to work without extra arguments if ($no_shared) { $openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n"; $options.=" static-engine"; } else { $openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n"; $options.=" no-static-engine"; } } $cpuid_obj.=" uplink.o uplink-x86.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/); # # Platform fix-ups # if ($target =~ /\-icc$/) # Intel C compiler { my $iccver=0; if (open(FD,"$cc -V 2>&1 |")) { while() { $iccver=$1 if (/Version ([0-9]+)\./); } close(FD); } if ($iccver>=8) { $cflags=~s/\-KPIC/-fPIC/; # Eliminate unnecessary dependency from libirc.a. This is # essential for shared library support, as otherwise # apps/openssl can end up in endless loop upon startup... $cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset"; } if ($iccver>=9) { $lflags.=" -i-static"; $lflags=~s/\-no_cpprt/-no-cpprt/; } if ($iccver>=10) { $lflags=~s/\-i\-static/-static-intel/; } if ($iccver>=11) { $cflags.=" -no-intel-extensions"; # disable Cilk $lflags=~s/\-no\-cpprt/-no-cxxlib/; } } # Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time # linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on # .so objects. Apparently application RPATH is not global and does # not apply to .so linked with other .so. Problem manifests itself # when libssl.so fails to load libcrypto.so. One can argue that we # should engrave this into Makefile.shared rules or into BSD-* config # lines above. Meanwhile let's try to be cautious and pass -rpath to # linker only when --prefix is not /usr. if ($target =~ /^BSD\-/) { $shared_ldflag.=" -Wl,-rpath,\$\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|); } if ($sys_id ne "") { #$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags"; $openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n"; } if ($ranlib eq "") { $ranlib = $default_ranlib; } #my ($bn1)=split(/\s+/,$bn_obj); #$bn1 = "" unless defined $bn1; #$bn1=$bn_asm unless ($bn1 =~ /\.o$/); #$bn_obj="$bn1"; $cpuid_obj="" if ($processor eq "386"); $bn_obj = $bn_asm unless $bn_obj ne ""; # bn-586 is the only one implementing bn_*_part_words $cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/); $cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/); $cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/); $cflags.=" -DOPENSSL_BN_ASM_MONT5" if ($bn_obj =~ /-mont5/); $cflags.=" -DOPENSSL_BN_ASM_GF2m" if ($bn_obj =~ /-gf2m/); if ($fips) { $openssl_other_defines.="#define OPENSSL_FIPS\n"; $cflags .= " -I\$(FIPSDIR)/include"; } $cpuid_obj="mem_clr.o" unless ($cpuid_obj =~ /\.o$/); $des_obj=$des_enc unless ($des_obj =~ /\.o$/); $bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/); $cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/); $rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/); if ($rc4_obj =~ /\.o$/) { $cflags.=" -DRC4_ASM"; } else { $rc4_obj=$rc4_enc; } if ($sha1_obj =~ /\.o$/) { # $sha1_obj=$sha1_enc; $cflags.=" -DSHA1_ASM" if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/); $cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/); $cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/); if ($sha1_obj =~ /sse2/) { if ($no_sse2) { $sha1_obj =~ s/\S*sse2\S+//; } elsif ($cflags !~ /OPENSSL_IA32_SSE2/) { $cflags.=" -DOPENSSL_IA32_SSE2"; } } } if ($md5_obj =~ /\.o$/) { # $md5_obj=$md5_enc; $cflags.=" -DMD5_ASM"; } if ($rmd160_obj =~ /\.o$/) { # $rmd160_obj=$rmd160_enc; $cflags.=" -DRMD160_ASM"; } if ($aes_obj =~ /\.o$/) { $cflags.=" -DAES_ASM" if ($aes_obj =~ m/\baes\-/);; # aes-ctr.o is not a real file, only indication that assembler # module implements AES_ctr32_encrypt... $cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes\-ctr\.o//); # aes-xts.o indicates presense of AES_xts_[en|de]crypt... $cflags.=" -DAES_XTS_ASM" if ($aes_obj =~ s/\s*aes\-xts\.o//); $aes_obj =~ s/\s*(vpaes|aesni)\-x86\.o//g if ($no_sse2); $cflags.=" -DVPAES_ASM" if ($aes_obj =~ m/vpaes/); $cflags.=" -DBSAES_ASM" if ($aes_obj =~ m/bsaes/); } else { $aes_obj=$aes_enc; } $wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386"); if ($wp_obj =~ /\.o$/ && !$disabled{"whirlpool"}) { $cflags.=" -DWHIRLPOOL_ASM"; } else { $wp_obj="wp_block.o"; } $cmll_obj=$cmll_enc unless ($cmll_obj =~ /.o$/); if ($modes_obj =~ /ghash\-/) { $cflags.=" -DGHASH_ASM"; } if ($ec_obj =~ /ecp_nistz256/) { $cflags.=" -DECP_NISTZ256_ASM"; } # "Stringify" the C flags string. This permits it to be made part of a string # and works as well on command lines. $cflags =~ s/([\\\"])/\\\1/g; my $version = "unknown"; my $version_num = "unknown"; my $major = "unknown"; my $minor = "unknown"; my $shlib_version_number = "unknown"; my $shlib_version_history = "unknown"; my $shlib_major = "unknown"; my $shlib_minor = "unknown"; open(IN,') { $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /; $version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/; $shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/; $shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/; } close(IN); if ($shlib_version_history ne "") { $shlib_version_history .= ":"; } if ($version =~ /(^[0-9]*)\.([0-9\.]*)/) { $major=$1; $minor=$2; } if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/) { $shlib_major=$1; $shlib_minor=$2; } my $ecc = $cc; $ecc = "clang" if `$cc --version 2>&1` =~ /clang/; if ($strict_warnings) { my $wopt; die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/); foreach $wopt (split /\s+/, $gcc_devteam_warn) { $cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/) } if ($ecc eq "clang") { foreach $wopt (split /\s+/, $clang_devteam_warn) { $cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/) } } } open(IN,'$Makefile.new") || die "unable to create $Makefile.new:$!\n"; print OUT "### Generated automatically from Makefile.org by Configure.\n\n"; my $sdirs=0; while () { chomp; $sdirs = 1 if /^SDIRS=/; if ($sdirs) { my $dir; foreach $dir (@skip) { s/(\s)$dir /$1/; s/\s$dir$//; } } $sdirs = 0 unless /\\$/; s/engines // if (/^DIRS=/ && $disabled{"engine"}); s/ccgost// if (/^ENGDIRS=/ && $disabled{"gost"}); s/^VERSION=.*/VERSION=$version/; s/^MAJOR=.*/MAJOR=$major/; s/^MINOR=.*/MINOR=$minor/; s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/; s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/; s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/; s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/; s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/; s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/; s/^MULTILIB=.*$/MULTILIB=$multilib/; s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/; s/^LIBDIR=.*$/LIBDIR=$libdir/; s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/; s/^PLATFORM=.*$/PLATFORM=$target/; s/^OPTIONS=.*$/OPTIONS=$options/; s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/; if ($cross_compile_prefix) { s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/; s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/; s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/; s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/; s/^RC=\s*/RC= \$\(CROSS_COMPILE\)/; s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc"; } else { s/^CC=.*$/CC= $cc/; s/^AR=\s*ar/AR= $ar/; s/^RANLIB=.*/RANLIB= $ranlib/; s/^RC=.*/RC= $windres/; s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc"; s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $ecc eq "gcc" || $ecc eq "clang"; } s/^CFLAG=.*$/CFLAG= $cflags/; s/^DEPFLAG=.*$/DEPFLAG=$depflags/; s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/; s/^EX_LIBS=.*$/EX_LIBS= $lflags/; s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/; s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/; s/^BN_ASM=.*$/BN_ASM= $bn_obj/; s/^EC_ASM=.*$/EC_ASM= $ec_obj/; s/^DES_ENC=.*$/DES_ENC= $des_obj/; s/^AES_ENC=.*$/AES_ENC= $aes_obj/; s/^BF_ENC=.*$/BF_ENC= $bf_obj/; s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/; s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/; s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/; s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/; s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/; s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/; s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/; s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/; s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/; s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/; s/^PROCESSOR=.*/PROCESSOR= $processor/; s/^ARFLAGS=.*/ARFLAGS= $arflags/; s/^PERL=.*/PERL= $perl/; s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/; s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/; s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/; s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/; s/^FIPSDIR=.*/FIPSDIR=$fipsdir/; s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/; s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips; s/^BASEADDR=.*/BASEADDR=$baseaddr/; s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/; s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/; s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared); if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/) { my $sotmp = $1; s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/; } elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/) { s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/; } elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/) { my $sotmp = $1; s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/; } elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/) { s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/; } s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/; print OUT $_."\n"; } close(IN); close(OUT); if ((compare($Makefile, "$Makefile.new")) or file_newer('Configure', $Makefile) or file_newer('config', $Makefile) or file_newer('Makefile.org', $Makefile)) { rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; } else { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; print "EX_LIBS =$lflags\n"; print "CPUID_OBJ =$cpuid_obj\n"; print "BN_ASM =$bn_obj\n"; print "EC_ASM =$ec_obj\n"; print "DES_ENC =$des_obj\n"; print "AES_ENC =$aes_obj\n"; print "BF_ENC =$bf_obj\n"; print "CAST_ENC =$cast_obj\n"; print "RC4_ENC =$rc4_obj\n"; print "RC5_ENC =$rc5_obj\n"; print "MD5_OBJ_ASM =$md5_obj\n"; print "SHA1_OBJ_ASM =$sha1_obj\n"; print "RMD160_OBJ_ASM=$rmd160_obj\n"; print "CMLL_ENC =$cmll_obj\n"; print "MODES_OBJ =$modes_obj\n"; print "ENGINES_OBJ =$engines_obj\n"; print "PROCESSOR =$processor\n"; print "RANLIB =$ranlib\n"; print "ARFLAGS =$arflags\n"; print "PERL =$perl\n"; print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n" if $withargs{"krb5-include"} ne ""; my $des_ptr=0; my $des_risc1=0; my $des_risc2=0; my $des_unroll=0; my $bn_ll=0; my $def_int=2; my $rc4_int=$def_int; my $md2_int=$def_int; my $idea_int=$def_int; my $rc2_int=$def_int; my $rc4_idx=0; my $rc4_chunk=0; my $bf_ptr=0; my @type=("char","short","int","long"); my ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0); my $export_var_as_fn=0; my $des_int; foreach (sort split(/\s+/,$bn_ops)) { $des_ptr=1 if /DES_PTR/; $des_risc1=1 if /DES_RISC1/; $des_risc2=1 if /DES_RISC2/; $des_unroll=1 if /DES_UNROLL/; $des_int=1 if /DES_INT/; $bn_ll=1 if /BN_LLONG/; $rc4_int=0 if /RC4_CHAR/; $rc4_int=3 if /RC4_LONG/; $rc4_idx=1 if /RC4_INDEX/; $rc4_chunk=1 if /RC4_CHUNK/; $rc4_chunk=2 if /RC4_CHUNK_LL/; $md2_int=0 if /MD2_CHAR/; $md2_int=3 if /MD2_LONG/; $idea_int=1 if /IDEA_SHORT/; $idea_int=3 if /IDEA_LONG/; $rc2_int=1 if /RC2_SHORT/; $rc2_int=3 if /RC2_LONG/; $bf_ptr=1 if $_ eq "BF_PTR"; $bf_ptr=2 if $_ eq "BF_PTR2"; ($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/; ($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/; ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/; ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/; ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/; $export_var_as_fn=1 if /EXPORT_VAR_AS_FN/; } open(IN,'crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n"; print OUT "/* opensslconf.h */\n"; print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n"; print OUT "#ifdef __cplusplus\n"; print OUT "extern \"C\" {\n"; print OUT "#endif\n"; print OUT "/* OpenSSL was configured with the following options: */\n"; my $openssl_algorithm_defines_trans = $openssl_algorithm_defines; $openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n# define OPENSSL_NO_$1\n# endif\n#endif/mg; $openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n# define $1\n# endif/mg; $openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; $openssl_algorithm_defines = " /* no ciphers excluded */\n" if $openssl_algorithm_defines eq ""; $openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; $openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; $openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg; print OUT $openssl_sys_defines; print OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n"; print OUT $openssl_experimental_defines; print OUT "\n"; print OUT $openssl_algorithm_defines; print OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n"; print OUT $openssl_thread_defines; print OUT $openssl_other_defines,"\n"; print OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n"; print OUT " asks for it. This is a transient feature that is provided for those\n"; print OUT " who haven't had the time to do the appropriate changes in their\n"; print OUT " applications. */\n"; print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n"; print OUT $openssl_algorithm_defines_trans; print OUT "#endif\n\n"; print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o"); while () { if (/^#define\s+OPENSSLDIR/) { my $foo = $openssldir; $foo =~ s/\\/\\\\/g; print OUT "#define OPENSSLDIR \"$foo\"\n"; } elsif (/^#define\s+ENGINESDIR/) { my $foo = "$prefix/$libdir/engines"; $foo =~ s/\\/\\\\/g; print OUT "#define ENGINESDIR \"$foo\"\n"; } elsif (/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/) { printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n" if $export_var_as_fn; printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n", ($export_var_as_fn)?"define":"undef"; } elsif (/^#define\s+OPENSSL_UNISTD/) { $unistd = "" if $unistd eq ""; print OUT "#define OPENSSL_UNISTD $unistd\n"; } elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/) { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; } elsif (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/) { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; } elsif (/^#((define)|(undef))\s+THIRTY_TWO_BIT/) { printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; } elsif (/^#((define)|(undef))\s+SIXTEEN_BIT/) { printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; } elsif (/^#((define)|(undef))\s+EIGHT_BIT/) { printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; } elsif (/^#((define)|(undef))\s+BN_LLONG\s*$/) { printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; } elsif (/^\#define\s+DES_LONG\s+.*/) { printf OUT "#define DES_LONG unsigned %s\n", ($des_int)?'int':'long'; } elsif (/^\#(define|undef)\s+DES_PTR/) { printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; } elsif (/^\#(define|undef)\s+DES_RISC1/) { printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; } elsif (/^\#(define|undef)\s+DES_RISC2/) { printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; } elsif (/^\#(define|undef)\s+DES_UNROLL/) { printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; } elsif (/^#define\s+RC4_INT\s/) { printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; } elsif (/^#undef\s+RC4_CHUNK/) { printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0; printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1; printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2; } elsif (/^#((define)|(undef))\s+RC4_INDEX/) { printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; } elsif (/^#(define|undef)\s+I386_ONLY/) { printf OUT "#%s I386_ONLY\n", ($processor eq "386")? "define":"undef"; } elsif (/^#define\s+MD2_INT\s/) { printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; } elsif (/^#define\s+IDEA_INT\s/) {printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];} elsif (/^#define\s+RC2_INT\s/) {printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];} elsif (/^#(define|undef)\s+BF_PTR/) { printf OUT "#undef BF_PTR\n" if $bf_ptr == 0; printf OUT "#define BF_PTR\n" if $bf_ptr == 1; printf OUT "#define BF_PTR2\n" if $bf_ptr == 2; } else { print OUT $_; } } close(IN); print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) { rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; } else { unlink("crypto/opensslconf.h.new"); } # Fix the date print "SIXTY_FOUR_BIT_LONG mode\n" if $b64l; print "SIXTY_FOUR_BIT mode\n" if $b64; print "THIRTY_TWO_BIT mode\n" if $b32; print "SIXTEEN_BIT mode\n" if $b16; print "EIGHT_BIT mode\n" if $b8; print "DES_PTR used\n" if $des_ptr; print "DES_RISC1 used\n" if $des_risc1; print "DES_RISC2 used\n" if $des_risc2; print "DES_UNROLL used\n" if $des_unroll; print "DES_INT used\n" if $des_int; print "BN_LLONG mode\n" if $bn_ll; print "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int; print "RC4_INDEX mode\n" if $rc4_idx; print "RC4_CHUNK is undefined\n" if $rc4_chunk==0; print "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1; print "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2; print "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int; print "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int; print "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int; print "BF_PTR used\n" if $bf_ptr == 1; print "BF_PTR2 used\n" if $bf_ptr == 2; if($IsMK1MF) { open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; printf OUT <ms/version32.rc") || die "Can't open ms/version32.rc"; print OUT < LANGUAGE 0x09,0x01 1 VERSIONINFO FILEVERSION $v1,$v2,$v3,$v4 PRODUCTVERSION $v1,$v2,$v3,$v4 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x01L #else FILEFLAGS 0x00L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN // Required: VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" VALUE "FileDescription", "OpenSSL Shared Library\\0" VALUE "FileVersion", "$version\\0" #if defined(CRYPTO) VALUE "InternalName", "libeay32\\0" VALUE "OriginalFilename", "libeay32.dll\\0" #elif defined(SSL) VALUE "InternalName", "ssleay32\\0" VALUE "OriginalFilename", "ssleay32.dll\\0" #endif VALUE "ProductName", "The OpenSSL Toolkit\\0" VALUE "ProductVersion", "$version\\0" // Optional: //VALUE "Comments", "\\0" VALUE "LegalCopyright", "Copyright © 1998-2005 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" //VALUE "LegalTrademarks", "\\0" //VALUE "PrivateBuild", "\\0" //VALUE "SpecialBuild", "\\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 0x4b0 END END EOF close(OUT); } print < 78) { print STDERR "\n"; $k=length($i); } print STDERR $i . " "; } foreach $i (sort keys %table) { next if $i !~ /^debug/; $k += length($i) + 1; if ($k > 78) { print STDERR "\n"; $k=length($i); } print STDERR $i . " "; } print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n"; exit(1); } sub which { my($name)=@_; my $path; foreach $path (split /:/, $ENV{PATH}) { if (-f "$path/$name$exe_ext" and -x _) { return "$path/$name$exe_ext" unless ($name eq "perl" and system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\'')); } } } sub dofile { my $f; my $p; my %m; my @a; my $k; my $ff; ($f,$p,%m)=@_; open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n"; @a=; close(IN); foreach $k (keys %m) { grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a); } open(OUT,">$f.new") || die "unable to open $f.new:$!\n"; print OUT @a; close(OUT); rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f; rename("$f.new",$f) || die "unable to rename $f.new\n"; } sub print_table_entry { my $target = shift; my ($cc, $cflags, $unistd, $thread_cflag, $sys_id, $lflags, $bn_ops, $cpuid_obj, $bn_obj, $ec_obj, $des_obj, $aes_obj, $bf_obj, $md5_obj, $sha1_obj, $cast_obj, $rc4_obj, $rmd160_obj, $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj, $perlasm_scheme, $dso_scheme, $shared_target, $shared_cflag, $shared_ldflag, $shared_extension, $ranlib, $arflags, $multilib)= split(/\s*:\s*/,$table{$target} . ":" x 30 , -1); print < (stat($file2))[9] } diff --git a/FREEBSD-upgrade b/FREEBSD-upgrade index 3b42f5aeb6e9..a9cd999dae3e 100644 --- a/FREEBSD-upgrade +++ b/FREEBSD-upgrade @@ -1,83 +1,83 @@ This contains various notes used to import a new OpenSSL version into the FreeBSD base system. It is not expected to be complete but just to contain some hints for imports. Note that this doesn't actually deal with getting OpenSSL to compile... XXX This file currently partly contain CVS and SVN instructions. First, read http://wiki.freebsd.org/SubversionPrimer/VendorImports # Xlist setenv XLIST /FreeBSD/work/openssl/svn-FREEBSD-files/FREEBSD-Xlist setenv FSVN "svn+ssh://repo.freebsd.org/base" -setenv OSSLVER 1.0.2m -# OSSLTAG format: v1_0_2m +setenv OSSLVER 1.0.2n +# OSSLTAG format: v1_0_2n ###setenv OSSLTAG v`echo ${OSSLVER} | tr . _` cd /FreeBSD/work/openssl/merge fetch http://www.openssl.org/source/openssl-${OSSLVER}.tar.gz \ http://www.openssl.org/source/openssl-${OSSLVER}.tar.gz.asc gpg --verify openssl-${OSSLVER}.tar.gz.asc openssl-${OSSLVER}.tar.gz svn co $FSVN/vendor-crypto/openssl/dist dist tar -x -X $XLIST -f openssl-${OSSLVER}.tar.gz cd dist svn list -R | egrep -v -e '/$' -e '^FREEBSD-(Xlist|upgrade)$' | sort >../old cd ../openssl-${OSSLVER} find . -type f -or -type l | cut -c 3- | sort >../new cd .. # See that files to remove makes sense comm -23 old new # See that files to add makes sense comm -13 old new tar -cf - -C openssl-${OSSLVER} . | tar -xf - -C dist cd dist comm -23 ../old ../new | xargs svn rm # Make sure to remove empty directories comm -13 ../old ../new | xargs svn --parents add svn stat svn ci svn cp ^/vendor-crypto/openssl/dist ^/vendor-crypto/openssl/$OSSLVER # Merge to head mkdir ../head cd ../head svn co $FSVN/head/crypto/openssl crypto/openssl svn merge ^/vendor-crypto/openssl/dist crypto/openssl # Resolve conflicts manually svn co $FSVN/head/secure/lib/libcrypto secure/lib/libcrypto svn co $FSVN/head/secure/lib/libssl secure/lib/libssl svn co $FSVN/head/secure/usr.bin/openssl secure/usr.bin/openssl cd secure/lib/libcrypto # Update version number and release date in Makefile.inc # Update all opensslconf-${MACHINE_CPUARCH}.h # Regen assembly files if necessary make -f Makefile.asm all mv *.[Ss] ${MACHINE_CPUARCH} make -f Makefile.asm clean # Regen manual pages make man-makefile-update && make man-update cd ../libssl make man-makefile-update && make man-update cd ../../usr.bin/openssl make man-makefile-update && make man-update cd ../../.. # Commit! svn ci crypto/openssl secure/lib/libcrypto secure/lib/libssl secure/usr.bin/openssl -- simon@, jkim@ $FreeBSD$ diff --git a/Makefile b/Makefile index 484f2f45f776..9212c2885278 100644 --- a/Makefile +++ b/Makefile @@ -1,692 +1,692 @@ ### Generated automatically from Makefile.org by Configure. ## ## Makefile for OpenSSL ## -VERSION=1.0.2m +VERSION=1.0.2n MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 SHLIB_VERSION_HISTORY= SHLIB_MAJOR=1 SHLIB_MINOR=0.0 SHLIB_EXT= PLATFORM=dist OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-ssl2 no-store no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic static-engine CONFIGURE_ARGS=dist SHLIB_TARGET= # HERE indicates where this Makefile lives. This can be used to indicate # where sub-Makefiles are expected to be. Currently has very limited usage, # and should probably not be bothered with at all. HERE=. # INSTALL_PREFIX is for package builders so that they can configure # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/. # Normally it is left empty. INSTALL_PREFIX= INSTALLTOP=/usr/local/ssl # Do not edit this manually. Use Configure --openssldir=DIR do change this! OPENSSLDIR=/usr/local/ssl # NO_IDEA - Define to build without the IDEA algorithm # NO_RC4 - Define to build without the RC4 algorithm # NO_RC2 - Define to build without the RC2 algorithm # THREADS - Define when building with threads, you will probably also need any # system defines as well, i.e. _REENTERANT for Solaris 2.[34] # TERMIO - Define the termio terminal subsystem, needed if sgtty is missing. # TERMIOS - Define the termios terminal subsystem, Silicon Graphics. # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3). # DEVRANDOM - Give this the value of the 'random device' if your OS supports # one. 32 bytes will be read from this when the random # number generator is initalised. # SSL_FORBID_ENULL - define if you want the server to be not able to use the # NULL encryption ciphers. # # LOCK_DEBUG - turns on lots of lock debug output :-) # REF_CHECK - turn on some xyz_free() assertions. # REF_PRINT - prints some stuff on structure free. # CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff # MFUNC - Make all Malloc/Free/Realloc calls call # CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to # call application defined callbacks via CRYPTO_set_mem_functions() # MD5_ASM needs to be defined to use the x86 assembler for MD5 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must # equal 4. # PKCS1_CHECK - pkcs1 tests. CC= cc CFLAG= -O DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS PEX_LIBS= EX_LIBS= EXE_EXT= ARFLAGS= AR= ar $(ARFLAGS) r RANLIB= /usr/bin/ranlib RC= windres NM= nm PERL= /usr/bin/perl TAR= tar TARFLAGS= --no-recursion MAKEDEPPROG=makedepend LIBDIR=lib # We let the C compiler driver to take care of .s files. This is done in # order to be excused from maintaining a separate set of architecture # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC # gcc, then the driver will automatically translate it to -xarch=v8plus # and pass it down to assembler. AS=$(CC) -c ASFLAG=$(CFLAG) # For x86 assembler: Set PROCESSOR to 386 if you want to support # the 80386. PROCESSOR= # CPUID module collects small commonly used assembler snippets CPUID_OBJ= mem_clr.o BN_ASM= bn_asm.o EC_ASM= DES_ENC= des_enc.o fcrypt_b.o AES_ENC= aes_core.o aes_cbc.o BF_ENC= bf_enc.o CAST_ENC= c_enc.o RC4_ENC= rc4_enc.o rc4_skey.o RC5_ENC= rc5_enc.o MD5_ASM_OBJ= SHA1_ASM_OBJ= RMD160_ASM_OBJ= WP_ASM_OBJ= wp_block.o CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o MODES_ASM_OBJ= ENGINES_ASM_OBJ= PERLASM_SCHEME= # KRB5 stuff KRB5_INCLUDES= LIBKRB5= # Zlib stuff ZLIB_INCLUDE= LIBZLIB= # TOP level FIPS install directory. FIPSDIR=/usr/local/ssl/fips-2.0 # This is the location of fipscanister.o and friends. # The FIPS module build will place it $(INSTALLTOP)/lib # but since $(INSTALLTOP) can only take the default value # when the module is built it will be in /usr/local/ssl/lib # $(INSTALLTOP) for this build may be different so hard # code the path. FIPSLIBDIR= # The location of the library which contains fipscanister.o # normally it will be libcrypto unless fipsdso is set in which # case it will be libfips. If not compiling in FIPS mode at all # this is empty making it a useful test for a FIPS compile. FIPSCANLIB= # Shared library base address. Currently only used on Windows. # BASEADDR=0xFB00000 DIRS= crypto ssl engines apps test tools ENGDIRS= ccgost SHLIBDIRS= crypto ssl # dirs in crypto to build SDIRS= \ objects \ md4 md5 sha mdc2 hmac ripemd whrlpool \ des aes rc2 rc4 idea bf cast camellia seed modes \ bn ec rsa dsa ecdsa dh ecdh dso engine \ buffer bio stack lhash rand err \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \ cms pqueue ts srp cmac # keep in mind that the above list is adjusted by ./Configure # according to no-xxx arguments... # tests to perform. "alltests" is a special word indicating that all tests # should be performed. TESTS = alltests MAKEFILE= Makefile MANDIR=$(OPENSSLDIR)/man MAN1=1 MAN3=3 MANSUFFIX= HTMLSUFFIX=html HTMLDIR=$(OPENSSLDIR)/html SHELL=/bin/sh TOP= . ONEDIRS=out tmp EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS WDIRS= windows LIBS= libcrypto.a libssl.a SHARED_CRYPTO=libcrypto$(SHLIB_EXT) SHARED_SSL=libssl$(SHLIB_EXT) SHARED_LIBS= SHARED_LIBS_LINK_EXTS= SHARED_LDFLAGS= GENERAL= Makefile BASENAME= openssl NAME= $(BASENAME)-$(VERSION) TARFILE= ../$(NAME).tar EXHEADER= e_os2.h HEADER= e_os.h all: Makefile build_all # as we stick to -e, CLEARENV ensures that local variables in lower # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn # shell, which [annoyingly enough] terminates unset with error if VAR # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh, # which terminates unset with error if no variable was present:-( CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \ $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES} \ $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC} \ $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \ $${EXHEADER+EXHEADER} $${HEADER+HEADER} \ $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \ $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\ CC='$(CC)' CFLAG='$(CFLAG)' \ AS='$(CC)' ASFLAG='$(CFLAG) -c' \ AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \ RC='$(RC)' \ CROSS_COMPILE='$(CROSS_COMPILE)' \ PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \ SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \ INSTALL_PREFIX='$(INSTALL_PREFIX)' \ INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \ LIBDIR='$(LIBDIR)' \ MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \ DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \ MAKEDEPPROG='$(MAKEDEPPROG)' \ SHARED_LDFLAGS='$(SHARED_LDFLAGS)' \ KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)' \ ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \ EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \ SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \ PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \ CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \ EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \ AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \ BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \ RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \ SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \ MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \ RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \ WP_ASM_OBJ='$(WP_ASM_OBJ)' \ MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \ ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \ PERLASM_SCHEME='$(PERLASM_SCHEME)' \ FIPSLIBDIR='${FIPSLIBDIR}' \ FIPSDIR='${FIPSDIR}' \ FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \ THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES= # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors, # which in turn eliminates ambiguities in variable treatment with -e. # BUILD_CMD is a generic macro to build a given target in a given # subdirectory. The target must be given through the shell variable # `target' and the subdirectory to build in must be given through `dir'. # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or # BUILD_ONE_CMD instead. # # BUILD_ONE_CMD is a macro to build a given target in a given # subdirectory if that subdirectory is part of $(DIRS). It requires # exactly the same shell variables as BUILD_CMD. # # RECURSIVE_BUILD_CMD is a macro to build a given target in all # subdirectories defined in $(DIRS). It requires that the target # is given through the shell variable `target'. BUILD_CMD= if [ -d "$$dir" ]; then \ ( cd $$dir && echo "making $$target in $$dir..." && \ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \ ) || exit 1; \ fi RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done BUILD_ONE_CMD=\ if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \ $(BUILD_CMD); \ fi reflect: @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) sub_all: build_all build_all: build_libs build_apps build_tests build_tools build_libs: build_libcrypto build_libssl openssl.pc build_libcrypto: build_crypto build_engines libcrypto.pc build_libssl: build_ssl libssl.pc build_crypto: @dir=crypto; target=all; $(BUILD_ONE_CMD) build_ssl: build_crypto @dir=ssl; target=all; $(BUILD_ONE_CMD) build_engines: build_crypto @dir=engines; target=all; $(BUILD_ONE_CMD) build_apps: build_libs @dir=apps; target=all; $(BUILD_ONE_CMD) build_tests: build_libs @dir=test; target=all; $(BUILD_ONE_CMD) build_tools: build_libs @dir=tools; target=all; $(BUILD_ONE_CMD) all_testapps: build_libs build_testapps build_testapps: @dir=crypto; target=testapps; $(BUILD_ONE_CMD) fips_premain_dso$(EXE_EXT): libcrypto.a [ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \ -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \ $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \ libcrypto.a $(EX_LIBS) libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT) @if [ "$(SHLIB_TARGET)" != "" ]; then \ if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \ FIPSLD_LIBCRYPTO=libcrypto.a ; \ FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \ export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \ fi; \ $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \ (touch -c fips_premain_dso$(EXE_EXT) || :); \ else \ echo "There's no support for shared libraries on this platform" >&2; \ exit 1; \ fi libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a @if [ "$(SHLIB_TARGET)" != "" ]; then \ $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \ else \ echo "There's no support for shared libraries on this platform" >&2; \ exit 1; \ fi clean-shared: @set -e; for i in $(SHLIBDIRS); do \ if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \ tmp="$(SHARED_LIBS_LINK_EXTS)"; \ for j in $${tmp:-x}; do \ ( set -x; rm -f lib$$i$$j ); \ done; \ fi; \ ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \ ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \ fi; \ done link-shared: @ set -e; for i in $(SHLIBDIRS); do \ $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \ LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ symlink.$(SHLIB_TARGET); \ libs="$$libs -l$$i"; \ done build-shared: do_$(SHLIB_TARGET) link-shared do_$(SHLIB_TARGET): @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \ if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \ libs="$(LIBKRB5) $$libs"; \ fi; \ $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \ LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ LIBDEPS="$$libs $(EX_LIBS)" \ link_a.$(SHLIB_TARGET); \ libs="-l$$i $$libs"; \ done libcrypto.pc: Makefile @ ( echo 'prefix=$(INSTALLTOP)'; \ echo 'exec_prefix=$${prefix}'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'includedir=$${prefix}/include'; \ echo 'enginesdir=$${libdir}/engines'; \ echo ''; \ echo 'Name: OpenSSL-libcrypto'; \ echo 'Description: OpenSSL cryptography library'; \ echo 'Version: '$(VERSION); \ echo 'Requires: '; \ echo 'Libs: -L$${libdir} -lcrypto'; \ echo 'Libs.private: $(EX_LIBS)'; \ echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc libssl.pc: Makefile @ ( echo 'prefix=$(INSTALLTOP)'; \ echo 'exec_prefix=$${prefix}'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'includedir=$${prefix}/include'; \ echo ''; \ echo 'Name: OpenSSL-libssl'; \ echo 'Description: Secure Sockets Layer and cryptography libraries'; \ echo 'Version: '$(VERSION); \ echo 'Requires.private: libcrypto'; \ echo 'Libs: -L$${libdir} -lssl'; \ echo 'Libs.private: $(EX_LIBS)'; \ echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc openssl.pc: Makefile @ ( echo 'prefix=$(INSTALLTOP)'; \ echo 'exec_prefix=$${prefix}'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'includedir=$${prefix}/include'; \ echo ''; \ echo 'Name: OpenSSL'; \ echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ echo 'Version: '$(VERSION); \ echo 'Requires: libssl libcrypto' ) > openssl.pc Makefile: Makefile.org Configure config @echo "Makefile is older than Makefile.org, Configure or config." @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please." @false libclean: rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib clean: libclean rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c @set -e; target=clean; $(RECURSIVE_BUILD_CMD) rm -f $(LIBS) rm -f openssl.pc libssl.pc libcrypto.pc rm -f speed.* .pure rm -f $(TARFILE) @set -e; for i in $(ONEDIRS) ;\ do \ rm -fr $$i/*; \ done distclean: clean -$(RM) `find . -name .git -prune -o -type l -print` $(RM) apps/CA.pl $(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem $(RM) tools/c_rehash $(RM) crypto/opensslconf.h $(RM) Makefile Makefile.bak makefile.one: files $(PERL) util/mk1mf.pl >makefile.one; \ sh util/do_ms.sh files: $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO @set -e; target=files; $(RECURSIVE_BUILD_CMD) links: @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER) @set -e; target=links; $(RECURSIVE_BUILD_CMD) gentests: @(cd test && echo "generating dummy tests (if needed)..." && \ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate ); dclean: rm -rf *.bak include/openssl certs/.0 @set -e; target=dclean; $(RECURSIVE_BUILD_CMD) rehash: rehash.time rehash.time: certs apps @if [ -z "$(CROSS_COMPILE)" ]; then \ (OPENSSL="`pwd`/util/opensslwrap.sh"; \ [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ OPENSSL_DEBUG_MEMORY=on; \ export OPENSSL OPENSSL_DEBUG_MEMORY; \ $(PERL) tools/c_rehash certs/demo) && \ touch rehash.time; \ else :; fi test: tests tests: rehash @(cd test && echo "testing..." && \ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests ); OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a report: @$(PERL) util/selftest.pl update: errors stacks util/libeay.num util/ssleay.num TABLE @set -e; target=update; $(RECURSIVE_BUILD_CMD) depend: @set -e; target=depend; $(RECURSIVE_BUILD_CMD) lint: @set -e; target=lint; $(RECURSIVE_BUILD_CMD) tags: rm -f TAGS find . -name '[^.]*.[ch]' | xargs etags -a errors: $(PERL) util/ck_errf.pl -strict */*.c */*/*.c $(PERL) util/mkerr.pl -recurse -write (cd engines; $(MAKE) PERL=$(PERL) errors) stacks: $(PERL) util/mkstack.pl -write util/libeay.num:: $(PERL) util/mkdef.pl crypto update util/ssleay.num:: $(PERL) util/mkdef.pl ssl update TABLE: Configure (echo 'Output of `Configure TABLE'"':"; \ $(PERL) Configure TABLE) > TABLE # Build distribution tar-file. As the list of files returned by "find" is # pretty long, on several platforms a "too many arguments" error or similar # would occur. Therefore the list of files is temporarily stored into a file # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal # tar does not support the --files-from option. TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \ --owner 0 --group 0 \ --transform 's|^|$(NAME)/|' \ -cvf - $(TARFILE).list: find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \ \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \ \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \ \! -name '.#*' \! -name '*~' \! -type l \ | sort > $(TARFILE).list tar: $(TARFILE).list find . -type d -print | xargs chmod 755 find . -type f -print | xargs chmod a+r find . -type f -perm -0100 -print | xargs chmod a+x $(TAR_COMMAND) | gzip --best > $(TARFILE).gz rm -f $(TARFILE).list ls -l $(TARFILE).gz tar-snap: $(TARFILE).list $(TAR_COMMAND) > $(TARFILE) rm -f $(TARFILE).list ls -l $(TARFILE) dist: $(PERL) Configure dist @$(MAKE) SDIRS='$(SDIRS)' clean @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar install: all install_docs install_sw install_sw: @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \ $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \ $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \ $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \ $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \ $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \ $(INSTALL_PREFIX)$(OPENSSLDIR)/private @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\ do \ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; @set -e; target=install; $(RECURSIVE_BUILD_CMD) @set -e; liblist="$(LIBS)"; for i in $$liblist ;\ do \ if [ -f "$$i" ]; then \ ( echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \ fi; \ done; @set -e; if [ -n "$(SHARED_LIBS)" ]; then \ tmp="$(SHARED_LIBS)"; \ for i in $${tmp:-x}; \ do \ if [ -f "$$i" -o -f "$$i.a" ]; then \ ( echo installing $$i; \ if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \ c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ else \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ fi ); \ if expr $(PLATFORM) : 'mingw' > /dev/null; then \ ( case $$i in \ *crypto*) i=libeay32.dll;; \ *ssl*) i=ssleay32.dll;; \ esac; \ echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ fi; \ fi; \ done; \ ( here="`pwd`"; \ cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \ $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \ if [ "$(INSTALLTOP)" != "/usr" ]; then \ echo 'OpenSSL shared libraries have been installed in:'; \ echo ' $(INSTALLTOP)'; \ echo ''; \ sed -e '1,/^$$/d' doc/openssl-shared.txt; \ fi; \ fi cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc install_html_docs: here="`pwd`"; \ filecase=; \ case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ filecase=-i; \ esac; \ for subdir in apps crypto ssl; do \ mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ for i in doc/$$subdir/*.pod; do \ fn=`basename $$i .pod`; \ echo "installing html/$$fn.$(HTMLSUFFIX)"; \ cat $$i \ | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \ | pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \ | sed -r 's/ $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \ $(PERL) util/extract-names.pl < $$i | \ grep -v $$filecase "^$$fn\$$" | \ (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ while read n; do \ PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \ done); \ done; \ done install_docs: @$(PERL) $(TOP)/util/mkdir-p.pl \ $(INSTALL_PREFIX)$(MANDIR)/man1 \ $(INSTALL_PREFIX)$(MANDIR)/man3 \ $(INSTALL_PREFIX)$(MANDIR)/man5 \ $(INSTALL_PREFIX)$(MANDIR)/man7 @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \ here="`pwd`"; \ filecase=; \ case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ filecase=-i; \ esac; \ set -e; for i in doc/apps/*.pod; do \ fn=`basename $$i .pod`; \ sec=`$(PERL) util/extract-section.pl 1 < $$i`; \ echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \ (cd `$(PERL) util/dirname.pl $$i`; \ sh -c "$$pod2man \ --section=$$sec --center=OpenSSL \ --release=$(VERSION) `basename $$i`") \ > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ $(PERL) util/extract-names.pl < $$i | \ (grep -v $$filecase "^$$fn\$$"; true) | \ (grep -v "[ ]"; true) | \ (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \ while read n; do \ PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \ done); \ done; \ set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \ fn=`basename $$i .pod`; \ sec=`$(PERL) util/extract-section.pl 3 < $$i`; \ echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \ (cd `$(PERL) util/dirname.pl $$i`; \ sh -c "$$pod2man \ --section=$$sec --center=OpenSSL \ --release=$(VERSION) `basename $$i`") \ > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ $(PERL) util/extract-names.pl < $$i | \ (grep -v $$filecase "^$$fn\$$"; true) | \ (grep -v "[ ]"; true) | \ (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \ while read n; do \ PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \ done); \ done # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/NEWS b/NEWS index 1b72013ad186..6f0c5c47b654 100644 --- a/NEWS +++ b/NEWS @@ -1,808 +1,813 @@ NEWS ==== This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2m and OpenSSL 1.0.2n [7 Dec 2017] + + o Read/write after SSL object in error state (CVE-2017-3737) + o 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] o bn_sqrx8x_internal carry bug on x86_64 (CVE-2017-3736) o 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] o 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] o Truncated packet could crash via OOB read (CVE-2017-3731) o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) o Montgomery multiplication may produce incorrect results (CVE-2016-7055) Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] o OCSP Status Request extension unbounded memory growth (CVE-2016-6304) o SWEET32 Mitigation (CVE-2016-2183) o OOB write in MDC2_Update() (CVE-2016-6303) o Malformed SHA512 ticket DoS (CVE-2016-6302) o OOB write in BN_bn2dec() (CVE-2016-2182) o OOB read in TS_OBJ_print_bio() (CVE-2016-2180) o Pointer arithmetic undefined behaviour (CVE-2016-2177) o Constant time flag not preserved in DSA signing (CVE-2016-2178) o DTLS buffered message DoS (CVE-2016-2179) o DTLS replay protection DoS (CVE-2016-2181) o Certificate message OOB reads (CVE-2016-6306) Major changes between OpenSSL 1.0.2g and OpenSSL 1.0.2h [3 May 2016] o Prevent padding oracle in AES-NI CBC MAC check (CVE-2016-2107) o Fix EVP_EncodeUpdate overflow (CVE-2016-2105) o Fix EVP_EncryptUpdate overflow (CVE-2016-2106) o Prevent ASN.1 BIO excessive memory allocation (CVE-2016-2109) o EBCDIC overread (CVE-2016-2176) o Modify behavior of ALPN to invoke callback after SNI/servername callback, such that updates to the SSL_CTX affect ALPN. o Remove LOW from the DEFAULT cipher list. This removes singles DES from the default. o 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] o Disable weak ciphers in SSLv3 and up in default builds of OpenSSL. o Disable SSLv2 default build, default negotiation and weak ciphers (CVE-2016-0800) o Fix a double-free in DSA code (CVE-2016-0705) o Disable SRP fake user seed to address a server memory leak (CVE-2016-0798) o Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption (CVE-2016-0797) o Fix memory issues in BIO_*printf functions (CVE-2016-0799) o 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] o DH small subgroups (CVE-2016-0701) o SSLv2 doesn't block disabled ciphers (CVE-2015-3197) Major changes between OpenSSL 1.0.2d and OpenSSL 1.0.2e [3 Dec 2015] o BN_mod_exp may produce incorrect results on x86_64 (CVE-2015-3193) o Certificate verify crash with missing PSS parameter (CVE-2015-3194) o X509_ATTRIBUTE memory leak (CVE-2015-3195) o Rewrite EVP_DecodeUpdate (base64 decoding) to fix several bugs o 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] o Alternate chains certificate forgery (CVE-2015-1793) o Race condition handling PSK identify hint (CVE-2015-3196) Major changes between OpenSSL 1.0.2b and OpenSSL 1.0.2c [12 Jun 2015] o Fix HMAC ABI incompatibility Major changes between OpenSSL 1.0.2a and OpenSSL 1.0.2b [11 Jun 2015] o Malformed ECParameters causes infinite loop (CVE-2015-1788) o Exploitable out-of-bounds read in X509_cmp_time (CVE-2015-1789) o PKCS7 crash with missing EnvelopedContent (CVE-2015-1790) o CMS verify infinite loop with unknown hash function (CVE-2015-1792) o Race condition handling NewSessionTicket (CVE-2015-1791) Major changes between OpenSSL 1.0.2 and OpenSSL 1.0.2a [19 Mar 2015] o OpenSSL 1.0.2 ClientHello sigalgs DoS fix (CVE-2015-0291) o Multiblock corrupted pointer fix (CVE-2015-0290) o Segmentation fault in DTLSv1_listen fix (CVE-2015-0207) o Segmentation fault in ASN1_TYPE_cmp fix (CVE-2015-0286) o Segmentation fault for invalid PSS parameters fix (CVE-2015-0208) o ASN.1 structure reuse memory corruption fix (CVE-2015-0287) o PKCS7 NULL pointer dereferences fix (CVE-2015-0289) o DoS via reachable assert in SSLv2 servers fix (CVE-2015-0293) o Empty CKE with client auth and DHE fix (CVE-2015-1787) o Handshake with unseeded PRNG fix (CVE-2015-0285) o Use After Free following d2i_ECPrivatekey error fix (CVE-2015-0209) o X509_to_X509_REQ NULL pointer deref fix (CVE-2015-0288) o Removed the export ciphers from the DEFAULT ciphers Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.2 [22 Jan 2015]: o Suite B support for TLS 1.2 and DTLS 1.2 o Support for DTLS 1.2 o TLS automatic EC curve selection. o API to set TLS supported signature algorithms and curves o SSL_CONF configuration API. o TLS Brainpool support. o ALPN support. o CMS support for RSA-PSS, RSA-OAEP, ECDH and X9.42 DH. Major changes between OpenSSL 1.0.1k and OpenSSL 1.0.1l [15 Jan 2015] o Build fixes for the Windows and OpenVMS platforms Major changes between OpenSSL 1.0.1j and OpenSSL 1.0.1k [8 Jan 2015] o Fix for CVE-2014-3571 o Fix for CVE-2015-0206 o Fix for CVE-2014-3569 o Fix for CVE-2014-3572 o Fix for CVE-2015-0204 o Fix for CVE-2015-0205 o Fix for CVE-2014-8275 o Fix for CVE-2014-3570 Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014] o Fix for CVE-2014-3513 o Fix for CVE-2014-3567 o Mitigation for CVE-2014-3566 (SSL protocol vulnerability) o Fix for CVE-2014-3568 Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014] o Fix for CVE-2014-3512 o Fix for CVE-2014-3511 o Fix for CVE-2014-3510 o Fix for CVE-2014-3507 o Fix for CVE-2014-3506 o Fix for CVE-2014-3505 o Fix for CVE-2014-3509 o Fix for CVE-2014-5139 o Fix for CVE-2014-3508 Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014] o Fix for CVE-2014-0224 o Fix for CVE-2014-0221 o Fix for CVE-2014-0198 o Fix for CVE-2014-0195 o Fix for CVE-2014-3470 o Fix for CVE-2010-5298 Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014] o Fix for CVE-2014-0160 o Add TLS padding extension workaround for broken servers. o Fix for CVE-2014-0076 Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014] o Don't include gmt_unix_time in TLS server and client random values o Fix for TLS record tampering bug CVE-2013-4353 o Fix for TLS version checking bug CVE-2013-6449 o Fix for DTLS retransmission bug CVE-2013-6450 Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013]: o Corrected fix for CVE-2013-0169 Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013]: o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version. o Include the fips configuration module. o Fix OCSP bad key DoS attack CVE-2013-0166 o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169 o 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]: o Fix TLS/DTLS record length checking bug CVE-2012-2333 o 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]: o Fix compilation error on non-x86 platforms. o Make FIPS capable OpenSSL ciphers work in non-FIPS mode. o 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]: o Fix for ASN1 overflow bug CVE-2012-2110 o Workarounds for some servers that hang on long client hellos. o Fix SEGV in AES code. Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012]: o TLS/DTLS heartbeat support. o SCTP support. o RFC 5705 TLS key material exporter. o RFC 5764 DTLS-SRTP negotiation. o Next Protocol Negotiation. o PSS signatures in certificates, requests and CRLs. o Support for password based recipient info for CMS. o Support TLS v1.2 and TLS v1.1. o Preliminary FIPS capability for unvalidated 2.0 FIPS module. o SRP support. Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012]: o Fix for CMS/PKCS#7 MMA CVE-2012-0884 o Corrected fix for CVE-2011-4619 o Various DTLS fixes. Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012]: o Fix for DTLS DoS issue CVE-2012-0050 Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012]: o Fix for DTLS plaintext recovery attack CVE-2011-4108 o Clear block padding bytes of SSL 3.0 records CVE-2011-4576 o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619 o Check parameters are not NULL in GOST ENGINE CVE-2012-0027 o Check for malformed RFC3779 data CVE-2011-4577 Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011]: o Fix for CRL vulnerability issue CVE-2011-3207 o Fix for ECDH crashes CVE-2011-3210 o Protection against EC timing attacks. o Support ECDH ciphersuites for certificates using SHA2 algorithms. o Various DTLS fixes. Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011]: o Fix for security issue CVE-2011-0014 Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010]: o Fix for security issue CVE-2010-4180 o Fix for CVE-2010-4252 o Fix mishandling of absent EC point format extension. o Fix various platform compilation issues. o Corrected fix for security issue CVE-2010-3864. Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010]: o Fix for security issue CVE-2010-3864. o Fix for CVE-2010-2939 o Fix WIN32 build system for GOST ENGINE. Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010]: o Fix for security issue CVE-2010-1633. o GOST MAC and CFB fixes. Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010]: o RFC3280 path validation: sufficient to process PKITS tests. o Integrated support for PVK files and keyblobs. o Change default private key format to PKCS#8. o CMS support: able to process all examples in RFC4134 o Streaming ASN1 encode support for PKCS#7 and CMS. o Multiple signer and signer add support for PKCS#7 and CMS. o ASN1 printing support. o Whirlpool hash algorithm added. o RFC3161 time stamp support. o New generalised public key API supporting ENGINE based algorithms. o New generalised public key API utilities. o New ENGINE supporting GOST algorithms. o SSL/TLS GOST ciphersuite support. o PKCS#7 and CMS GOST support. o RFC4279 PSK ciphersuite support. o Supported points format extension for ECC ciphersuites. o ecdsa-with-SHA224/256/384/512 signature types. o dsa-with-SHA224 and dsa-with-SHA256 signature types. o Opaque PRF Input TLS extension support. o Updated time routines to avoid OS limitations. Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]: o CFB cipher definition fixes. o 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]: o Cipher definition fixes. o Workaround for slow RAND_poll() on some WIN32 versions. o Remove MD2 from algorithm tables. o SPKAC handling fixes. o Support for RFC5746 TLS renegotiation extension. o Compression memory leak fixed. o Compression session resumption fixed. o Ticket and SNI coexistence fixes. o Many fixes to DTLS handling. Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]: o Temporary work around for CVE-2009-3555: disable renegotiation. Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]: o Fix various build issues. o 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]: o Fix security issue (CVE-2008-5077) o Merge FIPS 140-2 branch code. Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]: o CryptoAPI ENGINE support. o Various precautionary measures. o Fix for bugs affecting certificate request creation. o 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]: o Backport of CMS functionality to 0.9.8. o Fixes for bugs introduced with 0.9.8f. Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]: o Add gcc 4.2 support. o Add support for AES and SSE2 assembly lanugauge optimization for VC++ build. o Support for RFC4507bis and server name extensions if explicitly selected at compile time. o DTLS improvements. o RFC4507bis support. o TLS Extensions support. Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]: o Various ciphersuite selection fixes. o RFC3779 support. Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]: o Introduce limits to prevent malicious key DoS (CVE-2006-2940) o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) o Changes to ciphersuite selection algorithm Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]: o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 o New cipher Camellia Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]: o Cipher string fixes. o Fixes for VC++ 2005. o Updated ECC cipher suite support. o New functions EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free(). o Zlib compression usage fixes. o Built in dynamic engine compilation support on Win32. o Fixes auto dynamic engine loading in Win32. Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]: o Fix potential SSL 2.0 rollback, CVE-2005-2969 o Extended Windows CE support Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]: o Major work on the BIGNUM library for higher efficiency and to make operations more streamlined and less contradictory. This is the result of a major audit of the BIGNUM library. o Addition of BIGNUM functions for fields GF(2^m) and NIST curves, to support the Elliptic Crypto functions. o Major work on Elliptic Crypto; ECDH and ECDSA added, including the use through EVP, X509 and ENGINE. o New ASN.1 mini-compiler that's usable through the OpenSSL configuration file. o Added support for ASN.1 indefinite length constructed encoding. o New PKCS#12 'medium level' API to manipulate PKCS#12 files. o Complete rework of shared library construction and linking programs with shared or static libraries, through a separate Makefile.shared. o Rework of the passing of parameters from one Makefile to another. o Changed ENGINE framework to load dynamic engine modules automatically from specifically given directories. o New structure and ASN.1 functions for CertificatePair. o Changed the ZLIB compression method to be stateful. o Changed the key-generation and primality testing "progress" mechanism to take a structure that contains the ticker function and an argument. o New engine module: GMP (performs private key exponentiation). o New engine module: VIA PadLOck ACE extension in VIA C3 Nehemiah processors. o Added support for IPv6 addresses in certificate extensions. See RFC 1884, section 2.2. o Added support for certificate policy mappings, policy constraints and name constraints. o Added support for multi-valued AVAs in the OpenSSL configuration file. o Added support for multiple certificates with the same subject in the 'openssl ca' index file. o Make it possible to create self-signed certificates using 'openssl ca -selfsign'. o Make it possible to generate a serial number file with 'openssl ca -create_serial'. o New binary search functions with extended functionality. o New BUF functions. o New STORE structure and library to provide an interface to all sorts of data repositories. Supports storage of public and private keys, certificates, CRLs, numbers and arbitrary blobs. This library is unfortunately unfinished and unused withing OpenSSL. o New control functions for the error stack. o Changed the PKCS#7 library to support one-pass S/MIME processing. o Added the possibility to compile without old deprecated functionality with the OPENSSL_NO_DEPRECATED macro or the 'no-deprecated' argument to the config and Configure scripts. o Constification of all ASN.1 conversion functions, and other affected functions. o Improved platform support for PowerPC. o New FIPS 180-2 algorithms (SHA-224, -256, -384 and -512). o New X509_VERIFY_PARAM structure to support parametrisation of X.509 path validation. o Major overhaul of RC4 performance on Intel P4, IA-64 and AMD64. o Changed the Configure script to have some algorithms disabled by default. Those can be explicitely enabled with the new argument form 'enable-xxx'. o Change the default digest in 'openssl' commands from MD5 to SHA-1. o Added support for DTLS. o New BIGNUM blinding. o Added support for the RSA-PSS encryption scheme o Added support for the RSA X.931 padding. o Added support for BSD sockets on NetWare. o Added support for files larger than 2GB. o Added initial support for Win64. o Added alternate pkg-config files. Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]: o FIPS 1.1.1 module linking. o Various ciphersuite selection fixes. Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]: o Introduce limits to prevent malicious key DoS (CVE-2006-2940) o 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]: o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]: o Visual C++ 2005 fixes. o Update Windows build system for FIPS. Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]: o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build. Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]: o Fix SSL 2.0 Rollback, CVE-2005-2969 o Allow use of fixed-length exponent on DSA signing o Default fixed-window RSA, DSA, DH private-key operations Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]: o More compilation issues fixed. o Adaptation to more modern Kerberos API. o Enhanced or corrected configuration for Solaris64, Mingw and Cygwin. o Enhanced x86_64 assembler BIGNUM module. o More constification. o Added processing of proxy certificates (RFC 3820). Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]: o Several compilation issues fixed. o Many memory allocation failure checks added. o Improved comparison of X509 Name type. o Mandatory basic checks on certificates. o Performance improvements. Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]: o Fix race condition in CRL checking code. o Fixes to PKCS#7 (S/MIME) code. Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]: o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug o Security: Fix null-pointer assignment in do_change_cipher_spec() o Allow multiple active certificates with same subject in CA index o Multiple X509 verification fixes o Speed up HMAC and other operations Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]: o Security: fix various ASN1 parsing bugs. o New -ignore_err option to OCSP utility. o Various interop and bug fixes in S/MIME code. o SSL/TLS protocol fix for unrequested client certificates. Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]: o Security: counter the Klima-Pokorny-Rosa extension of Bleichbacher's attack o Security: make RSA blinding default. o Configuration: Irix fixes, AIX fixes, better mingw support. o Support for new platforms: linux-ia64-ecc. o Build: shared library support fixes. o ASN.1: treat domainComponent correctly. o Documentation: fixes and additions. Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]: o Security: Important security related bugfixes. o Enhanced compatibility with MIT Kerberos. o Can be built without the ENGINE framework. o IA32 assembler enhancements. o Support for new platforms: FreeBSD/IA64 and FreeBSD/Sparc64. o Configuration: the no-err option now works properly. o SSL/TLS: now handles manual certificate chain building. o SSL/TLS: certain session ID malfunctions corrected. Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]: o New library section OCSP. o Complete rewrite of ASN1 code. o CRL checking in verify code and openssl utility. o Extension copying in 'ca' utility. o Flexible display options in 'ca' utility. o Provisional support for international characters with UTF8. o Support for external crypto devices ('engine') is no longer a separate distribution. o New elliptic curve library section. o New AES (Rijndael) library section. o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit, Linux x86_64, Linux 64-bit on Sparc v9 o Extended support for some platforms: VxWorks o Enhanced support for shared libraries. o Now only builds PIC code when shared library support is requested. o Support for pkg-config. o Lots of new manuals. o Makes symbolic links to or copies of manuals to cover all described functions. o Change DES API to clean up the namespace (some applications link also against libdes providing similar functions having the same name). Provide macros for backward compatibility (will be removed in the future). o Unify handling of cryptographic algorithms (software and engine) to be available via EVP routines for asymmetric and symmetric ciphers. o NCONF: new configuration handling routines. o Change API to use more 'const' modifiers to improve error checking and help optimizers. o Finally remove references to RSAref. o Reworked parts of the BIGNUM code. o Support for new engines: Broadcom ubsec, Accelerated Encryption Processing, IBM 4758. o A few new engines added in the demos area. o Extended and corrected OID (object identifier) table. o PRNG: query at more locations for a random device, automatic query for EGD style random sources at several locations. o SSL/TLS: allow optional cipher choice according to server's preference. o SSL/TLS: allow server to explicitly set new session ids. o SSL/TLS: support Kerberos cipher suites (RFC2712). Only supports MIT Kerberos for now. o SSL/TLS: allow more precise control of renegotiations and sessions. o SSL/TLS: add callback to retrieve SSL/TLS messages. o SSL/TLS: support AES cipher suites (RFC3268). Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]: o Security: fix various ASN1 parsing bugs. o SSL/TLS protocol fix for unrequested client certificates. Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]: o Security: counter the Klima-Pokorny-Rosa extension of Bleichbacher's attack o Security: make RSA blinding default. o Build: shared library support fixes. Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]: o Important security related bugfixes. Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]: o New configuration targets for Tandem OSS and A/UX. o New OIDs for Microsoft attributes. o Better handling of SSL session caching. o Better comparison of distinguished names. o Better handling of shared libraries in a mixed GNU/non-GNU environment. o Support assembler code with Borland C. o Fixes for length problems. o Fixes for uninitialised variables. o Fixes for memory leaks, some unusual crashes and some race conditions. o Fixes for smaller building problems. o Updates of manuals, FAQ and other instructive documents. Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]: o Important building fixes on Unix. Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]: o Various important bugfixes. Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]: o Important security related bugfixes. o Various SSL/TLS library bugfixes. Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]: o Various SSL/TLS library bugfixes. o Fix DH parameter generation for 'non-standard' generators. Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]: o Various SSL/TLS library bugfixes. o BIGNUM library fixes. o RSA OAEP and random number generation fixes. o Object identifiers corrected and added. o Add assembler BN routines for IA64. o Add support for OS/390 Unix, UnixWare with gcc, OpenUNIX 8, MIPS Linux; shared library support for Irix, HP-UX. o Add crypto accelerator support for AEP, Baltimore SureWare, 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]: o Security fix: PRNG improvements. o Security fix: RSA OAEP check. o Security fix: Reinsert and fix countermeasure to Bleichbacher's attack. o MIPS bug fix in BIGNUM. o Bug fix in "openssl enc". o Bug fix in X.509 printing routine. o Bug fix in DSA verification routine and DSA S/MIME verification. o Bug fix to make PRNG thread-safe. o Bug fix in RAND_file_name(). o Bug fix in compatibility mode trust settings. o Bug fix in blowfish EVP. o Increase default size for BIO buffering filter. o Compatibility fixes in some scripts. Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]: o Security fix: change behavior of OpenSSL to avoid using environment variables when running as root. o Security fix: check the result of RSA-CRT to reduce the possibility of deducing the private key from an incorrectly calculated signature. o Security fix: prevent Bleichenbacher's DSA attack. o Security fix: Zero the premaster secret after deriving the master secret in DH ciphersuites. o Reimplement SSL_peek(), which had various problems. o Compatibility fix: the function des_encrypt() renamed to des_encrypt1() to avoid clashes with some Unixen libc. o Bug fixes for Win32, HP/UX and Irix. o Bug fixes in BIGNUM, SSL, PKCS#7, PKCS#12, X.509, CONF and memory checking routines. o Bug fixes for RSA operations in threaded environments. o Bug fixes in misc. openssl applications. o Remove a few potential memory leaks. o Add tighter checks of BIGNUM routines. o Shared library support has been reworked for generality. o More documentation. o New function BN_rand_range(). o 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]: o Some documentation for BIO and SSL libraries. o Enhanced chain verification using key identifiers. o New sign and verify options to 'dgst' application. o Support for DER and PEM encoded messages in 'smime' application. o New 'rsautl' application, low level RSA utility. o MD4 now included. o Bugfix for SSL rollback padding check. o Support for external crypto devices [1]. o Enhanced EVP interface. [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]: o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 o Shared library support for HPUX and Solaris-gcc o Support of Linux/IA64 o Assembler support for Mingw32 o New 'rand' application o 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]: o S/MIME support in new 'smime' command o Documentation for the OpenSSL command line application o Automation of 'req' application o Fixes to make s_client, s_server work under Windows o Support for multiple fieldnames in SPKACs o New SPKAC command line utilty and associated library functions o Options to allow passwords to be obtained from various sources o New public key PEM format and options to handle it o Many other fixes and enhancements to command line utilities o Usable certificate chain verification o Certificate purpose checking o Certificate trust settings o Support of authority information access extension o Extensions in certificate requests o Simplified X509 name and attribute routines o Initial (incomplete) support for international character sets o New DH_METHOD, DSA_METHOD and enhanced RSA_METHOD o Read only memory BIOs and simplified creation function o TLS/SSL protocol bugfixes: Accept TLS 'client hello' in SSL 3.0 record; allow fragmentation and interleaving of handshake and other data o TLS/SSL code now "tolerates" MS SGC o Work around for Netscape client certificate hang bug o RSA_NULL option that removes RSA patent code but keeps other RSA functionality o Memory leak detection now allows applications to add extra information via a per-thread stack o PRNG robustness improved o EGD support o BIGNUM library bug fixes o Faster DSA parameter generation o Enhanced support for Alpha Linux o Experimental MacOS support Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]: o Transparent support for PKCS#8 format private keys: these are used by several software packages and are more secure than the standard form o PKCS#5 v2.0 implementation o Password callbacks have a new void * argument for application data o Avoid various memory leaks o 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]: o Lots of enhancements and cleanups to the Configuration mechanism o RSA OEAP related fixes o Added `openssl ca -revoke' option for revoking a certificate o Source cleanups: const correctness, type-safe stacks and ASN.1 SETs o Source tree cleanups: removed lots of obsolete files o Thawte SXNet, certificate policies and CRL distribution points extension support o Preliminary (experimental) S/MIME support o Support for ASN.1 UTF8String and VisibleString o Full integration of PKCS#12 code o Sparc assembler bignum implementation, optimized hash functions o Option to disable selected ciphers Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]: o Fixed a security hole related to session resumption o Fixed RSA encryption routines for the p < q case o "ALL" in cipher lists now means "everything except NULL ciphers" o Support for Triple-DES CBCM cipher o Support of Optimal Asymmetric Encryption Padding (OAEP) for RSA o First support for new TLSv1 ciphers o Added a few new BIOs (syslog BIO, reliable BIO) o Extended support for DSA certificate/keys. o Extended support for Certificate Signing Requests (CSR) o Initial support for X.509v3 extensions o Extended support for compression inside the SSL record layer o Overhauled Win32 builds o Cleanups and fixes to the Big Number (BN) library o Support for ASN.1 GeneralizedTime o Splitted ASN.1 SETs from SEQUENCEs o ASN1 and PEM support for Netscape Certificate Sequences o Overhauled Perl interface o Lots of source tree cleanups. o Lots of memory leak fixes. o Lots of bug fixes. Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]: o Integration of the popular NO_RSA/NO_DSA patches o Initial support for compression inside the SSL record layer o Added BIO proxy and filtering functionality o Extended Big Number (BN) library o Added RIPE MD160 message digest o Addeed support for RC2/64bit cipher o Extended ASN.1 parser routines o Adjustations of the source tree for CVS o Support for various new platforms diff --git a/README b/README index b5aae6260ce8..80de6886a766 100644 --- a/README +++ b/README @@ -1,101 +1,101 @@ - OpenSSL 1.0.2m 2 Nov 2017 + OpenSSL 1.0.2n 7 Dec 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson All rights reserved. DESCRIPTION ----------- The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, fully featured, and Open Source toolkit implementing the Secure Sockets Layer (SSLv3) and Transport Layer Security (TLS) protocols as well as a full-strength general purpose cryptograpic library. The project is managed by a worldwide community of volunteers that use the Internet to communicate, plan, and develop the OpenSSL toolkit and its related documentation. OpenSSL is descended from the SSLeay library developed by Eric A. Young and Tim J. Hudson. The OpenSSL toolkit is licensed under a dual-license (the OpenSSL license plus the SSLeay license), which means that you are free to get and use it for commercial and non-commercial purposes as long as you fulfill the conditions of both licenses. OVERVIEW -------- The OpenSSL toolkit includes: libssl.a: Provides the client and server-side implementations for SSLv3 and TLS. libcrypto.a: Provides general cryptographic and X.509 support needed by SSL/TLS but not logically part of it. openssl: A command line tool that 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... INSTALLATION ------------ See the appropriate file: INSTALL Linux, Unix, etc. INSTALL.DJGPP DOS platform with DJGPP INSTALL.NW Netware INSTALL.OS2 OS/2 INSTALL.VMS VMS INSTALL.W32 Windows (32bit) INSTALL.W64 Windows (64bit) INSTALL.WCE Windows CE SUPPORT ------- See the OpenSSL website www.openssl.org for details on how to obtain commercial technical support. If you have any problems with OpenSSL then please take the following steps first: - Download the latest version from the repository to see if the problem has already been addressed - Configure with no-asm - Remove compiler optimisation flags If you wish to report a bug then please include the following information and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' - On other systems: OpenSSL version: output of 'openssl version -a' OS Name, Version, Hardware platform Compiler Details (name, version) - Application Details (name, version) - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. HOW TO CONTRIBUTE TO OpenSSL ---------------------------- See CONTRIBUTING LEGALITIES ---------- A number of nations restrict the use or export of cryptography. If you are potentially subject to such restrictions you should seek competent professional legal advice before attempting to develop or distribute cryptographic code. diff --git a/apps/apps.c b/apps/apps.c index c487bd92db2a..29de1b75dd60 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -1,3279 +1,3283 @@ /* apps/apps.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #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 #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef OPENSSL_NO_ENGINE # include #endif #ifndef OPENSSL_NO_RSA # include #endif #include #ifndef OPENSSL_NO_JPAKE # include #endif #define NON_MAIN #include "apps.h" #undef NON_MAIN #ifdef _WIN32 static int WIN32_rename(const char *from, const char *to); # define rename(from,to) WIN32_rename((from),(to)) +# ifdef fileno +# undef fileno +# endif +# define fileno(a) (int)_fileno(a) #endif typedef struct { const char *name; unsigned long flag; unsigned long mask; } NAME_EX_TBL; static UI_METHOD *ui_method = NULL; static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL * in_tbl); static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL * in_tbl); #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) /* Looks like this stuff is worth moving into separate function */ static EVP_PKEY *load_netscape_key(BIO *err, BIO *key, const char *file, const char *key_descrip, int format); #endif int app_init(long mesgwin); #ifdef undef /* never finished - probably never will be * :-) */ int args_from_file(char *file, int *argc, char **argv[]) { FILE *fp; int num, i; unsigned int len; static char *buf = NULL; static char **arg = NULL; char *p; fp = fopen(file, "r"); if (fp == NULL) return (0); if (fseek(fp, 0, SEEK_END) == 0) len = ftell(fp), rewind(fp); else len = -1; if (len <= 0) { fclose(fp); return (0); } *argc = 0; *argv = NULL; if (buf != NULL) OPENSSL_free(buf); buf = (char *)OPENSSL_malloc(len + 1); if (buf == NULL) return (0); len = fread(buf, 1, len, fp); if (len <= 1) return (0); buf[len] = '\0'; i = 0; for (p = buf; *p; p++) if (*p == '\n') i++; if (arg != NULL) OPENSSL_free(arg); arg = (char **)OPENSSL_malloc(sizeof(char *) * (i * 2)); if (arg == NULL) return 0; *argv = arg; num = 0; p = buf; for (;;) { if (!*p) break; if (*p == '#') { /* comment line */ while (*p && (*p != '\n')) p++; continue; } /* else we have a line */ *(arg++) = p; num++; while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n'))) p++; if (!*p) break; if (*p == '\n') { *(p++) = '\0'; continue; } /* else it is a tab or space */ p++; while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n'))) p++; if (!*p) break; if (*p == '\n') { p++; continue; } *(arg++) = p++; num++; while (*p && (*p != '\n')) p++; if (!*p) break; /* else *p == '\n' */ *(p++) = '\0'; } *argc = num; return (1); } #endif int str2fmt(char *s) { if (s == NULL) return FORMAT_UNDEF; if ((*s == 'D') || (*s == 'd')) return (FORMAT_ASN1); else if ((*s == 'T') || (*s == 't')) return (FORMAT_TEXT); else if ((*s == 'N') || (*s == 'n')) return (FORMAT_NETSCAPE); else if ((*s == 'S') || (*s == 's')) return (FORMAT_SMIME); else if ((*s == 'M') || (*s == 'm')) return (FORMAT_MSBLOB); else if ((*s == '1') || (strcmp(s, "PKCS12") == 0) || (strcmp(s, "pkcs12") == 0) || (strcmp(s, "P12") == 0) || (strcmp(s, "p12") == 0)) return (FORMAT_PKCS12); else if ((*s == 'E') || (*s == 'e')) return (FORMAT_ENGINE); else if ((*s == 'H') || (*s == 'h')) return FORMAT_HTTP; else if ((*s == 'P') || (*s == 'p')) { if (s[1] == 'V' || s[1] == 'v') return FORMAT_PVK; else return (FORMAT_PEM); } else return (FORMAT_UNDEF); } #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_NETWARE) void program_name(char *in, char *out, int size) { int i, n; char *p = NULL; n = strlen(in); /* find the last '/', '\' or ':' */ for (i = n - 1; i > 0; i--) { if ((in[i] == '/') || (in[i] == '\\') || (in[i] == ':')) { p = &(in[i + 1]); break; } } if (p == NULL) p = in; n = strlen(p); # if defined(OPENSSL_SYS_NETWARE) /* strip off trailing .nlm if present. */ if ((n > 4) && (p[n - 4] == '.') && ((p[n - 3] == 'n') || (p[n - 3] == 'N')) && ((p[n - 2] == 'l') || (p[n - 2] == 'L')) && ((p[n - 1] == 'm') || (p[n - 1] == 'M'))) n -= 4; # else /* strip off trailing .exe if present. */ if ((n > 4) && (p[n - 4] == '.') && ((p[n - 3] == 'e') || (p[n - 3] == 'E')) && ((p[n - 2] == 'x') || (p[n - 2] == 'X')) && ((p[n - 1] == 'e') || (p[n - 1] == 'E'))) n -= 4; # endif if (n > size - 1) n = size - 1; for (i = 0; i < n; i++) { if ((p[i] >= 'A') && (p[i] <= 'Z')) out[i] = p[i] - 'A' + 'a'; else out[i] = p[i]; } out[n] = '\0'; } #else # ifdef OPENSSL_SYS_VMS void program_name(char *in, char *out, int size) { char *p = in, *q; char *chars = ":]>"; while (*chars != '\0') { q = strrchr(p, *chars); if (q > p) p = q + 1; chars++; } q = strrchr(p, '.'); if (q == NULL) q = p + strlen(p); strncpy(out, p, size - 1); if (q - p >= size) { out[size - 1] = '\0'; } else { out[q - p] = '\0'; } } # else void program_name(char *in, char *out, int size) { char *p; p = strrchr(in, '/'); if (p != NULL) p++; else p = in; BUF_strlcpy(out, p, size); } # endif #endif int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) { int num, i; char *p; *argc = 0; *argv = NULL; i = 0; if (arg->count == 0) { arg->count = 20; arg->data = (char **)OPENSSL_malloc(sizeof(char *) * arg->count); if (arg->data == NULL) return 0; } for (i = 0; i < arg->count; i++) arg->data[i] = NULL; num = 0; p = buf; for (;;) { /* first scan over white space */ if (!*p) break; while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n'))) p++; if (!*p) break; /* The start of something good :-) */ if (num >= arg->count) { char **tmp_p; int tlen = arg->count + 20; tmp_p = (char **)OPENSSL_realloc(arg->data, sizeof(char *) * tlen); if (tmp_p == NULL) return 0; arg->data = tmp_p; arg->count = tlen; /* initialize newly allocated data */ for (i = num; i < arg->count; i++) arg->data[i] = NULL; } arg->data[num++] = p; /* now look for the end of this */ if ((*p == '\'') || (*p == '\"')) { /* scan for closing quote */ i = *(p++); arg->data[num - 1]++; /* jump over quote */ while (*p && (*p != i)) p++; *p = '\0'; } else { while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n'))) p++; if (*p == '\0') p--; else *p = '\0'; } p++; } *argc = num; *argv = arg->data; return (1); } #ifndef APP_INIT int app_init(long mesgwin) { return (1); } #endif int dump_cert_text(BIO *out, X509 *x) { char *p; p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); BIO_puts(out, "subject="); BIO_puts(out, p); OPENSSL_free(p); p = X509_NAME_oneline(X509_get_issuer_name(x), NULL, 0); BIO_puts(out, "\nissuer="); BIO_puts(out, p); BIO_puts(out, "\n"); OPENSSL_free(p); return 0; } static int ui_open(UI *ui) { return UI_method_get_opener(UI_OpenSSL())(ui); } static int ui_read(UI *ui, UI_STRING *uis) { if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD && UI_get0_user_data(ui)) { switch (UI_get_string_type(uis)) { case UIT_PROMPT: case UIT_VERIFY: { const char *password = ((PW_CB_DATA *)UI_get0_user_data(ui))->password; if (password && password[0] != '\0') { UI_set_result(ui, uis, password); return 1; } } default: break; } } return UI_method_get_reader(UI_OpenSSL())(ui, uis); } static int ui_write(UI *ui, UI_STRING *uis) { if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD && UI_get0_user_data(ui)) { switch (UI_get_string_type(uis)) { case UIT_PROMPT: case UIT_VERIFY: { const char *password = ((PW_CB_DATA *)UI_get0_user_data(ui))->password; if (password && password[0] != '\0') return 1; } default: break; } } return UI_method_get_writer(UI_OpenSSL())(ui, uis); } static int ui_close(UI *ui) { return UI_method_get_closer(UI_OpenSSL())(ui); } int setup_ui_method(void) { ui_method = UI_create_method("OpenSSL application user interface"); UI_method_set_opener(ui_method, ui_open); UI_method_set_reader(ui_method, ui_read); UI_method_set_writer(ui_method, ui_write); UI_method_set_closer(ui_method, ui_close); return 0; } void destroy_ui_method(void) { if (ui_method) { UI_destroy_method(ui_method); ui_method = NULL; } } int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp) { UI *ui = NULL; int res = 0; const char *prompt_info = NULL; const char *password = NULL; PW_CB_DATA *cb_data = (PW_CB_DATA *)cb_tmp; if (cb_data) { if (cb_data->password) password = cb_data->password; if (cb_data->prompt_info) prompt_info = cb_data->prompt_info; } if (password) { res = strlen(password); if (res > bufsiz) res = bufsiz; memcpy(buf, password, res); return res; } ui = UI_new_method(ui_method); if (ui) { int ok = 0; char *buff = NULL; int ui_flags = 0; char *prompt = NULL; prompt = UI_construct_prompt(ui, "pass phrase", prompt_info); if (!prompt) { BIO_printf(bio_err, "Out of memory\n"); UI_free(ui); return 0; } ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD; UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0); if (ok >= 0) ok = UI_add_input_string(ui, prompt, ui_flags, buf, PW_MIN_LENGTH, bufsiz - 1); if (ok >= 0 && verify) { buff = (char *)OPENSSL_malloc(bufsiz); if (!buff) { BIO_printf(bio_err, "Out of memory\n"); UI_free(ui); OPENSSL_free(prompt); return 0; } ok = UI_add_verify_string(ui, prompt, ui_flags, buff, PW_MIN_LENGTH, bufsiz - 1, buf); } if (ok >= 0) do { ok = UI_process(ui); } while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0)); if (buff) { OPENSSL_cleanse(buff, (unsigned int)bufsiz); OPENSSL_free(buff); } if (ok >= 0) res = strlen(buf); if (ok == -1) { BIO_printf(bio_err, "User interface error\n"); ERR_print_errors(bio_err); OPENSSL_cleanse(buf, (unsigned int)bufsiz); res = 0; } if (ok == -2) { BIO_printf(bio_err, "aborted!\n"); OPENSSL_cleanse(buf, (unsigned int)bufsiz); res = 0; } UI_free(ui); OPENSSL_free(prompt); } return res; } static char *app_get_pass(BIO *err, char *arg, int keepbio); int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2) { int same; if (!arg2 || !arg1 || strcmp(arg1, arg2)) same = 0; else same = 1; if (arg1) { *pass1 = app_get_pass(err, arg1, same); if (!*pass1) return 0; } else if (pass1) *pass1 = NULL; if (arg2) { *pass2 = app_get_pass(err, arg2, same ? 2 : 0); if (!*pass2) return 0; } else if (pass2) *pass2 = NULL; return 1; } static char *app_get_pass(BIO *err, char *arg, int keepbio) { char *tmp, tpass[APP_PASS_LEN]; static BIO *pwdbio = NULL; int i; if (!strncmp(arg, "pass:", 5)) return BUF_strdup(arg + 5); if (!strncmp(arg, "env:", 4)) { tmp = getenv(arg + 4); if (!tmp) { BIO_printf(err, "Can't read environment variable %s\n", arg + 4); return NULL; } return BUF_strdup(tmp); } if (!keepbio || !pwdbio) { if (!strncmp(arg, "file:", 5)) { pwdbio = BIO_new_file(arg + 5, "r"); if (!pwdbio) { BIO_printf(err, "Can't open file %s\n", arg + 5); return NULL; } #if !defined(_WIN32) /* * Under _WIN32, which covers even Win64 and CE, file * descriptors referenced by BIO_s_fd are not inherited * by child process and therefore below is not an option. * It could have been an option if bss_fd.c was operating * on real Windows descriptors, such as those obtained * with CreateFile. */ } else if (!strncmp(arg, "fd:", 3)) { BIO *btmp; i = atoi(arg + 3); if (i >= 0) pwdbio = BIO_new_fd(i, BIO_NOCLOSE); if ((i < 0) || !pwdbio) { BIO_printf(err, "Can't access file descriptor %s\n", arg + 3); return NULL; } /* * Can't do BIO_gets on an fd BIO so add a buffering BIO */ btmp = BIO_new(BIO_f_buffer()); pwdbio = BIO_push(btmp, pwdbio); #endif } else if (!strcmp(arg, "stdin")) { pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE); if (!pwdbio) { BIO_printf(err, "Can't open BIO for stdin\n"); return NULL; } } else { BIO_printf(err, "Invalid password argument \"%s\"\n", arg); return NULL; } } i = BIO_gets(pwdbio, tpass, APP_PASS_LEN); if (keepbio != 1) { BIO_free_all(pwdbio); pwdbio = NULL; } if (i <= 0) { BIO_printf(err, "Error reading password from BIO\n"); return NULL; } tmp = strchr(tpass, '\n'); if (tmp) *tmp = 0; return BUF_strdup(tpass); } int add_oid_section(BIO *err, CONF *conf) { char *p; STACK_OF(CONF_VALUE) *sktmp; CONF_VALUE *cnf; int i; if (!(p = NCONF_get_string(conf, NULL, "oid_section"))) { ERR_clear_error(); return 1; } if (!(sktmp = NCONF_get_section(conf, p))) { BIO_printf(err, "problem loading oid section %s\n", p); return 0; } for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) { cnf = sk_CONF_VALUE_value(sktmp, i); if (OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) { BIO_printf(err, "problem creating object %s=%s\n", cnf->name, cnf->value); return 0; } } return 1; } static int load_pkcs12(BIO *err, 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, ret = 0; PKCS12 *p12; p12 = d2i_PKCS12_bio(in, NULL); if (p12 == NULL) { BIO_printf(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) pem_cb = (pem_password_cb *)password_callback; len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data); if (len < 0) { BIO_printf(err, "Passpharse callback error for %s\n", desc); goto die; } if (len < PEM_BUFSIZE) tpass[len] = 0; if (!PKCS12_verify_mac(p12, tpass, len)) { BIO_printf(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: if (p12) PKCS12_free(p12); return ret; } int load_cert_crl_http(const char *url, BIO *err, X509 **pcert, X509_CRL **pcrl) { char *host = NULL, *port = NULL, *path = NULL; BIO *bio = NULL; OCSP_REQ_CTX *rctx = NULL; int use_ssl, rv = 0; if (!OCSP_parse_url(url, &host, &port, &path, &use_ssl)) goto err; if (use_ssl) { if (err) BIO_puts(err, "https not supported\n"); goto err; } bio = BIO_new_connect(host); if (!bio || !BIO_set_conn_port(bio, port)) goto err; rctx = OCSP_REQ_CTX_new(bio, 1024); if (!rctx) goto err; if (!OCSP_REQ_CTX_http(rctx, "GET", path)) goto err; if (!OCSP_REQ_CTX_add1_header(rctx, "Host", host)) goto err; if (pcert) { do { rv = X509_http_nbio(rctx, pcert); } while (rv == -1); } else { do { rv = X509_CRL_http_nbio(rctx, pcrl); } while (rv == -1); } err: if (host) OPENSSL_free(host); if (path) OPENSSL_free(path); if (port) OPENSSL_free(port); if (bio) BIO_free_all(bio); if (rctx) OCSP_REQ_CTX_free(rctx); if (rv != 1) { if (bio && err) BIO_printf(bio_err, "Error loading %s from %s\n", pcert ? "certificate" : "CRL", url); ERR_print_errors(bio_err); } return rv; } X509 *load_cert(BIO *err, const char *file, int format, const char *pass, ENGINE *e, const char *cert_descrip) { X509 *x = NULL; BIO *cert; if (format == FORMAT_HTTP) { load_cert_crl_http(file, err, &x, NULL); return x; } if ((cert = BIO_new(BIO_s_file())) == NULL) { ERR_print_errors(err); goto end; } if (file == NULL) { #ifdef _IONBF # ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); # endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(cert, stdin, BIO_NOCLOSE); } else { if (BIO_read_filename(cert, file) <= 0) { BIO_printf(err, "Error opening %s %s\n", cert_descrip, file); ERR_print_errors(err); goto end; } } if (format == FORMAT_ASN1) x = d2i_X509_bio(cert, NULL); else if (format == FORMAT_NETSCAPE) { NETSCAPE_X509 *nx; nx = ASN1_item_d2i_bio(ASN1_ITEM_rptr(NETSCAPE_X509), cert, NULL); if (nx == NULL) goto end; if ((strncmp(NETSCAPE_CERT_HDR, (char *)nx->header->data, nx->header->length) != 0)) { NETSCAPE_X509_free(nx); BIO_printf(err, "Error reading header on certificate\n"); goto end; } x = nx->cert; nx->cert = NULL; NETSCAPE_X509_free(nx); } 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(err, cert, cert_descrip, NULL, NULL, NULL, &x, NULL)) goto end; } else { BIO_printf(err, "bad input format specified for %s\n", cert_descrip); goto end; } end: if (x == NULL) { BIO_printf(err, "unable to load certificate\n"); ERR_print_errors(err); } if (cert != NULL) BIO_free(cert); return (x); } X509_CRL *load_crl(const char *infile, int format) { X509_CRL *x = NULL; BIO *in = NULL; if (format == FORMAT_HTTP) { load_cert_crl_http(infile, bio_err, NULL, &x); return x; } in = BIO_new(BIO_s_file()); if (in == NULL) { ERR_print_errors(bio_err); goto end; } if (infile == NULL) BIO_set_fp(in, stdin, BIO_NOCLOSE); else { if (BIO_read_filename(in, infile) <= 0) { perror(infile); 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; } end: BIO_free(in); return (x); } EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, const char *pass, ENGINE *e, const char *key_descrip) { BIO *key = NULL; EVP_PKEY *pkey = NULL; PW_CB_DATA cb_data; cb_data.password = pass; cb_data.prompt_info = file; if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE)) { BIO_printf(err, "no keyfile specified\n"); goto end; } #ifndef OPENSSL_NO_ENGINE if (format == FORMAT_ENGINE) { if (!e) BIO_printf(err, "no engine specified\n"); else { if (ENGINE_init(e)) { pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); ENGINE_finish(e); } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); } } goto end; } #endif key = BIO_new(BIO_s_file()); if (key == NULL) { ERR_print_errors(err); goto end; } if (file == NULL && maybe_stdin) { #ifdef _IONBF # ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); # endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(key, stdin, BIO_NOCLOSE); } else if (BIO_read_filename(key, file) <= 0) { BIO_printf(err, "Error opening %s %s\n", key_descrip, file); ERR_print_errors(err); goto end; } if (format == FORMAT_ASN1) { pkey = d2i_PrivateKey_bio(key, NULL); } else if (format == FORMAT_PEM) { pkey = PEM_read_bio_PrivateKey(key, NULL, (pem_password_cb *)password_callback, &cb_data); } #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif else if (format == FORMAT_PKCS12) { if (!load_pkcs12(err, key, key_descrip, (pem_password_cb *)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, (pem_password_cb *)password_callback, &cb_data); #endif else { BIO_printf(err, "bad input format specified for key file\n"); goto end; } end: if (key != NULL) BIO_free(key); if (pkey == NULL) { BIO_printf(err, "unable to load %s\n", key_descrip); ERR_print_errors(err); } return (pkey); } EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, const char *pass, ENGINE *e, const char *key_descrip) { BIO *key = NULL; EVP_PKEY *pkey = NULL; PW_CB_DATA cb_data; cb_data.password = pass; cb_data.prompt_info = file; if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE)) { BIO_printf(err, "no keyfile specified\n"); goto end; } #ifndef OPENSSL_NO_ENGINE if (format == FORMAT_ENGINE) { if (!e) BIO_printf(bio_err, "no engine specified\n"); else pkey = ENGINE_load_public_key(e, file, ui_method, &cb_data); goto end; } #endif key = BIO_new(BIO_s_file()); if (key == NULL) { ERR_print_errors(err); goto end; } if (file == NULL && maybe_stdin) { #ifdef _IONBF # ifndef OPENSSL_NO_SETVBUF_IONBF setvbuf(stdin, NULL, _IONBF, 0); # endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ #endif BIO_set_fp(key, stdin, BIO_NOCLOSE); } else if (BIO_read_filename(key, file) <= 0) { BIO_printf(err, "Error opening %s %s\n", key_descrip, file); ERR_print_errors(err); goto end; } if (format == FORMAT_ASN1) { pkey = d2i_PUBKEY_bio(key, NULL); } #ifndef OPENSSL_NO_RSA else if (format == FORMAT_ASN1RSA) { RSA *rsa; rsa = d2i_RSAPublicKey_bio(key, NULL); if (rsa) { pkey = EVP_PKEY_new(); if (pkey) EVP_PKEY_set1_RSA(pkey, rsa); RSA_free(rsa); } else pkey = NULL; } else if (format == FORMAT_PEMRSA) { RSA *rsa; rsa = PEM_read_bio_RSAPublicKey(key, NULL, (pem_password_cb *)password_callback, &cb_data); if (rsa) { pkey = EVP_PKEY_new(); if (pkey) EVP_PKEY_set1_RSA(pkey, rsa); RSA_free(rsa); } else pkey = NULL; } #endif else if (format == FORMAT_PEM) { pkey = PEM_read_bio_PUBKEY(key, NULL, (pem_password_cb *)password_callback, &cb_data); } #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) else if (format == FORMAT_MSBLOB) pkey = b2i_PublicKey_bio(key); #endif else { BIO_printf(err, "bad input format specified for key file\n"); goto end; } end: if (key != NULL) BIO_free(key); if (pkey == NULL) BIO_printf(err, "unable to load %s\n", key_descrip); return (pkey); } #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) static EVP_PKEY *load_netscape_key(BIO *err, BIO *key, const char *file, const char *key_descrip, int format) { EVP_PKEY *pkey; BUF_MEM *buf; RSA *rsa; const unsigned char *p; int size, i; buf = BUF_MEM_new(); pkey = EVP_PKEY_new(); size = 0; if (buf == NULL || pkey == NULL) goto error; for (;;) { if (!BUF_MEM_grow_clean(buf, size + 1024 * 10)) goto error; i = BIO_read(key, &(buf->data[size]), 1024 * 10); size += i; if (i == 0) break; if (i < 0) { BIO_printf(err, "Error reading %s %s", key_descrip, file); goto error; } } p = (unsigned char *)buf->data; rsa = d2i_RSA_NET(NULL, &p, (long)size, NULL, (format == FORMAT_IISSGC ? 1 : 0)); if (rsa == NULL) goto error; BUF_MEM_free(buf); EVP_PKEY_set1_RSA(pkey, rsa); return pkey; error: BUF_MEM_free(buf); EVP_PKEY_free(pkey); return NULL; } #endif /* ndef OPENSSL_NO_RC4 */ static int load_certs_crls(BIO *err, const char *file, int format, const char *pass, ENGINE *e, const char *desc, STACK_OF(X509) **pcerts, STACK_OF(X509_CRL) **pcrls) { int i; BIO *bio; STACK_OF(X509_INFO) *xis = NULL; X509_INFO *xi; PW_CB_DATA cb_data; int rv = 0; cb_data.password = pass; cb_data.prompt_info = file; if (format != FORMAT_PEM) { BIO_printf(err, "bad input format specified for %s\n", desc); return 0; } if (file == NULL) bio = BIO_new_fp(stdin, BIO_NOCLOSE); else bio = BIO_new_file(file, "r"); if (bio == NULL) { BIO_printf(err, "Error opening %s %s\n", desc, file ? file : "stdin"); ERR_print_errors(err); return 0; } xis = PEM_X509_INFO_read_bio(bio, NULL, (pem_password_cb *)password_callback, &cb_data); BIO_free(bio); if (pcerts) { *pcerts = sk_X509_new_null(); if (!*pcerts) goto end; } if (pcrls) { *pcrls = sk_X509_CRL_new_null(); if (!*pcrls) goto end; } for (i = 0; i < sk_X509_INFO_num(xis); i++) { xi = sk_X509_INFO_value(xis, i); if (xi->x509 && pcerts) { if (!sk_X509_push(*pcerts, xi->x509)) goto end; xi->x509 = NULL; } if (xi->crl && pcrls) { if (!sk_X509_CRL_push(*pcrls, xi->crl)) goto end; xi->crl = NULL; } } if (pcerts && sk_X509_num(*pcerts) > 0) rv = 1; if (pcrls && sk_X509_CRL_num(*pcrls) > 0) rv = 1; end: if (xis) sk_X509_INFO_pop_free(xis, X509_INFO_free); if (rv == 0) { if (pcerts) { sk_X509_pop_free(*pcerts, X509_free); *pcerts = NULL; } if (pcrls) { sk_X509_CRL_pop_free(*pcrls, X509_CRL_free); *pcrls = NULL; } BIO_printf(err, "unable to load %s\n", pcerts ? "certificates" : "CRLs"); ERR_print_errors(err); } return rv; } STACK_OF(X509) *load_certs(BIO *err, const char *file, int format, const char *pass, ENGINE *e, const char *desc) { STACK_OF(X509) *certs; if (!load_certs_crls(err, file, format, pass, e, desc, &certs, NULL)) return NULL; return certs; } STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format, const char *pass, ENGINE *e, const char *desc) { STACK_OF(X509_CRL) *crls; if (!load_certs_crls(err, file, format, pass, e, desc, NULL, &crls)) return NULL; return crls; } #define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) /* Return error for unknown extensions */ #define X509V3_EXT_DEFAULT 0 /* Print error for unknown extensions */ #define X509V3_EXT_ERROR_UNKNOWN (1L << 16) /* ASN1 parse unknown extensions */ #define X509V3_EXT_PARSE_UNKNOWN (2L << 16) /* BIO_dump unknown extensions */ #define X509V3_EXT_DUMP_UNKNOWN (3L << 16) #define X509_FLAG_CA (X509_FLAG_NO_ISSUER | X509_FLAG_NO_PUBKEY | \ X509_FLAG_NO_HEADER | X509_FLAG_NO_VERSION) int set_cert_ex(unsigned long *flags, const char *arg) { static const NAME_EX_TBL cert_tbl[] = { {"compatible", X509_FLAG_COMPAT, 0xffffffffl}, {"ca_default", X509_FLAG_CA, 0xffffffffl}, {"no_header", X509_FLAG_NO_HEADER, 0}, {"no_version", X509_FLAG_NO_VERSION, 0}, {"no_serial", X509_FLAG_NO_SERIAL, 0}, {"no_signame", X509_FLAG_NO_SIGNAME, 0}, {"no_validity", X509_FLAG_NO_VALIDITY, 0}, {"no_subject", X509_FLAG_NO_SUBJECT, 0}, {"no_issuer", X509_FLAG_NO_ISSUER, 0}, {"no_pubkey", X509_FLAG_NO_PUBKEY, 0}, {"no_extensions", X509_FLAG_NO_EXTENSIONS, 0}, {"no_sigdump", X509_FLAG_NO_SIGDUMP, 0}, {"no_aux", X509_FLAG_NO_AUX, 0}, {"no_attributes", X509_FLAG_NO_ATTRIBUTES, 0}, {"ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK}, {"ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK}, {"ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK}, {"ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK}, {NULL, 0, 0} }; return set_multi_opts(flags, arg, cert_tbl); } int set_name_ex(unsigned long *flags, const char *arg) { static const NAME_EX_TBL ex_tbl[] = { {"esc_2253", ASN1_STRFLGS_ESC_2253, 0}, {"esc_ctrl", ASN1_STRFLGS_ESC_CTRL, 0}, {"esc_msb", ASN1_STRFLGS_ESC_MSB, 0}, {"use_quote", ASN1_STRFLGS_ESC_QUOTE, 0}, {"utf8", ASN1_STRFLGS_UTF8_CONVERT, 0}, {"ignore_type", ASN1_STRFLGS_IGNORE_TYPE, 0}, {"show_type", ASN1_STRFLGS_SHOW_TYPE, 0}, {"dump_all", ASN1_STRFLGS_DUMP_ALL, 0}, {"dump_nostr", ASN1_STRFLGS_DUMP_UNKNOWN, 0}, {"dump_der", ASN1_STRFLGS_DUMP_DER, 0}, {"compat", XN_FLAG_COMPAT, 0xffffffffL}, {"sep_comma_plus", XN_FLAG_SEP_COMMA_PLUS, XN_FLAG_SEP_MASK}, {"sep_comma_plus_space", XN_FLAG_SEP_CPLUS_SPC, XN_FLAG_SEP_MASK}, {"sep_semi_plus_space", XN_FLAG_SEP_SPLUS_SPC, XN_FLAG_SEP_MASK}, {"sep_multiline", XN_FLAG_SEP_MULTILINE, XN_FLAG_SEP_MASK}, {"dn_rev", XN_FLAG_DN_REV, 0}, {"nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK}, {"sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK}, {"lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK}, {"align", XN_FLAG_FN_ALIGN, 0}, {"oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK}, {"space_eq", XN_FLAG_SPC_EQ, 0}, {"dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0}, {"RFC2253", XN_FLAG_RFC2253, 0xffffffffL}, {"oneline", XN_FLAG_ONELINE, 0xffffffffL}, {"multiline", XN_FLAG_MULTILINE, 0xffffffffL}, {"ca_default", XN_FLAG_MULTILINE, 0xffffffffL}, {NULL, 0, 0} }; if (set_multi_opts(flags, arg, ex_tbl) == 0) return 0; if ((*flags & XN_FLAG_SEP_MASK) == 0) *flags |= XN_FLAG_SEP_CPLUS_SPC; return 1; } int set_ext_copy(int *copy_type, const char *arg) { if (!strcasecmp(arg, "none")) *copy_type = EXT_COPY_NONE; else if (!strcasecmp(arg, "copy")) *copy_type = EXT_COPY_ADD; else if (!strcasecmp(arg, "copyall")) *copy_type = EXT_COPY_ALL; else return 0; return 1; } int copy_extensions(X509 *x, X509_REQ *req, int copy_type) { STACK_OF(X509_EXTENSION) *exts = NULL; X509_EXTENSION *ext, *tmpext; ASN1_OBJECT *obj; int i, idx, ret = 0; if (!x || !req || (copy_type == EXT_COPY_NONE)) return 1; exts = X509_REQ_get_extensions(req); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { ext = sk_X509_EXTENSION_value(exts, i); obj = X509_EXTENSION_get_object(ext); idx = X509_get_ext_by_OBJ(x, obj, -1); /* Does extension exist? */ if (idx != -1) { /* If normal copy don't override existing extension */ if (copy_type == EXT_COPY_ADD) continue; /* Delete all extensions of same type */ do { tmpext = X509_get_ext(x, idx); X509_delete_ext(x, idx); X509_EXTENSION_free(tmpext); idx = X509_get_ext_by_OBJ(x, obj, -1); } while (idx != -1); } if (!X509_add_ext(x, ext, -1)) goto end; } ret = 1; end: sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); return ret; } static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL * in_tbl) { STACK_OF(CONF_VALUE) *vals; CONF_VALUE *val; int i, ret = 1; if (!arg) return 0; vals = X509V3_parse_list(arg); for (i = 0; i < sk_CONF_VALUE_num(vals); i++) { val = sk_CONF_VALUE_value(vals, i); if (!set_table_opts(flags, val->name, in_tbl)) ret = 0; } sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); return ret; } static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL * in_tbl) { char c; const NAME_EX_TBL *ptbl; c = arg[0]; if (c == '-') { c = 0; arg++; } else if (c == '+') { c = 1; arg++; } else c = 1; for (ptbl = in_tbl; ptbl->name; ptbl++) { if (!strcasecmp(arg, ptbl->name)) { *flags &= ~ptbl->mask; if (c) *flags |= ptbl->flag; else *flags &= ~ptbl->flag; return 1; } } return 0; } void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags) { char *buf; char mline = 0; int indent = 0; if (title) BIO_puts(out, title); if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) { mline = 1; indent = 4; } if (lflags == XN_FLAG_COMPAT) { buf = X509_NAME_oneline(nm, 0, 0); BIO_puts(out, buf); BIO_puts(out, "\n"); OPENSSL_free(buf); } else { if (mline) BIO_puts(out, "\n"); X509_NAME_print_ex(out, nm, indent, lflags); BIO_puts(out, "\n"); } } X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath) { X509_STORE *store; X509_LOOKUP *lookup; if (!(store = X509_STORE_new())) goto end; lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); if (lookup == NULL) goto end; if (CAfile) { if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) { BIO_printf(bp, "Error loading file %s\n", CAfile); goto end; } } else X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT); lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); if (lookup == NULL) goto end; if (CApath) { if (!X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM)) { BIO_printf(bp, "Error loading directory %s\n", CApath); goto end; } } else X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT); ERR_clear_error(); return store; end: X509_STORE_free(store); return NULL; } #ifndef OPENSSL_NO_ENGINE /* Try to load an engine in a shareable library */ static ENGINE *try_load_engine(BIO *err, const char *engine, int debug) { ENGINE *e = ENGINE_by_id("dynamic"); if (e) { if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0) || !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)) { ENGINE_free(e); e = NULL; } } return e; } #endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; #ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); ENGINE_register_all_complete(); return NULL; } if ((e = ENGINE_by_id(engine)) == NULL && (e = try_load_engine(err, engine, debug)) == NULL) { BIO_printf(err, "invalid engine \"%s\"\n", engine); ERR_print_errors(err); return NULL; } if (debug) { ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, err, 0); } ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1); if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { BIO_printf(err, "can't use that engine\n"); ERR_print_errors(err); ENGINE_free(e); return NULL; } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); } #endif return e; } void release_engine(ENGINE *e) { #ifndef OPENSSL_NO_ENGINE if (e != NULL) /* Free our "structural" reference. */ ENGINE_free(e); #endif } int load_config(BIO *err, CONF *cnf) { static int load_config_called = 0; if (load_config_called) return 1; load_config_called = 1; if (!cnf) cnf = config; if (!cnf) return 1; OPENSSL_load_builtin_modules(); if (CONF_modules_load(cnf, NULL, 0) <= 0) { BIO_printf(err, "Error configuring OpenSSL\n"); ERR_print_errors(err); return 0; } return 1; } char *make_config_name() { const char *t = X509_get_default_cert_area(); size_t len; char *p; len = strlen(t) + strlen(OPENSSL_CONF) + 2; p = OPENSSL_malloc(len); if (p == NULL) return NULL; BUF_strlcpy(p, t, len); #ifndef OPENSSL_SYS_VMS BUF_strlcat(p, "/", len); #endif BUF_strlcat(p, OPENSSL_CONF, len); return p; } static unsigned long index_serial_hash(const OPENSSL_CSTRING *a) { const char *n; n = a[DB_serial]; while (*n == '0') n++; return (lh_strhash(n)); } static int index_serial_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b) { const char *aa, *bb; for (aa = a[DB_serial]; *aa == '0'; aa++) ; for (bb = b[DB_serial]; *bb == '0'; bb++) ; return (strcmp(aa, bb)); } static int index_name_qual(char **a) { return (a[0][0] == 'V'); } static unsigned long index_name_hash(const OPENSSL_CSTRING *a) { return (lh_strhash(a[DB_name])); } int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b) { return (strcmp(a[DB_name], b[DB_name])); } static IMPLEMENT_LHASH_HASH_FN(index_serial, OPENSSL_CSTRING) static IMPLEMENT_LHASH_COMP_FN(index_serial, OPENSSL_CSTRING) static IMPLEMENT_LHASH_HASH_FN(index_name, OPENSSL_CSTRING) static IMPLEMENT_LHASH_COMP_FN(index_name, OPENSSL_CSTRING) #undef BSIZE #define BSIZE 256 BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai) { BIO *in = NULL; BIGNUM *ret = NULL; MS_STATIC char buf[1024]; ASN1_INTEGER *ai = NULL; ai = ASN1_INTEGER_new(); if (ai == NULL) goto err; if ((in = BIO_new(BIO_s_file())) == NULL) { ERR_print_errors(bio_err); goto err; } if (BIO_read_filename(in, serialfile) <= 0) { if (!create) { perror(serialfile); goto err; } else { ret = BN_new(); if (ret == NULL || !rand_serial(ret, ai)) 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", 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"); goto err; } } if (ret && retai) { *retai = ai; ai = NULL; } err: if (in != NULL) BIO_free(in); if (ai != NULL) ASN1_INTEGER_free(ai); return (ret); } int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai) { char buf[1][BSIZE]; BIO *out = NULL; int ret = 0; ASN1_INTEGER *ai = NULL; int j; if (suffix == NULL) j = strlen(serialfile); else j = strlen(serialfile) + strlen(suffix) + 1; if (j >= BSIZE) { BIO_printf(bio_err, "file name too long\n"); goto err; } if (suffix == NULL) BUF_strlcpy(buf[0], serialfile, BSIZE); else { #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix); #else j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", serialfile, suffix); #endif } #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]); #endif out = BIO_new(BIO_s_file()); if (out == NULL) { ERR_print_errors(bio_err); goto err; } if (BIO_write_filename(out, buf[0]) <= 0) { perror(serialfile); goto err; } if ((ai = BN_to_ASN1_INTEGER(serial, NULL)) == NULL) { BIO_printf(bio_err, "error converting serial to ASN.1 format\n"); goto err; } i2a_ASN1_INTEGER(out, ai); BIO_puts(out, "\n"); ret = 1; if (retai) { *retai = ai; ai = NULL; } err: if (out != NULL) BIO_free_all(out); if (ai != NULL) ASN1_INTEGER_free(ai); return (ret); } int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix) { char buf[5][BSIZE]; int i, j; i = strlen(serialfile) + strlen(old_suffix); j = strlen(serialfile) + strlen(new_suffix); if (i > j) j = i; if (j + 1 >= BSIZE) { BIO_printf(bio_err, "file name too long\n"); goto err; } #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, new_suffix); #else j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", serialfile, new_suffix); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s", serialfile, old_suffix); #else j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s", serialfile, old_suffix); #endif #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", serialfile, buf[1]); #endif if (rename(serialfile, buf[1]) < 0 && errno != ENOENT #ifdef ENOTDIR && errno != ENOTDIR #endif ) { BIO_printf(bio_err, "unable to rename %s to %s\n", serialfile, buf[1]); perror("reason"); goto err; } #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", buf[0], serialfile); #endif if (rename(buf[0], serialfile) < 0) { BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], serialfile); perror("reason"); rename(buf[1], serialfile); goto err; } return 1; err: return 0; } int rand_serial(BIGNUM *b, ASN1_INTEGER *ai) { BIGNUM *btmp; int ret = 0; if (b) btmp = b; else btmp = BN_new(); if (!btmp) return 0; if (!BN_pseudo_rand(btmp, SERIAL_RAND_BITS, 0, 0)) goto error; if (ai && !BN_to_ASN1_INTEGER(btmp, ai)) goto error; ret = 1; error: if (!b) BN_free(btmp); return ret; } CA_DB *load_index(char *dbfile, DB_ATTR *db_attr) { CA_DB *retdb = NULL; TXT_DB *tmpdb = NULL; BIO *in = BIO_new(BIO_s_file()); CONF *dbattr_conf = NULL; char buf[1][BSIZE]; long errorline = -1; if (in == NULL) { ERR_print_errors(bio_err); goto err; } if (BIO_read_filename(in, dbfile) <= 0) { perror(dbfile); BIO_printf(bio_err, "unable to open '%s'\n", dbfile); goto err; } if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL) goto err; #ifndef OPENSSL_SYS_VMS BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile); #else BIO_snprintf(buf[0], sizeof buf[0], "%s-attr", dbfile); #endif dbattr_conf = NCONF_new(NULL); if (NCONF_load(dbattr_conf, buf[0], &errorline) <= 0) { if (errorline > 0) { BIO_printf(bio_err, "error on line %ld of db attribute file '%s'\n", errorline, buf[0]); goto err; } else { NCONF_free(dbattr_conf); dbattr_conf = NULL; } } if ((retdb = OPENSSL_malloc(sizeof(CA_DB))) == NULL) { fprintf(stderr, "Out of memory\n"); goto err; } retdb->db = tmpdb; tmpdb = NULL; if (db_attr) retdb->attributes = *db_attr; else { retdb->attributes.unique_subject = 1; } if (dbattr_conf) { char *p = NCONF_get_string(dbattr_conf, NULL, "unique_subject"); if (p) { #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG[load_index]: unique_subject = \"%s\"\n", p); #endif retdb->attributes.unique_subject = parse_yesno(p, 1); } } err: if (dbattr_conf) NCONF_free(dbattr_conf); if (tmpdb) TXT_DB_free(tmpdb); if (in) BIO_free_all(in); return retdb; } int index_index(CA_DB *db) { if (!TXT_DB_create_index(db->db, DB_serial, NULL, LHASH_HASH_FN(index_serial), LHASH_COMP_FN(index_serial))) { BIO_printf(bio_err, "error creating serial number index:(%ld,%ld,%ld)\n", db->db->error, db->db->arg1, db->db->arg2); return 0; } 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", db->db->error, db->db->arg1, db->db->arg2); return 0; } return 1; } int save_index(const char *dbfile, const char *suffix, CA_DB *db) { char buf[3][BSIZE]; BIO *out = BIO_new(BIO_s_file()); int j; if (out == NULL) { ERR_print_errors(bio_err); goto err; } j = strlen(dbfile) + strlen(suffix); if (j + 6 >= BSIZE) { BIO_printf(bio_err, "file name too long\n"); goto err; } #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr", dbfile); #else j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr", dbfile); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[1], sizeof buf[1], "%s.attr.%s", dbfile, suffix); #else j = BIO_snprintf(buf[1], sizeof buf[1], "%s-attr-%s", dbfile, suffix); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, suffix); #else j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", dbfile, suffix); #endif #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]); #endif if (BIO_write_filename(out, buf[0]) <= 0) { perror(dbfile); BIO_printf(bio_err, "unable to open '%s'\n", dbfile); goto err; } j = TXT_DB_write(out, db->db); if (j <= 0) goto err; BIO_free(out); out = BIO_new(BIO_s_file()); #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[1]); #endif if (BIO_write_filename(out, buf[1]) <= 0) { perror(buf[2]); BIO_printf(bio_err, "unable to open '%s'\n", buf[2]); goto err; } BIO_printf(out, "unique_subject = %s\n", db->attributes.unique_subject ? "yes" : "no"); BIO_free(out); return 1; err: return 0; } int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix) { char buf[5][BSIZE]; int i, j; i = strlen(dbfile) + strlen(old_suffix); j = strlen(dbfile) + strlen(new_suffix); if (i > j) j = i; if (j + 6 >= BSIZE) { BIO_printf(bio_err, "file name too long\n"); goto err; } #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[4], sizeof buf[4], "%s.attr", dbfile); #else j = BIO_snprintf(buf[4], sizeof buf[4], "%s-attr", dbfile); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr.%s", dbfile, new_suffix); #else j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr-%s", dbfile, new_suffix); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, new_suffix); #else j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", dbfile, new_suffix); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s", dbfile, old_suffix); #else j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s", dbfile, old_suffix); #endif #ifndef OPENSSL_SYS_VMS j = BIO_snprintf(buf[3], sizeof buf[3], "%s.attr.%s", dbfile, old_suffix); #else j = BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s", dbfile, old_suffix); #endif #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", dbfile, buf[1]); #endif if (rename(dbfile, buf[1]) < 0 && errno != ENOENT #ifdef ENOTDIR && errno != ENOTDIR #endif ) { BIO_printf(bio_err, "unable to rename %s to %s\n", dbfile, buf[1]); perror("reason"); goto err; } #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", buf[0], dbfile); #endif if (rename(buf[0], dbfile) < 0) { BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], dbfile); perror("reason"); rename(buf[1], dbfile); goto err; } #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", buf[4], buf[3]); #endif if (rename(buf[4], buf[3]) < 0 && errno != ENOENT #ifdef ENOTDIR && errno != ENOTDIR #endif ) { 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; } #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", buf[2], buf[4]); #endif if (rename(buf[2], buf[4]) < 0) { 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]); rename(buf[1], dbfile); goto err; } return 1; err: return 0; } void free_index(CA_DB *db) { if (db) { if (db->db) TXT_DB_free(db->db); OPENSSL_free(db); } } int parse_yesno(const char *str, int def) { int ret = def; if (str) { switch (*str) { case 'f': /* false */ case 'F': /* FALSE */ case 'n': /* no */ case 'N': /* NO */ case '0': /* 0 */ ret = 0; break; case 't': /* true */ case 'T': /* TRUE */ case 'y': /* yes */ case 'Y': /* YES */ case '1': /* 1 */ ret = 1; break; default: ret = def; break; } } return ret; } /* * subject is expected to be in the format /type0=value0/type1=value1/type2=... * where characters may be escaped by \ */ X509_NAME *parse_name(char *subject, long chtype, int multirdn) { size_t buflen = strlen(subject) + 1; /* to copy the types and values * into. due to escaping, the copy * can only become shorter */ char *buf = OPENSSL_malloc(buflen); size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ char **ne_types = OPENSSL_malloc(max_ne * sizeof(char *)); char **ne_values = OPENSSL_malloc(max_ne * sizeof(char *)); int *mval = OPENSSL_malloc(max_ne * sizeof(int)); char *sp = subject, *bp = buf; int i, ne_num = 0; X509_NAME *n = NULL; int nid; if (!buf || !ne_types || !ne_values || !mval) { BIO_printf(bio_err, "malloc error\n"); goto error; } if (*subject != '/') { BIO_printf(bio_err, "Subject does not start with '/'.\n"); goto error; } sp++; /* skip leading / */ /* no multivalued RDN by default */ mval[ne_num] = 0; while (*sp) { /* collect type */ ne_types[ne_num] = bp; while (*sp) { if (*sp == '\\') { /* is there anything to escape in the * type...? */ if (*++sp) *bp++ = *sp++; else { BIO_printf(bio_err, "escape character at end of string\n"); goto error; } } else if (*sp == '=') { sp++; *bp++ = '\0'; break; } else *bp++ = *sp++; } if (!*sp) { BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num); goto error; } ne_values[ne_num] = bp; while (*sp) { if (*sp == '\\') { if (*++sp) *bp++ = *sp++; else { BIO_printf(bio_err, "escape character at end of string\n"); goto error; } } else if (*sp == '/') { sp++; /* no multivalued RDN by default */ mval[ne_num + 1] = 0; break; } else if (*sp == '+' && multirdn) { /* * a not escaped + signals a mutlivalued RDN */ sp++; mval[ne_num + 1] = -1; break; } else *bp++ = *sp++; } *bp++ = '\0'; ne_num++; } if (!(n = X509_NAME_new())) goto error; for (i = 0; i < ne_num; i++) { if ((nid = OBJ_txt2nid(ne_types[i])) == NID_undef) { BIO_printf(bio_err, "Subject Attribute %s has no known NID, skipped\n", ne_types[i]); continue; } if (!*ne_values[i]) { BIO_printf(bio_err, "No value provided for Subject Attribute %s, skipped\n", ne_types[i]); continue; } if (!X509_NAME_add_entry_by_NID (n, nid, chtype, (unsigned char *)ne_values[i], -1, -1, mval[i])) goto error; } OPENSSL_free(ne_values); OPENSSL_free(ne_types); OPENSSL_free(buf); OPENSSL_free(mval); return n; error: X509_NAME_free(n); if (ne_values) OPENSSL_free(ne_values); if (ne_types) OPENSSL_free(ne_types); if (mval) OPENSSL_free(mval); if (buf) OPENSSL_free(buf); return NULL; } int args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, X509_VERIFY_PARAM **pm) { ASN1_OBJECT *otmp = NULL; unsigned long flags = 0; int i; int purpose = 0, depth = -1; char **oldargs = *pargs; char *arg = **pargs, *argn = (*pargs)[1]; time_t at_time = 0; char *hostname = NULL; char *email = NULL; char *ipasc = NULL; if (!strcmp(arg, "-policy")) { if (!argn) *badarg = 1; else { otmp = OBJ_txt2obj(argn, 0); if (!otmp) { BIO_printf(err, "Invalid Policy \"%s\"\n", argn); *badarg = 1; } } (*pargs)++; } else if (strcmp(arg, "-purpose") == 0) { X509_PURPOSE *xptmp; if (!argn) *badarg = 1; else { i = X509_PURPOSE_get_by_sname(argn); if (i < 0) { BIO_printf(err, "unrecognized purpose\n"); *badarg = 1; } else { xptmp = X509_PURPOSE_get0(i); purpose = X509_PURPOSE_get_id(xptmp); } } (*pargs)++; } else if (strcmp(arg, "-verify_depth") == 0) { if (!argn) *badarg = 1; else { depth = atoi(argn); if (depth < 0) { BIO_printf(err, "invalid depth\n"); *badarg = 1; } } (*pargs)++; } else if (strcmp(arg, "-attime") == 0) { if (!argn) *badarg = 1; else { long timestamp; /* * interpret the -attime argument as seconds since Epoch */ if (sscanf(argn, "%li", ×tamp) != 1) { BIO_printf(bio_err, "Error parsing timestamp %s\n", argn); *badarg = 1; } /* on some platforms time_t may be a float */ at_time = (time_t)timestamp; } (*pargs)++; } else if (strcmp(arg, "-verify_hostname") == 0) { if (!argn) *badarg = 1; hostname = argn; (*pargs)++; } else if (strcmp(arg, "-verify_email") == 0) { if (!argn) *badarg = 1; email = argn; (*pargs)++; } else if (strcmp(arg, "-verify_ip") == 0) { if (!argn) *badarg = 1; ipasc = argn; (*pargs)++; } else if (!strcmp(arg, "-ignore_critical")) flags |= X509_V_FLAG_IGNORE_CRITICAL; else if (!strcmp(arg, "-issuer_checks")) flags |= X509_V_FLAG_CB_ISSUER_CHECK; else if (!strcmp(arg, "-crl_check")) flags |= X509_V_FLAG_CRL_CHECK; else if (!strcmp(arg, "-crl_check_all")) flags |= X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL; else if (!strcmp(arg, "-policy_check")) flags |= X509_V_FLAG_POLICY_CHECK; else if (!strcmp(arg, "-explicit_policy")) flags |= X509_V_FLAG_EXPLICIT_POLICY; else if (!strcmp(arg, "-inhibit_any")) flags |= X509_V_FLAG_INHIBIT_ANY; else if (!strcmp(arg, "-inhibit_map")) flags |= X509_V_FLAG_INHIBIT_MAP; else if (!strcmp(arg, "-x509_strict")) flags |= X509_V_FLAG_X509_STRICT; else if (!strcmp(arg, "-extended_crl")) flags |= X509_V_FLAG_EXTENDED_CRL_SUPPORT; else if (!strcmp(arg, "-use_deltas")) flags |= X509_V_FLAG_USE_DELTAS; else if (!strcmp(arg, "-policy_print")) flags |= X509_V_FLAG_NOTIFY_POLICY; else if (!strcmp(arg, "-check_ss_sig")) flags |= X509_V_FLAG_CHECK_SS_SIGNATURE; else if (!strcmp(arg, "-trusted_first")) flags |= X509_V_FLAG_TRUSTED_FIRST; else if (!strcmp(arg, "-suiteB_128_only")) flags |= X509_V_FLAG_SUITEB_128_LOS_ONLY; else if (!strcmp(arg, "-suiteB_128")) flags |= X509_V_FLAG_SUITEB_128_LOS; else if (!strcmp(arg, "-suiteB_192")) flags |= X509_V_FLAG_SUITEB_192_LOS; else if (!strcmp(arg, "-partial_chain")) flags |= X509_V_FLAG_PARTIAL_CHAIN; else if (!strcmp(arg, "-no_alt_chains")) flags |= X509_V_FLAG_NO_ALT_CHAINS; else if (!strcmp(arg, "-allow_proxy_certs")) flags |= X509_V_FLAG_ALLOW_PROXY_CERTS; else return 0; if (*badarg) { if (*pm) X509_VERIFY_PARAM_free(*pm); *pm = NULL; goto end; } if (!*pm && !(*pm = X509_VERIFY_PARAM_new())) { *badarg = 1; goto end; } if (otmp) X509_VERIFY_PARAM_add0_policy(*pm, otmp); if (flags) X509_VERIFY_PARAM_set_flags(*pm, flags); if (purpose) X509_VERIFY_PARAM_set_purpose(*pm, purpose); if (depth >= 0) X509_VERIFY_PARAM_set_depth(*pm, depth); if (at_time) X509_VERIFY_PARAM_set_time(*pm, at_time); if (hostname && !X509_VERIFY_PARAM_set1_host(*pm, hostname, 0)) *badarg = 1; if (email && !X509_VERIFY_PARAM_set1_email(*pm, email, 0)) *badarg = 1; if (ipasc && !X509_VERIFY_PARAM_set1_ip_asc(*pm, ipasc)) *badarg = 1; end: (*pargs)++; if (pargc) *pargc -= *pargs - oldargs; return 1; } /* * Read whole contents of a BIO into an allocated memory buffer and return * it. */ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) { BIO *mem; int len, ret; unsigned char tbuf[1024]; mem = BIO_new(BIO_s_mem()); if (!mem) return -1; for (;;) { if ((maxlen != -1) && maxlen < 1024) len = maxlen; else len = 1024; len = BIO_read(in, tbuf, len); if (len < 0) { BIO_free(mem); return -1; } if (len == 0) break; if (BIO_write(mem, tbuf, len) != len) { BIO_free(mem); return -1; } maxlen -= len; if (maxlen == 0) break; } ret = BIO_get_mem_data(mem, (char **)out); BIO_set_flags(mem, BIO_FLAGS_MEM_RDONLY); BIO_free(mem); return ret; } int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) { int rv; char *stmp, *vtmp = NULL; stmp = BUF_strdup(value); if (!stmp) return -1; vtmp = strchr(stmp, ':'); if (vtmp) { *vtmp = 0; vtmp++; } rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); OPENSSL_free(stmp); return rv; } static void nodes_print(BIO *out, const char *name, STACK_OF(X509_POLICY_NODE) *nodes) { X509_POLICY_NODE *node; int i; BIO_printf(out, "%s Policies:", name); if (nodes) { BIO_puts(out, "\n"); for (i = 0; i < sk_X509_POLICY_NODE_num(nodes); i++) { node = sk_X509_POLICY_NODE_value(nodes, i); X509_POLICY_NODE_print(out, node, 2); } } else BIO_puts(out, " \n"); } void policies_print(BIO *out, X509_STORE_CTX *ctx) { X509_POLICY_TREE *tree; int explicit_policy; int free_out = 0; if (out == NULL) { out = BIO_new_fp(stderr, BIO_NOCLOSE); free_out = 1; } tree = X509_STORE_CTX_get0_policy_tree(ctx); explicit_policy = X509_STORE_CTX_get_explicit_policy(ctx); BIO_printf(out, "Require explicit Policy: %s\n", explicit_policy ? "True" : "False"); nodes_print(out, "Authority", X509_policy_tree_get0_policies(tree)); nodes_print(out, "User", X509_policy_tree_get0_user_policies(tree)); if (free_out) BIO_free(out); } #if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK) static JPAKE_CTX *jpake_init(const char *us, const char *them, const char *secret) { BIGNUM *p = NULL; BIGNUM *g = NULL; BIGNUM *q = NULL; BIGNUM *bnsecret = BN_new(); JPAKE_CTX *ctx; /* Use a safe prime for p (that we found earlier) */ BN_hex2bn(&p, "F9E5B365665EA7A05A9C534502780FEE6F1AB5BD4F49947FD036DBD7E905269AF46EF28B0FC07487EE4F5D20FB3C0AF8E700F3A2FA3414970CBED44FEDFF80CE78D800F184BB82435D137AADA2C6C16523247930A63B85661D1FC817A51ACD96168E95898A1F83A79FFB529368AA7833ABD1B0C3AEDDB14D2E1A2F71D99F763F"); g = BN_new(); BN_set_word(g, 2); q = BN_new(); BN_rshift1(q, p); BN_bin2bn((const unsigned char *)secret, strlen(secret), bnsecret); ctx = JPAKE_CTX_new(us, them, p, g, q, bnsecret); BN_free(bnsecret); BN_free(q); BN_free(g); BN_free(p); return ctx; } static void jpake_send_part(BIO *conn, const JPAKE_STEP_PART *p) { BN_print(conn, p->gx); BIO_puts(conn, "\n"); BN_print(conn, p->zkpx.gr); BIO_puts(conn, "\n"); BN_print(conn, p->zkpx.b); BIO_puts(conn, "\n"); } static void jpake_send_step1(BIO *bconn, JPAKE_CTX *ctx) { JPAKE_STEP1 s1; JPAKE_STEP1_init(&s1); JPAKE_STEP1_generate(&s1, ctx); jpake_send_part(bconn, &s1.p1); jpake_send_part(bconn, &s1.p2); (void)BIO_flush(bconn); JPAKE_STEP1_release(&s1); } static void jpake_send_step2(BIO *bconn, JPAKE_CTX *ctx) { JPAKE_STEP2 s2; JPAKE_STEP2_init(&s2); JPAKE_STEP2_generate(&s2, ctx); jpake_send_part(bconn, &s2); (void)BIO_flush(bconn); JPAKE_STEP2_release(&s2); } static void jpake_send_step3a(BIO *bconn, JPAKE_CTX *ctx) { JPAKE_STEP3A s3a; JPAKE_STEP3A_init(&s3a); JPAKE_STEP3A_generate(&s3a, ctx); BIO_write(bconn, s3a.hhk, sizeof s3a.hhk); (void)BIO_flush(bconn); JPAKE_STEP3A_release(&s3a); } static void jpake_send_step3b(BIO *bconn, JPAKE_CTX *ctx) { JPAKE_STEP3B s3b; JPAKE_STEP3B_init(&s3b); JPAKE_STEP3B_generate(&s3b, ctx); BIO_write(bconn, s3b.hk, sizeof s3b.hk); (void)BIO_flush(bconn); JPAKE_STEP3B_release(&s3b); } static void readbn(BIGNUM **bn, BIO *bconn) { char buf[10240]; int l; l = BIO_gets(bconn, buf, sizeof buf); assert(l > 0); assert(buf[l - 1] == '\n'); buf[l - 1] = '\0'; BN_hex2bn(bn, buf); } static void jpake_receive_part(JPAKE_STEP_PART *p, BIO *bconn) { readbn(&p->gx, bconn); readbn(&p->zkpx.gr, bconn); readbn(&p->zkpx.b, bconn); } static void jpake_receive_step1(JPAKE_CTX *ctx, BIO *bconn) { JPAKE_STEP1 s1; JPAKE_STEP1_init(&s1); jpake_receive_part(&s1.p1, bconn); jpake_receive_part(&s1.p2, bconn); if (!JPAKE_STEP1_process(ctx, &s1)) { ERR_print_errors(bio_err); exit(1); } JPAKE_STEP1_release(&s1); } static void jpake_receive_step2(JPAKE_CTX *ctx, BIO *bconn) { JPAKE_STEP2 s2; JPAKE_STEP2_init(&s2); jpake_receive_part(&s2, bconn); if (!JPAKE_STEP2_process(ctx, &s2)) { ERR_print_errors(bio_err); exit(1); } JPAKE_STEP2_release(&s2); } static void jpake_receive_step3a(JPAKE_CTX *ctx, BIO *bconn) { JPAKE_STEP3A s3a; int l; JPAKE_STEP3A_init(&s3a); l = BIO_read(bconn, s3a.hhk, sizeof s3a.hhk); assert(l == sizeof s3a.hhk); if (!JPAKE_STEP3A_process(ctx, &s3a)) { ERR_print_errors(bio_err); exit(1); } JPAKE_STEP3A_release(&s3a); } static void jpake_receive_step3b(JPAKE_CTX *ctx, BIO *bconn) { JPAKE_STEP3B s3b; int l; JPAKE_STEP3B_init(&s3b); l = BIO_read(bconn, s3b.hk, sizeof s3b.hk); assert(l == sizeof s3b.hk); if (!JPAKE_STEP3B_process(ctx, &s3b)) { ERR_print_errors(bio_err); exit(1); } JPAKE_STEP3B_release(&s3b); } void jpake_client_auth(BIO *out, BIO *conn, const char *secret) { JPAKE_CTX *ctx; BIO *bconn; BIO_puts(out, "Authenticating with JPAKE\n"); ctx = jpake_init("client", "server", secret); bconn = BIO_new(BIO_f_buffer()); BIO_push(bconn, conn); jpake_send_step1(bconn, ctx); jpake_receive_step1(ctx, bconn); jpake_send_step2(bconn, ctx); jpake_receive_step2(ctx, bconn); jpake_send_step3a(bconn, ctx); jpake_receive_step3b(ctx, bconn); BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n"); if (psk_key) OPENSSL_free(psk_key); psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx)); BIO_pop(bconn); BIO_free(bconn); JPAKE_CTX_free(ctx); } void jpake_server_auth(BIO *out, BIO *conn, const char *secret) { JPAKE_CTX *ctx; BIO *bconn; BIO_puts(out, "Authenticating with JPAKE\n"); ctx = jpake_init("server", "client", secret); bconn = BIO_new(BIO_f_buffer()); BIO_push(bconn, conn); jpake_receive_step1(ctx, bconn); jpake_send_step1(bconn, ctx); jpake_receive_step2(ctx, bconn); jpake_send_step2(bconn, ctx); jpake_receive_step3a(ctx, bconn); jpake_send_step3b(bconn, ctx); BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n"); if (psk_key) OPENSSL_free(psk_key); psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx)); BIO_pop(bconn); BIO_free(bconn); JPAKE_CTX_free(ctx); } #endif #ifndef OPENSSL_NO_TLSEXT /*- * next_protos_parse parses a comma separated list of strings into a string * in a format suitable for passing to SSL_CTX_set_next_protos_advertised. * outlen: (output) set to the length of the resulting buffer on success. * err: (maybe NULL) on failure, an error message line is written to this BIO. * in: a NUL termianted string like "abc,def,ghi" * * returns: a malloced buffer or NULL on failure. */ unsigned char *next_protos_parse(unsigned short *outlen, const char *in) { size_t len; unsigned char *out; size_t i, start = 0; len = strlen(in); if (len >= 65535) return NULL; out = OPENSSL_malloc(strlen(in) + 1); if (!out) return NULL; for (i = 0; i <= len; ++i) { if (i == len || in[i] == ',') { if (i - start > 255) { OPENSSL_free(out); return NULL; } - out[start] = i - start; + out[start] = (unsigned char)(i - start); start = i + 1; } else out[i + 1] = in[i]; } - *outlen = len + 1; + *outlen = (unsigned char)(len + 1); return out; } #endif /* ndef OPENSSL_NO_TLSEXT */ void print_cert_checks(BIO *bio, X509 *x, const char *checkhost, const char *checkemail, const char *checkip) { if (x == NULL) return; if (checkhost) { BIO_printf(bio, "Hostname %s does%s match certificate\n", checkhost, X509_check_host(x, checkhost, 0, 0, NULL) == 1 ? "" : " NOT"); } if (checkemail) { BIO_printf(bio, "Email %s does%s match certificate\n", checkemail, X509_check_email(x, checkemail, 0, 0) ? "" : " NOT"); } if (checkip) { BIO_printf(bio, "IP %s does%s match certificate\n", checkip, X509_check_ip_asc(x, checkip, 0) ? "" : " NOT"); } } /* Get first http URL from a DIST_POINT structure */ static const char *get_dp_url(DIST_POINT *dp) { GENERAL_NAMES *gens; GENERAL_NAME *gen; int i, gtype; ASN1_STRING *uri; if (!dp->distpoint || dp->distpoint->type != 0) return NULL; gens = dp->distpoint->name.fullname; for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) { gen = sk_GENERAL_NAME_value(gens, i); uri = GENERAL_NAME_get0_value(gen, >ype); if (gtype == GEN_URI && ASN1_STRING_length(uri) > 6) { char *uptr = (char *)ASN1_STRING_data(uri); if (!strncmp(uptr, "http://", 7)) return uptr; } } return NULL; } /* * Look through a CRLDP structure and attempt to find an http URL to * downloads a CRL from. */ static X509_CRL *load_crl_crldp(STACK_OF(DIST_POINT) *crldp) { int i; const char *urlptr = NULL; for (i = 0; i < sk_DIST_POINT_num(crldp); i++) { DIST_POINT *dp = sk_DIST_POINT_value(crldp, i); urlptr = get_dp_url(dp); if (urlptr) return load_crl(urlptr, FORMAT_HTTP); } 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. */ static STACK_OF(X509_CRL) *crls_http_cb(X509_STORE_CTX *ctx, X509_NAME *nm) { X509 *x; STACK_OF(X509_CRL) *crls = NULL; X509_CRL *crl; STACK_OF(DIST_POINT) *crldp; x = X509_STORE_CTX_get_current_cert(ctx); crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, NULL, NULL); crl = load_crl_crldp(crldp); sk_DIST_POINT_pop_free(crldp, DIST_POINT_free); if (!crl) return NULL; crls = sk_X509_CRL_new_null(); sk_X509_CRL_push(crls, crl); /* Try to download delta CRL */ crldp = X509_get_ext_d2i(x, NID_freshest_crl, NULL, NULL); crl = load_crl_crldp(crldp); sk_DIST_POINT_pop_free(crldp, DIST_POINT_free); if (crl) sk_X509_CRL_push(crls, crl); return crls; } void store_setup_crl_download(X509_STORE *st) { X509_STORE_set_lookup_crls_cb(st, crls_http_cb); } /* * Platform-specific sections */ #if defined(_WIN32) # ifdef fileno # undef fileno # define fileno(a) (int)_fileno(a) # endif # include # include static int WIN32_rename(const char *from, const char *to) { TCHAR *tfrom = NULL, *tto; DWORD err; int ret = 0; if (sizeof(TCHAR) == 1) { tfrom = (TCHAR *)from; tto = (TCHAR *)to; } else { /* UNICODE path */ size_t i, flen = strlen(from) + 1, tlen = strlen(to) + 1; tfrom = (TCHAR *)malloc(sizeof(TCHAR) * (flen + tlen)); if (tfrom == NULL) goto err; tto = tfrom + flen; # if !defined(_WIN32_WCE) || _WIN32_WCE>=101 if (!MultiByteToWideChar(CP_ACP, 0, from, flen, (WCHAR *)tfrom, flen)) # endif for (i = 0; i < flen; i++) tfrom[i] = (TCHAR)from[i]; # if !defined(_WIN32_WCE) || _WIN32_WCE>=101 if (!MultiByteToWideChar(CP_ACP, 0, to, tlen, (WCHAR *)tto, tlen)) # endif for (i = 0; i < tlen; i++) tto[i] = (TCHAR)to[i]; } if (MoveFile(tfrom, tto)) goto ok; err = GetLastError(); if (err == ERROR_ALREADY_EXISTS || err == ERROR_FILE_EXISTS) { if (DeleteFile(tto) && MoveFile(tfrom, tto)) goto ok; err = GetLastError(); } if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) errno = ENOENT; else if (err == ERROR_ACCESS_DENIED) errno = EACCES; else errno = EINVAL; /* we could map more codes... */ err: ret = -1; ok: if (tfrom != NULL && tfrom != (TCHAR *)from) free(tfrom); return ret; } #endif /* app_tminterval section */ #if defined(_WIN32) double app_tminterval(int stop, int usertime) { FILETIME now; double ret = 0; static ULARGE_INTEGER tmstart; static int warning = 1; # ifdef _WIN32_WINNT static HANDLE proc = NULL; if (proc == NULL) { if (check_winnt()) proc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, GetCurrentProcessId()); if (proc == NULL) proc = (HANDLE) - 1; } if (usertime && proc != (HANDLE) - 1) { FILETIME junk; GetProcessTimes(proc, &junk, &junk, &junk, &now); } else # endif { SYSTEMTIME systime; if (usertime && warning) { BIO_printf(bio_err, "To get meaningful results, run " "this program on idle system.\n"); warning = 0; } GetSystemTime(&systime); SystemTimeToFileTime(&systime, &now); } if (stop == TM_START) { tmstart.u.LowPart = now.dwLowDateTime; tmstart.u.HighPart = now.dwHighDateTime; } else { ULARGE_INTEGER tmstop; tmstop.u.LowPart = now.dwLowDateTime; tmstop.u.HighPart = now.dwHighDateTime; ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart) * 1e-7; } return (ret); } #elif defined(OPENSSL_SYS_NETWARE) # include double app_tminterval(int stop, int usertime) { double ret = 0; static clock_t tmstart; static int warning = 1; if (usertime && warning) { BIO_printf(bio_err, "To get meaningful results, run " "this program on idle system.\n"); warning = 0; } if (stop == TM_START) tmstart = clock(); else ret = (clock() - tmstart) / (double)CLOCKS_PER_SEC; return (ret); } #elif defined(OPENSSL_SYSTEM_VXWORKS) # include double app_tminterval(int stop, int usertime) { double ret = 0; # ifdef CLOCK_REALTIME static struct timespec tmstart; struct timespec now; # else static unsigned long tmstart; unsigned long now; # endif static int warning = 1; if (usertime && warning) { BIO_printf(bio_err, "To get meaningful results, run " "this program on idle system.\n"); warning = 0; } # ifdef CLOCK_REALTIME clock_gettime(CLOCK_REALTIME, &now); if (stop == TM_START) tmstart = now; else ret = ((now.tv_sec + now.tv_nsec * 1e-9) - (tmstart.tv_sec + tmstart.tv_nsec * 1e-9)); # else now = tickGet(); if (stop == TM_START) tmstart = now; else ret = (now - tmstart) / (double)sysClkRateGet(); # endif return (ret); } #elif defined(OPENSSL_SYSTEM_VMS) # include # include 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 double app_tminterval(int stop, int usertime) { double ret = 0; struct tms rus; clock_t now = times(&rus); static clock_t tmstart; if (usertime) now = rus.tms_utime; if (stop == TM_START) tmstart = now; else { long int tck = sysconf(_SC_CLK_TCK); ret = (now - tmstart) / (double)tck; } return (ret); } #else # include # include double app_tminterval(int stop, int usertime) { double ret = 0; struct rusage rus; struct timeval now; static struct timeval tmstart; if (usertime) getrusage(RUSAGE_SELF, &rus), now = rus.ru_utime; else gettimeofday(&now, NULL); if (stop == TM_START) tmstart = now; else ret = ((now.tv_sec + now.tv_usec * 1e-6) - (tmstart.tv_sec + tmstart.tv_usec * 1e-6)); return ret; } #endif /* app_isdir section */ #ifdef _WIN32 int app_isdir(const char *name) { HANDLE hList; WIN32_FIND_DATA FileData; # if defined(UNICODE) || defined(_UNICODE) size_t i, len_0 = strlen(name) + 1; if (len_0 > sizeof(FileData.cFileName) / sizeof(FileData.cFileName[0])) return -1; # if !defined(_WIN32_WCE) || _WIN32_WCE>=101 if (!MultiByteToWideChar (CP_ACP, 0, name, len_0, FileData.cFileName, len_0)) # endif for (i = 0; i < len_0; i++) FileData.cFileName[i] = (WCHAR)name[i]; hList = FindFirstFile(FileData.cFileName, &FileData); # else hList = FindFirstFile(name, &FileData); # endif if (hList == INVALID_HANDLE_VALUE) return -1; FindClose(hList); return ((FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); } #else # include # ifndef S_ISDIR # if defined(_S_IFMT) && defined(_S_IFDIR) # define S_ISDIR(a) (((a) & _S_IFMT) == _S_IFDIR) # else # define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) # endif # endif int app_isdir(const char *name) { # if defined(S_ISDIR) struct stat st; if (stat(name, &st) == 0) return S_ISDIR(st.st_mode); else return -1; # else return -1; # endif } #endif /* raw_read|write section */ #if defined(__VMS) # include "vms_term_sock.h" static int stdin_sock = -1; static void close_stdin_sock(void) { TerminalSocket (TERM_SOCK_DELETE, &stdin_sock); } int fileno_stdin(void) { if (stdin_sock == -1) { TerminalSocket(TERM_SOCK_CREATE, &stdin_sock); atexit(close_stdin_sock); } return stdin_sock; } #else int fileno_stdin(void) { return fileno(stdin); } #endif int fileno_stdout(void) { return fileno(stdout); } #if defined(_WIN32) && defined(STD_INPUT_HANDLE) int raw_read_stdin(void *buf, int siz) { DWORD n; if (ReadFile(GetStdHandle(STD_INPUT_HANDLE), buf, siz, &n, NULL)) return (n); else return (-1); } #elif defined(__VMS) #include int raw_read_stdin(void *buf, int siz) { return recv(fileno_stdin(), buf, siz, 0); } #else int raw_read_stdin(void *buf, int siz) { return read(fileno_stdin(), buf, siz); } #endif #if defined(_WIN32) && defined(STD_OUTPUT_HANDLE) int raw_write_stdout(const void *buf, int siz) { DWORD n; if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, siz, &n, NULL)) return (n); else return (-1); } #else int raw_write_stdout(const void *buf, int siz) { return write(fileno_stdout(), buf, siz); } #endif diff --git a/apps/dsa.c b/apps/dsa.c index 4ed21d891e86..82a870eb2910 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -1,369 +1,372 @@ /* apps/dsa.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include /* for OPENSSL_NO_DSA */ #ifndef OPENSSL_NO_DSA # include # include # include # include # include "apps.h" # include # include # include # include # include # include # include # undef PROG # define PROG dsa_main /*- * -inform arg - input format - default PEM (one of DER, NET or PEM) * -outform arg - output format - default PEM * -in arg - input file - default stdin * -out arg - output file - default stdout * -des - encrypt output if PEM format with DES in cbc mode * -des3 - encrypt output if PEM format * -idea - encrypt output if PEM format * -aes128 - encrypt output if PEM format * -aes192 - encrypt output if PEM format * -aes256 - encrypt output if PEM format * -camellia128 - encrypt output if PEM format * -camellia192 - encrypt output if PEM format * -camellia256 - encrypt output if PEM format * -seed - encrypt output if PEM format * -text - print a text version * -modulus - print the DSA public key */ int MAIN(int, char **); int MAIN(int argc, char **argv) { ENGINE *e = NULL; int ret = 1; DSA *dsa = NULL; int i, badops = 0; const EVP_CIPHER *enc = NULL; BIO *in = NULL, *out = NULL; int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; char *engine; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; int pvk_encr = 2; apps_startup(); if (bio_err == NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT); if (!load_config(bio_err, NULL)) goto end; engine = NULL; infile = NULL; outfile = NULL; informat = FORMAT_PEM; outformat = FORMAT_PEM; prog = argv[0]; argc--; argv++; while (argc >= 1) { if (strcmp(*argv, "-inform") == 0) { if (--argc < 1) goto bad; informat = str2fmt(*(++argv)); } else if (strcmp(*argv, "-outform") == 0) { if (--argc < 1) goto bad; outformat = str2fmt(*(++argv)); } else if (strcmp(*argv, "-in") == 0) { if (--argc < 1) goto bad; infile = *(++argv); } else if (strcmp(*argv, "-out") == 0) { if (--argc < 1) goto bad; outfile = *(++argv); } else if (strcmp(*argv, "-passin") == 0) { if (--argc < 1) goto bad; passargin = *(++argv); } else if (strcmp(*argv, "-passout") == 0) { if (--argc < 1) goto bad; passargout = *(++argv); } # ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv, "-engine") == 0) { if (--argc < 1) goto bad; engine = *(++argv); } # endif else if (strcmp(*argv, "-pvk-strong") == 0) pvk_encr = 2; else if (strcmp(*argv, "-pvk-weak") == 0) pvk_encr = 1; else if (strcmp(*argv, "-pvk-none") == 0) pvk_encr = 0; else if (strcmp(*argv, "-noout") == 0) noout = 1; else if (strcmp(*argv, "-text") == 0) text = 1; else if (strcmp(*argv, "-modulus") == 0) modulus = 1; else if (strcmp(*argv, "-pubin") == 0) pubin = 1; else if (strcmp(*argv, "-pubout") == 0) pubout = 1; else if ((enc = EVP_get_cipherbyname(&(argv[0][1]))) == NULL) { BIO_printf(bio_err, "unknown option %s\n", *argv); badops = 1; break; } argc--; argv++; } if (badops) { bad: BIO_printf(bio_err, "%s [options] outfile\n", prog); BIO_printf(bio_err, "where options are\n"); BIO_printf(bio_err, " -inform arg input format - DER or PEM\n"); BIO_printf(bio_err, " -outform arg output format - DER or PEM\n"); BIO_printf(bio_err, " -in arg input file\n"); BIO_printf(bio_err, " -passin arg input file pass phrase source\n"); BIO_printf(bio_err, " -out arg output file\n"); BIO_printf(bio_err, " -passout arg output file pass phrase source\n"); # ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, " -engine e use engine e, possibly a hardware device.\n"); # endif BIO_printf(bio_err, " -des encrypt PEM output with cbc des\n"); BIO_printf(bio_err, " -des3 encrypt PEM output with ede cbc des using 168 bit key\n"); # ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, " -idea encrypt PEM output with cbc idea\n"); # endif # ifndef OPENSSL_NO_AES BIO_printf(bio_err, " -aes128, -aes192, -aes256\n"); BIO_printf(bio_err, " encrypt PEM output with cbc aes\n"); # endif # ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, " -camellia128, -camellia192, -camellia256\n"); BIO_printf(bio_err, " encrypt PEM output with cbc camellia\n"); # endif # ifndef OPENSSL_NO_SEED BIO_printf(bio_err, " -seed encrypt PEM output with cbc seed\n"); # endif BIO_printf(bio_err, " -text print the key in text\n"); BIO_printf(bio_err, " -noout don't print key out\n"); BIO_printf(bio_err, " -modulus print the DSA public value\n"); goto end; } ERR_load_crypto_strings(); e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); goto end; } in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); if ((in == NULL) || (out == NULL)) { ERR_print_errors(bio_err); goto end; } if (infile == NULL) BIO_set_fp(in, stdin, BIO_NOCLOSE); else { if (BIO_read_filename(in, infile) <= 0) { perror(infile); goto end; } } BIO_printf(bio_err, "read DSA key\n"); { EVP_PKEY *pkey; if (pubin) pkey = load_pubkey(bio_err, infile, informat, 1, passin, e, "Public Key"); else pkey = load_key(bio_err, infile, informat, 1, passin, e, "Private Key"); if (pkey) { dsa = EVP_PKEY_get1_DSA(pkey); EVP_PKEY_free(pkey); } } if (dsa == NULL) { BIO_printf(bio_err, "unable to load Key\n"); ERR_print_errors(bio_err); goto end; } if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); # ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out); } # endif } else { if (BIO_write_filename(out, outfile) <= 0) { perror(outfile); goto end; } } if (text) if (!DSA_print(out, dsa, 0)) { perror(outfile); ERR_print_errors(bio_err); goto end; } if (modulus) { fprintf(stdout, "Public Key="); BN_print(out, dsa->pub_key); fprintf(stdout, "\n"); } if (noout) goto end; BIO_printf(bio_err, "writing DSA key\n"); if (outformat == FORMAT_ASN1) { if (pubin || pubout) i = i2d_DSA_PUBKEY_bio(out, dsa); else i = i2d_DSAPrivateKey_bio(out, dsa); } else if (outformat == FORMAT_PEM) { if (pubin || pubout) i = PEM_write_bio_DSA_PUBKEY(out, dsa); else i = PEM_write_bio_DSAPrivateKey(out, dsa, enc, NULL, 0, NULL, passout); # if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_RC4) } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) { EVP_PKEY *pk; pk = EVP_PKEY_new(); + if (pk == NULL) + goto end; + EVP_PKEY_set1_DSA(pk, dsa); if (outformat == FORMAT_PVK) i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout); else if (pubin || pubout) i = i2b_PublicKey_bio(out, pk); else i = i2b_PrivateKey_bio(out, pk); EVP_PKEY_free(pk); # endif } else { BIO_printf(bio_err, "bad output format specified for outfile\n"); goto end; } if (i <= 0) { BIO_printf(bio_err, "unable to write private key\n"); ERR_print_errors(bio_err); } else ret = 0; end: if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); release_engine(e); if (passin) OPENSSL_free(passin); if (passout) OPENSSL_free(passout); apps_shutdown(); OPENSSL_EXIT(ret); } #else /* !OPENSSL_NO_DSA */ # if PEDANTIC static void *dummy = &dummy; # endif #endif diff --git a/apps/s_client.c b/apps/s_client.c index dc467994f8e2..2a0ead7beffb 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1,2363 +1,2364 @@ /* apps/s_client.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2005 Nokia. All rights reserved. * * The portions of the attached software ("Contribution") is developed by * Nokia Corporation and is licensed pursuant to the OpenSSL open source * license. * * The Contribution, originally written by Mika Kousa and Pasi Eronen of * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites * support (see RFC 4279) to OpenSSL. * * No patent licenses or other rights except those expressly stated in * the OpenSSL open source license shall be deemed granted or received * expressly, by implication, estoppel, or otherwise. * * No assurances are provided by Nokia that the Contribution does not * infringe the patent or other intellectual property rights of any third * party or that the license provides you with all the necessary rights * to make use of the Contribution. * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR * OTHERWISE. */ #include #include #include #include #include #include #ifdef OPENSSL_NO_STDIO # define APPS_WIN16 #endif /* * With IPv6, it looks like Digital has mixed up the proper order of * recursive header file inclusion, resulting in the compiler complaining * that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which is * needed to have fileno() declared correctly... So let's define u_int */ #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT) # define __U_INT typedef unsigned int u_int; #endif #define USE_SOCKETS #include "apps.h" #include #include #include #include #include #include #include #ifndef OPENSSL_NO_SRP # include #endif #include "s_apps.h" #include "timeouts.h" #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ # undef FIONBIO #endif #if defined(OPENSSL_SYS_BEOS_R5) # include #endif #undef PROG #define PROG s_client_main /* * #define SSL_HOST_NAME "www.netscape.com" */ /* * #define SSL_HOST_NAME "193.118.187.102" */ #define SSL_HOST_NAME "localhost" /* no default cert. */ /* * #define TEST_CERT "client.pem" */ #undef BUFSIZZ #define BUFSIZZ 1024*8 extern int verify_depth; extern int verify_error; extern int verify_return_error; extern int verify_quiet; #ifdef FIONBIO static int c_nbio = 0; #endif static int c_Pause = 0; static int c_debug = 0; #ifndef OPENSSL_NO_TLSEXT static int c_tlsextdebug = 0; static int c_status_req = 0; #endif static int c_msg = 0; static int c_showcerts = 0; static char *keymatexportlabel = NULL; static int keymatexportlen = 20; static void sc_usage(void); static void print_stuff(BIO *berr, SSL *con, int full); #ifndef OPENSSL_NO_TLSEXT static int ocsp_resp_cb(SSL *s, void *arg); #endif static BIO *bio_c_out = NULL; static BIO *bio_c_msg = NULL; static int c_quiet = 0; static int c_ign_eof = 0; static int c_brief = 0; #ifndef OPENSSL_NO_PSK /* Default PSK identity and key */ static char *psk_identity = "Client_identity"; /* * char *psk_key=NULL; by default PSK is not used */ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len) { int ret; long key_len; unsigned char *key; if (c_debug) BIO_printf(bio_c_out, "psk_client_cb\n"); if (!hint) { /* no ServerKeyExchange message */ if (c_debug) BIO_printf(bio_c_out, "NULL received PSK identity hint, continuing anyway\n"); } else if (c_debug) BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint); /* * lookup PSK identity and PSK key based on the given identity hint here */ ret = BIO_snprintf(identity, max_identity_len, "%s", psk_identity); if (ret < 0 || (unsigned int)ret > max_identity_len) goto out_err; if (c_debug) BIO_printf(bio_c_out, "created identity '%s' len=%d\n", identity, ret); /* convert the PSK key to binary */ key = string_to_hex(psk_key, &key_len); if (key == NULL) { BIO_printf(bio_err, "Could not convert PSK key '%s' to buffer\n", psk_key); return 0; } if ((unsigned long)key_len > (unsigned long)max_psk_len) { BIO_printf(bio_err, "psk buffer of callback is too small (%d) for key (%ld)\n", max_psk_len, key_len); OPENSSL_free(key); return 0; } memcpy(psk, key, key_len); OPENSSL_free(key); if (c_debug) BIO_printf(bio_c_out, "created PSK len=%ld\n", key_len); return key_len; out_err: if (c_debug) BIO_printf(bio_err, "Error in PSK client callback\n"); return 0; } #endif static void sc_usage(void) { BIO_printf(bio_err, "usage: s_client args\n"); BIO_printf(bio_err, "\n"); BIO_printf(bio_err, " -host host - use -connect instead\n"); BIO_printf(bio_err, " -port port - use -connect instead\n"); BIO_printf(bio_err, " -connect host:port - who to connect to (default is %s:%s)\n", SSL_HOST_NAME, PORT_STR); BIO_printf(bio_err, " -verify_hostname host - check peer certificate matches \"host\"\n"); BIO_printf(bio_err, " -verify_email email - check peer certificate matches \"email\"\n"); BIO_printf(bio_err, " -verify_ip ipaddr - check peer certificate matches \"ipaddr\"\n"); BIO_printf(bio_err, " -verify arg - turn on peer certificate verification\n"); BIO_printf(bio_err, " -verify_return_error - return verification errors\n"); BIO_printf(bio_err, " -cert arg - certificate file to use, PEM format assumed\n"); BIO_printf(bio_err, " -certform arg - certificate format (PEM or DER) PEM default\n"); BIO_printf(bio_err, " -key arg - Private key file to use, in cert file if\n"); BIO_printf(bio_err, " not specified but cert file is.\n"); BIO_printf(bio_err, " -keyform arg - key format (PEM or DER) PEM default\n"); BIO_printf(bio_err, " -pass arg - private key file pass phrase source\n"); BIO_printf(bio_err, " -CApath arg - PEM format directory of CA's\n"); BIO_printf(bio_err, " -CAfile arg - PEM format file of CA's\n"); BIO_printf(bio_err, " -no_alt_chains - only ever use the first certificate chain found\n"); BIO_printf(bio_err, " -reconnect - Drop and re-make the connection with the same Session-ID\n"); BIO_printf(bio_err, " -pause - sleep(1) after each read(2) and write(2) system call\n"); BIO_printf(bio_err, " -prexit - print session information even on connection failure\n"); BIO_printf(bio_err, " -showcerts - show all certificates in the chain\n"); BIO_printf(bio_err, " -debug - extra output\n"); #ifdef WATT32 BIO_printf(bio_err, " -wdebug - WATT-32 tcp debugging\n"); #endif BIO_printf(bio_err, " -msg - Show protocol messages\n"); BIO_printf(bio_err, " -nbio_test - more ssl protocol testing\n"); BIO_printf(bio_err, " -state - print the 'ssl' states\n"); #ifdef FIONBIO BIO_printf(bio_err, " -nbio - Run with non-blocking IO\n"); #endif BIO_printf(bio_err, " -crlf - convert LF from terminal into CRLF\n"); BIO_printf(bio_err, " -quiet - no s_client output\n"); BIO_printf(bio_err, " -ign_eof - ignore input eof (default when -quiet)\n"); BIO_printf(bio_err, " -no_ign_eof - don't ignore input eof\n"); #ifndef OPENSSL_NO_PSK BIO_printf(bio_err, " -psk_identity arg - PSK identity\n"); BIO_printf(bio_err, " -psk arg - PSK in hex (without 0x)\n"); # ifndef OPENSSL_NO_JPAKE BIO_printf(bio_err, " -jpake arg - JPAKE secret to use\n"); # endif #endif #ifndef OPENSSL_NO_SRP BIO_printf(bio_err, " -srpuser user - SRP authentification for 'user'\n"); BIO_printf(bio_err, " -srppass arg - password for 'user'\n"); BIO_printf(bio_err, " -srp_lateuser - SRP username into second ClientHello message\n"); BIO_printf(bio_err, " -srp_moregroups - Tolerate other than the known g N values.\n"); BIO_printf(bio_err, " -srp_strength int - minimal length in bits for N (default %d).\n", SRP_MINIMAL_N); #endif BIO_printf(bio_err, " -ssl2 - just use SSLv2\n"); #ifndef OPENSSL_NO_SSL3_METHOD BIO_printf(bio_err, " -ssl3 - just use SSLv3\n"); #endif BIO_printf(bio_err, " -tls1_2 - just use TLSv1.2\n"); BIO_printf(bio_err, " -tls1_1 - just use TLSv1.1\n"); BIO_printf(bio_err, " -tls1 - just use TLSv1\n"); BIO_printf(bio_err, " -dtls1 - just use DTLSv1\n"); BIO_printf(bio_err, " -fallback_scsv - send TLS_FALLBACK_SCSV\n"); BIO_printf(bio_err, " -mtu - set the link layer MTU\n"); BIO_printf(bio_err, " -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err, " -bugs - Switch on all SSL implementation bug workarounds\n"); BIO_printf(bio_err, " -cipher - preferred cipher to use, use the 'openssl ciphers'\n"); BIO_printf(bio_err, " command to see what is available\n"); BIO_printf(bio_err, " -starttls prot - use the STARTTLS command before starting TLS\n"); BIO_printf(bio_err, " for those protocols that support it, where\n"); BIO_printf(bio_err, " 'prot' defines which one to assume. Currently,\n"); BIO_printf(bio_err, " only \"smtp\", \"pop3\", \"imap\", \"ftp\" and \"xmpp\"\n"); BIO_printf(bio_err, " are supported.\n"); #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, " -engine id - Initialise and use the specified engine\n"); #endif BIO_printf(bio_err, " -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); BIO_printf(bio_err, " -sess_out arg - file to write SSL session to\n"); BIO_printf(bio_err, " -sess_in arg - file to read SSL session from\n"); #ifndef OPENSSL_NO_TLSEXT BIO_printf(bio_err, " -servername host - Set TLS extension servername in ClientHello\n"); BIO_printf(bio_err, " -tlsextdebug - hex dump of all TLS extensions received\n"); BIO_printf(bio_err, " -status - request certificate status from server\n"); BIO_printf(bio_err, " -no_ticket - disable use of RFC4507bis session tickets\n"); BIO_printf(bio_err, " -serverinfo types - send empty ClientHello extensions (comma-separated numbers)\n"); BIO_printf(bio_err, " -curves arg - Elliptic curves to advertise (colon-separated list)\n"); BIO_printf(bio_err, " -sigalgs arg - Signature algorithms to support (colon-separated list)\n"); BIO_printf(bio_err, " -client_sigalgs arg - Signature algorithms to support for client\n"); BIO_printf(bio_err, " certificate authentication (colon-separated list)\n"); #endif #ifndef OPENSSL_NO_NEXTPROTONEG BIO_printf(bio_err, " -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n"); #endif BIO_printf(bio_err, " -alpn arg - enable ALPN extension, considering named protocols supported (comma-separated list)\n"); BIO_printf(bio_err, " -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n"); #ifndef OPENSSL_NO_SRTP BIO_printf(bio_err, " -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n"); #endif BIO_printf(bio_err, " -keymatexport label - Export keying material using label\n"); BIO_printf(bio_err, " -keymatexportlen len - Export len bytes of keying material (default 20)\n"); } #ifndef OPENSSL_NO_TLSEXT /* This is a context that we pass to callbacks */ typedef struct tlsextctx_st { BIO *biodebug; int ack; } tlsextctx; static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg) { tlsextctx *p = (tlsextctx *) arg; const char *hn = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); if (SSL_get_servername_type(s) != -1) p->ack = !SSL_session_reused(s) && hn != NULL; else BIO_printf(bio_err, "Can't use SSL_get_servername\n"); return SSL_TLSEXT_ERR_OK; } # ifndef OPENSSL_NO_SRP /* This is a context that we pass to all callbacks */ typedef struct srp_arg_st { char *srppassin; char *srplogin; int msg; /* copy from c_msg */ int debug; /* copy from c_debug */ int amp; /* allow more groups */ int strength /* minimal size for N */ ; } SRP_ARG; # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 static int srp_Verify_N_and_g(BIGNUM *N, BIGNUM *g) { BN_CTX *bn_ctx = BN_CTX_new(); BIGNUM *p = BN_new(); BIGNUM *r = BN_new(); int ret = g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && p != NULL && BN_rshift1(p, N) && /* p = (N-1)/2 */ BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && r != NULL && /* verify g^((N-1)/2) == -1 (mod N) */ BN_mod_exp(r, g, p, N, bn_ctx) && BN_add_word(r, 1) && BN_cmp(r, N) == 0; if (r) BN_free(r); if (p) BN_free(p); if (bn_ctx) BN_CTX_free(bn_ctx); return ret; } /*- * This callback is used here for two purposes: * - extended debugging * - making some primality tests for unknown groups * The callback is only called for a non default group. * * An application does not need the call back at all if * only the stanard groups are used. In real life situations, * client and server already share well known groups, * thus there is no need to verify them. * Furthermore, in case that a server actually proposes a group that * is not one of those defined in RFC 5054, it is more appropriate * to add the group to a static list and then compare since * primality tests are rather cpu consuming. */ static int MS_CALLBACK ssl_srp_verify_param_cb(SSL *s, void *arg) { SRP_ARG *srp_arg = (SRP_ARG *)arg; BIGNUM *N = NULL, *g = NULL; if (!(N = SSL_get_srp_N(s)) || !(g = SSL_get_srp_g(s))) return 0; if (srp_arg->debug || srp_arg->msg || srp_arg->amp == 1) { BIO_printf(bio_err, "SRP parameters:\n"); BIO_printf(bio_err, "\tN="); BN_print(bio_err, N); BIO_printf(bio_err, "\n\tg="); BN_print(bio_err, g); BIO_printf(bio_err, "\n"); } if (SRP_check_known_gN_param(g, N)) return 1; if (srp_arg->amp == 1) { if (srp_arg->debug) BIO_printf(bio_err, "SRP param N and g are not known params, going to check deeper.\n"); /* * The srp_moregroups is a real debugging feature. Implementors * should rather add the value to the known ones. The minimal size * has already been tested. */ if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g)) return 1; } BIO_printf(bio_err, "SRP param N and g rejected.\n"); return 0; } # define PWD_STRLEN 1024 static char *MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg) { SRP_ARG *srp_arg = (SRP_ARG *)arg; char *pass = (char *)OPENSSL_malloc(PWD_STRLEN + 1); PW_CB_DATA cb_tmp; int l; if (!pass) { BIO_printf(bio_err, "Malloc failure\n"); return NULL; } cb_tmp.password = (char *)srp_arg->srppassin; cb_tmp.prompt_info = "SRP user"; if ((l = password_callback(pass, PWD_STRLEN, 0, &cb_tmp)) < 0) { BIO_printf(bio_err, "Can't read Password\n"); OPENSSL_free(pass); return NULL; } *(pass + l) = '\0'; return pass; } # endif # ifndef OPENSSL_NO_SRTP char *srtp_profiles = NULL; # endif # ifndef OPENSSL_NO_NEXTPROTONEG /* This the context that we pass to next_proto_cb */ typedef struct tlsextnextprotoctx_st { unsigned char *data; unsigned short len; int status; } tlsextnextprotoctx; static tlsextnextprotoctx next_proto; static int next_proto_cb(SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { tlsextnextprotoctx *ctx = arg; if (!c_quiet) { /* We can assume that |in| is syntactically valid. */ unsigned i; BIO_printf(bio_c_out, "Protocols advertised by server: "); for (i = 0; i < inlen;) { if (i) BIO_write(bio_c_out, ", ", 2); BIO_write(bio_c_out, &in[i + 1], in[i]); i += in[i] + 1; } BIO_write(bio_c_out, "\n", 1); } ctx->status = SSL_select_next_proto(out, outlen, in, inlen, ctx->data, ctx->len); return SSL_TLSEXT_ERR_OK; } # endif /* ndef OPENSSL_NO_NEXTPROTONEG */ static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { char pem_name[100]; unsigned char ext_buf[4 + 65536]; /* Reconstruct the type/len fields prior to extension data */ - ext_buf[0] = ext_type >> 8; - ext_buf[1] = ext_type & 0xFF; - ext_buf[2] = inlen >> 8; - ext_buf[3] = inlen & 0xFF; + inlen &= 0xffff; /* for formal memcpy correctness */ + ext_buf[0] = (unsigned char)(ext_type >> 8); + ext_buf[1] = (unsigned char)(ext_type); + ext_buf[2] = (unsigned char)(inlen >> 8); + ext_buf[3] = (unsigned char)(inlen); memcpy(ext_buf + 4, in, inlen); BIO_snprintf(pem_name, sizeof(pem_name), "SERVERINFO FOR EXTENSION %d", ext_type); PEM_write_bio(bio_c_out, pem_name, "", ext_buf, 4 + inlen); return 1; } #endif enum { PROTO_OFF = 0, PROTO_SMTP, PROTO_POP3, PROTO_IMAP, PROTO_FTP, PROTO_XMPP }; int MAIN(int, char **); int MAIN(int argc, char **argv) { int build_chain = 0; SSL *con = NULL; #ifndef OPENSSL_NO_KRB5 KSSL_CTX *kctx; #endif int s, k, width, state = 0; char *cbuf = NULL, *sbuf = NULL, *mbuf = NULL; int cbuf_len, cbuf_off; int sbuf_len, sbuf_off; fd_set readfds, writefds; short port = PORT; int full_log = 1; char *host = SSL_HOST_NAME; char *cert_file = NULL, *key_file = NULL, *chain_file = NULL; int cert_format = FORMAT_PEM, key_format = FORMAT_PEM; char *passarg = NULL, *pass = NULL; X509 *cert = NULL; EVP_PKEY *key = NULL; STACK_OF(X509) *chain = NULL; char *CApath = NULL, *CAfile = NULL; char *chCApath = NULL, *chCAfile = NULL; char *vfyCApath = NULL, *vfyCAfile = NULL; int reconnect = 0, badop = 0, verify = SSL_VERIFY_NONE; int crlf = 0; int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending; SSL_CTX *ctx = NULL; int ret = 1, in_init = 1, i, nbio_test = 0; int starttls_proto = PROTO_OFF; int prexit = 0; X509_VERIFY_PARAM *vpm = NULL; int badarg = 0; const SSL_METHOD *meth = NULL; int socket_type = SOCK_STREAM; BIO *sbio; char *inrand = NULL; int mbuf_len = 0; struct timeval timeout, *timeoutp; char *engine_id = NULL; ENGINE *e = NULL; #ifndef OPENSSL_NO_ENGINE char *ssl_client_engine_id = NULL; ENGINE *ssl_client_engine = NULL; #endif #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5) struct timeval tv; # if defined(OPENSSL_SYS_BEOS_R5) int stdin_set = 0; # endif #endif #ifndef OPENSSL_NO_TLSEXT char *servername = NULL; tlsextctx tlsextcbp = { NULL, 0 }; # ifndef OPENSSL_NO_NEXTPROTONEG const char *next_proto_neg_in = NULL; # endif const char *alpn_in = NULL; # define MAX_SI_TYPES 100 unsigned short serverinfo_types[MAX_SI_TYPES]; int serverinfo_types_count = 0; #endif char *sess_in = NULL; char *sess_out = NULL; struct sockaddr peer; int peerlen = sizeof(peer); int fallback_scsv = 0; int enable_timeouts = 0; long socket_mtu = 0; #ifndef OPENSSL_NO_JPAKE static char *jpake_secret = NULL; # define no_jpake !jpake_secret #else # define no_jpake 1 #endif #ifndef OPENSSL_NO_SRP char *srppass = NULL; int srp_lateuser = 0; SRP_ARG srp_arg = { NULL, NULL, 0, 0, 0, 1024 }; #endif SSL_EXCERT *exc = NULL; SSL_CONF_CTX *cctx = NULL; STACK_OF(OPENSSL_STRING) *ssl_args = NULL; char *crl_file = NULL; int crl_format = FORMAT_PEM; int crl_download = 0; STACK_OF(X509_CRL) *crls = NULL; int prot_opt = 0, no_prot_opt = 0; meth = SSLv23_client_method(); apps_startup(); c_Pause = 0; c_quiet = 0; c_ign_eof = 0; c_debug = 0; c_msg = 0; c_showcerts = 0; if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); if (!load_config(bio_err, NULL)) goto end; cctx = SSL_CONF_CTX_new(); if (!cctx) goto end; SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT); SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CMDLINE); if (((cbuf = OPENSSL_malloc(BUFSIZZ)) == NULL) || ((sbuf = OPENSSL_malloc(BUFSIZZ)) == NULL) || ((mbuf = OPENSSL_malloc(BUFSIZZ)) == NULL)) { BIO_printf(bio_err, "out of memory\n"); goto end; } verify_depth = 0; verify_error = X509_V_OK; #ifdef FIONBIO c_nbio = 0; #endif argc--; argv++; while (argc >= 1) { if (strcmp(*argv, "-host") == 0) { if (--argc < 1) goto bad; host = *(++argv); } else if (strcmp(*argv, "-port") == 0) { if (--argc < 1) goto bad; port = atoi(*(++argv)); if (port == 0) goto bad; } else if (strcmp(*argv, "-connect") == 0) { if (--argc < 1) goto bad; if (!extract_host_port(*(++argv), &host, NULL, &port)) goto bad; } else if (strcmp(*argv, "-verify") == 0) { verify = SSL_VERIFY_PEER; if (--argc < 1) goto bad; verify_depth = atoi(*(++argv)); if (!c_quiet) BIO_printf(bio_err, "verify depth is %d\n", verify_depth); } else if (strcmp(*argv, "-cert") == 0) { if (--argc < 1) goto bad; cert_file = *(++argv); } else if (strcmp(*argv, "-CRL") == 0) { if (--argc < 1) goto bad; crl_file = *(++argv); } else if (strcmp(*argv, "-crl_download") == 0) crl_download = 1; else if (strcmp(*argv, "-sess_out") == 0) { if (--argc < 1) goto bad; sess_out = *(++argv); } else if (strcmp(*argv, "-sess_in") == 0) { if (--argc < 1) goto bad; sess_in = *(++argv); } else if (strcmp(*argv, "-certform") == 0) { if (--argc < 1) goto bad; cert_format = str2fmt(*(++argv)); } else if (strcmp(*argv, "-CRLform") == 0) { if (--argc < 1) goto bad; crl_format = str2fmt(*(++argv)); } else if (args_verify(&argv, &argc, &badarg, bio_err, &vpm)) { if (badarg) goto bad; continue; } else if (strcmp(*argv, "-verify_return_error") == 0) verify_return_error = 1; else if (strcmp(*argv, "-verify_quiet") == 0) verify_quiet = 1; else if (strcmp(*argv, "-brief") == 0) { c_brief = 1; verify_quiet = 1; c_quiet = 1; } else if (args_excert(&argv, &argc, &badarg, bio_err, &exc)) { if (badarg) goto bad; continue; } else if (args_ssl(&argv, &argc, cctx, &badarg, bio_err, &ssl_args, &no_prot_opt)) { if (badarg) goto bad; continue; } else if (strcmp(*argv, "-prexit") == 0) prexit = 1; else if (strcmp(*argv, "-crlf") == 0) crlf = 1; else if (strcmp(*argv, "-quiet") == 0) { c_quiet = 1; c_ign_eof = 1; } else if (strcmp(*argv, "-ign_eof") == 0) c_ign_eof = 1; else if (strcmp(*argv, "-no_ign_eof") == 0) c_ign_eof = 0; else if (strcmp(*argv, "-pause") == 0) c_Pause = 1; else if (strcmp(*argv, "-debug") == 0) c_debug = 1; #ifndef OPENSSL_NO_TLSEXT else if (strcmp(*argv, "-tlsextdebug") == 0) c_tlsextdebug = 1; else if (strcmp(*argv, "-status") == 0) c_status_req = 1; #endif #ifdef WATT32 else if (strcmp(*argv, "-wdebug") == 0) dbug_init(); #endif else if (strcmp(*argv, "-msg") == 0) c_msg = 1; else if (strcmp(*argv, "-msgfile") == 0) { if (--argc < 1) goto bad; bio_c_msg = BIO_new_file(*(++argv), "w"); } #ifndef OPENSSL_NO_SSL_TRACE else if (strcmp(*argv, "-trace") == 0) c_msg = 2; #endif else if (strcmp(*argv, "-showcerts") == 0) c_showcerts = 1; else if (strcmp(*argv, "-nbio_test") == 0) nbio_test = 1; else if (strcmp(*argv, "-state") == 0) state = 1; #ifndef OPENSSL_NO_PSK else if (strcmp(*argv, "-psk_identity") == 0) { if (--argc < 1) goto bad; psk_identity = *(++argv); } else if (strcmp(*argv, "-psk") == 0) { size_t j; if (--argc < 1) goto bad; psk_key = *(++argv); for (j = 0; j < strlen(psk_key); j++) { if (isxdigit((unsigned char)psk_key[j])) continue; BIO_printf(bio_err, "Not a hex number '%s'\n", *argv); goto bad; } } #endif #ifndef OPENSSL_NO_SRP else if (strcmp(*argv, "-srpuser") == 0) { if (--argc < 1) goto bad; srp_arg.srplogin = *(++argv); meth = TLSv1_client_method(); } else if (strcmp(*argv, "-srppass") == 0) { if (--argc < 1) goto bad; srppass = *(++argv); meth = TLSv1_client_method(); } else if (strcmp(*argv, "-srp_strength") == 0) { if (--argc < 1) goto bad; srp_arg.strength = atoi(*(++argv)); BIO_printf(bio_err, "SRP minimal length for N is %d\n", srp_arg.strength); meth = TLSv1_client_method(); } else if (strcmp(*argv, "-srp_lateuser") == 0) { srp_lateuser = 1; meth = TLSv1_client_method(); } else if (strcmp(*argv, "-srp_moregroups") == 0) { srp_arg.amp = 1; meth = TLSv1_client_method(); } #endif #ifndef OPENSSL_NO_SSL2 else if (strcmp(*argv, "-ssl2") == 0) { meth = SSLv2_client_method(); prot_opt++; } #endif #ifndef OPENSSL_NO_SSL3_METHOD else if (strcmp(*argv, "-ssl3") == 0) { meth = SSLv3_client_method(); prot_opt++; } #endif #ifndef OPENSSL_NO_TLS1 else if (strcmp(*argv, "-tls1_2") == 0) { meth = TLSv1_2_client_method(); prot_opt++; } else if (strcmp(*argv, "-tls1_1") == 0) { meth = TLSv1_1_client_method(); prot_opt++; } else if (strcmp(*argv, "-tls1") == 0) { meth = TLSv1_client_method(); prot_opt++; } #endif #ifndef OPENSSL_NO_DTLS1 else if (strcmp(*argv, "-dtls") == 0) { meth = DTLS_client_method(); socket_type = SOCK_DGRAM; prot_opt++; } else if (strcmp(*argv, "-dtls1") == 0) { meth = DTLSv1_client_method(); socket_type = SOCK_DGRAM; prot_opt++; } else if (strcmp(*argv, "-dtls1_2") == 0) { meth = DTLSv1_2_client_method(); socket_type = SOCK_DGRAM; prot_opt++; } else if (strcmp(*argv, "-timeout") == 0) enable_timeouts = 1; else if (strcmp(*argv, "-mtu") == 0) { if (--argc < 1) goto bad; socket_mtu = atol(*(++argv)); } #endif else if (strcmp(*argv, "-fallback_scsv") == 0) { fallback_scsv = 1; } else if (strcmp(*argv, "-keyform") == 0) { if (--argc < 1) goto bad; key_format = str2fmt(*(++argv)); } else if (strcmp(*argv, "-pass") == 0) { if (--argc < 1) goto bad; passarg = *(++argv); } else if (strcmp(*argv, "-cert_chain") == 0) { if (--argc < 1) goto bad; chain_file = *(++argv); } else if (strcmp(*argv, "-key") == 0) { if (--argc < 1) goto bad; key_file = *(++argv); } else if (strcmp(*argv, "-reconnect") == 0) { reconnect = 5; } else if (strcmp(*argv, "-CApath") == 0) { if (--argc < 1) goto bad; CApath = *(++argv); } else if (strcmp(*argv, "-chainCApath") == 0) { if (--argc < 1) goto bad; chCApath = *(++argv); } else if (strcmp(*argv, "-verifyCApath") == 0) { if (--argc < 1) goto bad; vfyCApath = *(++argv); } else if (strcmp(*argv, "-build_chain") == 0) build_chain = 1; else if (strcmp(*argv, "-CAfile") == 0) { if (--argc < 1) goto bad; CAfile = *(++argv); } else if (strcmp(*argv, "-chainCAfile") == 0) { if (--argc < 1) goto bad; chCAfile = *(++argv); } else if (strcmp(*argv, "-verifyCAfile") == 0) { if (--argc < 1) goto bad; vfyCAfile = *(++argv); } #ifndef OPENSSL_NO_TLSEXT # ifndef OPENSSL_NO_NEXTPROTONEG else if (strcmp(*argv, "-nextprotoneg") == 0) { if (--argc < 1) goto bad; next_proto_neg_in = *(++argv); } # endif else if (strcmp(*argv, "-alpn") == 0) { if (--argc < 1) goto bad; alpn_in = *(++argv); } else if (strcmp(*argv, "-serverinfo") == 0) { char *c; int start = 0; int len; if (--argc < 1) goto bad; c = *(++argv); serverinfo_types_count = 0; len = strlen(c); for (i = 0; i <= len; ++i) { if (i == len || c[i] == ',') { serverinfo_types[serverinfo_types_count] = atoi(c + start); serverinfo_types_count++; start = i + 1; } if (serverinfo_types_count == MAX_SI_TYPES) break; } } #endif #ifdef FIONBIO else if (strcmp(*argv, "-nbio") == 0) { c_nbio = 1; } #endif else if (strcmp(*argv, "-starttls") == 0) { if (--argc < 1) goto bad; ++argv; if (strcmp(*argv, "smtp") == 0) starttls_proto = PROTO_SMTP; else if (strcmp(*argv, "pop3") == 0) starttls_proto = PROTO_POP3; else if (strcmp(*argv, "imap") == 0) starttls_proto = PROTO_IMAP; else if (strcmp(*argv, "ftp") == 0) starttls_proto = PROTO_FTP; else if (strcmp(*argv, "xmpp") == 0) starttls_proto = PROTO_XMPP; else goto bad; } #ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv, "-engine") == 0) { if (--argc < 1) goto bad; engine_id = *(++argv); } else if (strcmp(*argv, "-ssl_client_engine") == 0) { if (--argc < 1) goto bad; ssl_client_engine_id = *(++argv); } #endif else if (strcmp(*argv, "-rand") == 0) { if (--argc < 1) goto bad; inrand = *(++argv); } #ifndef OPENSSL_NO_TLSEXT else if (strcmp(*argv, "-servername") == 0) { if (--argc < 1) goto bad; servername = *(++argv); /* meth=TLSv1_client_method(); */ } #endif #ifndef OPENSSL_NO_JPAKE else if (strcmp(*argv, "-jpake") == 0) { if (--argc < 1) goto bad; jpake_secret = *++argv; } #endif #ifndef OPENSSL_NO_SRTP else if (strcmp(*argv, "-use_srtp") == 0) { if (--argc < 1) goto bad; srtp_profiles = *(++argv); } #endif else if (strcmp(*argv, "-keymatexport") == 0) { if (--argc < 1) goto bad; keymatexportlabel = *(++argv); } else if (strcmp(*argv, "-keymatexportlen") == 0) { if (--argc < 1) goto bad; keymatexportlen = atoi(*(++argv)); if (keymatexportlen == 0) goto bad; } else { BIO_printf(bio_err, "unknown option %s\n", *argv); badop = 1; break; } argc--; argv++; } if (badop) { bad: sc_usage(); goto end; } #if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK) if (jpake_secret) { if (psk_key) { BIO_printf(bio_err, "Can't use JPAKE and PSK together\n"); goto end; } psk_identity = "JPAKE"; } #endif if (prot_opt > 1) { BIO_printf(bio_err, "Cannot supply multiple protocol flags\n"); goto end; } if (prot_opt == 1 && no_prot_opt) { BIO_printf(bio_err, "Cannot supply both a protocol flag and " "\"-no_\"\n"); goto end; } OpenSSL_add_ssl_algorithms(); SSL_load_error_strings(); #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) next_proto.status = -1; if (next_proto_neg_in) { next_proto.data = next_protos_parse(&next_proto.len, next_proto_neg_in); if (next_proto.data == NULL) { BIO_printf(bio_err, "Error parsing -nextprotoneg argument\n"); goto end; } } else next_proto.data = NULL; #endif e = setup_engine(bio_err, engine_id, 1); #ifndef OPENSSL_NO_ENGINE if (ssl_client_engine_id) { ssl_client_engine = ENGINE_by_id(ssl_client_engine_id); if (!ssl_client_engine) { BIO_printf(bio_err, "Error getting client auth engine\n"); goto end; } } #endif if (!app_passwd(bio_err, passarg, NULL, &pass, NULL)) { BIO_printf(bio_err, "Error getting password\n"); goto end; } if (key_file == NULL) key_file = cert_file; if (key_file) { key = load_key(bio_err, key_file, key_format, 0, pass, e, "client certificate private key file"); if (!key) { ERR_print_errors(bio_err); goto end; } } if (cert_file) { cert = load_cert(bio_err, cert_file, cert_format, NULL, e, "client certificate file"); if (!cert) { ERR_print_errors(bio_err); goto end; } } if (chain_file) { chain = load_certs(bio_err, chain_file, FORMAT_PEM, NULL, e, "client certificate chain"); if (!chain) goto end; } if (crl_file) { X509_CRL *crl; crl = load_crl(crl_file, crl_format); if (!crl) { BIO_puts(bio_err, "Error loading CRL\n"); ERR_print_errors(bio_err); goto end; } crls = sk_X509_CRL_new_null(); if (!crls || !sk_X509_CRL_push(crls, crl)) { BIO_puts(bio_err, "Error adding CRL\n"); ERR_print_errors(bio_err); X509_CRL_free(crl); goto end; } } if (!load_excert(&exc, bio_err)) goto end; if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL && !RAND_status()) { BIO_printf(bio_err, "warning, not much extra random data, consider using the -rand option\n"); } if (inrand != NULL) BIO_printf(bio_err, "%ld semi-random bytes loaded\n", app_RAND_load_files(inrand)); if (bio_c_out == NULL) { if (c_quiet && !c_debug) { bio_c_out = BIO_new(BIO_s_null()); if (c_msg && !bio_c_msg) bio_c_msg = BIO_new_fp(stdout, BIO_NOCLOSE); } else { if (bio_c_out == NULL) bio_c_out = BIO_new_fp(stdout, BIO_NOCLOSE); } } #ifndef OPENSSL_NO_SRP if (!app_passwd(bio_err, srppass, NULL, &srp_arg.srppassin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); goto end; } #endif ctx = SSL_CTX_new(meth); if (ctx == NULL) { ERR_print_errors(bio_err); goto end; } if (vpm) SSL_CTX_set1_param(ctx, vpm); if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, 1, no_jpake)) { ERR_print_errors(bio_err); goto end; } if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile, crls, crl_download)) { BIO_printf(bio_err, "Error loading store locations\n"); ERR_print_errors(bio_err); goto end; } #ifndef OPENSSL_NO_ENGINE if (ssl_client_engine) { if (!SSL_CTX_set_client_cert_engine(ctx, ssl_client_engine)) { BIO_puts(bio_err, "Error setting client auth engine\n"); ERR_print_errors(bio_err); ENGINE_free(ssl_client_engine); goto end; } ENGINE_free(ssl_client_engine); } #endif #ifndef OPENSSL_NO_PSK # ifdef OPENSSL_NO_JPAKE if (psk_key != NULL) # else if (psk_key != NULL || jpake_secret) # endif { if (c_debug) BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n"); SSL_CTX_set_psk_client_callback(ctx, psk_client_cb); } #endif #ifndef OPENSSL_NO_SRTP if (srtp_profiles != NULL) SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); #endif if (exc) ssl_ctx_set_excert(ctx, exc); #if !defined(OPENSSL_NO_TLSEXT) # if !defined(OPENSSL_NO_NEXTPROTONEG) if (next_proto.data) SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &next_proto); # endif if (alpn_in) { unsigned short alpn_len; unsigned char *alpn = next_protos_parse(&alpn_len, alpn_in); if (alpn == NULL) { BIO_printf(bio_err, "Error parsing -alpn argument\n"); goto end; } SSL_CTX_set_alpn_protos(ctx, alpn, alpn_len); OPENSSL_free(alpn); } #endif #ifndef OPENSSL_NO_TLSEXT for (i = 0; i < serverinfo_types_count; i++) { SSL_CTX_add_client_custom_ext(ctx, serverinfo_types[i], NULL, NULL, NULL, serverinfo_cli_parse_cb, NULL); } #endif if (state) SSL_CTX_set_info_callback(ctx, apps_ssl_info_callback); #if 0 else SSL_CTX_set_cipher_list(ctx, getenv("SSL_CIPHER")); #endif SSL_CTX_set_verify(ctx, verify, verify_callback); if ((CAfile || CApath) && !SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) { ERR_print_errors(bio_err); } if (!SSL_CTX_set_default_verify_paths(ctx)) { ERR_print_errors(bio_err); } ssl_ctx_add_crls(ctx, crls, crl_download); if (!set_cert_key_stuff(ctx, cert, key, chain, build_chain)) goto end; #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { tlsextcbp.biodebug = bio_err; SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb); SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp); } # ifndef OPENSSL_NO_SRP if (srp_arg.srplogin) { if (!srp_lateuser && !SSL_CTX_set_srp_username(ctx, srp_arg.srplogin)) { BIO_printf(bio_err, "Unable to set SRP username\n"); goto end; } srp_arg.msg = c_msg; srp_arg.debug = c_debug; SSL_CTX_set_srp_cb_arg(ctx, &srp_arg); SSL_CTX_set_srp_client_pwd_callback(ctx, ssl_give_srp_client_pwd_cb); SSL_CTX_set_srp_strength(ctx, srp_arg.strength); if (c_msg || c_debug || srp_arg.amp == 0) SSL_CTX_set_srp_verify_param_callback(ctx, ssl_srp_verify_param_cb); } # endif #endif con = SSL_new(ctx); if (sess_in) { SSL_SESSION *sess; BIO *stmp = BIO_new_file(sess_in, "r"); if (!stmp) { BIO_printf(bio_err, "Can't open session file %s\n", sess_in); ERR_print_errors(bio_err); goto end; } sess = PEM_read_bio_SSL_SESSION(stmp, NULL, 0, NULL); BIO_free(stmp); if (!sess) { BIO_printf(bio_err, "Can't open session file %s\n", sess_in); ERR_print_errors(bio_err); goto end; } SSL_set_session(con, sess); SSL_SESSION_free(sess); } if (fallback_scsv) SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { if (!SSL_set_tlsext_host_name(con, servername)) { BIO_printf(bio_err, "Unable to set TLS servername extension.\n"); ERR_print_errors(bio_err); goto end; } } #endif #ifndef OPENSSL_NO_KRB5 if (con && (kctx = kssl_ctx_new()) != NULL) { SSL_set0_kssl_ctx(con, kctx); kssl_ctx_setstring(kctx, KSSL_SERVER, host); } #endif /* OPENSSL_NO_KRB5 */ /* SSL_set_cipher_list(con,"RC4-MD5"); */ #if 0 # ifdef TLSEXT_TYPE_opaque_prf_input SSL_set_tlsext_opaque_prf_input(con, "Test client", 11); # endif #endif re_start: if (init_client(&s, host, port, socket_type) == 0) { BIO_printf(bio_err, "connect:errno=%d\n", get_last_socket_error()); SHUTDOWN(s); goto end; } BIO_printf(bio_c_out, "CONNECTED(%08X)\n", s); #ifdef FIONBIO if (c_nbio) { unsigned long l = 1; BIO_printf(bio_c_out, "turning on non blocking io\n"); if (BIO_socket_ioctl(s, FIONBIO, &l) < 0) { ERR_print_errors(bio_err); goto end; } } #endif if (c_Pause & 0x01) SSL_set_debug(con, 1); if (socket_type == SOCK_DGRAM) { sbio = BIO_new_dgram(s, BIO_NOCLOSE); if (getsockname(s, &peer, (void *)&peerlen) < 0) { BIO_printf(bio_err, "getsockname:errno=%d\n", get_last_socket_error()); SHUTDOWN(s); goto end; } (void)BIO_ctrl_set_connected(sbio, 1, &peer); if (enable_timeouts) { timeout.tv_sec = 0; timeout.tv_usec = DGRAM_RCV_TIMEOUT; BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_RECV_TIMEOUT, 0, &timeout); timeout.tv_sec = 0; timeout.tv_usec = DGRAM_SND_TIMEOUT; BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout); } if (socket_mtu) { if (socket_mtu < DTLS_get_link_min_mtu(con)) { BIO_printf(bio_err, "MTU too small. Must be at least %ld\n", DTLS_get_link_min_mtu(con)); BIO_free(sbio); goto shut; } SSL_set_options(con, SSL_OP_NO_QUERY_MTU); if (!DTLS_set_link_mtu(con, socket_mtu)) { BIO_printf(bio_err, "Failed to set MTU\n"); BIO_free(sbio); goto shut; } } else /* want to do MTU discovery */ BIO_ctrl(sbio, BIO_CTRL_DGRAM_MTU_DISCOVER, 0, NULL); } else sbio = BIO_new_socket(s, BIO_NOCLOSE); if (nbio_test) { BIO *test; test = BIO_new(BIO_f_nbio_test()); sbio = BIO_push(test, sbio); } if (c_debug) { SSL_set_debug(con, 1); BIO_set_callback(sbio, bio_dump_callback); BIO_set_callback_arg(sbio, (char *)bio_c_out); } if (c_msg) { #ifndef OPENSSL_NO_SSL_TRACE if (c_msg == 2) SSL_set_msg_callback(con, SSL_trace); else #endif SSL_set_msg_callback(con, msg_cb); SSL_set_msg_callback_arg(con, bio_c_msg ? bio_c_msg : bio_c_out); } #ifndef OPENSSL_NO_TLSEXT if (c_tlsextdebug) { SSL_set_tlsext_debug_callback(con, tlsext_cb); SSL_set_tlsext_debug_arg(con, bio_c_out); } if (c_status_req) { SSL_set_tlsext_status_type(con, TLSEXT_STATUSTYPE_ocsp); SSL_CTX_set_tlsext_status_cb(ctx, ocsp_resp_cb); SSL_CTX_set_tlsext_status_arg(ctx, bio_c_out); # if 0 { STACK_OF(OCSP_RESPID) *ids = sk_OCSP_RESPID_new_null(); OCSP_RESPID *id = OCSP_RESPID_new(); id->value.byKey = ASN1_OCTET_STRING_new(); id->type = V_OCSP_RESPID_KEY; ASN1_STRING_set(id->value.byKey, "Hello World", -1); sk_OCSP_RESPID_push(ids, id); SSL_set_tlsext_status_ids(con, ids); } # endif } #endif #ifndef OPENSSL_NO_JPAKE if (jpake_secret) jpake_client_auth(bio_c_out, sbio, jpake_secret); #endif SSL_set_bio(con, sbio, sbio); SSL_set_connect_state(con); /* ok, lets connect */ if (fileno_stdin() > SSL_get_fd(con)) width = fileno_stdin() + 1; else width = SSL_get_fd(con) + 1; read_tty = 1; write_tty = 0; tty_on = 0; read_ssl = 1; write_ssl = 1; cbuf_len = 0; cbuf_off = 0; sbuf_len = 0; sbuf_off = 0; /* This is an ugly hack that does a lot of assumptions */ /* * We do have to handle multi-line responses which may come in a single * packet or not. We therefore have to use BIO_gets() which does need a * buffering BIO. So during the initial chitchat we do push a buffering * BIO into the chain that is removed again later on to not disturb the * rest of the s_client operation. */ if (starttls_proto == PROTO_SMTP) { int foundit = 0; BIO *fbio = BIO_new(BIO_f_buffer()); BIO_push(fbio, sbio); /* wait for multi-line response to end from SMTP */ do { mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ); } while (mbuf_len > 3 && mbuf[3] == '-'); /* STARTTLS command requires EHLO... */ BIO_printf(fbio, "EHLO openssl.client.net\r\n"); (void)BIO_flush(fbio); /* wait for multi-line response to end EHLO SMTP response */ do { mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ); if (strstr(mbuf, "STARTTLS")) foundit = 1; } while (mbuf_len > 3 && mbuf[3] == '-'); (void)BIO_flush(fbio); BIO_pop(fbio); BIO_free(fbio); if (!foundit) BIO_printf(bio_err, "didn't found starttls in server response," " try anyway...\n"); BIO_printf(sbio, "STARTTLS\r\n"); BIO_read(sbio, sbuf, BUFSIZZ); } else if (starttls_proto == PROTO_POP3) { BIO_read(sbio, mbuf, BUFSIZZ); BIO_printf(sbio, "STLS\r\n"); BIO_read(sbio, sbuf, BUFSIZZ); } else if (starttls_proto == PROTO_IMAP) { int foundit = 0; BIO *fbio = BIO_new(BIO_f_buffer()); BIO_push(fbio, sbio); BIO_gets(fbio, mbuf, BUFSIZZ); /* STARTTLS command requires CAPABILITY... */ BIO_printf(fbio, ". CAPABILITY\r\n"); (void)BIO_flush(fbio); /* wait for multi-line CAPABILITY response */ do { mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ); if (strstr(mbuf, "STARTTLS")) foundit = 1; } while (mbuf_len > 3 && mbuf[0] != '.'); (void)BIO_flush(fbio); BIO_pop(fbio); BIO_free(fbio); if (!foundit) BIO_printf(bio_err, "didn't found STARTTLS in server response," " try anyway...\n"); BIO_printf(sbio, ". STARTTLS\r\n"); BIO_read(sbio, sbuf, BUFSIZZ); } else if (starttls_proto == PROTO_FTP) { BIO *fbio = BIO_new(BIO_f_buffer()); BIO_push(fbio, sbio); /* wait for multi-line response to end from FTP */ do { mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ); } while (mbuf_len > 3 && mbuf[3] == '-'); (void)BIO_flush(fbio); BIO_pop(fbio); BIO_free(fbio); BIO_printf(sbio, "AUTH TLS\r\n"); BIO_read(sbio, sbuf, BUFSIZZ); } if (starttls_proto == PROTO_XMPP) { int seen = 0; BIO_printf(sbio, "", host); seen = BIO_read(sbio, mbuf, BUFSIZZ); mbuf[seen] = 0; while (!strstr (mbuf, "")) goto shut; seen = BIO_read(sbio, mbuf, BUFSIZZ); if (seen <= 0) goto shut; mbuf[seen] = 0; } BIO_printf(sbio, ""); seen = BIO_read(sbio, sbuf, BUFSIZZ); sbuf[seen] = 0; if (!strstr(sbuf, " 0) full_log--; if (starttls_proto) { BIO_printf(bio_err, "%s", mbuf); /* We don't need to know any more */ starttls_proto = PROTO_OFF; } if (reconnect) { reconnect--; BIO_printf(bio_c_out, "drop connection and then reconnect\n"); SSL_shutdown(con); SSL_set_connect_state(con); SHUTDOWN(SSL_get_fd(con)); goto re_start; } } } ssl_pending = read_ssl && SSL_pending(con); if (!ssl_pending) { #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5) if (tty_on) { if (read_tty) openssl_fdset(fileno_stdin(), &readfds); #if !defined(OPENSSL_SYS_VMS) if (write_tty) openssl_fdset(fileno_stdout(), &writefds); #endif } if (read_ssl) openssl_fdset(SSL_get_fd(con), &readfds); if (write_ssl) openssl_fdset(SSL_get_fd(con), &writefds); #else if (!tty_on || !write_tty) { if (read_ssl) openssl_fdset(SSL_get_fd(con), &readfds); if (write_ssl) openssl_fdset(SSL_get_fd(con), &writefds); } #endif /*- printf("mode tty(%d %d%d) ssl(%d%d)\n", tty_on,read_tty,write_tty,read_ssl,write_ssl);*/ /* * Note: under VMS with SOCKETSHR the second parameter is * currently of type (int *) whereas under other systems it is * (void *) if you don't have a cast it will choke the compiler: * if you do have a cast then you can either go for (int *) or * (void *). */ #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) /* * Under Windows/DOS we make the assumption that we can always * write to the tty: therefore if we need to write to the tty we * just fall through. Otherwise we timeout the select every * second and see if there are any keypresses. Note: this is a * hack, in a proper Windows application we wouldn't do this. */ i = 0; if (!write_tty) { if (read_tty) { tv.tv_sec = 1; tv.tv_usec = 0; i = select(width, (void *)&readfds, (void *)&writefds, NULL, &tv); # if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS) if (!i && (!_kbhit() || !read_tty)) continue; # else if (!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle (STD_INPUT_HANDLE), 0))) || !read_tty)) continue; # endif } else i = select(width, (void *)&readfds, (void *)&writefds, NULL, timeoutp); } #elif defined(OPENSSL_SYS_NETWARE) if (!write_tty) { if (read_tty) { tv.tv_sec = 1; tv.tv_usec = 0; i = select(width, (void *)&readfds, (void *)&writefds, NULL, &tv); } else i = select(width, (void *)&readfds, (void *)&writefds, NULL, timeoutp); } #elif defined(OPENSSL_SYS_BEOS_R5) /* Under BeOS-R5 the situation is similar to DOS */ i = 0; stdin_set = 0; (void)fcntl(fileno_stdin(), F_SETFL, O_NONBLOCK); if (!write_tty) { if (read_tty) { tv.tv_sec = 1; tv.tv_usec = 0; i = select(width, (void *)&readfds, (void *)&writefds, NULL, &tv); if (read(fileno_stdin(), sbuf, 0) >= 0) stdin_set = 1; if (!i && (stdin_set != 1 || !read_tty)) continue; } else i = select(width, (void *)&readfds, (void *)&writefds, NULL, timeoutp); } (void)fcntl(fileno_stdin(), F_SETFL, 0); #else i = select(width, (void *)&readfds, (void *)&writefds, NULL, timeoutp); #endif if (i < 0) { BIO_printf(bio_err, "bad select %d\n", get_last_socket_error()); goto shut; /* goto end; */ } } if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0) { BIO_printf(bio_err, "TIMEOUT occured\n"); } if (!ssl_pending && FD_ISSET(SSL_get_fd(con), &writefds)) { k = SSL_write(con, &(cbuf[cbuf_off]), (unsigned int)cbuf_len); switch (SSL_get_error(con, k)) { case SSL_ERROR_NONE: cbuf_off += k; cbuf_len -= k; if (k <= 0) goto end; /* we have done a write(con,NULL,0); */ if (cbuf_len <= 0) { read_tty = 1; write_ssl = 0; } else { /* if (cbuf_len > 0) */ read_tty = 0; write_ssl = 1; } break; case SSL_ERROR_WANT_WRITE: BIO_printf(bio_c_out, "write W BLOCK\n"); write_ssl = 1; read_tty = 0; break; case SSL_ERROR_WANT_READ: BIO_printf(bio_c_out, "write R BLOCK\n"); write_tty = 0; read_ssl = 1; write_ssl = 0; break; case SSL_ERROR_WANT_X509_LOOKUP: BIO_printf(bio_c_out, "write X BLOCK\n"); break; case SSL_ERROR_ZERO_RETURN: if (cbuf_len != 0) { BIO_printf(bio_c_out, "shutdown\n"); ret = 0; goto shut; } else { read_tty = 1; write_ssl = 0; break; } case SSL_ERROR_SYSCALL: if ((k != 0) || (cbuf_len != 0)) { BIO_printf(bio_err, "write:errno=%d\n", get_last_socket_error()); goto shut; } else { read_tty = 1; write_ssl = 0; } break; case SSL_ERROR_SSL: ERR_print_errors(bio_err); goto shut; } } #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5) || defined(OPENSSL_SYS_VMS) /* Assume Windows/DOS/BeOS can always write */ else if (!ssl_pending && write_tty) #else else if (!ssl_pending && FD_ISSET(fileno_stdout(), &writefds)) #endif { #ifdef CHARSET_EBCDIC ascii2ebcdic(&(sbuf[sbuf_off]), &(sbuf[sbuf_off]), sbuf_len); #endif i = raw_write_stdout(&(sbuf[sbuf_off]), sbuf_len); if (i <= 0) { BIO_printf(bio_c_out, "DONE\n"); ret = 0; goto shut; /* goto end; */ } sbuf_len -= i;; sbuf_off += i; if (sbuf_len <= 0) { read_ssl = 1; write_tty = 0; } } else if (ssl_pending || FD_ISSET(SSL_get_fd(con), &readfds)) { #ifdef RENEG { static int iiii; if (++iiii == 52) { SSL_renegotiate(con); iiii = 0; } } #endif #if 1 k = SSL_read(con, sbuf, 1024 /* BUFSIZZ */ ); #else /* Demo for pending and peek :-) */ k = SSL_read(con, sbuf, 16); { char zbuf[10240]; printf("read=%d pending=%d peek=%d\n", k, SSL_pending(con), SSL_peek(con, zbuf, 10240)); } #endif switch (SSL_get_error(con, k)) { case SSL_ERROR_NONE: if (k <= 0) goto end; sbuf_off = 0; sbuf_len = k; read_ssl = 0; write_tty = 1; break; case SSL_ERROR_WANT_WRITE: BIO_printf(bio_c_out, "read W BLOCK\n"); write_ssl = 1; read_tty = 0; break; case SSL_ERROR_WANT_READ: BIO_printf(bio_c_out, "read R BLOCK\n"); write_tty = 0; read_ssl = 1; if ((read_tty == 0) && (write_ssl == 0)) write_ssl = 1; break; case SSL_ERROR_WANT_X509_LOOKUP: BIO_printf(bio_c_out, "read X BLOCK\n"); break; case SSL_ERROR_SYSCALL: ret = get_last_socket_error(); if (c_brief) BIO_puts(bio_err, "CONNECTION CLOSED BY SERVER\n"); else BIO_printf(bio_err, "read:errno=%d\n", ret); goto shut; case SSL_ERROR_ZERO_RETURN: BIO_printf(bio_c_out, "closed\n"); ret = 0; goto shut; case SSL_ERROR_SSL: ERR_print_errors(bio_err); goto shut; /* break; */ } } #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) # if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS) else if (_kbhit()) # else else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) # endif #elif defined (OPENSSL_SYS_NETWARE) else if (_kbhit()) #elif defined(OPENSSL_SYS_BEOS_R5) else if (stdin_set) #else else if (FD_ISSET(fileno_stdin(), &readfds)) #endif { if (crlf) { int j, lf_num; i = raw_read_stdin(cbuf, BUFSIZZ / 2); lf_num = 0; /* both loops are skipped when i <= 0 */ for (j = 0; j < i; j++) if (cbuf[j] == '\n') lf_num++; for (j = i - 1; j >= 0; j--) { cbuf[j + lf_num] = cbuf[j]; if (cbuf[j] == '\n') { lf_num--; i++; cbuf[j + lf_num] = '\r'; } } assert(lf_num == 0); } else i = raw_read_stdin(cbuf, BUFSIZZ); if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) { BIO_printf(bio_err, "DONE\n"); ret = 0; goto shut; } if ((!c_ign_eof) && (cbuf[0] == 'R')) { BIO_printf(bio_err, "RENEGOTIATING\n"); SSL_renegotiate(con); cbuf_len = 0; } #ifndef OPENSSL_NO_HEARTBEATS else if ((!c_ign_eof) && (cbuf[0] == 'B')) { BIO_printf(bio_err, "HEARTBEATING\n"); SSL_heartbeat(con); cbuf_len = 0; } #endif else { cbuf_len = i; cbuf_off = 0; #ifdef CHARSET_EBCDIC ebcdic2ascii(cbuf, cbuf, i); #endif } write_ssl = 1; read_tty = 0; } } ret = 0; shut: if (in_init) print_stuff(bio_c_out, con, full_log); SSL_shutdown(con); SHUTDOWN(SSL_get_fd(con)); end: if (con != NULL) { if (prexit != 0) print_stuff(bio_c_out, con, 1); SSL_free(con); } #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) if (next_proto.data) OPENSSL_free(next_proto.data); #endif if (ctx != NULL) SSL_CTX_free(ctx); if (cert) X509_free(cert); if (crls) sk_X509_CRL_pop_free(crls, X509_CRL_free); if (key) EVP_PKEY_free(key); if (chain) sk_X509_pop_free(chain, X509_free); if (pass) OPENSSL_free(pass); #ifndef OPENSSL_NO_SRP OPENSSL_free(srp_arg.srppassin); #endif if (vpm) X509_VERIFY_PARAM_free(vpm); ssl_excert_free(exc); if (ssl_args) sk_OPENSSL_STRING_free(ssl_args); if (cctx) SSL_CONF_CTX_free(cctx); #ifndef OPENSSL_NO_JPAKE if (jpake_secret && psk_key) OPENSSL_free(psk_key); #endif if (cbuf != NULL) { OPENSSL_cleanse(cbuf, BUFSIZZ); OPENSSL_free(cbuf); } if (sbuf != NULL) { OPENSSL_cleanse(sbuf, BUFSIZZ); OPENSSL_free(sbuf); } if (mbuf != NULL) { OPENSSL_cleanse(mbuf, BUFSIZZ); OPENSSL_free(mbuf); } release_engine(e); if (bio_c_out != NULL) { BIO_free(bio_c_out); bio_c_out = NULL; } if (bio_c_msg != NULL) { BIO_free(bio_c_msg); bio_c_msg = NULL; } SSL_COMP_free_compression_methods(); apps_shutdown(); OPENSSL_EXIT(ret); } static void print_stuff(BIO *bio, SSL *s, int full) { X509 *peer = NULL; char *p; static const char *space = " "; char buf[BUFSIZ]; STACK_OF(X509) *sk; STACK_OF(X509_NAME) *sk2; const SSL_CIPHER *c; X509_NAME *xn; int j, i; #ifndef OPENSSL_NO_COMP const COMP_METHOD *comp, *expansion; #endif unsigned char *exportedkeymat; if (full) { int got_a_chain = 0; sk = SSL_get_peer_cert_chain(s); if (sk != NULL) { got_a_chain = 1; /* we don't have it for SSL2 (yet) */ BIO_printf(bio, "---\nCertificate chain\n"); for (i = 0; i < sk_X509_num(sk); i++) { X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)), buf, sizeof buf); BIO_printf(bio, "%2d s:%s\n", i, buf); X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk, i)), buf, sizeof buf); BIO_printf(bio, " i:%s\n", buf); if (c_showcerts) PEM_write_bio_X509(bio, sk_X509_value(sk, i)); } } BIO_printf(bio, "---\n"); peer = SSL_get_peer_certificate(s); if (peer != NULL) { BIO_printf(bio, "Server certificate\n"); /* Redundant if we showed the whole chain */ if (!(c_showcerts && got_a_chain)) PEM_write_bio_X509(bio, peer); X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf); BIO_printf(bio, "subject=%s\n", buf); X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf); BIO_printf(bio, "issuer=%s\n", buf); } else BIO_printf(bio, "no peer certificate available\n"); sk2 = SSL_get_client_CA_list(s); if ((sk2 != NULL) && (sk_X509_NAME_num(sk2) > 0)) { BIO_printf(bio, "---\nAcceptable client certificate CA names\n"); for (i = 0; i < sk_X509_NAME_num(sk2); i++) { xn = sk_X509_NAME_value(sk2, i); X509_NAME_oneline(xn, buf, sizeof(buf)); BIO_write(bio, buf, strlen(buf)); BIO_write(bio, "\n", 1); } } else { BIO_printf(bio, "---\nNo client certificate CA names sent\n"); } p = SSL_get_shared_ciphers(s, buf, sizeof buf); if (p != NULL) { /* * This works only for SSL 2. In later protocol versions, the * client does not know what other ciphers (in addition to the * one to be used in the current connection) the server supports. */ BIO_printf(bio, "---\nCiphers common between both SSL endpoints:\n"); j = i = 0; while (*p) { if (*p == ':') { BIO_write(bio, space, 15 - j % 25); i++; j = 0; BIO_write(bio, ((i % 3) ? " " : "\n"), 1); } else { BIO_write(bio, p, 1); j++; } p++; } BIO_write(bio, "\n", 1); } ssl_print_sigalgs(bio, s); ssl_print_tmp_key(bio, s); BIO_printf(bio, "---\nSSL handshake has read %ld bytes and written %ld bytes\n", BIO_number_read(SSL_get_rbio(s)), BIO_number_written(SSL_get_wbio(s))); } BIO_printf(bio, (SSL_cache_hit(s) ? "---\nReused, " : "---\nNew, ")); c = SSL_get_current_cipher(s); BIO_printf(bio, "%s, Cipher is %s\n", SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c)); if (peer != NULL) { EVP_PKEY *pktmp; pktmp = X509_get_pubkey(peer); BIO_printf(bio, "Server public key is %d bit\n", EVP_PKEY_bits(pktmp)); EVP_PKEY_free(pktmp); } BIO_printf(bio, "Secure Renegotiation IS%s supported\n", SSL_get_secure_renegotiation_support(s) ? "" : " NOT"); #ifndef OPENSSL_NO_COMP comp = SSL_get_current_compression(s); expansion = SSL_get_current_expansion(s); BIO_printf(bio, "Compression: %s\n", comp ? SSL_COMP_get_name(comp) : "NONE"); BIO_printf(bio, "Expansion: %s\n", expansion ? SSL_COMP_get_name(expansion) : "NONE"); #endif #ifdef SSL_DEBUG { /* Print out local port of connection: useful for debugging */ int sock; struct sockaddr_in ladd; socklen_t ladd_size = sizeof(ladd); sock = SSL_get_fd(s); getsockname(sock, (struct sockaddr *)&ladd, &ladd_size); BIO_printf(bio_c_out, "LOCAL PORT is %u\n", ntohs(ladd.sin_port)); } #endif #if !defined(OPENSSL_NO_TLSEXT) # if !defined(OPENSSL_NO_NEXTPROTONEG) if (next_proto.status != -1) { const unsigned char *proto; unsigned int proto_len; SSL_get0_next_proto_negotiated(s, &proto, &proto_len); BIO_printf(bio, "Next protocol: (%d) ", next_proto.status); BIO_write(bio, proto, proto_len); BIO_write(bio, "\n", 1); } # endif { const unsigned char *proto; unsigned int proto_len; SSL_get0_alpn_selected(s, &proto, &proto_len); if (proto_len > 0) { BIO_printf(bio, "ALPN protocol: "); BIO_write(bio, proto, proto_len); BIO_write(bio, "\n", 1); } else BIO_printf(bio, "No ALPN negotiated\n"); } #endif #ifndef OPENSSL_NO_SRTP { SRTP_PROTECTION_PROFILE *srtp_profile = SSL_get_selected_srtp_profile(s); if (srtp_profile) BIO_printf(bio, "SRTP Extension negotiated, profile=%s\n", srtp_profile->name); } #endif SSL_SESSION_print(bio, SSL_get_session(s)); if (keymatexportlabel != NULL) { BIO_printf(bio, "Keying material exporter:\n"); BIO_printf(bio, " Label: '%s'\n", keymatexportlabel); BIO_printf(bio, " Length: %i bytes\n", keymatexportlen); exportedkeymat = OPENSSL_malloc(keymatexportlen); if (exportedkeymat != NULL) { if (!SSL_export_keying_material(s, exportedkeymat, keymatexportlen, keymatexportlabel, strlen(keymatexportlabel), NULL, 0, 0)) { BIO_printf(bio, " Error\n"); } else { BIO_printf(bio, " Keying material: "); for (i = 0; i < keymatexportlen; i++) BIO_printf(bio, "%02X", exportedkeymat[i]); BIO_printf(bio, "\n"); } OPENSSL_free(exportedkeymat); } } BIO_printf(bio, "---\n"); if (peer != NULL) X509_free(peer); /* flush, or debugging output gets mixed with http response */ (void)BIO_flush(bio); } #ifndef OPENSSL_NO_TLSEXT static int ocsp_resp_cb(SSL *s, void *arg) { const unsigned char *p; int len; OCSP_RESPONSE *rsp; len = SSL_get_tlsext_status_ocsp_resp(s, &p); BIO_puts(arg, "OCSP response: "); if (!p) { BIO_puts(arg, "no response sent\n"); return 1; } rsp = d2i_OCSP_RESPONSE(NULL, &p, len); if (!rsp) { BIO_puts(arg, "response parse error\n"); BIO_dump_indent(arg, (char *)p, len, 4); return 0; } BIO_puts(arg, "\n======================================\n"); OCSP_RESPONSE_print(arg, rsp, 0); BIO_puts(arg, "======================================\n"); OCSP_RESPONSE_free(rsp); return 1; } #endif diff --git a/apps/speed.c b/apps/speed.c index 5259c16f1218..5383678b9864 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1,2880 +1,2880 @@ /* apps/speed.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the OpenSSL open source * license provided above. * * The ECDH and ECDSA speed test software is originally written by * Sumit Gupta of Sun Microsystems Laboratories. * */ /* most of this code has been pilfered from my libdes speed.c program */ #ifndef OPENSSL_NO_SPEED # undef SECONDS # define SECONDS 3 # define RSA_SECONDS 10 # define DSA_SECONDS 10 # define ECDSA_SECONDS 10 # define ECDH_SECONDS 10 /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ # undef PROG # define PROG speed_main # include # include # include # include # include "apps.h" # ifdef OPENSSL_NO_STDIO # define APPS_WIN16 # endif # include # include # include # include # include # if !defined(OPENSSL_SYS_MSDOS) # include OPENSSL_UNISTD # endif # ifndef OPENSSL_SYS_NETWARE # include # endif # if defined(_WIN32) || defined(__CYGWIN__) # include # if defined(__CYGWIN__) && !defined(_WIN32) /* * should define _WIN32, which normally is mutually exclusive * with __CYGWIN__, but if it didn't... */ # define _WIN32 /* this is done because Cygwin alarm() fails sometimes. */ # endif # endif # include # ifndef OPENSSL_NO_DES # include # endif # ifndef OPENSSL_NO_AES # include # endif # ifndef OPENSSL_NO_CAMELLIA # include # endif # ifndef OPENSSL_NO_MD2 # include # endif # ifndef OPENSSL_NO_MDC2 # include # endif # ifndef OPENSSL_NO_MD4 # include # endif # ifndef OPENSSL_NO_MD5 # include # endif # ifndef OPENSSL_NO_HMAC # include # endif # include # ifndef OPENSSL_NO_SHA # include # endif # ifndef OPENSSL_NO_RIPEMD # include # endif # ifndef OPENSSL_NO_WHIRLPOOL # include # endif # ifndef OPENSSL_NO_RC4 # include # endif # ifndef OPENSSL_NO_RC5 # include # endif # ifndef OPENSSL_NO_RC2 # include # endif # ifndef OPENSSL_NO_IDEA # include # endif # ifndef OPENSSL_NO_SEED # include # endif # ifndef OPENSSL_NO_BF # include # endif # ifndef OPENSSL_NO_CAST # include # endif # ifndef OPENSSL_NO_RSA # include # include "./testrsa.h" # endif # include # ifndef OPENSSL_NO_DSA # include # include "./testdsa.h" # endif # ifndef OPENSSL_NO_ECDSA # include # endif # ifndef OPENSSL_NO_ECDH # include # endif # include # ifdef OPENSSL_FIPS # ifdef OPENSSL_DOING_MAKEDEPEND # undef AES_set_encrypt_key # undef AES_set_decrypt_key # undef DES_set_key_unchecked # endif # define BF_set_key private_BF_set_key # define CAST_set_key private_CAST_set_key # define idea_set_encrypt_key private_idea_set_encrypt_key # define SEED_set_key private_SEED_set_key # define RC2_set_key private_RC2_set_key # define RC4_set_key private_RC4_set_key # define DES_set_key_unchecked private_DES_set_key_unchecked # define AES_set_encrypt_key private_AES_set_encrypt_key # define AES_set_decrypt_key private_AES_set_decrypt_key # define Camellia_set_key private_Camellia_set_key # endif # ifndef HAVE_FORK # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE) # define HAVE_FORK 0 # else # define HAVE_FORK 1 # endif # endif # if HAVE_FORK # undef NO_FORK # else # define NO_FORK # endif # undef BUFSIZE # define BUFSIZE ((long)1024*8+1) static volatile int run = 0; static int mr = 0; static int usertime = 1; static double Time_F(int s); static void print_message(const char *s, long num, int length); static void pkey_print_message(const char *str, const char *str2, long num, int bits, int sec); static void print_result(int alg, int run_no, int count, double time_used); # ifndef NO_FORK static int do_multi(int multi); # endif # define ALGOR_NUM 30 # define SIZE_NUM 5 # define RSA_NUM 4 # define DSA_NUM 3 # define EC_NUM 16 # define MAX_ECDH_SIZE 256 static const char *names[ALGOR_NUM] = { "md2", "mdc2", "md4", "md5", "hmac(md5)", "sha1", "rmd160", "rc4", "des cbc", "des ede3", "idea cbc", "seed cbc", "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc", "evp", "sha256", "sha512", "whirlpool", "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash" }; static double results[ALGOR_NUM][SIZE_NUM]; static int lengths[SIZE_NUM] = { 16, 64, 256, 1024, 8 * 1024 }; # ifndef OPENSSL_NO_RSA static double rsa_results[RSA_NUM][2]; # endif # ifndef OPENSSL_NO_DSA static double dsa_results[DSA_NUM][2]; # endif # ifndef OPENSSL_NO_ECDSA static double ecdsa_results[EC_NUM][2]; # endif # ifndef OPENSSL_NO_ECDH static double ecdh_results[EC_NUM][1]; # endif # if defined(OPENSSL_NO_DSA) && !(defined(OPENSSL_NO_ECDSA) && defined(OPENSSL_NO_ECDH)) static const char rnd_seed[] = "string to make the random number generator think it has entropy"; static int rnd_fake = 0; # endif # ifdef SIGALRM # if defined(__STDC__) || defined(sgi) || defined(_AIX) # define SIGRETTYPE void # else # define SIGRETTYPE int # endif static SIGRETTYPE sig_done(int sig); static SIGRETTYPE sig_done(int sig) { signal(SIGALRM, sig_done); run = 0; # ifdef LINT sig = sig; # endif } # endif # define START 0 # define STOP 1 # if defined(_WIN32) # if !defined(SIGALRM) # define SIGALRM # endif static volatile unsigned int lapse; static volatile unsigned int schlock; static void alarm_win32(unsigned int secs) { lapse = secs * 1000; } # define alarm alarm_win32 static DWORD WINAPI sleepy(VOID * arg) { schlock = 1; Sleep(lapse); run = 0; return 0; } static double Time_F(int s) { if (s == START) { HANDLE thr; schlock = 0; thr = CreateThread(NULL, 4096, sleepy, NULL, 0, NULL); if (thr == NULL) { DWORD ret = GetLastError(); BIO_printf(bio_err, "unable to CreateThread (%d)", ret); ExitProcess(ret); } CloseHandle(thr); /* detach the thread */ while (!schlock) Sleep(0); /* scheduler spinlock */ } return app_tminterval(s, usertime); } # else static double Time_F(int s) { return app_tminterval(s, usertime); } # endif # ifndef OPENSSL_NO_ECDH static const int KDF1_SHA1_len = 20; static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) { # ifndef OPENSSL_NO_SHA if (*outlen < SHA_DIGEST_LENGTH) return NULL; else *outlen = SHA_DIGEST_LENGTH; return SHA1(in, inlen, out); # else return NULL; # endif /* OPENSSL_NO_SHA */ } # endif /* OPENSSL_NO_ECDH */ static void multiblock_speed(const EVP_CIPHER *evp_cipher); int MAIN(int, char **); int MAIN(int argc, char **argv) { ENGINE *e = NULL; unsigned char *buf = NULL, *buf2 = NULL; int mret = 1; long count = 0, save_count = 0; int i, j, k; # if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) long rsa_count; # endif # ifndef OPENSSL_NO_RSA unsigned rsa_num; # endif unsigned char md[EVP_MAX_MD_SIZE]; # ifndef OPENSSL_NO_MD2 unsigned char md2[MD2_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_MDC2 unsigned char mdc2[MDC2_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_MD4 unsigned char md4[MD4_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_MD5 unsigned char md5[MD5_DIGEST_LENGTH]; unsigned char hmac[MD5_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_SHA unsigned char sha[SHA_DIGEST_LENGTH]; # ifndef OPENSSL_NO_SHA256 unsigned char sha256[SHA256_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_SHA512 unsigned char sha512[SHA512_DIGEST_LENGTH]; # endif # endif # ifndef OPENSSL_NO_WHIRLPOOL unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_RIPEMD unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; # endif # ifndef OPENSSL_NO_RC4 RC4_KEY rc4_ks; # endif # ifndef OPENSSL_NO_RC5 RC5_32_KEY rc5_ks; # endif # ifndef OPENSSL_NO_RC2 RC2_KEY rc2_ks; # endif # ifndef OPENSSL_NO_IDEA IDEA_KEY_SCHEDULE idea_ks; # endif # ifndef OPENSSL_NO_SEED SEED_KEY_SCHEDULE seed_ks; # endif # ifndef OPENSSL_NO_BF BF_KEY bf_ks; # endif # ifndef OPENSSL_NO_CAST CAST_KEY cast_ks; # endif static const unsigned char key16[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; # ifndef OPENSSL_NO_AES static const unsigned char key24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char key32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; # endif # ifndef OPENSSL_NO_CAMELLIA static const unsigned char ckey24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char ckey32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; # endif # ifndef OPENSSL_NO_AES # define MAX_BLOCK_SIZE 128 # else # define MAX_BLOCK_SIZE 64 # endif unsigned char DES_iv[8]; unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; # ifndef OPENSSL_NO_DES static DES_cblock key = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; static DES_cblock key2 = { 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; static DES_cblock key3 = { 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; DES_key_schedule sch; DES_key_schedule sch2; DES_key_schedule sch3; # endif # ifndef OPENSSL_NO_AES AES_KEY aes_ks1, aes_ks2, aes_ks3; # endif # ifndef OPENSSL_NO_CAMELLIA CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; # endif # define D_MD2 0 # define D_MDC2 1 # define D_MD4 2 # define D_MD5 3 # define D_HMAC 4 # define D_SHA1 5 # define D_RMD160 6 # define D_RC4 7 # define D_CBC_DES 8 # define D_EDE3_DES 9 # define D_CBC_IDEA 10 # define D_CBC_SEED 11 # define D_CBC_RC2 12 # define D_CBC_RC5 13 # define D_CBC_BF 14 # define D_CBC_CAST 15 # define D_CBC_128_AES 16 # define D_CBC_192_AES 17 # define D_CBC_256_AES 18 # define D_CBC_128_CML 19 # define D_CBC_192_CML 20 # define D_CBC_256_CML 21 # define D_EVP 22 # define D_SHA256 23 # define D_SHA512 24 # define D_WHIRLPOOL 25 # define D_IGE_128_AES 26 # define D_IGE_192_AES 27 # define D_IGE_256_AES 28 # define D_GHASH 29 double d = 0.0; long c[ALGOR_NUM][SIZE_NUM]; # define R_DSA_512 0 # define R_DSA_1024 1 # define R_DSA_2048 2 # define R_RSA_512 0 # define R_RSA_1024 1 # define R_RSA_2048 2 # define R_RSA_4096 3 # define R_EC_P160 0 # define R_EC_P192 1 # define R_EC_P224 2 # define R_EC_P256 3 # define R_EC_P384 4 # define R_EC_P521 5 # define R_EC_K163 6 # define R_EC_K233 7 # define R_EC_K283 8 # define R_EC_K409 9 # define R_EC_K571 10 # define R_EC_B163 11 # define R_EC_B233 12 # define R_EC_B283 13 # define R_EC_B409 14 # define R_EC_B571 15 # ifndef OPENSSL_NO_RSA RSA *rsa_key[RSA_NUM]; long rsa_c[RSA_NUM][2]; static unsigned int rsa_bits[RSA_NUM] = { 512, 1024, 2048, 4096 }; static unsigned char *rsa_data[RSA_NUM] = { test512, test1024, test2048, test4096 }; static int rsa_data_length[RSA_NUM] = { sizeof(test512), sizeof(test1024), sizeof(test2048), sizeof(test4096) }; # endif # ifndef OPENSSL_NO_DSA DSA *dsa_key[DSA_NUM]; long dsa_c[DSA_NUM][2]; static unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 }; # endif # ifndef OPENSSL_NO_EC /* * We only test over the following curves as they are representative, To * add tests over more curves, simply add the curve NID and curve name to * the following arrays and increase the EC_NUM value accordingly. */ static unsigned int test_curves[EC_NUM] = { /* Prime Curves */ NID_secp160r1, NID_X9_62_prime192v1, NID_secp224r1, NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, /* Binary Curves */ NID_sect163k1, NID_sect233k1, NID_sect283k1, NID_sect409k1, NID_sect571k1, NID_sect163r2, NID_sect233r1, NID_sect283r1, NID_sect409r1, NID_sect571r1 }; static const char *test_curves_names[EC_NUM] = { /* Prime Curves */ "secp160r1", "nistp192", "nistp224", "nistp256", "nistp384", "nistp521", /* Binary Curves */ "nistk163", "nistk233", "nistk283", "nistk409", "nistk571", "nistb163", "nistb233", "nistb283", "nistb409", "nistb571" }; static int test_curves_bits[EC_NUM] = { 160, 192, 224, 256, 384, 521, 163, 233, 283, 409, 571, 163, 233, 283, 409, 571 }; # endif # ifndef OPENSSL_NO_ECDSA unsigned char ecdsasig[256]; unsigned int ecdsasiglen; EC_KEY *ecdsa[EC_NUM]; long ecdsa_c[EC_NUM][2]; # endif # ifndef OPENSSL_NO_ECDH EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; int secret_size_a, secret_size_b; int ecdh_checks = 0; int secret_idx = 0; long ecdh_c[EC_NUM][2]; # endif int rsa_doit[RSA_NUM]; int dsa_doit[DSA_NUM]; # ifndef OPENSSL_NO_ECDSA int ecdsa_doit[EC_NUM]; # endif # ifndef OPENSSL_NO_ECDH int ecdh_doit[EC_NUM]; # endif int doit[ALGOR_NUM]; int pr_header = 0; const EVP_CIPHER *evp_cipher = NULL; const EVP_MD *evp_md = NULL; int decrypt = 0; # ifndef NO_FORK int multi = 0; # endif int multiblock = 0; # ifndef TIMES usertime = -1; # endif apps_startup(); memset(results, 0, sizeof(results)); # ifndef OPENSSL_NO_DSA memset(dsa_key, 0, sizeof(dsa_key)); # endif # ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa[i] = NULL; # endif # ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) { ecdh_a[i] = NULL; ecdh_b[i] = NULL; } # endif # ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) rsa_key[i] = NULL; # endif if (bio_err == NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT); if (!load_config(bio_err, NULL)) goto end; if ((buf = (unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } if ((buf2 = (unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } memset(c, 0, sizeof(c)); memset(DES_iv, 0, sizeof(DES_iv)); memset(iv, 0, sizeof(iv)); for (i = 0; i < ALGOR_NUM; i++) doit[i] = 0; for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 0; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 0; # ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 0; # endif # ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 0; # endif j = 0; argc--; argv++; while (argc) { if ((argc > 0) && (strcmp(*argv, "-elapsed") == 0)) { usertime = 0; j--; /* Otherwise, -elapsed gets confused with an * algorithm. */ } else if ((argc > 0) && (strcmp(*argv, "-evp") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no EVP given\n"); goto end; } evp_md = NULL; evp_cipher = EVP_get_cipherbyname(*argv); if (!evp_cipher) { evp_md = EVP_get_digestbyname(*argv); } if (!evp_cipher && !evp_md) { BIO_printf(bio_err, "%s is an unknown cipher or digest\n", *argv); goto end; } doit[D_EVP] = 1; } else if (argc > 0 && !strcmp(*argv, "-decrypt")) { decrypt = 1; j--; /* Otherwise, -elapsed gets confused with an * algorithm. */ } # ifndef OPENSSL_NO_ENGINE else if ((argc > 0) && (strcmp(*argv, "-engine") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no engine given\n"); goto end; } e = setup_engine(bio_err, *argv, 0); /* * j will be increased again further down. We just don't want * speed to confuse an engine with an algorithm, especially when * none is given (which means all of them should be run) */ j--; } # endif # ifndef NO_FORK else if ((argc > 0) && (strcmp(*argv, "-multi") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no multi count given\n"); goto end; } multi = atoi(argv[0]); if (multi <= 0) { BIO_printf(bio_err, "bad multi count\n"); goto end; } j--; /* Otherwise, -mr gets confused with an * algorithm. */ } # endif else if (argc > 0 && !strcmp(*argv, "-mr")) { mr = 1; j--; /* Otherwise, -mr gets confused with an * algorithm. */ } else if (argc > 0 && !strcmp(*argv, "-mb")) { multiblock = 1; j--; } else # ifndef OPENSSL_NO_MD2 if (strcmp(*argv, "md2") == 0) doit[D_MD2] = 1; else # endif # ifndef OPENSSL_NO_MDC2 if (strcmp(*argv, "mdc2") == 0) doit[D_MDC2] = 1; else # endif # ifndef OPENSSL_NO_MD4 if (strcmp(*argv, "md4") == 0) doit[D_MD4] = 1; else # endif # ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "md5") == 0) doit[D_MD5] = 1; else # endif # ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "hmac") == 0) doit[D_HMAC] = 1; else # endif # ifndef OPENSSL_NO_SHA if (strcmp(*argv, "sha1") == 0) doit[D_SHA1] = 1; else if (strcmp(*argv, "sha") == 0) doit[D_SHA1] = 1, doit[D_SHA256] = 1, doit[D_SHA512] = 1; else # ifndef OPENSSL_NO_SHA256 if (strcmp(*argv, "sha256") == 0) doit[D_SHA256] = 1; else # endif # ifndef OPENSSL_NO_SHA512 if (strcmp(*argv, "sha512") == 0) doit[D_SHA512] = 1; else # endif # endif # ifndef OPENSSL_NO_WHIRLPOOL if (strcmp(*argv, "whirlpool") == 0) doit[D_WHIRLPOOL] = 1; else # endif # ifndef OPENSSL_NO_RIPEMD if (strcmp(*argv, "ripemd") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "rmd160") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "ripemd160") == 0) doit[D_RMD160] = 1; else # endif # ifndef OPENSSL_NO_RC4 if (strcmp(*argv, "rc4") == 0) doit[D_RC4] = 1; else # endif # ifndef OPENSSL_NO_DES if (strcmp(*argv, "des-cbc") == 0) doit[D_CBC_DES] = 1; else if (strcmp(*argv, "des-ede3") == 0) doit[D_EDE3_DES] = 1; else # endif # ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes-128-cbc") == 0) doit[D_CBC_128_AES] = 1; else if (strcmp(*argv, "aes-192-cbc") == 0) doit[D_CBC_192_AES] = 1; else if (strcmp(*argv, "aes-256-cbc") == 0) doit[D_CBC_256_AES] = 1; else if (strcmp(*argv, "aes-128-ige") == 0) doit[D_IGE_128_AES] = 1; else if (strcmp(*argv, "aes-192-ige") == 0) doit[D_IGE_192_AES] = 1; else if (strcmp(*argv, "aes-256-ige") == 0) doit[D_IGE_256_AES] = 1; else # endif # ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia-128-cbc") == 0) doit[D_CBC_128_CML] = 1; else if (strcmp(*argv, "camellia-192-cbc") == 0) doit[D_CBC_192_CML] = 1; else if (strcmp(*argv, "camellia-256-cbc") == 0) doit[D_CBC_256_CML] = 1; else # endif # ifndef OPENSSL_NO_RSA # if 0 /* was: #ifdef RSAref */ if (strcmp(*argv, "rsaref") == 0) { RSA_set_default_openssl_method(RSA_PKCS1_RSAref()); j--; } else # endif # ifndef RSA_NULL if (strcmp(*argv, "openssl") == 0) { RSA_set_default_method(RSA_PKCS1_SSLeay()); j--; } else # endif # endif /* !OPENSSL_NO_RSA */ if (strcmp(*argv, "dsa512") == 0) dsa_doit[R_DSA_512] = 2; else if (strcmp(*argv, "dsa1024") == 0) dsa_doit[R_DSA_1024] = 2; else if (strcmp(*argv, "dsa2048") == 0) dsa_doit[R_DSA_2048] = 2; else if (strcmp(*argv, "rsa512") == 0) rsa_doit[R_RSA_512] = 2; else if (strcmp(*argv, "rsa1024") == 0) rsa_doit[R_RSA_1024] = 2; else if (strcmp(*argv, "rsa2048") == 0) rsa_doit[R_RSA_2048] = 2; else if (strcmp(*argv, "rsa4096") == 0) rsa_doit[R_RSA_4096] = 2; else # ifndef OPENSSL_NO_RC2 if (strcmp(*argv, "rc2-cbc") == 0) doit[D_CBC_RC2] = 1; else if (strcmp(*argv, "rc2") == 0) doit[D_CBC_RC2] = 1; else # endif # ifndef OPENSSL_NO_RC5 if (strcmp(*argv, "rc5-cbc") == 0) doit[D_CBC_RC5] = 1; else if (strcmp(*argv, "rc5") == 0) doit[D_CBC_RC5] = 1; else # endif # ifndef OPENSSL_NO_IDEA if (strcmp(*argv, "idea-cbc") == 0) doit[D_CBC_IDEA] = 1; else if (strcmp(*argv, "idea") == 0) doit[D_CBC_IDEA] = 1; else # endif # ifndef OPENSSL_NO_SEED if (strcmp(*argv, "seed-cbc") == 0) doit[D_CBC_SEED] = 1; else if (strcmp(*argv, "seed") == 0) doit[D_CBC_SEED] = 1; else # endif # ifndef OPENSSL_NO_BF if (strcmp(*argv, "bf-cbc") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "blowfish") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "bf") == 0) doit[D_CBC_BF] = 1; else # endif # ifndef OPENSSL_NO_CAST if (strcmp(*argv, "cast-cbc") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast5") == 0) doit[D_CBC_CAST] = 1; else # endif # ifndef OPENSSL_NO_DES if (strcmp(*argv, "des") == 0) { doit[D_CBC_DES] = 1; doit[D_EDE3_DES] = 1; } else # endif # ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes") == 0) { doit[D_CBC_128_AES] = 1; doit[D_CBC_192_AES] = 1; doit[D_CBC_256_AES] = 1; } else if (strcmp(*argv, "ghash") == 0) { doit[D_GHASH] = 1; } else # endif # ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia") == 0) { doit[D_CBC_128_CML] = 1; doit[D_CBC_192_CML] = 1; doit[D_CBC_256_CML] = 1; } else # endif # ifndef OPENSSL_NO_RSA if (strcmp(*argv, "rsa") == 0) { rsa_doit[R_RSA_512] = 1; rsa_doit[R_RSA_1024] = 1; rsa_doit[R_RSA_2048] = 1; rsa_doit[R_RSA_4096] = 1; } else # endif # ifndef OPENSSL_NO_DSA if (strcmp(*argv, "dsa") == 0) { dsa_doit[R_DSA_512] = 1; dsa_doit[R_DSA_1024] = 1; dsa_doit[R_DSA_2048] = 1; } else # endif # ifndef OPENSSL_NO_ECDSA if (strcmp(*argv, "ecdsap160") == 0) ecdsa_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdsap192") == 0) ecdsa_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdsap224") == 0) ecdsa_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdsap256") == 0) ecdsa_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdsap384") == 0) ecdsa_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdsap521") == 0) ecdsa_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdsak163") == 0) ecdsa_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdsak233") == 0) ecdsa_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdsak283") == 0) ecdsa_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdsak409") == 0) ecdsa_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdsak571") == 0) ecdsa_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdsab163") == 0) ecdsa_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdsab233") == 0) ecdsa_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdsab283") == 0) ecdsa_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdsab409") == 0) ecdsa_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdsab571") == 0) ecdsa_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdsa") == 0) { for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; } else # endif # ifndef OPENSSL_NO_ECDH if (strcmp(*argv, "ecdhp160") == 0) ecdh_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdhp192") == 0) ecdh_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdhp224") == 0) ecdh_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdhp256") == 0) ecdh_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdhp384") == 0) ecdh_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdhp521") == 0) ecdh_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdhk163") == 0) ecdh_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdhk233") == 0) ecdh_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdhk283") == 0) ecdh_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdhk409") == 0) ecdh_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdhk571") == 0) ecdh_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdhb163") == 0) ecdh_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdhb233") == 0) ecdh_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdhb283") == 0) ecdh_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdhb409") == 0) ecdh_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdhb571") == 0) ecdh_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdh") == 0) { for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; } else # endif { BIO_printf(bio_err, "Error: bad option or value\n"); BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available values:\n"); # ifndef OPENSSL_NO_MD2 BIO_printf(bio_err, "md2 "); # endif # ifndef OPENSSL_NO_MDC2 BIO_printf(bio_err, "mdc2 "); # endif # ifndef OPENSSL_NO_MD4 BIO_printf(bio_err, "md4 "); # endif # ifndef OPENSSL_NO_MD5 BIO_printf(bio_err, "md5 "); # ifndef OPENSSL_NO_HMAC BIO_printf(bio_err, "hmac "); # endif # endif # ifndef OPENSSL_NO_SHA1 BIO_printf(bio_err, "sha1 "); # endif # ifndef OPENSSL_NO_SHA256 BIO_printf(bio_err, "sha256 "); # endif # ifndef OPENSSL_NO_SHA512 BIO_printf(bio_err, "sha512 "); # endif # ifndef OPENSSL_NO_WHIRLPOOL BIO_printf(bio_err, "whirlpool"); # endif # ifndef OPENSSL_NO_RIPEMD160 BIO_printf(bio_err, "rmd160"); # endif # if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \ !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ !defined(OPENSSL_NO_WHIRLPOOL) BIO_printf(bio_err, "\n"); # endif # ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea-cbc "); # endif # ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed-cbc "); # endif # ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2-cbc "); # endif # ifndef OPENSSL_NO_RC5 BIO_printf(bio_err, "rc5-cbc "); # endif # ifndef OPENSSL_NO_BF BIO_printf(bio_err, "bf-cbc"); # endif # if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \ !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5) BIO_printf(bio_err, "\n"); # endif # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des-cbc des-ede3 "); # endif # ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes-128-cbc aes-192-cbc aes-256-cbc "); BIO_printf(bio_err, "aes-128-ige aes-192-ige aes-256-ige "); # endif # ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "camellia-128-cbc camellia-192-cbc camellia-256-cbc "); # endif # ifndef OPENSSL_NO_RC4 BIO_printf(bio_err, "rc4"); # endif BIO_printf(bio_err, "\n"); # ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa512 rsa1024 rsa2048 rsa4096\n"); # endif # ifndef OPENSSL_NO_DSA BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); # endif # ifndef OPENSSL_NO_ECDSA BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 " "ecdsap256 ecdsap384 ecdsap521\n"); BIO_printf(bio_err, "ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n"); BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n"); BIO_printf(bio_err, "ecdsa\n"); # endif # ifndef OPENSSL_NO_ECDH BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 " "ecdhp256 ecdhp384 ecdhp521\n"); BIO_printf(bio_err, "ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n"); BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n"); BIO_printf(bio_err, "ecdh\n"); # endif # ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea "); # endif # ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed "); # endif # ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2 "); # endif # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des "); # endif # ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes "); # endif # ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "camellia "); # endif # ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa "); # endif # ifndef OPENSSL_NO_BF BIO_printf(bio_err, "blowfish"); # endif # if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \ !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \ !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \ !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA) BIO_printf(bio_err, "\n"); # endif BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available options:\n"); # if defined(TIMES) || defined(USE_TOD) BIO_printf(bio_err, "-elapsed " "measure time in real time instead of CPU user time.\n"); # endif # ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, "-engine e " "use engine e, possibly a hardware device.\n"); # endif BIO_printf(bio_err, "-evp e " "use EVP e.\n"); BIO_printf(bio_err, "-decrypt " "time decryption instead of encryption (only EVP).\n"); BIO_printf(bio_err, "-mr " "produce machine readable output.\n"); # ifndef NO_FORK BIO_printf(bio_err, "-multi n " "run n benchmarks in parallel.\n"); # endif goto end; } argc--; argv++; j++; } # ifndef NO_FORK if (multi && do_multi(multi)) goto show_res; # endif if (j == 0) { for (i = 0; i < ALGOR_NUM; i++) { if (i != D_EVP) doit[i] = 1; } for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 1; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 1; # ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; # endif # ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; # endif } for (i = 0; i < ALGOR_NUM; i++) if (doit[i]) pr_header++; if (usertime == 0 && !mr) BIO_printf(bio_err, "You have chosen to measure elapsed time " "instead of user CPU time.\n"); # ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) { const unsigned char *p; p = rsa_data[i]; rsa_key[i] = d2i_RSAPrivateKey(NULL, &p, rsa_data_length[i]); if (rsa_key[i] == NULL) { BIO_printf(bio_err, "internal error loading RSA key number %d\n", i); goto end; } # if 0 else { BIO_printf(bio_err, mr ? "+RK:%d:" : "Loaded RSA key, %d bit modulus and e= 0x", BN_num_bits(rsa_key[i]->n)); BN_print(bio_err, rsa_key[i]->e); BIO_printf(bio_err, "\n"); } # endif } # endif # ifndef OPENSSL_NO_DSA dsa_key[0] = get_dsa512(); dsa_key[1] = get_dsa1024(); dsa_key[2] = get_dsa2048(); # endif # ifndef OPENSSL_NO_DES DES_set_key_unchecked(&key, &sch); DES_set_key_unchecked(&key2, &sch2); DES_set_key_unchecked(&key3, &sch3); # endif # ifndef OPENSSL_NO_AES AES_set_encrypt_key(key16, 128, &aes_ks1); AES_set_encrypt_key(key24, 192, &aes_ks2); AES_set_encrypt_key(key32, 256, &aes_ks3); # endif # ifndef OPENSSL_NO_CAMELLIA Camellia_set_key(key16, 128, &camellia_ks1); Camellia_set_key(ckey24, 192, &camellia_ks2); Camellia_set_key(ckey32, 256, &camellia_ks3); # endif # ifndef OPENSSL_NO_IDEA idea_set_encrypt_key(key16, &idea_ks); # endif # ifndef OPENSSL_NO_SEED SEED_set_key(key16, &seed_ks); # endif # ifndef OPENSSL_NO_RC4 RC4_set_key(&rc4_ks, 16, key16); # endif # ifndef OPENSSL_NO_RC2 RC2_set_key(&rc2_ks, 16, key16, 128); # endif # ifndef OPENSSL_NO_RC5 RC5_32_set_key(&rc5_ks, 16, key16, 12); # endif # ifndef OPENSSL_NO_BF BF_set_key(&bf_ks, 16, key16); # endif # ifndef OPENSSL_NO_CAST CAST_set_key(&cast_ks, 16, key16); # endif # ifndef OPENSSL_NO_RSA memset(rsa_c, 0, sizeof(rsa_c)); # endif # ifndef SIGALRM # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "First we calculate the approximate speed ...\n"); count = 10; do { long it; count *= 2; Time_F(START); for (it = count; it; it--) DES_ecb_encrypt((DES_cblock *)buf, (DES_cblock *)buf, &sch, DES_ENCRYPT); d = Time_F(STOP); } while (d < 3); save_count = count; c[D_MD2][0] = count / 10; c[D_MDC2][0] = count / 10; c[D_MD4][0] = count; c[D_MD5][0] = count; c[D_HMAC][0] = count; c[D_SHA1][0] = count; c[D_RMD160][0] = count; c[D_RC4][0] = count * 5; c[D_CBC_DES][0] = count; c[D_EDE3_DES][0] = count / 3; c[D_CBC_IDEA][0] = count; c[D_CBC_SEED][0] = count; c[D_CBC_RC2][0] = count; c[D_CBC_RC5][0] = count; c[D_CBC_BF][0] = count; c[D_CBC_CAST][0] = count; c[D_CBC_128_AES][0] = count; c[D_CBC_192_AES][0] = count; c[D_CBC_256_AES][0] = count; c[D_CBC_128_CML][0] = count; c[D_CBC_192_CML][0] = count; c[D_CBC_256_CML][0] = count; c[D_SHA256][0] = count; c[D_SHA512][0] = count; c[D_WHIRLPOOL][0] = count; c[D_IGE_128_AES][0] = count; c[D_IGE_192_AES][0] = count; c[D_IGE_256_AES][0] = count; c[D_GHASH][0] = count; for (i = 1; i < SIZE_NUM; i++) { c[D_MD2][i] = c[D_MD2][0] * 4 * lengths[0] / lengths[i]; c[D_MDC2][i] = c[D_MDC2][0] * 4 * lengths[0] / lengths[i]; c[D_MD4][i] = c[D_MD4][0] * 4 * lengths[0] / lengths[i]; c[D_MD5][i] = c[D_MD5][0] * 4 * lengths[0] / lengths[i]; c[D_HMAC][i] = c[D_HMAC][0] * 4 * lengths[0] / lengths[i]; c[D_SHA1][i] = c[D_SHA1][0] * 4 * lengths[0] / lengths[i]; c[D_RMD160][i] = c[D_RMD160][0] * 4 * lengths[0] / lengths[i]; c[D_SHA256][i] = c[D_SHA256][0] * 4 * lengths[0] / lengths[i]; c[D_SHA512][i] = c[D_SHA512][0] * 4 * lengths[0] / lengths[i]; c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * lengths[0] / lengths[i]; } for (i = 1; i < SIZE_NUM; i++) { long l0, l1; l0 = (long)lengths[i - 1]; l1 = (long)lengths[i]; c[D_RC4][i] = c[D_RC4][i - 1] * l0 / l1; c[D_CBC_DES][i] = c[D_CBC_DES][i - 1] * l0 / l1; c[D_EDE3_DES][i] = c[D_EDE3_DES][i - 1] * l0 / l1; c[D_CBC_IDEA][i] = c[D_CBC_IDEA][i - 1] * l0 / l1; c[D_CBC_SEED][i] = c[D_CBC_SEED][i - 1] * l0 / l1; c[D_CBC_RC2][i] = c[D_CBC_RC2][i - 1] * l0 / l1; c[D_CBC_RC5][i] = c[D_CBC_RC5][i - 1] * l0 / l1; c[D_CBC_BF][i] = c[D_CBC_BF][i - 1] * l0 / l1; c[D_CBC_CAST][i] = c[D_CBC_CAST][i - 1] * l0 / l1; c[D_CBC_128_AES][i] = c[D_CBC_128_AES][i - 1] * l0 / l1; c[D_CBC_192_AES][i] = c[D_CBC_192_AES][i - 1] * l0 / l1; c[D_CBC_256_AES][i] = c[D_CBC_256_AES][i - 1] * l0 / l1; c[D_CBC_128_CML][i] = c[D_CBC_128_CML][i - 1] * l0 / l1; c[D_CBC_192_CML][i] = c[D_CBC_192_CML][i - 1] * l0 / l1; c[D_CBC_256_CML][i] = c[D_CBC_256_CML][i - 1] * l0 / l1; c[D_IGE_128_AES][i] = c[D_IGE_128_AES][i - 1] * l0 / l1; c[D_IGE_192_AES][i] = c[D_IGE_192_AES][i - 1] * l0 / l1; c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1; } # ifndef OPENSSL_NO_RSA rsa_c[R_RSA_512][0] = count / 2000; rsa_c[R_RSA_512][1] = count / 400; for (i = 1; i < RSA_NUM; i++) { rsa_c[i][0] = rsa_c[i - 1][0] / 8; rsa_c[i][1] = rsa_c[i - 1][1] / 4; if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0)) rsa_doit[i] = 0; else { if (rsa_c[i][0] == 0) { rsa_c[i][0] = 1; rsa_c[i][1] = 20; } } } # endif # ifndef OPENSSL_NO_DSA dsa_c[R_DSA_512][0] = count / 1000; dsa_c[R_DSA_512][1] = count / 1000 / 2; for (i = 1; i < DSA_NUM; i++) { dsa_c[i][0] = dsa_c[i - 1][0] / 4; dsa_c[i][1] = dsa_c[i - 1][1] / 4; if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0)) dsa_doit[i] = 0; else { if (dsa_c[i] == 0) { dsa_c[i][0] = 1; dsa_c[i][1] = 1; } } } # endif # ifndef OPENSSL_NO_ECDSA ecdsa_c[R_EC_P160][0] = count / 1000; ecdsa_c[R_EC_P160][1] = count / 1000 / 2; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_K163][0] = count / 1000; ecdsa_c[R_EC_K163][1] = count / 1000 / 2; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_B163][0] = count / 1000; ecdsa_c[R_EC_B163][1] = count / 1000 / 2; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } # endif # ifndef OPENSSL_NO_ECDH ecdh_c[R_EC_P160][0] = count / 1000; ecdh_c[R_EC_P160][1] = count / 1000; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_K163][0] = count / 1000; ecdh_c[R_EC_K163][1] = count / 1000; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_B163][0] = count / 1000; ecdh_c[R_EC_B163][1] = count / 1000; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } # endif # define COND(d) (count < (d)) # define COUNT(d) (d) # else /* not worth fixing */ # error "You cannot disable DES on systems without SIGALRM." # endif /* OPENSSL_NO_DES */ # else # define COND(c) (run && count<0x7fffffff) # define COUNT(d) (count) # ifndef _WIN32 signal(SIGALRM, sig_done); # endif # endif /* SIGALRM */ # ifndef OPENSSL_NO_MD2 if (doit[D_MD2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD2], c[D_MD2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(md2[0]), NULL, EVP_md2(), NULL); d = Time_F(STOP); print_result(D_MD2, j, count, d); } } # endif # ifndef OPENSSL_NO_MDC2 if (doit[D_MDC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MDC2], c[D_MDC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MDC2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(mdc2[0]), NULL, EVP_mdc2(), NULL); d = Time_F(STOP); print_result(D_MDC2, j, count, d); } } # endif # ifndef OPENSSL_NO_MD4 if (doit[D_MD4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD4], c[D_MD4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD4][j]); count++) EVP_Digest(&(buf[0]), (unsigned long)lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); d = Time_F(STOP); print_result(D_MD4, j, count, d); } } # endif # ifndef OPENSSL_NO_MD5 if (doit[D_MD5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD5], c[D_MD5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD5][j]); count++) EVP_Digest(&(buf[0]), (unsigned long)lengths[j], &(md5[0]), NULL, EVP_get_digestbyname("md5"), NULL); d = Time_F(STOP); print_result(D_MD5, j, count, d); } } # endif # if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_HMAC) if (doit[D_HMAC]) { HMAC_CTX hctx; HMAC_CTX_init(&hctx); HMAC_Init_ex(&hctx, (unsigned char *)"This is a key...", 16, EVP_md5(), NULL); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { HMAC_Init_ex(&hctx, NULL, 0, NULL, NULL); HMAC_Update(&hctx, buf, lengths[j]); HMAC_Final(&hctx, &(hmac[0]), NULL); } d = Time_F(STOP); print_result(D_HMAC, j, count, d); } HMAC_CTX_cleanup(&hctx); } # endif # ifndef OPENSSL_NO_SHA if (doit[D_SHA1]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(sha[0]), NULL, EVP_sha1(), NULL); d = Time_F(STOP); print_result(D_SHA1, j, count, d); } } # ifndef OPENSSL_NO_SHA256 if (doit[D_SHA256]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) SHA256(buf, lengths[j], sha256); d = Time_F(STOP); print_result(D_SHA256, j, count, d); } } # endif # ifndef OPENSSL_NO_SHA512 if (doit[D_SHA512]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) SHA512(buf, lengths[j], sha512); d = Time_F(STOP); print_result(D_SHA512, j, count, d); } } # endif # endif # ifndef OPENSSL_NO_WHIRLPOOL if (doit[D_WHIRLPOOL]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++) WHIRLPOOL(buf, lengths[j], whirlpool); d = Time_F(STOP); print_result(D_WHIRLPOOL, j, count, d); } } # endif # ifndef OPENSSL_NO_RIPEMD if (doit[D_RMD160]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); d = Time_F(STOP); print_result(D_RMD160, j, count, d); } } # endif # ifndef OPENSSL_NO_RC4 if (doit[D_RC4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RC4], c[D_RC4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RC4][j]); count++) RC4(&rc4_ks, (unsigned int)lengths[j], buf, buf); d = Time_F(STOP); print_result(D_RC4, j, count, d); } } # endif # ifndef OPENSSL_NO_DES if (doit[D_CBC_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) DES_ncbc_encrypt(buf, buf, lengths[j], &sch, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_DES, j, count, d); } } if (doit[D_EDE3_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) DES_ede3_cbc_encrypt(buf, buf, lengths[j], &sch, &sch2, &sch3, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_EDE3_DES, j, count, d); } } # endif # ifndef OPENSSL_NO_AES if (doit[D_CBC_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_AES, j, count, d); } } if (doit[D_CBC_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_AES, j, count, d); } } if (doit[D_CBC_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_AES, j, count, d); } } if (doit[D_IGE_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_128_AES, j, count, d); } } if (doit[D_IGE_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_192_AES, j, count, d); } } if (doit[D_IGE_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_256_AES, j, count, d); } } if (doit[D_GHASH]) { GCM128_CONTEXT *ctx = CRYPTO_gcm128_new(&aes_ks1, (block128_f) AES_encrypt); CRYPTO_gcm128_setiv(ctx, (unsigned char *)"0123456789ab", 12); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) CRYPTO_gcm128_aad(ctx, buf, lengths[j]); d = Time_F(STOP); print_result(D_GHASH, j, count, d); } CRYPTO_gcm128_release(ctx); } # endif # ifndef OPENSSL_NO_CAMELLIA if (doit[D_CBC_128_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks1, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_CML, j, count, d); } } if (doit[D_CBC_192_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks2, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_CML, j, count, d); } } if (doit[D_CBC_256_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks3, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_CML, j, count, d); } } # endif # ifndef OPENSSL_NO_IDEA if (doit[D_CBC_IDEA]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) idea_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &idea_ks, iv, IDEA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_IDEA, j, count, d); } } # endif # ifndef OPENSSL_NO_SEED if (doit[D_CBC_SEED]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_SEED], c[D_CBC_SEED][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_SEED][j]); count++) SEED_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &seed_ks, iv, 1); d = Time_F(STOP); print_result(D_CBC_SEED, j, count, d); } } # endif # ifndef OPENSSL_NO_RC2 if (doit[D_CBC_RC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) RC2_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc2_ks, iv, RC2_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC2, j, count, d); } } # endif # ifndef OPENSSL_NO_RC5 if (doit[D_CBC_RC5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC5], c[D_CBC_RC5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC5][j]); count++) RC5_32_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc5_ks, iv, RC5_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC5, j, count, d); } } # endif # ifndef OPENSSL_NO_BF if (doit[D_CBC_BF]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) BF_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &bf_ks, iv, BF_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_BF, j, count, d); } } # endif # ifndef OPENSSL_NO_CAST if (doit[D_CBC_CAST]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) CAST_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &cast_ks, iv, CAST_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_CAST, j, count, d); } } # endif if (doit[D_EVP]) { # ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK if (multiblock && evp_cipher) { if (! (EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) { fprintf(stderr, "%s is not multi-block capable\n", OBJ_nid2ln(evp_cipher->nid)); goto end; } multiblock_speed(evp_cipher); mret = 0; goto end; } # endif for (j = 0; j < SIZE_NUM; j++) { if (evp_cipher) { EVP_CIPHER_CTX ctx; int outl; names[D_EVP] = OBJ_nid2ln(evp_cipher->nid); /* * -O3 -fschedule-insns messes up an optimization here! * names[D_EVP] somehow becomes NULL */ print_message(names[D_EVP], save_count, lengths[j]); EVP_CIPHER_CTX_init(&ctx); if (decrypt) EVP_DecryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); else EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); EVP_CIPHER_CTX_set_padding(&ctx, 0); Time_F(START); if (decrypt) for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_DecryptUpdate(&ctx, buf, &outl, buf, lengths[j]); else for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_EncryptUpdate(&ctx, buf, &outl, buf, lengths[j]); if (decrypt) EVP_DecryptFinal_ex(&ctx, buf, &outl); else EVP_EncryptFinal_ex(&ctx, buf, &outl); d = Time_F(STOP); EVP_CIPHER_CTX_cleanup(&ctx); } if (evp_md) { names[D_EVP] = OBJ_nid2ln(evp_md->type); print_message(names[D_EVP], save_count, lengths[j]); Time_F(START); for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); d = Time_F(STOP); } print_result(D_EVP, j, count, d); } } RAND_pseudo_bytes(buf, 36); # ifndef OPENSSL_NO_RSA for (j = 0; j < RSA_NUM; j++) { int ret; if (!rsa_doit[j]) continue; ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure. No RSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("private", "rsa", rsa_c[j][0], rsa_bits[j], RSA_SECONDS); /* RSA_blinding_on(rsa_key[j],NULL); */ Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" : "%ld %d bit private RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][0] = d / (double)count; rsa_count = count; } # if 1 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure. No RSA verify will be done.\n"); ERR_print_errors(bio_err); rsa_doit[j] = 0; } else { pkey_print_message("public", "rsa", rsa_c[j][1], rsa_bits[j], RSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" : "%ld %d bit public RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][1] = d / (double)count; } # endif if (rsa_count <= 1) { /* if longer than 10s, don't do any more */ for (j++; j < RSA_NUM; j++) rsa_doit[j] = 0; } } # endif RAND_pseudo_bytes(buf, 20); # ifndef OPENSSL_NO_DSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < DSA_NUM; j++) { unsigned int kk; int ret; if (!dsa_doit[j]) continue; /* DSA_generate_key(dsa_key[j]); */ /* DSA_sign_setup(dsa_key[j],NULL); */ ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure. No DSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "dsa", dsa_c[j][0], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" : "%ld %d bit DSA signs in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][0] = d / (double)count; rsa_count = count; } ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure. No DSA verify will be done.\n"); ERR_print_errors(bio_err); dsa_doit[j] = 0; } else { pkey_print_message("verify", "dsa", dsa_c[j][1], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" : "%ld %d bit DSA verify in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { /* if longer than 10s, don't do any more */ for (j++; j < DSA_NUM; j++) dsa_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); # endif # ifndef OPENSSL_NO_ECDSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { int ret; if (!ecdsa_doit[j]) continue; /* Ignore Curve */ ecdsa[j] = EC_KEY_new_by_curve_name(test_curves[j]); if (ecdsa[j] == NULL) { BIO_printf(bio_err, "ECDSA failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { # if 1 EC_KEY_precompute_mult(ecdsa[j], NULL); # endif /* Perform ECDSA signature test */ EC_KEY_generate_key(ecdsa[j]); ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure. No ECDSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "ecdsa", ecdsa_c[j][0], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][0]); count++) { ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : "%ld %d bit ECDSA signs in %.2fs \n", count, test_curves_bits[j], d); ecdsa_results[j][0] = d / (double)count; rsa_count = count; } /* Perform ECDSA verification test */ ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure. No ECDSA verify will be done.\n"); ERR_print_errors(bio_err); ecdsa_doit[j] = 0; } else { pkey_print_message("verify", "ecdsa", ecdsa_c[j][1], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" : "%ld %d bit ECDSA verify in %.2fs\n", count, test_curves_bits[j], d); ecdsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { /* if longer than 10s, don't do any more */ for (j++; j < EC_NUM; j++) ecdsa_doit[j] = 0; } } } if (rnd_fake) RAND_cleanup(); # endif # ifndef OPENSSL_NO_ECDH if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { if (!ecdh_doit[j]) continue; ecdh_a[j] = EC_KEY_new_by_curve_name(test_curves[j]); ecdh_b[j] = EC_KEY_new_by_curve_name(test_curves[j]); if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL)) { BIO_printf(bio_err, "ECDH failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { /* generate two ECDH key pairs */ if (!EC_KEY_generate_key(ecdh_a[j]) || !EC_KEY_generate_key(ecdh_b[j])) { BIO_printf(bio_err, "ECDH key generation failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { /* * If field size is not more than 24 octets, then use SHA-1 * hash of result; otherwise, use result (see section 4.8 of * draft-ietf-tls-ecc-03.txt). */ int field_size, outlen; void *(*kdf) (const void *in, size_t inlen, void *out, size_t *xoutlen); field_size = EC_GROUP_get_degree(EC_KEY_get0_group(ecdh_a[j])); if (field_size <= 24 * 8) { outlen = KDF1_SHA1_len; kdf = KDF1_SHA1; } else { outlen = (field_size + 7) / 8; kdf = NULL; } secret_size_a = ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); secret_size_b = ECDH_compute_key(secret_b, outlen, EC_KEY_get0_public_key(ecdh_a[j]), ecdh_b[j], kdf); if (secret_size_a != secret_size_b) ecdh_checks = 0; else ecdh_checks = 1; for (secret_idx = 0; (secret_idx < secret_size_a) && (ecdh_checks == 1); secret_idx++) { if (secret_a[secret_idx] != secret_b[secret_idx]) ecdh_checks = 0; } if (ecdh_checks == 0) { BIO_printf(bio_err, "ECDH computations don't match.\n"); ERR_print_errors(bio_err); rsa_count = 1; } pkey_print_message("", "ecdh", ecdh_c[j][0], test_curves_bits[j], ECDH_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdh_c[j][0]); count++) { ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" : "%ld %d-bit ECDH ops in %.2fs\n", count, test_curves_bits[j], d); ecdh_results[j][0] = d / (double)count; rsa_count = count; } } if (rsa_count <= 1) { /* if longer than 10s, don't do any more */ for (j++; j < EC_NUM; j++) ecdh_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); # endif # ifndef NO_FORK show_res: # endif if (!mr) { fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION)); fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON)); printf("options:"); printf("%s ", BN_options()); # ifndef OPENSSL_NO_MD2 printf("%s ", MD2_options()); # endif # ifndef OPENSSL_NO_RC4 printf("%s ", RC4_options()); # endif # ifndef OPENSSL_NO_DES printf("%s ", DES_options()); # endif # ifndef OPENSSL_NO_AES printf("%s ", AES_options()); # endif # ifndef OPENSSL_NO_IDEA printf("%s ", idea_options()); # endif # ifndef OPENSSL_NO_BF printf("%s ", BF_options()); # endif fprintf(stdout, "\n%s\n", SSLeay_version(SSLEAY_CFLAGS)); } if (pr_header) { if (mr) fprintf(stdout, "+H"); else { fprintf(stdout, "The 'numbers' are in 1000s of bytes per second processed.\n"); fprintf(stdout, "type "); } for (j = 0; j < SIZE_NUM; j++) fprintf(stdout, mr ? ":%d" : "%7d bytes", lengths[j]); fprintf(stdout, "\n"); } for (k = 0; k < ALGOR_NUM; k++) { if (!doit[k]) continue; if (mr) fprintf(stdout, "+F:%d:%s", k, names[k]); else fprintf(stdout, "%-13s", names[k]); for (j = 0; j < SIZE_NUM; j++) { if (results[k][j] > 10000 && !mr) fprintf(stdout, " %11.2fk", results[k][j] / 1e3); else fprintf(stdout, mr ? ":%.2f" : " %11.2f ", results[k][j]); } fprintf(stdout, "\n"); } # ifndef OPENSSL_NO_RSA j = 1; for (k = 0; k < RSA_NUM; k++) { if (!rsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F2:%u:%u:%f:%f\n", k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]); else fprintf(stdout, "rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", rsa_bits[k], rsa_results[k][0], rsa_results[k][1], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1]); } # endif # ifndef OPENSSL_NO_DSA j = 1; for (k = 0; k < DSA_NUM; k++) { if (!dsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F3:%u:%u:%f:%f\n", k, dsa_bits[k], dsa_results[k][0], dsa_results[k][1]); else fprintf(stdout, "dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", dsa_bits[k], dsa_results[k][0], dsa_results[k][1], 1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1]); } # endif # ifndef OPENSSL_NO_ECDSA j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdsa_doit[k]) continue; if (j && !mr) { printf("%30ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F4:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdsa_results[k][0], ecdsa_results[k][1]); else fprintf(stdout, "%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdsa_results[k][0], ecdsa_results[k][1], 1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]); } # endif # ifndef OPENSSL_NO_ECDH j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdh_doit[k]) continue; if (j && !mr) { printf("%30sop op/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F5:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); else fprintf(stdout, "%4u bit ecdh (%s) %8.4fs %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); } # endif mret = 0; end: ERR_print_errors(bio_err); if (buf != NULL) OPENSSL_free(buf); if (buf2 != NULL) OPENSSL_free(buf2); # ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) if (rsa_key[i] != NULL) RSA_free(rsa_key[i]); # endif # ifndef OPENSSL_NO_DSA for (i = 0; i < DSA_NUM; i++) if (dsa_key[i] != NULL) DSA_free(dsa_key[i]); # endif # ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) if (ecdsa[i] != NULL) EC_KEY_free(ecdsa[i]); # endif # ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) { if (ecdh_a[i] != NULL) EC_KEY_free(ecdh_a[i]); if (ecdh_b[i] != NULL) EC_KEY_free(ecdh_b[i]); } # endif release_engine(e); apps_shutdown(); OPENSSL_EXIT(mret); } static void print_message(const char *s, long num, int length) { # ifdef SIGALRM BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n" : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length); (void)BIO_flush(bio_err); alarm(SECONDS); # else BIO_printf(bio_err, mr ? "+DN:%s:%ld:%d\n" : "Doing %s %ld times on %d size blocks: ", s, num, length); (void)BIO_flush(bio_err); # endif # ifdef LINT num = num; # endif } static void pkey_print_message(const char *str, const char *str2, long num, int bits, int tm) { # ifdef SIGALRM BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n" : "Doing %d bit %s %s's for %ds: ", bits, str, str2, tm); (void)BIO_flush(bio_err); alarm(tm); # else BIO_printf(bio_err, mr ? "+DNP:%ld:%d:%s:%s\n" : "Doing %ld %d bit %s %s's: ", num, bits, str, str2); (void)BIO_flush(bio_err); # endif # ifdef LINT num = num; # endif } static void print_result(int alg, int run_no, int count, double time_used) { BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n" : "%d %s's in %.2fs\n", count, names[alg], time_used); results[alg][run_no] = ((double)count) / time_used * lengths[run_no]; } # ifndef NO_FORK static char *sstrsep(char **string, const char *delim) { char isdelim[256]; char *token = *string; if (**string == 0) return NULL; memset(isdelim, 0, sizeof isdelim); isdelim[0] = 1; while (*delim) { isdelim[(unsigned char)(*delim)] = 1; delim++; } while (!isdelim[(unsigned char)(**string)]) { (*string)++; } if (**string) { **string = 0; (*string)++; } return token; } static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(multi * sizeof *fds); if (fds == NULL) { fprintf(stderr, "Out of memory in speed (do_multi)\n"); exit(1); } for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { fprintf(stderr, "pipe failure\n"); exit(1); } fflush(stdout); fflush(stderr); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { fprintf(stderr, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } /* for now, assume the pipe is long enough to take all the output */ for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof buf, f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { fprintf(stderr, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (!strncmp(buf, "+F:", 3)) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < SIZE_NUM; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (!strncmp(buf, "+F2:", 4)) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][0] = 1 / (1 / rsa_results[k][0] + 1 / d); else rsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][1] = 1 / (1 / rsa_results[k][1] + 1 / d); else rsa_results[k][1] = d; } # ifndef OPENSSL_NO_DSA else if (!strncmp(buf, "+F3:", 4)) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][0] = 1 / (1 / dsa_results[k][0] + 1 / d); else dsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][1] = 1 / (1 / dsa_results[k][1] + 1 / d); else dsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_ECDSA else if (!strncmp(buf, "+F4:", 4)) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][0] = 1 / (1 / ecdsa_results[k][0] + 1 / d); else ecdsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][1] = 1 / (1 / ecdsa_results[k][1] + 1 / d); else ecdsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_ECDH else if (!strncmp(buf, "+F5:", 4)) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdh_results[k][0] = 1 / (1 / ecdh_results[k][0] + 1 / d); else ecdh_results[k][0] = d; } # endif else if (!strncmp(buf, "+H:", 3)) { } else fprintf(stderr, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } # endif static void multiblock_speed(const EVP_CIPHER *evp_cipher) { static int mblengths[] = { 8 * 1024, 2 * 8 * 1024, 4 * 8 * 1024, 8 * 8 * 1024, 8 * 16 * 1024 }; int j, count, num = sizeof(lengths) / sizeof(lengths[0]); const char *alg_name; unsigned char *inp, *out, no_key[32], no_iv[16]; EVP_CIPHER_CTX ctx; double d = 0.0; inp = OPENSSL_malloc(mblengths[num - 1]); out = OPENSSL_malloc(mblengths[num - 1] + 1024); if (!inp || !out) { BIO_printf(bio_err,"Out of memory\n"); goto end; } EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, no_key, no_iv); EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_AEAD_SET_MAC_KEY, sizeof(no_key), no_key); alg_name = OBJ_nid2ln(evp_cipher->nid); for (j = 0; j < num; j++) { print_message(alg_name, 0, mblengths[j]); Time_F(START); for (count = 0, run = 1; run && count < 0x7fffffff; count++) { unsigned char aad[EVP_AEAD_TLS1_AAD_LEN]; EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param; size_t len = mblengths[j]; int packlen; memset(aad, 0, 8); /* avoid uninitialized values */ aad[8] = 23; /* SSL3_RT_APPLICATION_DATA */ aad[9] = 3; /* version */ aad[10] = 2; aad[11] = 0; /* length */ aad[12] = 0; mb_param.out = NULL; mb_param.inp = aad; mb_param.len = len; mb_param.interleave = 8; packlen = EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_TLS1_1_MULTIBLOCK_AAD, sizeof(mb_param), &mb_param); if (packlen > 0) { mb_param.out = out; mb_param.inp = inp; mb_param.len = len; EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT, sizeof(mb_param), &mb_param); } else { int pad; RAND_bytes(out, 16); len += 16; - aad[11] = len >> 8; - aad[12] = len; + aad[11] = (unsigned char)(len >> 8); + aad[12] = (unsigned char)(len); pad = EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_AEAD_TLS1_AAD, EVP_AEAD_TLS1_AAD_LEN, aad); EVP_Cipher(&ctx, out, inp, len + pad); } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n" : "%d %s's in %.2fs\n", count, "evp", d); results[D_EVP][j] = ((double)count) / d * mblengths[j]; } if (mr) { fprintf(stdout, "+H"); for (j = 0; j < num; j++) fprintf(stdout, ":%d", mblengths[j]); fprintf(stdout, "\n"); fprintf(stdout, "+F:%d:%s", D_EVP, alg_name); for (j = 0; j < num; j++) fprintf(stdout, ":%.2f", results[D_EVP][j]); fprintf(stdout, "\n"); } else { fprintf(stdout, "The 'numbers' are in 1000s of bytes per second processed.\n"); fprintf(stdout, "type "); for (j = 0; j < num; j++) fprintf(stdout, "%7d bytes", mblengths[j]); fprintf(stdout, "\n"); fprintf(stdout, "%-24s", alg_name); for (j = 0; j < num; j++) { if (results[D_EVP][j] > 10000) fprintf(stdout, " %11.2fk", results[D_EVP][j] / 1e3); else fprintf(stdout, " %11.2f ", results[D_EVP][j]); } fprintf(stdout, "\n"); } end: if (inp) OPENSSL_free(inp); if (out) OPENSSL_free(out); } #endif diff --git a/crypto/aes/asm/aes-armv4.pl b/crypto/aes/asm/aes-armv4.pl index 4f8917089f6c..c1b5e352d76f 100755 --- a/crypto/aes/asm/aes-armv4.pl +++ b/crypto/aes/asm/aes-armv4.pl @@ -1,1217 +1,1217 @@ #!/usr/bin/env perl # ==================================================================== # Written by Andy Polyakov for the OpenSSL # project. The module is, however, dual licensed under OpenSSL and # CRYPTOGAMS licenses depending on where you obtain it. For further # details see http://www.openssl.org/~appro/cryptogams/. # ==================================================================== # AES for ARMv4 # January 2007. # # Code uses single 1K S-box and is >2 times faster than code generated # by gcc-3.4.1. This is thanks to unique feature of ARMv4 ISA, which # allows to merge logical or arithmetic operation with shift or rotate # in one instruction and emit combined result every cycle. The module # is endian-neutral. The performance is ~42 cycles/byte for 128-bit # key [on single-issue Xscale PXA250 core]. # May 2007. # # AES_set_[en|de]crypt_key is added. # July 2010. # # Rescheduling for dual-issue pipeline resulted in 12% improvement on # Cortex A8 core and ~25 cycles per byte processed with 128-bit key. # February 2011. # # Profiler-assisted and platform-specific optimization resulted in 16% # improvement on Cortex A8 core and ~21.5 cycles per byte. while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} open STDOUT,">$output"; $s0="r0"; $s1="r1"; $s2="r2"; $s3="r3"; $t1="r4"; $t2="r5"; $t3="r6"; $i1="r7"; $i2="r8"; $i3="r9"; $tbl="r10"; $key="r11"; $rounds="r12"; $code=<<___; #ifndef __KERNEL__ # include "arm_arch.h" #else # define __ARM_ARCH__ __LINUX_ARM_ARCH__ #endif .text #if __ARM_ARCH__<7 .code 32 #else .syntax unified # ifdef __thumb2__ .thumb # else .code 32 # endif #endif .type AES_Te,%object .align 5 AES_Te: .word 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d .word 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554 .word 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d .word 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a .word 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87 .word 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b .word 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea .word 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b .word 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a .word 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f .word 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108 .word 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f .word 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e .word 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5 .word 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d .word 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f .word 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e .word 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb .word 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce .word 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497 .word 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c .word 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed .word 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b .word 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a .word 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16 .word 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594 .word 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81 .word 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3 .word 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a .word 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504 .word 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163 .word 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d .word 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f .word 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739 .word 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47 .word 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395 .word 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f .word 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883 .word 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c .word 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76 .word 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e .word 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4 .word 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6 .word 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b .word 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7 .word 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0 .word 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25 .word 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818 .word 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72 .word 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651 .word 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21 .word 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85 .word 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa .word 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12 .word 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0 .word 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9 .word 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133 .word 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7 .word 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920 .word 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a .word 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17 .word 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8 .word 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11 .word 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a @ Te4[256] .byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 .byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 .byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 .byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 .byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc .byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 .byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a .byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 .byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 .byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 .byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b .byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf .byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 .byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 .byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 .byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 .byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 .byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 .byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 .byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb .byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c .byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 .byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 .byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 .byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 .byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a .byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e .byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e .byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 .byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf .byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 .byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 @ rcon[] .word 0x01000000, 0x02000000, 0x04000000, 0x08000000 .word 0x10000000, 0x20000000, 0x40000000, 0x80000000 .word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0 .size AES_Te,.-AES_Te @ void AES_encrypt(const unsigned char *in, unsigned char *out, @ const AES_KEY *key) { .global AES_encrypt .type AES_encrypt,%function .align 5 AES_encrypt: #if __ARM_ARCH__<7 sub r3,pc,#8 @ AES_encrypt #else - adr r3,AES_encrypt + adr r3,. #endif stmdb sp!,{r1,r4-r12,lr} mov $rounds,r0 @ inp mov $key,r2 sub $tbl,r3,#AES_encrypt-AES_Te @ Te #if __ARM_ARCH__<7 ldrb $s0,[$rounds,#3] @ load input data in endian-neutral ldrb $t1,[$rounds,#2] @ manner... ldrb $t2,[$rounds,#1] ldrb $t3,[$rounds,#0] orr $s0,$s0,$t1,lsl#8 ldrb $s1,[$rounds,#7] orr $s0,$s0,$t2,lsl#16 ldrb $t1,[$rounds,#6] orr $s0,$s0,$t3,lsl#24 ldrb $t2,[$rounds,#5] ldrb $t3,[$rounds,#4] orr $s1,$s1,$t1,lsl#8 ldrb $s2,[$rounds,#11] orr $s1,$s1,$t2,lsl#16 ldrb $t1,[$rounds,#10] orr $s1,$s1,$t3,lsl#24 ldrb $t2,[$rounds,#9] ldrb $t3,[$rounds,#8] orr $s2,$s2,$t1,lsl#8 ldrb $s3,[$rounds,#15] orr $s2,$s2,$t2,lsl#16 ldrb $t1,[$rounds,#14] orr $s2,$s2,$t3,lsl#24 ldrb $t2,[$rounds,#13] ldrb $t3,[$rounds,#12] orr $s3,$s3,$t1,lsl#8 orr $s3,$s3,$t2,lsl#16 orr $s3,$s3,$t3,lsl#24 #else ldr $s0,[$rounds,#0] ldr $s1,[$rounds,#4] ldr $s2,[$rounds,#8] ldr $s3,[$rounds,#12] #ifdef __ARMEL__ rev $s0,$s0 rev $s1,$s1 rev $s2,$s2 rev $s3,$s3 #endif #endif bl _armv4_AES_encrypt ldr $rounds,[sp],#4 @ pop out #if __ARM_ARCH__>=7 #ifdef __ARMEL__ rev $s0,$s0 rev $s1,$s1 rev $s2,$s2 rev $s3,$s3 #endif str $s0,[$rounds,#0] str $s1,[$rounds,#4] str $s2,[$rounds,#8] str $s3,[$rounds,#12] #else mov $t1,$s0,lsr#24 @ write output in endian-neutral mov $t2,$s0,lsr#16 @ manner... mov $t3,$s0,lsr#8 strb $t1,[$rounds,#0] strb $t2,[$rounds,#1] mov $t1,$s1,lsr#24 strb $t3,[$rounds,#2] mov $t2,$s1,lsr#16 strb $s0,[$rounds,#3] mov $t3,$s1,lsr#8 strb $t1,[$rounds,#4] strb $t2,[$rounds,#5] mov $t1,$s2,lsr#24 strb $t3,[$rounds,#6] mov $t2,$s2,lsr#16 strb $s1,[$rounds,#7] mov $t3,$s2,lsr#8 strb $t1,[$rounds,#8] strb $t2,[$rounds,#9] mov $t1,$s3,lsr#24 strb $t3,[$rounds,#10] mov $t2,$s3,lsr#16 strb $s2,[$rounds,#11] mov $t3,$s3,lsr#8 strb $t1,[$rounds,#12] strb $t2,[$rounds,#13] strb $t3,[$rounds,#14] strb $s3,[$rounds,#15] #endif #if __ARM_ARCH__>=5 ldmia sp!,{r4-r12,pc} #else ldmia sp!,{r4-r12,lr} tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) #endif .size AES_encrypt,.-AES_encrypt .type _armv4_AES_encrypt,%function .align 2 _armv4_AES_encrypt: str lr,[sp,#-4]! @ push lr ldmia $key!,{$t1-$i1} eor $s0,$s0,$t1 ldr $rounds,[$key,#240-16] eor $s1,$s1,$t2 eor $s2,$s2,$t3 eor $s3,$s3,$i1 sub $rounds,$rounds,#1 mov lr,#255 and $i1,lr,$s0 and $i2,lr,$s0,lsr#8 and $i3,lr,$s0,lsr#16 mov $s0,$s0,lsr#24 .Lenc_loop: ldr $t1,[$tbl,$i1,lsl#2] @ Te3[s0>>0] and $i1,lr,$s1,lsr#16 @ i0 ldr $t2,[$tbl,$i2,lsl#2] @ Te2[s0>>8] and $i2,lr,$s1 ldr $t3,[$tbl,$i3,lsl#2] @ Te1[s0>>16] and $i3,lr,$s1,lsr#8 ldr $s0,[$tbl,$s0,lsl#2] @ Te0[s0>>24] mov $s1,$s1,lsr#24 ldr $i1,[$tbl,$i1,lsl#2] @ Te1[s1>>16] ldr $i2,[$tbl,$i2,lsl#2] @ Te3[s1>>0] ldr $i3,[$tbl,$i3,lsl#2] @ Te2[s1>>8] eor $s0,$s0,$i1,ror#8 ldr $s1,[$tbl,$s1,lsl#2] @ Te0[s1>>24] and $i1,lr,$s2,lsr#8 @ i0 eor $t2,$t2,$i2,ror#8 and $i2,lr,$s2,lsr#16 @ i1 eor $t3,$t3,$i3,ror#8 and $i3,lr,$s2 ldr $i1,[$tbl,$i1,lsl#2] @ Te2[s2>>8] eor $s1,$s1,$t1,ror#24 ldr $i2,[$tbl,$i2,lsl#2] @ Te1[s2>>16] mov $s2,$s2,lsr#24 ldr $i3,[$tbl,$i3,lsl#2] @ Te3[s2>>0] eor $s0,$s0,$i1,ror#16 ldr $s2,[$tbl,$s2,lsl#2] @ Te0[s2>>24] and $i1,lr,$s3 @ i0 eor $s1,$s1,$i2,ror#8 and $i2,lr,$s3,lsr#8 @ i1 eor $t3,$t3,$i3,ror#16 and $i3,lr,$s3,lsr#16 @ i2 ldr $i1,[$tbl,$i1,lsl#2] @ Te3[s3>>0] eor $s2,$s2,$t2,ror#16 ldr $i2,[$tbl,$i2,lsl#2] @ Te2[s3>>8] mov $s3,$s3,lsr#24 ldr $i3,[$tbl,$i3,lsl#2] @ Te1[s3>>16] eor $s0,$s0,$i1,ror#24 ldr $i1,[$key],#16 eor $s1,$s1,$i2,ror#16 ldr $s3,[$tbl,$s3,lsl#2] @ Te0[s3>>24] eor $s2,$s2,$i3,ror#8 ldr $t1,[$key,#-12] eor $s3,$s3,$t3,ror#8 ldr $t2,[$key,#-8] eor $s0,$s0,$i1 ldr $t3,[$key,#-4] and $i1,lr,$s0 eor $s1,$s1,$t1 and $i2,lr,$s0,lsr#8 eor $s2,$s2,$t2 and $i3,lr,$s0,lsr#16 eor $s3,$s3,$t3 mov $s0,$s0,lsr#24 subs $rounds,$rounds,#1 bne .Lenc_loop add $tbl,$tbl,#2 ldrb $t1,[$tbl,$i1,lsl#2] @ Te4[s0>>0] and $i1,lr,$s1,lsr#16 @ i0 ldrb $t2,[$tbl,$i2,lsl#2] @ Te4[s0>>8] and $i2,lr,$s1 ldrb $t3,[$tbl,$i3,lsl#2] @ Te4[s0>>16] and $i3,lr,$s1,lsr#8 ldrb $s0,[$tbl,$s0,lsl#2] @ Te4[s0>>24] mov $s1,$s1,lsr#24 ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s1>>16] ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s1>>0] ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s1>>8] eor $s0,$i1,$s0,lsl#8 ldrb $s1,[$tbl,$s1,lsl#2] @ Te4[s1>>24] and $i1,lr,$s2,lsr#8 @ i0 eor $t2,$i2,$t2,lsl#8 and $i2,lr,$s2,lsr#16 @ i1 eor $t3,$i3,$t3,lsl#8 and $i3,lr,$s2 ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s2>>8] eor $s1,$t1,$s1,lsl#24 ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s2>>16] mov $s2,$s2,lsr#24 ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s2>>0] eor $s0,$i1,$s0,lsl#8 ldrb $s2,[$tbl,$s2,lsl#2] @ Te4[s2>>24] and $i1,lr,$s3 @ i0 eor $s1,$s1,$i2,lsl#16 and $i2,lr,$s3,lsr#8 @ i1 eor $t3,$i3,$t3,lsl#8 and $i3,lr,$s3,lsr#16 @ i2 ldrb $i1,[$tbl,$i1,lsl#2] @ Te4[s3>>0] eor $s2,$t2,$s2,lsl#24 ldrb $i2,[$tbl,$i2,lsl#2] @ Te4[s3>>8] mov $s3,$s3,lsr#24 ldrb $i3,[$tbl,$i3,lsl#2] @ Te4[s3>>16] eor $s0,$i1,$s0,lsl#8 ldr $i1,[$key,#0] ldrb $s3,[$tbl,$s3,lsl#2] @ Te4[s3>>24] eor $s1,$s1,$i2,lsl#8 ldr $t1,[$key,#4] eor $s2,$s2,$i3,lsl#16 ldr $t2,[$key,#8] eor $s3,$t3,$s3,lsl#24 ldr $t3,[$key,#12] eor $s0,$s0,$i1 eor $s1,$s1,$t1 eor $s2,$s2,$t2 eor $s3,$s3,$t3 sub $tbl,$tbl,#2 ldr pc,[sp],#4 @ pop and return .size _armv4_AES_encrypt,.-_armv4_AES_encrypt .global private_AES_set_encrypt_key .type private_AES_set_encrypt_key,%function .align 5 private_AES_set_encrypt_key: _armv4_AES_set_encrypt_key: #if __ARM_ARCH__<7 sub r3,pc,#8 @ AES_set_encrypt_key #else - adr r3,private_AES_set_encrypt_key + adr r3,. #endif teq r0,#0 #if __ARM_ARCH__>=7 itt eq @ Thumb2 thing, sanity check in ARM #endif moveq r0,#-1 beq .Labrt teq r2,#0 #if __ARM_ARCH__>=7 itt eq @ Thumb2 thing, sanity check in ARM #endif moveq r0,#-1 beq .Labrt teq r1,#128 beq .Lok teq r1,#192 beq .Lok teq r1,#256 #if __ARM_ARCH__>=7 itt ne @ Thumb2 thing, sanity check in ARM #endif movne r0,#-1 bne .Labrt .Lok: stmdb sp!,{r4-r12,lr} sub $tbl,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4 mov $rounds,r0 @ inp mov lr,r1 @ bits mov $key,r2 @ key #if __ARM_ARCH__<7 ldrb $s0,[$rounds,#3] @ load input data in endian-neutral ldrb $t1,[$rounds,#2] @ manner... ldrb $t2,[$rounds,#1] ldrb $t3,[$rounds,#0] orr $s0,$s0,$t1,lsl#8 ldrb $s1,[$rounds,#7] orr $s0,$s0,$t2,lsl#16 ldrb $t1,[$rounds,#6] orr $s0,$s0,$t3,lsl#24 ldrb $t2,[$rounds,#5] ldrb $t3,[$rounds,#4] orr $s1,$s1,$t1,lsl#8 ldrb $s2,[$rounds,#11] orr $s1,$s1,$t2,lsl#16 ldrb $t1,[$rounds,#10] orr $s1,$s1,$t3,lsl#24 ldrb $t2,[$rounds,#9] ldrb $t3,[$rounds,#8] orr $s2,$s2,$t1,lsl#8 ldrb $s3,[$rounds,#15] orr $s2,$s2,$t2,lsl#16 ldrb $t1,[$rounds,#14] orr $s2,$s2,$t3,lsl#24 ldrb $t2,[$rounds,#13] ldrb $t3,[$rounds,#12] orr $s3,$s3,$t1,lsl#8 str $s0,[$key],#16 orr $s3,$s3,$t2,lsl#16 str $s1,[$key,#-12] orr $s3,$s3,$t3,lsl#24 str $s2,[$key,#-8] str $s3,[$key,#-4] #else ldr $s0,[$rounds,#0] ldr $s1,[$rounds,#4] ldr $s2,[$rounds,#8] ldr $s3,[$rounds,#12] #ifdef __ARMEL__ rev $s0,$s0 rev $s1,$s1 rev $s2,$s2 rev $s3,$s3 #endif str $s0,[$key],#16 str $s1,[$key,#-12] str $s2,[$key,#-8] str $s3,[$key,#-4] #endif teq lr,#128 bne .Lnot128 mov $rounds,#10 str $rounds,[$key,#240-16] add $t3,$tbl,#256 @ rcon mov lr,#255 .L128_loop: and $t2,lr,$s3,lsr#24 and $i1,lr,$s3,lsr#16 ldrb $t2,[$tbl,$t2] and $i2,lr,$s3,lsr#8 ldrb $i1,[$tbl,$i1] and $i3,lr,$s3 ldrb $i2,[$tbl,$i2] orr $t2,$t2,$i1,lsl#24 ldrb $i3,[$tbl,$i3] orr $t2,$t2,$i2,lsl#16 ldr $t1,[$t3],#4 @ rcon[i++] orr $t2,$t2,$i3,lsl#8 eor $t2,$t2,$t1 eor $s0,$s0,$t2 @ rk[4]=rk[0]^... eor $s1,$s1,$s0 @ rk[5]=rk[1]^rk[4] str $s0,[$key],#16 eor $s2,$s2,$s1 @ rk[6]=rk[2]^rk[5] str $s1,[$key,#-12] eor $s3,$s3,$s2 @ rk[7]=rk[3]^rk[6] str $s2,[$key,#-8] subs $rounds,$rounds,#1 str $s3,[$key,#-4] bne .L128_loop sub r2,$key,#176 b .Ldone .Lnot128: #if __ARM_ARCH__<7 ldrb $i2,[$rounds,#19] ldrb $t1,[$rounds,#18] ldrb $t2,[$rounds,#17] ldrb $t3,[$rounds,#16] orr $i2,$i2,$t1,lsl#8 ldrb $i3,[$rounds,#23] orr $i2,$i2,$t2,lsl#16 ldrb $t1,[$rounds,#22] orr $i2,$i2,$t3,lsl#24 ldrb $t2,[$rounds,#21] ldrb $t3,[$rounds,#20] orr $i3,$i3,$t1,lsl#8 orr $i3,$i3,$t2,lsl#16 str $i2,[$key],#8 orr $i3,$i3,$t3,lsl#24 str $i3,[$key,#-4] #else ldr $i2,[$rounds,#16] ldr $i3,[$rounds,#20] #ifdef __ARMEL__ rev $i2,$i2 rev $i3,$i3 #endif str $i2,[$key],#8 str $i3,[$key,#-4] #endif teq lr,#192 bne .Lnot192 mov $rounds,#12 str $rounds,[$key,#240-24] add $t3,$tbl,#256 @ rcon mov lr,#255 mov $rounds,#8 .L192_loop: and $t2,lr,$i3,lsr#24 and $i1,lr,$i3,lsr#16 ldrb $t2,[$tbl,$t2] and $i2,lr,$i3,lsr#8 ldrb $i1,[$tbl,$i1] and $i3,lr,$i3 ldrb $i2,[$tbl,$i2] orr $t2,$t2,$i1,lsl#24 ldrb $i3,[$tbl,$i3] orr $t2,$t2,$i2,lsl#16 ldr $t1,[$t3],#4 @ rcon[i++] orr $t2,$t2,$i3,lsl#8 eor $i3,$t2,$t1 eor $s0,$s0,$i3 @ rk[6]=rk[0]^... eor $s1,$s1,$s0 @ rk[7]=rk[1]^rk[6] str $s0,[$key],#24 eor $s2,$s2,$s1 @ rk[8]=rk[2]^rk[7] str $s1,[$key,#-20] eor $s3,$s3,$s2 @ rk[9]=rk[3]^rk[8] str $s2,[$key,#-16] subs $rounds,$rounds,#1 str $s3,[$key,#-12] #if __ARM_ARCH__>=7 itt eq @ Thumb2 thing, sanity check in ARM #endif subeq r2,$key,#216 beq .Ldone ldr $i1,[$key,#-32] ldr $i2,[$key,#-28] eor $i1,$i1,$s3 @ rk[10]=rk[4]^rk[9] eor $i3,$i2,$i1 @ rk[11]=rk[5]^rk[10] str $i1,[$key,#-8] str $i3,[$key,#-4] b .L192_loop .Lnot192: #if __ARM_ARCH__<7 ldrb $i2,[$rounds,#27] ldrb $t1,[$rounds,#26] ldrb $t2,[$rounds,#25] ldrb $t3,[$rounds,#24] orr $i2,$i2,$t1,lsl#8 ldrb $i3,[$rounds,#31] orr $i2,$i2,$t2,lsl#16 ldrb $t1,[$rounds,#30] orr $i2,$i2,$t3,lsl#24 ldrb $t2,[$rounds,#29] ldrb $t3,[$rounds,#28] orr $i3,$i3,$t1,lsl#8 orr $i3,$i3,$t2,lsl#16 str $i2,[$key],#8 orr $i3,$i3,$t3,lsl#24 str $i3,[$key,#-4] #else ldr $i2,[$rounds,#24] ldr $i3,[$rounds,#28] #ifdef __ARMEL__ rev $i2,$i2 rev $i3,$i3 #endif str $i2,[$key],#8 str $i3,[$key,#-4] #endif mov $rounds,#14 str $rounds,[$key,#240-32] add $t3,$tbl,#256 @ rcon mov lr,#255 mov $rounds,#7 .L256_loop: and $t2,lr,$i3,lsr#24 and $i1,lr,$i3,lsr#16 ldrb $t2,[$tbl,$t2] and $i2,lr,$i3,lsr#8 ldrb $i1,[$tbl,$i1] and $i3,lr,$i3 ldrb $i2,[$tbl,$i2] orr $t2,$t2,$i1,lsl#24 ldrb $i3,[$tbl,$i3] orr $t2,$t2,$i2,lsl#16 ldr $t1,[$t3],#4 @ rcon[i++] orr $t2,$t2,$i3,lsl#8 eor $i3,$t2,$t1 eor $s0,$s0,$i3 @ rk[8]=rk[0]^... eor $s1,$s1,$s0 @ rk[9]=rk[1]^rk[8] str $s0,[$key],#32 eor $s2,$s2,$s1 @ rk[10]=rk[2]^rk[9] str $s1,[$key,#-28] eor $s3,$s3,$s2 @ rk[11]=rk[3]^rk[10] str $s2,[$key,#-24] subs $rounds,$rounds,#1 str $s3,[$key,#-20] #if __ARM_ARCH__>=7 itt eq @ Thumb2 thing, sanity check in ARM #endif subeq r2,$key,#256 beq .Ldone and $t2,lr,$s3 and $i1,lr,$s3,lsr#8 ldrb $t2,[$tbl,$t2] and $i2,lr,$s3,lsr#16 ldrb $i1,[$tbl,$i1] and $i3,lr,$s3,lsr#24 ldrb $i2,[$tbl,$i2] orr $t2,$t2,$i1,lsl#8 ldrb $i3,[$tbl,$i3] orr $t2,$t2,$i2,lsl#16 ldr $t1,[$key,#-48] orr $t2,$t2,$i3,lsl#24 ldr $i1,[$key,#-44] ldr $i2,[$key,#-40] eor $t1,$t1,$t2 @ rk[12]=rk[4]^... ldr $i3,[$key,#-36] eor $i1,$i1,$t1 @ rk[13]=rk[5]^rk[12] str $t1,[$key,#-16] eor $i2,$i2,$i1 @ rk[14]=rk[6]^rk[13] str $i1,[$key,#-12] eor $i3,$i3,$i2 @ rk[15]=rk[7]^rk[14] str $i2,[$key,#-8] str $i3,[$key,#-4] b .L256_loop .align 2 .Ldone: mov r0,#0 ldmia sp!,{r4-r12,lr} .Labrt: #if __ARM_ARCH__>=5 ret @ bx lr #else tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) #endif .size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key .global private_AES_set_decrypt_key .type private_AES_set_decrypt_key,%function .align 5 private_AES_set_decrypt_key: str lr,[sp,#-4]! @ push lr bl _armv4_AES_set_encrypt_key teq r0,#0 ldr lr,[sp],#4 @ pop lr bne .Labrt mov r0,r2 @ AES_set_encrypt_key preserves r2, mov r1,r2 @ which is AES_KEY *key b _armv4_AES_set_enc2dec_key .size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key @ void AES_set_enc2dec_key(const AES_KEY *inp,AES_KEY *out) .global AES_set_enc2dec_key .type AES_set_enc2dec_key,%function .align 5 AES_set_enc2dec_key: _armv4_AES_set_enc2dec_key: stmdb sp!,{r4-r12,lr} ldr $rounds,[r0,#240] mov $i1,r0 @ input add $i2,r0,$rounds,lsl#4 mov $key,r1 @ ouput add $tbl,r1,$rounds,lsl#4 str $rounds,[r1,#240] .Linv: ldr $s0,[$i1],#16 ldr $s1,[$i1,#-12] ldr $s2,[$i1,#-8] ldr $s3,[$i1,#-4] ldr $t1,[$i2],#-16 ldr $t2,[$i2,#16+4] ldr $t3,[$i2,#16+8] ldr $i3,[$i2,#16+12] str $s0,[$tbl],#-16 str $s1,[$tbl,#16+4] str $s2,[$tbl,#16+8] str $s3,[$tbl,#16+12] str $t1,[$key],#16 str $t2,[$key,#-12] str $t3,[$key,#-8] str $i3,[$key,#-4] teq $i1,$i2 bne .Linv ldr $s0,[$i1] ldr $s1,[$i1,#4] ldr $s2,[$i1,#8] ldr $s3,[$i1,#12] str $s0,[$key] str $s1,[$key,#4] str $s2,[$key,#8] str $s3,[$key,#12] sub $key,$key,$rounds,lsl#3 ___ $mask80=$i1; $mask1b=$i2; $mask7f=$i3; $code.=<<___; ldr $s0,[$key,#16]! @ prefetch tp1 mov $mask80,#0x80 mov $mask1b,#0x1b orr $mask80,$mask80,#0x8000 orr $mask1b,$mask1b,#0x1b00 orr $mask80,$mask80,$mask80,lsl#16 orr $mask1b,$mask1b,$mask1b,lsl#16 sub $rounds,$rounds,#1 mvn $mask7f,$mask80 mov $rounds,$rounds,lsl#2 @ (rounds-1)*4 .Lmix: and $t1,$s0,$mask80 and $s1,$s0,$mask7f sub $t1,$t1,$t1,lsr#7 and $t1,$t1,$mask1b eor $s1,$t1,$s1,lsl#1 @ tp2 and $t1,$s1,$mask80 and $s2,$s1,$mask7f sub $t1,$t1,$t1,lsr#7 and $t1,$t1,$mask1b eor $s2,$t1,$s2,lsl#1 @ tp4 and $t1,$s2,$mask80 and $s3,$s2,$mask7f sub $t1,$t1,$t1,lsr#7 and $t1,$t1,$mask1b eor $s3,$t1,$s3,lsl#1 @ tp8 eor $t1,$s1,$s2 eor $t2,$s0,$s3 @ tp9 eor $t1,$t1,$s3 @ tpe eor $t1,$t1,$s1,ror#24 eor $t1,$t1,$t2,ror#24 @ ^= ROTATE(tpb=tp9^tp2,8) eor $t1,$t1,$s2,ror#16 eor $t1,$t1,$t2,ror#16 @ ^= ROTATE(tpd=tp9^tp4,16) eor $t1,$t1,$t2,ror#8 @ ^= ROTATE(tp9,24) ldr $s0,[$key,#4] @ prefetch tp1 str $t1,[$key],#4 subs $rounds,$rounds,#1 bne .Lmix mov r0,#0 #if __ARM_ARCH__>=5 ldmia sp!,{r4-r12,pc} #else ldmia sp!,{r4-r12,lr} tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) #endif .size AES_set_enc2dec_key,.-AES_set_enc2dec_key .type AES_Td,%object .align 5 AES_Td: .word 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96 .word 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393 .word 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25 .word 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f .word 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1 .word 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6 .word 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da .word 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844 .word 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd .word 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4 .word 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45 .word 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94 .word 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7 .word 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a .word 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5 .word 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c .word 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1 .word 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a .word 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75 .word 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051 .word 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46 .word 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff .word 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77 .word 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb .word 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000 .word 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e .word 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927 .word 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a .word 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e .word 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16 .word 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d .word 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8 .word 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd .word 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34 .word 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163 .word 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120 .word 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d .word 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0 .word 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422 .word 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef .word 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36 .word 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4 .word 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662 .word 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5 .word 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3 .word 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b .word 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8 .word 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6 .word 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6 .word 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0 .word 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815 .word 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f .word 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df .word 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f .word 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e .word 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713 .word 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89 .word 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c .word 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf .word 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86 .word 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f .word 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541 .word 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190 .word 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742 @ Td4[256] .byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 .byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb .byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87 .byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb .byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d .byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e .byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2 .byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25 .byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16 .byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92 .byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda .byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84 .byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a .byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06 .byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02 .byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b .byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea .byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73 .byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85 .byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e .byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89 .byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b .byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20 .byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4 .byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 .byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f .byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d .byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef .byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 .byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 .byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 .byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d .size AES_Td,.-AES_Td @ void AES_decrypt(const unsigned char *in, unsigned char *out, @ const AES_KEY *key) { .global AES_decrypt .type AES_decrypt,%function .align 5 AES_decrypt: #if __ARM_ARCH__<7 sub r3,pc,#8 @ AES_decrypt #else - adr r3,AES_decrypt + adr r3,. #endif stmdb sp!,{r1,r4-r12,lr} mov $rounds,r0 @ inp mov $key,r2 sub $tbl,r3,#AES_decrypt-AES_Td @ Td #if __ARM_ARCH__<7 ldrb $s0,[$rounds,#3] @ load input data in endian-neutral ldrb $t1,[$rounds,#2] @ manner... ldrb $t2,[$rounds,#1] ldrb $t3,[$rounds,#0] orr $s0,$s0,$t1,lsl#8 ldrb $s1,[$rounds,#7] orr $s0,$s0,$t2,lsl#16 ldrb $t1,[$rounds,#6] orr $s0,$s0,$t3,lsl#24 ldrb $t2,[$rounds,#5] ldrb $t3,[$rounds,#4] orr $s1,$s1,$t1,lsl#8 ldrb $s2,[$rounds,#11] orr $s1,$s1,$t2,lsl#16 ldrb $t1,[$rounds,#10] orr $s1,$s1,$t3,lsl#24 ldrb $t2,[$rounds,#9] ldrb $t3,[$rounds,#8] orr $s2,$s2,$t1,lsl#8 ldrb $s3,[$rounds,#15] orr $s2,$s2,$t2,lsl#16 ldrb $t1,[$rounds,#14] orr $s2,$s2,$t3,lsl#24 ldrb $t2,[$rounds,#13] ldrb $t3,[$rounds,#12] orr $s3,$s3,$t1,lsl#8 orr $s3,$s3,$t2,lsl#16 orr $s3,$s3,$t3,lsl#24 #else ldr $s0,[$rounds,#0] ldr $s1,[$rounds,#4] ldr $s2,[$rounds,#8] ldr $s3,[$rounds,#12] #ifdef __ARMEL__ rev $s0,$s0 rev $s1,$s1 rev $s2,$s2 rev $s3,$s3 #endif #endif bl _armv4_AES_decrypt ldr $rounds,[sp],#4 @ pop out #if __ARM_ARCH__>=7 #ifdef __ARMEL__ rev $s0,$s0 rev $s1,$s1 rev $s2,$s2 rev $s3,$s3 #endif str $s0,[$rounds,#0] str $s1,[$rounds,#4] str $s2,[$rounds,#8] str $s3,[$rounds,#12] #else mov $t1,$s0,lsr#24 @ write output in endian-neutral mov $t2,$s0,lsr#16 @ manner... mov $t3,$s0,lsr#8 strb $t1,[$rounds,#0] strb $t2,[$rounds,#1] mov $t1,$s1,lsr#24 strb $t3,[$rounds,#2] mov $t2,$s1,lsr#16 strb $s0,[$rounds,#3] mov $t3,$s1,lsr#8 strb $t1,[$rounds,#4] strb $t2,[$rounds,#5] mov $t1,$s2,lsr#24 strb $t3,[$rounds,#6] mov $t2,$s2,lsr#16 strb $s1,[$rounds,#7] mov $t3,$s2,lsr#8 strb $t1,[$rounds,#8] strb $t2,[$rounds,#9] mov $t1,$s3,lsr#24 strb $t3,[$rounds,#10] mov $t2,$s3,lsr#16 strb $s2,[$rounds,#11] mov $t3,$s3,lsr#8 strb $t1,[$rounds,#12] strb $t2,[$rounds,#13] strb $t3,[$rounds,#14] strb $s3,[$rounds,#15] #endif #if __ARM_ARCH__>=5 ldmia sp!,{r4-r12,pc} #else ldmia sp!,{r4-r12,lr} tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) #endif .size AES_decrypt,.-AES_decrypt .type _armv4_AES_decrypt,%function .align 2 _armv4_AES_decrypt: str lr,[sp,#-4]! @ push lr ldmia $key!,{$t1-$i1} eor $s0,$s0,$t1 ldr $rounds,[$key,#240-16] eor $s1,$s1,$t2 eor $s2,$s2,$t3 eor $s3,$s3,$i1 sub $rounds,$rounds,#1 mov lr,#255 and $i1,lr,$s0,lsr#16 and $i2,lr,$s0,lsr#8 and $i3,lr,$s0 mov $s0,$s0,lsr#24 .Ldec_loop: ldr $t1,[$tbl,$i1,lsl#2] @ Td1[s0>>16] and $i1,lr,$s1 @ i0 ldr $t2,[$tbl,$i2,lsl#2] @ Td2[s0>>8] and $i2,lr,$s1,lsr#16 ldr $t3,[$tbl,$i3,lsl#2] @ Td3[s0>>0] and $i3,lr,$s1,lsr#8 ldr $s0,[$tbl,$s0,lsl#2] @ Td0[s0>>24] mov $s1,$s1,lsr#24 ldr $i1,[$tbl,$i1,lsl#2] @ Td3[s1>>0] ldr $i2,[$tbl,$i2,lsl#2] @ Td1[s1>>16] ldr $i3,[$tbl,$i3,lsl#2] @ Td2[s1>>8] eor $s0,$s0,$i1,ror#24 ldr $s1,[$tbl,$s1,lsl#2] @ Td0[s1>>24] and $i1,lr,$s2,lsr#8 @ i0 eor $t2,$i2,$t2,ror#8 and $i2,lr,$s2 @ i1 eor $t3,$i3,$t3,ror#8 and $i3,lr,$s2,lsr#16 ldr $i1,[$tbl,$i1,lsl#2] @ Td2[s2>>8] eor $s1,$s1,$t1,ror#8 ldr $i2,[$tbl,$i2,lsl#2] @ Td3[s2>>0] mov $s2,$s2,lsr#24 ldr $i3,[$tbl,$i3,lsl#2] @ Td1[s2>>16] eor $s0,$s0,$i1,ror#16 ldr $s2,[$tbl,$s2,lsl#2] @ Td0[s2>>24] and $i1,lr,$s3,lsr#16 @ i0 eor $s1,$s1,$i2,ror#24 and $i2,lr,$s3,lsr#8 @ i1 eor $t3,$i3,$t3,ror#8 and $i3,lr,$s3 @ i2 ldr $i1,[$tbl,$i1,lsl#2] @ Td1[s3>>16] eor $s2,$s2,$t2,ror#8 ldr $i2,[$tbl,$i2,lsl#2] @ Td2[s3>>8] mov $s3,$s3,lsr#24 ldr $i3,[$tbl,$i3,lsl#2] @ Td3[s3>>0] eor $s0,$s0,$i1,ror#8 ldr $i1,[$key],#16 eor $s1,$s1,$i2,ror#16 ldr $s3,[$tbl,$s3,lsl#2] @ Td0[s3>>24] eor $s2,$s2,$i3,ror#24 ldr $t1,[$key,#-12] eor $s0,$s0,$i1 ldr $t2,[$key,#-8] eor $s3,$s3,$t3,ror#8 ldr $t3,[$key,#-4] and $i1,lr,$s0,lsr#16 eor $s1,$s1,$t1 and $i2,lr,$s0,lsr#8 eor $s2,$s2,$t2 and $i3,lr,$s0 eor $s3,$s3,$t3 mov $s0,$s0,lsr#24 subs $rounds,$rounds,#1 bne .Ldec_loop add $tbl,$tbl,#1024 ldr $t2,[$tbl,#0] @ prefetch Td4 ldr $t3,[$tbl,#32] ldr $t1,[$tbl,#64] ldr $t2,[$tbl,#96] ldr $t3,[$tbl,#128] ldr $t1,[$tbl,#160] ldr $t2,[$tbl,#192] ldr $t3,[$tbl,#224] ldrb $s0,[$tbl,$s0] @ Td4[s0>>24] ldrb $t1,[$tbl,$i1] @ Td4[s0>>16] and $i1,lr,$s1 @ i0 ldrb $t2,[$tbl,$i2] @ Td4[s0>>8] and $i2,lr,$s1,lsr#16 ldrb $t3,[$tbl,$i3] @ Td4[s0>>0] and $i3,lr,$s1,lsr#8 add $s1,$tbl,$s1,lsr#24 ldrb $i1,[$tbl,$i1] @ Td4[s1>>0] ldrb $s1,[$s1] @ Td4[s1>>24] ldrb $i2,[$tbl,$i2] @ Td4[s1>>16] eor $s0,$i1,$s0,lsl#24 ldrb $i3,[$tbl,$i3] @ Td4[s1>>8] eor $s1,$t1,$s1,lsl#8 and $i1,lr,$s2,lsr#8 @ i0 eor $t2,$t2,$i2,lsl#8 and $i2,lr,$s2 @ i1 ldrb $i1,[$tbl,$i1] @ Td4[s2>>8] eor $t3,$t3,$i3,lsl#8 ldrb $i2,[$tbl,$i2] @ Td4[s2>>0] and $i3,lr,$s2,lsr#16 add $s2,$tbl,$s2,lsr#24 ldrb $s2,[$s2] @ Td4[s2>>24] eor $s0,$s0,$i1,lsl#8 ldrb $i3,[$tbl,$i3] @ Td4[s2>>16] eor $s1,$i2,$s1,lsl#16 and $i1,lr,$s3,lsr#16 @ i0 eor $s2,$t2,$s2,lsl#16 and $i2,lr,$s3,lsr#8 @ i1 ldrb $i1,[$tbl,$i1] @ Td4[s3>>16] eor $t3,$t3,$i3,lsl#16 ldrb $i2,[$tbl,$i2] @ Td4[s3>>8] and $i3,lr,$s3 @ i2 add $s3,$tbl,$s3,lsr#24 ldrb $i3,[$tbl,$i3] @ Td4[s3>>0] ldrb $s3,[$s3] @ Td4[s3>>24] eor $s0,$s0,$i1,lsl#16 ldr $i1,[$key,#0] eor $s1,$s1,$i2,lsl#8 ldr $t1,[$key,#4] eor $s2,$i3,$s2,lsl#8 ldr $t2,[$key,#8] eor $s3,$t3,$s3,lsl#24 ldr $t3,[$key,#12] eor $s0,$s0,$i1 eor $s1,$s1,$t1 eor $s2,$s2,$t2 eor $s3,$s3,$t3 sub $tbl,$tbl,#1024 ldr pc,[sp],#4 @ pop and return .size _armv4_AES_decrypt,.-_armv4_AES_decrypt .asciz "AES for ARMv4, CRYPTOGAMS by " .align 2 ___ $code =~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compile with -march=armv4 $code =~ s/\bret\b/bx\tlr/gm; open SELF,$0; while() { next if (/^#!/); last if (!s/^#/@/ and !/^$/); print; } close SELF; print $code; close STDOUT; # enforce flush diff --git a/crypto/aes/asm/bsaes-armv7.pl b/crypto/aes/asm/bsaes-armv7.pl index 70b3f9656f4f..ec66b0502a64 100755 --- a/crypto/aes/asm/bsaes-armv7.pl +++ b/crypto/aes/asm/bsaes-armv7.pl @@ -1,2451 +1,2451 @@ #!/usr/bin/env perl # ==================================================================== # Written by Andy Polyakov for the OpenSSL # project. The module is, however, dual licensed under OpenSSL and # CRYPTOGAMS licenses depending on where you obtain it. For further # details see http://www.openssl.org/~appro/cryptogams/. # # Specific modes and adaptation for Linux kernel by Ard Biesheuvel # . Permission to use under GPL terms is # granted. # ==================================================================== # Bit-sliced AES for ARM NEON # # February 2012. # # This implementation is direct adaptation of bsaes-x86_64 module for # ARM NEON. Except that this module is endian-neutral [in sense that # it can be compiled for either endianness] by courtesy of vld1.8's # neutrality. Initial version doesn't implement interface to OpenSSL, # only low-level primitives and unsupported entry points, just enough # to collect performance results, which for Cortex-A8 core are: # # encrypt 19.5 cycles per byte processed with 128-bit key # decrypt 22.1 cycles per byte processed with 128-bit key # key conv. 440 cycles per 128-bit key/0.18 of 8x block # # Snapdragon S4 encrypts byte in 17.6 cycles and decrypts in 19.7, # which is [much] worse than anticipated (for further details see # http://www.openssl.org/~appro/Snapdragon-S4.html). # # Cortex-A15 manages in 14.2/16.1 cycles [when integer-only code # manages in 20.0 cycles]. # # When comparing to x86_64 results keep in mind that NEON unit is # [mostly] single-issue and thus can't [fully] benefit from # instruction-level parallelism. And when comparing to aes-armv4 # results keep in mind key schedule conversion overhead (see # bsaes-x86_64.pl for further details)... # # # April-August 2013 # # Add CBC, CTR and XTS subroutines, adapt for kernel use. # # while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} open STDOUT,">$output"; my ($inp,$out,$len,$key)=("r0","r1","r2","r3"); my @XMM=map("q$_",(0..15)); { my ($key,$rounds,$const)=("r4","r5","r6"); sub Dlo() { shift=~m|q([1]?[0-9])|?"d".($1*2):""; } sub Dhi() { shift=~m|q([1]?[0-9])|?"d".($1*2+1):""; } sub Sbox { # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb # output in lsb > [b0, b1, b4, b6, b3, b7, b2, b5] < msb my @b=@_[0..7]; my @t=@_[8..11]; my @s=@_[12..15]; &InBasisChange (@b); &Inv_GF256 (@b[6,5,0,3,7,1,4,2],@t,@s); &OutBasisChange (@b[7,1,4,2,6,5,0,3]); } sub InBasisChange { # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb # output in lsb > [b6, b5, b0, b3, b7, b1, b4, b2] < msb my @b=@_[0..7]; $code.=<<___; veor @b[2], @b[2], @b[1] veor @b[5], @b[5], @b[6] veor @b[3], @b[3], @b[0] veor @b[6], @b[6], @b[2] veor @b[5], @b[5], @b[0] veor @b[6], @b[6], @b[3] veor @b[3], @b[3], @b[7] veor @b[7], @b[7], @b[5] veor @b[3], @b[3], @b[4] veor @b[4], @b[4], @b[5] veor @b[2], @b[2], @b[7] veor @b[3], @b[3], @b[1] veor @b[1], @b[1], @b[5] ___ } sub OutBasisChange { # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb # output in lsb > [b6, b1, b2, b4, b7, b0, b3, b5] < msb my @b=@_[0..7]; $code.=<<___; veor @b[0], @b[0], @b[6] veor @b[1], @b[1], @b[4] veor @b[4], @b[4], @b[6] veor @b[2], @b[2], @b[0] veor @b[6], @b[6], @b[1] veor @b[1], @b[1], @b[5] veor @b[5], @b[5], @b[3] veor @b[3], @b[3], @b[7] veor @b[7], @b[7], @b[5] veor @b[2], @b[2], @b[5] veor @b[4], @b[4], @b[7] ___ } sub InvSbox { # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb # output in lsb > [b0, b1, b6, b4, b2, b7, b3, b5] < msb my @b=@_[0..7]; my @t=@_[8..11]; my @s=@_[12..15]; &InvInBasisChange (@b); &Inv_GF256 (@b[5,1,2,6,3,7,0,4],@t,@s); &InvOutBasisChange (@b[3,7,0,4,5,1,2,6]); } sub InvInBasisChange { # OutBasisChange in reverse (with twist) my @b=@_[5,1,2,6,3,7,0,4]; $code.=<<___ veor @b[1], @b[1], @b[7] veor @b[4], @b[4], @b[7] veor @b[7], @b[7], @b[5] veor @b[1], @b[1], @b[3] veor @b[2], @b[2], @b[5] veor @b[3], @b[3], @b[7] veor @b[6], @b[6], @b[1] veor @b[2], @b[2], @b[0] veor @b[5], @b[5], @b[3] veor @b[4], @b[4], @b[6] veor @b[0], @b[0], @b[6] veor @b[1], @b[1], @b[4] ___ } sub InvOutBasisChange { # InBasisChange in reverse my @b=@_[2,5,7,3,6,1,0,4]; $code.=<<___; veor @b[1], @b[1], @b[5] veor @b[2], @b[2], @b[7] veor @b[3], @b[3], @b[1] veor @b[4], @b[4], @b[5] veor @b[7], @b[7], @b[5] veor @b[3], @b[3], @b[4] veor @b[5], @b[5], @b[0] veor @b[3], @b[3], @b[7] veor @b[6], @b[6], @b[2] veor @b[2], @b[2], @b[1] veor @b[6], @b[6], @b[3] veor @b[3], @b[3], @b[0] veor @b[5], @b[5], @b[6] ___ } sub Mul_GF4 { #;************************************************************* #;* Mul_GF4: Input x0-x1,y0-y1 Output x0-x1 Temp t0 (8) * #;************************************************************* my ($x0,$x1,$y0,$y1,$t0,$t1)=@_; $code.=<<___; veor $t0, $y0, $y1 vand $t0, $t0, $x0 veor $x0, $x0, $x1 vand $t1, $x1, $y0 vand $x0, $x0, $y1 veor $x1, $t1, $t0 veor $x0, $x0, $t1 ___ } sub Mul_GF4_N { # not used, see next subroutine # multiply and scale by N my ($x0,$x1,$y0,$y1,$t0)=@_; $code.=<<___; veor $t0, $y0, $y1 vand $t0, $t0, $x0 veor $x0, $x0, $x1 vand $x1, $x1, $y0 vand $x0, $x0, $y1 veor $x1, $x1, $x0 veor $x0, $x0, $t0 ___ } sub Mul_GF4_N_GF4 { # interleaved Mul_GF4_N and Mul_GF4 my ($x0,$x1,$y0,$y1,$t0, $x2,$x3,$y2,$y3,$t1)=@_; $code.=<<___; veor $t0, $y0, $y1 veor $t1, $y2, $y3 vand $t0, $t0, $x0 vand $t1, $t1, $x2 veor $x0, $x0, $x1 veor $x2, $x2, $x3 vand $x1, $x1, $y0 vand $x3, $x3, $y2 vand $x0, $x0, $y1 vand $x2, $x2, $y3 veor $x1, $x1, $x0 veor $x2, $x2, $x3 veor $x0, $x0, $t0 veor $x3, $x3, $t1 ___ } sub Mul_GF16_2 { my @x=@_[0..7]; my @y=@_[8..11]; my @t=@_[12..15]; $code.=<<___; veor @t[0], @x[0], @x[2] veor @t[1], @x[1], @x[3] ___ &Mul_GF4 (@x[0], @x[1], @y[0], @y[1], @t[2..3]); $code.=<<___; veor @y[0], @y[0], @y[2] veor @y[1], @y[1], @y[3] ___ Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3], @x[2], @x[3], @y[2], @y[3], @t[2]); $code.=<<___; veor @x[0], @x[0], @t[0] veor @x[2], @x[2], @t[0] veor @x[1], @x[1], @t[1] veor @x[3], @x[3], @t[1] veor @t[0], @x[4], @x[6] veor @t[1], @x[5], @x[7] ___ &Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3], @x[6], @x[7], @y[2], @y[3], @t[2]); $code.=<<___; veor @y[0], @y[0], @y[2] veor @y[1], @y[1], @y[3] ___ &Mul_GF4 (@x[4], @x[5], @y[0], @y[1], @t[2..3]); $code.=<<___; veor @x[4], @x[4], @t[0] veor @x[6], @x[6], @t[0] veor @x[5], @x[5], @t[1] veor @x[7], @x[7], @t[1] ___ } sub Inv_GF256 { #;******************************************************************** #;* Inv_GF256: Input x0-x7 Output x0-x7 Temp t0-t3,s0-s3 (144) * #;******************************************************************** my @x=@_[0..7]; my @t=@_[8..11]; my @s=@_[12..15]; # direct optimizations from hardware $code.=<<___; veor @t[3], @x[4], @x[6] veor @t[2], @x[5], @x[7] veor @t[1], @x[1], @x[3] veor @s[1], @x[7], @x[6] vmov @t[0], @t[2] veor @s[0], @x[0], @x[2] vorr @t[2], @t[2], @t[1] veor @s[3], @t[3], @t[0] vand @s[2], @t[3], @s[0] vorr @t[3], @t[3], @s[0] veor @s[0], @s[0], @t[1] vand @t[0], @t[0], @t[1] veor @t[1], @x[3], @x[2] vand @s[3], @s[3], @s[0] vand @s[1], @s[1], @t[1] veor @t[1], @x[4], @x[5] veor @s[0], @x[1], @x[0] veor @t[3], @t[3], @s[1] veor @t[2], @t[2], @s[1] vand @s[1], @t[1], @s[0] vorr @t[1], @t[1], @s[0] veor @t[3], @t[3], @s[3] veor @t[0], @t[0], @s[1] veor @t[2], @t[2], @s[2] veor @t[1], @t[1], @s[3] veor @t[0], @t[0], @s[2] vand @s[0], @x[7], @x[3] veor @t[1], @t[1], @s[2] vand @s[1], @x[6], @x[2] vand @s[2], @x[5], @x[1] vorr @s[3], @x[4], @x[0] veor @t[3], @t[3], @s[0] veor @t[1], @t[1], @s[2] veor @t[0], @t[0], @s[3] veor @t[2], @t[2], @s[1] @ Inv_GF16 \t0, \t1, \t2, \t3, \s0, \s1, \s2, \s3 @ new smaller inversion vand @s[2], @t[3], @t[1] vmov @s[0], @t[0] veor @s[1], @t[2], @s[2] veor @s[3], @t[0], @s[2] veor @s[2], @t[0], @s[2] @ @s[2]=@s[3] vbsl @s[1], @t[1], @t[0] vbsl @s[3], @t[3], @t[2] veor @t[3], @t[3], @t[2] vbsl @s[0], @s[1], @s[2] vbsl @t[0], @s[2], @s[1] vand @s[2], @s[0], @s[3] veor @t[1], @t[1], @t[0] veor @s[2], @s[2], @t[3] ___ # output in s3, s2, s1, t1 # Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \t2, \t3, \t0, \t1, \s0, \s1, \s2, \s3 # Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \s3, \s2, \s1, \t1, \s0, \t0, \t2, \t3 &Mul_GF16_2(@x,@s[3,2,1],@t[1],@s[0],@t[0,2,3]); ### output msb > [x3,x2,x1,x0,x7,x6,x5,x4] < lsb } # AES linear components sub ShiftRows { my @x=@_[0..7]; my @t=@_[8..11]; my $mask=pop; $code.=<<___; vldmia $key!, {@t[0]-@t[3]} veor @t[0], @t[0], @x[0] veor @t[1], @t[1], @x[1] vtbl.8 `&Dlo(@x[0])`, {@t[0]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[0])`, {@t[0]}, `&Dhi($mask)` vldmia $key!, {@t[0]} veor @t[2], @t[2], @x[2] vtbl.8 `&Dlo(@x[1])`, {@t[1]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[1])`, {@t[1]}, `&Dhi($mask)` vldmia $key!, {@t[1]} veor @t[3], @t[3], @x[3] vtbl.8 `&Dlo(@x[2])`, {@t[2]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[2])`, {@t[2]}, `&Dhi($mask)` vldmia $key!, {@t[2]} vtbl.8 `&Dlo(@x[3])`, {@t[3]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[3])`, {@t[3]}, `&Dhi($mask)` vldmia $key!, {@t[3]} veor @t[0], @t[0], @x[4] veor @t[1], @t[1], @x[5] vtbl.8 `&Dlo(@x[4])`, {@t[0]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[4])`, {@t[0]}, `&Dhi($mask)` veor @t[2], @t[2], @x[6] vtbl.8 `&Dlo(@x[5])`, {@t[1]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[5])`, {@t[1]}, `&Dhi($mask)` veor @t[3], @t[3], @x[7] vtbl.8 `&Dlo(@x[6])`, {@t[2]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[6])`, {@t[2]}, `&Dhi($mask)` vtbl.8 `&Dlo(@x[7])`, {@t[3]}, `&Dlo($mask)` vtbl.8 `&Dhi(@x[7])`, {@t[3]}, `&Dhi($mask)` ___ } sub MixColumns { # modified to emit output in order suitable for feeding back to aesenc[last] my @x=@_[0..7]; my @t=@_[8..15]; my $inv=@_[16]; # optional $code.=<<___; vext.8 @t[0], @x[0], @x[0], #12 @ x0 <<< 32 vext.8 @t[1], @x[1], @x[1], #12 veor @x[0], @x[0], @t[0] @ x0 ^ (x0 <<< 32) vext.8 @t[2], @x[2], @x[2], #12 veor @x[1], @x[1], @t[1] vext.8 @t[3], @x[3], @x[3], #12 veor @x[2], @x[2], @t[2] vext.8 @t[4], @x[4], @x[4], #12 veor @x[3], @x[3], @t[3] vext.8 @t[5], @x[5], @x[5], #12 veor @x[4], @x[4], @t[4] vext.8 @t[6], @x[6], @x[6], #12 veor @x[5], @x[5], @t[5] vext.8 @t[7], @x[7], @x[7], #12 veor @x[6], @x[6], @t[6] veor @t[1], @t[1], @x[0] veor @x[7], @x[7], @t[7] vext.8 @x[0], @x[0], @x[0], #8 @ (x0 ^ (x0 <<< 32)) <<< 64) veor @t[2], @t[2], @x[1] veor @t[0], @t[0], @x[7] veor @t[1], @t[1], @x[7] vext.8 @x[1], @x[1], @x[1], #8 veor @t[5], @t[5], @x[4] veor @x[0], @x[0], @t[0] veor @t[6], @t[6], @x[5] veor @x[1], @x[1], @t[1] vext.8 @t[0], @x[4], @x[4], #8 veor @t[4], @t[4], @x[3] vext.8 @t[1], @x[5], @x[5], #8 veor @t[7], @t[7], @x[6] vext.8 @x[4], @x[3], @x[3], #8 veor @t[3], @t[3], @x[2] vext.8 @x[5], @x[7], @x[7], #8 veor @t[4], @t[4], @x[7] vext.8 @x[3], @x[6], @x[6], #8 veor @t[3], @t[3], @x[7] vext.8 @x[6], @x[2], @x[2], #8 veor @x[7], @t[1], @t[5] ___ $code.=<<___ if (!$inv); veor @x[2], @t[0], @t[4] veor @x[4], @x[4], @t[3] veor @x[5], @x[5], @t[7] veor @x[3], @x[3], @t[6] @ vmov @x[2], @t[0] veor @x[6], @x[6], @t[2] @ vmov @x[7], @t[1] ___ $code.=<<___ if ($inv); veor @t[3], @t[3], @x[4] veor @x[5], @x[5], @t[7] veor @x[2], @x[3], @t[6] veor @x[3], @t[0], @t[4] veor @x[4], @x[6], @t[2] vmov @x[6], @t[3] @ vmov @x[7], @t[1] ___ } sub InvMixColumns_orig { my @x=@_[0..7]; my @t=@_[8..15]; $code.=<<___; @ multiplication by 0x0e vext.8 @t[7], @x[7], @x[7], #12 vmov @t[2], @x[2] veor @x[2], @x[2], @x[5] @ 2 5 veor @x[7], @x[7], @x[5] @ 7 5 vext.8 @t[0], @x[0], @x[0], #12 vmov @t[5], @x[5] veor @x[5], @x[5], @x[0] @ 5 0 [1] veor @x[0], @x[0], @x[1] @ 0 1 vext.8 @t[1], @x[1], @x[1], #12 veor @x[1], @x[1], @x[2] @ 1 25 veor @x[0], @x[0], @x[6] @ 01 6 [2] vext.8 @t[3], @x[3], @x[3], #12 veor @x[1], @x[1], @x[3] @ 125 3 [4] veor @x[2], @x[2], @x[0] @ 25 016 [3] veor @x[3], @x[3], @x[7] @ 3 75 veor @x[7], @x[7], @x[6] @ 75 6 [0] vext.8 @t[6], @x[6], @x[6], #12 vmov @t[4], @x[4] veor @x[6], @x[6], @x[4] @ 6 4 veor @x[4], @x[4], @x[3] @ 4 375 [6] veor @x[3], @x[3], @x[7] @ 375 756=36 veor @x[6], @x[6], @t[5] @ 64 5 [7] veor @x[3], @x[3], @t[2] @ 36 2 vext.8 @t[5], @t[5], @t[5], #12 veor @x[3], @x[3], @t[4] @ 362 4 [5] ___ my @y = @x[7,5,0,2,1,3,4,6]; $code.=<<___; @ multiplication by 0x0b veor @y[1], @y[1], @y[0] veor @y[0], @y[0], @t[0] vext.8 @t[2], @t[2], @t[2], #12 veor @y[1], @y[1], @t[1] veor @y[0], @y[0], @t[5] vext.8 @t[4], @t[4], @t[4], #12 veor @y[1], @y[1], @t[6] veor @y[0], @y[0], @t[7] veor @t[7], @t[7], @t[6] @ clobber t[7] veor @y[3], @y[3], @t[0] veor @y[1], @y[1], @y[0] vext.8 @t[0], @t[0], @t[0], #12 veor @y[2], @y[2], @t[1] veor @y[4], @y[4], @t[1] vext.8 @t[1], @t[1], @t[1], #12 veor @y[2], @y[2], @t[2] veor @y[3], @y[3], @t[2] veor @y[5], @y[5], @t[2] veor @y[2], @y[2], @t[7] vext.8 @t[2], @t[2], @t[2], #12 veor @y[3], @y[3], @t[3] veor @y[6], @y[6], @t[3] veor @y[4], @y[4], @t[3] veor @y[7], @y[7], @t[4] vext.8 @t[3], @t[3], @t[3], #12 veor @y[5], @y[5], @t[4] veor @y[7], @y[7], @t[7] veor @t[7], @t[7], @t[5] @ clobber t[7] even more veor @y[3], @y[3], @t[5] veor @y[4], @y[4], @t[4] veor @y[5], @y[5], @t[7] vext.8 @t[4], @t[4], @t[4], #12 veor @y[6], @y[6], @t[7] veor @y[4], @y[4], @t[7] veor @t[7], @t[7], @t[5] vext.8 @t[5], @t[5], @t[5], #12 @ multiplication by 0x0d veor @y[4], @y[4], @y[7] veor @t[7], @t[7], @t[6] @ restore t[7] veor @y[7], @y[7], @t[4] vext.8 @t[6], @t[6], @t[6], #12 veor @y[2], @y[2], @t[0] veor @y[7], @y[7], @t[5] vext.8 @t[7], @t[7], @t[7], #12 veor @y[2], @y[2], @t[2] veor @y[3], @y[3], @y[1] veor @y[1], @y[1], @t[1] veor @y[0], @y[0], @t[0] veor @y[3], @y[3], @t[0] veor @y[1], @y[1], @t[5] veor @y[0], @y[0], @t[5] vext.8 @t[0], @t[0], @t[0], #12 veor @y[1], @y[1], @t[7] veor @y[0], @y[0], @t[6] veor @y[3], @y[3], @y[1] veor @y[4], @y[4], @t[1] vext.8 @t[1], @t[1], @t[1], #12 veor @y[7], @y[7], @t[7] veor @y[4], @y[4], @t[2] veor @y[5], @y[5], @t[2] veor @y[2], @y[2], @t[6] veor @t[6], @t[6], @t[3] @ clobber t[6] vext.8 @t[2], @t[2], @t[2], #12 veor @y[4], @y[4], @y[7] veor @y[3], @y[3], @t[6] veor @y[6], @y[6], @t[6] veor @y[5], @y[5], @t[5] vext.8 @t[5], @t[5], @t[5], #12 veor @y[6], @y[6], @t[4] vext.8 @t[4], @t[4], @t[4], #12 veor @y[5], @y[5], @t[6] veor @y[6], @y[6], @t[7] vext.8 @t[7], @t[7], @t[7], #12 veor @t[6], @t[6], @t[3] @ restore t[6] vext.8 @t[3], @t[3], @t[3], #12 @ multiplication by 0x09 veor @y[4], @y[4], @y[1] veor @t[1], @t[1], @y[1] @ t[1]=y[1] veor @t[0], @t[0], @t[5] @ clobber t[0] vext.8 @t[6], @t[6], @t[6], #12 veor @t[1], @t[1], @t[5] veor @y[3], @y[3], @t[0] veor @t[0], @t[0], @y[0] @ t[0]=y[0] veor @t[1], @t[1], @t[6] veor @t[6], @t[6], @t[7] @ clobber t[6] veor @y[4], @y[4], @t[1] veor @y[7], @y[7], @t[4] veor @y[6], @y[6], @t[3] veor @y[5], @y[5], @t[2] veor @t[4], @t[4], @y[4] @ t[4]=y[4] veor @t[3], @t[3], @y[3] @ t[3]=y[3] veor @t[5], @t[5], @y[5] @ t[5]=y[5] veor @t[2], @t[2], @y[2] @ t[2]=y[2] veor @t[3], @t[3], @t[7] veor @XMM[5], @t[5], @t[6] veor @XMM[6], @t[6], @y[6] @ t[6]=y[6] veor @XMM[2], @t[2], @t[6] veor @XMM[7], @t[7], @y[7] @ t[7]=y[7] vmov @XMM[0], @t[0] vmov @XMM[1], @t[1] @ vmov @XMM[2], @t[2] vmov @XMM[3], @t[3] vmov @XMM[4], @t[4] @ vmov @XMM[5], @t[5] @ vmov @XMM[6], @t[6] @ vmov @XMM[7], @t[7] ___ } sub InvMixColumns { my @x=@_[0..7]; my @t=@_[8..15]; # Thanks to Jussi Kivilinna for providing pointer to # # | 0e 0b 0d 09 | | 02 03 01 01 | | 05 00 04 00 | # | 09 0e 0b 0d | = | 01 02 03 01 | x | 00 05 00 04 | # | 0d 09 0e 0b | | 01 01 02 03 | | 04 00 05 00 | # | 0b 0d 09 0e | | 03 01 01 02 | | 00 04 00 05 | $code.=<<___; @ multiplication by 0x05-0x00-0x04-0x00 vext.8 @t[0], @x[0], @x[0], #8 vext.8 @t[6], @x[6], @x[6], #8 vext.8 @t[7], @x[7], @x[7], #8 veor @t[0], @t[0], @x[0] vext.8 @t[1], @x[1], @x[1], #8 veor @t[6], @t[6], @x[6] vext.8 @t[2], @x[2], @x[2], #8 veor @t[7], @t[7], @x[7] vext.8 @t[3], @x[3], @x[3], #8 veor @t[1], @t[1], @x[1] vext.8 @t[4], @x[4], @x[4], #8 veor @t[2], @t[2], @x[2] vext.8 @t[5], @x[5], @x[5], #8 veor @t[3], @t[3], @x[3] veor @t[4], @t[4], @x[4] veor @t[5], @t[5], @x[5] veor @x[0], @x[0], @t[6] veor @x[1], @x[1], @t[6] veor @x[2], @x[2], @t[0] veor @x[4], @x[4], @t[2] veor @x[3], @x[3], @t[1] veor @x[1], @x[1], @t[7] veor @x[2], @x[2], @t[7] veor @x[4], @x[4], @t[6] veor @x[5], @x[5], @t[3] veor @x[3], @x[3], @t[6] veor @x[6], @x[6], @t[4] veor @x[4], @x[4], @t[7] veor @x[5], @x[5], @t[7] veor @x[7], @x[7], @t[5] ___ &MixColumns (@x,@t,1); # flipped 2<->3 and 4<->6 } sub swapmove { my ($a,$b,$n,$mask,$t)=@_; $code.=<<___; vshr.u64 $t, $b, #$n veor $t, $t, $a vand $t, $t, $mask veor $a, $a, $t vshl.u64 $t, $t, #$n veor $b, $b, $t ___ } sub swapmove2x { my ($a0,$b0,$a1,$b1,$n,$mask,$t0,$t1)=@_; $code.=<<___; vshr.u64 $t0, $b0, #$n vshr.u64 $t1, $b1, #$n veor $t0, $t0, $a0 veor $t1, $t1, $a1 vand $t0, $t0, $mask vand $t1, $t1, $mask veor $a0, $a0, $t0 vshl.u64 $t0, $t0, #$n veor $a1, $a1, $t1 vshl.u64 $t1, $t1, #$n veor $b0, $b0, $t0 veor $b1, $b1, $t1 ___ } sub bitslice { my @x=reverse(@_[0..7]); my ($t0,$t1,$t2,$t3)=@_[8..11]; $code.=<<___; vmov.i8 $t0,#0x55 @ compose .LBS0 vmov.i8 $t1,#0x33 @ compose .LBS1 ___ &swapmove2x(@x[0,1,2,3],1,$t0,$t2,$t3); &swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3); $code.=<<___; vmov.i8 $t0,#0x0f @ compose .LBS2 ___ &swapmove2x(@x[0,2,1,3],2,$t1,$t2,$t3); &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3); &swapmove2x(@x[0,4,1,5],4,$t0,$t2,$t3); &swapmove2x(@x[2,6,3,7],4,$t0,$t2,$t3); } $code.=<<___; #ifndef __KERNEL__ # include "arm_arch.h" # define VFP_ABI_PUSH vstmdb sp!,{d8-d15} # define VFP_ABI_POP vldmia sp!,{d8-d15} # define VFP_ABI_FRAME 0x40 #else # define VFP_ABI_PUSH # define VFP_ABI_POP # define VFP_ABI_FRAME 0 # define BSAES_ASM_EXTENDED_KEY # define XTS_CHAIN_TWEAK # define __ARM_ARCH__ __LINUX_ARM_ARCH__ # define __ARM_MAX_ARCH__ __LINUX_ARM_ARCH__ #endif #ifdef __thumb__ # define adrl adr #endif #if __ARM_MAX_ARCH__>=7 .arch armv7-a .fpu neon .text .syntax unified @ ARMv7-capable assembler is expected to handle this #ifdef __thumb2__ .thumb #else .code 32 #endif .type _bsaes_decrypt8,%function .align 4 _bsaes_decrypt8: - adr $const,_bsaes_decrypt8 + adr $const,. vldmia $key!, {@XMM[9]} @ round 0 key add $const,$const,#.LM0ISR-_bsaes_decrypt8 vldmia $const!, {@XMM[8]} @ .LM0ISR veor @XMM[10], @XMM[0], @XMM[9] @ xor with round0 key veor @XMM[11], @XMM[1], @XMM[9] vtbl.8 `&Dlo(@XMM[0])`, {@XMM[10]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[0])`, {@XMM[10]}, `&Dhi(@XMM[8])` veor @XMM[12], @XMM[2], @XMM[9] vtbl.8 `&Dlo(@XMM[1])`, {@XMM[11]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[1])`, {@XMM[11]}, `&Dhi(@XMM[8])` veor @XMM[13], @XMM[3], @XMM[9] vtbl.8 `&Dlo(@XMM[2])`, {@XMM[12]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[2])`, {@XMM[12]}, `&Dhi(@XMM[8])` veor @XMM[14], @XMM[4], @XMM[9] vtbl.8 `&Dlo(@XMM[3])`, {@XMM[13]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[3])`, {@XMM[13]}, `&Dhi(@XMM[8])` veor @XMM[15], @XMM[5], @XMM[9] vtbl.8 `&Dlo(@XMM[4])`, {@XMM[14]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[4])`, {@XMM[14]}, `&Dhi(@XMM[8])` veor @XMM[10], @XMM[6], @XMM[9] vtbl.8 `&Dlo(@XMM[5])`, {@XMM[15]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[5])`, {@XMM[15]}, `&Dhi(@XMM[8])` veor @XMM[11], @XMM[7], @XMM[9] vtbl.8 `&Dlo(@XMM[6])`, {@XMM[10]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[6])`, {@XMM[10]}, `&Dhi(@XMM[8])` vtbl.8 `&Dlo(@XMM[7])`, {@XMM[11]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[7])`, {@XMM[11]}, `&Dhi(@XMM[8])` ___ &bitslice (@XMM[0..7, 8..11]); $code.=<<___; sub $rounds,$rounds,#1 b .Ldec_sbox .align 4 .Ldec_loop: ___ &ShiftRows (@XMM[0..7, 8..12]); $code.=".Ldec_sbox:\n"; &InvSbox (@XMM[0..7, 8..15]); $code.=<<___; subs $rounds,$rounds,#1 bcc .Ldec_done ___ &InvMixColumns (@XMM[0,1,6,4,2,7,3,5, 8..15]); $code.=<<___; vldmia $const, {@XMM[12]} @ .LISR ite eq @ Thumb2 thing, sanity check in ARM addeq $const,$const,#0x10 bne .Ldec_loop vldmia $const, {@XMM[12]} @ .LISRM0 b .Ldec_loop .align 4 .Ldec_done: ___ &bitslice (@XMM[0,1,6,4,2,7,3,5, 8..11]); $code.=<<___; vldmia $key, {@XMM[8]} @ last round key veor @XMM[6], @XMM[6], @XMM[8] veor @XMM[4], @XMM[4], @XMM[8] veor @XMM[2], @XMM[2], @XMM[8] veor @XMM[7], @XMM[7], @XMM[8] veor @XMM[3], @XMM[3], @XMM[8] veor @XMM[5], @XMM[5], @XMM[8] veor @XMM[0], @XMM[0], @XMM[8] veor @XMM[1], @XMM[1], @XMM[8] bx lr .size _bsaes_decrypt8,.-_bsaes_decrypt8 .type _bsaes_const,%object .align 6 _bsaes_const: .LM0ISR: @ InvShiftRows constants .quad 0x0a0e0206070b0f03, 0x0004080c0d010509 .LISR: .quad 0x0504070602010003, 0x0f0e0d0c080b0a09 .LISRM0: .quad 0x01040b0e0205080f, 0x0306090c00070a0d .LM0SR: @ ShiftRows constants .quad 0x0a0e02060f03070b, 0x0004080c05090d01 .LSR: .quad 0x0504070600030201, 0x0f0e0d0c0a09080b .LSRM0: .quad 0x0304090e00050a0f, 0x01060b0c0207080d .LM0: .quad 0x02060a0e03070b0f, 0x0004080c0105090d .LREVM0SR: .quad 0x090d01050c000408, 0x03070b0f060a0e02 .asciz "Bit-sliced AES for NEON, CRYPTOGAMS by " .align 6 .size _bsaes_const,.-_bsaes_const .type _bsaes_encrypt8,%function .align 4 _bsaes_encrypt8: - adr $const,_bsaes_encrypt8 + adr $const,. vldmia $key!, {@XMM[9]} @ round 0 key sub $const,$const,#_bsaes_encrypt8-.LM0SR vldmia $const!, {@XMM[8]} @ .LM0SR _bsaes_encrypt8_alt: veor @XMM[10], @XMM[0], @XMM[9] @ xor with round0 key veor @XMM[11], @XMM[1], @XMM[9] vtbl.8 `&Dlo(@XMM[0])`, {@XMM[10]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[0])`, {@XMM[10]}, `&Dhi(@XMM[8])` veor @XMM[12], @XMM[2], @XMM[9] vtbl.8 `&Dlo(@XMM[1])`, {@XMM[11]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[1])`, {@XMM[11]}, `&Dhi(@XMM[8])` veor @XMM[13], @XMM[3], @XMM[9] vtbl.8 `&Dlo(@XMM[2])`, {@XMM[12]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[2])`, {@XMM[12]}, `&Dhi(@XMM[8])` veor @XMM[14], @XMM[4], @XMM[9] vtbl.8 `&Dlo(@XMM[3])`, {@XMM[13]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[3])`, {@XMM[13]}, `&Dhi(@XMM[8])` veor @XMM[15], @XMM[5], @XMM[9] vtbl.8 `&Dlo(@XMM[4])`, {@XMM[14]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[4])`, {@XMM[14]}, `&Dhi(@XMM[8])` veor @XMM[10], @XMM[6], @XMM[9] vtbl.8 `&Dlo(@XMM[5])`, {@XMM[15]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[5])`, {@XMM[15]}, `&Dhi(@XMM[8])` veor @XMM[11], @XMM[7], @XMM[9] vtbl.8 `&Dlo(@XMM[6])`, {@XMM[10]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[6])`, {@XMM[10]}, `&Dhi(@XMM[8])` vtbl.8 `&Dlo(@XMM[7])`, {@XMM[11]}, `&Dlo(@XMM[8])` vtbl.8 `&Dhi(@XMM[7])`, {@XMM[11]}, `&Dhi(@XMM[8])` _bsaes_encrypt8_bitslice: ___ &bitslice (@XMM[0..7, 8..11]); $code.=<<___; sub $rounds,$rounds,#1 b .Lenc_sbox .align 4 .Lenc_loop: ___ &ShiftRows (@XMM[0..7, 8..12]); $code.=".Lenc_sbox:\n"; &Sbox (@XMM[0..7, 8..15]); $code.=<<___; subs $rounds,$rounds,#1 bcc .Lenc_done ___ &MixColumns (@XMM[0,1,4,6,3,7,2,5, 8..15]); $code.=<<___; vldmia $const, {@XMM[12]} @ .LSR ite eq @ Thumb2 thing, samity check in ARM addeq $const,$const,#0x10 bne .Lenc_loop vldmia $const, {@XMM[12]} @ .LSRM0 b .Lenc_loop .align 4 .Lenc_done: ___ # output in lsb > [t0, t1, t4, t6, t3, t7, t2, t5] < msb &bitslice (@XMM[0,1,4,6,3,7,2,5, 8..11]); $code.=<<___; vldmia $key, {@XMM[8]} @ last round key veor @XMM[4], @XMM[4], @XMM[8] veor @XMM[6], @XMM[6], @XMM[8] veor @XMM[3], @XMM[3], @XMM[8] veor @XMM[7], @XMM[7], @XMM[8] veor @XMM[2], @XMM[2], @XMM[8] veor @XMM[5], @XMM[5], @XMM[8] veor @XMM[0], @XMM[0], @XMM[8] veor @XMM[1], @XMM[1], @XMM[8] bx lr .size _bsaes_encrypt8,.-_bsaes_encrypt8 ___ } { my ($out,$inp,$rounds,$const)=("r12","r4","r5","r6"); sub bitslice_key { my @x=reverse(@_[0..7]); my ($bs0,$bs1,$bs2,$t2,$t3)=@_[8..12]; &swapmove (@x[0,1],1,$bs0,$t2,$t3); $code.=<<___; @ &swapmove(@x[2,3],1,$t0,$t2,$t3); vmov @x[2], @x[0] vmov @x[3], @x[1] ___ #&swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3); &swapmove2x (@x[0,2,1,3],2,$bs1,$t2,$t3); $code.=<<___; @ &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3); vmov @x[4], @x[0] vmov @x[6], @x[2] vmov @x[5], @x[1] vmov @x[7], @x[3] ___ &swapmove2x (@x[0,4,1,5],4,$bs2,$t2,$t3); &swapmove2x (@x[2,6,3,7],4,$bs2,$t2,$t3); } $code.=<<___; .type _bsaes_key_convert,%function .align 4 _bsaes_key_convert: - adr $const,_bsaes_key_convert + adr $const,. vld1.8 {@XMM[7]}, [$inp]! @ load round 0 key sub $const,$const,#_bsaes_key_convert-.LM0 vld1.8 {@XMM[15]}, [$inp]! @ load round 1 key vmov.i8 @XMM[8], #0x01 @ bit masks vmov.i8 @XMM[9], #0x02 vmov.i8 @XMM[10], #0x04 vmov.i8 @XMM[11], #0x08 vmov.i8 @XMM[12], #0x10 vmov.i8 @XMM[13], #0x20 vldmia $const, {@XMM[14]} @ .LM0 #ifdef __ARMEL__ vrev32.8 @XMM[7], @XMM[7] vrev32.8 @XMM[15], @XMM[15] #endif sub $rounds,$rounds,#1 vstmia $out!, {@XMM[7]} @ save round 0 key b .Lkey_loop .align 4 .Lkey_loop: vtbl.8 `&Dlo(@XMM[7])`,{@XMM[15]},`&Dlo(@XMM[14])` vtbl.8 `&Dhi(@XMM[7])`,{@XMM[15]},`&Dhi(@XMM[14])` vmov.i8 @XMM[6], #0x40 vmov.i8 @XMM[15], #0x80 vtst.8 @XMM[0], @XMM[7], @XMM[8] vtst.8 @XMM[1], @XMM[7], @XMM[9] vtst.8 @XMM[2], @XMM[7], @XMM[10] vtst.8 @XMM[3], @XMM[7], @XMM[11] vtst.8 @XMM[4], @XMM[7], @XMM[12] vtst.8 @XMM[5], @XMM[7], @XMM[13] vtst.8 @XMM[6], @XMM[7], @XMM[6] vtst.8 @XMM[7], @XMM[7], @XMM[15] vld1.8 {@XMM[15]}, [$inp]! @ load next round key vmvn @XMM[0], @XMM[0] @ "pnot" vmvn @XMM[1], @XMM[1] vmvn @XMM[5], @XMM[5] vmvn @XMM[6], @XMM[6] #ifdef __ARMEL__ vrev32.8 @XMM[15], @XMM[15] #endif subs $rounds,$rounds,#1 vstmia $out!,{@XMM[0]-@XMM[7]} @ write bit-sliced round key bne .Lkey_loop vmov.i8 @XMM[7],#0x63 @ compose .L63 @ don't save last round key bx lr .size _bsaes_key_convert,.-_bsaes_key_convert ___ } if (0) { # following four functions are unsupported interface # used for benchmarking... $code.=<<___; .globl bsaes_enc_key_convert .type bsaes_enc_key_convert,%function .align 4 bsaes_enc_key_convert: stmdb sp!,{r4-r6,lr} vstmdb sp!,{d8-d15} @ ABI specification says so ldr r5,[$inp,#240] @ pass rounds mov r4,$inp @ pass key mov r12,$out @ pass key schedule bl _bsaes_key_convert veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key vstmia r12, {@XMM[7]} @ save last round key vldmia sp!,{d8-d15} ldmia sp!,{r4-r6,pc} .size bsaes_enc_key_convert,.-bsaes_enc_key_convert .globl bsaes_encrypt_128 .type bsaes_encrypt_128,%function .align 4 bsaes_encrypt_128: stmdb sp!,{r4-r6,lr} vstmdb sp!,{d8-d15} @ ABI specification says so .Lenc128_loop: vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input vld1.8 {@XMM[2]-@XMM[3]}, [$inp]! mov r4,$key @ pass the key vld1.8 {@XMM[4]-@XMM[5]}, [$inp]! mov r5,#10 @ pass rounds vld1.8 {@XMM[6]-@XMM[7]}, [$inp]! bl _bsaes_encrypt8 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[3]}, [$out]! vst1.8 {@XMM[7]}, [$out]! vst1.8 {@XMM[2]}, [$out]! subs $len,$len,#0x80 vst1.8 {@XMM[5]}, [$out]! bhi .Lenc128_loop vldmia sp!,{d8-d15} ldmia sp!,{r4-r6,pc} .size bsaes_encrypt_128,.-bsaes_encrypt_128 .globl bsaes_dec_key_convert .type bsaes_dec_key_convert,%function .align 4 bsaes_dec_key_convert: stmdb sp!,{r4-r6,lr} vstmdb sp!,{d8-d15} @ ABI specification says so ldr r5,[$inp,#240] @ pass rounds mov r4,$inp @ pass key mov r12,$out @ pass key schedule bl _bsaes_key_convert vldmia $out, {@XMM[6]} vstmia r12, {@XMM[15]} @ save last round key veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key vstmia $out, {@XMM[7]} vldmia sp!,{d8-d15} ldmia sp!,{r4-r6,pc} .size bsaes_dec_key_convert,.-bsaes_dec_key_convert .globl bsaes_decrypt_128 .type bsaes_decrypt_128,%function .align 4 bsaes_decrypt_128: stmdb sp!,{r4-r6,lr} vstmdb sp!,{d8-d15} @ ABI specification says so .Ldec128_loop: vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input vld1.8 {@XMM[2]-@XMM[3]}, [$inp]! mov r4,$key @ pass the key vld1.8 {@XMM[4]-@XMM[5]}, [$inp]! mov r5,#10 @ pass rounds vld1.8 {@XMM[6]-@XMM[7]}, [$inp]! bl _bsaes_decrypt8 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[2]}, [$out]! vst1.8 {@XMM[7]}, [$out]! vst1.8 {@XMM[3]}, [$out]! subs $len,$len,#0x80 vst1.8 {@XMM[5]}, [$out]! bhi .Ldec128_loop vldmia sp!,{d8-d15} ldmia sp!,{r4-r6,pc} .size bsaes_decrypt_128,.-bsaes_decrypt_128 ___ } { my ($inp,$out,$len,$key, $ivp,$fp,$rounds)=map("r$_",(0..3,8..10)); my ($keysched)=("sp"); $code.=<<___; .extern AES_cbc_encrypt .extern AES_decrypt .global bsaes_cbc_encrypt .type bsaes_cbc_encrypt,%function .align 5 bsaes_cbc_encrypt: #ifndef __KERNEL__ cmp $len, #128 #ifndef __thumb__ blo AES_cbc_encrypt #else bhs 1f b AES_cbc_encrypt 1: #endif #endif @ it is up to the caller to make sure we are called with enc == 0 mov ip, sp stmdb sp!, {r4-r10, lr} VFP_ABI_PUSH ldr $ivp, [ip] @ IV is 1st arg on the stack mov $len, $len, lsr#4 @ len in 16 byte blocks sub sp, #0x10 @ scratch space to carry over the IV mov $fp, sp @ save sp ldr $rounds, [$key, #240] @ get # of rounds #ifndef BSAES_ASM_EXTENDED_KEY @ allocate the key schedule on the stack sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key add r12, #`128-32` @ sifze of bit-slices key schedule @ populate the key schedule mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds mov sp, r12 @ sp is $keysched bl _bsaes_key_convert vldmia $keysched, {@XMM[6]} vstmia r12, {@XMM[15]} @ save last round key veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key vstmia $keysched, {@XMM[7]} #else ldr r12, [$key, #244] eors r12, #1 beq 0f @ populate the key schedule str r12, [$key, #244] mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds add r12, $key, #248 @ pass key schedule bl _bsaes_key_convert add r4, $key, #248 vldmia r4, {@XMM[6]} vstmia r12, {@XMM[15]} @ save last round key veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key vstmia r4, {@XMM[7]} .align 2 0: #endif vld1.8 {@XMM[15]}, [$ivp] @ load IV b .Lcbc_dec_loop .align 4 .Lcbc_dec_loop: subs $len, $len, #0x8 bmi .Lcbc_dec_loop_finish vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input vld1.8 {@XMM[2]-@XMM[3]}, [$inp]! #ifndef BSAES_ASM_EXTENDED_KEY mov r4, $keysched @ pass the key #else add r4, $key, #248 #endif vld1.8 {@XMM[4]-@XMM[5]}, [$inp]! mov r5, $rounds vld1.8 {@XMM[6]-@XMM[7]}, [$inp] sub $inp, $inp, #0x60 vstmia $fp, {@XMM[15]} @ put aside IV bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[10]-@XMM[11]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vld1.8 {@XMM[12]-@XMM[13]}, [$inp]! veor @XMM[4], @XMM[4], @XMM[10] veor @XMM[2], @XMM[2], @XMM[11] vld1.8 {@XMM[14]-@XMM[15]}, [$inp]! veor @XMM[7], @XMM[7], @XMM[12] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output veor @XMM[3], @XMM[3], @XMM[13] vst1.8 {@XMM[6]}, [$out]! veor @XMM[5], @XMM[5], @XMM[14] vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[2]}, [$out]! vst1.8 {@XMM[7]}, [$out]! vst1.8 {@XMM[3]}, [$out]! vst1.8 {@XMM[5]}, [$out]! b .Lcbc_dec_loop .Lcbc_dec_loop_finish: adds $len, $len, #8 beq .Lcbc_dec_done vld1.8 {@XMM[0]}, [$inp]! @ load input cmp $len, #2 blo .Lcbc_dec_one vld1.8 {@XMM[1]}, [$inp]! #ifndef BSAES_ASM_EXTENDED_KEY mov r4, $keysched @ pass the key #else add r4, $key, #248 #endif mov r5, $rounds vstmia $fp, {@XMM[15]} @ put aside IV beq .Lcbc_dec_two vld1.8 {@XMM[2]}, [$inp]! cmp $len, #4 blo .Lcbc_dec_three vld1.8 {@XMM[3]}, [$inp]! beq .Lcbc_dec_four vld1.8 {@XMM[4]}, [$inp]! cmp $len, #6 blo .Lcbc_dec_five vld1.8 {@XMM[5]}, [$inp]! beq .Lcbc_dec_six vld1.8 {@XMM[6]}, [$inp]! sub $inp, $inp, #0x70 bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[10]-@XMM[11]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vld1.8 {@XMM[12]-@XMM[13]}, [$inp]! veor @XMM[4], @XMM[4], @XMM[10] veor @XMM[2], @XMM[2], @XMM[11] vld1.8 {@XMM[15]}, [$inp]! veor @XMM[7], @XMM[7], @XMM[12] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output veor @XMM[3], @XMM[3], @XMM[13] vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[2]}, [$out]! vst1.8 {@XMM[7]}, [$out]! vst1.8 {@XMM[3]}, [$out]! b .Lcbc_dec_done .align 4 .Lcbc_dec_six: sub $inp, $inp, #0x60 bl _bsaes_decrypt8 vldmia $fp,{@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[10]-@XMM[11]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vld1.8 {@XMM[12]}, [$inp]! veor @XMM[4], @XMM[4], @XMM[10] veor @XMM[2], @XMM[2], @XMM[11] vld1.8 {@XMM[15]}, [$inp]! veor @XMM[7], @XMM[7], @XMM[12] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[2]}, [$out]! vst1.8 {@XMM[7]}, [$out]! b .Lcbc_dec_done .align 4 .Lcbc_dec_five: sub $inp, $inp, #0x50 bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[10]-@XMM[11]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vld1.8 {@XMM[15]}, [$inp]! veor @XMM[4], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output veor @XMM[2], @XMM[2], @XMM[11] vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[4]}, [$out]! vst1.8 {@XMM[2]}, [$out]! b .Lcbc_dec_done .align 4 .Lcbc_dec_four: sub $inp, $inp, #0x40 bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[10]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vld1.8 {@XMM[15]}, [$inp]! veor @XMM[4], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output vst1.8 {@XMM[6]}, [$out]! vst1.8 {@XMM[4]}, [$out]! b .Lcbc_dec_done .align 4 .Lcbc_dec_three: sub $inp, $inp, #0x30 bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[15]}, [$inp]! veor @XMM[1], @XMM[1], @XMM[8] veor @XMM[6], @XMM[6], @XMM[9] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output vst1.8 {@XMM[6]}, [$out]! b .Lcbc_dec_done .align 4 .Lcbc_dec_two: sub $inp, $inp, #0x20 bl _bsaes_decrypt8 vldmia $fp, {@XMM[14]} @ reload IV vld1.8 {@XMM[8]}, [$inp]! @ reload input veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV vld1.8 {@XMM[15]}, [$inp]! @ reload input veor @XMM[1], @XMM[1], @XMM[8] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output b .Lcbc_dec_done .align 4 .Lcbc_dec_one: sub $inp, $inp, #0x10 mov $rounds, $out @ save original out pointer mov $out, $fp @ use the iv scratch space as out buffer mov r2, $key vmov @XMM[4],@XMM[15] @ just in case ensure that IV vmov @XMM[5],@XMM[0] @ and input are preserved bl AES_decrypt vld1.8 {@XMM[0]}, [$fp] @ load result veor @XMM[0], @XMM[0], @XMM[4] @ ^= IV vmov @XMM[15], @XMM[5] @ @XMM[5] holds input vst1.8 {@XMM[0]}, [$rounds] @ write output .Lcbc_dec_done: #ifndef BSAES_ASM_EXTENDED_KEY vmov.i32 q0, #0 vmov.i32 q1, #0 .Lcbc_dec_bzero: @ wipe key schedule [if any] vstmia $keysched!, {q0-q1} cmp $keysched, $fp bne .Lcbc_dec_bzero #endif mov sp, $fp add sp, #0x10 @ add sp,$fp,#0x10 is no good for thumb vst1.8 {@XMM[15]}, [$ivp] @ return IV VFP_ABI_POP ldmia sp!, {r4-r10, pc} .size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt ___ } { my ($inp,$out,$len,$key, $ctr,$fp,$rounds)=(map("r$_",(0..3,8..10))); my $const = "r6"; # shared with _bsaes_encrypt8_alt my $keysched = "sp"; $code.=<<___; .extern AES_encrypt .global bsaes_ctr32_encrypt_blocks .type bsaes_ctr32_encrypt_blocks,%function .align 5 bsaes_ctr32_encrypt_blocks: cmp $len, #8 @ use plain AES for blo .Lctr_enc_short @ small sizes mov ip, sp stmdb sp!, {r4-r10, lr} VFP_ABI_PUSH ldr $ctr, [ip] @ ctr is 1st arg on the stack sub sp, sp, #0x10 @ scratch space to carry over the ctr mov $fp, sp @ save sp ldr $rounds, [$key, #240] @ get # of rounds #ifndef BSAES_ASM_EXTENDED_KEY @ allocate the key schedule on the stack sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key add r12, #`128-32` @ size of bit-sliced key schedule @ populate the key schedule mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds mov sp, r12 @ sp is $keysched bl _bsaes_key_convert veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key vstmia r12, {@XMM[7]} @ save last round key vld1.8 {@XMM[0]}, [$ctr] @ load counter add $ctr, $const, #.LREVM0SR-.LM0 @ borrow $ctr vldmia $keysched, {@XMM[4]} @ load round0 key #else ldr r12, [$key, #244] eors r12, #1 beq 0f @ populate the key schedule str r12, [$key, #244] mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds add r12, $key, #248 @ pass key schedule bl _bsaes_key_convert veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key vstmia r12, {@XMM[7]} @ save last round key .align 2 0: add r12, $key, #248 vld1.8 {@XMM[0]}, [$ctr] @ load counter adrl $ctr, .LREVM0SR @ borrow $ctr vldmia r12, {@XMM[4]} @ load round0 key sub sp, #0x10 @ place for adjusted round0 key #endif vmov.i32 @XMM[8],#1 @ compose 1<<96 veor @XMM[9],@XMM[9],@XMM[9] vrev32.8 @XMM[0],@XMM[0] vext.8 @XMM[8],@XMM[9],@XMM[8],#4 vrev32.8 @XMM[4],@XMM[4] vadd.u32 @XMM[9],@XMM[8],@XMM[8] @ compose 2<<96 vstmia $keysched, {@XMM[4]} @ save adjusted round0 key b .Lctr_enc_loop .align 4 .Lctr_enc_loop: vadd.u32 @XMM[10], @XMM[8], @XMM[9] @ compose 3<<96 vadd.u32 @XMM[1], @XMM[0], @XMM[8] @ +1 vadd.u32 @XMM[2], @XMM[0], @XMM[9] @ +2 vadd.u32 @XMM[3], @XMM[0], @XMM[10] @ +3 vadd.u32 @XMM[4], @XMM[1], @XMM[10] vadd.u32 @XMM[5], @XMM[2], @XMM[10] vadd.u32 @XMM[6], @XMM[3], @XMM[10] vadd.u32 @XMM[7], @XMM[4], @XMM[10] vadd.u32 @XMM[10], @XMM[5], @XMM[10] @ next counter @ Borrow prologue from _bsaes_encrypt8 to use the opportunity @ to flip byte order in 32-bit counter vldmia $keysched, {@XMM[9]} @ load round0 key #ifndef BSAES_ASM_EXTENDED_KEY add r4, $keysched, #0x10 @ pass next round key #else add r4, $key, #`248+16` #endif vldmia $ctr, {@XMM[8]} @ .LREVM0SR mov r5, $rounds @ pass rounds vstmia $fp, {@XMM[10]} @ save next counter sub $const, $ctr, #.LREVM0SR-.LSR @ pass constants bl _bsaes_encrypt8_alt subs $len, $len, #8 blo .Lctr_enc_loop_done vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ load input vld1.8 {@XMM[10]-@XMM[11]}, [$inp]! veor @XMM[0], @XMM[8] veor @XMM[1], @XMM[9] vld1.8 {@XMM[12]-@XMM[13]}, [$inp]! veor @XMM[4], @XMM[10] veor @XMM[6], @XMM[11] vld1.8 {@XMM[14]-@XMM[15]}, [$inp]! veor @XMM[3], @XMM[12] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output veor @XMM[7], @XMM[13] veor @XMM[2], @XMM[14] vst1.8 {@XMM[4]}, [$out]! veor @XMM[5], @XMM[15] vst1.8 {@XMM[6]}, [$out]! vmov.i32 @XMM[8], #1 @ compose 1<<96 vst1.8 {@XMM[3]}, [$out]! veor @XMM[9], @XMM[9], @XMM[9] vst1.8 {@XMM[7]}, [$out]! vext.8 @XMM[8], @XMM[9], @XMM[8], #4 vst1.8 {@XMM[2]}, [$out]! vadd.u32 @XMM[9],@XMM[8],@XMM[8] @ compose 2<<96 vst1.8 {@XMM[5]}, [$out]! vldmia $fp, {@XMM[0]} @ load counter bne .Lctr_enc_loop b .Lctr_enc_done .align 4 .Lctr_enc_loop_done: add $len, $len, #8 vld1.8 {@XMM[8]}, [$inp]! @ load input veor @XMM[0], @XMM[8] vst1.8 {@XMM[0]}, [$out]! @ write output cmp $len, #2 blo .Lctr_enc_done vld1.8 {@XMM[9]}, [$inp]! veor @XMM[1], @XMM[9] vst1.8 {@XMM[1]}, [$out]! beq .Lctr_enc_done vld1.8 {@XMM[10]}, [$inp]! veor @XMM[4], @XMM[10] vst1.8 {@XMM[4]}, [$out]! cmp $len, #4 blo .Lctr_enc_done vld1.8 {@XMM[11]}, [$inp]! veor @XMM[6], @XMM[11] vst1.8 {@XMM[6]}, [$out]! beq .Lctr_enc_done vld1.8 {@XMM[12]}, [$inp]! veor @XMM[3], @XMM[12] vst1.8 {@XMM[3]}, [$out]! cmp $len, #6 blo .Lctr_enc_done vld1.8 {@XMM[13]}, [$inp]! veor @XMM[7], @XMM[13] vst1.8 {@XMM[7]}, [$out]! beq .Lctr_enc_done vld1.8 {@XMM[14]}, [$inp] veor @XMM[2], @XMM[14] vst1.8 {@XMM[2]}, [$out]! .Lctr_enc_done: vmov.i32 q0, #0 vmov.i32 q1, #0 #ifndef BSAES_ASM_EXTENDED_KEY .Lctr_enc_bzero: @ wipe key schedule [if any] vstmia $keysched!, {q0-q1} cmp $keysched, $fp bne .Lctr_enc_bzero #else vstmia $keysched, {q0-q1} #endif mov sp, $fp add sp, #0x10 @ add sp,$fp,#0x10 is no good for thumb VFP_ABI_POP ldmia sp!, {r4-r10, pc} @ return .align 4 .Lctr_enc_short: ldr ip, [sp] @ ctr pointer is passed on stack stmdb sp!, {r4-r8, lr} mov r4, $inp @ copy arguments mov r5, $out mov r6, $len mov r7, $key ldr r8, [ip, #12] @ load counter LSW vld1.8 {@XMM[1]}, [ip] @ load whole counter value #ifdef __ARMEL__ rev r8, r8 #endif sub sp, sp, #0x10 vst1.8 {@XMM[1]}, [sp,:64] @ copy counter value sub sp, sp, #0x10 .Lctr_enc_short_loop: add r0, sp, #0x10 @ input counter value mov r1, sp @ output on the stack mov r2, r7 @ key bl AES_encrypt vld1.8 {@XMM[0]}, [r4]! @ load input vld1.8 {@XMM[1]}, [sp,:64] @ load encrypted counter add r8, r8, #1 #ifdef __ARMEL__ rev r0, r8 str r0, [sp, #0x1c] @ next counter value #else str r8, [sp, #0x1c] @ next counter value #endif veor @XMM[0],@XMM[0],@XMM[1] vst1.8 {@XMM[0]}, [r5]! @ store output subs r6, r6, #1 bne .Lctr_enc_short_loop vmov.i32 q0, #0 vmov.i32 q1, #0 vstmia sp!, {q0-q1} ldmia sp!, {r4-r8, pc} .size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks ___ } { ###################################################################### # void bsaes_xts_[en|de]crypt(const char *inp,char *out,size_t len, # const AES_KEY *key1, const AES_KEY *key2, # const unsigned char iv[16]); # my ($inp,$out,$len,$key,$rounds,$magic,$fp)=(map("r$_",(7..10,1..3))); my $const="r6"; # returned by _bsaes_key_convert my $twmask=@XMM[5]; my @T=@XMM[6..7]; $code.=<<___; .globl bsaes_xts_encrypt .type bsaes_xts_encrypt,%function .align 4 bsaes_xts_encrypt: mov ip, sp stmdb sp!, {r4-r10, lr} @ 0x20 VFP_ABI_PUSH mov r6, sp @ future $fp mov $inp, r0 mov $out, r1 mov $len, r2 mov $key, r3 sub r0, sp, #0x10 @ 0x10 bic r0, #0xf @ align at 16 bytes mov sp, r0 #ifdef XTS_CHAIN_TWEAK ldr r0, [ip] @ pointer to input tweak #else @ generate initial tweak ldr r0, [ip, #4] @ iv[] mov r1, sp ldr r2, [ip, #0] @ key2 bl AES_encrypt mov r0,sp @ pointer to initial tweak #endif ldr $rounds, [$key, #240] @ get # of rounds mov $fp, r6 #ifndef BSAES_ASM_EXTENDED_KEY @ allocate the key schedule on the stack sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key @ add r12, #`128-32` @ size of bit-sliced key schedule sub r12, #`32+16` @ place for tweak[9] @ populate the key schedule mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds mov sp, r12 add r12, #0x90 @ pass key schedule bl _bsaes_key_convert veor @XMM[7], @XMM[7], @XMM[15] @ fix up last round key vstmia r12, {@XMM[7]} @ save last round key #else ldr r12, [$key, #244] eors r12, #1 beq 0f str r12, [$key, #244] mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds add r12, $key, #248 @ pass key schedule bl _bsaes_key_convert veor @XMM[7], @XMM[7], @XMM[15] @ fix up last round key vstmia r12, {@XMM[7]} .align 2 0: sub sp, #0x90 @ place for tweak[9] #endif vld1.8 {@XMM[8]}, [r0] @ initial tweak adr $magic, .Lxts_magic subs $len, #0x80 blo .Lxts_enc_short b .Lxts_enc_loop .align 4 .Lxts_enc_loop: vldmia $magic, {$twmask} @ load XTS magic vshr.s64 @T[0], @XMM[8], #63 mov r0, sp vand @T[0], @T[0], $twmask ___ for($i=9;$i<16;$i++) { $code.=<<___; vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1] vst1.64 {@XMM[$i-1]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` vshr.s64 @T[1], @XMM[$i], #63 veor @XMM[$i], @XMM[$i], @T[0] vand @T[1], @T[1], $twmask ___ @T=reverse(@T); $code.=<<___ if ($i>=10); vld1.8 {@XMM[$i-10]}, [$inp]! ___ $code.=<<___ if ($i>=11); veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3] ___ } $code.=<<___; vadd.u64 @XMM[8], @XMM[15], @XMM[15] vst1.64 {@XMM[15]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` veor @XMM[8], @XMM[8], @T[0] vst1.64 {@XMM[8]}, [r0,:128] @ next round tweak vld1.8 {@XMM[6]-@XMM[7]}, [$inp]! veor @XMM[5], @XMM[5], @XMM[13] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[6], @XMM[6], @XMM[14] mov r5, $rounds @ pass rounds veor @XMM[7], @XMM[7], @XMM[15] mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[6], @XMM[11] vld1.64 {@XMM[14]-@XMM[15]}, [r0,:128]! veor @XMM[10], @XMM[3], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] veor @XMM[12], @XMM[2], @XMM[14] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! veor @XMM[13], @XMM[5], @XMM[15] vst1.8 {@XMM[12]-@XMM[13]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak subs $len, #0x80 bpl .Lxts_enc_loop .Lxts_enc_short: adds $len, #0x70 bmi .Lxts_enc_done vldmia $magic, {$twmask} @ load XTS magic vshr.s64 @T[0], @XMM[8], #63 mov r0, sp vand @T[0], @T[0], $twmask ___ for($i=9;$i<16;$i++) { $code.=<<___; vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1] vst1.64 {@XMM[$i-1]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` vshr.s64 @T[1], @XMM[$i], #63 veor @XMM[$i], @XMM[$i], @T[0] vand @T[1], @T[1], $twmask ___ @T=reverse(@T); $code.=<<___ if ($i>=10); vld1.8 {@XMM[$i-10]}, [$inp]! subs $len, #0x10 bmi .Lxts_enc_`$i-9` ___ $code.=<<___ if ($i>=11); veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3] ___ } $code.=<<___; sub $len, #0x10 vst1.64 {@XMM[15]}, [r0,:128] @ next round tweak vld1.8 {@XMM[6]}, [$inp]! veor @XMM[5], @XMM[5], @XMM[13] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[6], @XMM[6], @XMM[14] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[6], @XMM[11] vld1.64 {@XMM[14]}, [r0,:128]! veor @XMM[10], @XMM[3], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] veor @XMM[12], @XMM[2], @XMM[14] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! vst1.8 {@XMM[12]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done .align 4 .Lxts_enc_6: veor @XMM[4], @XMM[4], @XMM[12] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[5], @XMM[5], @XMM[13] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[6], @XMM[11] veor @XMM[10], @XMM[3], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done @ put this in range for both ARM and Thumb mode adr instructions .align 5 .Lxts_magic: .quad 1, 0x87 .align 5 .Lxts_enc_5: veor @XMM[3], @XMM[3], @XMM[11] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[4], @XMM[4], @XMM[12] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[6], @XMM[11] veor @XMM[10], @XMM[3], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! vst1.8 {@XMM[10]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done .align 4 .Lxts_enc_4: veor @XMM[2], @XMM[2], @XMM[10] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[3], @XMM[3], @XMM[11] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[6], @XMM[11] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done .align 4 .Lxts_enc_3: veor @XMM[1], @XMM[1], @XMM[9] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[2], @XMM[2], @XMM[10] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]! vld1.64 {@XMM[10]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[4], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! vst1.8 {@XMM[8]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done .align 4 .Lxts_enc_2: veor @XMM[0], @XMM[0], @XMM[8] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[1], @XMM[1], @XMM[9] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_encrypt8 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_enc_done .align 4 .Lxts_enc_1: mov r0, sp veor @XMM[0], @XMM[0], @XMM[8] mov r1, sp vst1.8 {@XMM[0]}, [sp,:128] mov r2, $key mov r4, $fp @ preserve fp bl AES_encrypt vld1.8 {@XMM[0]}, [sp,:128] veor @XMM[0], @XMM[0], @XMM[8] vst1.8 {@XMM[0]}, [$out]! mov $fp, r4 vmov @XMM[8], @XMM[9] @ next round tweak .Lxts_enc_done: #ifndef XTS_CHAIN_TWEAK adds $len, #0x10 beq .Lxts_enc_ret sub r6, $out, #0x10 .Lxts_enc_steal: ldrb r0, [$inp], #1 ldrb r1, [$out, #-0x10] strb r0, [$out, #-0x10] strb r1, [$out], #1 subs $len, #1 bhi .Lxts_enc_steal vld1.8 {@XMM[0]}, [r6] mov r0, sp veor @XMM[0], @XMM[0], @XMM[8] mov r1, sp vst1.8 {@XMM[0]}, [sp,:128] mov r2, $key mov r4, $fp @ preserve fp bl AES_encrypt vld1.8 {@XMM[0]}, [sp,:128] veor @XMM[0], @XMM[0], @XMM[8] vst1.8 {@XMM[0]}, [r6] mov $fp, r4 #endif .Lxts_enc_ret: bic r0, $fp, #0xf vmov.i32 q0, #0 vmov.i32 q1, #0 #ifdef XTS_CHAIN_TWEAK ldr r1, [$fp, #0x20+VFP_ABI_FRAME] @ chain tweak #endif .Lxts_enc_bzero: @ wipe key schedule [if any] vstmia sp!, {q0-q1} cmp sp, r0 bne .Lxts_enc_bzero mov sp, $fp #ifdef XTS_CHAIN_TWEAK vst1.8 {@XMM[8]}, [r1] #endif VFP_ABI_POP ldmia sp!, {r4-r10, pc} @ return .size bsaes_xts_encrypt,.-bsaes_xts_encrypt .globl bsaes_xts_decrypt .type bsaes_xts_decrypt,%function .align 4 bsaes_xts_decrypt: mov ip, sp stmdb sp!, {r4-r10, lr} @ 0x20 VFP_ABI_PUSH mov r6, sp @ future $fp mov $inp, r0 mov $out, r1 mov $len, r2 mov $key, r3 sub r0, sp, #0x10 @ 0x10 bic r0, #0xf @ align at 16 bytes mov sp, r0 #ifdef XTS_CHAIN_TWEAK ldr r0, [ip] @ pointer to input tweak #else @ generate initial tweak ldr r0, [ip, #4] @ iv[] mov r1, sp ldr r2, [ip, #0] @ key2 bl AES_encrypt mov r0, sp @ pointer to initial tweak #endif ldr $rounds, [$key, #240] @ get # of rounds mov $fp, r6 #ifndef BSAES_ASM_EXTENDED_KEY @ allocate the key schedule on the stack sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key @ add r12, #`128-32` @ size of bit-sliced key schedule sub r12, #`32+16` @ place for tweak[9] @ populate the key schedule mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds mov sp, r12 add r12, #0x90 @ pass key schedule bl _bsaes_key_convert add r4, sp, #0x90 vldmia r4, {@XMM[6]} vstmia r12, {@XMM[15]} @ save last round key veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key vstmia r4, {@XMM[7]} #else ldr r12, [$key, #244] eors r12, #1 beq 0f str r12, [$key, #244] mov r4, $key @ pass key mov r5, $rounds @ pass # of rounds add r12, $key, #248 @ pass key schedule bl _bsaes_key_convert add r4, $key, #248 vldmia r4, {@XMM[6]} vstmia r12, {@XMM[15]} @ save last round key veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key vstmia r4, {@XMM[7]} .align 2 0: sub sp, #0x90 @ place for tweak[9] #endif vld1.8 {@XMM[8]}, [r0] @ initial tweak adr $magic, .Lxts_magic tst $len, #0xf @ if not multiple of 16 it ne @ Thumb2 thing, sanity check in ARM subne $len, #0x10 @ subtract another 16 bytes subs $len, #0x80 blo .Lxts_dec_short b .Lxts_dec_loop .align 4 .Lxts_dec_loop: vldmia $magic, {$twmask} @ load XTS magic vshr.s64 @T[0], @XMM[8], #63 mov r0, sp vand @T[0], @T[0], $twmask ___ for($i=9;$i<16;$i++) { $code.=<<___; vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1] vst1.64 {@XMM[$i-1]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` vshr.s64 @T[1], @XMM[$i], #63 veor @XMM[$i], @XMM[$i], @T[0] vand @T[1], @T[1], $twmask ___ @T=reverse(@T); $code.=<<___ if ($i>=10); vld1.8 {@XMM[$i-10]}, [$inp]! ___ $code.=<<___ if ($i>=11); veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3] ___ } $code.=<<___; vadd.u64 @XMM[8], @XMM[15], @XMM[15] vst1.64 {@XMM[15]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` veor @XMM[8], @XMM[8], @T[0] vst1.64 {@XMM[8]}, [r0,:128] @ next round tweak vld1.8 {@XMM[6]-@XMM[7]}, [$inp]! veor @XMM[5], @XMM[5], @XMM[13] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[6], @XMM[6], @XMM[14] mov r5, $rounds @ pass rounds veor @XMM[7], @XMM[7], @XMM[15] mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[4], @XMM[11] vld1.64 {@XMM[14]-@XMM[15]}, [r0,:128]! veor @XMM[10], @XMM[2], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] veor @XMM[12], @XMM[3], @XMM[14] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! veor @XMM[13], @XMM[5], @XMM[15] vst1.8 {@XMM[12]-@XMM[13]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak subs $len, #0x80 bpl .Lxts_dec_loop .Lxts_dec_short: adds $len, #0x70 bmi .Lxts_dec_done vldmia $magic, {$twmask} @ load XTS magic vshr.s64 @T[0], @XMM[8], #63 mov r0, sp vand @T[0], @T[0], $twmask ___ for($i=9;$i<16;$i++) { $code.=<<___; vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1] vst1.64 {@XMM[$i-1]}, [r0,:128]! vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")` vshr.s64 @T[1], @XMM[$i], #63 veor @XMM[$i], @XMM[$i], @T[0] vand @T[1], @T[1], $twmask ___ @T=reverse(@T); $code.=<<___ if ($i>=10); vld1.8 {@XMM[$i-10]}, [$inp]! subs $len, #0x10 bmi .Lxts_dec_`$i-9` ___ $code.=<<___ if ($i>=11); veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3] ___ } $code.=<<___; sub $len, #0x10 vst1.64 {@XMM[15]}, [r0,:128] @ next round tweak vld1.8 {@XMM[6]}, [$inp]! veor @XMM[5], @XMM[5], @XMM[13] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[6], @XMM[6], @XMM[14] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[4], @XMM[11] vld1.64 {@XMM[14]}, [r0,:128]! veor @XMM[10], @XMM[2], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] veor @XMM[12], @XMM[3], @XMM[14] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! vst1.8 {@XMM[12]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_6: vst1.64 {@XMM[14]}, [r0,:128] @ next round tweak veor @XMM[4], @XMM[4], @XMM[12] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[5], @XMM[5], @XMM[13] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[4], @XMM[11] veor @XMM[10], @XMM[2], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! veor @XMM[11], @XMM[7], @XMM[13] vst1.8 {@XMM[10]-@XMM[11]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_5: veor @XMM[3], @XMM[3], @XMM[11] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[4], @XMM[4], @XMM[12] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] vld1.64 {@XMM[12]}, [r0,:128]! veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[4], @XMM[11] veor @XMM[10], @XMM[2], @XMM[12] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! vst1.8 {@XMM[10]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_4: veor @XMM[2], @XMM[2], @XMM[10] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[3], @XMM[3], @XMM[11] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]! vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! veor @XMM[9], @XMM[4], @XMM[11] vst1.8 {@XMM[8]-@XMM[9]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_3: veor @XMM[1], @XMM[1], @XMM[9] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[2], @XMM[2], @XMM[10] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]! vld1.64 {@XMM[10]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] veor @XMM[8], @XMM[6], @XMM[10] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! vst1.8 {@XMM[8]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_2: veor @XMM[0], @XMM[0], @XMM[8] #ifndef BSAES_ASM_EXTENDED_KEY add r4, sp, #0x90 @ pass key schedule #else add r4, $key, #248 @ pass key schedule #endif veor @XMM[1], @XMM[1], @XMM[9] mov r5, $rounds @ pass rounds mov r0, sp bl _bsaes_decrypt8 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]! veor @XMM[0], @XMM[0], @XMM[ 8] veor @XMM[1], @XMM[1], @XMM[ 9] vst1.8 {@XMM[0]-@XMM[1]}, [$out]! vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak b .Lxts_dec_done .align 4 .Lxts_dec_1: mov r0, sp veor @XMM[0], @XMM[0], @XMM[8] mov r1, sp vst1.8 {@XMM[0]}, [sp,:128] mov r5, $magic @ preserve magic mov r2, $key mov r4, $fp @ preserve fp bl AES_decrypt vld1.8 {@XMM[0]}, [sp,:128] veor @XMM[0], @XMM[0], @XMM[8] vst1.8 {@XMM[0]}, [$out]! mov $fp, r4 mov $magic, r5 vmov @XMM[8], @XMM[9] @ next round tweak .Lxts_dec_done: #ifndef XTS_CHAIN_TWEAK adds $len, #0x10 beq .Lxts_dec_ret @ calculate one round of extra tweak for the stolen ciphertext vldmia $magic, {$twmask} vshr.s64 @XMM[6], @XMM[8], #63 vand @XMM[6], @XMM[6], $twmask vadd.u64 @XMM[9], @XMM[8], @XMM[8] vswp `&Dhi("@XMM[6]")`,`&Dlo("@XMM[6]")` veor @XMM[9], @XMM[9], @XMM[6] @ perform the final decryption with the last tweak value vld1.8 {@XMM[0]}, [$inp]! mov r0, sp veor @XMM[0], @XMM[0], @XMM[9] mov r1, sp vst1.8 {@XMM[0]}, [sp,:128] mov r2, $key mov r4, $fp @ preserve fp bl AES_decrypt vld1.8 {@XMM[0]}, [sp,:128] veor @XMM[0], @XMM[0], @XMM[9] vst1.8 {@XMM[0]}, [$out] mov r6, $out .Lxts_dec_steal: ldrb r1, [$out] ldrb r0, [$inp], #1 strb r1, [$out, #0x10] strb r0, [$out], #1 subs $len, #1 bhi .Lxts_dec_steal vld1.8 {@XMM[0]}, [r6] mov r0, sp veor @XMM[0], @XMM[8] mov r1, sp vst1.8 {@XMM[0]}, [sp,:128] mov r2, $key bl AES_decrypt vld1.8 {@XMM[0]}, [sp,:128] veor @XMM[0], @XMM[0], @XMM[8] vst1.8 {@XMM[0]}, [r6] mov $fp, r4 #endif .Lxts_dec_ret: bic r0, $fp, #0xf vmov.i32 q0, #0 vmov.i32 q1, #0 #ifdef XTS_CHAIN_TWEAK ldr r1, [$fp, #0x20+VFP_ABI_FRAME] @ chain tweak #endif .Lxts_dec_bzero: @ wipe key schedule [if any] vstmia sp!, {q0-q1} cmp sp, r0 bne .Lxts_dec_bzero mov sp, $fp #ifdef XTS_CHAIN_TWEAK vst1.8 {@XMM[8]}, [r1] #endif VFP_ABI_POP ldmia sp!, {r4-r10, pc} @ return .size bsaes_xts_decrypt,.-bsaes_xts_decrypt ___ } $code.=<<___; #endif ___ $code =~ s/\`([^\`]*)\`/eval($1)/gem; open SELF,$0; while() { next if (/^#!/); last if (!s/^#/@/ and !/^$/); print; } close SELF; print $code; close STDOUT; diff --git a/crypto/asn1/a_i2d_fp.c b/crypto/asn1/a_i2d_fp.c index 0f56cd4e0745..2e85e041e4cf 100644 --- a/crypto/asn1/a_i2d_fp.c +++ b/crypto/asn1/a_i2d_fp.c @@ -1,157 +1,160 @@ /* crypto/asn1/a_i2d_fp.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include #include "cryptlib.h" #include #include #ifndef NO_OLD_ASN1 # ifndef OPENSSL_NO_FP_API int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x) { BIO *b; int ret; if ((b = BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_I2D_FP, ERR_R_BUF_LIB); return (0); } BIO_set_fp(b, out, BIO_NOCLOSE); ret = ASN1_i2d_bio(i2d, b, x); BIO_free(b); return (ret); } # endif int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) { char *b; unsigned char *p; int i, j = 0, n, ret = 1; n = i2d(x, NULL); + if (n <= 0) + return 0; + b = (char *)OPENSSL_malloc(n); if (b == NULL) { ASN1err(ASN1_F_ASN1_I2D_BIO, ERR_R_MALLOC_FAILURE); return (0); } p = (unsigned char *)b; i2d(x, &p); for (;;) { i = BIO_write(out, &(b[j]), n); if (i == n) break; if (i <= 0) { ret = 0; break; } j += i; n -= i; } OPENSSL_free(b); return (ret); } #endif #ifndef OPENSSL_NO_FP_API int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x) { BIO *b; int ret; if ((b = BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_ITEM_I2D_FP, ERR_R_BUF_LIB); return (0); } BIO_set_fp(b, out, BIO_NOCLOSE); ret = ASN1_item_i2d_bio(it, b, x); BIO_free(b); return (ret); } #endif int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) { unsigned char *b = NULL; int i, j = 0, n, ret = 1; n = ASN1_item_i2d(x, &b, it); if (b == NULL) { ASN1err(ASN1_F_ASN1_ITEM_I2D_BIO, ERR_R_MALLOC_FAILURE); return (0); } for (;;) { i = BIO_write(out, &(b[j]), n); if (i == n) break; if (i <= 0) { ret = 0; break; } j += i; n -= i; } OPENSSL_free(b); return (ret); } diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index eb3ab759349c..1c82f53d5a07 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -1,869 +1,869 @@ /* crypto/bio/b_print.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* disable assert() unless BIO_DEBUG has been defined */ #ifndef BIO_DEBUG # ifndef NDEBUG # define NDEBUG # endif #endif /* * Stolen from tjh's ssl/ssl_trc.c stuff. */ #include #include #include #include #include #include "cryptlib.h" #ifndef NO_SYS_TYPES_H # include #endif #include /* To get BN_LLONG properly defined */ #include #if defined(BN_LLONG) || defined(SIXTY_FOUR_BIT) # ifndef HAVE_LONG_LONG # define HAVE_LONG_LONG 1 # endif #endif /***************************************************************************/ /* * Copyright Patrick Powell 1995 * This code is based on code written by Patrick Powell * It may be used for any purpose as long as this notice remains intact * on all source code distributions. */ /*- * This code contains numerious changes and enhancements which were * made by lots of contributors over the last years to Patrick Powell's * original code: * * o Patrick Powell (1995) * o Brandon Long (1996, for Mutt) * o Thomas Roessler (1998, for Mutt) * o Michael Elkins (1998, for Mutt) * o Andrew Tridgell (1998, for Samba) * o Luke Mewburn (1999, for LukemFTP) * o Ralf S. Engelschall (1999, for Pth) * o ... (for OpenSSL) */ #ifdef HAVE_LONG_DOUBLE # define LDOUBLE long double #else # define LDOUBLE double #endif #ifdef HAVE_LONG_LONG # if defined(_WIN32) && !defined(__GNUC__) # define LLONG __int64 # else # define LLONG long long # endif #else # define LLONG long #endif static int fmtstr(char **, char **, size_t *, size_t *, const char *, int, int, int); static int fmtint(char **, char **, size_t *, size_t *, LLONG, int, int, int, int); static int fmtfp(char **, char **, size_t *, size_t *, LDOUBLE, int, int, int); static int doapr_outch(char **, char **, size_t *, size_t *, int); static int _dopr(char **sbuffer, char **buffer, size_t *maxlen, size_t *retlen, int *truncated, const char *format, va_list args); /* format read states */ #define DP_S_DEFAULT 0 #define DP_S_FLAGS 1 #define DP_S_MIN 2 #define DP_S_DOT 3 #define DP_S_MAX 4 #define DP_S_MOD 5 #define DP_S_CONV 6 #define DP_S_DONE 7 /* format flags - Bits */ #define DP_F_MINUS (1 << 0) #define DP_F_PLUS (1 << 1) #define DP_F_SPACE (1 << 2) #define DP_F_NUM (1 << 3) #define DP_F_ZERO (1 << 4) #define DP_F_UP (1 << 5) #define DP_F_UNSIGNED (1 << 6) /* conversion flags */ #define DP_C_SHORT 1 #define DP_C_LONG 2 #define DP_C_LDOUBLE 3 #define DP_C_LLONG 4 /* some handy macros */ #define char_to_int(p) (p - '0') #define OSSL_MAX(p,q) ((p >= q) ? p : q) static int _dopr(char **sbuffer, char **buffer, size_t *maxlen, size_t *retlen, int *truncated, const char *format, va_list args) { char ch; LLONG value; LDOUBLE fvalue; char *strvalue; int min; int max; int state; int flags; int cflags; size_t currlen; state = DP_S_DEFAULT; flags = currlen = cflags = min = 0; max = -1; ch = *format++; while (state != DP_S_DONE) { if (ch == '\0' || (buffer == NULL && currlen >= *maxlen)) state = DP_S_DONE; switch (state) { case DP_S_DEFAULT: if (ch == '%') state = DP_S_FLAGS; else if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) return 0; ch = *format++; break; case DP_S_FLAGS: switch (ch) { case '-': flags |= DP_F_MINUS; ch = *format++; break; case '+': flags |= DP_F_PLUS; ch = *format++; break; case ' ': flags |= DP_F_SPACE; ch = *format++; break; case '#': flags |= DP_F_NUM; ch = *format++; break; case '0': flags |= DP_F_ZERO; ch = *format++; break; default: state = DP_S_MIN; break; } break; case DP_S_MIN: if (isdigit((unsigned char)ch)) { min = 10 * min + char_to_int(ch); ch = *format++; } else if (ch == '*') { min = va_arg(args, int); ch = *format++; state = DP_S_DOT; } else state = DP_S_DOT; break; case DP_S_DOT: if (ch == '.') { state = DP_S_MAX; ch = *format++; } else state = DP_S_MOD; break; case DP_S_MAX: if (isdigit((unsigned char)ch)) { if (max < 0) max = 0; max = 10 * max + char_to_int(ch); ch = *format++; } else if (ch == '*') { max = va_arg(args, int); ch = *format++; state = DP_S_MOD; } else state = DP_S_MOD; break; case DP_S_MOD: switch (ch) { case 'h': cflags = DP_C_SHORT; ch = *format++; break; case 'l': if (*format == 'l') { cflags = DP_C_LLONG; format++; } else cflags = DP_C_LONG; ch = *format++; break; case 'q': cflags = DP_C_LLONG; ch = *format++; break; case 'L': cflags = DP_C_LDOUBLE; ch = *format++; break; default: break; } state = DP_S_CONV; break; case DP_S_CONV: switch (ch) { case 'd': case 'i': switch (cflags) { case DP_C_SHORT: value = (short int)va_arg(args, int); break; case DP_C_LONG: value = va_arg(args, long int); break; case DP_C_LLONG: value = va_arg(args, LLONG); break; default: value = va_arg(args, int); break; } if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min, max, flags)) return 0; break; case 'X': flags |= DP_F_UP; /* FALLTHROUGH */ case 'x': case 'o': case 'u': flags |= DP_F_UNSIGNED; switch (cflags) { case DP_C_SHORT: value = (unsigned short int)va_arg(args, unsigned int); break; case DP_C_LONG: value = (LLONG) va_arg(args, unsigned long int); break; case DP_C_LLONG: value = va_arg(args, unsigned LLONG); break; default: value = (LLONG) va_arg(args, unsigned int); break; } if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, ch == 'o' ? 8 : (ch == 'u' ? 10 : 16), min, max, flags)) return 0; break; case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max, flags)) return 0; break; case 'E': flags |= DP_F_UP; case 'e': if (cflags == DP_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); break; case 'G': flags |= DP_F_UP; case 'g': if (cflags == DP_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); break; case 'c': if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, va_arg(args, int))) return 0; break; case 's': strvalue = va_arg(args, char *); if (max < 0) { if (buffer) max = INT_MAX; else max = *maxlen; } if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue, flags, min, max)) return 0; break; case 'p': value = (long)va_arg(args, void *); if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 16, min, max, flags | DP_F_NUM)) return 0; break; case 'n': /* XXX */ if (cflags == DP_C_SHORT) { short int *num; num = va_arg(args, short int *); - *num = currlen; + *num = (short int)currlen; } else if (cflags == DP_C_LONG) { /* XXX */ long int *num; num = va_arg(args, long int *); *num = (long int)currlen; } else if (cflags == DP_C_LLONG) { /* XXX */ LLONG *num; num = va_arg(args, LLONG *); *num = (LLONG) currlen; } else { int *num; num = va_arg(args, int *); *num = currlen; } break; case '%': if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) return 0; break; case 'w': /* not supported yet, treat as next char */ ch = *format++; break; default: /* unknown, skip */ break; } ch = *format++; state = DP_S_DEFAULT; flags = cflags = min = 0; max = -1; break; case DP_S_DONE: break; default: break; } } /* * We have to truncate if there is no dynamic buffer and we have filled the * static buffer. */ if (buffer == NULL) { *truncated = (currlen > *maxlen - 1); if (*truncated) currlen = *maxlen - 1; } if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0')) return 0; *retlen = currlen - 1; return 1; } static int fmtstr(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, const char *value, int flags, int min, int max) { int padlen; size_t strln; int cnt = 0; if (value == 0) value = ""; strln = strlen(value); if (strln > INT_MAX) strln = INT_MAX; padlen = min - strln; if (min < 0 || padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; while ((padlen > 0) && (cnt < max)) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --padlen; ++cnt; } while (*value && (cnt < max)) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++)) return 0; ++cnt; } while ((padlen < 0) && (cnt < max)) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++padlen; ++cnt; } return 1; } static int fmtint(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, LLONG value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; unsigned LLONG uvalue; char convert[DECIMAL_SIZE(value) + 3]; int place = 0; int spadlen = 0; int zpadlen = 0; int caps = 0; if (max < 0) max = 0; uvalue = value; if (!(flags & DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; - uvalue = -(unsigned LLONG)value; + uvalue = 0 - (unsigned LLONG)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_NUM) { if (base == 8) prefix = "0"; if (base == 16) prefix = "0x"; } if (flags & DP_F_UP) caps = 1; do { convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef") [uvalue % (unsigned)base]; uvalue = (uvalue / (unsigned)base); } while (uvalue && (place < (int)sizeof(convert))); if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = OSSL_MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* spaces */ while (spadlen > 0) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) if(!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } } /* digits */ while (place > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) return 0; } /* left justified spaces */ while (spadlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++spadlen; } return 1; } static LDOUBLE abs_val(LDOUBLE value) { LDOUBLE result = value; if (value < 0) result = -value; return result; } static LDOUBLE pow_10(int in_exp) { LDOUBLE result = 1; while (in_exp) { result *= 10; in_exp--; } return result; } static long roundv(LDOUBLE value) { long intpart; intpart = (long)value; value = value - intpart; if (value >= 0.5) intpart++; return intpart; } static int fmtfp(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; LDOUBLE ufvalue; char iconvert[20]; char fconvert[20]; int iplace = 0; int fplace = 0; int padlen = 0; int zpadlen = 0; long intpart; long fracpart; long max10; if (max < 0) max = 6; ufvalue = abs_val(fvalue); if (fvalue < 0) signvalue = '-'; else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; intpart = (long)ufvalue; /* * sorry, we only support 9 digits past the decimal because of our * conversion method */ if (max > 9) max = 9; /* * we "cheat" by converting the fractional part to integer by multiplying * by a factor of 10 */ max10 = roundv(pow_10(max)); fracpart = roundv(pow_10(max) * (ufvalue - intpart)); if (fracpart >= max10) { intpart++; fracpart -= max10; } /* convert integer part */ do { iconvert[iplace++] = "0123456789"[intpart % 10]; intpart = (intpart / 10); } while (intpart && (iplace < (int)sizeof(iconvert))); if (iplace == sizeof iconvert) iplace--; iconvert[iplace] = 0; /* convert fractional part */ do { fconvert[fplace++] = "0123456789"[fracpart % 10]; fracpart = (fracpart / 10); } while (fplace < max); if (fplace == sizeof fconvert) fplace--; fconvert[fplace] = 0; /* -1 for decimal point, another -1 if we are printing a sign */ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; --padlen; signvalue = 0; } while (padlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --padlen; } } while (padlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --padlen; } if (signvalue && !doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; while (iplace > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace])) return 0; } /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0 || (flags & DP_F_NUM)) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '.')) return 0; while (fplace > 0) { if(!doapr_outch(sbuffer, buffer, currlen, maxlen, fconvert[--fplace])) return 0; } } while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } while (padlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++padlen; } return 1; } #define BUFFER_INC 1024 static int doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int c) { /* If we haven't at least one buffer, someone has doe a big booboo */ assert(*sbuffer != NULL || buffer != NULL); /* |currlen| must always be <= |*maxlen| */ assert(*currlen <= *maxlen); if (buffer && *currlen == *maxlen) { if (*maxlen > INT_MAX - BUFFER_INC) return 0; *maxlen += BUFFER_INC; if (*buffer == NULL) { *buffer = OPENSSL_malloc(*maxlen); if (*buffer == NULL) return 0; if (*currlen > 0) { assert(*sbuffer != NULL); memcpy(*buffer, *sbuffer, *currlen); } *sbuffer = NULL; } else { char *tmpbuf; tmpbuf = OPENSSL_realloc(*buffer, *maxlen); if (tmpbuf == NULL) return 0; *buffer = tmpbuf; } } if (*currlen < *maxlen) { if (*sbuffer) (*sbuffer)[(*currlen)++] = (char)c; else (*buffer)[(*currlen)++] = (char)c; } return 1; } /***************************************************************************/ int BIO_printf(BIO *bio, const char *format, ...) { va_list args; int ret; va_start(args, format); ret = BIO_vprintf(bio, format, args); va_end(args); return (ret); } int BIO_vprintf(BIO *bio, const char *format, va_list args) { int ret; size_t retlen; char hugebuf[1024 * 2]; /* Was previously 10k, which is unreasonable * in small-stack environments, like threads * or DOS programs. */ char *hugebufp = hugebuf; size_t hugebufsize = sizeof(hugebuf); char *dynbuf = NULL; int ignored; dynbuf = NULL; CRYPTO_push_info("doapr()"); if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, args)) { OPENSSL_free(dynbuf); return -1; } if (dynbuf) { ret = BIO_write(bio, dynbuf, (int)retlen); OPENSSL_free(dynbuf); } else { ret = BIO_write(bio, hugebuf, (int)retlen); } CRYPTO_pop_info(); return (ret); } /* * As snprintf is not available everywhere, we provide our own * implementation. This function has nothing to do with BIOs, but it's * closely related to BIO_printf, and we need *some* name prefix ... (XXX the * function should be renamed, but to what?) */ int BIO_snprintf(char *buf, size_t n, const char *format, ...) { va_list args; int ret; va_start(args, format); ret = BIO_vsnprintf(buf, n, format, args); va_end(args); return (ret); } int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) { size_t retlen; int truncated; if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args)) return -1; if (truncated) /* * In case of truncation, return -1 like traditional snprintf. * (Current drafts for ISO/IEC 9899 say snprintf should return the * number of characters that would have been written, had the buffer * been large enough.) */ return -1; else return (retlen <= INT_MAX) ? (int)retlen : -1; } diff --git a/crypto/bn/asm/rsaz-avx2.pl b/crypto/bn/asm/rsaz-avx2.pl index 712a77fe8ca3..2b3f8b0e21ec 100755 --- a/crypto/bn/asm/rsaz-avx2.pl +++ b/crypto/bn/asm/rsaz-avx2.pl @@ -1,1961 +1,1960 @@ #!/usr/bin/env perl ############################################################################## # # # Copyright (c) 2012, Intel Corporation # # # # All rights reserved. # # # # Redistribution and use in source and binary forms, with or without # # modification, are permitted provided that the following conditions are # # met: # # # # * Redistributions of source code must retain the above copyright # # notice, this list of conditions and the following disclaimer. # # # # * Redistributions in binary form must reproduce the above copyright # # notice, this list of conditions and the following disclaimer in the # # documentation and/or other materials provided with the # # distribution. # # # # * Neither the name of the Intel Corporation nor the names of its # # contributors may be used to endorse or promote products derived from # # this software without specific prior written permission. # # # # # # THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY # # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR # # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # ############################################################################## # Developers and authors: # # Shay Gueron (1, 2), and Vlad Krasnov (1) # # (1) Intel Corporation, Israel Development Center, Haifa, Israel # # (2) University of Haifa, Israel # ############################################################################## # Reference: # # [1] S. Gueron, V. Krasnov: "Software Implementation of Modular # # Exponentiation, Using Advanced Vector Instructions Architectures", # # F. Ozbudak and F. Rodriguez-Henriquez (Eds.): WAIFI 2012, LNCS 7369, # # pp. 119?135, 2012. Springer-Verlag Berlin Heidelberg 2012 # # [2] S. Gueron: "Efficient Software Implementations of Modular # # Exponentiation", Journal of Cryptographic Engineering 2:31-43 (2012). # # [3] S. Gueron, V. Krasnov: "Speeding up Big-numbers Squaring",IEEE # # Proceedings of 9th International Conference on Information Technology: # # New Generations (ITNG 2012), pp.821-823 (2012) # # [4] S. Gueron, V. Krasnov: "[PATCH] Efficient and side channel analysis # # resistant 1024-bit modular exponentiation, for optimizing RSA2048 # # on AVX2 capable x86_64 platforms", # # http://rt.openssl.org/Ticket/Display.html?id=2850&user=guest&pass=guest# ############################################################################## # # +13% improvement over original submission by # # rsa2048 sign/sec OpenSSL 1.0.1 scalar(*) this # 2.3GHz Haswell 621 765/+23% 1113/+79% # 2.3GHz Broadwell(**) 688 1200(***)/+74% 1120/+63% # # (*) if system doesn't support AVX2, for reference purposes; # (**) scaled to 2.3GHz to simplify comparison; # (***) scalar AD*X code is faster than AVX2 and is preferred code # path for Broadwell; $flavour = shift; $output = shift; if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or die "can't locate x86_64-xlate.pl"; if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` =~ /GNU assembler version ([2-9]\.[0-9]+)/) { $avx = ($1>=2.19) + ($1>=2.22); $addx = ($1>=2.23); } if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) && `nasm -v 2>&1` =~ /NASM version ([2-9]\.[0-9]+)/) { $avx = ($1>=2.09) + ($1>=2.10); $addx = ($1>=2.10); } if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) && `ml64 2>&1` =~ /Version ([0-9]+)\./) { $avx = ($1>=10) + ($1>=11); $addx = ($1>=11); } if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on LLVM) ([3-9])\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $avx = ($ver>=3.0) + ($ver>=3.01); $addx = ($ver>=3.03); } open OUT,"| \"$^X\" $xlate $flavour $output"; *STDOUT = *OUT; if ($avx>1) {{{ { # void AMS_WW( my $rp="%rdi"; # BN_ULONG *rp, my $ap="%rsi"; # const BN_ULONG *ap, my $np="%rdx"; # const BN_ULONG *np, my $n0="%ecx"; # const BN_ULONG n0, my $rep="%r8d"; # int repeat); # The registers that hold the accumulated redundant result # The AMM works on 1024 bit operands, and redundant word size is 29 # Therefore: ceil(1024/29)/4 = 9 my $ACC0="%ymm0"; my $ACC1="%ymm1"; my $ACC2="%ymm2"; my $ACC3="%ymm3"; my $ACC4="%ymm4"; my $ACC5="%ymm5"; my $ACC6="%ymm6"; my $ACC7="%ymm7"; my $ACC8="%ymm8"; my $ACC9="%ymm9"; # Registers that hold the broadcasted words of bp, currently used my $B1="%ymm10"; my $B2="%ymm11"; # Registers that hold the broadcasted words of Y, currently used my $Y1="%ymm12"; my $Y2="%ymm13"; # Helper registers my $TEMP1="%ymm14"; my $AND_MASK="%ymm15"; # alu registers that hold the first words of the ACC my $r0="%r9"; my $r1="%r10"; my $r2="%r11"; my $r3="%r12"; my $i="%r14d"; # loop counter my $tmp = "%r15"; my $FrameSize=32*18+32*8; # place for A^2 and 2*A my $aap=$r0; my $tp0="%rbx"; my $tp1=$r3; my $tpa=$tmp; $np="%r13"; # reassigned argument $code.=<<___; .text .globl rsaz_1024_sqr_avx2 .type rsaz_1024_sqr_avx2,\@function,5 .align 64 rsaz_1024_sqr_avx2: # 702 cycles, 14% faster than rsaz_1024_mul_avx2 lea (%rsp), %rax push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 vzeroupper ___ $code.=<<___ if ($win64); lea -0xa8(%rsp),%rsp vmovaps %xmm6,-0xd8(%rax) vmovaps %xmm7,-0xc8(%rax) vmovaps %xmm8,-0xb8(%rax) vmovaps %xmm9,-0xa8(%rax) vmovaps %xmm10,-0x98(%rax) vmovaps %xmm11,-0x88(%rax) vmovaps %xmm12,-0x78(%rax) vmovaps %xmm13,-0x68(%rax) vmovaps %xmm14,-0x58(%rax) vmovaps %xmm15,-0x48(%rax) .Lsqr_1024_body: ___ $code.=<<___; mov %rax,%rbp mov %rdx, $np # reassigned argument sub \$$FrameSize, %rsp mov $np, $tmp sub \$-128, $rp # size optimization sub \$-128, $ap sub \$-128, $np and \$4095, $tmp # see if $np crosses page add \$32*10, $tmp shr \$12, $tmp vpxor $ACC9,$ACC9,$ACC9 jz .Lsqr_1024_no_n_copy # unaligned 256-bit load that crosses page boundary can # cause >2x performance degradation here, so if $np does # cross page boundary, copy it to stack and make sure stack # frame doesn't... sub \$32*10,%rsp vmovdqu 32*0-128($np), $ACC0 and \$-2048, %rsp vmovdqu 32*1-128($np), $ACC1 vmovdqu 32*2-128($np), $ACC2 vmovdqu 32*3-128($np), $ACC3 vmovdqu 32*4-128($np), $ACC4 vmovdqu 32*5-128($np), $ACC5 vmovdqu 32*6-128($np), $ACC6 vmovdqu 32*7-128($np), $ACC7 vmovdqu 32*8-128($np), $ACC8 lea $FrameSize+128(%rsp),$np vmovdqu $ACC0, 32*0-128($np) vmovdqu $ACC1, 32*1-128($np) vmovdqu $ACC2, 32*2-128($np) vmovdqu $ACC3, 32*3-128($np) vmovdqu $ACC4, 32*4-128($np) vmovdqu $ACC5, 32*5-128($np) vmovdqu $ACC6, 32*6-128($np) vmovdqu $ACC7, 32*7-128($np) vmovdqu $ACC8, 32*8-128($np) vmovdqu $ACC9, 32*9-128($np) # $ACC9 is zero .Lsqr_1024_no_n_copy: and \$-1024, %rsp vmovdqu 32*1-128($ap), $ACC1 vmovdqu 32*2-128($ap), $ACC2 vmovdqu 32*3-128($ap), $ACC3 vmovdqu 32*4-128($ap), $ACC4 vmovdqu 32*5-128($ap), $ACC5 vmovdqu 32*6-128($ap), $ACC6 vmovdqu 32*7-128($ap), $ACC7 vmovdqu 32*8-128($ap), $ACC8 lea 192(%rsp), $tp0 # 64+128=192 - vpbroadcastq .Land_mask(%rip), $AND_MASK + vmovdqu .Land_mask(%rip), $AND_MASK jmp .LOOP_GRANDE_SQR_1024 .align 32 .LOOP_GRANDE_SQR_1024: lea 32*18+128(%rsp), $aap # size optimization lea 448(%rsp), $tp1 # 64+128+256=448 # the squaring is performed as described in Variant B of # "Speeding up Big-Number Squaring", so start by calculating # the A*2=A+A vector vpaddq $ACC1, $ACC1, $ACC1 vpbroadcastq 32*0-128($ap), $B1 vpaddq $ACC2, $ACC2, $ACC2 vmovdqa $ACC1, 32*0-128($aap) vpaddq $ACC3, $ACC3, $ACC3 vmovdqa $ACC2, 32*1-128($aap) vpaddq $ACC4, $ACC4, $ACC4 vmovdqa $ACC3, 32*2-128($aap) vpaddq $ACC5, $ACC5, $ACC5 vmovdqa $ACC4, 32*3-128($aap) vpaddq $ACC6, $ACC6, $ACC6 vmovdqa $ACC5, 32*4-128($aap) vpaddq $ACC7, $ACC7, $ACC7 vmovdqa $ACC6, 32*5-128($aap) vpaddq $ACC8, $ACC8, $ACC8 vmovdqa $ACC7, 32*6-128($aap) vpxor $ACC9, $ACC9, $ACC9 vmovdqa $ACC8, 32*7-128($aap) vpmuludq 32*0-128($ap), $B1, $ACC0 vpbroadcastq 32*1-128($ap), $B2 vmovdqu $ACC9, 32*9-192($tp0) # zero upper half vpmuludq $B1, $ACC1, $ACC1 vmovdqu $ACC9, 32*10-448($tp1) vpmuludq $B1, $ACC2, $ACC2 vmovdqu $ACC9, 32*11-448($tp1) vpmuludq $B1, $ACC3, $ACC3 vmovdqu $ACC9, 32*12-448($tp1) vpmuludq $B1, $ACC4, $ACC4 vmovdqu $ACC9, 32*13-448($tp1) vpmuludq $B1, $ACC5, $ACC5 vmovdqu $ACC9, 32*14-448($tp1) vpmuludq $B1, $ACC6, $ACC6 vmovdqu $ACC9, 32*15-448($tp1) vpmuludq $B1, $ACC7, $ACC7 vmovdqu $ACC9, 32*16-448($tp1) vpmuludq $B1, $ACC8, $ACC8 vpbroadcastq 32*2-128($ap), $B1 vmovdqu $ACC9, 32*17-448($tp1) mov $ap, $tpa mov \$4, $i jmp .Lsqr_entry_1024 ___ $TEMP0=$Y1; $TEMP2=$Y2; $code.=<<___; .align 32 .LOOP_SQR_1024: vpbroadcastq 32*1-128($tpa), $B2 vpmuludq 32*0-128($ap), $B1, $ACC0 vpaddq 32*0-192($tp0), $ACC0, $ACC0 vpmuludq 32*0-128($aap), $B1, $ACC1 vpaddq 32*1-192($tp0), $ACC1, $ACC1 vpmuludq 32*1-128($aap), $B1, $ACC2 vpaddq 32*2-192($tp0), $ACC2, $ACC2 vpmuludq 32*2-128($aap), $B1, $ACC3 vpaddq 32*3-192($tp0), $ACC3, $ACC3 vpmuludq 32*3-128($aap), $B1, $ACC4 vpaddq 32*4-192($tp0), $ACC4, $ACC4 vpmuludq 32*4-128($aap), $B1, $ACC5 vpaddq 32*5-192($tp0), $ACC5, $ACC5 vpmuludq 32*5-128($aap), $B1, $ACC6 vpaddq 32*6-192($tp0), $ACC6, $ACC6 vpmuludq 32*6-128($aap), $B1, $ACC7 vpaddq 32*7-192($tp0), $ACC7, $ACC7 vpmuludq 32*7-128($aap), $B1, $ACC8 vpbroadcastq 32*2-128($tpa), $B1 vpaddq 32*8-192($tp0), $ACC8, $ACC8 .Lsqr_entry_1024: vmovdqu $ACC0, 32*0-192($tp0) vmovdqu $ACC1, 32*1-192($tp0) vpmuludq 32*1-128($ap), $B2, $TEMP0 vpaddq $TEMP0, $ACC2, $ACC2 vpmuludq 32*1-128($aap), $B2, $TEMP1 vpaddq $TEMP1, $ACC3, $ACC3 vpmuludq 32*2-128($aap), $B2, $TEMP2 vpaddq $TEMP2, $ACC4, $ACC4 vpmuludq 32*3-128($aap), $B2, $TEMP0 vpaddq $TEMP0, $ACC5, $ACC5 vpmuludq 32*4-128($aap), $B2, $TEMP1 vpaddq $TEMP1, $ACC6, $ACC6 vpmuludq 32*5-128($aap), $B2, $TEMP2 vpaddq $TEMP2, $ACC7, $ACC7 vpmuludq 32*6-128($aap), $B2, $TEMP0 vpaddq $TEMP0, $ACC8, $ACC8 vpmuludq 32*7-128($aap), $B2, $ACC0 vpbroadcastq 32*3-128($tpa), $B2 vpaddq 32*9-192($tp0), $ACC0, $ACC0 vmovdqu $ACC2, 32*2-192($tp0) vmovdqu $ACC3, 32*3-192($tp0) vpmuludq 32*2-128($ap), $B1, $TEMP2 vpaddq $TEMP2, $ACC4, $ACC4 vpmuludq 32*2-128($aap), $B1, $TEMP0 vpaddq $TEMP0, $ACC5, $ACC5 vpmuludq 32*3-128($aap), $B1, $TEMP1 vpaddq $TEMP1, $ACC6, $ACC6 vpmuludq 32*4-128($aap), $B1, $TEMP2 vpaddq $TEMP2, $ACC7, $ACC7 vpmuludq 32*5-128($aap), $B1, $TEMP0 vpaddq $TEMP0, $ACC8, $ACC8 vpmuludq 32*6-128($aap), $B1, $TEMP1 vpaddq $TEMP1, $ACC0, $ACC0 vpmuludq 32*7-128($aap), $B1, $ACC1 vpbroadcastq 32*4-128($tpa), $B1 vpaddq 32*10-448($tp1), $ACC1, $ACC1 vmovdqu $ACC4, 32*4-192($tp0) vmovdqu $ACC5, 32*5-192($tp0) vpmuludq 32*3-128($ap), $B2, $TEMP0 vpaddq $TEMP0, $ACC6, $ACC6 vpmuludq 32*3-128($aap), $B2, $TEMP1 vpaddq $TEMP1, $ACC7, $ACC7 vpmuludq 32*4-128($aap), $B2, $TEMP2 vpaddq $TEMP2, $ACC8, $ACC8 vpmuludq 32*5-128($aap), $B2, $TEMP0 vpaddq $TEMP0, $ACC0, $ACC0 vpmuludq 32*6-128($aap), $B2, $TEMP1 vpaddq $TEMP1, $ACC1, $ACC1 vpmuludq 32*7-128($aap), $B2, $ACC2 vpbroadcastq 32*5-128($tpa), $B2 vpaddq 32*11-448($tp1), $ACC2, $ACC2 vmovdqu $ACC6, 32*6-192($tp0) vmovdqu $ACC7, 32*7-192($tp0) vpmuludq 32*4-128($ap), $B1, $TEMP0 vpaddq $TEMP0, $ACC8, $ACC8 vpmuludq 32*4-128($aap), $B1, $TEMP1 vpaddq $TEMP1, $ACC0, $ACC0 vpmuludq 32*5-128($aap), $B1, $TEMP2 vpaddq $TEMP2, $ACC1, $ACC1 vpmuludq 32*6-128($aap), $B1, $TEMP0 vpaddq $TEMP0, $ACC2, $ACC2 vpmuludq 32*7-128($aap), $B1, $ACC3 vpbroadcastq 32*6-128($tpa), $B1 vpaddq 32*12-448($tp1), $ACC3, $ACC3 vmovdqu $ACC8, 32*8-192($tp0) vmovdqu $ACC0, 32*9-192($tp0) lea 8($tp0), $tp0 vpmuludq 32*5-128($ap), $B2, $TEMP2 vpaddq $TEMP2, $ACC1, $ACC1 vpmuludq 32*5-128($aap), $B2, $TEMP0 vpaddq $TEMP0, $ACC2, $ACC2 vpmuludq 32*6-128($aap), $B2, $TEMP1 vpaddq $TEMP1, $ACC3, $ACC3 vpmuludq 32*7-128($aap), $B2, $ACC4 vpbroadcastq 32*7-128($tpa), $B2 vpaddq 32*13-448($tp1), $ACC4, $ACC4 vmovdqu $ACC1, 32*10-448($tp1) vmovdqu $ACC2, 32*11-448($tp1) vpmuludq 32*6-128($ap), $B1, $TEMP0 vpaddq $TEMP0, $ACC3, $ACC3 vpmuludq 32*6-128($aap), $B1, $TEMP1 vpbroadcastq 32*8-128($tpa), $ACC0 # borrow $ACC0 for $B1 vpaddq $TEMP1, $ACC4, $ACC4 vpmuludq 32*7-128($aap), $B1, $ACC5 vpbroadcastq 32*0+8-128($tpa), $B1 # for next iteration vpaddq 32*14-448($tp1), $ACC5, $ACC5 vmovdqu $ACC3, 32*12-448($tp1) vmovdqu $ACC4, 32*13-448($tp1) lea 8($tpa), $tpa vpmuludq 32*7-128($ap), $B2, $TEMP0 vpaddq $TEMP0, $ACC5, $ACC5 vpmuludq 32*7-128($aap), $B2, $ACC6 vpaddq 32*15-448($tp1), $ACC6, $ACC6 vpmuludq 32*8-128($ap), $ACC0, $ACC7 vmovdqu $ACC5, 32*14-448($tp1) vpaddq 32*16-448($tp1), $ACC7, $ACC7 vmovdqu $ACC6, 32*15-448($tp1) vmovdqu $ACC7, 32*16-448($tp1) lea 8($tp1), $tp1 dec $i jnz .LOOP_SQR_1024 ___ $ZERO = $ACC9; $TEMP0 = $B1; $TEMP2 = $B2; $TEMP3 = $Y1; $TEMP4 = $Y2; $code.=<<___; # we need to fix indices 32-39 to avoid overflow vmovdqu 32*8(%rsp), $ACC8 # 32*8-192($tp0), vmovdqu 32*9(%rsp), $ACC1 # 32*9-192($tp0) vmovdqu 32*10(%rsp), $ACC2 # 32*10-192($tp0) lea 192(%rsp), $tp0 # 64+128=192 vpsrlq \$29, $ACC8, $TEMP1 vpand $AND_MASK, $ACC8, $ACC8 vpsrlq \$29, $ACC1, $TEMP2 vpand $AND_MASK, $ACC1, $ACC1 vpermq \$0x93, $TEMP1, $TEMP1 vpxor $ZERO, $ZERO, $ZERO vpermq \$0x93, $TEMP2, $TEMP2 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC8, $ACC8 vpblendd \$3, $TEMP2, $ZERO, $TEMP2 vpaddq $TEMP1, $ACC1, $ACC1 vpaddq $TEMP2, $ACC2, $ACC2 vmovdqu $ACC1, 32*9-192($tp0) vmovdqu $ACC2, 32*10-192($tp0) mov (%rsp), %rax mov 8(%rsp), $r1 mov 16(%rsp), $r2 mov 24(%rsp), $r3 vmovdqu 32*1(%rsp), $ACC1 vmovdqu 32*2-192($tp0), $ACC2 vmovdqu 32*3-192($tp0), $ACC3 vmovdqu 32*4-192($tp0), $ACC4 vmovdqu 32*5-192($tp0), $ACC5 vmovdqu 32*6-192($tp0), $ACC6 vmovdqu 32*7-192($tp0), $ACC7 mov %rax, $r0 imull $n0, %eax and \$0x1fffffff, %eax vmovd %eax, $Y1 mov %rax, %rdx imulq -128($np), %rax vpbroadcastq $Y1, $Y1 add %rax, $r0 mov %rdx, %rax imulq 8-128($np), %rax shr \$29, $r0 add %rax, $r1 mov %rdx, %rax imulq 16-128($np), %rax add $r0, $r1 add %rax, $r2 imulq 24-128($np), %rdx add %rdx, $r3 mov $r1, %rax imull $n0, %eax and \$0x1fffffff, %eax mov \$9, $i jmp .LOOP_REDUCE_1024 .align 32 .LOOP_REDUCE_1024: vmovd %eax, $Y2 vpbroadcastq $Y2, $Y2 vpmuludq 32*1-128($np), $Y1, $TEMP0 mov %rax, %rdx imulq -128($np), %rax vpaddq $TEMP0, $ACC1, $ACC1 add %rax, $r1 vpmuludq 32*2-128($np), $Y1, $TEMP1 mov %rdx, %rax imulq 8-128($np), %rax vpaddq $TEMP1, $ACC2, $ACC2 vpmuludq 32*3-128($np), $Y1, $TEMP2 .byte 0x67 add %rax, $r2 .byte 0x67 mov %rdx, %rax imulq 16-128($np), %rax shr \$29, $r1 vpaddq $TEMP2, $ACC3, $ACC3 vpmuludq 32*4-128($np), $Y1, $TEMP0 add %rax, $r3 add $r1, $r2 vpaddq $TEMP0, $ACC4, $ACC4 vpmuludq 32*5-128($np), $Y1, $TEMP1 mov $r2, %rax imull $n0, %eax vpaddq $TEMP1, $ACC5, $ACC5 vpmuludq 32*6-128($np), $Y1, $TEMP2 and \$0x1fffffff, %eax vpaddq $TEMP2, $ACC6, $ACC6 vpmuludq 32*7-128($np), $Y1, $TEMP0 vpaddq $TEMP0, $ACC7, $ACC7 vpmuludq 32*8-128($np), $Y1, $TEMP1 vmovd %eax, $Y1 #vmovdqu 32*1-8-128($np), $TEMP2 # moved below vpaddq $TEMP1, $ACC8, $ACC8 #vmovdqu 32*2-8-128($np), $TEMP0 # moved below vpbroadcastq $Y1, $Y1 vpmuludq 32*1-8-128($np), $Y2, $TEMP2 # see above vmovdqu 32*3-8-128($np), $TEMP1 mov %rax, %rdx imulq -128($np), %rax vpaddq $TEMP2, $ACC1, $ACC1 vpmuludq 32*2-8-128($np), $Y2, $TEMP0 # see above vmovdqu 32*4-8-128($np), $TEMP2 add %rax, $r2 mov %rdx, %rax imulq 8-128($np), %rax vpaddq $TEMP0, $ACC2, $ACC2 add $r3, %rax shr \$29, $r2 vpmuludq $Y2, $TEMP1, $TEMP1 vmovdqu 32*5-8-128($np), $TEMP0 add $r2, %rax vpaddq $TEMP1, $ACC3, $ACC3 vpmuludq $Y2, $TEMP2, $TEMP2 vmovdqu 32*6-8-128($np), $TEMP1 .byte 0x67 mov %rax, $r3 imull $n0, %eax vpaddq $TEMP2, $ACC4, $ACC4 vpmuludq $Y2, $TEMP0, $TEMP0 .byte 0xc4,0x41,0x7e,0x6f,0x9d,0x58,0x00,0x00,0x00 # vmovdqu 32*7-8-128($np), $TEMP2 and \$0x1fffffff, %eax vpaddq $TEMP0, $ACC5, $ACC5 vpmuludq $Y2, $TEMP1, $TEMP1 vmovdqu 32*8-8-128($np), $TEMP0 vpaddq $TEMP1, $ACC6, $ACC6 vpmuludq $Y2, $TEMP2, $TEMP2 vmovdqu 32*9-8-128($np), $ACC9 vmovd %eax, $ACC0 # borrow ACC0 for Y2 imulq -128($np), %rax vpaddq $TEMP2, $ACC7, $ACC7 vpmuludq $Y2, $TEMP0, $TEMP0 vmovdqu 32*1-16-128($np), $TEMP1 vpbroadcastq $ACC0, $ACC0 vpaddq $TEMP0, $ACC8, $ACC8 vpmuludq $Y2, $ACC9, $ACC9 vmovdqu 32*2-16-128($np), $TEMP2 add %rax, $r3 ___ ($ACC0,$Y2)=($Y2,$ACC0); $code.=<<___; vmovdqu 32*1-24-128($np), $ACC0 vpmuludq $Y1, $TEMP1, $TEMP1 vmovdqu 32*3-16-128($np), $TEMP0 vpaddq $TEMP1, $ACC1, $ACC1 vpmuludq $Y2, $ACC0, $ACC0 vpmuludq $Y1, $TEMP2, $TEMP2 .byte 0xc4,0x41,0x7e,0x6f,0xb5,0xf0,0xff,0xff,0xff # vmovdqu 32*4-16-128($np), $TEMP1 vpaddq $ACC1, $ACC0, $ACC0 vpaddq $TEMP2, $ACC2, $ACC2 vpmuludq $Y1, $TEMP0, $TEMP0 vmovdqu 32*5-16-128($np), $TEMP2 .byte 0x67 vmovq $ACC0, %rax vmovdqu $ACC0, (%rsp) # transfer $r0-$r3 vpaddq $TEMP0, $ACC3, $ACC3 vpmuludq $Y1, $TEMP1, $TEMP1 vmovdqu 32*6-16-128($np), $TEMP0 vpaddq $TEMP1, $ACC4, $ACC4 vpmuludq $Y1, $TEMP2, $TEMP2 vmovdqu 32*7-16-128($np), $TEMP1 vpaddq $TEMP2, $ACC5, $ACC5 vpmuludq $Y1, $TEMP0, $TEMP0 vmovdqu 32*8-16-128($np), $TEMP2 vpaddq $TEMP0, $ACC6, $ACC6 vpmuludq $Y1, $TEMP1, $TEMP1 shr \$29, $r3 vmovdqu 32*9-16-128($np), $TEMP0 add $r3, %rax vpaddq $TEMP1, $ACC7, $ACC7 vpmuludq $Y1, $TEMP2, $TEMP2 #vmovdqu 32*2-24-128($np), $TEMP1 # moved below mov %rax, $r0 imull $n0, %eax vpaddq $TEMP2, $ACC8, $ACC8 vpmuludq $Y1, $TEMP0, $TEMP0 and \$0x1fffffff, %eax vmovd %eax, $Y1 vmovdqu 32*3-24-128($np), $TEMP2 .byte 0x67 vpaddq $TEMP0, $ACC9, $ACC9 vpbroadcastq $Y1, $Y1 vpmuludq 32*2-24-128($np), $Y2, $TEMP1 # see above vmovdqu 32*4-24-128($np), $TEMP0 mov %rax, %rdx imulq -128($np), %rax mov 8(%rsp), $r1 vpaddq $TEMP1, $ACC2, $ACC1 vpmuludq $Y2, $TEMP2, $TEMP2 vmovdqu 32*5-24-128($np), $TEMP1 add %rax, $r0 mov %rdx, %rax imulq 8-128($np), %rax .byte 0x67 shr \$29, $r0 mov 16(%rsp), $r2 vpaddq $TEMP2, $ACC3, $ACC2 vpmuludq $Y2, $TEMP0, $TEMP0 vmovdqu 32*6-24-128($np), $TEMP2 add %rax, $r1 mov %rdx, %rax imulq 16-128($np), %rax vpaddq $TEMP0, $ACC4, $ACC3 vpmuludq $Y2, $TEMP1, $TEMP1 vmovdqu 32*7-24-128($np), $TEMP0 imulq 24-128($np), %rdx # future $r3 add %rax, $r2 lea ($r0,$r1), %rax vpaddq $TEMP1, $ACC5, $ACC4 vpmuludq $Y2, $TEMP2, $TEMP2 vmovdqu 32*8-24-128($np), $TEMP1 mov %rax, $r1 imull $n0, %eax vpmuludq $Y2, $TEMP0, $TEMP0 vpaddq $TEMP2, $ACC6, $ACC5 vmovdqu 32*9-24-128($np), $TEMP2 and \$0x1fffffff, %eax vpaddq $TEMP0, $ACC7, $ACC6 vpmuludq $Y2, $TEMP1, $TEMP1 add 24(%rsp), %rdx vpaddq $TEMP1, $ACC8, $ACC7 vpmuludq $Y2, $TEMP2, $TEMP2 vpaddq $TEMP2, $ACC9, $ACC8 vmovq $r3, $ACC9 mov %rdx, $r3 dec $i jnz .LOOP_REDUCE_1024 ___ ($ACC0,$Y2)=($Y2,$ACC0); $code.=<<___; lea 448(%rsp), $tp1 # size optimization vpaddq $ACC9, $Y2, $ACC0 vpxor $ZERO, $ZERO, $ZERO vpaddq 32*9-192($tp0), $ACC0, $ACC0 vpaddq 32*10-448($tp1), $ACC1, $ACC1 vpaddq 32*11-448($tp1), $ACC2, $ACC2 vpaddq 32*12-448($tp1), $ACC3, $ACC3 vpaddq 32*13-448($tp1), $ACC4, $ACC4 vpaddq 32*14-448($tp1), $ACC5, $ACC5 vpaddq 32*15-448($tp1), $ACC6, $ACC6 vpaddq 32*16-448($tp1), $ACC7, $ACC7 vpaddq 32*17-448($tp1), $ACC8, $ACC8 vpsrlq \$29, $ACC0, $TEMP1 vpand $AND_MASK, $ACC0, $ACC0 vpsrlq \$29, $ACC1, $TEMP2 vpand $AND_MASK, $ACC1, $ACC1 vpsrlq \$29, $ACC2, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC2, $ACC2 vpsrlq \$29, $ACC3, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC3, $ACC3 vpermq \$0x93, $TEMP3, $TEMP3 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC0, $ACC0 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC1, $ACC1 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC2, $ACC2 vpblendd \$3, $TEMP4, $ZERO, $TEMP4 vpaddq $TEMP3, $ACC3, $ACC3 vpaddq $TEMP4, $ACC4, $ACC4 vpsrlq \$29, $ACC0, $TEMP1 vpand $AND_MASK, $ACC0, $ACC0 vpsrlq \$29, $ACC1, $TEMP2 vpand $AND_MASK, $ACC1, $ACC1 vpsrlq \$29, $ACC2, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC2, $ACC2 vpsrlq \$29, $ACC3, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC3, $ACC3 vpermq \$0x93, $TEMP3, $TEMP3 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC0, $ACC0 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC1, $ACC1 vmovdqu $ACC0, 32*0-128($rp) vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC2, $ACC2 vmovdqu $ACC1, 32*1-128($rp) vpblendd \$3, $TEMP4, $ZERO, $TEMP4 vpaddq $TEMP3, $ACC3, $ACC3 vmovdqu $ACC2, 32*2-128($rp) vpaddq $TEMP4, $ACC4, $ACC4 vmovdqu $ACC3, 32*3-128($rp) ___ $TEMP5=$ACC0; $code.=<<___; vpsrlq \$29, $ACC4, $TEMP1 vpand $AND_MASK, $ACC4, $ACC4 vpsrlq \$29, $ACC5, $TEMP2 vpand $AND_MASK, $ACC5, $ACC5 vpsrlq \$29, $ACC6, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC6, $ACC6 vpsrlq \$29, $ACC7, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC7, $ACC7 vpsrlq \$29, $ACC8, $TEMP5 vpermq \$0x93, $TEMP3, $TEMP3 vpand $AND_MASK, $ACC8, $ACC8 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP5, $TEMP5 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC4, $ACC4 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC5, $ACC5 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC6, $ACC6 vpblendd \$3, $TEMP4, $TEMP5, $TEMP4 vpaddq $TEMP3, $ACC7, $ACC7 vpaddq $TEMP4, $ACC8, $ACC8 vpsrlq \$29, $ACC4, $TEMP1 vpand $AND_MASK, $ACC4, $ACC4 vpsrlq \$29, $ACC5, $TEMP2 vpand $AND_MASK, $ACC5, $ACC5 vpsrlq \$29, $ACC6, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC6, $ACC6 vpsrlq \$29, $ACC7, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC7, $ACC7 vpsrlq \$29, $ACC8, $TEMP5 vpermq \$0x93, $TEMP3, $TEMP3 vpand $AND_MASK, $ACC8, $ACC8 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP5, $TEMP5 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC4, $ACC4 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC5, $ACC5 vmovdqu $ACC4, 32*4-128($rp) vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC6, $ACC6 vmovdqu $ACC5, 32*5-128($rp) vpblendd \$3, $TEMP4, $TEMP5, $TEMP4 vpaddq $TEMP3, $ACC7, $ACC7 vmovdqu $ACC6, 32*6-128($rp) vpaddq $TEMP4, $ACC8, $ACC8 vmovdqu $ACC7, 32*7-128($rp) vmovdqu $ACC8, 32*8-128($rp) mov $rp, $ap dec $rep jne .LOOP_GRANDE_SQR_1024 vzeroall mov %rbp, %rax ___ $code.=<<___ if ($win64); movaps -0xd8(%rax),%xmm6 movaps -0xc8(%rax),%xmm7 movaps -0xb8(%rax),%xmm8 movaps -0xa8(%rax),%xmm9 movaps -0x98(%rax),%xmm10 movaps -0x88(%rax),%xmm11 movaps -0x78(%rax),%xmm12 movaps -0x68(%rax),%xmm13 movaps -0x58(%rax),%xmm14 movaps -0x48(%rax),%xmm15 ___ $code.=<<___; mov -48(%rax),%r15 mov -40(%rax),%r14 mov -32(%rax),%r13 mov -24(%rax),%r12 mov -16(%rax),%rbp mov -8(%rax),%rbx lea (%rax),%rsp # restore %rsp .Lsqr_1024_epilogue: ret .size rsaz_1024_sqr_avx2,.-rsaz_1024_sqr_avx2 ___ } { # void AMM_WW( my $rp="%rdi"; # BN_ULONG *rp, my $ap="%rsi"; # const BN_ULONG *ap, my $bp="%rdx"; # const BN_ULONG *bp, my $np="%rcx"; # const BN_ULONG *np, my $n0="%r8d"; # unsigned int n0); # The registers that hold the accumulated redundant result # The AMM works on 1024 bit operands, and redundant word size is 29 # Therefore: ceil(1024/29)/4 = 9 my $ACC0="%ymm0"; my $ACC1="%ymm1"; my $ACC2="%ymm2"; my $ACC3="%ymm3"; my $ACC4="%ymm4"; my $ACC5="%ymm5"; my $ACC6="%ymm6"; my $ACC7="%ymm7"; my $ACC8="%ymm8"; my $ACC9="%ymm9"; # Registers that hold the broadcasted words of multiplier, currently used my $Bi="%ymm10"; my $Yi="%ymm11"; # Helper registers my $TEMP0=$ACC0; my $TEMP1="%ymm12"; my $TEMP2="%ymm13"; my $ZERO="%ymm14"; my $AND_MASK="%ymm15"; # alu registers that hold the first words of the ACC my $r0="%r9"; my $r1="%r10"; my $r2="%r11"; my $r3="%r12"; my $i="%r14d"; my $tmp="%r15"; $bp="%r13"; # reassigned argument $code.=<<___; .globl rsaz_1024_mul_avx2 .type rsaz_1024_mul_avx2,\@function,5 .align 64 rsaz_1024_mul_avx2: lea (%rsp), %rax push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 ___ $code.=<<___ if ($win64); vzeroupper lea -0xa8(%rsp),%rsp vmovaps %xmm6,-0xd8(%rax) vmovaps %xmm7,-0xc8(%rax) vmovaps %xmm8,-0xb8(%rax) vmovaps %xmm9,-0xa8(%rax) vmovaps %xmm10,-0x98(%rax) vmovaps %xmm11,-0x88(%rax) vmovaps %xmm12,-0x78(%rax) vmovaps %xmm13,-0x68(%rax) vmovaps %xmm14,-0x58(%rax) vmovaps %xmm15,-0x48(%rax) .Lmul_1024_body: ___ $code.=<<___; mov %rax,%rbp vzeroall mov %rdx, $bp # reassigned argument sub \$64,%rsp # unaligned 256-bit load that crosses page boundary can # cause severe performance degradation here, so if $ap does # cross page boundary, swap it with $bp [meaning that caller # is advised to lay down $ap and $bp next to each other, so # that only one can cross page boundary]. .byte 0x67,0x67 mov $ap, $tmp and \$4095, $tmp add \$32*10, $tmp shr \$12, $tmp mov $ap, $tmp cmovnz $bp, $ap cmovnz $tmp, $bp mov $np, $tmp sub \$-128,$ap # size optimization sub \$-128,$np sub \$-128,$rp and \$4095, $tmp # see if $np crosses page add \$32*10, $tmp .byte 0x67,0x67 shr \$12, $tmp jz .Lmul_1024_no_n_copy # unaligned 256-bit load that crosses page boundary can # cause severe performance degradation here, so if $np does # cross page boundary, copy it to stack and make sure stack # frame doesn't... sub \$32*10,%rsp vmovdqu 32*0-128($np), $ACC0 and \$-512, %rsp vmovdqu 32*1-128($np), $ACC1 vmovdqu 32*2-128($np), $ACC2 vmovdqu 32*3-128($np), $ACC3 vmovdqu 32*4-128($np), $ACC4 vmovdqu 32*5-128($np), $ACC5 vmovdqu 32*6-128($np), $ACC6 vmovdqu 32*7-128($np), $ACC7 vmovdqu 32*8-128($np), $ACC8 lea 64+128(%rsp),$np vmovdqu $ACC0, 32*0-128($np) vpxor $ACC0, $ACC0, $ACC0 vmovdqu $ACC1, 32*1-128($np) vpxor $ACC1, $ACC1, $ACC1 vmovdqu $ACC2, 32*2-128($np) vpxor $ACC2, $ACC2, $ACC2 vmovdqu $ACC3, 32*3-128($np) vpxor $ACC3, $ACC3, $ACC3 vmovdqu $ACC4, 32*4-128($np) vpxor $ACC4, $ACC4, $ACC4 vmovdqu $ACC5, 32*5-128($np) vpxor $ACC5, $ACC5, $ACC5 vmovdqu $ACC6, 32*6-128($np) vpxor $ACC6, $ACC6, $ACC6 vmovdqu $ACC7, 32*7-128($np) vpxor $ACC7, $ACC7, $ACC7 vmovdqu $ACC8, 32*8-128($np) vmovdqa $ACC0, $ACC8 vmovdqu $ACC9, 32*9-128($np) # $ACC9 is zero after vzeroall .Lmul_1024_no_n_copy: and \$-64,%rsp mov ($bp), %rbx vpbroadcastq ($bp), $Bi vmovdqu $ACC0, (%rsp) # clear top of stack xor $r0, $r0 .byte 0x67 xor $r1, $r1 xor $r2, $r2 xor $r3, $r3 vmovdqu .Land_mask(%rip), $AND_MASK mov \$9, $i vmovdqu $ACC9, 32*9-128($rp) # $ACC9 is zero after vzeroall jmp .Loop_mul_1024 .align 32 .Loop_mul_1024: vpsrlq \$29, $ACC3, $ACC9 # correct $ACC3(*) mov %rbx, %rax imulq -128($ap), %rax add $r0, %rax mov %rbx, $r1 imulq 8-128($ap), $r1 add 8(%rsp), $r1 mov %rax, $r0 imull $n0, %eax and \$0x1fffffff, %eax mov %rbx, $r2 imulq 16-128($ap), $r2 add 16(%rsp), $r2 mov %rbx, $r3 imulq 24-128($ap), $r3 add 24(%rsp), $r3 vpmuludq 32*1-128($ap),$Bi,$TEMP0 vmovd %eax, $Yi vpaddq $TEMP0,$ACC1,$ACC1 vpmuludq 32*2-128($ap),$Bi,$TEMP1 vpbroadcastq $Yi, $Yi vpaddq $TEMP1,$ACC2,$ACC2 vpmuludq 32*3-128($ap),$Bi,$TEMP2 vpand $AND_MASK, $ACC3, $ACC3 # correct $ACC3 vpaddq $TEMP2,$ACC3,$ACC3 vpmuludq 32*4-128($ap),$Bi,$TEMP0 vpaddq $TEMP0,$ACC4,$ACC4 vpmuludq 32*5-128($ap),$Bi,$TEMP1 vpaddq $TEMP1,$ACC5,$ACC5 vpmuludq 32*6-128($ap),$Bi,$TEMP2 vpaddq $TEMP2,$ACC6,$ACC6 vpmuludq 32*7-128($ap),$Bi,$TEMP0 vpermq \$0x93, $ACC9, $ACC9 # correct $ACC3 vpaddq $TEMP0,$ACC7,$ACC7 vpmuludq 32*8-128($ap),$Bi,$TEMP1 vpbroadcastq 8($bp), $Bi vpaddq $TEMP1,$ACC8,$ACC8 mov %rax,%rdx imulq -128($np),%rax add %rax,$r0 mov %rdx,%rax imulq 8-128($np),%rax add %rax,$r1 mov %rdx,%rax imulq 16-128($np),%rax add %rax,$r2 shr \$29, $r0 imulq 24-128($np),%rdx add %rdx,$r3 add $r0, $r1 vpmuludq 32*1-128($np),$Yi,$TEMP2 vmovq $Bi, %rbx vpaddq $TEMP2,$ACC1,$ACC1 vpmuludq 32*2-128($np),$Yi,$TEMP0 vpaddq $TEMP0,$ACC2,$ACC2 vpmuludq 32*3-128($np),$Yi,$TEMP1 vpaddq $TEMP1,$ACC3,$ACC3 vpmuludq 32*4-128($np),$Yi,$TEMP2 vpaddq $TEMP2,$ACC4,$ACC4 vpmuludq 32*5-128($np),$Yi,$TEMP0 vpaddq $TEMP0,$ACC5,$ACC5 vpmuludq 32*6-128($np),$Yi,$TEMP1 vpaddq $TEMP1,$ACC6,$ACC6 vpmuludq 32*7-128($np),$Yi,$TEMP2 - vpblendd \$3, $ZERO, $ACC9, $ACC9 # correct $ACC3 + vpblendd \$3, $ZERO, $ACC9, $TEMP1 # correct $ACC3 vpaddq $TEMP2,$ACC7,$ACC7 vpmuludq 32*8-128($np),$Yi,$TEMP0 - vpaddq $ACC9, $ACC3, $ACC3 # correct $ACC3 + vpaddq $TEMP1, $ACC3, $ACC3 # correct $ACC3 vpaddq $TEMP0,$ACC8,$ACC8 mov %rbx, %rax imulq -128($ap),%rax add %rax,$r1 vmovdqu -8+32*1-128($ap),$TEMP1 mov %rbx, %rax imulq 8-128($ap),%rax add %rax,$r2 vmovdqu -8+32*2-128($ap),$TEMP2 mov $r1, %rax + vpblendd \$0xfc, $ZERO, $ACC9, $ACC9 # correct $ACC3 imull $n0, %eax + vpaddq $ACC9,$ACC4,$ACC4 # correct $ACC3 and \$0x1fffffff, %eax imulq 16-128($ap),%rbx add %rbx,$r3 vpmuludq $Bi,$TEMP1,$TEMP1 vmovd %eax, $Yi vmovdqu -8+32*3-128($ap),$TEMP0 vpaddq $TEMP1,$ACC1,$ACC1 vpmuludq $Bi,$TEMP2,$TEMP2 vpbroadcastq $Yi, $Yi vmovdqu -8+32*4-128($ap),$TEMP1 vpaddq $TEMP2,$ACC2,$ACC2 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -8+32*5-128($ap),$TEMP2 vpaddq $TEMP0,$ACC3,$ACC3 vpmuludq $Bi,$TEMP1,$TEMP1 vmovdqu -8+32*6-128($ap),$TEMP0 vpaddq $TEMP1,$ACC4,$ACC4 vpmuludq $Bi,$TEMP2,$TEMP2 vmovdqu -8+32*7-128($ap),$TEMP1 vpaddq $TEMP2,$ACC5,$ACC5 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -8+32*8-128($ap),$TEMP2 vpaddq $TEMP0,$ACC6,$ACC6 vpmuludq $Bi,$TEMP1,$TEMP1 vmovdqu -8+32*9-128($ap),$ACC9 vpaddq $TEMP1,$ACC7,$ACC7 vpmuludq $Bi,$TEMP2,$TEMP2 vpaddq $TEMP2,$ACC8,$ACC8 vpmuludq $Bi,$ACC9,$ACC9 vpbroadcastq 16($bp), $Bi mov %rax,%rdx imulq -128($np),%rax add %rax,$r1 vmovdqu -8+32*1-128($np),$TEMP0 mov %rdx,%rax imulq 8-128($np),%rax add %rax,$r2 vmovdqu -8+32*2-128($np),$TEMP1 shr \$29, $r1 imulq 16-128($np),%rdx add %rdx,$r3 add $r1, $r2 vpmuludq $Yi,$TEMP0,$TEMP0 vmovq $Bi, %rbx vmovdqu -8+32*3-128($np),$TEMP2 vpaddq $TEMP0,$ACC1,$ACC1 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -8+32*4-128($np),$TEMP0 vpaddq $TEMP1,$ACC2,$ACC2 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -8+32*5-128($np),$TEMP1 vpaddq $TEMP2,$ACC3,$ACC3 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -8+32*6-128($np),$TEMP2 vpaddq $TEMP0,$ACC4,$ACC4 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -8+32*7-128($np),$TEMP0 vpaddq $TEMP1,$ACC5,$ACC5 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -8+32*8-128($np),$TEMP1 vpaddq $TEMP2,$ACC6,$ACC6 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -8+32*9-128($np),$TEMP2 vpaddq $TEMP0,$ACC7,$ACC7 vpmuludq $Yi,$TEMP1,$TEMP1 vpaddq $TEMP1,$ACC8,$ACC8 vpmuludq $Yi,$TEMP2,$TEMP2 vpaddq $TEMP2,$ACC9,$ACC9 vmovdqu -16+32*1-128($ap),$TEMP0 mov %rbx,%rax imulq -128($ap),%rax add $r2,%rax vmovdqu -16+32*2-128($ap),$TEMP1 mov %rax,$r2 imull $n0, %eax and \$0x1fffffff, %eax imulq 8-128($ap),%rbx add %rbx,$r3 vpmuludq $Bi,$TEMP0,$TEMP0 vmovd %eax, $Yi vmovdqu -16+32*3-128($ap),$TEMP2 vpaddq $TEMP0,$ACC1,$ACC1 vpmuludq $Bi,$TEMP1,$TEMP1 vpbroadcastq $Yi, $Yi vmovdqu -16+32*4-128($ap),$TEMP0 vpaddq $TEMP1,$ACC2,$ACC2 vpmuludq $Bi,$TEMP2,$TEMP2 vmovdqu -16+32*5-128($ap),$TEMP1 vpaddq $TEMP2,$ACC3,$ACC3 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -16+32*6-128($ap),$TEMP2 vpaddq $TEMP0,$ACC4,$ACC4 vpmuludq $Bi,$TEMP1,$TEMP1 vmovdqu -16+32*7-128($ap),$TEMP0 vpaddq $TEMP1,$ACC5,$ACC5 vpmuludq $Bi,$TEMP2,$TEMP2 vmovdqu -16+32*8-128($ap),$TEMP1 vpaddq $TEMP2,$ACC6,$ACC6 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -16+32*9-128($ap),$TEMP2 vpaddq $TEMP0,$ACC7,$ACC7 vpmuludq $Bi,$TEMP1,$TEMP1 vpaddq $TEMP1,$ACC8,$ACC8 vpmuludq $Bi,$TEMP2,$TEMP2 vpbroadcastq 24($bp), $Bi vpaddq $TEMP2,$ACC9,$ACC9 vmovdqu -16+32*1-128($np),$TEMP0 mov %rax,%rdx imulq -128($np),%rax add %rax,$r2 vmovdqu -16+32*2-128($np),$TEMP1 imulq 8-128($np),%rdx add %rdx,$r3 shr \$29, $r2 vpmuludq $Yi,$TEMP0,$TEMP0 vmovq $Bi, %rbx vmovdqu -16+32*3-128($np),$TEMP2 vpaddq $TEMP0,$ACC1,$ACC1 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -16+32*4-128($np),$TEMP0 vpaddq $TEMP1,$ACC2,$ACC2 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -16+32*5-128($np),$TEMP1 vpaddq $TEMP2,$ACC3,$ACC3 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -16+32*6-128($np),$TEMP2 vpaddq $TEMP0,$ACC4,$ACC4 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -16+32*7-128($np),$TEMP0 vpaddq $TEMP1,$ACC5,$ACC5 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -16+32*8-128($np),$TEMP1 vpaddq $TEMP2,$ACC6,$ACC6 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -16+32*9-128($np),$TEMP2 vpaddq $TEMP0,$ACC7,$ACC7 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -24+32*1-128($ap),$TEMP0 vpaddq $TEMP1,$ACC8,$ACC8 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -24+32*2-128($ap),$TEMP1 vpaddq $TEMP2,$ACC9,$ACC9 add $r2, $r3 imulq -128($ap),%rbx add %rbx,$r3 mov $r3, %rax imull $n0, %eax and \$0x1fffffff, %eax vpmuludq $Bi,$TEMP0,$TEMP0 vmovd %eax, $Yi vmovdqu -24+32*3-128($ap),$TEMP2 vpaddq $TEMP0,$ACC1,$ACC1 vpmuludq $Bi,$TEMP1,$TEMP1 vpbroadcastq $Yi, $Yi vmovdqu -24+32*4-128($ap),$TEMP0 vpaddq $TEMP1,$ACC2,$ACC2 vpmuludq $Bi,$TEMP2,$TEMP2 vmovdqu -24+32*5-128($ap),$TEMP1 vpaddq $TEMP2,$ACC3,$ACC3 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -24+32*6-128($ap),$TEMP2 vpaddq $TEMP0,$ACC4,$ACC4 vpmuludq $Bi,$TEMP1,$TEMP1 vmovdqu -24+32*7-128($ap),$TEMP0 vpaddq $TEMP1,$ACC5,$ACC5 vpmuludq $Bi,$TEMP2,$TEMP2 vmovdqu -24+32*8-128($ap),$TEMP1 vpaddq $TEMP2,$ACC6,$ACC6 vpmuludq $Bi,$TEMP0,$TEMP0 vmovdqu -24+32*9-128($ap),$TEMP2 vpaddq $TEMP0,$ACC7,$ACC7 vpmuludq $Bi,$TEMP1,$TEMP1 vpaddq $TEMP1,$ACC8,$ACC8 vpmuludq $Bi,$TEMP2,$TEMP2 vpbroadcastq 32($bp), $Bi vpaddq $TEMP2,$ACC9,$ACC9 add \$32, $bp # $bp++ vmovdqu -24+32*1-128($np),$TEMP0 imulq -128($np),%rax add %rax,$r3 shr \$29, $r3 vmovdqu -24+32*2-128($np),$TEMP1 vpmuludq $Yi,$TEMP0,$TEMP0 vmovq $Bi, %rbx vmovdqu -24+32*3-128($np),$TEMP2 vpaddq $TEMP0,$ACC1,$ACC0 # $ACC0==$TEMP0 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu $ACC0, (%rsp) # transfer $r0-$r3 vpaddq $TEMP1,$ACC2,$ACC1 vmovdqu -24+32*4-128($np),$TEMP0 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -24+32*5-128($np),$TEMP1 vpaddq $TEMP2,$ACC3,$ACC2 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -24+32*6-128($np),$TEMP2 vpaddq $TEMP0,$ACC4,$ACC3 vpmuludq $Yi,$TEMP1,$TEMP1 vmovdqu -24+32*7-128($np),$TEMP0 vpaddq $TEMP1,$ACC5,$ACC4 vpmuludq $Yi,$TEMP2,$TEMP2 vmovdqu -24+32*8-128($np),$TEMP1 vpaddq $TEMP2,$ACC6,$ACC5 vpmuludq $Yi,$TEMP0,$TEMP0 vmovdqu -24+32*9-128($np),$TEMP2 mov $r3, $r0 vpaddq $TEMP0,$ACC7,$ACC6 vpmuludq $Yi,$TEMP1,$TEMP1 add (%rsp), $r0 vpaddq $TEMP1,$ACC8,$ACC7 vpmuludq $Yi,$TEMP2,$TEMP2 vmovq $r3, $TEMP1 vpaddq $TEMP2,$ACC9,$ACC8 dec $i jnz .Loop_mul_1024 ___ # (*) Original implementation was correcting ACC1-ACC3 for overflow # after 7 loop runs, or after 28 iterations, or 56 additions. # But as we underutilize resources, it's possible to correct in # each iteration with marginal performance loss. But then, as # we do it in each iteration, we can correct less digits, and -# avoid performance penalties completely. Also note that we -# correct only three digits out of four. This works because -# most significant digit is subjected to less additions. +# avoid performance penalties completely. $TEMP0 = $ACC9; $TEMP3 = $Bi; $TEMP4 = $Yi; $code.=<<___; - vpermq \$0, $AND_MASK, $AND_MASK vpaddq (%rsp), $TEMP1, $ACC0 vpsrlq \$29, $ACC0, $TEMP1 vpand $AND_MASK, $ACC0, $ACC0 vpsrlq \$29, $ACC1, $TEMP2 vpand $AND_MASK, $ACC1, $ACC1 vpsrlq \$29, $ACC2, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC2, $ACC2 vpsrlq \$29, $ACC3, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC3, $ACC3 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP3, $TEMP3 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpermq \$0x93, $TEMP4, $TEMP4 vpaddq $TEMP0, $ACC0, $ACC0 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC1, $ACC1 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC2, $ACC2 vpblendd \$3, $TEMP4, $ZERO, $TEMP4 vpaddq $TEMP3, $ACC3, $ACC3 vpaddq $TEMP4, $ACC4, $ACC4 vpsrlq \$29, $ACC0, $TEMP1 vpand $AND_MASK, $ACC0, $ACC0 vpsrlq \$29, $ACC1, $TEMP2 vpand $AND_MASK, $ACC1, $ACC1 vpsrlq \$29, $ACC2, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC2, $ACC2 vpsrlq \$29, $ACC3, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC3, $ACC3 vpermq \$0x93, $TEMP3, $TEMP3 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC0, $ACC0 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC1, $ACC1 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC2, $ACC2 vpblendd \$3, $TEMP4, $ZERO, $TEMP4 vpaddq $TEMP3, $ACC3, $ACC3 vpaddq $TEMP4, $ACC4, $ACC4 vmovdqu $ACC0, 0-128($rp) vmovdqu $ACC1, 32-128($rp) vmovdqu $ACC2, 64-128($rp) vmovdqu $ACC3, 96-128($rp) ___ $TEMP5=$ACC0; $code.=<<___; vpsrlq \$29, $ACC4, $TEMP1 vpand $AND_MASK, $ACC4, $ACC4 vpsrlq \$29, $ACC5, $TEMP2 vpand $AND_MASK, $ACC5, $ACC5 vpsrlq \$29, $ACC6, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC6, $ACC6 vpsrlq \$29, $ACC7, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC7, $ACC7 vpsrlq \$29, $ACC8, $TEMP5 vpermq \$0x93, $TEMP3, $TEMP3 vpand $AND_MASK, $ACC8, $ACC8 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP5, $TEMP5 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC4, $ACC4 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC5, $ACC5 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC6, $ACC6 vpblendd \$3, $TEMP4, $TEMP5, $TEMP4 vpaddq $TEMP3, $ACC7, $ACC7 vpaddq $TEMP4, $ACC8, $ACC8 vpsrlq \$29, $ACC4, $TEMP1 vpand $AND_MASK, $ACC4, $ACC4 vpsrlq \$29, $ACC5, $TEMP2 vpand $AND_MASK, $ACC5, $ACC5 vpsrlq \$29, $ACC6, $TEMP3 vpermq \$0x93, $TEMP1, $TEMP1 vpand $AND_MASK, $ACC6, $ACC6 vpsrlq \$29, $ACC7, $TEMP4 vpermq \$0x93, $TEMP2, $TEMP2 vpand $AND_MASK, $ACC7, $ACC7 vpsrlq \$29, $ACC8, $TEMP5 vpermq \$0x93, $TEMP3, $TEMP3 vpand $AND_MASK, $ACC8, $ACC8 vpermq \$0x93, $TEMP4, $TEMP4 vpblendd \$3, $ZERO, $TEMP1, $TEMP0 vpermq \$0x93, $TEMP5, $TEMP5 vpblendd \$3, $TEMP1, $TEMP2, $TEMP1 vpaddq $TEMP0, $ACC4, $ACC4 vpblendd \$3, $TEMP2, $TEMP3, $TEMP2 vpaddq $TEMP1, $ACC5, $ACC5 vpblendd \$3, $TEMP3, $TEMP4, $TEMP3 vpaddq $TEMP2, $ACC6, $ACC6 vpblendd \$3, $TEMP4, $TEMP5, $TEMP4 vpaddq $TEMP3, $ACC7, $ACC7 vpaddq $TEMP4, $ACC8, $ACC8 vmovdqu $ACC4, 128-128($rp) vmovdqu $ACC5, 160-128($rp) vmovdqu $ACC6, 192-128($rp) vmovdqu $ACC7, 224-128($rp) vmovdqu $ACC8, 256-128($rp) vzeroupper mov %rbp, %rax ___ $code.=<<___ if ($win64); movaps -0xd8(%rax),%xmm6 movaps -0xc8(%rax),%xmm7 movaps -0xb8(%rax),%xmm8 movaps -0xa8(%rax),%xmm9 movaps -0x98(%rax),%xmm10 movaps -0x88(%rax),%xmm11 movaps -0x78(%rax),%xmm12 movaps -0x68(%rax),%xmm13 movaps -0x58(%rax),%xmm14 movaps -0x48(%rax),%xmm15 ___ $code.=<<___; mov -48(%rax),%r15 mov -40(%rax),%r14 mov -32(%rax),%r13 mov -24(%rax),%r12 mov -16(%rax),%rbp mov -8(%rax),%rbx lea (%rax),%rsp # restore %rsp .Lmul_1024_epilogue: ret .size rsaz_1024_mul_avx2,.-rsaz_1024_mul_avx2 ___ } { my ($out,$inp) = $win64 ? ("%rcx","%rdx") : ("%rdi","%rsi"); my @T = map("%r$_",(8..11)); $code.=<<___; .globl rsaz_1024_red2norm_avx2 .type rsaz_1024_red2norm_avx2,\@abi-omnipotent .align 32 rsaz_1024_red2norm_avx2: sub \$-128,$inp # size optimization xor %rax,%rax ___ for ($j=0,$i=0; $i<16; $i++) { my $k=0; while (29*$j<64*($i+1)) { # load data till boundary $code.=" mov `8*$j-128`($inp), @T[0]\n"; $j++; $k++; push(@T,shift(@T)); } $l=$k; while ($k>1) { # shift loaded data but last value $code.=" shl \$`29*($j-$k)`,@T[-$k]\n"; $k--; } $code.=<<___; # shift last value mov @T[-1], @T[0] shl \$`29*($j-1)`, @T[-1] shr \$`-29*($j-1)`, @T[0] ___ while ($l) { # accumulate all values $code.=" add @T[-$l], %rax\n"; $l--; } $code.=<<___; adc \$0, @T[0] # consume eventual carry mov %rax, 8*$i($out) mov @T[0], %rax ___ push(@T,shift(@T)); } $code.=<<___; ret .size rsaz_1024_red2norm_avx2,.-rsaz_1024_red2norm_avx2 .globl rsaz_1024_norm2red_avx2 .type rsaz_1024_norm2red_avx2,\@abi-omnipotent .align 32 rsaz_1024_norm2red_avx2: sub \$-128,$out # size optimization mov ($inp),@T[0] mov \$0x1fffffff,%eax ___ for ($j=0,$i=0; $i<16; $i++) { $code.=" mov `8*($i+1)`($inp),@T[1]\n" if ($i<15); $code.=" xor @T[1],@T[1]\n" if ($i==15); my $k=1; while (29*($j+1)<64*($i+1)) { $code.=<<___; mov @T[0],@T[-$k] shr \$`29*$j`,@T[-$k] and %rax,@T[-$k] # &0x1fffffff mov @T[-$k],`8*$j-128`($out) ___ $j++; $k++; } $code.=<<___; shrd \$`29*$j`,@T[1],@T[0] and %rax,@T[0] mov @T[0],`8*$j-128`($out) ___ $j++; push(@T,shift(@T)); } $code.=<<___; mov @T[0],`8*$j-128`($out) # zero mov @T[0],`8*($j+1)-128`($out) mov @T[0],`8*($j+2)-128`($out) mov @T[0],`8*($j+3)-128`($out) ret .size rsaz_1024_norm2red_avx2,.-rsaz_1024_norm2red_avx2 ___ } { my ($out,$inp,$power) = $win64 ? ("%rcx","%rdx","%r8d") : ("%rdi","%rsi","%edx"); $code.=<<___; .globl rsaz_1024_scatter5_avx2 .type rsaz_1024_scatter5_avx2,\@abi-omnipotent .align 32 rsaz_1024_scatter5_avx2: vzeroupper vmovdqu .Lscatter_permd(%rip),%ymm5 shl \$4,$power lea ($out,$power),$out mov \$9,%eax jmp .Loop_scatter_1024 .align 32 .Loop_scatter_1024: vmovdqu ($inp),%ymm0 lea 32($inp),$inp vpermd %ymm0,%ymm5,%ymm0 vmovdqu %xmm0,($out) lea 16*32($out),$out dec %eax jnz .Loop_scatter_1024 vzeroupper ret .size rsaz_1024_scatter5_avx2,.-rsaz_1024_scatter5_avx2 .globl rsaz_1024_gather5_avx2 .type rsaz_1024_gather5_avx2,\@abi-omnipotent .align 32 rsaz_1024_gather5_avx2: vzeroupper mov %rsp,%r11 ___ $code.=<<___ if ($win64); lea -0x88(%rsp),%rax .LSEH_begin_rsaz_1024_gather5: # I can't trust assembler to use specific encoding:-( .byte 0x48,0x8d,0x60,0xe0 # lea -0x20(%rax),%rsp .byte 0xc5,0xf8,0x29,0x70,0xe0 # vmovaps %xmm6,-0x20(%rax) .byte 0xc5,0xf8,0x29,0x78,0xf0 # vmovaps %xmm7,-0x10(%rax) .byte 0xc5,0x78,0x29,0x40,0x00 # vmovaps %xmm8,0(%rax) .byte 0xc5,0x78,0x29,0x48,0x10 # vmovaps %xmm9,0x10(%rax) .byte 0xc5,0x78,0x29,0x50,0x20 # vmovaps %xmm10,0x20(%rax) .byte 0xc5,0x78,0x29,0x58,0x30 # vmovaps %xmm11,0x30(%rax) .byte 0xc5,0x78,0x29,0x60,0x40 # vmovaps %xmm12,0x40(%rax) .byte 0xc5,0x78,0x29,0x68,0x50 # vmovaps %xmm13,0x50(%rax) .byte 0xc5,0x78,0x29,0x70,0x60 # vmovaps %xmm14,0x60(%rax) .byte 0xc5,0x78,0x29,0x78,0x70 # vmovaps %xmm15,0x70(%rax) ___ $code.=<<___; lea -0x100(%rsp),%rsp and \$-32, %rsp lea .Linc(%rip), %r10 lea -128(%rsp),%rax # control u-op density vmovd $power, %xmm4 vmovdqa (%r10),%ymm0 vmovdqa 32(%r10),%ymm1 vmovdqa 64(%r10),%ymm5 vpbroadcastd %xmm4,%ymm4 vpaddd %ymm5, %ymm0, %ymm2 vpcmpeqd %ymm4, %ymm0, %ymm0 vpaddd %ymm5, %ymm1, %ymm3 vpcmpeqd %ymm4, %ymm1, %ymm1 vmovdqa %ymm0, 32*0+128(%rax) vpaddd %ymm5, %ymm2, %ymm0 vpcmpeqd %ymm4, %ymm2, %ymm2 vmovdqa %ymm1, 32*1+128(%rax) vpaddd %ymm5, %ymm3, %ymm1 vpcmpeqd %ymm4, %ymm3, %ymm3 vmovdqa %ymm2, 32*2+128(%rax) vpaddd %ymm5, %ymm0, %ymm2 vpcmpeqd %ymm4, %ymm0, %ymm0 vmovdqa %ymm3, 32*3+128(%rax) vpaddd %ymm5, %ymm1, %ymm3 vpcmpeqd %ymm4, %ymm1, %ymm1 vmovdqa %ymm0, 32*4+128(%rax) vpaddd %ymm5, %ymm2, %ymm8 vpcmpeqd %ymm4, %ymm2, %ymm2 vmovdqa %ymm1, 32*5+128(%rax) vpaddd %ymm5, %ymm3, %ymm9 vpcmpeqd %ymm4, %ymm3, %ymm3 vmovdqa %ymm2, 32*6+128(%rax) vpaddd %ymm5, %ymm8, %ymm10 vpcmpeqd %ymm4, %ymm8, %ymm8 vmovdqa %ymm3, 32*7+128(%rax) vpaddd %ymm5, %ymm9, %ymm11 vpcmpeqd %ymm4, %ymm9, %ymm9 vpaddd %ymm5, %ymm10, %ymm12 vpcmpeqd %ymm4, %ymm10, %ymm10 vpaddd %ymm5, %ymm11, %ymm13 vpcmpeqd %ymm4, %ymm11, %ymm11 vpaddd %ymm5, %ymm12, %ymm14 vpcmpeqd %ymm4, %ymm12, %ymm12 vpaddd %ymm5, %ymm13, %ymm15 vpcmpeqd %ymm4, %ymm13, %ymm13 vpcmpeqd %ymm4, %ymm14, %ymm14 vpcmpeqd %ymm4, %ymm15, %ymm15 vmovdqa -32(%r10),%ymm7 # .Lgather_permd lea 128($inp), $inp mov \$9,$power .Loop_gather_1024: vmovdqa 32*0-128($inp), %ymm0 vmovdqa 32*1-128($inp), %ymm1 vmovdqa 32*2-128($inp), %ymm2 vmovdqa 32*3-128($inp), %ymm3 vpand 32*0+128(%rax), %ymm0, %ymm0 vpand 32*1+128(%rax), %ymm1, %ymm1 vpand 32*2+128(%rax), %ymm2, %ymm2 vpor %ymm0, %ymm1, %ymm4 vpand 32*3+128(%rax), %ymm3, %ymm3 vmovdqa 32*4-128($inp), %ymm0 vmovdqa 32*5-128($inp), %ymm1 vpor %ymm2, %ymm3, %ymm5 vmovdqa 32*6-128($inp), %ymm2 vmovdqa 32*7-128($inp), %ymm3 vpand 32*4+128(%rax), %ymm0, %ymm0 vpand 32*5+128(%rax), %ymm1, %ymm1 vpand 32*6+128(%rax), %ymm2, %ymm2 vpor %ymm0, %ymm4, %ymm4 vpand 32*7+128(%rax), %ymm3, %ymm3 vpand 32*8-128($inp), %ymm8, %ymm0 vpor %ymm1, %ymm5, %ymm5 vpand 32*9-128($inp), %ymm9, %ymm1 vpor %ymm2, %ymm4, %ymm4 vpand 32*10-128($inp),%ymm10, %ymm2 vpor %ymm3, %ymm5, %ymm5 vpand 32*11-128($inp),%ymm11, %ymm3 vpor %ymm0, %ymm4, %ymm4 vpand 32*12-128($inp),%ymm12, %ymm0 vpor %ymm1, %ymm5, %ymm5 vpand 32*13-128($inp),%ymm13, %ymm1 vpor %ymm2, %ymm4, %ymm4 vpand 32*14-128($inp),%ymm14, %ymm2 vpor %ymm3, %ymm5, %ymm5 vpand 32*15-128($inp),%ymm15, %ymm3 lea 32*16($inp), $inp vpor %ymm0, %ymm4, %ymm4 vpor %ymm1, %ymm5, %ymm5 vpor %ymm2, %ymm4, %ymm4 vpor %ymm3, %ymm5, %ymm5 vpor %ymm5, %ymm4, %ymm4 vextracti128 \$1, %ymm4, %xmm5 # upper half is cleared vpor %xmm4, %xmm5, %xmm5 vpermd %ymm5,%ymm7,%ymm5 vmovdqu %ymm5,($out) lea 32($out),$out dec $power jnz .Loop_gather_1024 vpxor %ymm0,%ymm0,%ymm0 vmovdqu %ymm0,($out) vzeroupper ___ $code.=<<___ if ($win64); movaps -0xa8(%r11),%xmm6 movaps -0x98(%r11),%xmm7 movaps -0x88(%r11),%xmm8 movaps -0x78(%r11),%xmm9 movaps -0x68(%r11),%xmm10 movaps -0x58(%r11),%xmm11 movaps -0x48(%r11),%xmm12 movaps -0x38(%r11),%xmm13 movaps -0x28(%r11),%xmm14 movaps -0x18(%r11),%xmm15 .LSEH_end_rsaz_1024_gather5: ___ $code.=<<___; lea (%r11),%rsp ret .size rsaz_1024_gather5_avx2,.-rsaz_1024_gather5_avx2 ___ } $code.=<<___; .extern OPENSSL_ia32cap_P .globl rsaz_avx2_eligible .type rsaz_avx2_eligible,\@abi-omnipotent .align 32 rsaz_avx2_eligible: mov OPENSSL_ia32cap_P+8(%rip),%eax ___ $code.=<<___ if ($addx); mov \$`1<<8|1<<19`,%ecx mov \$0,%edx and %eax,%ecx cmp \$`1<<8|1<<19`,%ecx # check for BMI2+AD*X cmove %edx,%eax ___ $code.=<<___; and \$`1<<5`,%eax shr \$5,%eax ret .size rsaz_avx2_eligible,.-rsaz_avx2_eligible .align 64 .Land_mask: - .quad 0x1fffffff,0x1fffffff,0x1fffffff,-1 + .quad 0x1fffffff,0x1fffffff,0x1fffffff,0x1fffffff .Lscatter_permd: .long 0,2,4,6,7,7,7,7 .Lgather_permd: .long 0,7,1,7,2,7,3,7 .Linc: .long 0,0,0,0, 1,1,1,1 .long 2,2,2,2, 3,3,3,3 .long 4,4,4,4, 4,4,4,4 .align 64 ___ if ($win64) { $rec="%rcx"; $frame="%rdx"; $context="%r8"; $disp="%r9"; $code.=<<___ .extern __imp_RtlVirtualUnwind .type rsaz_se_handler,\@abi-omnipotent .align 16 rsaz_se_handler: push %rsi push %rdi push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 pushfq sub \$64,%rsp mov 120($context),%rax # pull context->Rax mov 248($context),%rbx # pull context->Rip mov 8($disp),%rsi # disp->ImageBase mov 56($disp),%r11 # disp->HandlerData mov 0(%r11),%r10d # HandlerData[0] lea (%rsi,%r10),%r10 # prologue label cmp %r10,%rbx # context->RipRsp mov 4(%r11),%r10d # HandlerData[1] lea (%rsi,%r10),%r10 # epilogue label cmp %r10,%rbx # context->Rip>=epilogue label jae .Lcommon_seh_tail mov 160($context),%rax # pull context->Rbp mov -48(%rax),%r15 mov -40(%rax),%r14 mov -32(%rax),%r13 mov -24(%rax),%r12 mov -16(%rax),%rbp mov -8(%rax),%rbx mov %r15,240($context) mov %r14,232($context) mov %r13,224($context) mov %r12,216($context) mov %rbp,160($context) mov %rbx,144($context) lea -0xd8(%rax),%rsi # %xmm save area lea 512($context),%rdi # & context.Xmm6 mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax) .long 0xa548f3fc # cld; rep movsq .Lcommon_seh_tail: mov 8(%rax),%rdi mov 16(%rax),%rsi mov %rax,152($context) # restore context->Rsp mov %rsi,168($context) # restore context->Rsi mov %rdi,176($context) # restore context->Rdi mov 40($disp),%rdi # disp->ContextRecord mov $context,%rsi # context mov \$154,%ecx # sizeof(CONTEXT) .long 0xa548f3fc # cld; rep movsq mov $disp,%rsi xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER mov 8(%rsi),%rdx # arg2, disp->ImageBase mov 0(%rsi),%r8 # arg3, disp->ControlPc mov 16(%rsi),%r9 # arg4, disp->FunctionEntry mov 40(%rsi),%r10 # disp->ContextRecord lea 56(%rsi),%r11 # &disp->HandlerData lea 24(%rsi),%r12 # &disp->EstablisherFrame mov %r10,32(%rsp) # arg5 mov %r11,40(%rsp) # arg6 mov %r12,48(%rsp) # arg7 mov %rcx,56(%rsp) # arg8, (NULL) call *__imp_RtlVirtualUnwind(%rip) mov \$1,%eax # ExceptionContinueSearch add \$64,%rsp popfq pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx pop %rdi pop %rsi ret .size rsaz_se_handler,.-rsaz_se_handler .section .pdata .align 4 .rva .LSEH_begin_rsaz_1024_sqr_avx2 .rva .LSEH_end_rsaz_1024_sqr_avx2 .rva .LSEH_info_rsaz_1024_sqr_avx2 .rva .LSEH_begin_rsaz_1024_mul_avx2 .rva .LSEH_end_rsaz_1024_mul_avx2 .rva .LSEH_info_rsaz_1024_mul_avx2 .rva .LSEH_begin_rsaz_1024_gather5 .rva .LSEH_end_rsaz_1024_gather5 .rva .LSEH_info_rsaz_1024_gather5 .section .xdata .align 8 .LSEH_info_rsaz_1024_sqr_avx2: .byte 9,0,0,0 .rva rsaz_se_handler .rva .Lsqr_1024_body,.Lsqr_1024_epilogue .LSEH_info_rsaz_1024_mul_avx2: .byte 9,0,0,0 .rva rsaz_se_handler .rva .Lmul_1024_body,.Lmul_1024_epilogue .LSEH_info_rsaz_1024_gather5: .byte 0x01,0x36,0x17,0x0b .byte 0x36,0xf8,0x09,0x00 # vmovaps 0x90(rsp),xmm15 .byte 0x31,0xe8,0x08,0x00 # vmovaps 0x80(rsp),xmm14 .byte 0x2c,0xd8,0x07,0x00 # vmovaps 0x70(rsp),xmm13 .byte 0x27,0xc8,0x06,0x00 # vmovaps 0x60(rsp),xmm12 .byte 0x22,0xb8,0x05,0x00 # vmovaps 0x50(rsp),xmm11 .byte 0x1d,0xa8,0x04,0x00 # vmovaps 0x40(rsp),xmm10 .byte 0x18,0x98,0x03,0x00 # vmovaps 0x30(rsp),xmm9 .byte 0x13,0x88,0x02,0x00 # vmovaps 0x20(rsp),xmm8 .byte 0x0e,0x78,0x01,0x00 # vmovaps 0x10(rsp),xmm7 .byte 0x09,0x68,0x00,0x00 # vmovaps 0x00(rsp),xmm6 .byte 0x04,0x01,0x15,0x00 # sub rsp,0xa8 .byte 0x00,0xb3,0x00,0x00 # set_frame r11 ___ } foreach (split("\n",$code)) { s/\`([^\`]*)\`/eval($1)/ge; s/\b(sh[rl]d?\s+\$)(-?[0-9]+)/$1.$2%64/ge or s/\b(vmov[dq])\b(.+)%ymm([0-9]+)/$1$2%xmm$3/go or s/\b(vmovdqu)\b(.+)%x%ymm([0-9]+)/$1$2%xmm$3/go or s/\b(vpinsr[qd])\b(.+)%ymm([0-9]+)/$1$2%xmm$3/go or s/\b(vpextr[qd])\b(.+)%ymm([0-9]+)/$1$2%xmm$3/go or s/\b(vpbroadcast[qd]\s+)%ymm([0-9]+)/$1%xmm$2/go; print $_,"\n"; } }}} else {{{ print <<___; # assembler is too old .text .globl rsaz_avx2_eligible .type rsaz_avx2_eligible,\@abi-omnipotent rsaz_avx2_eligible: xor %eax,%eax ret .size rsaz_avx2_eligible,.-rsaz_avx2_eligible .globl rsaz_1024_sqr_avx2 .globl rsaz_1024_mul_avx2 .globl rsaz_1024_norm2red_avx2 .globl rsaz_1024_red2norm_avx2 .globl rsaz_1024_scatter5_avx2 .globl rsaz_1024_gather5_avx2 .type rsaz_1024_sqr_avx2,\@abi-omnipotent rsaz_1024_sqr_avx2: rsaz_1024_mul_avx2: rsaz_1024_norm2red_avx2: rsaz_1024_red2norm_avx2: rsaz_1024_scatter5_avx2: rsaz_1024_gather5_avx2: .byte 0x0f,0x0b # ud2 ret .size rsaz_1024_sqr_avx2,.-rsaz_1024_sqr_avx2 ___ }}} close STDOUT; diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index 35facd213a25..c4b63e44ba36 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -1,1468 +1,1468 @@ /* crypto/bn/bn_exp.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include "cryptlib.h" #include "constant_time_locl.h" #include "bn_lcl.h" #include #ifdef _WIN32 # include # ifndef alloca # define alloca _alloca # endif #elif defined(__GNUC__) # ifndef alloca # define alloca(s) __builtin_alloca((s)) # endif #elif defined(__sun) # include #endif #include "rsaz_exp.h" #undef SPARC_T4_MONT #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc)) # include "sparc_arch.h" extern unsigned int OPENSSL_sparcv9cap_P[]; # define SPARC_T4_MONT #endif /* maximum precomputation table size for *variable* sliding windows */ #define TABLE_SIZE 32 /* this one works - simple but works */ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) { int i, bits, ret = 0; BIGNUM *v, *rr; if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 || BN_get_flags(a, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_EXP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return -1; + return 0; } BN_CTX_start(ctx); if ((r == a) || (r == p)) rr = BN_CTX_get(ctx); else rr = r; v = BN_CTX_get(ctx); if (rr == NULL || v == NULL) goto err; if (BN_copy(v, a) == NULL) goto err; bits = BN_num_bits(p); if (BN_is_odd(p)) { if (BN_copy(rr, a) == NULL) goto err; } else { if (!BN_one(rr)) goto err; } for (i = 1; i < bits; i++) { if (!BN_sqr(v, v, ctx)) goto err; if (BN_is_bit_set(p, i)) { if (!BN_mul(rr, rr, v, ctx)) goto err; } } if (r != rr && BN_copy(r, rr) == NULL) goto err; ret = 1; err: BN_CTX_end(ctx); bn_check_top(r); return (ret); } int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx) { int ret; bn_check_top(a); bn_check_top(p); bn_check_top(m); /*- * For even modulus m = 2^k*m_odd, it might make sense to compute * a^p mod m_odd and a^p mod 2^k separately (with Montgomery * exponentiation for the odd part), using appropriate exponent * reductions, and combine the results using the CRT. * * For now, we use Montgomery only if the modulus is odd; otherwise, * exponentiation using the reciprocal-based quick remaindering * algorithm is used. * * (Timing obtained with expspeed.c [computations a^p mod m * where a, p, m are of the same length: 256, 512, 1024, 2048, * 4096, 8192 bits], compared to the running time of the * standard algorithm: * * BN_mod_exp_mont 33 .. 40 % [AMD K6-2, Linux, debug configuration] * 55 .. 77 % [UltraSparc processor, but * debug-solaris-sparcv8-gcc conf.] * * BN_mod_exp_recp 50 .. 70 % [AMD K6-2, Linux, debug configuration] * 62 .. 118 % [UltraSparc, debug-solaris-sparcv8-gcc] * * On the Sparc, BN_mod_exp_recp was faster than BN_mod_exp_mont * at 2048 and more bits, but at 512 and 1024 bits, it was * slower even than the standard algorithm! * * "Real" timings [linux-elf, solaris-sparcv9-gcc configurations] * should be obtained when the new Montgomery reduction code * has been integrated into OpenSSL.) */ #define MONT_MUL_MOD #define MONT_EXP_WORD #define RECP_MUL_MOD #ifdef MONT_MUL_MOD /* * I have finally been able to take out this pre-condition of the top bit * being set. It was caused by an error in BN_div with negatives. There * was also another problem when for a^b%m a >= m. eay 07-May-97 */ /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */ if (BN_is_odd(m)) { # ifdef MONT_EXP_WORD if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0) && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0) && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) { BN_ULONG A = a->d[0]; ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); } else # endif ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); } else #endif #ifdef RECP_MUL_MOD { ret = BN_mod_exp_recp(r, a, p, m, ctx); } #else { ret = BN_mod_exp_simple(r, a, p, m, ctx); } #endif bn_check_top(r); return (ret); } int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx) { int i, j, bits, ret = 0, wstart, wend, window, wvalue; int start = 1; BIGNUM *aa; /* Table of variables obtained from 'ctx' */ BIGNUM *val[TABLE_SIZE]; BN_RECP_CTX recp; if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return -1; + return 0; } bits = BN_num_bits(p); if (bits == 0) { /* x**0 mod 1 is still zero. */ if (BN_is_one(m)) { ret = 1; BN_zero(r); } else { ret = BN_one(r); } return ret; } BN_CTX_start(ctx); aa = BN_CTX_get(ctx); val[0] = BN_CTX_get(ctx); if (!aa || !val[0]) goto err; BN_RECP_CTX_init(&recp); if (m->neg) { /* ignore sign of 'm' */ if (!BN_copy(aa, m)) goto err; aa->neg = 0; if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0) goto err; } else { if (BN_RECP_CTX_set(&recp, m, ctx) <= 0) goto err; } if (!BN_nnmod(val[0], a, m, ctx)) goto err; /* 1 */ if (BN_is_zero(val[0])) { BN_zero(r); ret = 1; goto err; } window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx)) goto err; /* 2 */ j = 1 << (window - 1); for (i = 1; i < j; i++) { if (((val[i] = BN_CTX_get(ctx)) == NULL) || !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx)) goto err; } } start = 1; /* This is used to avoid multiplication etc * when there is only the value '1' in the * buffer. */ wvalue = 0; /* The 'value' of the window */ wstart = bits - 1; /* The top bit of the window */ wend = 0; /* The bottom bit of the window */ if (!BN_one(r)) goto err; for (;;) { if (BN_is_bit_set(p, wstart) == 0) { if (!start) if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) goto err; if (wstart == 0) break; wstart--; continue; } /* * We now have wstart on a 'set' bit, we now need to work out how bit * a window to do. To do this we need to scan forward until the last * set bit before the end of the window */ j = wstart; wvalue = 1; wend = 0; for (i = 1; i < window; i++) { if (wstart - i < 0) break; if (BN_is_bit_set(p, wstart - i)) { wvalue <<= (i - wend); wvalue |= 1; wend = i; } } /* wend is the size of the current window */ j = wend + 1; /* add the 'bytes above' */ if (!start) for (i = 0; i < j; i++) { if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) goto err; } /* wvalue will be an odd number < 2^window */ if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx)) goto err; /* move the 'window' down further */ wstart -= wend + 1; wvalue = 0; start = 0; if (wstart < 0) break; } ret = 1; err: BN_CTX_end(ctx); BN_RECP_CTX_free(&recp); bn_check_top(r); return (ret); } int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) { int i, j, bits, ret = 0, wstart, wend, window, wvalue; int start = 1; BIGNUM *d, *r; const BIGNUM *aa; /* Table of variables obtained from 'ctx' */ BIGNUM *val[TABLE_SIZE]; BN_MONT_CTX *mont = NULL; if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); } bn_check_top(a); bn_check_top(p); bn_check_top(m); if (!BN_is_odd(m)) { BNerr(BN_F_BN_MOD_EXP_MONT, BN_R_CALLED_WITH_EVEN_MODULUS); return (0); } bits = BN_num_bits(p); if (bits == 0) { /* x**0 mod 1 is still zero. */ if (BN_is_one(m)) { ret = 1; BN_zero(rr); } else { ret = BN_one(rr); } return ret; } BN_CTX_start(ctx); d = BN_CTX_get(ctx); r = BN_CTX_get(ctx); val[0] = BN_CTX_get(ctx); if (!d || !r || !val[0]) goto err; /* * If this is not done, things will break in the montgomery part */ if (in_mont != NULL) mont = in_mont; else { if ((mont = BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont, m, ctx)) goto err; } if (a->neg || BN_ucmp(a, m) >= 0) { if (!BN_nnmod(val[0], a, m, ctx)) goto err; aa = val[0]; } else aa = a; if (BN_is_zero(aa)) { BN_zero(rr); ret = 1; goto err; } if (!BN_to_montgomery(val[0], aa, mont, ctx)) goto err; /* 1 */ window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_montgomery(d, val[0], val[0], mont, ctx)) goto err; /* 2 */ j = 1 << (window - 1); for (i = 1; i < j; i++) { if (((val[i] = BN_CTX_get(ctx)) == NULL) || !BN_mod_mul_montgomery(val[i], val[i - 1], d, mont, ctx)) goto err; } } start = 1; /* This is used to avoid multiplication etc * when there is only the value '1' in the * buffer. */ wvalue = 0; /* The 'value' of the window */ wstart = bits - 1; /* The top bit of the window */ wend = 0; /* The bottom bit of the window */ #if 1 /* by Shay Gueron's suggestion */ j = m->top; /* borrow j */ if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) { if (bn_wexpand(r, j) == NULL) goto err; /* 2^(top*BN_BITS2) - m */ r->d[0] = (0 - m->d[0]) & BN_MASK2; for (i = 1; i < j; i++) r->d[i] = (~m->d[i]) & BN_MASK2; r->top = j; /* * Upper words will be zero if the corresponding words of 'm' were * 0xfff[...], so decrement r->top accordingly. */ bn_correct_top(r); } else #endif if (!BN_to_montgomery(r, BN_value_one(), mont, ctx)) goto err; for (;;) { if (BN_is_bit_set(p, wstart) == 0) { if (!start) { if (!BN_mod_mul_montgomery(r, r, r, mont, ctx)) goto err; } if (wstart == 0) break; wstart--; continue; } /* * We now have wstart on a 'set' bit, we now need to work out how bit * a window to do. To do this we need to scan forward until the last * set bit before the end of the window */ j = wstart; wvalue = 1; wend = 0; for (i = 1; i < window; i++) { if (wstart - i < 0) break; if (BN_is_bit_set(p, wstart - i)) { wvalue <<= (i - wend); wvalue |= 1; wend = i; } } /* wend is the size of the current window */ j = wend + 1; /* add the 'bytes above' */ if (!start) for (i = 0; i < j; i++) { if (!BN_mod_mul_montgomery(r, r, r, mont, ctx)) goto err; } /* wvalue will be an odd number < 2^window */ if (!BN_mod_mul_montgomery(r, r, val[wvalue >> 1], mont, ctx)) goto err; /* move the 'window' down further */ wstart -= wend + 1; wvalue = 0; start = 0; if (wstart < 0) break; } #if defined(SPARC_T4_MONT) if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) { j = mont->N.top; /* borrow j */ val[0]->d[0] = 1; /* borrow val[0] */ for (i = 1; i < j; i++) val[0]->d[i] = 0; val[0]->top = j; if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx)) goto err; } else #endif if (!BN_from_montgomery(rr, r, mont, ctx)) goto err; ret = 1; err: if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); BN_CTX_end(ctx); bn_check_top(rr); return (ret); } #if defined(SPARC_T4_MONT) static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos) { BN_ULONG ret = 0; int wordpos; wordpos = bitpos / BN_BITS2; bitpos %= BN_BITS2; if (wordpos >= 0 && wordpos < a->top) { ret = a->d[wordpos] & BN_MASK2; if (bitpos) { ret >>= bitpos; if (++wordpos < a->top) ret |= a->d[wordpos] << (BN_BITS2 - bitpos); } } return ret & BN_MASK2; } #endif /* * BN_mod_exp_mont_consttime() stores the precomputed powers in a specific * layout so that accessing any of these table values shows the same access * pattern as far as cache lines are concerned. The following functions are * used to transfer a BIGNUM from/to that table. */ static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top, unsigned char *buf, int idx, int window) { int i, j; int width = 1 << window; BN_ULONG *table = (BN_ULONG *)buf; if (top > b->top) top = b->top; /* this works because 'buf' is explicitly * zeroed */ for (i = 0, j = idx; i < top; i++, j += width) { table[j] = b->d[i]; } return 1; } static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int window) { int i, j; int width = 1 << window; volatile BN_ULONG *table = (volatile BN_ULONG *)buf; if (bn_wexpand(b, top) == NULL) return 0; if (window <= 3) { for (i = 0; i < top; i++, table += width) { BN_ULONG acc = 0; for (j = 0; j < width; j++) { acc |= table[j] & ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1)); } b->d[i] = acc; } } else { int xstride = 1 << (window - 2); BN_ULONG y0, y1, y2, y3; i = idx >> (window - 2); /* equivalent of idx / xstride */ idx &= xstride - 1; /* equivalent of idx % xstride */ y0 = (BN_ULONG)0 - (constant_time_eq_int(i,0)&1); y1 = (BN_ULONG)0 - (constant_time_eq_int(i,1)&1); y2 = (BN_ULONG)0 - (constant_time_eq_int(i,2)&1); y3 = (BN_ULONG)0 - (constant_time_eq_int(i,3)&1); for (i = 0; i < top; i++, table += width) { BN_ULONG acc = 0; for (j = 0; j < xstride; j++) { acc |= ( (table[j + 0 * xstride] & y0) | (table[j + 1 * xstride] & y1) | (table[j + 2 * xstride] & y2) | (table[j + 3 * xstride] & y3) ) & ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1)); } b->d[i] = acc; } } b->top = top; bn_correct_top(b); return 1; } /* * Given a pointer value, compute the next address that is a cache line * multiple. */ #define MOD_EXP_CTIME_ALIGN(x_) \ ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK)))) /* * This variant of BN_mod_exp_mont() uses fixed windows and the special * precomputation memory layout to limit data-dependency to a minimum to * protect secret exponents (cf. the hyper-threading timing attacks pointed * out by Colin Percival, * http://www.daemonology.net/hyperthreading-considered-harmful/) */ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) { int i, bits, ret = 0, window, wvalue; int top; BN_MONT_CTX *mont = NULL; int numPowers; unsigned char *powerbufFree = NULL; int powerbufLen = 0; unsigned char *powerbuf = NULL; BIGNUM tmp, am; #if defined(SPARC_T4_MONT) unsigned int t4 = 0; #endif bn_check_top(a); bn_check_top(p); bn_check_top(m); if (!BN_is_odd(m)) { BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS); return (0); } top = m->top; bits = BN_num_bits(p); if (bits == 0) { /* x**0 mod 1 is still zero. */ if (BN_is_one(m)) { ret = 1; BN_zero(rr); } else { ret = BN_one(rr); } return ret; } BN_CTX_start(ctx); /* * Allocate a montgomery context if it was not supplied by the caller. If * this is not done, things will break in the montgomery part. */ if (in_mont != NULL) mont = in_mont; else { if ((mont = BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont, m, ctx)) goto err; } #ifdef RSAZ_ENABLED /* * If the size of the operands allow it, perform the optimized * RSAZ exponentiation. For further information see * crypto/bn/rsaz_exp.c and accompanying assembly modules. */ if ((16 == a->top) && (16 == p->top) && (BN_num_bits(m) == 1024) && rsaz_avx2_eligible()) { if (NULL == bn_wexpand(rr, 16)) goto err; RSAZ_1024_mod_exp_avx2(rr->d, a->d, p->d, m->d, mont->RR.d, mont->n0[0]); rr->top = 16; rr->neg = 0; bn_correct_top(rr); ret = 1; goto err; } else if ((8 == a->top) && (8 == p->top) && (BN_num_bits(m) == 512)) { if (NULL == bn_wexpand(rr, 8)) goto err; RSAZ_512_mod_exp(rr->d, a->d, p->d, m->d, mont->n0[0], mont->RR.d); rr->top = 8; rr->neg = 0; bn_correct_top(rr); ret = 1; goto err; } #endif /* Get the window size to use with size of p. */ window = BN_window_bits_for_ctime_exponent_size(bits); #if defined(SPARC_T4_MONT) if (window >= 5 && (top & 15) == 0 && top <= 64 && (OPENSSL_sparcv9cap_P[1] & (CFR_MONTMUL | CFR_MONTSQR)) == (CFR_MONTMUL | CFR_MONTSQR) && (t4 = OPENSSL_sparcv9cap_P[0])) window = 5; else #endif #if defined(OPENSSL_BN_ASM_MONT5) if (window >= 5) { window = 5; /* ~5% improvement for RSA2048 sign, and even * for RSA4096 */ /* reserve space for mont->N.d[] copy */ powerbufLen += top * sizeof(mont->N.d[0]); } #endif (void)0; /* * Allocate a buffer large enough to hold all of the pre-computed powers * of am, am itself and tmp. */ numPowers = 1 << window; powerbufLen += sizeof(m->d[0]) * (top * numPowers + ((2 * top) > numPowers ? (2 * top) : numPowers)); #ifdef alloca if (powerbufLen < 3072) powerbufFree = alloca(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH); else #endif if ((powerbufFree = (unsigned char *)OPENSSL_malloc(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) goto err; powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); memset(powerbuf, 0, powerbufLen); #ifdef alloca if (powerbufLen < 3072) powerbufFree = NULL; #endif /* lay down tmp and am right after powers table */ tmp.d = (BN_ULONG *)(powerbuf + sizeof(m->d[0]) * top * numPowers); am.d = tmp.d + top; tmp.top = am.top = 0; tmp.dmax = am.dmax = top; tmp.neg = am.neg = 0; tmp.flags = am.flags = BN_FLG_STATIC_DATA; /* prepare a^0 in Montgomery domain */ #if 1 /* by Shay Gueron's suggestion */ if (m->d[top - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) { /* 2^(top*BN_BITS2) - m */ tmp.d[0] = (0 - m->d[0]) & BN_MASK2; for (i = 1; i < top; i++) tmp.d[i] = (~m->d[i]) & BN_MASK2; tmp.top = top; } else #endif if (!BN_to_montgomery(&tmp, BN_value_one(), mont, ctx)) goto err; /* prepare a^1 in Montgomery domain */ if (a->neg || BN_ucmp(a, m) >= 0) { if (!BN_mod(&am, a, m, ctx)) goto err; if (!BN_to_montgomery(&am, &am, mont, ctx)) goto err; } else if (!BN_to_montgomery(&am, a, mont, ctx)) goto err; #if defined(SPARC_T4_MONT) if (t4) { typedef int (*bn_pwr5_mont_f) (BN_ULONG *tp, const BN_ULONG *np, const BN_ULONG *n0, const void *table, int power, int bits); int bn_pwr5_mont_t4_8(BN_ULONG *tp, const BN_ULONG *np, const BN_ULONG *n0, const void *table, int power, int bits); int bn_pwr5_mont_t4_16(BN_ULONG *tp, const BN_ULONG *np, const BN_ULONG *n0, const void *table, int power, int bits); int bn_pwr5_mont_t4_24(BN_ULONG *tp, const BN_ULONG *np, const BN_ULONG *n0, const void *table, int power, int bits); int bn_pwr5_mont_t4_32(BN_ULONG *tp, const BN_ULONG *np, const BN_ULONG *n0, const void *table, int power, int bits); static const bn_pwr5_mont_f pwr5_funcs[4] = { bn_pwr5_mont_t4_8, bn_pwr5_mont_t4_16, bn_pwr5_mont_t4_24, bn_pwr5_mont_t4_32 }; bn_pwr5_mont_f pwr5_worker = pwr5_funcs[top / 16 - 1]; typedef int (*bn_mul_mont_f) (BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0); int bn_mul_mont_t4_8(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0); int bn_mul_mont_t4_16(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0); int bn_mul_mont_t4_24(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0); int bn_mul_mont_t4_32(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0); static const bn_mul_mont_f mul_funcs[4] = { bn_mul_mont_t4_8, bn_mul_mont_t4_16, bn_mul_mont_t4_24, bn_mul_mont_t4_32 }; bn_mul_mont_f mul_worker = mul_funcs[top / 16 - 1]; void bn_mul_mont_vis3(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0, int num); void bn_mul_mont_t4(BN_ULONG *rp, const BN_ULONG *ap, const void *bp, const BN_ULONG *np, const BN_ULONG *n0, int num); void bn_mul_mont_gather5_t4(BN_ULONG *rp, const BN_ULONG *ap, const void *table, const BN_ULONG *np, const BN_ULONG *n0, int num, int power); void bn_flip_n_scatter5_t4(const BN_ULONG *inp, size_t num, void *table, size_t power); void bn_gather5_t4(BN_ULONG *out, size_t num, void *table, size_t power); void bn_flip_t4(BN_ULONG *dst, BN_ULONG *src, size_t num); BN_ULONG *np = mont->N.d, *n0 = mont->n0; int stride = 5 * (6 - (top / 16 - 1)); /* multiple of 5, but less * than 32 */ /* * BN_to_montgomery can contaminate words above .top [in * BN_DEBUG[_DEBUG] build]... */ for (i = am.top; i < top; i++) am.d[i] = 0; for (i = tmp.top; i < top; i++) tmp.d[i] = 0; bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 0); bn_flip_n_scatter5_t4(am.d, top, powerbuf, 1); if (!(*mul_worker) (tmp.d, am.d, am.d, np, n0) && !(*mul_worker) (tmp.d, am.d, am.d, np, n0)) bn_mul_mont_vis3(tmp.d, am.d, am.d, np, n0, top); bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 2); for (i = 3; i < 32; i++) { /* Calculate a^i = a^(i-1) * a */ if (!(*mul_worker) (tmp.d, tmp.d, am.d, np, n0) && !(*mul_worker) (tmp.d, tmp.d, am.d, np, n0)) bn_mul_mont_vis3(tmp.d, tmp.d, am.d, np, n0, top); bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, i); } /* switch to 64-bit domain */ np = alloca(top * sizeof(BN_ULONG)); top /= 2; bn_flip_t4(np, mont->N.d, top); bits--; for (wvalue = 0, i = bits % 5; i >= 0; i--, bits--) wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); bn_gather5_t4(tmp.d, top, powerbuf, wvalue); /* * Scan the exponent one window at a time starting from the most * significant bits. */ while (bits >= 0) { if (bits < stride) stride = bits + 1; bits -= stride; wvalue = bn_get_bits(p, bits + 1); if ((*pwr5_worker) (tmp.d, np, n0, powerbuf, wvalue, stride)) continue; /* retry once and fall back */ if ((*pwr5_worker) (tmp.d, np, n0, powerbuf, wvalue, stride)) continue; bits += stride - 5; wvalue >>= stride - 5; wvalue &= 31; bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_gather5_t4(tmp.d, tmp.d, powerbuf, np, n0, top, wvalue); } bn_flip_t4(tmp.d, tmp.d, top); top *= 2; /* back to 32-bit domain */ tmp.top = top; bn_correct_top(&tmp); OPENSSL_cleanse(np, top * sizeof(BN_ULONG)); } else #endif #if defined(OPENSSL_BN_ASM_MONT5) if (window == 5 && top > 1) { /* * This optimization uses ideas from http://eprint.iacr.org/2011/239, * specifically optimization of cache-timing attack countermeasures * and pre-computation optimization. */ /* * Dedicated window==4 case improves 512-bit RSA sign by ~15%, but as * 512-bit RSA is hardly relevant, we omit it to spare size... */ void bn_mul_mont_gather5(BN_ULONG *rp, const BN_ULONG *ap, const void *table, const BN_ULONG *np, const BN_ULONG *n0, int num, int power); void bn_scatter5(const BN_ULONG *inp, size_t num, void *table, size_t power); void bn_gather5(BN_ULONG *out, size_t num, void *table, size_t power); void bn_power5(BN_ULONG *rp, const BN_ULONG *ap, const void *table, const BN_ULONG *np, const BN_ULONG *n0, int num, int power); int bn_get_bits5(const BN_ULONG *ap, int off); int bn_from_montgomery(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *not_used, const BN_ULONG *np, const BN_ULONG *n0, int num); BN_ULONG *n0 = mont->n0, *np; /* * BN_to_montgomery can contaminate words above .top [in * BN_DEBUG[_DEBUG] build]... */ for (i = am.top; i < top; i++) am.d[i] = 0; for (i = tmp.top; i < top; i++) tmp.d[i] = 0; /* * copy mont->N.d[] to improve cache locality */ for (np = am.d + top, i = 0; i < top; i++) np[i] = mont->N.d[i]; bn_scatter5(tmp.d, top, powerbuf, 0); bn_scatter5(am.d, am.top, powerbuf, 1); bn_mul_mont(tmp.d, am.d, am.d, np, n0, top); bn_scatter5(tmp.d, top, powerbuf, 2); # if 0 for (i = 3; i < 32; i++) { /* Calculate a^i = a^(i-1) * a */ bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); } # else /* same as above, but uses squaring for 1/2 of operations */ for (i = 4; i < 32; i *= 2) { bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_scatter5(tmp.d, top, powerbuf, i); } for (i = 3; i < 8; i += 2) { int j; bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); for (j = 2 * i; j < 32; j *= 2) { bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_scatter5(tmp.d, top, powerbuf, j); } } for (; i < 16; i += 2) { bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_scatter5(tmp.d, top, powerbuf, 2 * i); } for (; i < 32; i += 2) { bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1); bn_scatter5(tmp.d, top, powerbuf, i); } # endif bits--; for (wvalue = 0, i = bits % 5; i >= 0; i--, bits--) wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); bn_gather5(tmp.d, top, powerbuf, wvalue); /* * Scan the exponent one window at a time starting from the most * significant bits. */ if (top & 7) while (bits >= 0) { for (wvalue = 0, i = 0; i < 5; i++, bits--) wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top); bn_mul_mont_gather5(tmp.d, tmp.d, powerbuf, np, n0, top, wvalue); } else { while (bits >= 0) { wvalue = bn_get_bits5(p->d, bits - 4); bits -= 5; bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top, wvalue); } } ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np, n0, top); tmp.top = top; bn_correct_top(&tmp); if (ret) { if (!BN_copy(rr, &tmp)) ret = 0; goto err; /* non-zero ret means it's not error */ } } else #endif { if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, window)) goto err; if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, window)) goto err; /* * If the window size is greater than 1, then calculate * val[i=2..2^winsize-1]. Powers are computed as a*a^(i-1) (even * powers could instead be computed as (a^(i/2))^2 to use the slight * performance advantage of sqr over mul). */ if (window > 1) { if (!BN_mod_mul_montgomery(&tmp, &am, &am, mont, ctx)) goto err; if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2, window)) goto err; for (i = 3; i < numPowers; i++) { /* Calculate a^i = a^(i-1) * a */ if (!BN_mod_mul_montgomery(&tmp, &am, &tmp, mont, ctx)) goto err; if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i, window)) goto err; } } bits--; for (wvalue = 0, i = bits % window; i >= 0; i--, bits--) wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, window)) goto err; /* * Scan the exponent one window at a time starting from the most * significant bits. */ while (bits >= 0) { wvalue = 0; /* The 'value' of the window */ /* Scan the window, squaring the result as we go */ for (i = 0; i < window; i++, bits--) { if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) goto err; wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); } /* * Fetch the appropriate pre-computed value from the pre-buf */ if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue, window)) goto err; /* Multiply the result into the intermediate result */ if (!BN_mod_mul_montgomery(&tmp, &tmp, &am, mont, ctx)) goto err; } } /* Convert the final result from montgomery to standard format */ #if defined(SPARC_T4_MONT) if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) { am.d[0] = 1; /* borrow am */ for (i = 1; i < top; i++) am.d[i] = 0; if (!BN_mod_mul_montgomery(rr, &tmp, &am, mont, ctx)) goto err; } else #endif if (!BN_from_montgomery(rr, &tmp, mont, ctx)) goto err; ret = 1; err: if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); if (powerbuf != NULL) { OPENSSL_cleanse(powerbuf, powerbufLen); if (powerbufFree) OPENSSL_free(powerbufFree); } BN_CTX_end(ctx); return (ret); } int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) { BN_MONT_CTX *mont = NULL; int b, bits, ret = 0; int r_is_one; BN_ULONG w, next_w; BIGNUM *d, *r, *t; BIGNUM *swap_tmp; #define BN_MOD_MUL_WORD(r, w, m) \ (BN_mul_word(r, (w)) && \ (/* BN_ucmp(r, (m)) < 0 ? 1 :*/ \ (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1)))) /* * BN_MOD_MUL_WORD is only used with 'w' large, so the BN_ucmp test is * probably more overhead than always using BN_mod (which uses BN_copy if * a similar test returns true). */ /* * We can use BN_mod and do not need BN_nnmod because our accumulator is * never negative (the result of BN_mod does not depend on the sign of * the modulus). */ #define BN_TO_MONTGOMERY_WORD(r, w, mont) \ (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx)) if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_MONT_WORD, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return -1; + return 0; } bn_check_top(p); bn_check_top(m); if (!BN_is_odd(m)) { BNerr(BN_F_BN_MOD_EXP_MONT_WORD, BN_R_CALLED_WITH_EVEN_MODULUS); return (0); } if (m->top == 1) a %= m->d[0]; /* make sure that 'a' is reduced */ bits = BN_num_bits(p); if (bits == 0) { /* x**0 mod 1 is still zero. */ if (BN_is_one(m)) { ret = 1; BN_zero(rr); } else { ret = BN_one(rr); } return ret; } if (a == 0) { BN_zero(rr); ret = 1; return ret; } BN_CTX_start(ctx); d = BN_CTX_get(ctx); r = BN_CTX_get(ctx); t = BN_CTX_get(ctx); if (d == NULL || r == NULL || t == NULL) goto err; if (in_mont != NULL) mont = in_mont; else { if ((mont = BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont, m, ctx)) goto err; } r_is_one = 1; /* except for Montgomery factor */ /* bits-1 >= 0 */ /* The result is accumulated in the product r*w. */ w = a; /* bit 'bits-1' of 'p' is always set */ for (b = bits - 2; b >= 0; b--) { /* First, square r*w. */ next_w = w * w; if ((next_w / w) != w) { /* overflow */ if (r_is_one) { if (!BN_TO_MONTGOMERY_WORD(r, w, mont)) goto err; r_is_one = 0; } else { if (!BN_MOD_MUL_WORD(r, w, m)) goto err; } next_w = 1; } w = next_w; if (!r_is_one) { if (!BN_mod_mul_montgomery(r, r, r, mont, ctx)) goto err; } /* Second, multiply r*w by 'a' if exponent bit is set. */ if (BN_is_bit_set(p, b)) { next_w = w * a; if ((next_w / a) != w) { /* overflow */ if (r_is_one) { if (!BN_TO_MONTGOMERY_WORD(r, w, mont)) goto err; r_is_one = 0; } else { if (!BN_MOD_MUL_WORD(r, w, m)) goto err; } next_w = a; } w = next_w; } } /* Finally, set r:=r*w. */ if (w != 1) { if (r_is_one) { if (!BN_TO_MONTGOMERY_WORD(r, w, mont)) goto err; r_is_one = 0; } else { if (!BN_MOD_MUL_WORD(r, w, m)) goto err; } } if (r_is_one) { /* can happen only if a == 1 */ if (!BN_one(rr)) goto err; } else { if (!BN_from_montgomery(rr, r, mont, ctx)) goto err; } ret = 1; err: if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); BN_CTX_end(ctx); bn_check_top(rr); return (ret); } /* The old fallback, simple version :-) */ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx) { int i, j, bits, ret = 0, wstart, wend, window, wvalue; int start = 1; BIGNUM *d; /* Table of variables obtained from 'ctx' */ BIGNUM *val[TABLE_SIZE]; if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_SIMPLE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return -1; + return 0; } bits = BN_num_bits(p); if (bits == 0) { /* x**0 mod 1 is still zero. */ if (BN_is_one(m)) { ret = 1; BN_zero(r); } else { ret = BN_one(r); } return ret; } BN_CTX_start(ctx); d = BN_CTX_get(ctx); val[0] = BN_CTX_get(ctx); if (!d || !val[0]) goto err; if (!BN_nnmod(val[0], a, m, ctx)) goto err; /* 1 */ if (BN_is_zero(val[0])) { BN_zero(r); ret = 1; goto err; } window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul(d, val[0], val[0], m, ctx)) goto err; /* 2 */ j = 1 << (window - 1); for (i = 1; i < j; i++) { if (((val[i] = BN_CTX_get(ctx)) == NULL) || !BN_mod_mul(val[i], val[i - 1], d, m, ctx)) goto err; } } start = 1; /* This is used to avoid multiplication etc * when there is only the value '1' in the * buffer. */ wvalue = 0; /* The 'value' of the window */ wstart = bits - 1; /* The top bit of the window */ wend = 0; /* The bottom bit of the window */ if (!BN_one(r)) goto err; for (;;) { if (BN_is_bit_set(p, wstart) == 0) { if (!start) if (!BN_mod_mul(r, r, r, m, ctx)) goto err; if (wstart == 0) break; wstart--; continue; } /* * We now have wstart on a 'set' bit, we now need to work out how bit * a window to do. To do this we need to scan forward until the last * set bit before the end of the window */ j = wstart; wvalue = 1; wend = 0; for (i = 1; i < window; i++) { if (wstart - i < 0) break; if (BN_is_bit_set(p, wstart - i)) { wvalue <<= (i - wend); wvalue |= 1; wend = i; } } /* wend is the size of the current window */ j = wend + 1; /* add the 'bytes above' */ if (!start) for (i = 0; i < j; i++) { if (!BN_mod_mul(r, r, r, m, ctx)) goto err; } /* wvalue will be an odd number < 2^window */ if (!BN_mod_mul(r, r, val[wvalue >> 1], m, ctx)) goto err; /* move the 'window' down further */ wstart -= wend + 1; wvalue = 0; start = 0; if (wstart < 0) break; } ret = 1; err: BN_CTX_end(ctx); bn_check_top(r); return (ret); } diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index aac253095141..e22627f85152 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -1,679 +1,683 @@ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 2006. */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include "cryptlib.h" #include #include #include #include #ifndef OPENSSL_NO_CMS # include #endif #include "asn1_locl.h" static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) { const unsigned char *p, *pm; int pklen, pmlen; int ptype; void *pval; ASN1_STRING *pstr; X509_ALGOR *palg; ASN1_INTEGER *public_key = NULL; DSA *dsa = NULL; if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey)) return 0; X509_ALGOR_get0(NULL, &ptype, &pval, palg); if (ptype == V_ASN1_SEQUENCE) { pstr = pval; pm = pstr->data; pmlen = pstr->length; if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen))) { DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR); goto err; } } else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) { if (!(dsa = DSA_new())) { DSAerr(DSA_F_DSA_PUB_DECODE, ERR_R_MALLOC_FAILURE); goto err; } } else { DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_PARAMETER_ENCODING_ERROR); goto err; } if (!(public_key = d2i_ASN1_INTEGER(NULL, &p, pklen))) { DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR); goto err; } if (!(dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL))) { DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_BN_DECODE_ERROR); goto err; } ASN1_INTEGER_free(public_key); EVP_PKEY_assign_DSA(pkey, dsa); return 1; err: if (public_key) ASN1_INTEGER_free(public_key); if (dsa) DSA_free(dsa); return 0; } static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) { DSA *dsa; int ptype; unsigned char *penc = NULL; int penclen; ASN1_STRING *str = NULL; + ASN1_OBJECT *aobj; dsa = pkey->pkey.dsa; if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) { str = ASN1_STRING_new(); if (!str) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } str->length = i2d_DSAparams(dsa, &str->data); if (str->length <= 0) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } ptype = V_ASN1_SEQUENCE; } else ptype = V_ASN1_UNDEF; dsa->write_params = 0; penclen = i2d_DSAPublicKey(dsa, &penc); if (penclen <= 0) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } - if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA), - ptype, str, penc, penclen)) + aobj = OBJ_nid2obj(EVP_PKEY_DSA); + if (aobj == NULL) + goto err; + + if (X509_PUBKEY_set0_param(pk, aobj, ptype, str, penc, penclen)) return 1; err: if (penc) OPENSSL_free(penc); if (str) ASN1_STRING_free(str); return 0; } /* * In PKCS#8 DSA: you just get a private key integer and parameters in the * AlgorithmIdentifier the pubkey must be recalculated. */ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) { const unsigned char *p, *pm; int pklen, pmlen; int ptype; void *pval; ASN1_STRING *pstr; X509_ALGOR *palg; ASN1_INTEGER *privkey = NULL; BN_CTX *ctx = NULL; STACK_OF(ASN1_TYPE) *ndsa = NULL; DSA *dsa = NULL; int ret = 0; if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8)) return 0; X509_ALGOR_get0(NULL, &ptype, &pval, palg); /* Check for broken DSA PKCS#8, UGH! */ if (*p == (V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED)) { ASN1_TYPE *t1, *t2; if (!(ndsa = d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen))) goto decerr; if (sk_ASN1_TYPE_num(ndsa) != 2) goto decerr; /*- * Handle Two broken types: * SEQUENCE {parameters, priv_key} * SEQUENCE {pub_key, priv_key} */ t1 = sk_ASN1_TYPE_value(ndsa, 0); t2 = sk_ASN1_TYPE_value(ndsa, 1); if (t1->type == V_ASN1_SEQUENCE) { p8->broken = PKCS8_EMBEDDED_PARAM; pval = t1->value.ptr; } else if (ptype == V_ASN1_SEQUENCE) p8->broken = PKCS8_NS_DB; else goto decerr; if (t2->type != V_ASN1_INTEGER) goto decerr; privkey = t2->value.integer; } else { const unsigned char *q = p; if (!(privkey = d2i_ASN1_INTEGER(NULL, &p, pklen))) goto decerr; if (privkey->type == V_ASN1_NEG_INTEGER) { p8->broken = PKCS8_NEG_PRIVKEY; ASN1_STRING_clear_free(privkey); if (!(privkey = d2i_ASN1_UINTEGER(NULL, &q, pklen))) goto decerr; } if (ptype != V_ASN1_SEQUENCE) goto decerr; } pstr = pval; pm = pstr->data; pmlen = pstr->length; if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen))) goto decerr; /* We have parameters now set private key */ if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) { DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR); goto dsaerr; } /* Calculate public key */ if (!(dsa->pub_key = BN_new())) { DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE); goto dsaerr; } if (!(ctx = BN_CTX_new())) { DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE); goto dsaerr; } BN_set_flags(dsa->priv_key, BN_FLG_CONSTTIME); if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) { DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR); goto dsaerr; } EVP_PKEY_assign_DSA(pkey, dsa); ret = 1; goto done; decerr: DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_DECODE_ERROR); dsaerr: DSA_free(dsa); done: BN_CTX_free(ctx); if (ndsa) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); else ASN1_STRING_clear_free(privkey); return ret; } static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) { ASN1_STRING *params = NULL; ASN1_INTEGER *prkey = NULL; unsigned char *dp = NULL; int dplen; if (!pkey->pkey.dsa || !pkey->pkey.dsa->priv_key) { DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_MISSING_PARAMETERS); goto err; } params = ASN1_STRING_new(); if (!params) { DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } params->length = i2d_DSAparams(pkey->pkey.dsa, ¶ms->data); if (params->length <= 0) { DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } params->type = V_ASN1_SEQUENCE; /* Get private key into integer */ prkey = BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, NULL); if (!prkey) { DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_BN_ERROR); goto err; } dplen = i2d_ASN1_INTEGER(prkey, &dp); ASN1_STRING_clear_free(prkey); prkey = NULL; if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0, V_ASN1_SEQUENCE, params, dp, dplen)) goto err; return 1; err: if (dp != NULL) OPENSSL_free(dp); if (params != NULL) ASN1_STRING_free(params); if (prkey != NULL) ASN1_STRING_clear_free(prkey); return 0; } static int int_dsa_size(const EVP_PKEY *pkey) { return (DSA_size(pkey->pkey.dsa)); } static int dsa_bits(const EVP_PKEY *pkey) { return BN_num_bits(pkey->pkey.dsa->p); } static int dsa_missing_parameters(const EVP_PKEY *pkey) { DSA *dsa; dsa = pkey->pkey.dsa; if (dsa == NULL || dsa->p == NULL || dsa->q == NULL || dsa->g == NULL) return 1; return 0; } static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) { BIGNUM *a; if ((a = BN_dup(from->pkey.dsa->p)) == NULL) return 0; if (to->pkey.dsa->p != NULL) BN_free(to->pkey.dsa->p); to->pkey.dsa->p = a; if ((a = BN_dup(from->pkey.dsa->q)) == NULL) return 0; if (to->pkey.dsa->q != NULL) BN_free(to->pkey.dsa->q); to->pkey.dsa->q = a; if ((a = BN_dup(from->pkey.dsa->g)) == NULL) return 0; if (to->pkey.dsa->g != NULL) BN_free(to->pkey.dsa->g); to->pkey.dsa->g = a; return 1; } static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) { if (BN_cmp(a->pkey.dsa->p, b->pkey.dsa->p) || BN_cmp(a->pkey.dsa->q, b->pkey.dsa->q) || BN_cmp(a->pkey.dsa->g, b->pkey.dsa->g)) return 0; else return 1; } static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) { if (BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) != 0) return 0; else return 1; } static void int_dsa_free(EVP_PKEY *pkey) { DSA_free(pkey->pkey.dsa); } static void update_buflen(const BIGNUM *b, size_t *pbuflen) { size_t i; if (!b) return; if (*pbuflen < (i = (size_t)BN_num_bytes(b))) *pbuflen = i; } static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) { unsigned char *m = NULL; int ret = 0; size_t buf_len = 0; const char *ktype = NULL; const BIGNUM *priv_key, *pub_key; if (ptype == 2) priv_key = x->priv_key; else priv_key = NULL; if (ptype > 0) pub_key = x->pub_key; else pub_key = NULL; if (ptype == 2) ktype = "Private-Key"; else if (ptype == 1) ktype = "Public-Key"; else ktype = "DSA-Parameters"; update_buflen(x->p, &buf_len); update_buflen(x->q, &buf_len); update_buflen(x->g, &buf_len); update_buflen(priv_key, &buf_len); update_buflen(pub_key, &buf_len); m = (unsigned char *)OPENSSL_malloc(buf_len + 10); if (m == NULL) { DSAerr(DSA_F_DO_DSA_PRINT, ERR_R_MALLOC_FAILURE); goto err; } if (priv_key) { if (!BIO_indent(bp, off, 128)) goto err; if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p)) <= 0) goto err; } if (!ASN1_bn_print(bp, "priv:", priv_key, m, off)) goto err; if (!ASN1_bn_print(bp, "pub: ", pub_key, m, off)) goto err; if (!ASN1_bn_print(bp, "P: ", x->p, m, off)) goto err; if (!ASN1_bn_print(bp, "Q: ", x->q, m, off)) goto err; if (!ASN1_bn_print(bp, "G: ", x->g, m, off)) goto err; ret = 1; err: if (m != NULL) OPENSSL_free(m); return (ret); } static int dsa_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { DSA *dsa; if (!(dsa = d2i_DSAparams(NULL, pder, derlen))) { DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB); return 0; } EVP_PKEY_assign_DSA(pkey, dsa); return 1; } static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder) { return i2d_DSAparams(pkey->pkey.dsa, pder); } static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { return do_dsa_print(bp, pkey->pkey.dsa, indent, 0); } static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { return do_dsa_print(bp, pkey->pkey.dsa, indent, 1); } static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { return do_dsa_print(bp, pkey->pkey.dsa, indent, 2); } static int old_dsa_priv_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { DSA *dsa; if (!(dsa = d2i_DSAPrivateKey(NULL, pder, derlen))) { DSAerr(DSA_F_OLD_DSA_PRIV_DECODE, ERR_R_DSA_LIB); return 0; } EVP_PKEY_assign_DSA(pkey, dsa); return 1; } static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) { return i2d_DSAPrivateKey(pkey->pkey.dsa, pder); } static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx) { DSA_SIG *dsa_sig; const unsigned char *p; if (!sig) { if (BIO_puts(bp, "\n") <= 0) return 0; else return 1; } p = sig->data; dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length); if (dsa_sig) { int rv = 0; size_t buf_len = 0; unsigned char *m = NULL; update_buflen(dsa_sig->r, &buf_len); update_buflen(dsa_sig->s, &buf_len); m = OPENSSL_malloc(buf_len + 10); if (m == NULL) { DSAerr(DSA_F_DSA_SIG_PRINT, ERR_R_MALLOC_FAILURE); goto err; } if (BIO_write(bp, "\n", 1) != 1) goto err; if (!ASN1_bn_print(bp, "r: ", dsa_sig->r, m, indent)) goto err; if (!ASN1_bn_print(bp, "s: ", dsa_sig->s, m, indent)) goto err; rv = 1; err: if (m) OPENSSL_free(m); DSA_SIG_free(dsa_sig); return rv; } return X509_signature_dump(bp, sig, indent); } static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) { switch (op) { case ASN1_PKEY_CTRL_PKCS7_SIGN: if (arg1 == 0) { int snid, hnid; X509_ALGOR *alg1, *alg2; PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2); if (alg1 == NULL || alg1->algorithm == NULL) return -1; hnid = OBJ_obj2nid(alg1->algorithm); if (hnid == NID_undef) return -1; if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) return -1; X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); } return 1; #ifndef OPENSSL_NO_CMS case ASN1_PKEY_CTRL_CMS_SIGN: if (arg1 == 0) { int snid, hnid; X509_ALGOR *alg1, *alg2; CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); if (alg1 == NULL || alg1->algorithm == NULL) return -1; hnid = OBJ_obj2nid(alg1->algorithm); if (hnid == NID_undef) return -1; if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) return -1; X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); } return 1; case ASN1_PKEY_CTRL_CMS_RI_TYPE: *(int *)arg2 = CMS_RECIPINFO_NONE; return 1; #endif case ASN1_PKEY_CTRL_DEFAULT_MD_NID: *(int *)arg2 = NID_sha256; return 2; default: return -2; } } /* NB these are sorted in pkey_id order, lowest first */ const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = { { EVP_PKEY_DSA2, EVP_PKEY_DSA, ASN1_PKEY_ALIAS}, { EVP_PKEY_DSA1, EVP_PKEY_DSA, ASN1_PKEY_ALIAS}, { EVP_PKEY_DSA4, EVP_PKEY_DSA, ASN1_PKEY_ALIAS}, { EVP_PKEY_DSA3, EVP_PKEY_DSA, ASN1_PKEY_ALIAS}, { EVP_PKEY_DSA, EVP_PKEY_DSA, 0, "DSA", "OpenSSL DSA method", dsa_pub_decode, dsa_pub_encode, dsa_pub_cmp, dsa_pub_print, dsa_priv_decode, dsa_priv_encode, dsa_priv_print, int_dsa_size, dsa_bits, dsa_param_decode, dsa_param_encode, dsa_missing_parameters, dsa_copy_parameters, dsa_cmp_parameters, dsa_param_print, dsa_sig_print, int_dsa_free, dsa_pkey_ctrl, old_dsa_priv_decode, old_dsa_priv_encode} }; diff --git a/crypto/engine/eng_fat.c b/crypto/engine/eng_fat.c index 4279dd94b135..55d3858bb1c6 100644 --- a/crypto/engine/eng_fat.c +++ b/crypto/engine/eng_fat.c @@ -1,181 +1,182 @@ /* crypto/engine/eng_fat.c */ /* ==================================================================== * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #include "eng_int.h" #include int ENGINE_set_default(ENGINE *e, unsigned int flags) { if ((flags & ENGINE_METHOD_CIPHERS) && !ENGINE_set_default_ciphers(e)) return 0; if ((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e)) return 0; #ifndef OPENSSL_NO_RSA if ((flags & ENGINE_METHOD_RSA) && !ENGINE_set_default_RSA(e)) return 0; #endif #ifndef OPENSSL_NO_DSA if ((flags & ENGINE_METHOD_DSA) && !ENGINE_set_default_DSA(e)) return 0; #endif #ifndef OPENSSL_NO_DH if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) return 0; #endif #ifndef OPENSSL_NO_ECDH if ((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) return 0; #endif #ifndef OPENSSL_NO_ECDSA if ((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) return 0; #endif if ((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) return 0; if ((flags & ENGINE_METHOD_PKEY_METHS) && !ENGINE_set_default_pkey_meths(e)) return 0; if ((flags & ENGINE_METHOD_PKEY_ASN1_METHS) && !ENGINE_set_default_pkey_asn1_meths(e)) return 0; return 1; } /* Set default algorithms using a string */ static int int_def_cb(const char *alg, int len, void *arg) { unsigned int *pflags = arg; if (alg == NULL) return 0; if (!strncmp(alg, "ALL", len)) *pflags |= ENGINE_METHOD_ALL; else if (!strncmp(alg, "RSA", len)) *pflags |= ENGINE_METHOD_RSA; else if (!strncmp(alg, "DSA", len)) *pflags |= ENGINE_METHOD_DSA; else if (!strncmp(alg, "ECDH", len)) *pflags |= ENGINE_METHOD_ECDH; else if (!strncmp(alg, "ECDSA", len)) *pflags |= ENGINE_METHOD_ECDSA; else if (!strncmp(alg, "DH", len)) *pflags |= ENGINE_METHOD_DH; else if (!strncmp(alg, "RAND", len)) *pflags |= ENGINE_METHOD_RAND; else if (!strncmp(alg, "CIPHERS", len)) *pflags |= ENGINE_METHOD_CIPHERS; else if (!strncmp(alg, "DIGESTS", len)) *pflags |= ENGINE_METHOD_DIGESTS; else if (!strncmp(alg, "PKEY", len)) *pflags |= ENGINE_METHOD_PKEY_METHS | ENGINE_METHOD_PKEY_ASN1_METHS; else if (!strncmp(alg, "PKEY_CRYPTO", len)) *pflags |= ENGINE_METHOD_PKEY_METHS; else if (!strncmp(alg, "PKEY_ASN1", len)) *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS; else return 0; return 1; } int ENGINE_set_default_string(ENGINE *e, const char *def_list) { unsigned int flags = 0; if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) { ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING, ENGINE_R_INVALID_STRING); ERR_add_error_data(2, "str=", def_list); return 0; } return ENGINE_set_default(e, flags); } int ENGINE_register_complete(ENGINE *e) { ENGINE_register_ciphers(e); ENGINE_register_digests(e); #ifndef OPENSSL_NO_RSA ENGINE_register_RSA(e); #endif #ifndef OPENSSL_NO_DSA ENGINE_register_DSA(e); #endif #ifndef OPENSSL_NO_DH ENGINE_register_DH(e); #endif #ifndef OPENSSL_NO_ECDH ENGINE_register_ECDH(e); #endif #ifndef OPENSSL_NO_ECDSA ENGINE_register_ECDSA(e); #endif ENGINE_register_RAND(e); ENGINE_register_pkey_meths(e); + ENGINE_register_pkey_asn1_meths(e); return 1; } int ENGINE_register_all_complete(void) { ENGINE *e; for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) if (!(e->flags & ENGINE_FLAGS_NO_REGISTER_ALL)) ENGINE_register_complete(e); return 1; } diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index f3798872598a..51bb258e74b8 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -1,477 +1,477 @@ /* crypto/lhash/lhash.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /*- * Code for dynamic hash table routines * Author - Eric Young v 2.0 * * 2.2 eay - added #include "crypto.h" so the memory leak checking code is * present. eay 18-Jun-98 * * 2.1 eay - Added an 'error in last operation' flag. eay 6-May-98 * * 2.0 eay - Fixed a bug that occurred when using lh_delete * from inside lh_doall(). As entries were deleted, * the 'table' was 'contract()ed', making some entries * jump from the end of the table to the start, there by * skipping the lh_doall() processing. eay - 4/12/95 * * 1.9 eay - Fixed a memory leak in lh_free, the LHASH_NODEs * were not being free()ed. 21/11/95 * * 1.8 eay - Put the stats routines into a separate file, lh_stats.c * 19/09/95 * * 1.7 eay - Removed the fputs() for realloc failures - the code * should silently tolerate them. I have also fixed things * lint complained about 04/05/95 * * 1.6 eay - Fixed an invalid pointers in contract/expand 27/07/92 * * 1.5 eay - Fixed a misuse of realloc in expand 02/03/1992 * * 1.4 eay - Fixed lh_doall so the function can call lh_delete 28/05/91 * * 1.3 eay - Fixed a few lint problems 19/3/1991 * * 1.2 eay - Fixed lh_doall problem 13/3/1991 * * 1.1 eay - Added lh_doall * * 1.0 eay - First version */ #include #include #include #include #include /* * A hashing implementation that appears to be based on the linear hashing * alogrithm: * https://en.wikipedia.org/wiki/Linear_hashing * * Litwin, Witold (1980), "Linear hashing: A new tool for file and table - * addressing", Proc. 6th Conference on Very Large Databases: 212–223 + * addressing", Proc. 6th Conference on Very Large Databases: 212-223 * http://hackthology.com/pdfs/Litwin-1980-Linear_Hashing.pdf * * From the wikipedia article "Linear hashing is used in the BDB Berkeley * database system, which in turn is used by many software systems such as * OpenLDAP, using a C implementation derived from the CACM article and first * published on the Usenet in 1988 by Esmond Pitt." * * The CACM paper is available here: * https://pdfs.semanticscholar.org/ff4d/1c5deca6269cc316bfd952172284dbf610ee.pdf */ const char lh_version[] = "lhash" OPENSSL_VERSION_PTEXT; #undef MIN_NODES #define MIN_NODES 16 #define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */ #define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */ static int expand(_LHASH *lh); static void contract(_LHASH *lh); static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash); _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) { _LHASH *ret; int i; if ((ret = OPENSSL_malloc(sizeof(_LHASH))) == NULL) goto err0; if ((ret->b = OPENSSL_malloc(sizeof(LHASH_NODE *) * MIN_NODES)) == NULL) goto err1; for (i = 0; i < MIN_NODES; i++) ret->b[i] = NULL; ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); ret->num_nodes = MIN_NODES / 2; ret->num_alloc_nodes = MIN_NODES; ret->p = 0; ret->pmax = MIN_NODES / 2; ret->up_load = UP_LOAD; ret->down_load = DOWN_LOAD; ret->num_items = 0; ret->num_expands = 0; ret->num_expand_reallocs = 0; ret->num_contracts = 0; ret->num_contract_reallocs = 0; ret->num_hash_calls = 0; ret->num_comp_calls = 0; ret->num_insert = 0; ret->num_replace = 0; ret->num_delete = 0; ret->num_no_delete = 0; ret->num_retrieve = 0; ret->num_retrieve_miss = 0; ret->num_hash_comps = 0; ret->error = 0; return (ret); err1: OPENSSL_free(ret); err0: return (NULL); } void lh_free(_LHASH *lh) { unsigned int i; LHASH_NODE *n, *nn; if (lh == NULL) return; for (i = 0; i < lh->num_nodes; i++) { n = lh->b[i]; while (n != NULL) { nn = n->next; OPENSSL_free(n); n = nn; } } OPENSSL_free(lh->b); OPENSSL_free(lh); } void *lh_insert(_LHASH *lh, void *data) { unsigned long hash; LHASH_NODE *nn, **rn; void *ret; lh->error = 0; if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes) && !expand(lh)) return NULL; rn = getrn(lh, data, &hash); if (*rn == NULL) { if ((nn = (LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL) { lh->error++; return (NULL); } nn->data = data; nn->next = NULL; #ifndef OPENSSL_NO_HASH_COMP nn->hash = hash; #endif *rn = nn; ret = NULL; lh->num_insert++; lh->num_items++; } else { /* replace same key */ ret = (*rn)->data; (*rn)->data = data; lh->num_replace++; } return (ret); } void *lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } void *lh_retrieve(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_retrieve_miss++; return (NULL); } else { ret = (*rn)->data; lh->num_retrieve++; } return (ret); } static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) { int i; LHASH_NODE *a, *n; if (lh == NULL) return; /* * reverse the order so we search from 'top to bottom' We were having * memory leaks otherwise */ for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { /* * 28/05/91 - eay - n added so items can be deleted via lh_doall */ /* * 22/05/08 - ben - eh? since a is not passed, this should not be * needed */ n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func) { doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)0, NULL); } void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) { doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); } static int expand(_LHASH *lh) { LHASH_NODE **n, **n1, **n2, *np; unsigned int p, pmax, nni, j; unsigned long hash; nni = lh->num_alloc_nodes; p = lh->p; pmax = lh->pmax; if (p + 1 >= pmax) { j = nni * 2; n = OPENSSL_realloc(lh->b, (int)(sizeof(LHASH_NODE *) * j)); if (n == NULL) { lh->error++; return 0; } lh->b = n; memset(n + nni, 0, sizeof(*n) * (j - nni)); lh->pmax = nni; lh->num_alloc_nodes = j; lh->num_expand_reallocs++; lh->p = 0; } else { lh->p++; } lh->num_nodes++; lh->num_expands++; n1 = &(lh->b[p]); n2 = &(lh->b[p + pmax]); *n2 = NULL; for (np = *n1; np != NULL;) { #ifndef OPENSSL_NO_HASH_COMP hash = np->hash; #else hash = lh->hash(np->data); lh->num_hash_calls++; #endif if ((hash % nni) != p) { /* move it */ *n1 = (*n1)->next; np->next = *n2; *n2 = np; } else n1 = &((*n1)->next); np = *n1; } return 1; } static void contract(_LHASH *lh) { LHASH_NODE **n, *n1, *np; np = lh->b[lh->p + lh->pmax - 1]; lh->b[lh->p + lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */ if (lh->p == 0) { n = (LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *) * lh->pmax)); if (n == NULL) { /* fputs("realloc error in lhash",stderr); */ lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes /= 2; lh->pmax /= 2; lh->p = lh->pmax - 1; lh->b = n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1 = lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p] = np; else { while (n1->next != NULL) n1 = n1->next; n1->next = np; } } static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash) { LHASH_NODE **ret, *n1; unsigned long hash, nn; LHASH_COMP_FN_TYPE cf; hash = (*(lh->hash)) (data); lh->num_hash_calls++; *rhash = hash; nn = hash % lh->pmax; if (nn < lh->p) nn = hash % lh->num_alloc_nodes; cf = lh->comp; ret = &(lh->b[(int)nn]); for (n1 = *ret; n1 != NULL; n1 = n1->next) { #ifndef OPENSSL_NO_HASH_COMP lh->num_hash_comps++; if (n1->hash != hash) { ret = &(n1->next); continue; } #endif lh->num_comp_calls++; if (cf(n1->data, data) == 0) break; ret = &(n1->next); } return (ret); } /* * The following hash seems to work very well on normal text strings no * collisions on /usr/dict/words and it distributes on %2^n quite well, not * as good as MD5, but still good. */ unsigned long lh_strhash(const char *c) { unsigned long ret = 0; long n; unsigned long v; int r; if ((c == NULL) || (*c == '\0')) return (ret); /*- unsigned char b[16]; MD5(c,strlen(c),b); return(b[0]|(b[1]<<8)|(b[2]<<16)|(b[3]<<24)); */ n = 0x100; while (*c) { v = n | (*c); n += 0x100; r = (int)((v >> 2) ^ v) & 0x0f; ret = (ret << r) | (ret >> (32 - r)); ret &= 0xFFFFFFFFL; ret ^= v * v; c++; } return ((ret >> 16) ^ ret); } unsigned long lh_num_items(const _LHASH *lh) { return lh ? lh->num_items : 0; } diff --git a/crypto/opensslv.h b/crypto/opensslv.h index c944d562dae0..baee2d0865fd 100644 --- a/crypto/opensslv.h +++ b/crypto/opensslv.h @@ -1,97 +1,97 @@ #ifndef HEADER_OPENSSLV_H # define HEADER_OPENSSLV_H #ifdef __cplusplus extern "C" { #endif /*- * Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x100020dfL +# define OPENSSL_VERSION_NUMBER 0x100020efL # ifdef OPENSSL_FIPS -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2m-fips 2 Nov 2017" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2n-fips 7 Dec 2017" # else -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2m 2 Nov 2017" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2n 7 Dec 2017" # endif # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /*- * The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ # define SHLIB_VERSION_HISTORY "" # define SHLIB_VERSION_NUMBER "1.0.0" #ifdef __cplusplus } #endif #endif /* HEADER_OPENSSLV_H */ diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c index 082c8da2efc2..a85493d6097b 100644 --- a/crypto/rsa/rsa_gen.c +++ b/crypto/rsa/rsa_gen.c @@ -1,251 +1,250 @@ /* crypto/rsa/rsa_gen.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* * NB: these functions have been "upgraded", the deprecated versions (which * are compatibility wrappers using these functions) are in rsa_depr.c. - * Geoff */ #include #include #include "cryptlib.h" #include #include #ifdef OPENSSL_FIPS # include extern int FIPS_rsa_x931_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); #endif static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); /* * NB: this wrapper would normally be placed in rsa_lib.c and the static * implementation would probably be in rsa_eay.c. Nonetheless, is kept here * so that we don't introduce a new linker dependency. Eg. any application * that wasn't previously linking object code related to key-generation won't * have to now just because key-generation is part of RSA_METHOD. */ int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) { #ifdef OPENSSL_FIPS if (FIPS_mode() && !(rsa->meth->flags & RSA_FLAG_FIPS_METHOD) && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) { RSAerr(RSA_F_RSA_GENERATE_KEY_EX, RSA_R_NON_FIPS_RSA_METHOD); return 0; } #endif if (rsa->meth->rsa_keygen) return rsa->meth->rsa_keygen(rsa, bits, e_value, cb); #ifdef OPENSSL_FIPS if (FIPS_mode()) return FIPS_rsa_x931_generate_key_ex(rsa, bits, e_value, cb); #endif return rsa_builtin_keygen(rsa, bits, e_value, cb); } static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) { BIGNUM *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *tmp; BIGNUM local_r0, local_d, local_p; BIGNUM *pr0, *d, *p; int bitsp, bitsq, ok = -1, n = 0; BN_CTX *ctx = NULL; + /* + * When generating ridiculously small keys, we can get stuck + * continually regenerating the same prime values. + */ + if (bits < 16) { + ok = 0; /* we set our own err */ + RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL); + goto err; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err; BN_CTX_start(ctx); r0 = BN_CTX_get(ctx); r1 = BN_CTX_get(ctx); r2 = BN_CTX_get(ctx); r3 = BN_CTX_get(ctx); if (r3 == NULL) goto err; bitsp = (bits + 1) / 2; bitsq = bits - bitsp; /* We need the RSA components non-NULL */ if (!rsa->n && ((rsa->n = BN_new()) == NULL)) goto err; if (!rsa->d && ((rsa->d = BN_new()) == NULL)) goto err; if (!rsa->e && ((rsa->e = BN_new()) == NULL)) goto err; if (!rsa->p && ((rsa->p = BN_new()) == NULL)) goto err; if (!rsa->q && ((rsa->q = BN_new()) == NULL)) goto err; if (!rsa->dmp1 && ((rsa->dmp1 = BN_new()) == NULL)) goto err; if (!rsa->dmq1 && ((rsa->dmq1 = BN_new()) == NULL)) goto err; if (!rsa->iqmp && ((rsa->iqmp = BN_new()) == NULL)) goto err; if (BN_copy(rsa->e, e_value) == NULL) goto err; /* generate p and q */ for (;;) { if (!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb)) goto err; if (!BN_sub(r2, rsa->p, BN_value_one())) goto err; if (!BN_gcd(r1, r2, rsa->e, ctx)) goto err; if (BN_is_one(r1)) break; if (!BN_GENCB_call(cb, 2, n++)) goto err; } if (!BN_GENCB_call(cb, 3, 0)) goto err; for (;;) { - /* - * When generating ridiculously small keys, we can get stuck - * continually regenerating the same prime values. Check for this and - * bail if it happens 3 times. - */ - unsigned int degenerate = 0; do { if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb)) goto err; - } while ((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3)); - if (degenerate == 3) { - ok = 0; /* we set our own err */ - RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL); - goto err; - } + } while (BN_cmp(rsa->p, rsa->q) == 0); if (!BN_sub(r2, rsa->q, BN_value_one())) goto err; if (!BN_gcd(r1, r2, rsa->e, ctx)) goto err; if (BN_is_one(r1)) break; if (!BN_GENCB_call(cb, 2, n++)) goto err; } if (!BN_GENCB_call(cb, 3, 1)) goto err; if (BN_cmp(rsa->p, rsa->q) < 0) { tmp = rsa->p; rsa->p = rsa->q; rsa->q = tmp; } /* calculate n */ if (!BN_mul(rsa->n, rsa->p, rsa->q, ctx)) goto err; /* calculate d */ if (!BN_sub(r1, rsa->p, BN_value_one())) goto err; /* p-1 */ if (!BN_sub(r2, rsa->q, BN_value_one())) goto err; /* q-1 */ if (!BN_mul(r0, r1, r2, ctx)) goto err; /* (p-1)(q-1) */ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { pr0 = &local_r0; BN_with_flags(pr0, r0, BN_FLG_CONSTTIME); } else pr0 = r0; if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx)) goto err; /* d */ /* set up d for correct BN_FLG_CONSTTIME flag */ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { d = &local_d; BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); } else d = rsa->d; /* calculate d mod (p-1) */ if (!BN_mod(rsa->dmp1, d, r1, ctx)) goto err; /* calculate d mod (q-1) */ if (!BN_mod(rsa->dmq1, d, r2, ctx)) goto err; /* calculate inverse of q mod p */ if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { p = &local_p; BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME); } else p = rsa->p; if (!BN_mod_inverse(rsa->iqmp, rsa->q, p, ctx)) goto err; ok = 1; err: if (ok == -1) { RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, ERR_LIB_BN); ok = 0; } if (ctx != NULL) { BN_CTX_end(ctx); BN_CTX_free(ctx); } return ok; } diff --git a/crypto/sha/asm/sha256-armv4.pl b/crypto/sha/asm/sha256-armv4.pl index 4fee74d832d1..750216eb4267 100755 --- a/crypto/sha/asm/sha256-armv4.pl +++ b/crypto/sha/asm/sha256-armv4.pl @@ -1,713 +1,713 @@ #!/usr/bin/env perl # ==================================================================== # Written by Andy Polyakov for the OpenSSL # project. The module is, however, dual licensed under OpenSSL and # CRYPTOGAMS licenses depending on where you obtain it. For further # details see http://www.openssl.org/~appro/cryptogams/. # # Permission to use under GPL terms is granted. # ==================================================================== # SHA256 block procedure for ARMv4. May 2007. # Performance is ~2x better than gcc 3.4 generated code and in "abso- # lute" terms is ~2250 cycles per 64-byte block or ~35 cycles per # byte [on single-issue Xscale PXA250 core]. # July 2010. # # Rescheduling for dual-issue pipeline resulted in 22% improvement on # Cortex A8 core and ~20 cycles per processed byte. # February 2011. # # Profiler-assisted and platform-specific optimization resulted in 16% # improvement on Cortex A8 core and ~15.4 cycles per processed byte. # September 2013. # # Add NEON implementation. On Cortex A8 it was measured to process one # byte in 12.5 cycles or 23% faster than integer-only code. Snapdragon # S4 does it in 12.5 cycles too, but it's 50% faster than integer-only # code (meaning that latter performs sub-optimally, nothing was done # about it). # May 2014. # # Add ARMv8 code path performing at 2.0 cpb on Apple A7. while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} open STDOUT,">$output"; $ctx="r0"; $t0="r0"; $inp="r1"; $t4="r1"; $len="r2"; $t1="r2"; $T1="r3"; $t3="r3"; $A="r4"; $B="r5"; $C="r6"; $D="r7"; $E="r8"; $F="r9"; $G="r10"; $H="r11"; @V=($A,$B,$C,$D,$E,$F,$G,$H); $t2="r12"; $Ktbl="r14"; @Sigma0=( 2,13,22); @Sigma1=( 6,11,25); @sigma0=( 7,18, 3); @sigma1=(17,19,10); sub BODY_00_15 { my ($i,$a,$b,$c,$d,$e,$f,$g,$h) = @_; $code.=<<___ if ($i<16); #if __ARM_ARCH__>=7 @ ldr $t1,[$inp],#4 @ $i # if $i==15 str $inp,[sp,#17*4] @ make room for $t4 # endif eor $t0,$e,$e,ror#`$Sigma1[1]-$Sigma1[0]` add $a,$a,$t2 @ h+=Maj(a,b,c) from the past eor $t0,$t0,$e,ror#`$Sigma1[2]-$Sigma1[0]` @ Sigma1(e) rev $t1,$t1 #else @ ldrb $t1,[$inp,#3] @ $i add $a,$a,$t2 @ h+=Maj(a,b,c) from the past ldrb $t2,[$inp,#2] ldrb $t0,[$inp,#1] orr $t1,$t1,$t2,lsl#8 ldrb $t2,[$inp],#4 orr $t1,$t1,$t0,lsl#16 # if $i==15 str $inp,[sp,#17*4] @ make room for $t4 # endif eor $t0,$e,$e,ror#`$Sigma1[1]-$Sigma1[0]` orr $t1,$t1,$t2,lsl#24 eor $t0,$t0,$e,ror#`$Sigma1[2]-$Sigma1[0]` @ Sigma1(e) #endif ___ $code.=<<___; ldr $t2,[$Ktbl],#4 @ *K256++ add $h,$h,$t1 @ h+=X[i] str $t1,[sp,#`$i%16`*4] eor $t1,$f,$g add $h,$h,$t0,ror#$Sigma1[0] @ h+=Sigma1(e) and $t1,$t1,$e add $h,$h,$t2 @ h+=K256[i] eor $t1,$t1,$g @ Ch(e,f,g) eor $t0,$a,$a,ror#`$Sigma0[1]-$Sigma0[0]` add $h,$h,$t1 @ h+=Ch(e,f,g) #if $i==31 and $t2,$t2,#0xff cmp $t2,#0xf2 @ done? #endif #if $i<15 # if __ARM_ARCH__>=7 ldr $t1,[$inp],#4 @ prefetch # else ldrb $t1,[$inp,#3] # endif eor $t2,$a,$b @ a^b, b^c in next round #else ldr $t1,[sp,#`($i+2)%16`*4] @ from future BODY_16_xx eor $t2,$a,$b @ a^b, b^c in next round ldr $t4,[sp,#`($i+15)%16`*4] @ from future BODY_16_xx #endif eor $t0,$t0,$a,ror#`$Sigma0[2]-$Sigma0[0]` @ Sigma0(a) and $t3,$t3,$t2 @ (b^c)&=(a^b) add $d,$d,$h @ d+=h eor $t3,$t3,$b @ Maj(a,b,c) add $h,$h,$t0,ror#$Sigma0[0] @ h+=Sigma0(a) @ add $h,$h,$t3 @ h+=Maj(a,b,c) ___ ($t2,$t3)=($t3,$t2); } sub BODY_16_XX { my ($i,$a,$b,$c,$d,$e,$f,$g,$h) = @_; $code.=<<___; @ ldr $t1,[sp,#`($i+1)%16`*4] @ $i @ ldr $t4,[sp,#`($i+14)%16`*4] mov $t0,$t1,ror#$sigma0[0] add $a,$a,$t2 @ h+=Maj(a,b,c) from the past mov $t2,$t4,ror#$sigma1[0] eor $t0,$t0,$t1,ror#$sigma0[1] eor $t2,$t2,$t4,ror#$sigma1[1] eor $t0,$t0,$t1,lsr#$sigma0[2] @ sigma0(X[i+1]) ldr $t1,[sp,#`($i+0)%16`*4] eor $t2,$t2,$t4,lsr#$sigma1[2] @ sigma1(X[i+14]) ldr $t4,[sp,#`($i+9)%16`*4] add $t2,$t2,$t0 eor $t0,$e,$e,ror#`$Sigma1[1]-$Sigma1[0]` @ from BODY_00_15 add $t1,$t1,$t2 eor $t0,$t0,$e,ror#`$Sigma1[2]-$Sigma1[0]` @ Sigma1(e) add $t1,$t1,$t4 @ X[i] ___ &BODY_00_15(@_); } $code=<<___; #ifndef __KERNEL__ # include "arm_arch.h" #else # define __ARM_ARCH__ __LINUX_ARM_ARCH__ # define __ARM_MAX_ARCH__ 7 #endif .text #if __ARM_ARCH__<7 .code 32 #else .syntax unified # ifdef __thumb2__ .thumb # else .code 32 # endif #endif .type K256,%object .align 5 K256: .word 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5 .word 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5 .word 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3 .word 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174 .word 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc .word 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da .word 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7 .word 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967 .word 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13 .word 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85 .word 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3 .word 0xd192e819,0xd6990624,0xf40e3585,0x106aa070 .word 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5 .word 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3 .word 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208 .word 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 .size K256,.-K256 .word 0 @ terminator #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) .LOPENSSL_armcap: .word OPENSSL_armcap_P-sha256_block_data_order #endif .align 5 .global sha256_block_data_order .type sha256_block_data_order,%function sha256_block_data_order: #if __ARM_ARCH__<7 sub r3,pc,#8 @ sha256_block_data_order #else - adr r3,sha256_block_data_order + adr r3,. #endif #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) ldr r12,.LOPENSSL_armcap ldr r12,[r3,r12] @ OPENSSL_armcap_P tst r12,#ARMV8_SHA256 bne .LARMv8 tst r12,#ARMV7_NEON bne .LNEON #endif add $len,$inp,$len,lsl#6 @ len to point at the end of inp stmdb sp!,{$ctx,$inp,$len,r4-r11,lr} ldmia $ctx,{$A,$B,$C,$D,$E,$F,$G,$H} sub $Ktbl,r3,#256+32 @ K256 sub sp,sp,#16*4 @ alloca(X[16]) .Loop: # if __ARM_ARCH__>=7 ldr $t1,[$inp],#4 # else ldrb $t1,[$inp,#3] # endif eor $t3,$B,$C @ magic eor $t2,$t2,$t2 ___ for($i=0;$i<16;$i++) { &BODY_00_15($i,@V); unshift(@V,pop(@V)); } $code.=".Lrounds_16_xx:\n"; for (;$i<32;$i++) { &BODY_16_XX($i,@V); unshift(@V,pop(@V)); } $code.=<<___; #if __ARM_ARCH__>=7 ite eq @ Thumb2 thing, sanity check in ARM #endif ldreq $t3,[sp,#16*4] @ pull ctx bne .Lrounds_16_xx add $A,$A,$t2 @ h+=Maj(a,b,c) from the past ldr $t0,[$t3,#0] ldr $t1,[$t3,#4] ldr $t2,[$t3,#8] add $A,$A,$t0 ldr $t0,[$t3,#12] add $B,$B,$t1 ldr $t1,[$t3,#16] add $C,$C,$t2 ldr $t2,[$t3,#20] add $D,$D,$t0 ldr $t0,[$t3,#24] add $E,$E,$t1 ldr $t1,[$t3,#28] add $F,$F,$t2 ldr $inp,[sp,#17*4] @ pull inp ldr $t2,[sp,#18*4] @ pull inp+len add $G,$G,$t0 add $H,$H,$t1 stmia $t3,{$A,$B,$C,$D,$E,$F,$G,$H} cmp $inp,$t2 sub $Ktbl,$Ktbl,#256 @ rewind Ktbl bne .Loop add sp,sp,#`16+3`*4 @ destroy frame #if __ARM_ARCH__>=5 ldmia sp!,{r4-r11,pc} #else ldmia sp!,{r4-r11,lr} tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) #endif .size sha256_block_data_order,.-sha256_block_data_order ___ ###################################################################### # NEON stuff # {{{ my @X=map("q$_",(0..3)); my ($T0,$T1,$T2,$T3,$T4,$T5)=("q8","q9","q10","q11","d24","d25"); my $Xfer=$t4; my $j=0; sub Dlo() { shift=~m|q([1]?[0-9])|?"d".($1*2):""; } sub Dhi() { shift=~m|q([1]?[0-9])|?"d".($1*2+1):""; } sub AUTOLOAD() # thunk [simplified] x86-style perlasm { my $opcode = $AUTOLOAD; $opcode =~ s/.*:://; $opcode =~ s/_/\./; my $arg = pop; $arg = "#$arg" if ($arg*1 eq $arg); $code .= "\t$opcode\t".join(',',@_,$arg)."\n"; } sub Xupdate() { use integer; my $body = shift; my @insns = (&$body,&$body,&$body,&$body); my ($a,$b,$c,$d,$e,$f,$g,$h); &vext_8 ($T0,@X[0],@X[1],4); # X[1..4] eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); &vext_8 ($T1,@X[2],@X[3],4); # X[9..12] eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T2,$T0,$sigma0[0]); eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 (@X[0],@X[0],$T1); # X[0..3] += X[9..12] eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T1,$T0,$sigma0[2]); eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T2,$T0,32-$sigma0[0]); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T3,$T0,$sigma0[1]); eval(shift(@insns)); eval(shift(@insns)); &veor ($T1,$T1,$T2); eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T3,$T0,32-$sigma0[1]); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T4,&Dhi(@X[3]),$sigma1[0]); eval(shift(@insns)); eval(shift(@insns)); &veor ($T1,$T1,$T3); # sigma0(X[1..4]) eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T4,&Dhi(@X[3]),32-$sigma1[0]); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T5,&Dhi(@X[3]),$sigma1[2]); eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 (@X[0],@X[0],$T1); # X[0..3] += sigma0(X[1..4]) eval(shift(@insns)); eval(shift(@insns)); &veor ($T5,$T5,$T4); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T4,&Dhi(@X[3]),$sigma1[1]); eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T4,&Dhi(@X[3]),32-$sigma1[1]); eval(shift(@insns)); eval(shift(@insns)); &veor ($T5,$T5,$T4); # sigma1(X[14..15]) eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 (&Dlo(@X[0]),&Dlo(@X[0]),$T5);# X[0..1] += sigma1(X[14..15]) eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T4,&Dlo(@X[0]),$sigma1[0]); eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T4,&Dlo(@X[0]),32-$sigma1[0]); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T5,&Dlo(@X[0]),$sigma1[2]); eval(shift(@insns)); eval(shift(@insns)); &veor ($T5,$T5,$T4); eval(shift(@insns)); eval(shift(@insns)); &vshr_u32 ($T4,&Dlo(@X[0]),$sigma1[1]); eval(shift(@insns)); eval(shift(@insns)); &vld1_32 ("{$T0}","[$Ktbl,:128]!"); eval(shift(@insns)); eval(shift(@insns)); &vsli_32 ($T4,&Dlo(@X[0]),32-$sigma1[1]); eval(shift(@insns)); eval(shift(@insns)); &veor ($T5,$T5,$T4); # sigma1(X[16..17]) eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 (&Dhi(@X[0]),&Dhi(@X[0]),$T5);# X[2..3] += sigma1(X[16..17]) eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 ($T0,$T0,@X[0]); while($#insns>=2) { eval(shift(@insns)); } &vst1_32 ("{$T0}","[$Xfer,:128]!"); eval(shift(@insns)); eval(shift(@insns)); push(@X,shift(@X)); # "rotate" X[] } sub Xpreload() { use integer; my $body = shift; my @insns = (&$body,&$body,&$body,&$body); my ($a,$b,$c,$d,$e,$f,$g,$h); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); &vld1_32 ("{$T0}","[$Ktbl,:128]!"); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); &vrev32_8 (@X[0],@X[0]); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); eval(shift(@insns)); &vadd_i32 ($T0,$T0,@X[0]); foreach (@insns) { eval; } # remaining instructions &vst1_32 ("{$T0}","[$Xfer,:128]!"); push(@X,shift(@X)); # "rotate" X[] } sub body_00_15 () { ( '($a,$b,$c,$d,$e,$f,$g,$h)=@V;'. '&add ($h,$h,$t1)', # h+=X[i]+K[i] '&eor ($t1,$f,$g)', '&eor ($t0,$e,$e,"ror#".($Sigma1[1]-$Sigma1[0]))', '&add ($a,$a,$t2)', # h+=Maj(a,b,c) from the past '&and ($t1,$t1,$e)', '&eor ($t2,$t0,$e,"ror#".($Sigma1[2]-$Sigma1[0]))', # Sigma1(e) '&eor ($t0,$a,$a,"ror#".($Sigma0[1]-$Sigma0[0]))', '&eor ($t1,$t1,$g)', # Ch(e,f,g) '&add ($h,$h,$t2,"ror#$Sigma1[0]")', # h+=Sigma1(e) '&eor ($t2,$a,$b)', # a^b, b^c in next round '&eor ($t0,$t0,$a,"ror#".($Sigma0[2]-$Sigma0[0]))', # Sigma0(a) '&add ($h,$h,$t1)', # h+=Ch(e,f,g) '&ldr ($t1,sprintf "[sp,#%d]",4*(($j+1)&15)) if (($j&15)!=15);'. '&ldr ($t1,"[$Ktbl]") if ($j==15);'. '&ldr ($t1,"[sp,#64]") if ($j==31)', '&and ($t3,$t3,$t2)', # (b^c)&=(a^b) '&add ($d,$d,$h)', # d+=h '&add ($h,$h,$t0,"ror#$Sigma0[0]");'. # h+=Sigma0(a) '&eor ($t3,$t3,$b)', # Maj(a,b,c) '$j++; unshift(@V,pop(@V)); ($t2,$t3)=($t3,$t2);' ) } $code.=<<___; #if __ARM_MAX_ARCH__>=7 .arch armv7-a .fpu neon .global sha256_block_data_order_neon .type sha256_block_data_order_neon,%function .align 4 sha256_block_data_order_neon: .LNEON: stmdb sp!,{r4-r12,lr} sub $H,sp,#16*4+16 adr $Ktbl,K256 bic $H,$H,#15 @ align for 128-bit stores mov $t2,sp mov sp,$H @ alloca add $len,$inp,$len,lsl#6 @ len to point at the end of inp vld1.8 {@X[0]},[$inp]! vld1.8 {@X[1]},[$inp]! vld1.8 {@X[2]},[$inp]! vld1.8 {@X[3]},[$inp]! vld1.32 {$T0},[$Ktbl,:128]! vld1.32 {$T1},[$Ktbl,:128]! vld1.32 {$T2},[$Ktbl,:128]! vld1.32 {$T3},[$Ktbl,:128]! vrev32.8 @X[0],@X[0] @ yes, even on str $ctx,[sp,#64] vrev32.8 @X[1],@X[1] @ big-endian str $inp,[sp,#68] mov $Xfer,sp vrev32.8 @X[2],@X[2] str $len,[sp,#72] vrev32.8 @X[3],@X[3] str $t2,[sp,#76] @ save original sp vadd.i32 $T0,$T0,@X[0] vadd.i32 $T1,$T1,@X[1] vst1.32 {$T0},[$Xfer,:128]! vadd.i32 $T2,$T2,@X[2] vst1.32 {$T1},[$Xfer,:128]! vadd.i32 $T3,$T3,@X[3] vst1.32 {$T2},[$Xfer,:128]! vst1.32 {$T3},[$Xfer,:128]! ldmia $ctx,{$A-$H} sub $Xfer,$Xfer,#64 ldr $t1,[sp,#0] eor $t2,$t2,$t2 eor $t3,$B,$C b .L_00_48 .align 4 .L_00_48: ___ &Xupdate(\&body_00_15); &Xupdate(\&body_00_15); &Xupdate(\&body_00_15); &Xupdate(\&body_00_15); $code.=<<___; teq $t1,#0 @ check for K256 terminator ldr $t1,[sp,#0] sub $Xfer,$Xfer,#64 bne .L_00_48 ldr $inp,[sp,#68] ldr $t0,[sp,#72] sub $Ktbl,$Ktbl,#256 @ rewind $Ktbl teq $inp,$t0 it eq subeq $inp,$inp,#64 @ avoid SEGV vld1.8 {@X[0]},[$inp]! @ load next input block vld1.8 {@X[1]},[$inp]! vld1.8 {@X[2]},[$inp]! vld1.8 {@X[3]},[$inp]! it ne strne $inp,[sp,#68] mov $Xfer,sp ___ &Xpreload(\&body_00_15); &Xpreload(\&body_00_15); &Xpreload(\&body_00_15); &Xpreload(\&body_00_15); $code.=<<___; ldr $t0,[$t1,#0] add $A,$A,$t2 @ h+=Maj(a,b,c) from the past ldr $t2,[$t1,#4] ldr $t3,[$t1,#8] ldr $t4,[$t1,#12] add $A,$A,$t0 @ accumulate ldr $t0,[$t1,#16] add $B,$B,$t2 ldr $t2,[$t1,#20] add $C,$C,$t3 ldr $t3,[$t1,#24] add $D,$D,$t4 ldr $t4,[$t1,#28] add $E,$E,$t0 str $A,[$t1],#4 add $F,$F,$t2 str $B,[$t1],#4 add $G,$G,$t3 str $C,[$t1],#4 add $H,$H,$t4 str $D,[$t1],#4 stmia $t1,{$E-$H} ittte ne movne $Xfer,sp ldrne $t1,[sp,#0] eorne $t2,$t2,$t2 ldreq sp,[sp,#76] @ restore original sp itt ne eorne $t3,$B,$C bne .L_00_48 ldmia sp!,{r4-r12,pc} .size sha256_block_data_order_neon,.-sha256_block_data_order_neon #endif ___ }}} ###################################################################### # ARMv8 stuff # {{{ my ($ABCD,$EFGH,$abcd)=map("q$_",(0..2)); my @MSG=map("q$_",(8..11)); my ($W0,$W1,$ABCD_SAVE,$EFGH_SAVE)=map("q$_",(12..15)); my $Ktbl="r3"; $code.=<<___; #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) # ifdef __thumb2__ # define INST(a,b,c,d) .byte c,d|0xc,a,b # else # define INST(a,b,c,d) .byte a,b,c,d # endif .type sha256_block_data_order_armv8,%function .align 5 sha256_block_data_order_armv8: .LARMv8: vld1.32 {$ABCD,$EFGH},[$ctx] # ifdef __thumb2__ adr $Ktbl,.LARMv8 sub $Ktbl,$Ktbl,#.LARMv8-K256 # else adrl $Ktbl,K256 # endif add $len,$inp,$len,lsl#6 @ len to point at the end of inp .Loop_v8: vld1.8 {@MSG[0]-@MSG[1]},[$inp]! vld1.8 {@MSG[2]-@MSG[3]},[$inp]! vld1.32 {$W0},[$Ktbl]! vrev32.8 @MSG[0],@MSG[0] vrev32.8 @MSG[1],@MSG[1] vrev32.8 @MSG[2],@MSG[2] vrev32.8 @MSG[3],@MSG[3] vmov $ABCD_SAVE,$ABCD @ offload vmov $EFGH_SAVE,$EFGH teq $inp,$len ___ for($i=0;$i<12;$i++) { $code.=<<___; vld1.32 {$W1},[$Ktbl]! vadd.i32 $W0,$W0,@MSG[0] sha256su0 @MSG[0],@MSG[1] vmov $abcd,$ABCD sha256h $ABCD,$EFGH,$W0 sha256h2 $EFGH,$abcd,$W0 sha256su1 @MSG[0],@MSG[2],@MSG[3] ___ ($W0,$W1)=($W1,$W0); push(@MSG,shift(@MSG)); } $code.=<<___; vld1.32 {$W1},[$Ktbl]! vadd.i32 $W0,$W0,@MSG[0] vmov $abcd,$ABCD sha256h $ABCD,$EFGH,$W0 sha256h2 $EFGH,$abcd,$W0 vld1.32 {$W0},[$Ktbl]! vadd.i32 $W1,$W1,@MSG[1] vmov $abcd,$ABCD sha256h $ABCD,$EFGH,$W1 sha256h2 $EFGH,$abcd,$W1 vld1.32 {$W1},[$Ktbl] vadd.i32 $W0,$W0,@MSG[2] sub $Ktbl,$Ktbl,#256-16 @ rewind vmov $abcd,$ABCD sha256h $ABCD,$EFGH,$W0 sha256h2 $EFGH,$abcd,$W0 vadd.i32 $W1,$W1,@MSG[3] vmov $abcd,$ABCD sha256h $ABCD,$EFGH,$W1 sha256h2 $EFGH,$abcd,$W1 vadd.i32 $ABCD,$ABCD,$ABCD_SAVE vadd.i32 $EFGH,$EFGH,$EFGH_SAVE it ne bne .Loop_v8 vst1.32 {$ABCD,$EFGH},[$ctx] ret @ bx lr .size sha256_block_data_order_armv8,.-sha256_block_data_order_armv8 #endif ___ }}} $code.=<<___; .asciz "SHA256 block transform for ARMv4/NEON/ARMv8, CRYPTOGAMS by " .align 2 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) .comm OPENSSL_armcap_P,4,4 #endif ___ open SELF,$0; while() { next if (/^#!/); last if (!s/^#/@/ and !/^$/); print; } close SELF; { my %opcode = ( "sha256h" => 0xf3000c40, "sha256h2" => 0xf3100c40, "sha256su0" => 0xf3ba03c0, "sha256su1" => 0xf3200c40 ); sub unsha256 { my ($mnemonic,$arg)=@_; if ($arg =~ m/q([0-9]+)(?:,\s*q([0-9]+))?,\s*q([0-9]+)/o) { my $word = $opcode{$mnemonic}|(($1&7)<<13)|(($1&8)<<19) |(($2&7)<<17)|(($2&8)<<4) |(($3&7)<<1) |(($3&8)<<2); # since ARMv7 instructions are always encoded little-endian. # correct solution is to use .inst directive, but older # assemblers don't implement it:-( sprintf "INST(0x%02x,0x%02x,0x%02x,0x%02x)\t@ %s %s", $word&0xff,($word>>8)&0xff, ($word>>16)&0xff,($word>>24)&0xff, $mnemonic,$arg; } } } foreach (split($/,$code)) { s/\`([^\`]*)\`/eval $1/geo; s/\b(sha256\w+)\s+(q.*)/unsha256($1,$2)/geo; s/\bret\b/bx lr/go or s/\bbx\s+lr\b/.word\t0xe12fff1e/go; # make it possible to compile with -march=armv4 print $_,"\n"; } close STDOUT; # enforce flush diff --git a/crypto/symhacks.h b/crypto/symhacks.h index 239fa4fb1b77..3001957988f7 100644 --- a/crypto/symhacks.h +++ b/crypto/symhacks.h @@ -1,516 +1,518 @@ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_SYMHACKS_H # define HEADER_SYMHACKS_H # include /* * Hacks to solve the problem with linkers incapable of handling very long * symbol names. In the case of VMS, the limit is 31 characters on VMS for * VAX. */ /* * Note that this affects util/libeay.num and util/ssleay.num... you may * change those manually, but that's not recommended, as those files are * controlled centrally and updated on Unix, and the central definition may * disagree with yours, which in turn may come with shareable library * incompatibilities. */ # ifdef OPENSSL_SYS_VMS /* Hack a long name in crypto/ex_data.c */ # undef CRYPTO_get_ex_data_implementation # define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl # undef CRYPTO_set_ex_data_implementation # define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl /* Hack a long name in crypto/asn1/a_mbstr.c */ # undef ASN1_STRING_set_default_mask_asc # define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ # undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO # define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF # undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO # define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF # endif # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ # undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO # define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF # undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO # define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF # endif # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ # undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION # define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC # undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION # define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC # endif /* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ # undef PEM_read_NETSCAPE_CERT_SEQUENCE # define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ # undef PEM_write_NETSCAPE_CERT_SEQUENCE # define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ # undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE # define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ # undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE # define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ # undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE # define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ /* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ # undef PEM_read_PKCS8_PRIV_KEY_INFO # define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO # undef PEM_write_PKCS8_PRIV_KEY_INFO # define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO # undef PEM_read_bio_PKCS8_PRIV_KEY_INFO # define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO # undef PEM_write_bio_PKCS8_PRIV_KEY_INFO # define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO # undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO # define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO /* Hack other PEM names */ # undef PEM_write_bio_PKCS8PrivateKey_nid # define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid /* Hack some long X509 names */ # undef X509_REVOKED_get_ext_by_critical # define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic # undef X509_policy_tree_get0_user_policies # define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies # undef X509_policy_node_get0_qualifiers # define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers # undef X509_STORE_CTX_get_explicit_policy # define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy # undef X509_STORE_CTX_get0_current_issuer # define X509_STORE_CTX_get0_current_issuer X509_STORE_CTX_get0_cur_issuer /* Hack some long CRYPTO names */ # undef CRYPTO_set_dynlock_destroy_callback # define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb # undef CRYPTO_set_dynlock_create_callback # define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb # undef CRYPTO_set_dynlock_lock_callback # define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb # undef CRYPTO_get_dynlock_lock_callback # define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb # undef CRYPTO_get_dynlock_destroy_callback # define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb # undef CRYPTO_get_dynlock_create_callback # define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb # undef CRYPTO_set_locked_mem_ex_functions # define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs # undef CRYPTO_get_locked_mem_ex_functions # define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs /* Hack some long SSL/TLS names */ # undef SSL_CTX_set_default_verify_paths # define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths # undef SSL_get_ex_data_X509_STORE_CTX_idx # define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx # undef SSL_add_file_cert_subjects_to_stack # define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk # undef SSL_add_dir_cert_subjects_to_stack # define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk # undef SSL_CTX_use_certificate_chain_file # define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file # undef SSL_CTX_set_cert_verify_callback # define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb # undef SSL_CTX_set_default_passwd_cb_userdata # define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud # undef SSL_COMP_get_compression_methods # define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods # undef SSL_COMP_set0_compression_methods # define SSL_COMP_set0_compression_methods SSL_COMP_set0_compress_methods # undef SSL_COMP_free_compression_methods # define SSL_COMP_free_compression_methods SSL_COMP_free_compress_methods # undef ssl_add_clienthello_renegotiate_ext # define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext # undef ssl_add_serverhello_renegotiate_ext # define ssl_add_serverhello_renegotiate_ext ssl_add_serverhello_reneg_ext # undef ssl_parse_clienthello_renegotiate_ext # define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_ext # undef ssl_parse_serverhello_renegotiate_ext # define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_ext # undef SSL_srp_server_param_with_username # define SSL_srp_server_param_with_username SSL_srp_server_param_with_un # undef SSL_CTX_set_srp_client_pwd_callback # define SSL_CTX_set_srp_client_pwd_callback SSL_CTX_set_srp_client_pwd_cb # undef SSL_CTX_set_srp_verify_param_callback # define SSL_CTX_set_srp_verify_param_callback SSL_CTX_set_srp_vfy_param_cb # undef SSL_CTX_set_srp_username_callback # define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb # undef ssl_add_clienthello_use_srtp_ext # define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext # undef ssl_add_serverhello_use_srtp_ext # define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext # undef ssl_parse_clienthello_use_srtp_ext # define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext # undef ssl_parse_serverhello_use_srtp_ext # define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext # undef SSL_CTX_set_next_protos_advertised_cb # define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb # undef SSL_CTX_set_next_proto_select_cb # define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb # undef tls1_send_server_supplemental_data # define tls1_send_server_supplemental_data tls1_send_server_suppl_data # undef tls1_send_client_supplemental_data # define tls1_send_client_supplemental_data tls1_send_client_suppl_data # undef tls1_get_server_supplemental_data # define tls1_get_server_supplemental_data tls1_get_server_suppl_data # undef tls1_get_client_supplemental_data # define tls1_get_client_supplemental_data tls1_get_client_suppl_data # undef ssl3_cbc_record_digest_supported # define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support # undef ssl_check_clienthello_tlsext_late # define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late # undef ssl_check_clienthello_tlsext_early # define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early /* Hack some RSA long names */ # undef RSA_padding_check_PKCS1_OAEP_mgf1 # define RSA_padding_check_PKCS1_OAEP_mgf1 RSA_pad_check_PKCS1_OAEP_mgf1 /* Hack some ENGINE long names */ # undef ENGINE_get_default_BN_mod_exp_crt # define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt # undef ENGINE_set_default_BN_mod_exp_crt # define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt # undef ENGINE_set_load_privkey_function # define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn # undef ENGINE_get_load_privkey_function # define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn # undef ENGINE_unregister_pkey_asn1_meths # define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths # undef ENGINE_register_all_pkey_asn1_meths # define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths # undef ENGINE_set_default_pkey_asn1_meths # define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths # undef ENGINE_get_pkey_asn1_meth_engine # define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng # undef ENGINE_set_load_ssl_client_cert_function # define ENGINE_set_load_ssl_client_cert_function \ ENGINE_set_ld_ssl_clnt_cert_fn # undef ENGINE_get_ssl_client_cert_function # define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn /* Hack some long OCSP names */ # undef OCSP_REQUEST_get_ext_by_critical # define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit # undef OCSP_BASICRESP_get_ext_by_critical # define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit # undef OCSP_SINGLERESP_get_ext_by_critical # define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit /* Hack some long DES names */ # undef _ossl_old_des_ede3_cfb64_encrypt # define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt # undef _ossl_old_des_ede3_ofb64_encrypt # define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt /* Hack some long EVP names */ # undef OPENSSL_add_all_algorithms_noconf # define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf # undef OPENSSL_add_all_algorithms_conf # define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf # undef EVP_PKEY_meth_set_verify_recover # define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover +# undef EVP_PKEY_meth_get_verify_recover +# define EVP_PKEY_meth_get_verify_recover EVP_PKEY_meth_get_vrfy_recover /* Hack some long EC names */ # undef EC_GROUP_set_point_conversion_form # define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form # undef EC_GROUP_get_point_conversion_form # define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form # undef EC_GROUP_clear_free_all_extra_data # define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data # undef EC_KEY_set_public_key_affine_coordinates # define EC_KEY_set_public_key_affine_coordinates \ EC_KEY_set_pub_key_aff_coords # undef EC_POINT_set_Jprojective_coordinates_GFp # define EC_POINT_set_Jprojective_coordinates_GFp \ EC_POINT_set_Jproj_coords_GFp # undef EC_POINT_get_Jprojective_coordinates_GFp # define EC_POINT_get_Jprojective_coordinates_GFp \ EC_POINT_get_Jproj_coords_GFp # undef EC_POINT_set_affine_coordinates_GFp # define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp # undef EC_POINT_get_affine_coordinates_GFp # define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp # undef EC_POINT_set_compressed_coordinates_GFp # define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp # undef EC_POINT_set_affine_coordinates_GF2m # define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m # undef EC_POINT_get_affine_coordinates_GF2m # define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m # undef EC_POINT_set_compressed_coordinates_GF2m # define EC_POINT_set_compressed_coordinates_GF2m \ EC_POINT_set_compr_coords_GF2m # undef ec_GF2m_simple_group_clear_finish # define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish # undef ec_GF2m_simple_group_check_discriminant # define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim # undef ec_GF2m_simple_point_clear_finish # define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish # undef ec_GF2m_simple_point_set_to_infinity # define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf # undef ec_GF2m_simple_points_make_affine # define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine # undef ec_GF2m_simple_point_set_affine_coordinates # define ec_GF2m_simple_point_set_affine_coordinates \ ec_GF2m_smp_pt_set_af_coords # undef ec_GF2m_simple_point_get_affine_coordinates # define ec_GF2m_simple_point_get_affine_coordinates \ ec_GF2m_smp_pt_get_af_coords # undef ec_GF2m_simple_set_compressed_coordinates # define ec_GF2m_simple_set_compressed_coordinates \ ec_GF2m_smp_set_compr_coords # undef ec_GFp_simple_group_set_curve_GFp # define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp # undef ec_GFp_simple_group_get_curve_GFp # define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp # undef ec_GFp_simple_group_clear_finish # define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish # undef ec_GFp_simple_group_set_generator # define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator # undef ec_GFp_simple_group_get0_generator # define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator # undef ec_GFp_simple_group_get_cofactor # define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor # undef ec_GFp_simple_point_clear_finish # define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish # undef ec_GFp_simple_point_set_to_infinity # define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf # undef ec_GFp_simple_points_make_affine # define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine # undef ec_GFp_simple_set_Jprojective_coordinates_GFp # define ec_GFp_simple_set_Jprojective_coordinates_GFp \ ec_GFp_smp_set_Jproj_coords_GFp # undef ec_GFp_simple_get_Jprojective_coordinates_GFp # define ec_GFp_simple_get_Jprojective_coordinates_GFp \ ec_GFp_smp_get_Jproj_coords_GFp # undef ec_GFp_simple_point_set_affine_coordinates_GFp # define ec_GFp_simple_point_set_affine_coordinates_GFp \ ec_GFp_smp_pt_set_af_coords_GFp # undef ec_GFp_simple_point_get_affine_coordinates_GFp # define ec_GFp_simple_point_get_affine_coordinates_GFp \ ec_GFp_smp_pt_get_af_coords_GFp # undef ec_GFp_simple_set_compressed_coordinates_GFp # define ec_GFp_simple_set_compressed_coordinates_GFp \ ec_GFp_smp_set_compr_coords_GFp # undef ec_GFp_simple_point_set_affine_coordinates # define ec_GFp_simple_point_set_affine_coordinates \ ec_GFp_smp_pt_set_af_coords # undef ec_GFp_simple_point_get_affine_coordinates # define ec_GFp_simple_point_get_affine_coordinates \ ec_GFp_smp_pt_get_af_coords # undef ec_GFp_simple_set_compressed_coordinates # define ec_GFp_simple_set_compressed_coordinates \ ec_GFp_smp_set_compr_coords # undef ec_GFp_simple_group_check_discriminant # define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim /* Hack som long STORE names */ # undef STORE_method_set_initialise_function # define STORE_method_set_initialise_function STORE_meth_set_initialise_fn # undef STORE_method_set_cleanup_function # define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn # undef STORE_method_set_generate_function # define STORE_method_set_generate_function STORE_meth_set_generate_fn # undef STORE_method_set_modify_function # define STORE_method_set_modify_function STORE_meth_set_modify_fn # undef STORE_method_set_revoke_function # define STORE_method_set_revoke_function STORE_meth_set_revoke_fn # undef STORE_method_set_delete_function # define STORE_method_set_delete_function STORE_meth_set_delete_fn # undef STORE_method_set_list_start_function # define STORE_method_set_list_start_function STORE_meth_set_list_start_fn # undef STORE_method_set_list_next_function # define STORE_method_set_list_next_function STORE_meth_set_list_next_fn # undef STORE_method_set_list_end_function # define STORE_method_set_list_end_function STORE_meth_set_list_end_fn # undef STORE_method_set_update_store_function # define STORE_method_set_update_store_function STORE_meth_set_update_store_fn # undef STORE_method_set_lock_store_function # define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn # undef STORE_method_set_unlock_store_function # define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn # undef STORE_method_get_initialise_function # define STORE_method_get_initialise_function STORE_meth_get_initialise_fn # undef STORE_method_get_cleanup_function # define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn # undef STORE_method_get_generate_function # define STORE_method_get_generate_function STORE_meth_get_generate_fn # undef STORE_method_get_modify_function # define STORE_method_get_modify_function STORE_meth_get_modify_fn # undef STORE_method_get_revoke_function # define STORE_method_get_revoke_function STORE_meth_get_revoke_fn # undef STORE_method_get_delete_function # define STORE_method_get_delete_function STORE_meth_get_delete_fn # undef STORE_method_get_list_start_function # define STORE_method_get_list_start_function STORE_meth_get_list_start_fn # undef STORE_method_get_list_next_function # define STORE_method_get_list_next_function STORE_meth_get_list_next_fn # undef STORE_method_get_list_end_function # define STORE_method_get_list_end_function STORE_meth_get_list_end_fn # undef STORE_method_get_update_store_function # define STORE_method_get_update_store_function STORE_meth_get_update_store_fn # undef STORE_method_get_lock_store_function # define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn # undef STORE_method_get_unlock_store_function # define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn /* Hack some long TS names */ # undef TS_RESP_CTX_set_status_info_cond # define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond # undef TS_RESP_CTX_set_clock_precision_digits # define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_digits # undef TS_CONF_set_clock_precision_digits # define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits /* Hack some long CMS names */ # undef CMS_RecipientInfo_ktri_get0_algs # define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs # undef CMS_RecipientInfo_ktri_get0_signer_id # define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id # undef CMS_OtherRevocationInfoFormat_it # define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it # undef CMS_KeyAgreeRecipientIdentifier_it # define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it # undef CMS_OriginatorIdentifierOrKey_it # define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it # undef cms_SignerIdentifier_get0_signer_id # define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id # undef CMS_RecipientInfo_kari_get0_orig_id # define CMS_RecipientInfo_kari_get0_orig_id CMS_RecipInfo_kari_get0_orig_id # undef CMS_RecipientInfo_kari_get0_reks # define CMS_RecipientInfo_kari_get0_reks CMS_RecipInfo_kari_get0_reks # undef CMS_RecipientEncryptedKey_cert_cmp # define CMS_RecipientEncryptedKey_cert_cmp CMS_RecipEncryptedKey_cert_cmp # undef CMS_RecipientInfo_kari_set0_pkey # define CMS_RecipientInfo_kari_set0_pkey CMS_RecipInfo_kari_set0_pkey # undef CMS_RecipientEncryptedKey_get0_id # define CMS_RecipientEncryptedKey_get0_id CMS_RecipEncryptedKey_get0_id # undef CMS_RecipientInfo_kari_orig_id_cmp # define CMS_RecipientInfo_kari_orig_id_cmp CMS_RecipInfo_kari_orig_id_cmp /* Hack some long DTLS1 names */ # undef dtls1_retransmit_buffered_messages # define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs /* Hack some long SRP names */ # undef SRP_generate_server_master_secret # define SRP_generate_server_master_secret SRP_gen_server_master_secret # undef SRP_generate_client_master_secret # define SRP_generate_client_master_secret SRP_gen_client_master_secret /* Hack some long UI names */ # undef UI_method_get_prompt_constructor # define UI_method_get_prompt_constructor UI_method_get_prompt_constructr # undef UI_method_set_prompt_constructor # define UI_method_set_prompt_constructor UI_method_set_prompt_constructr # endif /* defined OPENSSL_SYS_VMS */ /* Case insensitive linking causes problems.... */ # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) # undef ERR_load_CRYPTO_strings # define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings # undef OCSP_crlID_new # define OCSP_crlID_new OCSP_crlID2_new # undef d2i_ECPARAMETERS # define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS # undef i2d_ECPARAMETERS # define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS # undef d2i_ECPKPARAMETERS # define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS # undef i2d_ECPKPARAMETERS # define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS /* * These functions do not seem to exist! However, I'm paranoid... Original * command in x509v3.h: These functions are being redefined in another * directory, and clash when the linker is case-insensitive, so let's hide * them a little, by giving them an extra 'o' at the beginning of the name... */ # undef X509v3_cleanup_extensions # define X509v3_cleanup_extensions oX509v3_cleanup_extensions # undef X509v3_add_extension # define X509v3_add_extension oX509v3_add_extension # undef X509v3_add_netscape_extensions # define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions # undef X509v3_add_standard_extensions # define X509v3_add_standard_extensions oX509v3_add_standard_extensions /* This one clashes with CMS_data_create */ # undef cms_Data_create # define cms_Data_create priv_cms_Data_create # endif #endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/crypto/x509v3/v3_lib.c b/crypto/x509v3/v3_lib.c index 8350429aafbe..1112802483a1 100644 --- a/crypto/x509v3/v3_lib.c +++ b/crypto/x509v3/v3_lib.c @@ -1,363 +1,371 @@ /* v3_lib.c */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 1999. */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* X509 v3 extension utilities */ #include #include "cryptlib.h" #include #include #include "ext_dat.h" static STACK_OF(X509V3_EXT_METHOD) *ext_list = NULL; static int ext_cmp(const X509V3_EXT_METHOD *const *a, const X509V3_EXT_METHOD *const *b); static void ext_list_free(X509V3_EXT_METHOD *ext); int X509V3_EXT_add(X509V3_EXT_METHOD *ext) { if (!ext_list && !(ext_list = sk_X509V3_EXT_METHOD_new(ext_cmp))) { X509V3err(X509V3_F_X509V3_EXT_ADD, ERR_R_MALLOC_FAILURE); return 0; } if (!sk_X509V3_EXT_METHOD_push(ext_list, ext)) { X509V3err(X509V3_F_X509V3_EXT_ADD, ERR_R_MALLOC_FAILURE); return 0; } return 1; } static int ext_cmp(const X509V3_EXT_METHOD *const *a, const X509V3_EXT_METHOD *const *b) { return ((*a)->ext_nid - (*b)->ext_nid); } DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_METHOD *, ext); IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_METHOD *, ext); const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) { X509V3_EXT_METHOD tmp; const X509V3_EXT_METHOD *t = &tmp, *const *ret; int idx; if (nid < 0) return NULL; tmp.ext_nid = nid; ret = OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT); if (ret) return *ret; if (!ext_list) return NULL; idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp); if (idx == -1) return NULL; return sk_X509V3_EXT_METHOD_value(ext_list, idx); } const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext) { int nid; if ((nid = OBJ_obj2nid(ext->object)) == NID_undef) return NULL; return X509V3_EXT_get_nid(nid); } int X509V3_EXT_free(int nid, void *ext_data) { const X509V3_EXT_METHOD *ext_method = X509V3_EXT_get_nid(nid); if (ext_method == NULL) { X509V3err(X509V3_F_X509V3_EXT_FREE, X509V3_R_CANNOT_FIND_FREE_FUNCTION); return 0; } if (ext_method->it != NULL) ASN1_item_free(ext_data, ASN1_ITEM_ptr(ext_method->it)); else if (ext_method->ext_free != NULL) ext_method->ext_free(ext_data); else { X509V3err(X509V3_F_X509V3_EXT_FREE, X509V3_R_CANNOT_FIND_FREE_FUNCTION); return 0; } return 1; } int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist) { for (; extlist->ext_nid != -1; extlist++) if (!X509V3_EXT_add(extlist)) return 0; return 1; } int X509V3_EXT_add_alias(int nid_to, int nid_from) { const X509V3_EXT_METHOD *ext; X509V3_EXT_METHOD *tmpext; if (!(ext = X509V3_EXT_get_nid(nid_from))) { X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS, X509V3_R_EXTENSION_NOT_FOUND); return 0; } if (! (tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) { X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS, ERR_R_MALLOC_FAILURE); return 0; } *tmpext = *ext; tmpext->ext_nid = nid_to; tmpext->ext_flags |= X509V3_EXT_DYNAMIC; return X509V3_EXT_add(tmpext); } void X509V3_EXT_cleanup(void) { sk_X509V3_EXT_METHOD_pop_free(ext_list, ext_list_free); ext_list = NULL; } static void ext_list_free(X509V3_EXT_METHOD *ext) { if (ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext); } /* * Legacy function: we don't need to add standard extensions any more because * they are now kept in ext_dat.h. */ int X509V3_add_standard_extensions(void) { return 1; } /* Return an extension internal structure */ void *X509V3_EXT_d2i(X509_EXTENSION *ext) { const X509V3_EXT_METHOD *method; const unsigned char *p; if (!(method = X509V3_EXT_get(ext))) return NULL; p = ext->value->data; if (method->it) return ASN1_item_d2i(NULL, &p, ext->value->length, ASN1_ITEM_ptr(method->it)); return method->d2i(NULL, &p, ext->value->length); } /*- * Get critical flag and decoded version of extension from a NID. * The "idx" variable returns the last found extension and can * be used to retrieve multiple extensions of the same NID. * However multiple extensions with the same NID is usually * due to a badly encoded certificate so if idx is NULL we * choke if multiple extensions exist. * The "crit" variable is set to the critical value. * The return value is the decoded extension or NULL on * error. The actual error can have several different causes, * the value of *crit reflects the cause: * >= 0, extension found but not decoded (reflects critical value). * -1 extension not found. * -2 extension occurs more than once. */ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx) { int lastpos, i; X509_EXTENSION *ex, *found_ex = NULL; if (!x) { if (idx) *idx = -1; if (crit) *crit = -1; return NULL; } if (idx) lastpos = *idx + 1; else lastpos = 0; if (lastpos < 0) lastpos = 0; for (i = lastpos; i < sk_X509_EXTENSION_num(x); i++) { ex = sk_X509_EXTENSION_value(x, i); if (OBJ_obj2nid(ex->object) == nid) { if (idx) { *idx = i; found_ex = ex; break; } else if (found_ex) { /* Found more than one */ if (crit) *crit = -2; return NULL; } found_ex = ex; } } if (found_ex) { /* Found it */ if (crit) *crit = X509_EXTENSION_get_critical(found_ex); return X509V3_EXT_d2i(found_ex); } /* Extension not found */ if (idx) *idx = -1; if (crit) *crit = -1; return NULL; } /* * This function is a general extension append, replace and delete utility. * The precise operation is governed by the 'flags' value. The 'crit' and * 'value' arguments (if relevant) are the extensions internal structure. */ int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags) { - int extidx = -1; - int errcode; - X509_EXTENSION *ext, *extmp; + int errcode, extidx = -1; + X509_EXTENSION *ext = NULL, *extmp; + STACK_OF(X509_EXTENSION) *ret = NULL; unsigned long ext_op = flags & X509V3_ADD_OP_MASK; /* * If appending we don't care if it exists, otherwise look for existing * extension. */ if (ext_op != X509V3_ADD_APPEND) extidx = X509v3_get_ext_by_NID(*x, nid, -1); /* See if extension exists */ if (extidx >= 0) { /* If keep existing, nothing to do */ if (ext_op == X509V3_ADD_KEEP_EXISTING) return 1; /* If default then its an error */ if (ext_op == X509V3_ADD_DEFAULT) { errcode = X509V3_R_EXTENSION_EXISTS; goto err; } /* If delete, just delete it */ if (ext_op == X509V3_ADD_DELETE) { if (!sk_X509_EXTENSION_delete(*x, extidx)) return -1; return 1; } } else { /* * If replace existing or delete, error since extension must exist */ if ((ext_op == X509V3_ADD_REPLACE_EXISTING) || (ext_op == X509V3_ADD_DELETE)) { errcode = X509V3_R_EXTENSION_NOT_FOUND; goto err; } } /* * If we get this far then we have to create an extension: could have * some flags for alternative encoding schemes... */ ext = X509V3_EXT_i2d(nid, crit, value); if (!ext) { X509V3err(X509V3_F_X509V3_ADD1_I2D, X509V3_R_ERROR_CREATING_EXTENSION); return 0; } /* If extension exists replace it.. */ if (extidx >= 0) { extmp = sk_X509_EXTENSION_value(*x, extidx); X509_EXTENSION_free(extmp); if (!sk_X509_EXTENSION_set(*x, extidx, ext)) return -1; return 1; } - if (!*x && !(*x = sk_X509_EXTENSION_new_null())) - return -1; - if (!sk_X509_EXTENSION_push(*x, ext)) - return -1; + if ((ret = *x) == NULL + && (ret = sk_X509_EXTENSION_new_null()) == NULL) + goto m_fail; + if (!sk_X509_EXTENSION_push(ret, ext)) + goto m_fail; + *x = ret; return 1; + m_fail: + if (ret != *x) + sk_X509_EXTENSION_free(ret); + X509_EXTENSION_free(ext); + return -1; + err: if (!(flags & X509V3_ADD_SILENT)) X509V3err(X509V3_F_X509V3_ADD1_I2D, errcode); return 0; } IMPLEMENT_STACK_OF(X509V3_EXT_METHOD) diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c index 0b7c68180e78..87a6ae1da982 100644 --- a/crypto/x509v3/v3_scts.c +++ b/crypto/x509v3/v3_scts.c @@ -1,334 +1,334 @@ /* v3_scts.c */ /* * Written by Rob Stradling (rob@comodo.com) for the OpenSSL project 2014. */ /* ==================================================================== * Copyright (c) 2014 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include "cryptlib.h" #include #include /* Signature and hash algorithms from RFC 5246 */ #define TLSEXT_hash_sha256 4 #define TLSEXT_signature_rsa 1 #define TLSEXT_signature_ecdsa 3 #define n2s(c,s) ((s=(((unsigned int)(c[0]))<< 8)| \ (((unsigned int)(c[1])) )),c+=2) #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) # define SCT_TIMESTAMP unsigned __int64 #elif defined(__arch64__) # define SCT_TIMESTAMP unsigned long #else # define SCT_TIMESTAMP unsigned long long #endif #define n2l8(c,l) (l =((SCT_TIMESTAMP)(*((c)++)))<<56, \ l|=((SCT_TIMESTAMP)(*((c)++)))<<48, \ l|=((SCT_TIMESTAMP)(*((c)++)))<<40, \ l|=((SCT_TIMESTAMP)(*((c)++)))<<32, \ l|=((SCT_TIMESTAMP)(*((c)++)))<<24, \ l|=((SCT_TIMESTAMP)(*((c)++)))<<16, \ l|=((SCT_TIMESTAMP)(*((c)++)))<< 8, \ l|=((SCT_TIMESTAMP)(*((c)++)))) typedef struct SCT_st { /* The encoded SCT */ unsigned char *sct; unsigned short sctlen; /* * Components of the SCT. "logid", "ext" and "sig" point to addresses * inside "sct". */ unsigned char version; unsigned char *logid; unsigned short logidlen; SCT_TIMESTAMP timestamp; unsigned char *ext; unsigned short extlen; unsigned char hash_alg; unsigned char sig_alg; unsigned char *sig; unsigned short siglen; } SCT; DECLARE_STACK_OF(SCT) static void SCT_LIST_free(STACK_OF(SCT) *a); static STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, long length); static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list, BIO *out, int indent); const X509V3_EXT_METHOD v3_ct_scts[] = { {NID_ct_precert_scts, 0, NULL, 0, (X509V3_EXT_FREE)SCT_LIST_free, (X509V3_EXT_D2I)d2i_SCT_LIST, 0, 0, 0, 0, 0, (X509V3_EXT_I2R)i2r_SCT_LIST, 0, NULL}, {NID_ct_cert_scts, 0, NULL, 0, (X509V3_EXT_FREE)SCT_LIST_free, (X509V3_EXT_D2I)d2i_SCT_LIST, 0, 0, 0, 0, 0, (X509V3_EXT_I2R)i2r_SCT_LIST, 0, NULL}, }; static void tls12_signature_print(BIO *out, const unsigned char hash_alg, const unsigned char sig_alg) { int nid = NID_undef; /* RFC6962 only permits two signature algorithms */ if (hash_alg == TLSEXT_hash_sha256) { if (sig_alg == TLSEXT_signature_rsa) nid = NID_sha256WithRSAEncryption; else if (sig_alg == TLSEXT_signature_ecdsa) nid = NID_ecdsa_with_SHA256; } if (nid == NID_undef) BIO_printf(out, "%02X%02X", hash_alg, sig_alg); else BIO_printf(out, "%s", OBJ_nid2ln(nid)); } static void timestamp_print(BIO *out, SCT_TIMESTAMP timestamp) { ASN1_GENERALIZEDTIME *gen; char genstr[20]; gen = ASN1_GENERALIZEDTIME_new(); ASN1_GENERALIZEDTIME_adj(gen, (time_t)0, (int)(timestamp / 86400000), - (timestamp % 86400000) / 1000); + (int)(timestamp % 86400000) / 1000); /* * Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15 * characters long with a final Z. Update it with fractional seconds. */ BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ", ASN1_STRING_data(gen), (unsigned int)(timestamp % 1000)); ASN1_GENERALIZEDTIME_set_string(gen, genstr); ASN1_GENERALIZEDTIME_print(out, gen); ASN1_GENERALIZEDTIME_free(gen); } static void SCT_free(SCT *sct) { if (sct) { if (sct->sct) OPENSSL_free(sct->sct); OPENSSL_free(sct); } } static void SCT_LIST_free(STACK_OF(SCT) *a) { sk_SCT_pop_free(a, SCT_free); } static STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, long length) { ASN1_OCTET_STRING *oct = NULL; STACK_OF(SCT) *sk = NULL; SCT *sct; unsigned char *p, *p2; unsigned short listlen, sctlen = 0, fieldlen; const unsigned char *q = *pp; if (d2i_ASN1_OCTET_STRING(&oct, &q, length) == NULL) return NULL; if (oct->length < 2) goto done; p = oct->data; n2s(p, listlen); if (listlen != oct->length - 2) goto done; if ((sk = sk_SCT_new_null()) == NULL) goto done; while (listlen > 0) { if (listlen < 2) goto err; n2s(p, sctlen); listlen -= 2; if ((sctlen < 1) || (sctlen > listlen)) goto err; listlen -= sctlen; sct = OPENSSL_malloc(sizeof(SCT)); if (!sct) goto err; if (!sk_SCT_push(sk, sct)) { OPENSSL_free(sct); goto err; } sct->sct = OPENSSL_malloc(sctlen); if (!sct->sct) goto err; memcpy(sct->sct, p, sctlen); sct->sctlen = sctlen; p += sctlen; p2 = sct->sct; sct->version = *p2++; if (sct->version == 0) { /* SCT v1 */ /*- * Fixed-length header: * struct { * (1 byte) Version sct_version; * (32 bytes) LogID id; * (8 bytes) uint64 timestamp; * (2 bytes + ?) CtExtensions extensions; */ if (sctlen < 43) goto err; sctlen -= 43; sct->logid = p2; sct->logidlen = 32; p2 += 32; n2l8(p2, sct->timestamp); n2s(p2, fieldlen); if (sctlen < fieldlen) goto err; sct->ext = p2; sct->extlen = fieldlen; p2 += fieldlen; sctlen -= fieldlen; /*- * digitally-signed struct header: * (1 byte) Hash algorithm * (1 byte) Signature algorithm * (2 bytes + ?) Signature */ if (sctlen < 4) goto err; sctlen -= 4; sct->hash_alg = *p2++; sct->sig_alg = *p2++; n2s(p2, fieldlen); if (sctlen != fieldlen) goto err; sct->sig = p2; sct->siglen = fieldlen; } } done: ASN1_OCTET_STRING_free(oct); *pp = q; return sk; err: SCT_LIST_free(sk); sk = NULL; goto done; } static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list, BIO *out, int indent) { SCT *sct; int i; for (i = 0; i < sk_SCT_num(sct_list);) { sct = sk_SCT_value(sct_list, i); BIO_printf(out, "%*sSigned Certificate Timestamp:", indent, ""); BIO_printf(out, "\n%*sVersion : ", indent + 4, ""); if (sct->version == 0) { /* SCT v1 */ BIO_printf(out, "v1(0)"); BIO_printf(out, "\n%*sLog ID : ", indent + 4, ""); BIO_hex_string(out, indent + 16, 16, sct->logid, sct->logidlen); BIO_printf(out, "\n%*sTimestamp : ", indent + 4, ""); timestamp_print(out, sct->timestamp); BIO_printf(out, "\n%*sExtensions: ", indent + 4, ""); if (sct->extlen == 0) BIO_printf(out, "none"); else BIO_hex_string(out, indent + 16, 16, sct->ext, sct->extlen); BIO_printf(out, "\n%*sSignature : ", indent + 4, ""); tls12_signature_print(out, sct->hash_alg, sct->sig_alg); BIO_printf(out, "\n%*s ", indent + 4, ""); BIO_hex_string(out, indent + 16, 16, sct->sig, sct->siglen); } else { /* Unknown version */ BIO_printf(out, "unknown\n%*s", indent + 16, ""); BIO_hex_string(out, indent + 16, 16, sct->sct, sct->sctlen); } if (++i < sk_SCT_num(sct_list)) BIO_printf(out, "\n"); } return 1; } diff --git a/doc/crypto/EVP_EncryptInit.pod b/doc/crypto/EVP_EncryptInit.pod index dc9a2d76c5f6..4cd24d7e0169 100644 --- a/doc/crypto/EVP_EncryptInit.pod +++ b/doc/crypto/EVP_EncryptInit.pod @@ -1,594 +1,594 @@ =pod =head1 NAME EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherUpdate, EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX_cleanup, EVP_EncryptInit, EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherFinal, EVP_get_cipherbyname, EVP_get_cipherbynid, EVP_get_cipherbyobj, EVP_CIPHER_nid, EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, EVP_CIPHER_CTX_set_padding, EVP_enc_null, EVP_des_cbc, EVP_des_ecb, EVP_des_cfb, EVP_des_ofb, EVP_des_ede_cbc, EVP_des_ede, EVP_des_ede_ofb, EVP_des_ede_cfb, EVP_des_ede3_cbc, EVP_des_ede3, EVP_des_ede3_ofb, EVP_des_ede3_cfb, EVP_desx_cbc, EVP_rc4, EVP_rc4_40, EVP_rc4_hmac_md5, EVP_idea_cbc, EVP_idea_ecb, EVP_idea_cfb, EVP_idea_ofb, EVP_rc2_cbc, EVP_rc2_ecb, EVP_rc2_cfb, EVP_rc2_ofb, EVP_rc2_40_cbc, EVP_rc2_64_cbc, EVP_bf_cbc, EVP_bf_ecb, EVP_bf_cfb, EVP_bf_ofb, EVP_cast5_cbc, EVP_cast5_ecb, EVP_cast5_cfb, EVP_cast5_ofb, EVP_rc5_32_12_16_cbc, EVP_rc5_32_12_16_ecb, EVP_rc5_32_12_16_cfb, EVP_rc5_32_12_16_ofb, EVP_aes_128_gcm, EVP_aes_192_gcm, EVP_aes_256_gcm, EVP_aes_128_ccm, EVP_aes_192_ccm, EVP_aes_256_ccm, EVP_aes_128_cbc_hmac_sha1, EVP_aes_256_cbc_hmac_sha1, EVP_aes_128_cbc_hmac_sha256, EVP_aes_256_cbc_hmac_sha256 - EVP cipher routines =head1 SYNOPSIS #include void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv); int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); + int *outl, const unsigned char *in, int inl); int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv); int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, unsigned char *in, int inl); + int *outl, const unsigned char *in, int inl); int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv, int enc); int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv); int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv); int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv, int enc); int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding); int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); const EVP_CIPHER *EVP_get_cipherbyname(const char *name); #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) #define EVP_CIPHER_nid(e) ((e)->nid) #define EVP_CIPHER_block_size(e) ((e)->block_size) #define EVP_CIPHER_key_length(e) ((e)->key_len) #define EVP_CIPHER_iv_length(e) ((e)->iv_len) #define EVP_CIPHER_flags(e) ((e)->flags) #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) int EVP_CIPHER_type(const EVP_CIPHER *ctx); #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); =head1 DESCRIPTION The EVP cipher routines are a high level interface to certain symmetric ciphers. EVP_CIPHER_CTX_init() initializes cipher contex B. EVP_EncryptInit_ex() sets up cipher context B for encryption with cipher B from ENGINE B. B must be initialized before calling this function. B is normally supplied by a function such as EVP_aes_256_cbc(). If B is NULL then the default implementation is used. B is the symmetric key to use and B is the IV to use (if necessary), the actual number of bytes used for the key and IV depends on the cipher. It is possible to set all parameters to NULL except B in an initial call and supply the remaining parameters in subsequent calls, all of which have B set to NULL. This is done when the default cipher parameters are not appropriate. EVP_EncryptUpdate() encrypts B bytes from the buffer B and writes the encrypted version to B. This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the encrypted data: as a result the amount of data written may be anything from zero bytes to (inl + cipher_block_size - 1) so B should contain sufficient room. The actual number of bytes written is placed in B. If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts the "final" data, that is any data that remains in a partial block. It uses L (aka PKCS padding). The encrypted final data is written to B which should have sufficient space for one cipher block. The number of bytes written is placed in B. After this function is called the encryption operation is finished and no further calls to EVP_EncryptUpdate() should be made. If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more data and it will return an error if any data remains in a partial block: that is if the total data length is not a multiple of the block size. EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex() are the corresponding decryption operations. EVP_DecryptFinal() will return an error code if padding is enabled and the final block is not correctly formatted. The parameters and restrictions are identical to the encryption operations except that if padding is enabled the decrypted data buffer B passed to EVP_DecryptUpdate() should have sufficient room for (B + cipher_block_size) bytes unless the cipher block size is 1 in which case B bytes is sufficient. EVP_CipherInit_ex(), EVP_CipherUpdate() and EVP_CipherFinal_ex() are functions that can be used for decryption or encryption. The operation performed depends on the value of the B parameter. It should be set to 1 for encryption, 0 for decryption and -1 to leave the value unchanged (the actual value of 'enc' being supplied in a previous call). EVP_CIPHER_CTX_cleanup() clears all information from a cipher context and free up any allocated memory associate with it. It should be called after all operations using a cipher are complete so sensitive information does not remain in memory. EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and EVP_CipherInit_ex() except the B parameter does not need to be initialized and they always use the default cipher implementation. EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() are identical to EVP_EncryptFinal_ex(), EVP_DecryptFinal_ex() and EVP_CipherFinal_ex(). In previous releases they also cleaned up the B, but this is no longer done and EVP_CIPHER_CTX_clean() must be called to free any context resources. EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() return an EVP_CIPHER structure when passed a cipher name, a NID or an ASN1_OBJECT structure. EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return the NID of a cipher when passed an B or B structure. The actual NID value is an internal value which may not have a corresponding OBJECT IDENTIFIER. EVP_CIPHER_CTX_set_padding() enables or disables padding. By default encryption operations are padded using standard block padding and the padding is checked and removed when decrypting. If the B parameter is zero then no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur. EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key length of a cipher when passed an B or B structure. The constant B is the maximum key length for all ciphers. Note: although EVP_CIPHER_key_length() is fixed for a given cipher, the value of EVP_CIPHER_CTX_key_length() may be different for variable key length ciphers. EVP_CIPHER_CTX_set_key_length() sets the key length of the cipher ctx. If the cipher is a fixed length cipher then attempting to set the key length to any value other than the fixed value is an error. EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV length of a cipher when passed an B or B. It will return zero if the cipher does not use an IV. The constant B is the maximum IV length for all ciphers. EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block size of a cipher when passed an B or B structure. The constant B is also the maximum block length for all ciphers. EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the type of the passed cipher or context. This "type" is the actual NID of the cipher OBJECT IDENTIFIER as such it ignores the cipher parameters and 40 bit RC2 and 128 bit RC2 have the same NID. If the cipher does not have an object identifier or does not have ASN1 support this function will return B. EVP_CIPHER_CTX_cipher() returns the B structure when passed an B structure. EVP_CIPHER_mode() and EVP_CIPHER_CTX_mode() return the block cipher mode: EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE or EVP_CIPH_OFB_MODE. If the cipher is a stream cipher then EVP_CIPH_STREAM_CIPHER is returned. EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based on the passed cipher. This will typically include any parameters and an IV. The cipher IV (if any) must be set when this call is made. This call should be made before the cipher is actually "used" (before any EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function may fail if the cipher does not have any ASN1 support. EVP_CIPHER_asn1_to_param() sets the cipher parameters based on an ASN1 AlgorithmIdentifier "parameter". The precise effect depends on the cipher In the case of RC2, for example, it will set the IV and effective key length. This function should be called after the base cipher type is set but before the key is set. For example EVP_CipherInit() will be called with the IV and key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally EVP_CipherInit() again with all parameters except the key set to NULL. It is possible for this function to fail if the cipher does not have any ASN1 support or the parameters cannot be set (for example the RC2 effective key length is not supported. EVP_CIPHER_CTX_ctrl() allows various cipher specific parameters to be determined and set. =head1 RETURN VALUES EVP_EncryptInit_ex(), EVP_EncryptUpdate() and EVP_EncryptFinal_ex() return 1 for success and 0 for failure. EVP_DecryptInit_ex() and EVP_DecryptUpdate() return 1 for success and 0 for failure. EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success. EVP_CipherInit_ex() and EVP_CipherUpdate() return 1 for success and 0 for failure. EVP_CipherFinal_ex() returns 0 for a decryption failure or 1 for success. EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() return an B structure or NULL on error. EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return a NID. EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block size. EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key length. EVP_CIPHER_CTX_set_padding() always returns 1. EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV length or zero if the cipher does not use an IV. EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the NID of the cipher's OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER. EVP_CIPHER_CTX_cipher() returns an B structure. EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for success or zero for failure. =head1 CIPHER LISTING All algorithms have a fixed key length unless otherwise stated. =over 4 =item EVP_enc_null() Null cipher: does nothing. =item EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void) DES in CBC, ECB, CFB and OFB modes respectively. =item EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void) Two key triple DES in CBC, ECB, CFB and OFB modes respectively. =item EVP_des_ede3_cbc(void), EVP_des_ede3(), EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void) Three key triple DES in CBC, ECB, CFB and OFB modes respectively. =item EVP_desx_cbc(void) DESX algorithm in CBC mode. =item EVP_rc4(void) RC4 stream cipher. This is a variable key length cipher with default key length 128 bits. =item EVP_rc4_40(void) RC4 stream cipher with 40 bit key length. This is obsolete and new code should use EVP_rc4() and the EVP_CIPHER_CTX_set_key_length() function. =item EVP_idea_cbc() EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void) IDEA encryption algorithm in CBC, ECB, CFB and OFB modes respectively. =item EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void) RC2 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length cipher with an additional parameter called "effective key bits" or "effective key length". By default both are set to 128 bits. =item EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void) RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits. These are obsolete and new code should use EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and EVP_CIPHER_CTX_ctrl() to set the key length and effective key length. =item EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void); Blowfish encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length cipher. =item EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void) CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length cipher. =item EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void) RC5 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length cipher with an additional "number of rounds" parameter. By default the key length is set to 128 bits and 12 rounds. =item EVP_aes_128_gcm(void), EVP_aes_192_gcm(void), EVP_aes_256_gcm(void) AES Galois Counter Mode (GCM) for 128, 192 and 256 bit keys respectively. These ciphers require additional control operations to function correctly: see L section below for details. =item EVP_aes_128_ccm(void), EVP_aes_192_ccm(void), EVP_aes_256_ccm(void) AES Counter with CBC-MAC Mode (CCM) for 128, 192 and 256 bit keys respectively. These ciphers require additional control operations to function correctly: see CCM mode section below for details. =back =head1 GCM Mode For GCM mode ciphers the behaviour of the EVP interface is subtly altered and several GCM specific ctrl operations are supported. To specify any additional authenticated data (AAD) a call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with the output parameter B set to B. When decrypting the return value of EVP_DecryptFinal() or EVP_CipherFinal() indicates if the operation was successful. If it does not indicate success the authentication operation has failed and any output data B be used as it is corrupted. The following ctrls are supported in GCM mode: EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, NULL); Sets the GCM IV length: this call can only be made before specifying an IV. If not called a default IV length is used (96 bits for AES). EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, taglen, tag); Writes B bytes of the tag value to the buffer indicated by B. This call can only be made when encrypting data and B all data has been processed (e.g. after an EVP_EncryptFinal() call). EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, taglen, tag); Sets the expected tag to B bytes from B. This call is only legal when decrypting data. =head1 CCM Mode The behaviour of CCM mode ciphers is similar to CCM mode but with a few additional requirements and different ctrl values. Like GCM mode any additional authenticated data (AAD) is passed by calling EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() with the output parameter B set to B. Additionally the total plaintext or ciphertext length B be passed to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() with the output and input parameters (B and B) set to B and the length passed in the B parameter. The following ctrls are supported in CCM mode: EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, taglen, tag); This call is made to set the expected B tag value when decrypting or the length of the tag (with the B parameter set to NULL) when encrypting. The tag length is often referred to as B. If not set a default value is used (12 for AES). EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_L, ivlen, NULL); Sets the CCM B value. If not set a default is used (8 for AES). EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, ivlen, NULL); Sets the CCM nonce (IV) length: this call can only be made before specifying an nonce value. The nonce length is given by B<15 - L> so it is 7 by default for AES. =head1 NOTES Where possible the B interface to symmetric ciphers should be used in preference to the low level interfaces. This is because the code then becomes transparent to the cipher used and much more flexible. Additionally, the B interface will ensure the use of platform specific cryptographic acceleration such as AES-NI (the low level interfaces do not provide the guarantee). PKCS padding works by adding B padding bytes of value B to make the total length of the encrypted data a multiple of the block size. Padding is always added so if the data is already a multiple of the block size B will equal the block size. For example if the block size is 8 and 11 bytes are to be encrypted then 5 padding bytes of value 5 will be added. When decrypting the final block is checked to see if it has the correct form. Although the decryption operation can produce an error if padding is enabled, it is not a strong test that the input data or key is correct. A random block has better than 1 in 256 chance of being of the correct format and problems with the input data earlier on will not produce a final decrypt error. If padding is disabled then the decryption operation will always succeed if the total amount of data decrypted is a multiple of the block size. The functions EVP_EncryptInit(), EVP_EncryptFinal(), EVP_DecryptInit(), EVP_CipherInit() and EVP_CipherFinal() are obsolete but are retained for compatibility with existing code. New code should use EVP_EncryptInit_ex(), EVP_EncryptFinal_ex(), EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex() and EVP_CipherFinal_ex() because they can reuse an existing context without allocating and freeing it up on each call. =head1 BUGS For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is a limitation of the current RC5 code rather than the EVP interface. EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with default key lengths. If custom ciphers exceed these values the results are unpredictable. This is because it has become standard practice to define a generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes. The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode. =head1 EXAMPLES Encrypt a string using IDEA: int do_crypt(char *outfile) { unsigned char outbuf[1024]; int outlen, tmplen; /* Bogus key and IV: we'd normally set these from * another source. */ unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char iv[] = {1,2,3,4,5,6,7,8}; char intext[] = "Some Crypto Text"; EVP_CIPHER_CTX ctx; FILE *out; EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit_ex(&ctx, EVP_idea_cbc(), NULL, key, iv); if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) { /* Error */ return 0; } /* Buffer passed to EVP_EncryptFinal() must be after data just * encrypted to avoid overwriting it. */ if(!EVP_EncryptFinal_ex(&ctx, outbuf + outlen, &tmplen)) { /* Error */ return 0; } outlen += tmplen; EVP_CIPHER_CTX_cleanup(&ctx); /* Need binary mode for fopen because encrypted data is * binary data. Also cannot use strlen() on it because * it wont be null terminated and may contain embedded * nulls. */ out = fopen(outfile, "wb"); fwrite(outbuf, 1, outlen, out); fclose(out); return 1; } The ciphertext from the above example can be decrypted using the B utility with the command line (shown on two lines for clarity): openssl idea -d =head1 HISTORY EVP_CIPHER_CTX_init(), EVP_EncryptInit_ex(), EVP_EncryptFinal_ex(), EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex(), EVP_CipherFinal_ex() and EVP_CIPHER_CTX_set_padding() appeared in OpenSSL 0.9.7. IDEA appeared in OpenSSL 0.9.7 but was often disabled due to patent concerns; the last patents expired in 2012. =cut diff --git a/ssl/Makefile b/ssl/Makefile index dd1296225006..7866a3ccd77b 100644 --- a/ssl/Makefile +++ b/ssl/Makefile @@ -1,1123 +1,1124 @@ # # OpenSSL/ssl/Makefile # DIR= ssl TOP= .. CC= cc INCLUDES= -I../crypto -I$(TOP) -I../include $(KRB5_INCLUDES) CFLAG=-g MAKEFILE= Makefile AR= ar r # KRB5 stuff KRB5_INCLUDES= CFLAGS= $(INCLUDES) $(CFLAG) GENERAL=Makefile README ssl-lib.com install.com -TEST=ssltest.c heartbeat_test.c clienthellotest.c sslv2conftest.c dtlstest.c bad_dtls_test.c +TEST=ssltest.c heartbeat_test.c clienthellotest.c sslv2conftest.c dtlstest.c \ + bad_dtls_test.c fatalerrtest.c APPS= LIB=$(TOP)/libssl.a SHARED_LIB= libssl$(SHLIB_EXT) LIBSRC= \ s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s3_cbc.c \ s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c t1_ext.c \ d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \ d1_both.c d1_srtp.c \ ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c \ ssl_ciph.c ssl_stat.c ssl_rsa.c \ ssl_asn1.c ssl_txt.c ssl_algs.c ssl_conf.c \ bio_ssl.c ssl_err.c kssl.c t1_reneg.c tls_srp.c t1_trce.c ssl_utst.c LIBOBJ= \ s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o \ s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o s3_cbc.o \ s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o \ t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o t1_ext.o \ d1_meth.o d1_srvr.o d1_clnt.o d1_lib.o d1_pkt.o \ d1_both.o d1_srtp.o\ ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o \ ssl_ciph.o ssl_stat.o ssl_rsa.o \ ssl_asn1.o ssl_txt.o ssl_algs.o ssl_conf.o \ bio_ssl.o ssl_err.o kssl.o t1_reneg.o tls_srp.o t1_trce.o ssl_utst.o SRC= $(LIBSRC) EXHEADER= ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h kssl.h srtp.h HEADER= $(EXHEADER) ssl_locl.h kssl_lcl.h ALL= $(GENERAL) $(SRC) $(HEADER) top: (cd ..; $(MAKE) DIRS=$(DIR) all) all: shared lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) $(RANLIB) $(LIB) || echo Never mind. @touch lib shared: lib if [ -n "$(SHARED_LIBS)" ]; then \ (cd ..; $(MAKE) $(SHARED_LIB)); \ fi files: $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO links: @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER) @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST) @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS) install: @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ do \ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; tags: ctags $(SRC) tests: lint: lint -DLINT $(INCLUDES) $(SRC)>fluff update: local_depend @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi depend: local_depend @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi local_depend: @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) dclean: $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff # DO NOT DELETE THIS LINE -- make depend depends on it. bio_ssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h bio_ssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h bio_ssl.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h bio_ssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h bio_ssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h bio_ssl.o: ../include/openssl/err.h ../include/openssl/evp.h bio_ssl.o: ../include/openssl/hmac.h ../include/openssl/kssl.h bio_ssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h bio_ssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h bio_ssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h bio_ssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h bio_ssl.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h bio_ssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h bio_ssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h bio_ssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h bio_ssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h bio_ssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h bio_ssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h bio_ssl.c d1_both.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_both.o: ../include/openssl/buffer.h ../include/openssl/comp.h d1_both.o: ../include/openssl/crypto.h ../include/openssl/dsa.h d1_both.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_both.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_both.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_both.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_both.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_both.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h d1_both.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h d1_both.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h d1_both.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h d1_both.o: ../include/openssl/pqueue.h ../include/openssl/rand.h d1_both.o: ../include/openssl/rsa.h ../include/openssl/safestack.h d1_both.o: ../include/openssl/sha.h ../include/openssl/srtp.h d1_both.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h d1_both.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h d1_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h d1_both.o: ../include/openssl/tls1.h ../include/openssl/x509.h d1_both.o: ../include/openssl/x509_vfy.h d1_both.c ssl_locl.h d1_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h d1_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h d1_clnt.o: ../include/openssl/dh.h ../include/openssl/dsa.h d1_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_clnt.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h d1_clnt.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h d1_clnt.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h d1_clnt.o: ../include/openssl/pem.h ../include/openssl/pem2.h d1_clnt.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h d1_clnt.o: ../include/openssl/rand.h ../include/openssl/rsa.h d1_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h d1_clnt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h d1_clnt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h d1_clnt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h d1_clnt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h d1_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_clnt.c d1_clnt.o: kssl_lcl.h ssl_locl.h d1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h d1_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h d1_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h d1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h d1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h d1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h d1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h d1_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h d1_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h d1_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h d1_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h d1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h d1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_lib.c d1_lib.o: ssl_locl.h d1_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h d1_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h d1_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h d1_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h d1_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h d1_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h d1_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h d1_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h d1_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h d1_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h d1_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h d1_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h d1_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_meth.c d1_meth.o: ssl_locl.h d1_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h d1_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h d1_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h d1_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h d1_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h d1_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h d1_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h d1_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h d1_pkt.o: ../include/openssl/sha.h ../include/openssl/srtp.h d1_pkt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h d1_pkt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h d1_pkt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h d1_pkt.o: ../include/openssl/tls1.h ../include/openssl/x509.h d1_pkt.o: ../include/openssl/x509_vfy.h d1_pkt.c ssl_locl.h d1_srtp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_srtp.o: ../include/openssl/buffer.h ../include/openssl/comp.h d1_srtp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h d1_srtp.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_srtp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_srtp.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_srtp.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_srtp.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_srtp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h d1_srtp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h d1_srtp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h d1_srtp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h d1_srtp.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h d1_srtp.o: ../include/openssl/safestack.h ../include/openssl/sha.h d1_srtp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h d1_srtp.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h d1_srtp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h d1_srtp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h d1_srtp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srtp.c d1_srtp.o: srtp.h ssl_locl.h d1_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h d1_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h d1_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h d1_srvr.o: ../include/openssl/dh.h ../include/openssl/dsa.h d1_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h d1_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h d1_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h d1_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h d1_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h d1_srvr.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h d1_srvr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h d1_srvr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h d1_srvr.o: ../include/openssl/pem.h ../include/openssl/pem2.h d1_srvr.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h d1_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h d1_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h d1_srvr.o: ../include/openssl/srtp.h ../include/openssl/ssl.h d1_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h d1_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h d1_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h d1_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srvr.c d1_srvr.o: ssl_locl.h kssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h kssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h kssl.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h kssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h kssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h kssl.o: ../include/openssl/evp.h ../include/openssl/hmac.h kssl.o: ../include/openssl/krb5_asn.h ../include/openssl/kssl.h kssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h kssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h kssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h kssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h kssl.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h kssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h kssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h kssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h kssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h kssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h kssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl.c kssl.o: kssl_lcl.h s23_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s23_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h s23_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s23_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s23_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s23_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s23_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h s23_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s23_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s23_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s23_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s23_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s23_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s23_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s23_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h s23_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s23_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s23_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s23_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h s23_clnt.o: ../include/openssl/x509_vfy.h s23_clnt.c ssl_locl.h s23_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s23_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h s23_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s23_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s23_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s23_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s23_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h s23_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s23_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s23_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s23_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s23_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s23_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s23_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h s23_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s23_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s23_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s23_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s23_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_lib.c s23_lib.o: ssl_locl.h s23_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s23_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h s23_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s23_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s23_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s23_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s23_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h s23_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s23_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s23_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s23_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s23_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s23_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s23_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h s23_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s23_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s23_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s23_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s23_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_meth.c s23_meth.o: ssl_locl.h s23_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s23_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h s23_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s23_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s23_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s23_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s23_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h s23_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s23_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s23_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s23_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s23_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s23_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s23_pkt.o: ../include/openssl/safestack.h ../include/openssl/sha.h s23_pkt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s23_pkt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s23_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s23_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s23_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s23_pkt.c s23_pkt.o: ssl_locl.h s23_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s23_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h s23_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s23_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s23_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s23_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s23_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h s23_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s23_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s23_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s23_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s23_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s23_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s23_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s23_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h s23_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s23_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s23_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s23_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h s23_srvr.o: ../include/openssl/x509_vfy.h s23_srvr.c ssl_locl.h s2_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_clnt.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_clnt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_clnt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_clnt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_clnt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_clnt.c s2_clnt.o: ssl_locl.h s2_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_enc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_enc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_enc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_enc.c s2_enc.o: ssl_locl.h s2_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_lib.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_lib.c s2_lib.o: ssl_locl.h s2_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_meth.c s2_meth.o: ssl_locl.h s2_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_pkt.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_pkt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_pkt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_pkt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_pkt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_pkt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_pkt.c s2_pkt.o: ssl_locl.h s2_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s2_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h s2_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s2_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s2_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s2_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s2_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h s2_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s2_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s2_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s2_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s2_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s2_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s2_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h s2_srvr.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s2_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s2_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s2_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s2_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s2_srvr.c s2_srvr.o: ssl_locl.h s3_both.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_both.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_both.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s3_both.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s3_both.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s3_both.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s3_both.o: ../include/openssl/evp.h ../include/openssl/hmac.h s3_both.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s3_both.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_both.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_both.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_both.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_both.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s3_both.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s3_both.o: ../include/openssl/sha.h ../include/openssl/srtp.h s3_both.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s3_both.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s3_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s3_both.o: ../include/openssl/tls1.h ../include/openssl/x509.h s3_both.o: ../include/openssl/x509_vfy.h s3_both.c ssl_locl.h s3_cbc.o: ../crypto/constant_time_locl.h ../e_os.h ../include/openssl/asn1.h s3_cbc.o: ../include/openssl/bio.h ../include/openssl/buffer.h s3_cbc.o: ../include/openssl/comp.h ../include/openssl/crypto.h s3_cbc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h s3_cbc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h s3_cbc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h s3_cbc.o: ../include/openssl/err.h ../include/openssl/evp.h s3_cbc.o: ../include/openssl/hmac.h ../include/openssl/kssl.h s3_cbc.o: ../include/openssl/lhash.h ../include/openssl/md5.h s3_cbc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_cbc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_cbc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_cbc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_cbc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s3_cbc.o: ../include/openssl/safestack.h ../include/openssl/sha.h s3_cbc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s3_cbc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s3_cbc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s3_cbc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s3_cbc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s3_cbc.c s3_cbc.o: ssl_locl.h s3_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h s3_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h s3_clnt.o: ../include/openssl/dh.h ../include/openssl/dsa.h s3_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s3_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s3_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h s3_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h s3_clnt.o: ../include/openssl/hmac.h ../include/openssl/kssl.h s3_clnt.o: ../include/openssl/lhash.h ../include/openssl/md5.h s3_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s3_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s3_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h s3_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s3_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s3_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s3_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h s3_clnt.o: ../include/openssl/x509_vfy.h kssl_lcl.h s3_clnt.c ssl_locl.h s3_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s3_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s3_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s3_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s3_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h s3_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s3_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h s3_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h s3_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h s3_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h s3_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h s3_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s3_enc.o: ../include/openssl/sha.h ../include/openssl/srtp.h s3_enc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s3_enc.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s3_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s3_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h s3_enc.o: ../include/openssl/x509_vfy.h s3_enc.c ssl_locl.h s3_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h s3_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h s3_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h s3_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h s3_lib.o: ../include/openssl/err.h ../include/openssl/evp.h s3_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h s3_lib.o: ../include/openssl/lhash.h ../include/openssl/md5.h s3_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_lib.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s3_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h s3_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s3_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s3_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s3_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s3_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl_lcl.h s3_lib.o: s3_lib.c ssl_locl.h s3_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s3_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s3_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s3_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s3_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h s3_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s3_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h s3_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h s3_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s3_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s3_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s3_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s3_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h s3_meth.c s3_meth.o: ssl_locl.h s3_pkt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h s3_pkt.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_pkt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h s3_pkt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h s3_pkt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h s3_pkt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h s3_pkt.o: ../include/openssl/evp.h ../include/openssl/hmac.h s3_pkt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s3_pkt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h s3_pkt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h s3_pkt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h s3_pkt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h s3_pkt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h s3_pkt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h s3_pkt.o: ../include/openssl/sha.h ../include/openssl/srtp.h s3_pkt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h s3_pkt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h s3_pkt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h s3_pkt.o: ../include/openssl/tls1.h ../include/openssl/x509.h s3_pkt.o: ../include/openssl/x509_vfy.h s3_pkt.c ssl_locl.h s3_srvr.o: ../crypto/constant_time_locl.h ../e_os.h ../include/openssl/asn1.h s3_srvr.o: ../include/openssl/bio.h ../include/openssl/bn.h s3_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h s3_srvr.o: ../include/openssl/crypto.h ../include/openssl/dh.h s3_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h s3_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h s3_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h s3_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h s3_srvr.o: ../include/openssl/hmac.h ../include/openssl/krb5_asn.h s3_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h s3_srvr.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h s3_srvr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h s3_srvr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h s3_srvr.o: ../include/openssl/pem.h ../include/openssl/pem2.h s3_srvr.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h s3_srvr.o: ../include/openssl/rand.h ../include/openssl/rsa.h s3_srvr.o: ../include/openssl/safestack.h ../include/openssl/sha.h s3_srvr.o: ../include/openssl/srtp.h ../include/openssl/ssl.h s3_srvr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h s3_srvr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h s3_srvr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h s3_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h kssl_lcl.h s3_srvr.o: s3_srvr.c ssl_locl.h ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_algs.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_algs.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_algs.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_algs.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_algs.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_algs.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_algs.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_algs.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_algs.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_algs.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_algs.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_algs.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_algs.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_algs.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_algs.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_algs.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_algs.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_algs.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_algs.c ssl_algs.o: ssl_locl.h ssl_asn1.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1_mac.h ssl_asn1.o: ../include/openssl/bio.h ../include/openssl/buffer.h ssl_asn1.o: ../include/openssl/comp.h ../include/openssl/crypto.h ssl_asn1.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h ssl_asn1.o: ../include/openssl/e_os2.h ../include/openssl/ec.h ssl_asn1.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h ssl_asn1.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_asn1.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_asn1.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_asn1.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h ssl_asn1.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h ssl_asn1.o: ../include/openssl/pem.h ../include/openssl/pem2.h ssl_asn1.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ssl_asn1.o: ../include/openssl/rsa.h ../include/openssl/safestack.h ssl_asn1.o: ../include/openssl/sha.h ../include/openssl/srtp.h ssl_asn1.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h ssl_asn1.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h ssl_asn1.o: ../include/openssl/stack.h ../include/openssl/symhacks.h ssl_asn1.o: ../include/openssl/tls1.h ../include/openssl/x509.h ssl_asn1.o: ../include/openssl/x509_vfy.h ssl_asn1.c ssl_locl.h ssl_cert.o: ../crypto/o_dir.h ../e_os.h ../include/openssl/asn1.h ssl_cert.o: ../include/openssl/bio.h ../include/openssl/bn.h ssl_cert.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_cert.o: ../include/openssl/conf.h ../include/openssl/crypto.h ssl_cert.o: ../include/openssl/dh.h ../include/openssl/dsa.h ssl_cert.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_cert.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_cert.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_cert.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_cert.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_cert.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_cert.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_cert.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_cert.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_cert.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_cert.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_cert.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_cert.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_cert.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_cert.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_cert.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_cert.o: ../include/openssl/x509v3.h ssl_cert.c ssl_locl.h ssl_ciph.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_ciph.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_ciph.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_ciph.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_ciph.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_ciph.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h ssl_ciph.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_ciph.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_ciph.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_ciph.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h ssl_ciph.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h ssl_ciph.o: ../include/openssl/pem.h ../include/openssl/pem2.h ssl_ciph.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ssl_ciph.o: ../include/openssl/rsa.h ../include/openssl/safestack.h ssl_ciph.o: ../include/openssl/sha.h ../include/openssl/srtp.h ssl_ciph.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h ssl_ciph.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h ssl_ciph.o: ../include/openssl/stack.h ../include/openssl/symhacks.h ssl_ciph.o: ../include/openssl/tls1.h ../include/openssl/x509.h ssl_ciph.o: ../include/openssl/x509_vfy.h ssl_ciph.c ssl_locl.h ssl_conf.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_conf.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_conf.o: ../include/openssl/conf.h ../include/openssl/crypto.h ssl_conf.o: ../include/openssl/dh.h ../include/openssl/dsa.h ssl_conf.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_conf.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_conf.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_conf.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_conf.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_conf.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_conf.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_conf.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_conf.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_conf.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_conf.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_conf.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_conf.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_conf.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_conf.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_conf.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_conf.c ssl_conf.o: ssl_locl.h ssl_err.o: ../include/openssl/asn1.h ../include/openssl/bio.h ssl_err.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_err.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h ssl_err.o: ../include/openssl/e_os2.h ../include/openssl/ec.h ssl_err.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h ssl_err.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_err.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_err.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_err.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h ssl_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h ssl_err.o: ../include/openssl/pem.h ../include/openssl/pem2.h ssl_err.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ssl_err.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_err.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_err.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_err.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_err.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_err.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_err.c ssl_err2.o: ../include/openssl/asn1.h ../include/openssl/bio.h ssl_err2.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_err2.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h ssl_err2.o: ../include/openssl/e_os2.h ../include/openssl/ec.h ssl_err2.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h ssl_err2.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_err2.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_err2.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_err2.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h ssl_err2.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h ssl_err2.o: ../include/openssl/pem.h ../include/openssl/pem2.h ssl_err2.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ssl_err2.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_err2.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_err2.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_err2.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_err2.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_err2.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_err2.c ssl_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h ssl_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h ssl_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_lib.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h ssl_lib.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h ssl_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h ssl_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h ssl_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h ssl_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h ssl_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h ssl_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h ssl_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h ssl_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h kssl_lcl.h ssl_lib.o: ssl_lib.c ssl_locl.h ssl_rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_rsa.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_rsa.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_rsa.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_rsa.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_rsa.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_rsa.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_rsa.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_rsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_rsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_rsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_rsa.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_rsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_rsa.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_rsa.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_rsa.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_rsa.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h ssl_rsa.o: ssl_rsa.c ssl_sess.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_sess.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_sess.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_sess.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_sess.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_sess.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h ssl_sess.o: ../include/openssl/err.h ../include/openssl/evp.h ssl_sess.o: ../include/openssl/hmac.h ../include/openssl/kssl.h ssl_sess.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h ssl_sess.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h ssl_sess.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h ssl_sess.o: ../include/openssl/pem.h ../include/openssl/pem2.h ssl_sess.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h ssl_sess.o: ../include/openssl/rand.h ../include/openssl/rsa.h ssl_sess.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_sess.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_sess.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_sess.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_sess.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_sess.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h ssl_sess.o: ssl_sess.c ssl_stat.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_stat.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_stat.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_stat.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_stat.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_stat.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_stat.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_stat.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_stat.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_stat.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_stat.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_stat.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_stat.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_stat.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_stat.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_stat.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_stat.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_stat.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_stat.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h ssl_stat.o: ssl_stat.c ssl_txt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_txt.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_txt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_txt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_txt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_txt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_txt.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_txt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_txt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_txt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_txt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_txt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_txt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_txt.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_txt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_txt.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_txt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_txt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_txt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h ssl_txt.o: ssl_txt.c ssl_utst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h ssl_utst.o: ../include/openssl/buffer.h ../include/openssl/comp.h ssl_utst.o: ../include/openssl/crypto.h ../include/openssl/dsa.h ssl_utst.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h ssl_utst.o: ../include/openssl/ec.h ../include/openssl/ecdh.h ssl_utst.o: ../include/openssl/ecdsa.h ../include/openssl/err.h ssl_utst.o: ../include/openssl/evp.h ../include/openssl/hmac.h ssl_utst.o: ../include/openssl/kssl.h ../include/openssl/lhash.h ssl_utst.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h ssl_utst.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h ssl_utst.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h ssl_utst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h ssl_utst.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h ssl_utst.o: ../include/openssl/safestack.h ../include/openssl/sha.h ssl_utst.o: ../include/openssl/srtp.h ../include/openssl/ssl.h ssl_utst.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h ssl_utst.o: ../include/openssl/ssl3.h ../include/openssl/stack.h ssl_utst.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssl_utst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h ssl_utst.o: ssl_utst.c t1_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_clnt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_clnt.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_clnt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_clnt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_clnt.o: ../include/openssl/pqueue.h ../include/openssl/rand.h t1_clnt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h t1_clnt.o: ../include/openssl/sha.h ../include/openssl/srtp.h t1_clnt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h t1_clnt.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h t1_clnt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h t1_clnt.o: ../include/openssl/tls1.h ../include/openssl/x509.h t1_clnt.o: ../include/openssl/x509_vfy.h ssl_locl.h t1_clnt.c t1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_enc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h t1_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h t1_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h t1_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h t1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h t1_enc.o: ../include/openssl/rand.h ../include/openssl/rsa.h t1_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h t1_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h t1_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h t1_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h t1_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h t1_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h t1_enc.o: t1_enc.c t1_ext.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_ext.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_ext.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_ext.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_ext.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_ext.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_ext.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_ext.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_ext.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_ext.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_ext.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_ext.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_ext.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h t1_ext.o: ../include/openssl/safestack.h ../include/openssl/sha.h t1_ext.o: ../include/openssl/srtp.h ../include/openssl/ssl.h t1_ext.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h t1_ext.o: ../include/openssl/ssl3.h ../include/openssl/stack.h t1_ext.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h t1_ext.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h t1_ext.o: t1_ext.c t1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h t1_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h t1_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h t1_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h t1_lib.o: ../include/openssl/err.h ../include/openssl/evp.h t1_lib.o: ../include/openssl/hmac.h ../include/openssl/kssl.h t1_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h t1_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h t1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h t1_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h t1_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h t1_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h t1_lib.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h t1_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h t1_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h t1_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h ssl_locl.h t1_lib.o: t1_lib.c t1_meth.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_meth.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_meth.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_meth.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_meth.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_meth.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_meth.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_meth.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_meth.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_meth.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_meth.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_meth.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_meth.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h t1_meth.o: ../include/openssl/safestack.h ../include/openssl/sha.h t1_meth.o: ../include/openssl/srtp.h ../include/openssl/ssl.h t1_meth.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h t1_meth.o: ../include/openssl/ssl3.h ../include/openssl/stack.h t1_meth.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h t1_meth.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h t1_meth.o: t1_meth.c t1_reneg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_reneg.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_reneg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_reneg.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_reneg.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_reneg.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_reneg.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_reneg.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_reneg.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_reneg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_reneg.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_reneg.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_reneg.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h t1_reneg.o: ../include/openssl/safestack.h ../include/openssl/sha.h t1_reneg.o: ../include/openssl/srtp.h ../include/openssl/ssl.h t1_reneg.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h t1_reneg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h t1_reneg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h t1_reneg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h t1_reneg.o: t1_reneg.c t1_srvr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_srvr.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_srvr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_srvr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_srvr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_srvr.o: ../include/openssl/pqueue.h ../include/openssl/rand.h t1_srvr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h t1_srvr.o: ../include/openssl/sha.h ../include/openssl/srtp.h t1_srvr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h t1_srvr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h t1_srvr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h t1_srvr.o: ../include/openssl/tls1.h ../include/openssl/x509.h t1_srvr.o: ../include/openssl/x509_vfy.h ssl_locl.h t1_srvr.c t1_trce.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h t1_trce.o: ../include/openssl/buffer.h ../include/openssl/comp.h t1_trce.o: ../include/openssl/crypto.h ../include/openssl/dsa.h t1_trce.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h t1_trce.o: ../include/openssl/ec.h ../include/openssl/ecdh.h t1_trce.o: ../include/openssl/ecdsa.h ../include/openssl/err.h t1_trce.o: ../include/openssl/evp.h ../include/openssl/hmac.h t1_trce.o: ../include/openssl/kssl.h ../include/openssl/lhash.h t1_trce.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h t1_trce.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h t1_trce.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h t1_trce.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h t1_trce.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h t1_trce.o: ../include/openssl/safestack.h ../include/openssl/sha.h t1_trce.o: ../include/openssl/srtp.h ../include/openssl/ssl.h t1_trce.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h t1_trce.o: ../include/openssl/ssl3.h ../include/openssl/stack.h t1_trce.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h t1_trce.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssl_locl.h t1_trce.o: t1_trce.c tls_srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h tls_srp.o: ../include/openssl/bn.h ../include/openssl/buffer.h tls_srp.o: ../include/openssl/comp.h ../include/openssl/crypto.h tls_srp.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h tls_srp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h tls_srp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h tls_srp.o: ../include/openssl/err.h ../include/openssl/evp.h tls_srp.o: ../include/openssl/hmac.h ../include/openssl/kssl.h tls_srp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h tls_srp.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h tls_srp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h tls_srp.o: ../include/openssl/pem.h ../include/openssl/pem2.h tls_srp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h tls_srp.o: ../include/openssl/rand.h ../include/openssl/rsa.h tls_srp.o: ../include/openssl/safestack.h ../include/openssl/sha.h tls_srp.o: ../include/openssl/srp.h ../include/openssl/srtp.h tls_srp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h tls_srp.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h tls_srp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h tls_srp.o: ../include/openssl/tls1.h ../include/openssl/x509.h tls_srp.o: ../include/openssl/x509_vfy.h ssl_locl.h tls_srp.c diff --git a/ssl/bad_dtls_test.c b/ssl/bad_dtls_test.c index 70d8578b5883..34af37d9a9f4 100644 --- a/ssl/bad_dtls_test.c +++ b/ssl/bad_dtls_test.c @@ -1,926 +1,926 @@ /* * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (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 */ /* * Unit test for Cisco DTLS1_BAD_VER session resume, as used by * AnyConnect VPN protocol. * * This is designed to exercise the code paths in * http://git.infradead.org/users/dwmw2/openconnect.git/blob/HEAD:/dtls.c * which have frequently been affected by regressions in DTLS1_BAD_VER * support. * * Note that unlike other SSL tests, we don't test against our own SSL * server method. Firstly because we don't have one; we *only* support * DTLS1_BAD_VER as a client. And secondly because even if that were * fixed up it's the wrong thing to test against — because if changes * are made in generic DTLS code which don't take DTLS1_BAD_VER into * account, there's plenty of scope for making those changes such that * they break *both* the client and the server in the same way. * * So we handle the server side manually. In a session resume there isn't * much to be done anyway. */ #include /* On Windows this will include and thus it needs to be * included *before* anything that includes . Ick. */ #include "e_os.h" /* for 'inline' */ #include #include #include #include #include #include /* PACKET functions lifted from OpenSSL 1.1's ssl/packet_locl.h */ typedef struct { /* Pointer to where we are currently reading from */ const unsigned char *curr; /* Number of bytes remaining */ size_t remaining; } PACKET; /* Internal unchecked shorthand; don't use outside this file. */ static inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } /* * Returns the number of bytes remaining to be read in the PACKET */ static inline size_t PACKET_remaining(const PACKET *pkt) { return pkt->remaining; } /* * Initialise a PACKET with |len| bytes held in |buf|. This does not make a * copy of the data so |buf| must be present for the whole time that the PACKET * is being used. */ static inline int PACKET_buf_init(PACKET *pkt, const unsigned char *buf, size_t len) { /* Sanity check for negative values. */ if (len > (size_t)65536) return 0; pkt->curr = buf; pkt->remaining = len; return 1; } /* * Returns 1 if the packet has length |num| and its contents equal the |num| * bytes read from |ptr|. Returns 0 otherwise (lengths or contents not equal). * If lengths are equal, performs the comparison in constant time. */ static inline int PACKET_equal(const PACKET *pkt, const void *ptr, size_t num) { if (PACKET_remaining(pkt) != num) return 0; return CRYPTO_memcmp(pkt->curr, ptr, num) == 0; } /* * Peek ahead at 2 bytes in network order from |pkt| and store the value in * |*data| */ static inline int PACKET_peek_net_2(const PACKET *pkt, unsigned int *data) { if (PACKET_remaining(pkt) < 2) return 0; *data = ((unsigned int)(*pkt->curr)) << 8; *data |= *(pkt->curr + 1); return 1; } /* Equivalent of n2s */ /* Get 2 bytes in network order from |pkt| and store the value in |*data| */ static inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) { if (!PACKET_peek_net_2(pkt, data)) return 0; packet_forward(pkt, 2); return 1; } /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */ static inline int PACKET_peek_1(const PACKET *pkt, unsigned int *data) { if (!PACKET_remaining(pkt)) return 0; *data = *pkt->curr; return 1; } /* Get 1 byte from |pkt| and store the value in |*data| */ static inline int PACKET_get_1(PACKET *pkt, unsigned int *data) { if (!PACKET_peek_1(pkt, data)) return 0; packet_forward(pkt, 1); return 1; } /* * Peek ahead at |len| bytes from the |pkt| and store a pointer to them in * |*data|. This just points at the underlying buffer that |pkt| is using. The * caller should not free this data directly (it will be freed when the * underlying buffer gets freed */ static inline int PACKET_peek_bytes(const PACKET *pkt, const unsigned char **data, size_t len) { if (PACKET_remaining(pkt) < len) return 0; *data = pkt->curr; return 1; } /* * Read |len| bytes from the |pkt| and store a pointer to them in |*data|. This * just points at the underlying buffer that |pkt| is using. The caller should * not free this data directly (it will be freed when the underlying buffer gets * freed */ static inline int PACKET_get_bytes(PACKET *pkt, const unsigned char **data, size_t len) { if (!PACKET_peek_bytes(pkt, data, len)) return 0; packet_forward(pkt, len); return 1; } /* Peek ahead at |len| bytes from |pkt| and copy them to |data| */ static inline int PACKET_peek_copy_bytes(const PACKET *pkt, unsigned char *data, size_t len) { if (PACKET_remaining(pkt) < len) return 0; memcpy(data, pkt->curr, len); return 1; } /* * Read |len| bytes from |pkt| and copy them to |data|. * The caller is responsible for ensuring that |data| can hold |len| bytes. */ static inline int PACKET_copy_bytes(PACKET *pkt, unsigned char *data, size_t len) { if (!PACKET_peek_copy_bytes(pkt, data, len)) return 0; packet_forward(pkt, len); return 1; } /* Move the current reading position forward |len| bytes */ static inline int PACKET_forward(PACKET *pkt, size_t len) { if (PACKET_remaining(pkt) < len) return 0; packet_forward(pkt, len); return 1; } /* * Reads a variable-length vector prefixed with a one-byte length, and stores * the contents in |subpkt|. |pkt| can equal |subpkt|. * Data is not copied: the |subpkt| packet will share its underlying buffer with * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. * Upon failure, the original |pkt| and |subpkt| are not modified. */ static inline int PACKET_get_length_prefixed_1(PACKET *pkt, PACKET *subpkt) { unsigned int length; const unsigned char *data; PACKET tmp = *pkt; if (!PACKET_get_1(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length)) { return 0; } *pkt = tmp; subpkt->curr = data; subpkt->remaining = length; return 1; } #define OSSL_NELEM(x) (sizeof(x)/sizeof(x[0])) /* For DTLS1_BAD_VER packets the MAC doesn't include the handshake header */ #define MAC_OFFSET (DTLS1_RT_HEADER_LENGTH + DTLS1_HM_HEADER_LENGTH) static unsigned char client_random[SSL3_RANDOM_SIZE]; static unsigned char server_random[SSL3_RANDOM_SIZE]; /* These are all generated locally, sized purely according to our own whim */ static unsigned char session_id[32]; static unsigned char master_secret[48]; static unsigned char cookie[20]; /* We've hard-coded the cipher suite; we know it's 104 bytes */ static unsigned char key_block[104]; #define mac_key (key_block + 20) #define dec_key (key_block + 40) #define enc_key (key_block + 56) static EVP_MD_CTX handshake_md5; static EVP_MD_CTX handshake_sha1; /* PRF lifted from ssl/t1_enc.c since we can't easily use it directly */ static int tls1_P_hash(const EVP_MD *md, const unsigned char *sec, int sec_len, const void *seed1, int seed1_len, const void *seed2, int seed2_len, const void *seed3, int seed3_len, unsigned char *out, int olen) { int chunk; size_t j; EVP_MD_CTX ctx, ctx_tmp, ctx_init; EVP_PKEY *prf_mac_key; unsigned char A1[EVP_MAX_MD_SIZE]; size_t A1_len; int ret = 0; chunk = EVP_MD_size(md); OPENSSL_assert(chunk >= 0); EVP_MD_CTX_init(&ctx); EVP_MD_CTX_init(&ctx_tmp); EVP_MD_CTX_init(&ctx_init); EVP_MD_CTX_set_flags(&ctx_init, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); prf_mac_key = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, sec, sec_len); if (!prf_mac_key) goto err; if (!EVP_DigestSignInit(&ctx_init, NULL, md, NULL, prf_mac_key)) goto err; if (!EVP_MD_CTX_copy_ex(&ctx, &ctx_init)) goto err; if (seed1 && !EVP_DigestSignUpdate(&ctx, seed1, seed1_len)) goto err; if (seed2 && !EVP_DigestSignUpdate(&ctx, seed2, seed2_len)) goto err; if (seed3 && !EVP_DigestSignUpdate(&ctx, seed3, seed3_len)) goto err; if (!EVP_DigestSignFinal(&ctx, A1, &A1_len)) goto err; for (;;) { /* Reinit mac contexts */ if (!EVP_MD_CTX_copy_ex(&ctx, &ctx_init)) goto err; if (!EVP_DigestSignUpdate(&ctx, A1, A1_len)) goto err; if (olen > chunk && !EVP_MD_CTX_copy_ex(&ctx_tmp, &ctx)) goto err; if (seed1 && !EVP_DigestSignUpdate(&ctx, seed1, seed1_len)) goto err; if (seed2 && !EVP_DigestSignUpdate(&ctx, seed2, seed2_len)) goto err; if (seed3 && !EVP_DigestSignUpdate(&ctx, seed3, seed3_len)) goto err; if (olen > chunk) { if (!EVP_DigestSignFinal(&ctx, out, &j)) goto err; out += j; olen -= j; /* calc the next A1 value */ if (!EVP_DigestSignFinal(&ctx_tmp, A1, &A1_len)) goto err; } else { /* last one */ if (!EVP_DigestSignFinal(&ctx, A1, &A1_len)) goto err; memcpy(out, A1, olen); break; } } ret = 1; err: EVP_PKEY_free(prf_mac_key); EVP_MD_CTX_cleanup(&ctx); EVP_MD_CTX_cleanup(&ctx_tmp); EVP_MD_CTX_cleanup(&ctx_init); OPENSSL_cleanse(A1, sizeof(A1)); return ret; } /* seed1 through seed5 are virtually concatenated */ static int do_PRF(const void *seed1, int seed1_len, const void *seed2, int seed2_len, const void *seed3, int seed3_len, unsigned char *out, int olen) { unsigned char out2[104]; int i, len; if (olen > (int)sizeof(out2)) return 0; len = sizeof(master_secret) / 2; if (!tls1_P_hash(EVP_md5(), master_secret, len, seed1, seed1_len, seed2, seed2_len, seed3, seed3_len, out, olen)) return 0; if (!tls1_P_hash(EVP_sha1(), master_secret + len, len, seed1, seed1_len, seed2, seed2_len, seed3, seed3_len, out2, olen)) return 0; for (i = 0; i < olen; i++) { out[i] ^= out2[i]; } return 1; } static SSL_SESSION *client_session(void) { static unsigned char session_asn1[] = { 0x30, 0x5F, /* SEQUENCE, length 0x5F */ 0x02, 0x01, 0x01, /* INTEGER, SSL_SESSION_ASN1_VERSION */ 0x02, 0x02, 0x01, 0x00, /* INTEGER, DTLS1_BAD_VER */ 0x04, 0x02, 0x00, 0x2F, /* OCTET_STRING, AES128-SHA */ 0x04, 0x20, /* OCTET_STRING, session id */ #define SS_SESSID_OFS 15 /* Session ID goes here */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x30, /* OCTET_STRING, master secret */ #define SS_SECRET_OFS 49 /* Master secret goes here */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const unsigned char *p = session_asn1; /* Copy the randomly-generated fields into the above ASN1 */ memcpy(session_asn1 + SS_SESSID_OFS, session_id, sizeof(session_id)); memcpy(session_asn1 + SS_SECRET_OFS, master_secret, sizeof(master_secret)); return d2i_SSL_SESSION(NULL, &p, sizeof(session_asn1)); } /* Returns 1 for initial ClientHello, 2 for ClientHello with cookie */ static int validate_client_hello(BIO *wbio) { PACKET pkt, pkt2; long len; unsigned char *data; int cookie_found = 0; unsigned int u; len = BIO_get_mem_data(wbio, (char **)&data); if (!PACKET_buf_init(&pkt, data, len)) return 0; /* Check record header type */ if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_HANDSHAKE) return 0; /* Version */ if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER) return 0; /* Skip the rest of the record header */ if (!PACKET_forward(&pkt, DTLS1_RT_HEADER_LENGTH - 3)) return 0; /* Check it's a ClientHello */ if (!PACKET_get_1(&pkt, &u) || u != SSL3_MT_CLIENT_HELLO) return 0; /* Skip the rest of the handshake message header */ if (!PACKET_forward(&pkt, DTLS1_HM_HEADER_LENGTH - 1)) return 0; /* Check client version */ if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER) return 0; /* Store random */ if (!PACKET_copy_bytes(&pkt, client_random, SSL3_RANDOM_SIZE)) return 0; /* Check session id length and content */ if (!PACKET_get_length_prefixed_1(&pkt, &pkt2) || !PACKET_equal(&pkt2, session_id, sizeof(session_id))) return 0; /* Check cookie */ if (!PACKET_get_length_prefixed_1(&pkt, &pkt2)) return 0; if (PACKET_remaining(&pkt2)) { if (!PACKET_equal(&pkt2, cookie, sizeof(cookie))) return 0; cookie_found = 1; } /* Skip ciphers */ if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u)) return 0; /* Skip compression */ if (!PACKET_get_1(&pkt, &u) || !PACKET_forward(&pkt, u)) return 0; /* Skip extensions */ if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u)) return 0; /* Now we are at the end */ if (PACKET_remaining(&pkt)) return 0; /* Update handshake MAC for second ClientHello (with cookie) */ if (cookie_found && (!EVP_DigestUpdate(&handshake_md5, data + MAC_OFFSET, len - MAC_OFFSET) || !EVP_DigestUpdate(&handshake_sha1, data + MAC_OFFSET, len - MAC_OFFSET))) printf("EVP_DigestUpdate() failed\n"); (void)BIO_reset(wbio); return 1 + cookie_found; } static int send_hello_verify(BIO *rbio) { static unsigned char hello_verify[] = { 0x16, /* Handshake */ 0x01, 0x00, /* DTLS1_BAD_VER */ 0x00, 0x00, /* Epoch 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Seq# 0 */ 0x00, 0x23, /* Length */ 0x03, /* Hello Verify */ 0x00, 0x00, 0x17, /* Length */ 0x00, 0x00, /* Seq# 0 */ 0x00, 0x00, 0x00, /* Fragment offset */ 0x00, 0x00, 0x17, /* Fragment length */ 0x01, 0x00, /* DTLS1_BAD_VER */ 0x14, /* Cookie length */ #define HV_COOKIE_OFS 28 /* Cookie goes here */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; memcpy(hello_verify + HV_COOKIE_OFS, cookie, sizeof(cookie)); BIO_write(rbio, hello_verify, sizeof(hello_verify)); return 1; } static int send_server_hello(BIO *rbio) { static unsigned char server_hello[] = { 0x16, /* Handshake */ 0x01, 0x00, /* DTLS1_BAD_VER */ 0x00, 0x00, /* Epoch 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* Seq# 1 */ 0x00, 0x52, /* Length */ 0x02, /* Server Hello */ 0x00, 0x00, 0x46, /* Length */ 0x00, 0x01, /* Seq# */ 0x00, 0x00, 0x00, /* Fragment offset */ 0x00, 0x00, 0x46, /* Fragment length */ 0x01, 0x00, /* DTLS1_BAD_VER */ #define SH_RANDOM_OFS 27 /* Server random goes here */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* Session ID length */ #define SH_SESSID_OFS 60 /* Session ID goes here */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, /* Cipher suite AES128-SHA */ 0x00, /* Compression null */ }; static unsigned char change_cipher_spec[] = { 0x14, /* Change Cipher Spec */ 0x01, 0x00, /* DTLS1_BAD_VER */ 0x00, 0x00, /* Epoch 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, /* Seq# 2 */ 0x00, 0x03, /* Length */ 0x01, 0x00, 0x02, /* Message */ }; memcpy(server_hello + SH_RANDOM_OFS, server_random, sizeof(server_random)); memcpy(server_hello + SH_SESSID_OFS, session_id, sizeof(session_id)); if (!EVP_DigestUpdate(&handshake_md5, server_hello + MAC_OFFSET, sizeof(server_hello) - MAC_OFFSET) || !EVP_DigestUpdate(&handshake_sha1, server_hello + MAC_OFFSET, sizeof(server_hello) - MAC_OFFSET)) printf("EVP_DigestUpdate() failed\n"); BIO_write(rbio, server_hello, sizeof(server_hello)); BIO_write(rbio, change_cipher_spec, sizeof(change_cipher_spec)); return 1; } /* Create header, HMAC, pad, encrypt and send a record */ static int send_record(BIO *rbio, unsigned char type, unsigned long seqnr, const void *msg, size_t len) { /* Note that the order of the record header fields on the wire, * and in the HMAC, is different. So we just keep them in separate * variables and handle them individually. */ static unsigned char epoch[2] = { 0x00, 0x01 }; static unsigned char seq[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static unsigned char ver[2] = { 0x01, 0x00 }; /* DTLS1_BAD_VER */ unsigned char lenbytes[2]; HMAC_CTX ctx; EVP_CIPHER_CTX enc_ctx; unsigned char iv[16]; unsigned char pad; unsigned char *enc; #ifdef SIXTY_FOUR_BIT_LONG - seq[0] = (seqnr >> 40) & 0xff; - seq[1] = (seqnr >> 32) & 0xff; + seq[0] = (unsigned char)(seqnr >> 40); + seq[1] = (unsigned char)(seqnr >> 32); #endif - seq[2] = (seqnr >> 24) & 0xff; - seq[3] = (seqnr >> 16) & 0xff; - seq[4] = (seqnr >> 8) & 0xff; - seq[5] = seqnr & 0xff; + seq[2] = (unsigned char)(seqnr >> 24); + seq[3] = (unsigned char)(seqnr >> 16); + seq[4] = (unsigned char)(seqnr >> 8); + seq[5] = (unsigned char)(seqnr); pad = 15 - ((len + SHA_DIGEST_LENGTH) % 16); enc = OPENSSL_malloc(len + SHA_DIGEST_LENGTH + 1 + pad); if (enc == NULL) return 0; /* Copy record to encryption buffer */ memcpy(enc, msg, len); /* Append HMAC to data */ HMAC_Init(&ctx, mac_key, 20, EVP_sha1()); HMAC_Update(&ctx, epoch, 2); HMAC_Update(&ctx, seq, 6); HMAC_Update(&ctx, &type, 1); HMAC_Update(&ctx, ver, 2); /* Version */ - lenbytes[0] = len >> 8; - lenbytes[1] = len & 0xff; + lenbytes[0] = (unsigned char)(len >> 8); + lenbytes[1] = (unsigned char)(len); HMAC_Update(&ctx, lenbytes, 2); /* Length */ HMAC_Update(&ctx, enc, len); /* Finally the data itself */ HMAC_Final(&ctx, enc + len, NULL); HMAC_CTX_cleanup(&ctx); /* Append padding bytes */ len += SHA_DIGEST_LENGTH; do { enc[len++] = pad; } while (len % 16); /* Generate IV, and encrypt */ RAND_bytes(iv, sizeof(iv)); EVP_CIPHER_CTX_init(&enc_ctx); EVP_CipherInit_ex(&enc_ctx, EVP_aes_128_cbc(), NULL, enc_key, iv, 1); EVP_Cipher(&enc_ctx, enc, enc, len); EVP_CIPHER_CTX_cleanup(&enc_ctx); /* Finally write header (from fragmented variables), IV and encrypted record */ BIO_write(rbio, &type, 1); BIO_write(rbio, ver, 2); BIO_write(rbio, epoch, 2); BIO_write(rbio, seq, 6); - lenbytes[0] = (len + sizeof(iv)) >> 8; - lenbytes[1] = (len + sizeof(iv)) & 0xff; + lenbytes[0] = (unsigned char)((len + sizeof(iv)) >> 8); + lenbytes[1] = (unsigned char)(len + sizeof(iv)); BIO_write(rbio, lenbytes, 2); BIO_write(rbio, iv, sizeof(iv)); BIO_write(rbio, enc, len); OPENSSL_free(enc); return 1; } static int send_finished(SSL *s, BIO *rbio) { static unsigned char finished_msg[DTLS1_HM_HEADER_LENGTH + TLS1_FINISH_MAC_LENGTH] = { 0x14, /* Finished */ 0x00, 0x00, 0x0c, /* Length */ 0x00, 0x03, /* Seq# 3 */ 0x00, 0x00, 0x00, /* Fragment offset */ 0x00, 0x00, 0x0c, /* Fragment length */ /* Finished MAC (12 bytes) */ }; unsigned char handshake_hash[EVP_MAX_MD_SIZE * 2]; /* Derive key material */ do_PRF(TLS_MD_KEY_EXPANSION_CONST, TLS_MD_KEY_EXPANSION_CONST_SIZE, server_random, SSL3_RANDOM_SIZE, client_random, SSL3_RANDOM_SIZE, key_block, sizeof(key_block)); /* Generate Finished MAC */ if (!EVP_DigestFinal_ex(&handshake_md5, handshake_hash, NULL) || !EVP_DigestFinal_ex(&handshake_sha1, handshake_hash + EVP_MD_CTX_size(&handshake_md5), NULL)) printf("EVP_DigestFinal_ex() failed\n"); do_PRF(TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE, handshake_hash, EVP_MD_CTX_size(&handshake_md5) + EVP_MD_CTX_size(&handshake_sha1), NULL, 0, finished_msg + DTLS1_HM_HEADER_LENGTH, TLS1_FINISH_MAC_LENGTH); return send_record(rbio, SSL3_RT_HANDSHAKE, 0, finished_msg, sizeof(finished_msg)); } static int validate_ccs(BIO *wbio) { PACKET pkt; long len; unsigned char *data; unsigned int u; len = BIO_get_mem_data(wbio, (char **)&data); if (!PACKET_buf_init(&pkt, data, len)) return 0; /* Check record header type */ if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_CHANGE_CIPHER_SPEC) return 0; /* Version */ if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER) return 0; /* Skip the rest of the record header */ if (!PACKET_forward(&pkt, DTLS1_RT_HEADER_LENGTH - 3)) return 0; /* Check ChangeCipherSpec message */ if (!PACKET_get_1(&pkt, &u) || u != SSL3_MT_CCS) return 0; /* A DTLS1_BAD_VER ChangeCipherSpec also contains the * handshake sequence number (which is 2 here) */ if (!PACKET_get_net_2(&pkt, &u) || u != 0x0002) return 0; /* Now check the Finished packet */ if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_HANDSHAKE) return 0; if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER) return 0; /* Check epoch is now 1 */ if (!PACKET_get_net_2(&pkt, &u) || u != 0x0001) return 0; /* That'll do for now. If OpenSSL accepted *our* Finished packet * then it's evidently remembered that DTLS1_BAD_VER doesn't * include the handshake header in the MAC. There's not a lot of * point in implementing decryption here, just to check that it * continues to get it right for one more packet. */ return 1; } #define NODROP(x) { x##UL, 0 } #define DROP(x) { x##UL, 1 } static struct { unsigned long seq; int drop; } tests[] = { NODROP(1), NODROP(3), NODROP(2), NODROP(0x1234), NODROP(0x1230), NODROP(0x1235), NODROP(0xffff), NODROP(0x10001), NODROP(0xfffe), NODROP(0x10000), DROP(0x10001), DROP(0xff), NODROP(0x100000), NODROP(0x800000), NODROP(0x7fffe1), NODROP(0xffffff), NODROP(0x1000000), NODROP(0xfffffe), DROP(0xffffff), NODROP(0x1000010), NODROP(0xfffffd), NODROP(0x1000011), DROP(0x12), NODROP(0x1000012), NODROP(0x1ffffff), NODROP(0x2000000), DROP(0x1ff00fe), NODROP(0x2000001), NODROP(0x20fffff), NODROP(0x2105500), DROP(0x20ffffe), NODROP(0x21054ff), NODROP(0x211ffff), DROP(0x2110000), NODROP(0x2120000) /* The last test should be NODROP, because a DROP wouldn't get tested. */ }; int main(int argc, char *argv[]) { SSL_SESSION *sess; SSL_CTX *ctx; SSL *con; BIO *rbio; BIO *wbio; BIO *err; time_t now = 0; int testresult = 0; int ret; int i; SSL_library_init(); SSL_load_error_strings(); err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT); CRYPTO_malloc_debug_init(); CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); RAND_bytes(session_id, sizeof(session_id)); RAND_bytes(master_secret, sizeof(master_secret)); RAND_bytes(cookie, sizeof(cookie)); RAND_bytes(server_random + 4, sizeof(server_random) - 4); now = time(NULL); memcpy(server_random, &now, sizeof(now)); sess = client_session(); if (sess == NULL) { printf("Failed to generate SSL_SESSION\n"); goto end; } if (!EVP_DigestInit_ex(&handshake_md5, EVP_md5(), NULL) || !EVP_DigestInit_ex(&handshake_sha1, EVP_sha1(), NULL)) { printf("Failed to initialise handshake_md\n"); goto end; } ctx = SSL_CTX_new(DTLSv1_client_method()); if (ctx == NULL) { printf("Failed to allocate SSL_CTX\n"); goto end_md; } SSL_CTX_set_options(ctx, SSL_OP_CISCO_ANYCONNECT); if (!SSL_CTX_set_cipher_list(ctx, "AES128-SHA")) { printf("SSL_CTX_set_cipher_list() failed\n"); goto end_ctx; } con = SSL_new(ctx); if (!SSL_set_session(con, sess)) { printf("SSL_set_session() failed\n"); goto end_con; } SSL_SESSION_free(sess); rbio = BIO_new(BIO_s_mem()); wbio = BIO_new(BIO_s_mem()); BIO_set_nbio(rbio, 1); BIO_set_nbio(wbio, 1); SSL_set_bio(con, rbio, wbio); SSL_set_connect_state(con); /* Send initial ClientHello */ ret = SSL_do_handshake(con); if (ret > 0 || SSL_get_error(con, ret) != SSL_ERROR_WANT_READ) { printf("Unexpected handshake result at initial call!\n"); goto end_con; } if (validate_client_hello(wbio) != 1) { printf("Initial ClientHello failed validation\n"); goto end_con; } if (send_hello_verify(rbio) != 1) { printf("Failed to send HelloVerify\n"); goto end_con; } ret = SSL_do_handshake(con); if (ret > 0 || SSL_get_error(con, ret) != SSL_ERROR_WANT_READ) { printf("Unexpected handshake result after HelloVerify!\n"); goto end_con; } if (validate_client_hello(wbio) != 2) { printf("Second ClientHello failed validation\n"); goto end_con; } if (send_server_hello(rbio) != 1) { printf("Failed to send ServerHello\n"); goto end_con; } ret = SSL_do_handshake(con); if (ret > 0 || SSL_get_error(con, ret) != SSL_ERROR_WANT_READ) { printf("Unexpected handshake result after ServerHello!\n"); goto end_con; } if (send_finished(con, rbio) != 1) { printf("Failed to send Finished\n"); goto end_con; } ret = SSL_do_handshake(con); if (ret < 1) { printf("Handshake not successful after Finished!\n"); goto end_con; } if (validate_ccs(wbio) != 1) { printf("Failed to validate client CCS/Finished\n"); goto end_con; } /* While we're here and crafting packets by hand, we might as well do a bit of a stress test on the DTLS record replay handling. Not Cisco-DTLS specific but useful anyway for the general case. It's been broken before, and in fact was broken even for a basic 0, 2, 1 test case when this test was first added.... */ for (i = 0; i < (int)OSSL_NELEM(tests); i++) { unsigned long recv_buf[2]; if (send_record(rbio, SSL3_RT_APPLICATION_DATA, tests[i].seq, &tests[i].seq, sizeof(unsigned long)) != 1) { printf("Failed to send data seq #0x%lx (%d)\n", tests[i].seq, i); goto end_con; } if (tests[i].drop) continue; ret = SSL_read(con, recv_buf, 2 * sizeof(unsigned long)); if (ret != sizeof(unsigned long)) { printf("SSL_read failed or wrong size on seq#0x%lx (%d)\n", tests[i].seq, i); goto end_con; } if (recv_buf[0] != tests[i].seq) { printf("Wrong data packet received (0x%lx not 0x%lx) at packet %d\n", recv_buf[0], tests[i].seq, i); goto end_con; } } if (tests[i-1].drop) { printf("Error: last test cannot be DROP()\n"); goto end_con; } testresult=1; end_con: SSL_free(con); end_ctx: SSL_CTX_free(ctx); end_md: EVP_MD_CTX_cleanup(&handshake_md5); EVP_MD_CTX_cleanup(&handshake_sha1); end: ERR_print_errors_fp(stderr); if (!testresult) { printf("Cisco BadDTLS test: FAILED\n"); } ERR_free_strings(); ERR_remove_thread_state(NULL); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); CRYPTO_mem_leaks(err); BIO_free(err); return testresult?0:1; } diff --git a/ssl/fatalerrtest.c b/ssl/fatalerrtest.c new file mode 100644 index 000000000000..0288c33fa2eb --- /dev/null +++ b/ssl/fatalerrtest.c @@ -0,0 +1,109 @@ +/* + * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (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 +#include +#include "ssltestlib.h" + +int main(int argc, char *argv[]) +{ + SSL_CTX *sctx, *cctx; + SSL *sssl, *cssl; + const char *msg = "Dummy"; + BIO *err = NULL, *wbio = NULL; + int ret = 1, len; + char buf[80]; + unsigned char dummyrec[] = { + 0x17, 0x03, 0x03, 0x00, 0x05, 'D', 'u', 'm', 'm', 'y' + }; + + if (argc != 3) { + printf("Incorrect number of parameters\n"); + return 1; + } + + SSL_library_init(); + SSL_load_error_strings(); + err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT); + CRYPTO_malloc_debug_init(); + CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); + CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); + + if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx, + argv[1], argv[2])) { + printf("Failed to create SSL_CTX pair\n"); + goto err; + } + + /* + * Deliberately set the cipher lists for client and server to be different + * to force a handshake failure. + */ + if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA") + || !SSL_CTX_set_cipher_list(cctx, "AES256-SHA")) { + printf("Failed to set cipher lists\n"); + goto err; + } + + if (!create_ssl_objects(sctx, cctx, &sssl, &cssl, NULL, NULL)) { + printf("Failed to create SSL objectx\n"); + goto err; + } + + wbio = SSL_get_wbio(cssl); + if (wbio == NULL) { + printf("Unexpected NULL bio received\n"); + goto err; + } + + if (create_ssl_connection(sssl, cssl)) { + printf("Unexpected success creating a connection\n"); + goto err; + } + + ERR_clear_error(); + + /* Inject a plaintext record from client to server */ + if (BIO_write(wbio, dummyrec, sizeof(dummyrec)) <= 0) { + printf("Unexpected failure injecting dummy record\n"); + goto err; + } + + /* SSL_read()/SSL_write should fail because of a previous fatal error */ + if ((len = SSL_read(sssl, buf, sizeof(buf - 1))) > 0) { + buf[len] = '\0'; + printf("Unexpected success reading data: %s\n", buf); + goto err; + } + if (SSL_write(sssl, msg, strlen(msg)) > 0) { + printf("Unexpected success writing data\n"); + goto err; + } + + ret = 0; + err: + SSL_free(sssl); + SSL_free(cssl); + SSL_CTX_free(sctx); + SSL_CTX_free(cctx); + ERR_print_errors_fp(stderr); + + if (ret) { + printf("Fatal err test: FAILED\n"); + } + + ERR_free_strings(); + ERR_remove_thread_state(NULL); + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); + CRYPTO_mem_leaks(err); + BIO_free(err); + + return ret; +} diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c index 92f41dd549ad..add8c9916c8f 100644 --- a/ssl/s23_clnt.c +++ b/ssl/s23_clnt.c @@ -1,833 +1,835 @@ /* ssl/s23_clnt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include "ssl_locl.h" #include #include #include #include static const SSL_METHOD *ssl23_get_client_method(int ver); static int ssl23_client_hello(SSL *s); static int ssl23_get_server_hello(SSL *s); static const SSL_METHOD *ssl23_get_client_method(int ver) { #ifndef OPENSSL_NO_SSL2 if (ver == SSL2_VERSION) return (SSLv2_client_method()); #endif #ifndef OPENSSL_NO_SSL3 if (ver == SSL3_VERSION) return (SSLv3_client_method()); #endif if (ver == TLS1_VERSION) return (TLSv1_client_method()); else if (ver == TLS1_1_VERSION) return (TLSv1_1_client_method()); else if (ver == TLS1_2_VERSION) return (TLSv1_2_client_method()); else return (NULL); } IMPLEMENT_ssl23_meth_func(SSLv23_client_method, ssl_undefined_function, ssl23_connect, ssl23_get_client_method) int ssl23_connect(SSL *s) { BUF_MEM *buf = NULL; unsigned long Time = (unsigned long)time(NULL); void (*cb) (const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state; RAND_add(&Time, sizeof(Time), 0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); for (;;) { state = s->state; switch (s->state) { case SSL_ST_BEFORE: case SSL_ST_CONNECT: case SSL_ST_BEFORE | SSL_ST_CONNECT: case SSL_ST_OK | SSL_ST_CONNECT: if (s->session != NULL) { SSLerr(SSL_F_SSL23_CONNECT, SSL_R_SSL23_DOING_SESSION_ID_REUSE); ret = -1; goto end; } s->server = 0; if (cb != NULL) cb(s, SSL_CB_HANDSHAKE_START, 1); /* s->version=TLS1_VERSION; */ s->type = SSL_ST_CONNECT; if (s->init_buf == NULL) { if ((buf = BUF_MEM_new()) == NULL) { ret = -1; goto end; } if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { ret = -1; goto end; } s->init_buf = buf; buf = NULL; } if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } if (!ssl3_init_finished_mac(s)) { ret = -1; goto end; } s->state = SSL23_ST_CW_CLNT_HELLO_A; s->ctx->stats.sess_connect++; s->init_num = 0; break; case SSL23_ST_CW_CLNT_HELLO_A: case SSL23_ST_CW_CLNT_HELLO_B: s->shutdown = 0; ret = ssl23_client_hello(s); if (ret <= 0) goto end; s->state = SSL23_ST_CR_SRVR_HELLO_A; s->init_num = 0; break; case SSL23_ST_CR_SRVR_HELLO_A: case SSL23_ST_CR_SRVR_HELLO_B: ret = ssl23_get_server_hello(s); if (ret >= 0) cb = NULL; goto end; /* break; */ default: SSLerr(SSL_F_SSL23_CONNECT, SSL_R_UNKNOWN_STATE); ret = -1; goto end; /* break; */ } if (s->debug) { (void)BIO_flush(s->wbio); } if ((cb != NULL) && (s->state != state)) { new_state = s->state; s->state = state; cb(s, SSL_CB_CONNECT_LOOP, 1); s->state = new_state; } } end: s->in_handshake--; if (buf != NULL) BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); return (ret); } static int ssl23_no_ssl2_ciphers(SSL *s) { SSL_CIPHER *cipher; STACK_OF(SSL_CIPHER) *ciphers; int i; ciphers = SSL_get_ciphers(s); for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) { cipher = sk_SSL_CIPHER_value(ciphers, i); if (cipher->algorithm_ssl == SSL_SSLV2) return 0; } return 1; } /* * Fill a ClientRandom or ServerRandom field of length len. Returns <= 0 on * failure, 1 on success. */ int ssl_fill_hello_random(SSL *s, int server, unsigned char *result, int len) { int send_time = 0; if (len < 4) return 0; if (server) send_time = (s->mode & SSL_MODE_SEND_SERVERHELLO_TIME) != 0; else send_time = (s->mode & SSL_MODE_SEND_CLIENTHELLO_TIME) != 0; if (send_time) { unsigned long Time = (unsigned long)time(NULL); unsigned char *p = result; l2n(Time, p); return RAND_bytes(p, len - 4); } else return RAND_bytes(result, len); } static int ssl23_client_hello(SSL *s) { unsigned char *buf; unsigned char *p, *d; int i, ch_len; unsigned long l; int ssl2_compat; int version = 0, version_major, version_minor; int al = 0; #ifndef OPENSSL_NO_COMP int j; SSL_COMP *comp; #endif int ret; unsigned long mask, options = s->options; ssl2_compat = (options & SSL_OP_NO_SSLv2) ? 0 : 1; if (ssl2_compat && ssl23_no_ssl2_ciphers(s)) ssl2_compat = 0; /* * SSL_OP_NO_X disables all protocols above X *if* there are * some protocols below X enabled. This is required in order * to maintain "version capability" vector contiguous. So * that if application wants to disable TLS1.0 in favour of * TLS1>=1, it would be insufficient to pass SSL_NO_TLSv1, the * answer is SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3|SSL_OP_NO_SSLv2. */ mask = SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1 #if !defined(OPENSSL_NO_SSL3) | SSL_OP_NO_SSLv3 #endif #if !defined(OPENSSL_NO_SSL2) | (ssl2_compat ? SSL_OP_NO_SSLv2 : 0) #endif ; #if !defined(OPENSSL_NO_TLS1_2_CLIENT) version = TLS1_2_VERSION; if ((options & SSL_OP_NO_TLSv1_2) && (options & mask) != mask) version = TLS1_1_VERSION; #else version = TLS1_1_VERSION; #endif mask &= ~SSL_OP_NO_TLSv1_1; if ((options & SSL_OP_NO_TLSv1_1) && (options & mask) != mask) version = TLS1_VERSION; mask &= ~SSL_OP_NO_TLSv1; #if !defined(OPENSSL_NO_SSL3) if ((options & SSL_OP_NO_TLSv1) && (options & mask) != mask) version = SSL3_VERSION; mask &= ~SSL_OP_NO_SSLv3; #endif #if !defined(OPENSSL_NO_SSL2) if ((options & SSL_OP_NO_SSLv3) && (options & mask) != mask) version = SSL2_VERSION; #endif #ifndef OPENSSL_NO_TLSEXT if (version != SSL2_VERSION) { /* * have to disable SSL 2.0 compatibility if we need TLS extensions */ if (s->tlsext_hostname != NULL) ssl2_compat = 0; if (s->tlsext_status_type != -1) ssl2_compat = 0; # ifdef TLSEXT_TYPE_opaque_prf_input if (s->ctx->tlsext_opaque_prf_input_callback != 0 || s->tlsext_opaque_prf_input != NULL) ssl2_compat = 0; # endif if (s->cert->cli_ext.meths_count != 0) ssl2_compat = 0; } #endif buf = (unsigned char *)s->init_buf->data; if (s->state == SSL23_ST_CW_CLNT_HELLO_A) { /* * Since we're sending s23 client hello, we're not reusing a session, as * we'd be using the method from the saved session instead */ if (!ssl_get_new_session(s, 0)) { return -1; } p = s->s3->client_random; if (ssl_fill_hello_random(s, 0, p, SSL3_RANDOM_SIZE) <= 0) return -1; if (version == TLS1_2_VERSION) { version_major = TLS1_2_VERSION_MAJOR; version_minor = TLS1_2_VERSION_MINOR; } else if (tls1_suiteb(s)) { SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE); return -1; } else if (version == TLS1_1_VERSION) { version_major = TLS1_1_VERSION_MAJOR; version_minor = TLS1_1_VERSION_MINOR; } else if (version == TLS1_VERSION) { version_major = TLS1_VERSION_MAJOR; version_minor = TLS1_VERSION_MINOR; } #ifdef OPENSSL_FIPS else if (FIPS_mode()) { SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); return -1; } #endif else if (version == SSL3_VERSION) { version_major = SSL3_VERSION_MAJOR; version_minor = SSL3_VERSION_MINOR; } else if (version == SSL2_VERSION) { version_major = SSL2_VERSION_MAJOR; version_minor = SSL2_VERSION_MINOR; } else { SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_NO_PROTOCOLS_AVAILABLE); return (-1); } s->client_version = version; if (ssl2_compat) { /* create SSL 2.0 compatible Client Hello */ /* two byte record header will be written last */ d = &(buf[2]); p = d + 9; /* leave space for message type, version, * individual length fields */ *(d++) = SSL2_MT_CLIENT_HELLO; *(d++) = version_major; *(d++) = version_minor; /* Ciphers supported */ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), p, 0); if (i == 0) { /* no ciphers */ SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_NO_CIPHERS_AVAILABLE); return -1; } s2n(i, d); p += i; /* * put in the session-id length (zero since there is no reuse) */ s2n(0, d); if (s->options & SSL_OP_NETSCAPE_CHALLENGE_BUG) ch_len = SSL2_CHALLENGE_LENGTH; else ch_len = SSL2_MAX_CHALLENGE_LENGTH; /* write out sslv2 challenge */ /* * Note that ch_len must be <= SSL3_RANDOM_SIZE (32), because it * is one of SSL2_MAX_CHALLENGE_LENGTH (32) or * SSL2_MAX_CHALLENGE_LENGTH (16), but leave the check in for * futurproofing */ if (SSL3_RANDOM_SIZE < ch_len) i = SSL3_RANDOM_SIZE; else i = ch_len; s2n(i, d); memset(&(s->s3->client_random[0]), 0, SSL3_RANDOM_SIZE); if (RAND_bytes (&(s->s3->client_random[SSL3_RANDOM_SIZE - i]), i) <= 0) return -1; memcpy(p, &(s->s3->client_random[SSL3_RANDOM_SIZE - i]), i); p += i; i = p - &(buf[2]); buf[0] = ((i >> 8) & 0xff) | 0x80; buf[1] = (i & 0xff); /* number of bytes to write */ s->init_num = i + 2; s->init_off = 0; ssl3_finish_mac(s, &(buf[2]), i); } else { /* create Client Hello in SSL 3.0/TLS 1.0 format */ /* * do the record header (5 bytes) and handshake message header (4 * bytes) last */ d = p = &(buf[9]); *(p++) = version_major; *(p++) = version_minor; /* Random stuff */ memcpy(p, s->s3->client_random, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; /* Session ID (zero since there is no reuse) */ *(p++) = 0; /* Ciphers supported (using SSL 3.0/TLS 1.0 format) */ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), ssl3_put_cipher_by_char); if (i == 0) { SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_NO_CIPHERS_AVAILABLE); return -1; } #ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH /* * Some servers hang if client hello > 256 bytes as hack * workaround chop number of supported ciphers to keep it well * below this if we use TLS v1.2 */ if (TLS1_get_version(s) >= TLS1_2_VERSION && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH) i = OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1; #endif s2n(i, p); p += i; /* COMPRESSION */ #ifdef OPENSSL_NO_COMP *(p++) = 1; #else if ((s->options & SSL_OP_NO_COMPRESSION) || !s->ctx->comp_methods) j = 0; else j = sk_SSL_COMP_num(s->ctx->comp_methods); *(p++) = 1 + j; for (i = 0; i < j; i++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, i); *(p++) = comp->id; } #endif *(p++) = 0; /* Add the NULL method */ #ifndef OPENSSL_NO_TLSEXT /* TLS extensions */ if (ssl_prepare_clienthello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL23_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); return -1; } if ((p = ssl_add_clienthello_tlsext(s, p, buf + SSL3_RT_MAX_PLAIN_LENGTH, &al)) == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, al); SSLerr(SSL_F_SSL23_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); return -1; } #endif l = p - d; /* fill in 4-byte handshake header */ d = &(buf[5]); *(d++) = SSL3_MT_CLIENT_HELLO; l2n3(l, d); l += 4; if (l > SSL3_RT_MAX_PLAIN_LENGTH) { SSLerr(SSL_F_SSL23_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); return -1; } /* fill in 5-byte record header */ d = buf; *(d++) = SSL3_RT_HANDSHAKE; *(d++) = version_major; /* * Some servers hang if we use long client hellos and a record * number > TLS 1.0. */ if (TLS1_get_client_version(s) > TLS1_VERSION) *(d++) = 1; else *(d++) = version_minor; s2n((int)l, d); /* number of bytes to write */ s->init_num = p - buf; s->init_off = 0; ssl3_finish_mac(s, &(buf[5]), s->init_num - 5); } s->state = SSL23_ST_CW_CLNT_HELLO_B; s->init_off = 0; } /* SSL3_ST_CW_CLNT_HELLO_B */ ret = ssl23_write_bytes(s); if ((ret >= 2) && s->msg_callback) { /* Client Hello has been sent; tell msg_callback */ if (ssl2_compat) s->msg_callback(1, SSL2_VERSION, 0, s->init_buf->data + 2, ret - 2, s, s->msg_callback_arg); else { s->msg_callback(1, version, SSL3_RT_HEADER, s->init_buf->data, 5, s, s->msg_callback_arg); s->msg_callback(1, version, SSL3_RT_HANDSHAKE, s->init_buf->data + 5, ret - 5, s, s->msg_callback_arg); } } return ret; } static int ssl23_get_server_hello(SSL *s) { char buf[8]; unsigned char *p; int i; int n; n = ssl23_read_bytes(s, 7); if (n != 7) return (n); p = s->packet; memcpy(buf, p, n); if ((p[0] & 0x80) && (p[2] == SSL2_MT_SERVER_HELLO) && (p[5] == 0x00) && (p[6] == 0x02)) { #ifdef OPENSSL_NO_SSL2 SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_PROTOCOL); goto err; #else /* we are talking sslv2 */ /* * we need to clean up the SSLv3 setup and put in the sslv2 stuff. */ int ch_len; if (s->options & SSL_OP_NO_SSLv2) { SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_PROTOCOL); goto err; } if (s->s2 == NULL) { if (!ssl2_new(s)) goto err; } else ssl2_clear(s); if (s->options & SSL_OP_NETSCAPE_CHALLENGE_BUG) ch_len = SSL2_CHALLENGE_LENGTH; else ch_len = SSL2_MAX_CHALLENGE_LENGTH; /* write out sslv2 challenge */ /* * Note that ch_len must be <= SSL3_RANDOM_SIZE (32), because it is * one of SSL2_MAX_CHALLENGE_LENGTH (32) or SSL2_MAX_CHALLENGE_LENGTH * (16), but leave the check in for futurproofing */ i = (SSL3_RANDOM_SIZE < ch_len) ? SSL3_RANDOM_SIZE : ch_len; s->s2->challenge_length = i; memcpy(s->s2->challenge, &(s->s3->client_random[SSL3_RANDOM_SIZE - i]), i); if (s->s3 != NULL) ssl3_free(s); if (!BUF_MEM_grow_clean(s->init_buf, SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER)) { SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, ERR_R_BUF_LIB); goto err; } s->state = SSL2_ST_GET_SERVER_HELLO_A; if (!(s->client_version == SSL2_VERSION)) /* * use special padding (SSL 3.0 draft/RFC 2246, App. E.2) */ s->s2->ssl2_rollback = 1; /* * setup the 7 bytes we have read so we get them from the sslv2 * buffer */ s->rstate = SSL_ST_READ_HEADER; s->packet_length = n; s->packet = &(s->s2->rbuf[0]); memcpy(s->packet, buf, n); s->s2->rbuf_left = n; s->s2->rbuf_offs = 0; /* we have already written one */ s->s2->write_sequence = 1; s->method = SSLv2_client_method(); s->handshake_func = s->method->ssl_connect; #endif } else if (p[1] == SSL3_VERSION_MAJOR && p[2] <= TLS1_2_VERSION_MINOR && ((p[0] == SSL3_RT_HANDSHAKE && p[5] == SSL3_MT_SERVER_HELLO) || (p[0] == SSL3_RT_ALERT && p[3] == 0 && p[4] == 2))) { /* we have sslv3 or tls1 (server hello or alert) */ #ifndef OPENSSL_NO_SSL3 if ((p[2] == SSL3_VERSION_MINOR) && !(s->options & SSL_OP_NO_SSLv3)) { # ifdef OPENSSL_FIPS if (FIPS_mode()) { SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); goto err; } # endif s->version = SSL3_VERSION; s->method = SSLv3_client_method(); } else #endif if ((p[2] == TLS1_VERSION_MINOR) && !(s->options & SSL_OP_NO_TLSv1)) { s->version = TLS1_VERSION; s->method = TLSv1_client_method(); } else if ((p[2] == TLS1_1_VERSION_MINOR) && !(s->options & SSL_OP_NO_TLSv1_1)) { s->version = TLS1_1_VERSION; s->method = TLSv1_1_client_method(); } else if ((p[2] == TLS1_2_VERSION_MINOR) && !(s->options & SSL_OP_NO_TLSv1_2)) { s->version = TLS1_2_VERSION; s->method = TLSv1_2_client_method(); } else { /* * Unrecognised version, we'll send a protocol version alert using * our preferred version. */ switch(s->client_version) { default: /* * Shouldn't happen * Fall through */ case TLS1_2_VERSION: s->version = TLS1_2_VERSION; s->method = TLSv1_2_client_method(); break; case TLS1_1_VERSION: s->version = TLS1_1_VERSION; s->method = TLSv1_1_client_method(); break; case TLS1_VERSION: s->version = TLS1_VERSION; s->method = TLSv1_client_method(); break; +#ifndef OPENSSL_NO_SSL3 case SSL3_VERSION: s->version = SSL3_VERSION; s->method = SSLv3_client_method(); break; +#endif } SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_PROTOCOL); ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_PROTOCOL_VERSION); goto err; } s->session->ssl_version = s->version; /* ensure that TLS_MAX_VERSION is up-to-date */ OPENSSL_assert(s->version <= TLS_MAX_VERSION); if (p[0] == SSL3_RT_ALERT && p[5] != SSL3_AL_WARNING) { /* fatal alert */ void (*cb) (const SSL *ssl, int type, int val) = NULL; int j; if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; i = p[5]; if (cb != NULL) { j = (i << 8) | p[6]; cb(s, SSL_CB_READ_ALERT, j); } if (s->msg_callback) { s->msg_callback(0, s->version, SSL3_RT_HEADER, p, 5, s, s->msg_callback_arg); s->msg_callback(0, s->version, SSL3_RT_ALERT, p + 5, 2, s, s->msg_callback_arg); } s->rwstate = SSL_NOTHING; SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_AD_REASON_OFFSET + p[6]); goto err; } if (!ssl_init_wbio_buffer(s, 1)) goto err; /* we are in this state */ s->state = SSL3_ST_CR_SRVR_HELLO_A; /* * put the 7 bytes we have read into the input buffer for SSLv3 */ s->rstate = SSL_ST_READ_HEADER; s->packet_length = n; if (s->s3->rbuf.buf == NULL) if (!ssl3_setup_read_buffer(s)) goto err; s->packet = &(s->s3->rbuf.buf[0]); memcpy(s->packet, buf, n); s->s3->rbuf.left = n; s->s3->rbuf.offset = 0; s->handshake_func = s->method->ssl_connect; } else { SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_UNKNOWN_PROTOCOL); goto err; } s->init_num = 0; return (SSL_connect(s)); err: return (-1); } diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 04212c51e726..b91456843041 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -1,1767 +1,1773 @@ /* ssl/s3_pkt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #include #define USE_SOCKETS #include "ssl_locl.h" #include #include #include #ifndef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK # define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0 #endif #if defined(OPENSSL_SMALL_FOOTPRINT) || \ !( defined(AES_ASM) && ( \ defined(__x86_64) || defined(__x86_64__) || \ defined(_M_AMD64) || defined(_M_X64) || \ defined(__INTEL__) ) \ ) # undef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK # define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0 #endif static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); static int ssl3_get_record(SSL *s); /* * Return values are as per SSL_read() */ int ssl3_read_n(SSL *s, int n, int max, int extend) { /* * If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. The packet will be in the sub-array of * s->s3->rbuf.buf specified by s->packet and s->packet_length. (If * s->read_ahead is set, 'max' bytes may be stored in rbuf [plus * s->packet_length bytes if extend == 1].) */ int i, len, left; long align = 0; unsigned char *pkt; SSL3_BUFFER *rb; if (n <= 0) return n; rb = &(s->s3->rbuf); if (rb->buf == NULL) if (!ssl3_setup_read_buffer(s)) return -1; left = rb->left; #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 align = (long)rb->buf + SSL3_RT_HEADER_LENGTH; align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif if (!extend) { /* start with empty packet ... */ if (left == 0) rb->offset = align; else if (align != 0 && left >= SSL3_RT_HEADER_LENGTH) { /* * check if next packet length is large enough to justify payload * alignment... */ pkt = rb->buf + rb->offset; if (pkt[0] == SSL3_RT_APPLICATION_DATA && (pkt[3] << 8 | pkt[4]) >= 128) { /* * Note that even if packet is corrupted and its length field * is insane, we can only be led to wrong decision about * whether memmove will occur or not. Header values has no * effect on memmove arguments and therefore no buffer * overrun can be triggered. */ memmove(rb->buf + align, pkt, left); rb->offset = align; } } s->packet = rb->buf + rb->offset; s->packet_length = 0; /* ... now we can act as if 'extend' was set */ } /* * For DTLS/UDP reads should not span multiple packets because the read * operation returns the whole packet at once (as long as it fits into * the buffer). */ if (SSL_IS_DTLS(s)) { if (left == 0 && extend) return 0; if (left > 0 && n > left) n = left; } /* if there is enough in the buffer from a previous read, take some */ if (left >= n) { s->packet_length += n; rb->left = left - n; rb->offset += n; return (n); } /* else we need to read more data */ len = s->packet_length; pkt = rb->buf + align; /* * Move any available bytes to front of buffer: 'len' bytes already * pointed to by 'packet', 'left' extra ones at the end */ if (s->packet != pkt) { /* len > 0 */ memmove(pkt, s->packet, len + left); s->packet = pkt; rb->offset = len + align; } if (n > (int)(rb->len - rb->offset)) { /* does not happen */ SSLerr(SSL_F_SSL3_READ_N, ERR_R_INTERNAL_ERROR); return -1; } /* We always act like read_ahead is set for DTLS */ if (!s->read_ahead && !SSL_IS_DTLS(s)) /* ignore max parameter */ max = n; else { if (max < n) max = n; if (max > (int)(rb->len - rb->offset)) max = rb->len - rb->offset; } while (left < n) { /* * Now we have len+left bytes at the front of s->s3->rbuf.buf and * need to read in more until we have len+n (up to len+max if * possible) */ clear_sys_error(); if (s->rbio != NULL) { s->rwstate = SSL_READING; i = BIO_read(s->rbio, pkt + len + left, max - left); } else { SSLerr(SSL_F_SSL3_READ_N, SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { rb->left = left; if (s->mode & SSL_MODE_RELEASE_BUFFERS && !SSL_IS_DTLS(s)) if (len + left == 0) ssl3_release_read_buffer(s); return (i); } left += i; /* * reads should *never* span multiple packets for DTLS because the * underlying transport protocol is message oriented as opposed to * byte oriented as in the TLS case. */ if (SSL_IS_DTLS(s)) { if (n > left) n = left; /* makes the while condition false */ } } /* done reading, now the book-keeping */ rb->offset += n; rb->left = left - n; s->packet_length += n; s->rwstate = SSL_NOTHING; return (n); } /* * MAX_EMPTY_RECORDS defines the number of consecutive, empty records that * will be processed per call to ssl3_get_record. Without this limit an * attacker could send empty records at a faster rate than we can process and * cause ssl3_get_record to loop forever. */ #define MAX_EMPTY_RECORDS 32 /*- * Call this to get a new input record. * It will return <= 0 if more data is needed, normally due to an error * or non-blocking IO. * When it finishes, one packet has been decoded and can be found in * ssl->s3->rrec.type - is the type of record * ssl->s3->rrec.data, - data * ssl->s3->rrec.length, - number of bytes */ /* used only by ssl3_read_bytes */ static int ssl3_get_record(SSL *s) { int ssl_major, ssl_minor, al; int enc_err, n, i, ret = -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned mac_size, orig_len; size_t extra; unsigned empty_record_count = 0; rr = &(s->s3->rrec); sess = s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra = SSL3_RT_MAX_EXTRA; else extra = 0; if (extra && !s->s3->init_extra) { /* * An application error: SLS_OP_MICROSOFT_BIG_SSLV3_BUFFER set after * ssl3_setup_buffers() was done */ SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR); return -1; } again: /* check if we have the header */ if ((s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return (n); /* error or non-blocking */ s->rstate = SSL_ST_READ_BODY; p = s->packet; if (s->msg_callback) s->msg_callback(0, 0, SSL3_RT_HEADER, p, 5, s, s->msg_callback_arg); /* Pull apart the header into the SSL3_RECORD */ rr->type = *(p++); ssl_major = *(p++); ssl_minor = *(p++); version = (ssl_major << 8) | ssl_minor; n2s(p, rr->length); #if 0 fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length); #endif /* Lets check version */ if (!s->first_packet) { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_WRONG_VERSION_NUMBER); if ((s->version & 0xFF00) == (version & 0xFF00) && !s->enc_write_ctx && !s->write_hash) { if (rr->type == SSL3_RT_ALERT) { /* * The record is using an incorrect version number, but * what we've got appears to be an alert. We haven't * read the body yet to check whether its a fatal or * not - but chances are it is. We probably shouldn't * send a fatal alert back. We'll just end. */ goto err; } /* * Send back error using their minor version number :-) */ s->version = (unsigned short)version; } al = SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version >> 8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH) { al = SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length - SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i = rr->length; n = ssl3_read_n(s, i, i, 1); if (n <= 0) return (n); /* error or non-blocking io */ /* * now n == rr->length, and s->packet_length == SSL3_RT_HEADER_LENGTH * + rr->length */ } s->rstate = SSL_ST_READ_HEADER; /* set state for later operations */ /* * At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input = &(s->packet[SSL3_RT_HEADER_LENGTH]); /* * ok, we can now read from 's->packet' data into 'rr' rr->input points * at rr->length bytes, which need to be copied into rr->data by either * the decryption or by the decompression When the data is 'copied' into * the rr->data buffer, rr->input will be pointed at the new buffer */ /* * We now have - encrypted [ MAC [ compressed [ plain ] ] ] rr->length * bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH + extra) { al = SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data = rr->input; enc_err = s->method->ssl3_enc->enc(s, 0); /*- * enc_err is: * 0: (in non-constant time) if the record is publically invalid. * 1: if the padding is valid * -1: if the padding is invalid */ if (enc_err == 0) { al = SSL_AD_DECRYPTION_FAILED; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); goto f_err; } #ifdef TLS_DEBUG printf("dec %d\n", rr->length); { unsigned int z; for (z = 0; z < rr->length; z++) printf("%02X%c", rr->data[z], ((z + 1) % 16) ? ' ' : '\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ((sess != NULL) && (s->enc_read_ctx != NULL) && (EVP_MD_CTX_md(s->read_hash) != NULL)) { /* s->read_hash != NULL => mac_size != -1 */ unsigned char *mac = NULL; unsigned char mac_tmp[EVP_MAX_MD_SIZE]; mac_size = EVP_MD_CTX_size(s->read_hash); OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE); /* * kludge: *_cbc_remove_padding passes padding length in rr->type */ orig_len = rr->length + ((unsigned int)rr->type >> 8); /* * orig_len is the length of the record before any padding was * removed. This is public information, as is the MAC in use, * therefore we can safely process the record in a different amount * of time if it's too short to possibly contain a MAC. */ if (orig_len < mac_size || /* CBC records must have a padding length byte too. */ (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE && orig_len < mac_size + 1)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_LENGTH_TOO_SHORT); goto f_err; } if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) { /* * We update the length so that the TLS header bytes can be * constructed correctly but we need to extract the MAC in * constant time from within the record, without leaking the * contents of the padding bytes. */ mac = mac_tmp; ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len); rr->length -= mac_size; } else { /* * In this case there's no padding, so |orig_len| equals * |rec->length| and we checked that there's enough bytes for * |mac_size| above. */ rr->length -= mac_size; mac = &rr->data[rr->length]; } i = s->method->ssl3_enc->mac(s, md, 0 /* not send */ ); if (i < 0 || mac == NULL || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0) enc_err = -1; if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + extra + mac_size) enc_err = -1; } if (enc_err < 0) { /* * A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, we should * not reveal which kind of error occured -- this might become * visible to an attacker (e.g. via a logfile) */ al = SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + extra) { al = SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!ssl3_do_uncompress(s)) { al = SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH + extra) { al = SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off = 0; /*- * So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length = 0; /* just read a 0 length packet */ if (rr->length == 0) { empty_record_count++; if (empty_record_count > MAX_EMPTY_RECORDS) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_RECORD_TOO_SMALL); goto f_err; } goto again; } #if 0 fprintf(stderr, "Ultimate Record type=%d, Length=%d\n", rr->type, rr->length); #endif return (1); f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: return (ret); } int ssl3_do_uncompress(SSL *ssl) { #ifndef OPENSSL_NO_COMP int i; SSL3_RECORD *rr; rr = &(ssl->s3->rrec); i = COMP_expand_block(ssl->expand, rr->comp, SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length); if (i < 0) return (0); else rr->length = i; rr->data = rr->comp; #endif return (1); } int ssl3_do_compress(SSL *ssl) { #ifndef OPENSSL_NO_COMP int i; SSL3_RECORD *wr; wr = &(ssl->s3->wrec); i = COMP_compress_block(ssl->compress, wr->data, SSL3_RT_MAX_COMPRESSED_LENGTH, wr->input, (int)wr->length); if (i < 0) return (0); else wr->length = i; wr->input = wr->data; #endif return (1); } /* * Call this to write data in records of type 'type' It will return <= 0 if * not all data has been sent or non-blocking IO. */ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf = buf_; int tot; unsigned int n, nw; #if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK unsigned int max_send_fragment; #endif SSL3_BUFFER *wb = &(s->s3->wbuf); int i; s->rwstate = SSL_NOTHING; OPENSSL_assert(s->s3->wnum <= INT_MAX); tot = s->s3->wnum; s->s3->wnum = 0; if (SSL_in_init(s) && !s->in_handshake) { i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return -1; } } /* * ensure that if we end up with a smaller value of data to write out * than the the original len from a write which didn't complete for * non-blocking I/O and also somehow ended up avoiding the check for * this in ssl3_write_pending/SSL_R_BAD_WRITE_RETRY as it must never be * possible to end up with (len-tot) as a large number that will then * promptly send beyond the end of the users buffer ... so we trap and * report the error in a way the user will notice */ if ((len < tot) || ((wb->left != 0) && (len < (tot + s->s3->wpend_tot)))) { SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH); return (-1); } /* * first check if there is a SSL3_BUFFER still being written out. This * will happen with non blocking IO */ if (wb->left != 0) { i = ssl3_write_pending(s, type, &buf[tot], s->s3->wpend_tot); if (i <= 0) { /* XXX should we ssl3_release_write_buffer if i<0? */ s->s3->wnum = tot; return i; } tot += i; /* this might be last fragment */ } #if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK /* * Depending on platform multi-block can deliver several *times* * better performance. Downside is that it has to allocate * jumbo buffer to accomodate up to 8 records, but the * compromise is considered worthy. */ if (type == SSL3_RT_APPLICATION_DATA && len >= 4 * (int)(max_send_fragment = s->max_send_fragment) && s->compress == NULL && s->msg_callback == NULL && SSL_USE_EXPLICIT_IV(s) && s->enc_write_ctx != NULL && EVP_CIPHER_flags(s->enc_write_ctx->cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK) { unsigned char aad[13]; EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param; int packlen; /* minimize address aliasing conflicts */ if ((max_send_fragment & 0xfff) == 0) max_send_fragment -= 512; if (tot == 0 || wb->buf == NULL) { /* allocate jumbo buffer */ ssl3_release_write_buffer(s); packlen = EVP_CIPHER_CTX_ctrl(s->enc_write_ctx, EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE, max_send_fragment, NULL); if (len >= 8 * (int)max_send_fragment) packlen *= 8; else packlen *= 4; wb->buf = OPENSSL_malloc(packlen); if (!wb->buf) { SSLerr(SSL_F_SSL3_WRITE_BYTES, ERR_R_MALLOC_FAILURE); return -1; } wb->len = packlen; } else if (tot == len) { /* done? */ OPENSSL_free(wb->buf); /* free jumbo buffer */ wb->buf = NULL; return tot; } n = (len - tot); for (;;) { if (n < 4 * max_send_fragment) { OPENSSL_free(wb->buf); /* free jumbo buffer */ wb->buf = NULL; break; } if (s->s3->alert_dispatch) { i = s->method->ssl_dispatch_alert(s); if (i <= 0) { s->s3->wnum = tot; return i; } } if (n >= 8 * max_send_fragment) nw = max_send_fragment * (mb_param.interleave = 8); else nw = max_send_fragment * (mb_param.interleave = 4); memcpy(aad, s->s3->write_sequence, 8); aad[8] = type; aad[9] = (unsigned char)(s->version >> 8); aad[10] = (unsigned char)(s->version); aad[11] = 0; aad[12] = 0; mb_param.out = NULL; mb_param.inp = aad; mb_param.len = nw; packlen = EVP_CIPHER_CTX_ctrl(s->enc_write_ctx, EVP_CTRL_TLS1_1_MULTIBLOCK_AAD, sizeof(mb_param), &mb_param); if (packlen <= 0 || packlen > (int)wb->len) { /* never happens */ OPENSSL_free(wb->buf); /* free jumbo buffer */ wb->buf = NULL; break; } mb_param.out = wb->buf; mb_param.inp = &buf[tot]; mb_param.len = nw; if (EVP_CIPHER_CTX_ctrl(s->enc_write_ctx, EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT, sizeof(mb_param), &mb_param) <= 0) return -1; s->s3->write_sequence[7] += mb_param.interleave; if (s->s3->write_sequence[7] < mb_param.interleave) { int j = 6; while (j >= 0 && (++s->s3->write_sequence[j--]) == 0) ; } wb->offset = 0; wb->left = packlen; s->s3->wpend_tot = nw; s->s3->wpend_buf = &buf[tot]; s->s3->wpend_type = type; s->s3->wpend_ret = nw; i = ssl3_write_pending(s, type, &buf[tot], nw); if (i <= 0) { if (i < 0 && (!s->wbio || !BIO_should_retry(s->wbio))) { OPENSSL_free(wb->buf); wb->buf = NULL; } s->s3->wnum = tot; return i; } if (i == (int)n) { OPENSSL_free(wb->buf); /* free jumbo buffer */ wb->buf = NULL; return tot + i; } n -= i; tot += i; } } else #endif if (tot == len) { /* done? */ if (s->mode & SSL_MODE_RELEASE_BUFFERS && !SSL_IS_DTLS(s)) ssl3_release_write_buffer(s); return tot; } n = (len - tot); for (;;) { if (n > s->max_send_fragment) nw = s->max_send_fragment; else nw = n; i = do_ssl3_write(s, type, &(buf[tot]), nw, 0); if (i <= 0) { /* XXX should we ssl3_release_write_buffer if i<0? */ s->s3->wnum = tot; return i; } if ((i == (int)n) || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* * next chunk of data should get another prepended empty fragment * in ciphersuites with known-IV weakness: */ s->s3->empty_fragment_done = 0; if ((i == (int)n) && s->mode & SSL_MODE_RELEASE_BUFFERS && !SSL_IS_DTLS(s)) ssl3_release_write_buffer(s); return tot + i; } n -= i; tot += i; } } static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p, *plen; int i, mac_size, clear = 0; int prefix_len = 0; int eivlen; long align = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb = &(s->s3->wbuf); SSL_SESSION *sess; /* * first check if there is a SSL3_BUFFER still being written out. This * will happen with non blocking IO */ if (wb->left != 0) return (ssl3_write_pending(s, type, buf, len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i = s->method->ssl_dispatch_alert(s); if (i <= 0) return (i); /* if it went, fall through and send more stuff */ } if (wb->buf == NULL) if (!ssl3_setup_write_buffer(s)) return -1; if (len == 0 && !create_empty_fragment) return 0; wr = &(s->s3->wrec); sess = s->session; if ((sess == NULL) || (s->enc_write_ctx == NULL) || (EVP_MD_CTX_md(s->write_hash) == NULL)) { #if 1 clear = s->enc_write_ctx ? 0 : 1; /* must be AEAD cipher */ #else clear = 1; #endif mac_size = 0; } else { mac_size = EVP_MD_CTX_size(s->write_hash); if (mac_size < 0) goto err; } /* * 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* * countermeasure against known-IV weakness in CBC ciphersuites (see * http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* * recursive function call with 'create_empty_fragment' set; this * prepares and buffers the data for an empty fragment (these * 'prefix_len' bytes are sent out later together with the actual * payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (prefix_len > (SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD)) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } if (create_empty_fragment) { #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 /* * extra fragment would be couple of cipher blocks, which would be * multiple of SSL3_ALIGN_PAYLOAD, so if we want to align the real * payload, then we can just pretent we simply have two headers. */ align = (long)wb->buf + 2 * SSL3_RT_HEADER_LENGTH; align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = wb->buf + align; wb->offset = align; } else if (prefix_len) { p = wb->buf + wb->offset + prefix_len; } else { #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 align = (long)wb->buf + SSL3_RT_HEADER_LENGTH; align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = wb->buf + align; wb->offset = align; } /* write the header */ *(p++) = type & 0xff; wr->type = type; *(p++) = (s->version >> 8); /* * Some servers hang if iniatial client hello is larger than 256 bytes * and record version number > TLS 1.0 */ if (s->state == SSL3_ST_CW_CLNT_HELLO_B && !s->renegotiate && TLS1_get_version(s) > TLS1_VERSION) *(p++) = 0x1; else *(p++) = s->version & 0xff; /* field where we are to write out packet length */ plen = p; p += 2; /* Explicit IV length, block ciphers appropriate version flag */ if (s->enc_write_ctx && SSL_USE_EXPLICIT_IV(s)) { int mode = EVP_CIPHER_CTX_mode(s->enc_write_ctx); if (mode == EVP_CIPH_CBC_MODE) { eivlen = EVP_CIPHER_CTX_iv_length(s->enc_write_ctx); if (eivlen <= 1) eivlen = 0; } /* Need explicit part of IV for GCM mode */ else if (mode == EVP_CIPH_GCM_MODE) eivlen = EVP_GCM_TLS_EXPLICIT_IV_LEN; else eivlen = 0; } else eivlen = 0; /* lets setup the record stuff. */ wr->data = p + eivlen; wr->length = (int)len; wr->input = (unsigned char *)buf; /* * we now 'read' from wr->input, wr->length bytes into wr->data */ /* first we compress */ if (s->compress != NULL) { if (!ssl3_do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE, SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data, wr->input, wr->length); wr->input = wr->data; } /* * we should still have the output to wr->data and the input from * wr->input. Length should be wr->length. wr->data still points in the * wb->buf */ if (mac_size != 0) { if (s->method->ssl3_enc->mac(s, &(p[wr->length + eivlen]), 1) < 0) goto err; wr->length += mac_size; } wr->input = p; wr->data = p; if (eivlen) { /* * if (RAND_pseudo_bytes(p, eivlen) <= 0) goto err; */ wr->length += eivlen; } if (s->method->ssl3_enc->enc(s, 1) < 1) goto err; /* record length after mac and block padding */ s2n(wr->length, plen); if (s->msg_callback) s->msg_callback(1, 0, SSL3_RT_HEADER, plen - 5, 5, s, s->msg_callback_arg); /* * we should now have wr->data pointing to the encrypted data, which is * wr->length long */ wr->type = type; /* not needed but helps for debugging */ wr->length += SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* * we are in a recursive call; just return the length, don't write * out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; /* * memorize arguments so that ssl3_write_pending can detect bad write * retries later */ s->s3->wpend_tot = len; s->s3->wpend_buf = buf; s->s3->wpend_type = type; s->s3->wpend_ret = len; /* we now just need to write the buffer */ return ssl3_write_pending(s, type, buf, len); err: return -1; } /* if s->s3->wbuf.left != 0, we need to call this * * Return values are as per SSL_write(), i.e. */ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; SSL3_BUFFER *wb = &(s->s3->wbuf); /* XXXX */ if ((s->s3->wpend_tot > (int)len) || ((s->s3->wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->s3->wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return (-1); } for (;;) { clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *)&(wb->buf[wb->offset]), (unsigned int)wb->left); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i == wb->left) { wb->left = 0; wb->offset += i; s->rwstate = SSL_NOTHING; return (s->s3->wpend_ret); } else if (i <= 0) { if (SSL_IS_DTLS(s)) { /* * For DTLS, just drop it. That's kind of the whole point in * using a datagram service */ wb->left = 0; } return i; } wb->offset += i; wb->left -= i; } } /*- * Return up to 'len' payload bytes received in 'type' records. * 'type' is one of the following: * * - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us) * - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us) * - 0 (during a shutdown, no data has to be returned) * * If we don't have stored data to work from, read a SSL/TLS record first * (possibly multiple records if we still don't have anything to return). * * This function must handle any surprises the peer may have for us, such as * Alert records (e.g. close_notify), ChangeCipherSpec records (not really * a surprise, but handled as if it were), or renegotiation requests. * Also if record payloads contain fragments too small to process, we store * them until there is enough for the respective protocol (the record protocol * may use arbitrary fragmentation and even interleaving): * Change cipher spec protocol * just 1 byte needed, no need for keeping anything stored * Alert protocol * 2 bytes needed (AlertLevel, AlertDescription) * Handshake protocol * 4 bytes needed (HandshakeType, uint24 length) -- we just have * to detect unexpected Client Hello and Hello Request messages * here, anything else is handled by higher layers * Application data protocol * none of our business */ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) { int al, i, j, ret; unsigned int n; SSL3_RECORD *rr; void (*cb) (const SSL *ssl, int type2, int val) = NULL; if (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_read_buffer(s)) return (-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE)) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* * Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } } start: s->rwstate = SSL_NOTHING; /*- * s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = &(s->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret = ssl3_get_record(s); if (ret <= 0) return (ret); } /* * Reset the count of consecutive warning alerts if we've got a non-empty * record that isn't an alert. */ if (rr->type != SSL3_RT_ALERT && rr->length != 0) s->cert->alert_count = 0; /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto f_err; } /* * If the other end has shut down, throw anything we read away (even in * 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length = 0; s->rwstate = SSL_NOTHING; return (0); } if (type == rr->type) { /* SSL3_RT_APPLICATION_DATA or * SSL3_RT_HANDSHAKE */ /* * make sure that we are not getting application data when we are * doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return (len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf, &(rr->data[rr->off]), n); if (!peek) { rr->length -= n; rr->off += n; if (rr->length == 0) { s->rstate = SSL_ST_READ_HEADER; rr->off = 0; if (s->mode & SSL_MODE_RELEASE_BUFFERS && s->s3->rbuf.left == 0) ssl3_release_read_buffer(s); } } return (n); } /* * If we get here, then type != rr->type; if we have a handshake message, * then it was unexpected (Hello Request or Client Hello). */ /* * In case of record types for which we have 'fragment' storage, fill * that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } #ifndef OPENSSL_NO_HEARTBEATS else if (rr->type == TLS1_RT_HEARTBEAT) { - tls1_process_heartbeat(s); + i = tls1_process_heartbeat(s); + + if (i < 0) + return i; - /* Exit and notify application to read again */ rr->length = 0; + if (s->mode & SSL_MODE_AUTO_RETRY) + goto start; + + /* Exit and notify application to read again */ s->rwstate = SSL_READING; BIO_clear_retry_flags(SSL_get_rbio(s)); BIO_set_retry_read(SSL_get_rbio(s)); return (-1); } #endif if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /*- * s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_BAD_HELLO_REQUEST); goto f_err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } } } /* * we either finished a handshake or ignored the request, now try * again to obtain the (application) data we were asked for */ goto start; } /* * If we are a server and get a client hello when renegotiation isn't * allowed send back a no renegotiation alert and carry on. WARNING: * experimental code, needs reviewing (steve) */ if (s->server && SSL_is_init_finished(s) && !s->s3->send_connection_binding && (s->version > SSL3_VERSION) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_CLIENT_HELLO) && (s->session != NULL) && (s->session->cipher != NULL) && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { /* * s->s3->handshake_fragment_len = 0; */ rr->length = 0; ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_NO_RENEGOTIATION); goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == SSL3_AL_WARNING) { s->s3->warn_alert = alert_descr; s->cert->alert_count++; if (s->cert->alert_count == MAX_WARN_ALERT_COUNT) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); goto f_err; } if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return (0); } /* * This is a warning but we receive it if we requested * renegotiation and the peer denied it. Terminate with a fatal * alert because if application tried to renegotiatie it * presumably had a good reason and expects it to succeed. In * future we might have a renegotiation where we don't care if * the peer refused it where we carry on. */ else if (alert_descr == SSL_AD_NO_RENEGOTIATION) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_NO_RENEGOTIATION); goto f_err; } #ifdef SSL_AD_MISSING_SRP_USERNAME else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) return (0); #endif } else if (alert_level == SSL3_AL_FATAL) { char tmp[16]; s->rwstate = SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr); ERR_add_error_data(2, "SSL alert number ", tmp); s->shutdown |= SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->session_ctx, s->session); return (0); } else { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) { /* but we have not received a * shutdown */ s->rwstate = SSL_NOTHING; rr->length = 0; return (0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* * 'Change Cipher Spec' is just a single byte, so we know exactly * what the record payload has to look like */ if ((rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_BAD_CHANGE_CIPHER_SPEC); goto f_err; } /* Check we have a cipher to change to */ if (s->s3->tmp.new_cipher == NULL) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } if (!(s->s3->flags & SSL3_FLAGS_CCS_OK)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } s->s3->flags &= ~SSL3_FLAGS_CCS_OK; rr->length = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec = 1; if (!ssl3_do_change_cipher_spec(s)) goto err; else goto start; } /* * Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state & SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences * are not as expected (and because this is * not really needed for clients except for * detecting protocol violations): */ s->state = SSL_ST_BEFORE | (s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->renegotiate = 1; s->new_session = 1; } i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, but we * trigger an SSL handshake, we return -1 with the retry * option set. Otherwise renegotiation may cause nasty * problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } goto start; } switch (rr->type) { default: /* * TLS 1.0 and 1.1 say you SHOULD ignore unrecognised record types, but * TLS 1.2 says you MUST send an unexpected message alert. We use the * TLS 1.2 behaviour for all protocol versions to prevent issues where * no progress is being made and the peer continually sends unrecognised * record types, using up resources processing them. */ al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* * we already handled all of these, with the possible exception of * SSL3_RT_HANDSHAKE when s->in_handshake is set, but that should not * happen when type != rr->type */ al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* * At this point, we were expecting handshake data, but have * application data. If the library was running inside ssl3_read() * (i.e. in_read_app_data is set) and it makes sense to read * application data at this point (session renegotiation not yet * started), we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (((s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ((s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data = 2; return (-1); } else { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: return (-1); } int ssl3_do_change_cipher_spec(SSL *s) { int i; const char *sender; int slen; if (s->state & SSL_ST_ACCEPT) i = SSL3_CHANGE_CIPHER_SERVER_READ; else i = SSL3_CHANGE_CIPHER_CLIENT_READ; if (s->s3->tmp.key_block == NULL) { if (s->session == NULL || s->session->master_key_length == 0) { /* might happen if dtls1_read_bytes() calls this */ SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC, SSL_R_CCS_RECEIVED_EARLY); return (0); } s->session->cipher = s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) return (0); } if (!s->method->ssl3_enc->change_cipher_state(s, i)) return (0); /* * we have to record the message digest at this point so we can get it * before we read the finished message */ if (s->state & SSL_ST_CONNECT) { sender = s->method->ssl3_enc->server_finished_label; slen = s->method->ssl3_enc->server_finished_label_len; } else { sender = s->method->ssl3_enc->client_finished_label; slen = s->method->ssl3_enc->client_finished_label_len; } i = s->method->ssl3_enc->final_finish_mac(s, sender, slen, s->s3->tmp.peer_finish_md); if (i == 0) { SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC, ERR_R_INTERNAL_ERROR); return 0; } s->s3->tmp.peer_finish_md_len = i; return (1); } int ssl3_send_alert(SSL *s, int level, int desc) { /* Map tls/ssl alert value to correct one */ desc = s->method->ssl3_enc->alert_value(desc); if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION) desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have * protocol_version alerts */ if (desc < 0) return -1; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) SSL_CTX_remove_session(s->session_ctx, s->session); s->s3->alert_dispatch = 1; s->s3->send_alert[0] = level; s->s3->send_alert[1] = desc; if (s->s3->wbuf.left == 0) /* data still being written out? */ return s->method->ssl_dispatch_alert(s); /* * else data is still being written out, we will get written some time in * the future */ return -1; } int ssl3_dispatch_alert(SSL *s) { int i, j; void (*cb) (const SSL *ssl, int type, int val) = NULL; s->s3->alert_dispatch = 0; i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0); if (i <= 0) { s->s3->alert_dispatch = 1; } else { /* * Alert sent to BIO. If it is important, flush it now. If the * message does not get sent due to non-blocking IO, we will not * worry too much. */ if (s->s3->send_alert[0] == SSL3_AL_FATAL) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if (cb != NULL) { j = (s->s3->send_alert[0] << 8) | s->s3->send_alert[1]; cb(s, SSL_CB_WRITE_ALERT, j); } } return (i); } diff --git a/ssl/ssl.h b/ssl/ssl.h index 90aeb0ce4e1e..3cf96a239bab 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -1,3163 +1,3163 @@ /* ssl/ssl.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECC cipher suite support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ /* ==================================================================== * Copyright 2005 Nokia. All rights reserved. * * The portions of the attached software ("Contribution") is developed by * Nokia Corporation and is licensed pursuant to the OpenSSL open source * license. * * The Contribution, originally written by Mika Kousa and Pasi Eronen of * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites * support (see RFC 4279) to OpenSSL. * * No patent licenses or other rights except those expressly stated in * the OpenSSL open source license shall be deemed granted or received * expressly, by implication, estoppel, or otherwise. * * No assurances are provided by Nokia that the Contribution does not * infringe the patent or other intellectual property rights of any third * party or that the license provides you with all the necessary rights * to make use of the Contribution. * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR * OTHERWISE. */ #ifndef HEADER_SSL_H # define HEADER_SSL_H # include # ifndef OPENSSL_NO_COMP # include # endif # ifndef OPENSSL_NO_BIO # include # endif # ifndef OPENSSL_NO_DEPRECATED # ifndef OPENSSL_NO_X509 # include # endif # include # include # include # endif # include # include # include # include # include #ifdef __cplusplus extern "C" { #endif /* SSLeay version number for ASN.1 encoding of the session information */ /*- * Version 0 - initial version * Version 1 - added the optional peer certificate */ # define SSL_SESSION_ASN1_VERSION 0x0001 /* text strings for the ciphers */ # define SSL_TXT_NULL_WITH_MD5 SSL2_TXT_NULL_WITH_MD5 # define SSL_TXT_RC4_128_WITH_MD5 SSL2_TXT_RC4_128_WITH_MD5 # define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 # define SSL_TXT_RC2_128_CBC_WITH_MD5 SSL2_TXT_RC2_128_CBC_WITH_MD5 # define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 # define SSL_TXT_IDEA_128_CBC_WITH_MD5 SSL2_TXT_IDEA_128_CBC_WITH_MD5 # define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5 # define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA # define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 # define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA /* * VRS Additional Kerberos5 entries */ # define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA # define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA # define SSL_TXT_KRB5_RC4_128_SHA SSL3_TXT_KRB5_RC4_128_SHA # define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA # define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 # define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 # define SSL_TXT_KRB5_RC4_128_MD5 SSL3_TXT_KRB5_RC4_128_MD5 # define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 # define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA # define SSL_TXT_KRB5_RC2_40_CBC_SHA SSL3_TXT_KRB5_RC2_40_CBC_SHA # define SSL_TXT_KRB5_RC4_40_SHA SSL3_TXT_KRB5_RC4_40_SHA # define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 # define SSL_TXT_KRB5_RC2_40_CBC_MD5 SSL3_TXT_KRB5_RC2_40_CBC_MD5 # define SSL_TXT_KRB5_RC4_40_MD5 SSL3_TXT_KRB5_RC4_40_MD5 # define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA # define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 # define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA # define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 # define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA # define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 # define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256 # define SSL_MAX_SSL_SESSION_ID_LENGTH 32 # define SSL_MAX_SID_CTX_LENGTH 32 # define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) # define SSL_MAX_KEY_ARG_LENGTH 8 # define SSL_MAX_MASTER_KEY_LENGTH 48 /* These are used to specify which ciphers to use and not to use */ # define SSL_TXT_EXP40 "EXPORT40" # define SSL_TXT_EXP56 "EXPORT56" # define SSL_TXT_LOW "LOW" # define SSL_TXT_MEDIUM "MEDIUM" # define SSL_TXT_HIGH "HIGH" # define SSL_TXT_FIPS "FIPS" # define SSL_TXT_kFZA "kFZA"/* unused! */ # define SSL_TXT_aFZA "aFZA"/* unused! */ # define SSL_TXT_eFZA "eFZA"/* unused! */ # define SSL_TXT_FZA "FZA"/* unused! */ # define SSL_TXT_aNULL "aNULL" # define SSL_TXT_eNULL "eNULL" # define SSL_TXT_NULL "NULL" # define SSL_TXT_kRSA "kRSA" # define SSL_TXT_kDHr "kDHr" # define SSL_TXT_kDHd "kDHd" # define SSL_TXT_kDH "kDH" # define SSL_TXT_kEDH "kEDH" # define SSL_TXT_kDHE "kDHE"/* alias for kEDH */ # define SSL_TXT_kKRB5 "kKRB5" # define SSL_TXT_kECDHr "kECDHr" # define SSL_TXT_kECDHe "kECDHe" # define SSL_TXT_kECDH "kECDH" # define SSL_TXT_kEECDH "kEECDH" # define SSL_TXT_kECDHE "kECDHE"/* alias for kEECDH */ # define SSL_TXT_kPSK "kPSK" # define SSL_TXT_kGOST "kGOST" # define SSL_TXT_kSRP "kSRP" # define SSL_TXT_aRSA "aRSA" # define SSL_TXT_aDSS "aDSS" # define SSL_TXT_aDH "aDH" # define SSL_TXT_aECDH "aECDH" # define SSL_TXT_aKRB5 "aKRB5" # define SSL_TXT_aECDSA "aECDSA" # define SSL_TXT_aPSK "aPSK" # define SSL_TXT_aGOST94 "aGOST94" # define SSL_TXT_aGOST01 "aGOST01" # define SSL_TXT_aGOST "aGOST" # define SSL_TXT_aSRP "aSRP" # define SSL_TXT_DSS "DSS" # define SSL_TXT_DH "DH" # define SSL_TXT_EDH "EDH"/* same as "kEDH:-ADH" */ # define SSL_TXT_DHE "DHE"/* alias for EDH */ # define SSL_TXT_ADH "ADH" # define SSL_TXT_RSA "RSA" # define SSL_TXT_ECDH "ECDH" # define SSL_TXT_EECDH "EECDH"/* same as "kEECDH:-AECDH" */ # define SSL_TXT_ECDHE "ECDHE"/* alias for ECDHE" */ # define SSL_TXT_AECDH "AECDH" # define SSL_TXT_ECDSA "ECDSA" # define SSL_TXT_KRB5 "KRB5" # define SSL_TXT_PSK "PSK" # define SSL_TXT_SRP "SRP" # define SSL_TXT_DES "DES" # define SSL_TXT_3DES "3DES" # define SSL_TXT_RC4 "RC4" # define SSL_TXT_RC2 "RC2" # define SSL_TXT_IDEA "IDEA" # define SSL_TXT_SEED "SEED" # define SSL_TXT_AES128 "AES128" # define SSL_TXT_AES256 "AES256" # define SSL_TXT_AES "AES" # define SSL_TXT_AES_GCM "AESGCM" # define SSL_TXT_CAMELLIA128 "CAMELLIA128" # define SSL_TXT_CAMELLIA256 "CAMELLIA256" # define SSL_TXT_CAMELLIA "CAMELLIA" # define SSL_TXT_MD5 "MD5" # define SSL_TXT_SHA1 "SHA1" # define SSL_TXT_SHA "SHA"/* same as "SHA1" */ # define SSL_TXT_GOST94 "GOST94" # define SSL_TXT_GOST89MAC "GOST89MAC" # define SSL_TXT_SHA256 "SHA256" # define SSL_TXT_SHA384 "SHA384" # define SSL_TXT_SSLV2 "SSLv2" # define SSL_TXT_SSLV3 "SSLv3" # define SSL_TXT_TLSV1 "TLSv1" # define SSL_TXT_TLSV1_1 "TLSv1.1" # define SSL_TXT_TLSV1_2 "TLSv1.2" # define SSL_TXT_EXP "EXP" # define SSL_TXT_EXPORT "EXPORT" # define SSL_TXT_ALL "ALL" /*- * COMPLEMENTOF* definitions. These identifiers are used to (de-select) * ciphers normally not being used. * Example: "RC4" will activate all ciphers using RC4 including ciphers * without authentication, which would normally disabled by DEFAULT (due * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" * will make sure that it is also disabled in the specific selection. * COMPLEMENTOF* identifiers are portable between version, as adjustments * to the default cipher setup will also be included here. * * COMPLEMENTOFDEFAULT does not experience the same special treatment that * DEFAULT gets, as only selection is being done and no sorting as needed * for DEFAULT. */ # define SSL_TXT_CMPALL "COMPLEMENTOFALL" # define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" /* * The following cipher list is used by default. It also is substituted when * an application-defined cipher list string starts with 'DEFAULT'. */ # define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2" /* * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always * starts with a reasonable order, and all we have to do for DEFAULT is * throwing out anonymous and unencrypted ciphersuites! (The latter are not * actually enabled by ALL, but "ALL:RSA" would enable some of them.) */ /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ # define SSL_SENT_SHUTDOWN 1 # define SSL_RECEIVED_SHUTDOWN 2 #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif # if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2) # define OPENSSL_NO_SSL2 # endif # define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 # define SSL_FILETYPE_PEM X509_FILETYPE_PEM /* * This is needed to stop compilers complaining about the 'struct ssl_st *' * function parameters used to prototype callbacks in SSL_CTX. */ typedef struct ssl_st *ssl_crock_st; typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; typedef struct ssl_method_st SSL_METHOD; typedef struct ssl_cipher_st SSL_CIPHER; typedef struct ssl_session_st SSL_SESSION; typedef struct tls_sigalgs_st TLS_SIGALGS; typedef struct ssl_conf_ctx_st SSL_CONF_CTX; DECLARE_STACK_OF(SSL_CIPHER) /* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ typedef struct srtp_protection_profile_st { const char *name; unsigned long id; } SRTP_PROTECTION_PROFILE; DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) typedef int (*tls_session_ticket_ext_cb_fn) (SSL *s, const unsigned char *data, int len, void *arg); typedef int (*tls_session_secret_cb_fn) (SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg); # ifndef OPENSSL_NO_TLSEXT /* Typedefs for handling custom extensions */ typedef int (*custom_ext_add_cb) (SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *add_arg); typedef void (*custom_ext_free_cb) (SSL *s, unsigned int ext_type, const unsigned char *out, void *add_arg); typedef int (*custom_ext_parse_cb) (SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *parse_arg); # endif # ifndef OPENSSL_NO_SSL_INTERN /* used to hold info on the particular ciphers used */ struct ssl_cipher_st { int valid; const char *name; /* text name */ unsigned long id; /* id, 4 bytes, first is version */ /* * changed in 0.9.9: these four used to be portions of a single value * 'algorithms' */ unsigned long algorithm_mkey; /* key exchange algorithm */ unsigned long algorithm_auth; /* server authentication */ unsigned long algorithm_enc; /* symmetric encryption */ unsigned long algorithm_mac; /* symmetric authentication */ unsigned long algorithm_ssl; /* (major) protocol version */ unsigned long algo_strength; /* strength and export flags */ unsigned long algorithm2; /* Extra flags */ int strength_bits; /* Number of bits really used */ int alg_bits; /* Number of bits for algorithm */ }; /* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ struct ssl_method_st { int version; int (*ssl_new) (SSL *s); void (*ssl_clear) (SSL *s); void (*ssl_free) (SSL *s); int (*ssl_accept) (SSL *s); int (*ssl_connect) (SSL *s); int (*ssl_read) (SSL *s, void *buf, int len); int (*ssl_peek) (SSL *s, void *buf, int len); int (*ssl_write) (SSL *s, const void *buf, int len); int (*ssl_shutdown) (SSL *s); int (*ssl_renegotiate) (SSL *s); int (*ssl_renegotiate_check) (SSL *s); long (*ssl_get_message) (SSL *s, int st1, int stn, int mt, long max, int *ok); int (*ssl_read_bytes) (SSL *s, int type, unsigned char *buf, int len, int peek); int (*ssl_write_bytes) (SSL *s, int type, const void *buf_, int len); int (*ssl_dispatch_alert) (SSL *s); long (*ssl_ctrl) (SSL *s, int cmd, long larg, void *parg); long (*ssl_ctx_ctrl) (SSL_CTX *ctx, int cmd, long larg, void *parg); const SSL_CIPHER *(*get_cipher_by_char) (const unsigned char *ptr); int (*put_cipher_by_char) (const SSL_CIPHER *cipher, unsigned char *ptr); int (*ssl_pending) (const SSL *s); int (*num_ciphers) (void); const SSL_CIPHER *(*get_cipher) (unsigned ncipher); const struct ssl_method_st *(*get_ssl_method) (int version); long (*get_timeout) (void); struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */ int (*ssl_version) (void); long (*ssl_callback_ctrl) (SSL *s, int cb_id, void (*fp) (void)); long (*ssl_ctx_callback_ctrl) (SSL_CTX *s, int cb_id, void (*fp) (void)); }; /*- * Lets make this into an ASN.1 type structure as follows * SSL_SESSION_ID ::= SEQUENCE { * version INTEGER, -- structure version number * SSLversion INTEGER, -- SSL version number * Cipher OCTET STRING, -- the 3 byte cipher ID * Session_ID OCTET STRING, -- the Session ID * Master_key OCTET STRING, -- the master key * KRB5_principal OCTET STRING -- optional Kerberos principal * Key_Arg [ 0 ] IMPLICIT OCTET STRING, -- the optional Key argument * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds * Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate * Session_ID_context [ 4 ] EXPLICIT OCTET STRING, -- the Session ID context * Verify_result [ 5 ] EXPLICIT INTEGER, -- X509_V_... code for `Peer' * HostName [ 6 ] EXPLICIT OCTET STRING, -- optional HostName from servername TLS extension * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only) * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username * } * Look in ssl/ssl_asn1.c for more details * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). */ struct ssl_session_st { int ssl_version; /* what ssl version session info is being * kept in here? */ /* only really used in SSLv2 */ unsigned int key_arg_length; unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH]; int master_key_length; unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; /* session_id - valid? */ unsigned int session_id_length; unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; /* * this is used to determine whether the session is being reused in the * appropriate context. It is up to the application to set this, via * SSL_new */ unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; # ifndef OPENSSL_NO_KRB5 unsigned int krb5_client_princ_len; unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; # endif /* OPENSSL_NO_KRB5 */ # ifndef OPENSSL_NO_PSK char *psk_identity_hint; char *psk_identity; # endif /* * Used to indicate that session resumption is not allowed. Applications * can also set this bit for a new session via not_resumable_session_cb * to disable session caching and tickets. */ int not_resumable; /* The cert is the certificate used to establish this connection */ struct sess_cert_st /* SESS_CERT */ *sess_cert; /* * This is the cert for the other end. On clients, it will be the same as * sess_cert->peer_key->x509 (the latter is not enough as sess_cert is * not retained in the external representation of sessions, see * ssl_asn1.c). */ X509 *peer; /* * when app_verify_callback accepts a session where the peer's * certificate is not ok, we must remember the error for session reuse: */ long verify_result; /* only for servers */ int references; long timeout; long time; unsigned int compress_meth; /* Need to lookup the method */ const SSL_CIPHER *cipher; unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used * to load the 'cipher' structure */ STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */ CRYPTO_EX_DATA ex_data; /* application specific data */ /* * These are used to make removal of session-ids more efficient and to * implement a maximum cache size. */ struct ssl_session_st *prev, *next; # ifndef OPENSSL_NO_TLSEXT char *tlsext_hostname; # ifndef OPENSSL_NO_EC size_t tlsext_ecpointformatlist_length; unsigned char *tlsext_ecpointformatlist; /* peer's list */ size_t tlsext_ellipticcurvelist_length; unsigned char *tlsext_ellipticcurvelist; /* peer's list */ # endif /* OPENSSL_NO_EC */ /* RFC4507 info */ unsigned char *tlsext_tick; /* Session ticket */ size_t tlsext_ticklen; /* Session ticket length */ long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ # endif # ifndef OPENSSL_NO_SRP char *srp_username; # endif }; # endif # define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L # define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L /* Allow initial connection to servers that don't support RI */ # define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L # define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L # define SSL_OP_TLSEXT_PADDING 0x00000010L # define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L # define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040L # define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L # define SSL_OP_TLS_D5_BUG 0x00000100L # define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L /* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */ # define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 /* Refers to ancient SSLREF and SSLv2, retained for compatibility */ # define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 /* * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in * OpenSSL 0.9.6d. Usually (depending on the application protocol) the * workaround is not needed. Unfortunately some broken SSL/TLS * implementations cannot handle it at all, which is why we include it in * SSL_OP_ALL. */ /* added in 0.9.6e */ # define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* * SSL_OP_ALL: various bug workarounds that should be rather harmless. This * used to be 0x000FFFFFL before 0.9.7. */ # define SSL_OP_ALL 0x80000BFFL /* DTLS options */ # define SSL_OP_NO_QUERY_MTU 0x00001000L /* Turn on Cookie Exchange (on relevant for servers) */ # define SSL_OP_COOKIE_EXCHANGE 0x00002000L /* Don't use RFC4507 ticket extension */ # define SSL_OP_NO_TICKET 0x00004000L /* Use Cisco's "speshul" version of DTLS_BAD_VER (as client) */ # define SSL_OP_CISCO_ANYCONNECT 0x00008000L /* As server, disallow session resumption on renegotiation */ # define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L /* Don't use compression even if supported */ # define SSL_OP_NO_COMPRESSION 0x00020000L /* Permit unsafe legacy renegotiation */ # define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L /* If set, always create a new key when using tmp_ecdh parameters */ # define SSL_OP_SINGLE_ECDH_USE 0x00080000L /* Does nothing: retained for compatibility */ # define SSL_OP_SINGLE_DH_USE 0x00100000L /* Does nothing: retained for compatibiity */ # define SSL_OP_EPHEMERAL_RSA 0x0 /* * Set on servers to choose the cipher according to the server's preferences */ # define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L /* * If set, a server will allow a client to issue a SSLv3.0 version number as * latest version supported in the premaster secret, even when TLSv1.0 * (version 3.1) was announced in the client hello. Normally this is * forbidden to prevent version rollback attacks. */ # define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L # define SSL_OP_NO_SSLv2 0x01000000L # define SSL_OP_NO_SSLv3 0x02000000L # define SSL_OP_NO_TLSv1 0x04000000L # define SSL_OP_NO_TLSv1_2 0x08000000L # define SSL_OP_NO_TLSv1_1 0x10000000L # define SSL_OP_NO_DTLSv1 0x04000000L # define SSL_OP_NO_DTLSv1_2 0x08000000L # define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|\ SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2) /* * These next two were never actually used for anything since SSLeay zap so * we have some more flags. */ /* * The next flag deliberately changes the ciphertest, this is a check for the * PKCS#1 attack */ # define SSL_OP_PKCS1_CHECK_1 0x0 # define SSL_OP_PKCS1_CHECK_2 0x0 # define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L # define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L /* * Make server add server-hello extension from early version of cryptopro * draft, when GOST ciphersuite is negotiated. Required for interoperability * with CryptoPro CSP 3.x */ # define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000L /* * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success * when just a single record has been written): */ # define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L /* * Make it possible to retry SSL_write() with changed buffer location (buffer * contents must stay the same!); this is not the default to avoid the * misconception that non-blocking SSL_write() behaves like non-blocking * write(): */ # define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L /* * Never bother the application with retries if the transport is blocking: */ # define SSL_MODE_AUTO_RETRY 0x00000004L /* Don't attempt to automatically build certificate chain */ # define SSL_MODE_NO_AUTO_CHAIN 0x00000008L /* * Save RAM by releasing read and write buffers when they're empty. (SSL3 and * TLS only.) "Released" buffers are put onto a free-list in the context or * just freed (depending on the context's setting for freelist_max_len). */ # define SSL_MODE_RELEASE_BUFFERS 0x00000010L /* * Send the current time in the Random fields of the ClientHello and * ServerHello records for compatibility with hypothetical implementations * that require it. */ # define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L # define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L /* * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications * that reconnect with a downgraded protocol version; see * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your * application attempts a normal handshake. Only use this in explicit * fallback retries, following the guidance in * draft-ietf-tls-downgrade-scsv-00. */ # define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L /* Cert related flags */ /* * Many implementations ignore some aspects of the TLS standards such as * enforcing certifcate chain algorithms. When this is set we enforce them. */ # define SSL_CERT_FLAG_TLS_STRICT 0x00000001L /* Suite B modes, takes same values as certificate verify flags */ # define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 /* Suite B 192 bit only mode */ # define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 /* Suite B 128 bit mode allowing 192 bit algorithms */ # define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 /* Perform all sorts of protocol violations for testing purposes */ # define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 /* Flags for building certificate chains */ /* Treat any existing certificates as untrusted CAs */ # define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 /* Don't include root CA in chain */ # define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 /* Just check certificates already there */ # define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 /* Ignore verification errors */ # define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 /* Clear verification errors from queue */ # define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 /* Flags returned by SSL_check_chain */ /* Certificate can be used with this session */ # define CERT_PKEY_VALID 0x1 /* Certificate can also be used for signing */ # define CERT_PKEY_SIGN 0x2 /* EE certificate signing algorithm OK */ # define CERT_PKEY_EE_SIGNATURE 0x10 /* CA signature algorithms OK */ # define CERT_PKEY_CA_SIGNATURE 0x20 /* EE certificate parameters OK */ # define CERT_PKEY_EE_PARAM 0x40 /* CA certificate parameters OK */ # define CERT_PKEY_CA_PARAM 0x80 /* Signing explicitly allowed as opposed to SHA1 fallback */ # define CERT_PKEY_EXPLICIT_SIGN 0x100 /* Client CA issuer names match (always set for server cert) */ # define CERT_PKEY_ISSUER_NAME 0x200 /* Cert type matches client types (always set for server cert) */ # define CERT_PKEY_CERT_TYPE 0x400 /* Cert chain suitable to Suite B */ # define CERT_PKEY_SUITEB 0x800 # define SSL_CONF_FLAG_CMDLINE 0x1 # define SSL_CONF_FLAG_FILE 0x2 # define SSL_CONF_FLAG_CLIENT 0x4 # define SSL_CONF_FLAG_SERVER 0x8 # define SSL_CONF_FLAG_SHOW_ERRORS 0x10 # define SSL_CONF_FLAG_CERTIFICATE 0x20 /* Configuration value types */ # define SSL_CONF_TYPE_UNKNOWN 0x0 # define SSL_CONF_TYPE_STRING 0x1 # define SSL_CONF_TYPE_FILE 0x2 # define SSL_CONF_TYPE_DIR 0x3 /* * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they * cannot be used to clear bits. */ # define SSL_CTX_set_options(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) # define SSL_CTX_clear_options(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_OPTIONS,(op),NULL) # define SSL_CTX_get_options(ctx) \ SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL) # define SSL_set_options(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL) # define SSL_clear_options(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_OPTIONS,(op),NULL) # define SSL_get_options(ssl) \ SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL) # define SSL_CTX_set_mode(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) # define SSL_CTX_clear_mode(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) # define SSL_CTX_get_mode(ctx) \ SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) # define SSL_clear_mode(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) # define SSL_set_mode(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) # define SSL_get_mode(ssl) \ SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) # define SSL_set_mtu(ssl, mtu) \ SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) # define DTLS_set_link_mtu(ssl, mtu) \ SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) # define DTLS_get_link_min_mtu(ssl) \ SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) # define SSL_get_secure_renegotiation_support(ssl) \ SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) # ifndef OPENSSL_NO_HEARTBEATS # define SSL_heartbeat(ssl) \ SSL_ctrl((ssl),SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,NULL) # endif # define SSL_CTX_set_cert_flags(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) # define SSL_set_cert_flags(s,op) \ SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) # define SSL_CTX_clear_cert_flags(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) # define SSL_clear_cert_flags(s,op) \ SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); void SSL_set_msg_callback(SSL *ssl, void (*cb) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); # define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) # define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) # ifndef OPENSSL_NO_SRP # ifndef OPENSSL_NO_SSL_INTERN typedef struct srp_ctx_st { /* param for all the callbacks */ void *SRP_cb_arg; /* set client Hello login callback */ int (*TLS_ext_srp_username_callback) (SSL *, int *, void *); /* set SRP N/g param callback for verification */ int (*SRP_verify_param_callback) (SSL *, void *); /* set SRP client passwd callback */ char *(*SRP_give_srp_client_pwd_callback) (SSL *, void *); char *login; BIGNUM *N, *g, *s, *B, *A; BIGNUM *a, *b, *v; char *info; int strength; unsigned long srp_Mask; } SRP_CTX; # endif /* see tls_srp.c */ int SSL_SRP_CTX_init(SSL *s); int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); int SSL_SRP_CTX_free(SSL *ctx); int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); int SSL_srp_server_param_with_username(SSL *s, int *ad); int SRP_generate_server_master_secret(SSL *s, unsigned char *master_key); int SRP_Calc_A_param(SSL *s); int SRP_generate_client_master_secret(SSL *s, unsigned char *master_key); # endif # if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) # define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */ # else # define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ # endif # define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) /* * This callback type is used inside SSL_CTX, SSL, and in the functions that * set them. It is used to override the generation of SSL/TLS session IDs in * a server. Return value should be zero on an error, non-zero to proceed. * Also, callbacks should themselves check if the id they generate is unique * otherwise the SSL handshake will fail with an error - callbacks can do * this using the 'ssl' value they're passed by; * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in * is set at the maximum size the session ID can be. In SSLv2 this is 16 * bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback can alter this * length to be less if desired, but under SSLv2 session IDs are supposed to * be fixed at 16 bytes so the id will be padded after the callback returns * in this case. It is also an error for the callback to set the size to * zero. */ typedef int (*GEN_SESSION_CB) (const SSL *ssl, unsigned char *id, unsigned int *id_len); typedef struct ssl_comp_st SSL_COMP; # ifndef OPENSSL_NO_SSL_INTERN struct ssl_comp_st { int id; const char *name; # ifndef OPENSSL_NO_COMP COMP_METHOD *method; # else char *method; # endif }; DECLARE_STACK_OF(SSL_COMP) DECLARE_LHASH_OF(SSL_SESSION); struct ssl_ctx_st { const SSL_METHOD *method; STACK_OF(SSL_CIPHER) *cipher_list; /* same as above but sorted for lookup */ STACK_OF(SSL_CIPHER) *cipher_list_by_id; struct x509_store_st /* X509_STORE */ *cert_store; LHASH_OF(SSL_SESSION) *sessions; /* * Most session-ids that will be cached, default is * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ unsigned long session_cache_size; struct ssl_session_st *session_cache_head; struct ssl_session_st *session_cache_tail; /* * This can have one of 2 values, ored together, SSL_SESS_CACHE_CLIENT, * SSL_SESS_CACHE_SERVER, Default is SSL_SESSION_CACHE_SERVER, which * means only SSL_accept which cache SSL_SESSIONS. */ int session_cache_mode; /* * If timeout is not 0, it is the default timeout value set when * SSL_new() is called. This has been put in to make life easier to set * things up */ long session_timeout; /* * If this callback is not null, it will be called each time a session id * is added to the cache. If this function returns 1, it means that the * callback will do a SSL_SESSION_free() when it has finished using it. * Otherwise, on 0, it means the callback has finished with it. If * remove_session_cb is not null, it will be called when a session-id is * removed from the cache. After the call, OpenSSL will * SSL_SESSION_free() it. */ int (*new_session_cb) (struct ssl_st *ssl, SSL_SESSION *sess); void (*remove_session_cb) (struct ssl_ctx_st *ctx, SSL_SESSION *sess); SSL_SESSION *(*get_session_cb) (struct ssl_st *ssl, unsigned char *data, int len, int *copy); struct { int sess_connect; /* SSL new conn - started */ int sess_connect_renegotiate; /* SSL reneg - requested */ int sess_connect_good; /* SSL new conne/reneg - finished */ int sess_accept; /* SSL new accept - started */ int sess_accept_renegotiate; /* SSL reneg - requested */ int sess_accept_good; /* SSL accept/reneg - finished */ int sess_miss; /* session lookup misses */ int sess_timeout; /* reuse attempt on timeouted session */ int sess_cache_full; /* session removed due to full cache */ int sess_hit; /* session reuse actually done */ int sess_cb_hit; /* session-id that was not in the cache was * passed back via the callback. This * indicates that the application is * supplying session-id's from other * processes - spooky :-) */ } stats; int references; /* if defined, these override the X509_verify_cert() calls */ int (*app_verify_callback) (X509_STORE_CTX *, void *); void *app_verify_arg; /* * before OpenSSL 0.9.7, 'app_verify_arg' was ignored * ('app_verify_callback' was called with just one argument) */ /* Default password callback. */ pem_password_cb *default_passwd_callback; /* Default password callback user data. */ void *default_passwd_callback_userdata; /* get client cert callback */ int (*client_cert_cb) (SSL *ssl, X509 **x509, EVP_PKEY **pkey); /* cookie generate callback */ int (*app_gen_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int *cookie_len); /* verify cookie callback */ int (*app_verify_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int cookie_len); CRYPTO_EX_DATA ex_data; const EVP_MD *rsa_md5; /* For SSLv2 - name is 'ssl2-md5' */ const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ STACK_OF(X509) *extra_certs; STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ /* Default values used when no per-SSL value is defined follow */ /* used if SSL's info_callback is NULL */ void (*info_callback) (const SSL *ssl, int type, int val); /* what we put in client cert requests */ STACK_OF(X509_NAME) *client_CA; /* * Default values to use in SSL structures follow (these are copied by * SSL_new) */ unsigned long options; unsigned long mode; long max_cert_list; struct cert_st /* CERT */ *cert; int read_ahead; /* callback that allows applications to peek at protocol messages */ void (*msg_callback) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void *msg_callback_arg; int verify_mode; unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; /* called 'verify_callback' in the SSL */ int (*default_verify_callback) (int ok, X509_STORE_CTX *ctx); /* Default generate session ID callback. */ GEN_SESSION_CB generate_session_id; X509_VERIFY_PARAM *param; # if 0 int purpose; /* Purpose setting */ int trust; /* Trust setting */ # endif int quiet_shutdown; /* * Maximum amount of data to send in one fragment. actual record size can * be more than this due to padding and MAC overheads. */ unsigned int max_send_fragment; # ifndef OPENSSL_NO_ENGINE /* * Engine to pass requests for client certs to */ ENGINE *client_cert_engine; # endif # ifndef OPENSSL_NO_TLSEXT /* TLS extensions servername callback */ int (*tlsext_servername_callback) (SSL *, int *, void *); void *tlsext_servername_arg; /* RFC 4507 session ticket keys */ unsigned char tlsext_tick_key_name[16]; unsigned char tlsext_tick_hmac_key[16]; unsigned char tlsext_tick_aes_key[16]; /* Callback to support customisation of ticket key setting */ int (*tlsext_ticket_key_cb) (SSL *ssl, unsigned char *name, unsigned char *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc); /* certificate status request info */ /* Callback for status request */ int (*tlsext_status_cb) (SSL *ssl, void *arg); void *tlsext_status_arg; /* draft-rescorla-tls-opaque-prf-input-00.txt information */ int (*tlsext_opaque_prf_input_callback) (SSL *, void *peerinput, size_t len, void *arg); void *tlsext_opaque_prf_input_callback_arg; # endif # ifndef OPENSSL_NO_PSK char *psk_identity_hint; unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); # endif # ifndef OPENSSL_NO_BUF_FREELISTS # define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32 unsigned int freelist_max_len; struct ssl3_buf_freelist_st *wbuf_freelist; struct ssl3_buf_freelist_st *rbuf_freelist; # endif # ifndef OPENSSL_NO_SRP SRP_CTX srp_ctx; /* ctx for SRP authentication */ # endif # ifndef OPENSSL_NO_TLSEXT # ifndef OPENSSL_NO_NEXTPROTONEG /* Next protocol negotiation information */ /* (for experimental NPN extension). */ /* * For a server, this contains a callback function by which the set of * advertised protocols can be provided. */ int (*next_protos_advertised_cb) (SSL *s, const unsigned char **buf, unsigned int *len, void *arg); void *next_protos_advertised_cb_arg; /* * For a client, this contains a callback function that selects the next * protocol from the list provided by the server. */ int (*next_proto_select_cb) (SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg); void *next_proto_select_cb_arg; # endif /* SRTP profiles we are willing to do from RFC 5764 */ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* * ALPN information (we are in the process of transitioning from NPN to * ALPN.) */ /*- * For a server, this contains a callback function that allows the * server to select the protocol for the connection. * out: on successful return, this must point to the raw protocol * name (without the length prefix). * outlen: on successful return, this contains the length of |*out|. * in: points to the client's list of supported protocols in * wire-format. * inlen: the length of |in|. */ int (*alpn_select_cb) (SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg); void *alpn_select_cb_arg; /* * For a client, this contains the list of supported protocols in wire * format. */ unsigned char *alpn_client_proto_list; unsigned alpn_client_proto_list_len; # ifndef OPENSSL_NO_EC /* EC extension values inherited by SSL structure */ size_t tlsext_ecpointformatlist_length; unsigned char *tlsext_ecpointformatlist; size_t tlsext_ellipticcurvelist_length; unsigned char *tlsext_ellipticcurvelist; # endif /* OPENSSL_NO_EC */ # endif }; # endif # define SSL_SESS_CACHE_OFF 0x0000 # define SSL_SESS_CACHE_CLIENT 0x0001 # define SSL_SESS_CACHE_SERVER 0x0002 # define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) # define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ # define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 # define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 # define SSL_SESS_CACHE_NO_INTERNAL \ (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); # define SSL_CTX_sess_number(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) # define SSL_CTX_sess_connect(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) # define SSL_CTX_sess_connect_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) # define SSL_CTX_sess_connect_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) # define SSL_CTX_sess_accept(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) # define SSL_CTX_sess_accept_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) # define SSL_CTX_sess_accept_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) # define SSL_CTX_sess_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) # define SSL_CTX_sess_cb_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) # define SSL_CTX_sess_misses(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) # define SSL_CTX_sess_timeouts(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) # define SSL_CTX_sess_cache_full(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb) (struct ssl_st *ssl, SSL_SESSION *sess)); int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, SSL_SESSION *sess); void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb) (struct ssl_ctx_st *ctx, SSL_SESSION *sess)); void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, SSL_SESSION *sess); void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb) (struct ssl_st *ssl, unsigned char *data, int len, int *copy)); SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, unsigned char *Data, int len, int *copy); void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb) (const SSL *ssl, int type, int val)); void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val); void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb) (SSL *ssl, X509 **x509, EVP_PKEY **pkey)); int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, EVP_PKEY **pkey); # ifndef OPENSSL_NO_ENGINE int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); # endif void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)); void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int cookie_len)); # ifndef OPENSSL_NO_NEXTPROTONEG void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb) (SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg), void *arg); void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, int (*cb) (SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg); void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, unsigned *len); # endif # ifndef OPENSSL_NO_TLSEXT int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, const unsigned char *client, unsigned int client_len); # endif # define OPENSSL_NPN_UNSUPPORTED 0 # define OPENSSL_NPN_NEGOTIATED 1 # define OPENSSL_NPN_NO_OVERLAP 2 int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned protos_len); int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, unsigned protos_len); void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg); void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, unsigned *len); # ifndef OPENSSL_NO_PSK /* * the maximum length of the buffer given to callbacks containing the * resulting identity/psk */ # define PSK_MAX_IDENTITY_LEN 128 # define PSK_MAX_PSK_LEN 256 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); void SSL_set_psk_client_callback(SSL *ssl, unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len)); void SSL_set_psk_server_callback(SSL *ssl, unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len)); int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); const char *SSL_get_psk_identity_hint(const SSL *s); const char *SSL_get_psk_identity(const SSL *s); # endif # ifndef OPENSSL_NO_TLSEXT /* Register callbacks to handle custom TLS Extensions for client or server. */ int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type, custom_ext_add_cb add_cb, custom_ext_free_cb free_cb, void *add_arg, custom_ext_parse_cb parse_cb, void *parse_arg); int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type, custom_ext_add_cb add_cb, custom_ext_free_cb free_cb, void *add_arg, custom_ext_parse_cb parse_cb, void *parse_arg); int SSL_extension_supported(unsigned int ext_type); # endif # define SSL_NOTHING 1 # define SSL_WRITING 2 # define SSL_READING 3 # define SSL_X509_LOOKUP 4 /* These will only be used when doing non-blocking IO */ # define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) # define SSL_want_read(s) (SSL_want(s) == SSL_READING) # define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) # define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) # define SSL_MAC_FLAG_READ_MAC_STREAM 1 # define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 # ifndef OPENSSL_NO_SSL_INTERN struct ssl_st { /* * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, * DTLS1_VERSION) */ int version; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ int type; /* SSLv3 */ const SSL_METHOD *method; /* * There are 2 BIO's even though they are normally both the same. This * is so data can be read and written to different handlers */ # ifndef OPENSSL_NO_BIO /* used by SSL_read */ BIO *rbio; /* used by SSL_write */ BIO *wbio; /* used during session-id reuse to concatenate messages */ BIO *bbio; # else /* used by SSL_read */ char *rbio; /* used by SSL_write */ char *wbio; char *bbio; # endif /* * This holds a variable that indicates what we were doing when a 0 or -1 * is returned. This is needed for non-blocking IO so we know what * request needs re-doing when in SSL_accept or SSL_connect */ int rwstate; /* true when we are actually in SSL_accept() or SSL_connect() */ int in_handshake; int (*handshake_func) (SSL *); /* * Imagine that here's a boolean member "init" that is switched as soon * as SSL_set_{accept/connect}_state is called for the first time, so * that "state" and "handshake_func" are properly initialized. But as * handshake_func is == 0 until then, we use this test instead of an * "init" member. */ /* are we the server side? - mostly used by SSL_clear */ int server; /* * Generate a new session or reuse an old one. * NB: For servers, the 'new' session may actually be a previously * cached session or even the previous session unless * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ int new_session; /* don't send shutdown packets */ int quiet_shutdown; /* we have shut things down, 0x01 sent, 0x02 for received */ int shutdown; /* where we are */ int state; /* where we are when reading */ int rstate; BUF_MEM *init_buf; /* buffer used during init */ void *init_msg; /* pointer to handshake message body, set by * ssl3_get_message() */ int init_num; /* amount read/written */ int init_off; /* amount read/written */ /* used internally to point at a raw packet */ unsigned char *packet; unsigned int packet_length; struct ssl2_state_st *s2; /* SSLv2 variables */ struct ssl3_state_st *s3; /* SSLv3 variables */ struct dtls1_state_st *d1; /* DTLSv1 variables */ int read_ahead; /* Read as many input bytes as possible (for * non-blocking reads) */ /* callback that allows applications to peek at protocol messages */ void (*msg_callback) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void *msg_callback_arg; int hit; /* reusing a previous session */ X509_VERIFY_PARAM *param; # if 0 int purpose; /* Purpose setting */ int trust; /* Trust setting */ # endif /* crypto */ STACK_OF(SSL_CIPHER) *cipher_list; STACK_OF(SSL_CIPHER) *cipher_list_by_id; /* * These are the ones being used, the ones in SSL_SESSION are the ones to * be 'copied' into these ones */ int mac_flags; EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ EVP_MD_CTX *read_hash; /* used for mac generation */ # ifndef OPENSSL_NO_COMP COMP_CTX *expand; /* uncompress */ # else char *expand; # endif EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ EVP_MD_CTX *write_hash; /* used for mac generation */ # ifndef OPENSSL_NO_COMP COMP_CTX *compress; /* compression */ # else char *compress; # endif /* session info */ /* client cert? */ /* This is used to hold the server certificate used */ struct cert_st /* CERT */ *cert; /* * the session_id_context is used to ensure sessions are only reused in * the appropriate context */ unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; /* This can also be in the session once a session is established */ SSL_SESSION *session; /* Default generate session ID callback. */ GEN_SESSION_CB generate_session_id; /* Used in SSL2 and SSL3 */ /* * 0 don't care about verify failure. * 1 fail if verify fails */ int verify_mode; /* fail if callback returns 0 */ int (*verify_callback) (int ok, X509_STORE_CTX *ctx); /* optional informational callback */ void (*info_callback) (const SSL *ssl, int type, int val); /* error bytes to be written */ int error; /* actual code */ int error_code; # ifndef OPENSSL_NO_KRB5 /* Kerberos 5 context */ KSSL_CTX *kssl_ctx; # endif /* OPENSSL_NO_KRB5 */ # ifndef OPENSSL_NO_PSK unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); # endif SSL_CTX *ctx; /* * set this flag to 1 and a sleep(1) is put into all SSL_read() and * SSL_write() calls, good for nbio debuging :-) */ int debug; /* extra application data */ long verify_result; CRYPTO_EX_DATA ex_data; /* for server side, keep the list of CA_dn we can use */ STACK_OF(X509_NAME) *client_CA; int references; /* protocol behaviour */ unsigned long options; /* API behaviour */ unsigned long mode; long max_cert_list; int first_packet; /* what was passed, used for SSLv3/TLS rollback check */ int client_version; unsigned int max_send_fragment; # ifndef OPENSSL_NO_TLSEXT /* TLS extension debug callback */ void (*tlsext_debug_cb) (SSL *s, int client_server, int type, unsigned char *data, int len, void *arg); void *tlsext_debug_arg; char *tlsext_hostname; /*- * no further mod of servername * 0 : call the servername extension callback. * 1 : prepare 2, allow last ack just after in server callback. * 2 : don't call servername callback, no ack in server hello */ int servername_done; /* certificate status request info */ /* Status type or -1 if no status type */ int tlsext_status_type; /* Expect OCSP CertificateStatus message */ int tlsext_status_expected; /* OCSP status request only */ STACK_OF(OCSP_RESPID) *tlsext_ocsp_ids; X509_EXTENSIONS *tlsext_ocsp_exts; /* OCSP response received or to be sent */ unsigned char *tlsext_ocsp_resp; int tlsext_ocsp_resplen; /* RFC4507 session ticket expected to be received or sent */ int tlsext_ticket_expected; # ifndef OPENSSL_NO_EC size_t tlsext_ecpointformatlist_length; /* our list */ unsigned char *tlsext_ecpointformatlist; size_t tlsext_ellipticcurvelist_length; /* our list */ unsigned char *tlsext_ellipticcurvelist; # endif /* OPENSSL_NO_EC */ /* * draft-rescorla-tls-opaque-prf-input-00.txt information to be used for * handshakes */ void *tlsext_opaque_prf_input; size_t tlsext_opaque_prf_input_len; /* TLS Session Ticket extension override */ TLS_SESSION_TICKET_EXT *tlsext_session_ticket; /* TLS Session Ticket extension callback */ tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb; void *tls_session_ticket_ext_cb_arg; /* TLS pre-shared secret session resumption */ tls_session_secret_cb_fn tls_session_secret_cb; void *tls_session_secret_cb_arg; SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */ # ifndef OPENSSL_NO_NEXTPROTONEG /* * Next protocol negotiation. For the client, this is the protocol that * we sent in NextProtocol and is set when handling ServerHello * extensions. For a server, this is the client's selected_protocol from * NextProtocol and is set when handling the NextProtocol message, before * the Finished message. */ unsigned char *next_proto_negotiated; unsigned char next_proto_negotiated_len; # endif # define session_ctx initial_ctx /* What we'll do */ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What's been chosen */ SRTP_PROTECTION_PROFILE *srtp_profile; /*- * Is use of the Heartbeat extension negotiated? * 0: disabled * 1: enabled * 2: enabled, but not allowed to send Requests */ unsigned int tlsext_heartbeat; /* Indicates if a HeartbeatRequest is in flight */ unsigned int tlsext_hb_pending; /* HeartbeatRequest sequence number */ unsigned int tlsext_hb_seq; # else # define session_ctx ctx # endif /* OPENSSL_NO_TLSEXT */ /*- * 1 if we are renegotiating. * 2 if we are a server and are inside a handshake * (i.e. not just sending a HelloRequest) */ int renegotiate; # ifndef OPENSSL_NO_SRP /* ctx for SRP authentication */ SRP_CTX srp_ctx; # endif # ifndef OPENSSL_NO_TLSEXT /* * For a client, this contains the list of supported protocols in wire * format. */ unsigned char *alpn_client_proto_list; unsigned alpn_client_proto_list_len; # endif /* OPENSSL_NO_TLSEXT */ }; # endif #ifdef __cplusplus } #endif # include # include # include /* This is mostly sslv3 with a few tweaks */ # include /* Datagram TLS */ # include # include /* Support for the use_srtp extension */ #ifdef __cplusplus extern "C" { #endif /* compatibility */ # define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)arg)) # define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) # define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0,(char *)a)) # define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) # define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) # define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0,(char *)arg)) /* * The following are the possible values for ssl->state are are used to * indicate where we are up to in the SSL connection establishment. The * macros that follow are about the only things you should need to use and * even then, only when using non-blocking IO. It can also be useful to work * out where you were when the connection failed */ # define SSL_ST_CONNECT 0x1000 # define SSL_ST_ACCEPT 0x2000 # define SSL_ST_MASK 0x0FFF # define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) # define SSL_ST_BEFORE 0x4000 # define SSL_ST_OK 0x03 # define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) -# define SSL_ST_ERR 0x05 +# define SSL_ST_ERR (0x05|SSL_ST_INIT) # define SSL_CB_LOOP 0x01 # define SSL_CB_EXIT 0x02 # define SSL_CB_READ 0x04 # define SSL_CB_WRITE 0x08 # define SSL_CB_ALERT 0x4000/* used in callback */ # define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) # define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) # define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) # define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) # define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) # define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) # define SSL_CB_HANDSHAKE_START 0x10 # define SSL_CB_HANDSHAKE_DONE 0x20 /* Is the SSL_connection established? */ # define SSL_get_state(a) SSL_state(a) # define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) # define SSL_in_init(a) (SSL_state(a)&SSL_ST_INIT) # define SSL_in_before(a) (SSL_state(a)&SSL_ST_BEFORE) # define SSL_in_connect_init(a) (SSL_state(a)&SSL_ST_CONNECT) # define SSL_in_accept_init(a) (SSL_state(a)&SSL_ST_ACCEPT) /* * The following 2 states are kept in ssl->rstate when reads fail, you should * not need these */ # define SSL_ST_READ_HEADER 0xF0 # define SSL_ST_READ_BODY 0xF1 # define SSL_ST_READ_DONE 0xF2 /*- * Obtain latest Finished message * -- that we sent (SSL_get_finished) * -- that we expected from peer (SSL_get_peer_finished). * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ size_t SSL_get_finished(const SSL *s, void *buf, size_t count); size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); /* * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options are * 'ored' with SSL_VERIFY_PEER if they are desired */ # define SSL_VERIFY_NONE 0x00 # define SSL_VERIFY_PEER 0x01 # define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 # define SSL_VERIFY_CLIENT_ONCE 0x04 # define OpenSSL_add_ssl_algorithms() SSL_library_init() # define SSLeay_add_ssl_algorithms() SSL_library_init() /* this is for backward compatibility */ # if 0 /* NEW_SSLEAY */ # define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c) # define SSL_set_pref_cipher(c,n) SSL_set_cipher_list(c,n) # define SSL_add_session(a,b) SSL_CTX_add_session((a),(b)) # define SSL_remove_session(a,b) SSL_CTX_remove_session((a),(b)) # define SSL_flush_sessions(a,b) SSL_CTX_flush_sessions((a),(b)) # endif /* More backward compatibility */ # define SSL_get_cipher(s) \ SSL_CIPHER_get_name(SSL_get_current_cipher(s)) # define SSL_get_cipher_bits(s,np) \ SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) # define SSL_get_cipher_version(s) \ SSL_CIPHER_get_version(SSL_get_current_cipher(s)) # define SSL_get_cipher_name(s) \ SSL_CIPHER_get_name(SSL_get_current_cipher(s)) # define SSL_get_time(a) SSL_SESSION_get_time(a) # define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) # define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) # define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) # define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) # define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) # define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value * from SSL_AD_... */ /* These alert types are for SSLv3 and TLSv1 */ # define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY /* fatal */ # define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */ # define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC # define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED # define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW /* fatal */ # define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE /* fatal */ # define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE /* Not for TLS */ # define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE # define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE # define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE # define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED # define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED # define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN /* fatal */ # define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER /* fatal */ # define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA /* fatal */ # define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED /* fatal */ # define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR # define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR /* fatal */ # define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION /* fatal */ # define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION /* fatal */ # define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY /* fatal */ # define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR # define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED # define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION # define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION # define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE # define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME # define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE # define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE /* fatal */ # define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ # define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK # define SSL_ERROR_NONE 0 # define SSL_ERROR_SSL 1 # define SSL_ERROR_WANT_READ 2 # define SSL_ERROR_WANT_WRITE 3 # define SSL_ERROR_WANT_X509_LOOKUP 4 # define SSL_ERROR_SYSCALL 5/* look at error stack/return * value/errno */ # define SSL_ERROR_ZERO_RETURN 6 # define SSL_ERROR_WANT_CONNECT 7 # define SSL_ERROR_WANT_ACCEPT 8 # define SSL_CTRL_NEED_TMP_RSA 1 # define SSL_CTRL_SET_TMP_RSA 2 # define SSL_CTRL_SET_TMP_DH 3 # define SSL_CTRL_SET_TMP_ECDH 4 # define SSL_CTRL_SET_TMP_RSA_CB 5 # define SSL_CTRL_SET_TMP_DH_CB 6 # define SSL_CTRL_SET_TMP_ECDH_CB 7 # define SSL_CTRL_GET_SESSION_REUSED 8 # define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 # define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 # define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 # define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 # define SSL_CTRL_GET_FLAGS 13 # define SSL_CTRL_EXTRA_CHAIN_CERT 14 # define SSL_CTRL_SET_MSG_CALLBACK 15 # define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 /* only applies to datagram connections */ # define SSL_CTRL_SET_MTU 17 /* Stats */ # define SSL_CTRL_SESS_NUMBER 20 # define SSL_CTRL_SESS_CONNECT 21 # define SSL_CTRL_SESS_CONNECT_GOOD 22 # define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 # define SSL_CTRL_SESS_ACCEPT 24 # define SSL_CTRL_SESS_ACCEPT_GOOD 25 # define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 # define SSL_CTRL_SESS_HIT 27 # define SSL_CTRL_SESS_CB_HIT 28 # define SSL_CTRL_SESS_MISSES 29 # define SSL_CTRL_SESS_TIMEOUTS 30 # define SSL_CTRL_SESS_CACHE_FULL 31 # define SSL_CTRL_OPTIONS 32 # define SSL_CTRL_MODE 33 # define SSL_CTRL_GET_READ_AHEAD 40 # define SSL_CTRL_SET_READ_AHEAD 41 # define SSL_CTRL_SET_SESS_CACHE_SIZE 42 # define SSL_CTRL_GET_SESS_CACHE_SIZE 43 # define SSL_CTRL_SET_SESS_CACHE_MODE 44 # define SSL_CTRL_GET_SESS_CACHE_MODE 45 # define SSL_CTRL_GET_MAX_CERT_LIST 50 # define SSL_CTRL_SET_MAX_CERT_LIST 51 # define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 /* see tls1.h for macros based on these */ # ifndef OPENSSL_NO_TLSEXT # define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 # define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 # define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 # define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 # define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 # define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 # define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 # define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 # define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 # define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 # define SSL_CTRL_SET_SRP_ARG 78 # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 # define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 # define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 # ifndef OPENSSL_NO_HEARTBEATS # define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT 85 # define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING 86 # define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS 87 # endif # endif /* OPENSSL_NO_TLSEXT */ # define DTLS_CTRL_GET_TIMEOUT 73 # define DTLS_CTRL_HANDLE_TIMEOUT 74 # define DTLS_CTRL_LISTEN 75 # define SSL_CTRL_GET_RI_SUPPORT 76 # define SSL_CTRL_CLEAR_OPTIONS 77 # define SSL_CTRL_CLEAR_MODE 78 # define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 # define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 # define SSL_CTRL_CHAIN 88 # define SSL_CTRL_CHAIN_CERT 89 # define SSL_CTRL_GET_CURVES 90 # define SSL_CTRL_SET_CURVES 91 # define SSL_CTRL_SET_CURVES_LIST 92 # define SSL_CTRL_GET_SHARED_CURVE 93 # define SSL_CTRL_SET_ECDH_AUTO 94 # define SSL_CTRL_SET_SIGALGS 97 # define SSL_CTRL_SET_SIGALGS_LIST 98 # define SSL_CTRL_CERT_FLAGS 99 # define SSL_CTRL_CLEAR_CERT_FLAGS 100 # define SSL_CTRL_SET_CLIENT_SIGALGS 101 # define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 # define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 # define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 # define SSL_CTRL_BUILD_CERT_CHAIN 105 # define SSL_CTRL_SET_VERIFY_CERT_STORE 106 # define SSL_CTRL_SET_CHAIN_CERT_STORE 107 # define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 # define SSL_CTRL_GET_SERVER_TMP_KEY 109 # define SSL_CTRL_GET_RAW_CIPHERLIST 110 # define SSL_CTRL_GET_EC_POINT_FORMATS 111 # define SSL_CTRL_GET_CHAIN_CERTS 115 # define SSL_CTRL_SELECT_CURRENT_CERT 116 # define SSL_CTRL_SET_CURRENT_CERT 117 # define SSL_CTRL_CHECK_PROTO_VERSION 119 # define DTLS_CTRL_SET_LINK_MTU 120 # define DTLS_CTRL_GET_LINK_MIN_MTU 121 # define SSL_CERT_SET_FIRST 1 # define SSL_CERT_SET_NEXT 2 # define SSL_CERT_SET_SERVER 3 # define DTLSv1_get_timeout(ssl, arg) \ SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg) # define DTLSv1_handle_timeout(ssl) \ SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) # define DTLSv1_listen(ssl, peer) \ SSL_ctrl(ssl,DTLS_CTRL_LISTEN,0, (void *)peer) # define SSL_session_reused(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL) # define SSL_num_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) # define SSL_clear_num_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) # define SSL_total_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) # define SSL_CTX_need_tmp_RSA(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL) # define SSL_CTX_set_tmp_rsa(ctx,rsa) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) # define SSL_CTX_set_tmp_dh(ctx,dh) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh) # define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) # define SSL_need_tmp_RSA(ssl) \ SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL) # define SSL_set_tmp_rsa(ssl,rsa) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) # define SSL_set_tmp_dh(ssl,dh) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh) # define SSL_set_tmp_ecdh(ssl,ecdh) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) # define SSL_CTX_add_extra_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) # define SSL_CTX_get_extra_chain_certs(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) # define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) # define SSL_CTX_clear_extra_chain_certs(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) # define SSL_CTX_set0_chain(ctx,sk) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)sk) # define SSL_CTX_set1_chain(ctx,sk) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)sk) # define SSL_CTX_add0_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)x509) # define SSL_CTX_add1_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)x509) # define SSL_CTX_get0_chain_certs(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) # define SSL_CTX_clear_chain_certs(ctx) \ SSL_CTX_set0_chain(ctx,NULL) # define SSL_CTX_build_cert_chain(ctx, flags) \ SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) # define SSL_CTX_select_current_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)x509) # define SSL_CTX_set_current_cert(ctx, op) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) # define SSL_CTX_set0_verify_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)st) # define SSL_CTX_set1_verify_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)st) # define SSL_CTX_set0_chain_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)st) # define SSL_CTX_set1_chain_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)st) # define SSL_set0_chain(ctx,sk) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)sk) # define SSL_set1_chain(ctx,sk) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)sk) # define SSL_add0_chain_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)x509) # define SSL_add1_chain_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)x509) # define SSL_get0_chain_certs(ctx,px509) \ SSL_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) # define SSL_clear_chain_certs(ctx) \ SSL_set0_chain(ctx,NULL) # define SSL_build_cert_chain(s, flags) \ SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) # define SSL_select_current_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)x509) # define SSL_set_current_cert(ctx,op) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) # define SSL_set0_verify_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)st) # define SSL_set1_verify_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)st) # define SSL_set0_chain_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)st) # define SSL_set1_chain_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)st) # define SSL_get1_curves(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_GET_CURVES,0,(char *)s) # define SSL_CTX_set1_curves(ctx, clist, clistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURVES,clistlen,(char *)clist) # define SSL_CTX_set1_curves_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURVES_LIST,0,(char *)s) # define SSL_set1_curves(ctx, clist, clistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURVES,clistlen,(char *)clist) # define SSL_set1_curves_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURVES_LIST,0,(char *)s) # define SSL_get_shared_curve(s, n) \ SSL_ctrl(s,SSL_CTRL_GET_SHARED_CURVE,n,NULL) # define SSL_CTX_set_ecdh_auto(ctx, onoff) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_ECDH_AUTO,onoff,NULL) # define SSL_set_ecdh_auto(s, onoff) \ SSL_ctrl(s,SSL_CTRL_SET_ECDH_AUTO,onoff,NULL) # define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_CTX_set1_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_set1_sigalgs(ctx, slist, slistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_set1_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)slist) # define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)s) # define SSL_set1_client_sigalgs(ctx, slist, slistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,clistlen,(int *)slist) # define SSL_set1_client_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)s) # define SSL_get0_certificate_types(s, clist) \ SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)clist) # define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)clist) # define SSL_set1_client_certificate_types(s, clist, clistlen) \ SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)clist) # define SSL_get_peer_signature_nid(s, pn) \ SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) # define SSL_get_server_tmp_key(s, pk) \ SSL_ctrl(s,SSL_CTRL_GET_SERVER_TMP_KEY,0,pk) # define SSL_get0_raw_cipherlist(s, plst) \ SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,(char *)plst) # define SSL_get0_ec_point_formats(s, plst) \ SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,(char *)plst) # ifndef OPENSSL_NO_BIO BIO_METHOD *BIO_f_ssl(void); BIO *BIO_new_ssl(SSL_CTX *ctx, int client); BIO *BIO_new_ssl_connect(SSL_CTX *ctx); BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); int BIO_ssl_copy_session_id(BIO *to, BIO *from); void BIO_ssl_shutdown(BIO *ssl_bio); # endif int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); void SSL_CTX_free(SSL_CTX *); long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); long SSL_CTX_get_timeout(const SSL_CTX *ctx); X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); int SSL_want(const SSL *s); int SSL_clear(SSL *s); void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); char *SSL_CIPHER_get_version(const SSL_CIPHER *c); const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); int SSL_get_fd(const SSL *s); int SSL_get_rfd(const SSL *s); int SSL_get_wfd(const SSL *s); const char *SSL_get_cipher_list(const SSL *s, int n); char *SSL_get_shared_ciphers(const SSL *s, char *buf, int len); int SSL_get_read_ahead(const SSL *s); int SSL_pending(const SSL *s); # ifndef OPENSSL_NO_SOCK int SSL_set_fd(SSL *s, int fd); int SSL_set_rfd(SSL *s, int fd); int SSL_set_wfd(SSL *s, int fd); # endif # ifndef OPENSSL_NO_BIO void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); BIO *SSL_get_rbio(const SSL *s); BIO *SSL_get_wbio(const SSL *s); # endif int SSL_set_cipher_list(SSL *s, const char *str); void SSL_set_read_ahead(SSL *s, int yes); int SSL_get_verify_mode(const SSL *s); int SSL_get_verify_depth(const SSL *s); int (*SSL_get_verify_callback(const SSL *s)) (int, X509_STORE_CTX *); void SSL_set_verify(SSL *s, int mode, int (*callback) (int ok, X509_STORE_CTX *ctx)); void SSL_set_verify_depth(SSL *s, int depth); void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); # ifndef OPENSSL_NO_RSA int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); # endif int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len); int SSL_use_certificate(SSL *ssl, X509 *x); int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); # ifndef OPENSSL_NO_TLSEXT /* Set serverinfo data for the current active cert. */ int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, size_t serverinfo_length); # ifndef OPENSSL_NO_STDIO int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); # endif /* NO_STDIO */ # endif # ifndef OPENSSL_NO_STDIO int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); int SSL_use_certificate_file(SSL *ssl, const char *file, int type); int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); /* PEM type */ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, const char *file); # ifndef OPENSSL_SYS_VMS /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */ # ifndef OPENSSL_SYS_MACINTOSH_CLASSIC int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, const char *dir); # endif # endif # endif void SSL_load_error_strings(void); const char *SSL_state_string(const SSL *s); const char *SSL_rstate_string(const SSL *s); const char *SSL_state_string_long(const SSL *s); const char *SSL_rstate_string_long(const SSL *s); long SSL_SESSION_get_time(const SSL_SESSION *s); long SSL_SESSION_set_time(SSL_SESSION *s, long t); long SSL_SESSION_get_timeout(const SSL_SESSION *s); long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); void SSL_copy_session_id(SSL *to, const SSL *from); X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, unsigned int sid_ctx_len); SSL_SESSION *SSL_SESSION_new(void); const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len); unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); # ifndef OPENSSL_NO_FP_API int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); # endif # ifndef OPENSSL_NO_BIO int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); # endif void SSL_SESSION_free(SSL_SESSION *ses); int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); int SSL_set_session(SSL *to, SSL_SESSION *session); int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c); int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, unsigned int id_len); SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); # ifdef HEADER_X509_H X509 *SSL_get_peer_certificate(const SSL *s); # endif STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx)) (int, X509_STORE_CTX *); void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*callback) (int, X509_STORE_CTX *)); void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb) (X509_STORE_CTX *, void *), void *arg); void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), void *arg); # ifndef OPENSSL_NO_RSA int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); # endif int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d, long len); int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); int SSL_CTX_check_private_key(const SSL_CTX *ctx); int SSL_check_private_key(const SSL *ctx); int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len); SSL *SSL_new(SSL_CTX *ctx); int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, unsigned int sid_ctx_len); int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); int SSL_set_purpose(SSL *s, int purpose); int SSL_CTX_set_trust(SSL_CTX *s, int trust); int SSL_set_trust(SSL *s, int trust); int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); # ifndef OPENSSL_NO_SRP int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, char *(*cb) (SSL *, void *)); int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, int (*cb) (SSL *, void *)); int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, int (*cb) (SSL *, int *, void *)); int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, BIGNUM *sa, BIGNUM *v, char *info); int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, const char *grp); BIGNUM *SSL_get_srp_g(SSL *s); BIGNUM *SSL_get_srp_N(SSL *s); char *SSL_get_srp_username(SSL *s); char *SSL_get_srp_userinfo(SSL *s); # endif void SSL_certs_clear(SSL *s); void SSL_free(SSL *ssl); int SSL_accept(SSL *ssl); int SSL_connect(SSL *ssl); int SSL_read(SSL *ssl, void *buf, int num); int SSL_peek(SSL *ssl, void *buf, int num); int SSL_write(SSL *ssl, const void *buf, int num); long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); long SSL_callback_ctrl(SSL *, int, void (*)(void)); long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); int SSL_get_error(const SSL *s, int ret_code); const char *SSL_get_version(const SSL *s); /* This sets the 'default' SSL version that SSL_new() will create */ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); # ifndef OPENSSL_NO_SSL2_METHOD const SSL_METHOD *SSLv2_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ # endif # ifndef OPENSSL_NO_SSL3_METHOD const SSL_METHOD *SSLv3_method(void); /* SSLv3 */ const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ # endif const SSL_METHOD *SSLv23_method(void); /* Negotiate highest available SSL/TLS * version */ const SSL_METHOD *SSLv23_server_method(void); /* Negotiate highest available * SSL/TLS version */ const SSL_METHOD *SSLv23_client_method(void); /* Negotiate highest available * SSL/TLS version */ const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_1_server_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_1_client_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */ const SSL_METHOD *TLSv1_2_server_method(void); /* TLSv1.2 */ const SSL_METHOD *TLSv1_2_client_method(void); /* TLSv1.2 */ const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); int SSL_do_handshake(SSL *s); int SSL_renegotiate(SSL *s); int SSL_renegotiate_abbreviated(SSL *s); int SSL_renegotiate_pending(SSL *s); int SSL_shutdown(SSL *s); const SSL_METHOD *SSL_CTX_get_ssl_method(SSL_CTX *ctx); const SSL_METHOD *SSL_get_ssl_method(SSL *s); int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); const char *SSL_alert_type_string_long(int value); const char *SSL_alert_type_string(int value); const char *SSL_alert_desc_string_long(int value); const char *SSL_alert_desc_string(int value); void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); int SSL_add_client_CA(SSL *ssl, X509 *x); int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); void SSL_set_connect_state(SSL *s); void SSL_set_accept_state(SSL *s); long SSL_get_default_timeout(const SSL *s); int SSL_library_init(void); char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); SSL *SSL_dup(SSL *ssl); X509 *SSL_get_certificate(const SSL *ssl); /* * EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); void SSL_set_quiet_shutdown(SSL *ssl, int mode); int SSL_get_quiet_shutdown(const SSL *ssl); void SSL_set_shutdown(SSL *ssl, int mode); int SSL_get_shutdown(const SSL *ssl); int SSL_version(const SSL *ssl); int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath); # define SSL_get0_session SSL_get_session/* just peek at pointer */ SSL_SESSION *SSL_get_session(const SSL *ssl); SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); void SSL_set_info_callback(SSL *ssl, void (*cb) (const SSL *ssl, int type, int val)); void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val); int SSL_state(const SSL *ssl); void SSL_set_state(SSL *ssl, int state); void SSL_set_verify_result(SSL *ssl, long v); long SSL_get_verify_result(const SSL *ssl); int SSL_set_ex_data(SSL *ssl, int idx, void *data); void *SSL_get_ex_data(const SSL *ssl, int idx); int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_get_ex_data_X509_STORE_CTX_idx(void); # define SSL_CTX_sess_set_cache_size(ctx,t) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) # define SSL_CTX_sess_get_cache_size(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) # define SSL_CTX_set_session_cache_mode(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) # define SSL_CTX_get_session_cache_mode(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) # define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) # define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) # define SSL_CTX_get_read_ahead(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) # define SSL_CTX_set_read_ahead(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) # define SSL_CTX_get_max_cert_list(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) # define SSL_CTX_set_max_cert_list(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) # define SSL_get_max_cert_list(ssl) \ SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) # define SSL_set_max_cert_list(ssl,m) \ SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) # define SSL_CTX_set_max_send_fragment(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) # define SSL_set_max_send_fragment(ssl,m) \ SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) /* NB: the keylength is only applicable when is_export is true */ # ifndef OPENSSL_NO_RSA void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb) (SSL *ssl, int is_export, int keylength)); # endif # ifndef OPENSSL_NO_DH void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*dh) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*dh) (SSL *ssl, int is_export, int keylength)); # endif # ifndef OPENSSL_NO_ECDH void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, EC_KEY *(*ecdh) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_ecdh_callback(SSL *ssl, EC_KEY *(*ecdh) (SSL *ssl, int is_export, int keylength)); # endif const COMP_METHOD *SSL_get_current_compression(SSL *s); const COMP_METHOD *SSL_get_current_expansion(SSL *s); const char *SSL_COMP_get_name(const COMP_METHOD *comp); STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) *meths); void SSL_COMP_free_compression_methods(void); int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); /* TLS extensions functions */ int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, void *arg); /* Pre-shared secret session resumption functions */ int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg); void SSL_set_debug(SSL *s, int debug); int SSL_cache_hit(SSL *s); int SSL_is_server(SSL *s); SSL_CONF_CTX *SSL_CONF_CTX_new(void); int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, unsigned int flags); int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); # ifndef OPENSSL_NO_SSL_TRACE void SSL_trace(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); # endif # ifndef OPENSSL_NO_UNIT_TEST const struct openssl_ssl_test_functions *SSL_test_functions(void); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_SSL_strings(void); /* Error codes for the SSL functions. */ /* Function codes. */ # define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 # define SSL_F_CLIENT_CERTIFICATE 100 # define SSL_F_CLIENT_FINISHED 167 # define SSL_F_CLIENT_HELLO 101 # define SSL_F_CLIENT_MASTER_KEY 102 # define SSL_F_D2I_SSL_SESSION 103 # define SSL_F_DO_DTLS1_WRITE 245 # define SSL_F_DO_SSL3_WRITE 104 # define SSL_F_DTLS1_ACCEPT 246 # define SSL_F_DTLS1_ADD_CERT_TO_BUF 295 # define SSL_F_DTLS1_BUFFER_RECORD 247 # define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 316 # define SSL_F_DTLS1_CLIENT_HELLO 248 # define SSL_F_DTLS1_CONNECT 249 # define SSL_F_DTLS1_ENC 250 # define SSL_F_DTLS1_GET_HELLO_VERIFY 251 # define SSL_F_DTLS1_GET_MESSAGE 252 # define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253 # define SSL_F_DTLS1_GET_RECORD 254 # define SSL_F_DTLS1_HANDLE_TIMEOUT 297 # define SSL_F_DTLS1_HEARTBEAT 305 # define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255 # define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 # define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 # define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256 # define SSL_F_DTLS1_PROCESS_RECORD 257 # define SSL_F_DTLS1_READ_BYTES 258 # define SSL_F_DTLS1_READ_FAILED 259 # define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 260 # define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 261 # define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 262 # define SSL_F_DTLS1_SEND_CLIENT_VERIFY 263 # define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 264 # define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 265 # define SSL_F_DTLS1_SEND_SERVER_HELLO 266 # define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 267 # define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 # define SSL_F_GET_CLIENT_FINISHED 105 # define SSL_F_GET_CLIENT_HELLO 106 # define SSL_F_GET_CLIENT_MASTER_KEY 107 # define SSL_F_GET_SERVER_FINISHED 108 # define SSL_F_GET_SERVER_HELLO 109 # define SSL_F_GET_SERVER_STATIC_DH_KEY 340 # define SSL_F_GET_SERVER_VERIFY 110 # define SSL_F_I2D_SSL_SESSION 111 # define SSL_F_READ_N 112 # define SSL_F_REQUEST_CERTIFICATE 113 # define SSL_F_SERVER_FINISH 239 # define SSL_F_SERVER_HELLO 114 # define SSL_F_SERVER_VERIFY 240 # define SSL_F_SSL23_ACCEPT 115 # define SSL_F_SSL23_CLIENT_HELLO 116 # define SSL_F_SSL23_CONNECT 117 # define SSL_F_SSL23_GET_CLIENT_HELLO 118 # define SSL_F_SSL23_GET_SERVER_HELLO 119 # define SSL_F_SSL23_PEEK 237 # define SSL_F_SSL23_READ 120 # define SSL_F_SSL23_WRITE 121 # define SSL_F_SSL2_ACCEPT 122 # define SSL_F_SSL2_CONNECT 123 # define SSL_F_SSL2_ENC_INIT 124 # define SSL_F_SSL2_GENERATE_KEY_MATERIAL 241 # define SSL_F_SSL2_PEEK 234 # define SSL_F_SSL2_READ 125 # define SSL_F_SSL2_READ_INTERNAL 236 # define SSL_F_SSL2_SET_CERTIFICATE 126 # define SSL_F_SSL2_WRITE 127 # define SSL_F_SSL3_ACCEPT 128 # define SSL_F_SSL3_ADD_CERT_TO_BUF 296 # define SSL_F_SSL3_CALLBACK_CTRL 233 # define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 # define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 # define SSL_F_SSL3_CHECK_CLIENT_HELLO 304 # define SSL_F_SSL3_CHECK_FINISHED 339 # define SSL_F_SSL3_CLIENT_HELLO 131 # define SSL_F_SSL3_CONNECT 132 # define SSL_F_SSL3_CTRL 213 # define SSL_F_SSL3_CTX_CTRL 133 # define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 # define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 # define SSL_F_SSL3_ENC 134 # define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 # define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 # define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 # define SSL_F_SSL3_GET_CERT_STATUS 289 # define SSL_F_SSL3_GET_CERT_VERIFY 136 # define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 # define SSL_F_SSL3_GET_CLIENT_HELLO 138 # define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 # define SSL_F_SSL3_GET_FINISHED 140 # define SSL_F_SSL3_GET_KEY_EXCHANGE 141 # define SSL_F_SSL3_GET_MESSAGE 142 # define SSL_F_SSL3_GET_NEW_SESSION_TICKET 283 # define SSL_F_SSL3_GET_NEXT_PROTO 306 # define SSL_F_SSL3_GET_RECORD 143 # define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 # define SSL_F_SSL3_GET_SERVER_DONE 145 # define SSL_F_SSL3_GET_SERVER_HELLO 146 # define SSL_F_SSL3_HANDSHAKE_MAC 285 # define SSL_F_SSL3_NEW_SESSION_TICKET 287 # define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 # define SSL_F_SSL3_PEEK 235 # define SSL_F_SSL3_READ_BYTES 148 # define SSL_F_SSL3_READ_N 149 # define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 # define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 # define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 # define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 # define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 # define SSL_F_SSL3_SEND_SERVER_HELLO 242 # define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 # define SSL_F_SSL3_SETUP_KEY_BLOCK 157 # define SSL_F_SSL3_SETUP_READ_BUFFER 156 # define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 # define SSL_F_SSL3_WRITE_BYTES 158 # define SSL_F_SSL3_WRITE_PENDING 159 # define SSL_F_SSL_ADD_CERT_CHAIN 318 # define SSL_F_SSL_ADD_CERT_TO_BUF 319 # define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 # define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 # define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 # define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 # define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 # define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 # define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 # define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 # define SSL_F_SSL_BAD_METHOD 160 # define SSL_F_SSL_BUILD_CERT_CHAIN 332 # define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 # define SSL_F_SSL_CERT_DUP 221 # define SSL_F_SSL_CERT_INST 222 # define SSL_F_SSL_CERT_INSTANTIATE 214 # define SSL_F_SSL_CERT_NEW 162 # define SSL_F_SSL_CHECK_PRIVATE_KEY 163 # define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 # define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 # define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 # define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 # define SSL_F_SSL_CLEAR 164 # define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 # define SSL_F_SSL_CONF_CMD 334 # define SSL_F_SSL_CREATE_CIPHER_LIST 166 # define SSL_F_SSL_CTRL 232 # define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 # define SSL_F_SSL_CTX_MAKE_PROFILES 309 # define SSL_F_SSL_CTX_NEW 169 # define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 # define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 # define SSL_F_SSL_CTX_SET_PURPOSE 226 # define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 # define SSL_F_SSL_CTX_SET_SSL_VERSION 170 # define SSL_F_SSL_CTX_SET_TRUST 229 # define SSL_F_SSL_CTX_USE_CERTIFICATE 171 # define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 # define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220 # define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 # define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 # define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 # define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 # define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 # define SSL_F_SSL_CTX_USE_SERVERINFO 336 # define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 # define SSL_F_SSL_DO_HANDSHAKE 180 # define SSL_F_SSL_GET_NEW_SESSION 181 # define SSL_F_SSL_GET_PREV_SESSION 217 # define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 # define SSL_F_SSL_GET_SERVER_SEND_CERT 182 # define SSL_F_SSL_GET_SERVER_SEND_PKEY 317 # define SSL_F_SSL_GET_SIGN_PKEY 183 # define SSL_F_SSL_INIT_WBIO_BUFFER 184 # define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 # define SSL_F_SSL_NEW 186 # define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 # define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 # define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 # define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 # define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 # define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 # define SSL_F_SSL_PEEK 270 # define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 281 # define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 282 # define SSL_F_SSL_READ 223 # define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187 # define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188 # define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 # define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 # define SSL_F_SSL_SESSION_DUP 348 # define SSL_F_SSL_SESSION_NEW 189 # define SSL_F_SSL_SESSION_PRINT_FP 190 # define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 # define SSL_F_SSL_SESS_CERT_NEW 225 # define SSL_F_SSL_SET_CERT 191 # define SSL_F_SSL_SET_CIPHER_LIST 271 # define SSL_F_SSL_SET_FD 192 # define SSL_F_SSL_SET_PKEY 193 # define SSL_F_SSL_SET_PURPOSE 227 # define SSL_F_SSL_SET_RFD 194 # define SSL_F_SSL_SET_SESSION 195 # define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 # define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 # define SSL_F_SSL_SET_TRUST 228 # define SSL_F_SSL_SET_WFD 196 # define SSL_F_SSL_SHUTDOWN 224 # define SSL_F_SSL_SRP_CTX_INIT 313 # define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 # define SSL_F_SSL_UNDEFINED_FUNCTION 197 # define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 # define SSL_F_SSL_USE_CERTIFICATE 198 # define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 # define SSL_F_SSL_USE_CERTIFICATE_FILE 200 # define SSL_F_SSL_USE_PRIVATEKEY 201 # define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 # define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 # define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 # define SSL_F_SSL_USE_RSAPRIVATEKEY 204 # define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 # define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 # define SSL_F_SSL_VERIFY_CERT_CHAIN 207 # define SSL_F_SSL_WRITE 208 # define SSL_F_TLS12_CHECK_PEER_SIGALG 333 # define SSL_F_TLS1_CERT_VERIFY_MAC 286 # define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 # define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT 274 # define SSL_F_TLS1_ENC 210 # define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 # define SSL_F_TLS1_GET_CURVELIST 338 # define SSL_F_TLS1_HEARTBEAT 315 # define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT 275 # define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT 276 # define SSL_F_TLS1_PRF 284 # define SSL_F_TLS1_SETUP_KEY_BLOCK 211 # define SSL_F_TLS1_SET_SERVER_SIGALGS 335 # define SSL_F_WRITE_PENDING 212 /* Reason codes. */ # define SSL_R_APP_DATA_IN_HANDSHAKE 100 # define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 # define SSL_R_BAD_ALERT_RECORD 101 # define SSL_R_BAD_AUTHENTICATION_TYPE 102 # define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 # define SSL_R_BAD_CHECKSUM 104 # define SSL_R_BAD_DATA 390 # define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 # define SSL_R_BAD_DECOMPRESSION 107 # define SSL_R_BAD_DH_G_LENGTH 108 # define SSL_R_BAD_DH_G_VALUE 375 # define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 # define SSL_R_BAD_DH_PUB_KEY_VALUE 393 # define SSL_R_BAD_DH_P_LENGTH 110 # define SSL_R_BAD_DH_P_VALUE 395 # define SSL_R_BAD_DIGEST_LENGTH 111 # define SSL_R_BAD_DSA_SIGNATURE 112 # define SSL_R_BAD_ECC_CERT 304 # define SSL_R_BAD_ECDSA_SIGNATURE 305 # define SSL_R_BAD_ECPOINT 306 # define SSL_R_BAD_HANDSHAKE_LENGTH 332 # define SSL_R_BAD_HELLO_REQUEST 105 # define SSL_R_BAD_LENGTH 271 # define SSL_R_BAD_MAC_DECODE 113 # define SSL_R_BAD_MAC_LENGTH 333 # define SSL_R_BAD_MESSAGE_TYPE 114 # define SSL_R_BAD_PACKET_LENGTH 115 # define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 # define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH 316 # define SSL_R_BAD_RESPONSE_ARGUMENT 117 # define SSL_R_BAD_RSA_DECRYPT 118 # define SSL_R_BAD_RSA_ENCRYPT 119 # define SSL_R_BAD_RSA_E_LENGTH 120 # define SSL_R_BAD_RSA_MODULUS_LENGTH 121 # define SSL_R_BAD_RSA_SIGNATURE 122 # define SSL_R_BAD_SIGNATURE 123 # define SSL_R_BAD_SRP_A_LENGTH 347 # define SSL_R_BAD_SRP_B_LENGTH 348 # define SSL_R_BAD_SRP_G_LENGTH 349 # define SSL_R_BAD_SRP_N_LENGTH 350 # define SSL_R_BAD_SRP_PARAMETERS 371 # define SSL_R_BAD_SRP_S_LENGTH 351 # define SSL_R_BAD_SRTP_MKI_VALUE 352 # define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 # define SSL_R_BAD_SSL_FILETYPE 124 # define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 # define SSL_R_BAD_STATE 126 # define SSL_R_BAD_VALUE 384 # define SSL_R_BAD_WRITE_RETRY 127 # define SSL_R_BIO_NOT_SET 128 # define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 # define SSL_R_BN_LIB 130 # define SSL_R_CA_DN_LENGTH_MISMATCH 131 # define SSL_R_CA_DN_TOO_LONG 132 # define SSL_R_CCS_RECEIVED_EARLY 133 # define SSL_R_CERTIFICATE_VERIFY_FAILED 134 # define SSL_R_CERT_CB_ERROR 377 # define SSL_R_CERT_LENGTH_MISMATCH 135 # define SSL_R_CHALLENGE_IS_DIFFERENT 136 # define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 # define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 # define SSL_R_CIPHER_TABLE_SRC_ERROR 139 # define SSL_R_CLIENTHELLO_TLSEXT 226 # define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 # define SSL_R_COMPRESSION_DISABLED 343 # define SSL_R_COMPRESSION_FAILURE 141 # define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 # define SSL_R_COMPRESSION_LIBRARY_ERROR 142 # define SSL_R_CONNECTION_ID_IS_DIFFERENT 143 # define SSL_R_CONNECTION_TYPE_NOT_SET 144 # define SSL_R_COOKIE_MISMATCH 308 # define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 # define SSL_R_DATA_LENGTH_TOO_LONG 146 # define SSL_R_DECRYPTION_FAILED 147 # define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 # define SSL_R_DH_KEY_TOO_SMALL 372 # define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 # define SSL_R_DIGEST_CHECK_FAILED 149 # define SSL_R_DTLS_MESSAGE_TOO_BIG 334 # define SSL_R_DUPLICATE_COMPRESSION_ID 309 # define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT 317 # define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 # define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE 322 # define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE 323 # define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 # define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310 # define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 # define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 # define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282 # define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 # define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 # define SSL_R_EXTRA_DATA_IN_MESSAGE 153 # define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 # define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS 355 # define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 356 # define SSL_R_HTTPS_PROXY_REQUEST 155 # define SSL_R_HTTP_REQUEST 156 # define SSL_R_ILLEGAL_PADDING 283 # define SSL_R_ILLEGAL_SUITEB_DIGEST 380 # define SSL_R_INAPPROPRIATE_FALLBACK 373 # define SSL_R_INCONSISTENT_COMPRESSION 340 # define SSL_R_INVALID_CHALLENGE_LENGTH 158 # define SSL_R_INVALID_COMMAND 280 # define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 # define SSL_R_INVALID_NULL_CMD_NAME 385 # define SSL_R_INVALID_PURPOSE 278 # define SSL_R_INVALID_SERVERINFO_DATA 388 # define SSL_R_INVALID_SRP_USERNAME 357 # define SSL_R_INVALID_STATUS_RESPONSE 328 # define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 # define SSL_R_INVALID_TRUST 279 # define SSL_R_KEY_ARG_TOO_LONG 284 # define SSL_R_KRB5 285 # define SSL_R_KRB5_C_CC_PRINC 286 # define SSL_R_KRB5_C_GET_CRED 287 # define SSL_R_KRB5_C_INIT 288 # define SSL_R_KRB5_C_MK_REQ 289 # define SSL_R_KRB5_S_BAD_TICKET 290 # define SSL_R_KRB5_S_INIT 291 # define SSL_R_KRB5_S_RD_REQ 292 # define SSL_R_KRB5_S_TKT_EXPIRED 293 # define SSL_R_KRB5_S_TKT_NYV 294 # define SSL_R_KRB5_S_TKT_SKEW 295 # define SSL_R_LENGTH_MISMATCH 159 # define SSL_R_LENGTH_TOO_SHORT 160 # define SSL_R_LIBRARY_BUG 274 # define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 # define SSL_R_MESSAGE_TOO_LONG 296 # define SSL_R_MISSING_DH_DSA_CERT 162 # define SSL_R_MISSING_DH_KEY 163 # define SSL_R_MISSING_DH_RSA_CERT 164 # define SSL_R_MISSING_DSA_SIGNING_CERT 165 # define SSL_R_MISSING_ECDH_CERT 382 # define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 # define SSL_R_MISSING_EXPORT_TMP_DH_KEY 166 # define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 167 # define SSL_R_MISSING_RSA_CERTIFICATE 168 # define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 # define SSL_R_MISSING_RSA_SIGNING_CERT 170 # define SSL_R_MISSING_SRP_PARAM 358 # define SSL_R_MISSING_TMP_DH_KEY 171 # define SSL_R_MISSING_TMP_ECDH_KEY 311 # define SSL_R_MISSING_TMP_RSA_KEY 172 # define SSL_R_MISSING_TMP_RSA_PKEY 173 # define SSL_R_MISSING_VERIFY_MESSAGE 174 # define SSL_R_MULTIPLE_SGC_RESTARTS 346 # define SSL_R_NON_SSLV2_INITIAL_PACKET 175 # define SSL_R_NO_CERTIFICATES_RETURNED 176 # define SSL_R_NO_CERTIFICATE_ASSIGNED 177 # define SSL_R_NO_CERTIFICATE_RETURNED 178 # define SSL_R_NO_CERTIFICATE_SET 179 # define SSL_R_NO_CERTIFICATE_SPECIFIED 180 # define SSL_R_NO_CIPHERS_AVAILABLE 181 # define SSL_R_NO_CIPHERS_PASSED 182 # define SSL_R_NO_CIPHERS_SPECIFIED 183 # define SSL_R_NO_CIPHER_LIST 184 # define SSL_R_NO_CIPHER_MATCH 185 # define SSL_R_NO_CLIENT_CERT_METHOD 331 # define SSL_R_NO_CLIENT_CERT_RECEIVED 186 # define SSL_R_NO_COMPRESSION_SPECIFIED 187 # define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 # define SSL_R_NO_METHOD_SPECIFIED 188 # define SSL_R_NO_PEM_EXTENSIONS 389 # define SSL_R_NO_PRIVATEKEY 189 # define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 # define SSL_R_NO_PROTOCOLS_AVAILABLE 191 # define SSL_R_NO_PUBLICKEY 192 # define SSL_R_NO_RENEGOTIATION 339 # define SSL_R_NO_REQUIRED_DIGEST 324 # define SSL_R_NO_SHARED_CIPHER 193 # define SSL_R_NO_SHARED_SIGATURE_ALGORITHMS 376 # define SSL_R_NO_SRTP_PROFILES 359 # define SSL_R_NO_VERIFY_CALLBACK 194 # define SSL_R_NULL_SSL_CTX 195 # define SSL_R_NULL_SSL_METHOD_PASSED 196 # define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 # define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 # define SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE 387 # define SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE 379 # define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297 # define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG 327 # define SSL_R_PACKET_LENGTH_TOO_LONG 198 # define SSL_R_PARSE_TLSEXT 227 # define SSL_R_PATH_TOO_LONG 270 # define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 # define SSL_R_PEER_ERROR 200 # define SSL_R_PEER_ERROR_CERTIFICATE 201 # define SSL_R_PEER_ERROR_NO_CERTIFICATE 202 # define SSL_R_PEER_ERROR_NO_CIPHER 203 # define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 204 # define SSL_R_PEM_NAME_BAD_PREFIX 391 # define SSL_R_PEM_NAME_TOO_SHORT 392 # define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205 # define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206 # define SSL_R_PROTOCOL_IS_SHUTDOWN 207 # define SSL_R_PSK_IDENTITY_NOT_FOUND 223 # define SSL_R_PSK_NO_CLIENT_CB 224 # define SSL_R_PSK_NO_SERVER_CB 225 # define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208 # define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209 # define SSL_R_PUBLIC_KEY_NOT_RSA 210 # define SSL_R_READ_BIO_NOT_SET 211 # define SSL_R_READ_TIMEOUT_EXPIRED 312 # define SSL_R_READ_WRONG_PACKET_TYPE 212 # define SSL_R_RECORD_LENGTH_MISMATCH 213 # define SSL_R_RECORD_TOO_LARGE 214 # define SSL_R_RECORD_TOO_SMALL 298 # define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 # define SSL_R_RENEGOTIATION_ENCODING_ERR 336 # define SSL_R_RENEGOTIATION_MISMATCH 337 # define SSL_R_REQUIRED_CIPHER_MISSING 215 # define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING 342 # define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216 # define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217 # define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218 # define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 # define SSL_R_SERVERHELLO_TLSEXT 275 # define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 # define SSL_R_SHORT_READ 219 # define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 # define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 # define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 # define SSL_R_SRP_A_CALC 361 # define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 # define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 # define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 # define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 # define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299 # define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT 321 # define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 # define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 # define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 # define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 # define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 # define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 # define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 # define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 # define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 # define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 # define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 # define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 # define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 # define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 # define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 # define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 # define SSL_R_SSL_HANDSHAKE_FAILURE 229 # define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 # define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 # define SSL_R_SSL_SESSION_ID_CONFLICT 302 # define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 # define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 # define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 # define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 # define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 # define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 # define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 # define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 # define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 # define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 # define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 # define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 # define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 # define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 # define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 # define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 # define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 # define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 # define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 # define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 # define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 # define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 # define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 # define SSL_R_TLS_HEARTBEAT_PENDING 366 # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 # define SSL_R_TOO_MANY_WARN_ALERTS 409 # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 # define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236 # define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313 # define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237 # define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238 # define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 # define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 # define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240 # define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241 # define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 # define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 # define SSL_R_UNEXPECTED_MESSAGE 244 # define SSL_R_UNEXPECTED_RECORD 245 # define SSL_R_UNINITIALIZED 276 # define SSL_R_UNKNOWN_ALERT_TYPE 246 # define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 # define SSL_R_UNKNOWN_CIPHER_RETURNED 248 # define SSL_R_UNKNOWN_CIPHER_TYPE 249 # define SSL_R_UNKNOWN_CMD_NAME 386 # define SSL_R_UNKNOWN_DIGEST 368 # define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 # define SSL_R_UNKNOWN_PKEY_TYPE 251 # define SSL_R_UNKNOWN_PROTOCOL 252 # define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253 # define SSL_R_UNKNOWN_SSL_VERSION 254 # define SSL_R_UNKNOWN_STATE 255 # define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 # define SSL_R_UNSUPPORTED_CIPHER 256 # define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 # define SSL_R_UNSUPPORTED_DIGEST_TYPE 326 # define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 # define SSL_R_UNSUPPORTED_PROTOCOL 258 # define SSL_R_UNSUPPORTED_SSL_VERSION 259 # define SSL_R_UNSUPPORTED_STATUS_TYPE 329 # define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 # define SSL_R_WRITE_BIO_NOT_SET 260 # define SSL_R_WRONG_CERTIFICATE_TYPE 383 # define SSL_R_WRONG_CIPHER_RETURNED 261 # define SSL_R_WRONG_CURVE 378 # define SSL_R_WRONG_MESSAGE_TYPE 262 # define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263 # define SSL_R_WRONG_SIGNATURE_LENGTH 264 # define SSL_R_WRONG_SIGNATURE_SIZE 265 # define SSL_R_WRONG_SIGNATURE_TYPE 370 # define SSL_R_WRONG_SSL_VERSION 266 # define SSL_R_WRONG_VERSION_NUMBER 267 # define SSL_R_X509_LIB 268 # define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 #ifdef __cplusplus } #endif #endif diff --git a/ssl/ssltest.c b/ssl/ssltest.c index 2d6141cd954e..f6a8f195eeb7 100644 --- a/ssl/ssltest.c +++ b/ssl/ssltest.c @@ -1,3369 +1,3370 @@ /* ssl/ssltest.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECC cipher suite support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ /* ==================================================================== * Copyright 2005 Nokia. All rights reserved. * * The portions of the attached software ("Contribution") is developed by * Nokia Corporation and is licensed pursuant to the OpenSSL open source * license. * * The Contribution, originally written by Mika Kousa and Pasi Eronen of * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites * support (see RFC 4279) to OpenSSL. * * No patent licenses or other rights except those expressly stated in * the OpenSSL open source license shall be deemed granted or received * expressly, by implication, estoppel, or otherwise. * * No assurances are provided by Nokia that the Contribution does not * infringe the patent or other intellectual property rights of any third * party or that the license provides you with all the necessary rights * to make use of the Contribution. * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR * OTHERWISE. */ /* Or gethostname won't be declared properly on Linux and GNU platforms. */ #define _BSD_SOURCE 1 #define _DEFAULT_SOURCE 1 #include #include #include #include #include #include #include #define USE_SOCKETS #include "e_os.h" #ifdef OPENSSL_SYS_VMS /* * Or isascii won't be declared properly on VMS (at least with DECompHP C). */ # define _XOPEN_SOURCE 500 #endif #include #include #include #include #include #include #include #ifndef OPENSSL_NO_ENGINE # include #endif #include #include #ifndef OPENSSL_NO_RSA # include #endif #ifndef OPENSSL_NO_DSA # include #endif #ifndef OPENSSL_NO_DH # include #endif #ifndef OPENSSL_NO_SRP # include #endif #include /* * Or gethostname won't be declared properly * on Compaq platforms (at least with DEC C). * Do not try to put it earlier, or IPv6 includes * get screwed... */ #define _XOPEN_SOURCE_EXTENDED 1 #ifdef OPENSSL_SYS_WINDOWS # include #else # include OPENSSL_UNISTD #endif #ifdef OPENSSL_SYS_VMS # define TEST_SERVER_CERT "SYS$DISK:[-.APPS]SERVER.PEM" # define TEST_CLIENT_CERT "SYS$DISK:[-.APPS]CLIENT.PEM" #elif defined(OPENSSL_SYS_WINCE) # define TEST_SERVER_CERT "\\OpenSSL\\server.pem" # define TEST_CLIENT_CERT "\\OpenSSL\\client.pem" #elif defined(OPENSSL_SYS_NETWARE) # define TEST_SERVER_CERT "\\openssl\\apps\\server.pem" # define TEST_CLIENT_CERT "\\openssl\\apps\\client.pem" #else # define TEST_SERVER_CERT "../apps/server.pem" # define TEST_CLIENT_CERT "../apps/client.pem" #endif static SSL_CTX *s_ctx = NULL; static SSL_CTX *s_ctx2 = NULL; /* * There is really no standard for this, so let's assign some tentative * numbers. In any case, these numbers are only for this test */ #define COMP_RLE 255 #define COMP_ZLIB 1 static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); #ifndef OPENSSL_NO_RSA static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength); static void free_tmp_rsa(void); #endif static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg); #define APP_CALLBACK_STRING "Test Callback Argument" struct app_verify_arg { char *string; int app_verify; int allow_proxy_certs; char *proxy_auth; char *proxy_cond; }; #ifndef OPENSSL_NO_DH static DH *get_dh512(void); static DH *get_dh1024(void); static DH *get_dh1024dsa(void); #endif static char *psk_key = NULL; /* by default PSK is not used */ #ifndef OPENSSL_NO_PSK static unsigned int psk_client_callback(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); static unsigned int psk_server_callback(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); #endif #ifndef OPENSSL_NO_SRP /* SRP client */ /* This is a context that we pass to all callbacks */ typedef struct srp_client_arg_st { char *srppassin; char *srplogin; } SRP_CLIENT_ARG; # define PWD_STRLEN 1024 static char *MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg) { SRP_CLIENT_ARG *srp_client_arg = (SRP_CLIENT_ARG *)arg; return BUF_strdup((char *)srp_client_arg->srppassin); } /* SRP server */ /* This is a context that we pass to SRP server callbacks */ typedef struct srp_server_arg_st { char *expected_user; char *pass; } SRP_SERVER_ARG; static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg) { SRP_SERVER_ARG *p = (SRP_SERVER_ARG *)arg; if (strcmp(p->expected_user, SSL_get_srp_username(s)) != 0) { fprintf(stderr, "User %s doesn't exist\n", SSL_get_srp_username(s)); return SSL3_AL_FATAL; } if (SSL_set_srp_server_param_pw(s, p->expected_user, p->pass, "1024") < 0) { *ad = SSL_AD_INTERNAL_ERROR; return SSL3_AL_FATAL; } return SSL_ERROR_NONE; } #endif static BIO *bio_err = NULL; static BIO *bio_stdout = NULL; static const char *alpn_client; static char *alpn_server; static char *alpn_server2; static const char *alpn_expected; static unsigned char *alpn_selected; static const char *sn_client; static const char *sn_server1; static const char *sn_server2; static int sn_expect = 0; static int s_ticket1 = 0; static int s_ticket2 = 0; static int c_ticket = 0; static int ticket_expect = -1; static int sni_in_cert_cb = 0; static const char *client_sigalgs = NULL; static const char *server_digest_expect = NULL; static int servername_cb(SSL *s, int *ad, void *arg) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); if (sn_server2 == NULL) { BIO_printf(bio_stdout, "Servername 2 is NULL\n"); return SSL_TLSEXT_ERR_NOACK; } if (servername != NULL) { if (s_ctx2 != NULL && sn_server2 != NULL && !strcasecmp(servername, sn_server2)) { BIO_printf(bio_stdout, "Switching server context.\n"); SSL_set_SSL_CTX(s, s_ctx2); /* Copy over all the SSL_CTX options */ SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(s_ctx2)); } } return SSL_TLSEXT_ERR_OK; } static int verify_servername(SSL *client, SSL *server) { /* just need to see if sn_context is what we expect */ SSL_CTX* ctx = SSL_get_SSL_CTX(server); if (sn_expect == 0) return 0; if (sn_expect == 1 && ctx == s_ctx) return 0; if (sn_expect == 2 && ctx == s_ctx2) return 0; BIO_printf(bio_stdout, "Servername: expected context %d\n", sn_expect); if (ctx == s_ctx2) BIO_printf(bio_stdout, "Servername: context is 2\n"); else if (ctx == s_ctx) BIO_printf(bio_stdout, "Servername: context is 1\n"); else BIO_printf(bio_stdout, "Servername: context is unknown\n"); return -1; } static int cert_cb(SSL *ssl, void *arg) { int unused; return servername_cb(ssl, &unused, NULL) != SSL_TLSEXT_ERR_ALERT_FATAL; } static int verify_ticket(SSL* ssl) { if (ticket_expect == -1) return 0; if (ticket_expect == 0 && (ssl->session->tlsext_tick == NULL || ssl->session->tlsext_ticklen == 0)) return 1; if (ticket_expect == 1 && (ssl->session->tlsext_tick != NULL && ssl->session->tlsext_ticklen != 0)) return 1; return -1; } static int verify_server_digest(SSL* ssl) { int nid = NID_undef; if (server_digest_expect == NULL) return 0; SSL_get_peer_signature_nid(ssl, &nid); if (strcmp(server_digest_expect, OBJ_nid2sn(nid)) == 0) return 1; BIO_printf(bio_stdout, "Expected server digest %s, got %s.\n", server_digest_expect, OBJ_nid2sn(nid)); return -1; } /*- * next_protos_parse parses a comma separated list of strings into a string * in a format suitable for passing to SSL_CTX_set_next_protos_advertised. * outlen: (output) set to the length of the resulting buffer on success. * err: (maybe NULL) on failure, an error message line is written to this BIO. * in: a NUL terminated string like "abc,def,ghi" * * returns: a malloced buffer or NULL on failure. */ static unsigned char *next_protos_parse(unsigned short *outlen, const char *in) { size_t len; unsigned char *out; size_t i, start = 0; len = strlen(in); if (len >= 65535) return NULL; out = OPENSSL_malloc(strlen(in) + 1); if (!out) return NULL; for (i = 0; i <= len; ++i) { if (i == len || in[i] == ',') { if (i - start > 255) { OPENSSL_free(out); return NULL; } - out[start] = i - start; + out[start] = (unsigned char)(i - start); start = i + 1; } else out[i + 1] = in[i]; } - *outlen = len + 1; + *outlen = (unsigned char)(len + 1); return out; } static int cb_server_alpn(SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { unsigned char *protos; unsigned short protos_len; char* alpn_str = arg; protos = next_protos_parse(&protos_len, alpn_str); if (protos == NULL) { fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", alpn_str); abort(); } if (SSL_select_next_proto ((unsigned char **)out, outlen, protos, protos_len, in, inlen) != OPENSSL_NPN_NEGOTIATED) { OPENSSL_free(protos); return SSL_TLSEXT_ERR_NOACK; } /* * Make a copy of the selected protocol which will be freed in * verify_alpn. */ alpn_selected = OPENSSL_malloc(*outlen); memcpy(alpn_selected, *out, *outlen); *out = alpn_selected; OPENSSL_free(protos); return SSL_TLSEXT_ERR_OK; } static int verify_alpn(SSL *client, SSL *server) { const unsigned char *client_proto, *server_proto; unsigned int client_proto_len = 0, server_proto_len = 0; SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); if (alpn_selected != NULL) { OPENSSL_free(alpn_selected); alpn_selected = NULL; } if (client_proto_len != server_proto_len || memcmp(client_proto, server_proto, client_proto_len) != 0) { BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); goto err; } if (client_proto_len > 0 && alpn_expected == NULL) { BIO_printf(bio_stdout, "ALPN unexpectedly negotiated\n"); goto err; } if (alpn_expected != NULL && (client_proto_len != strlen(alpn_expected) || memcmp(client_proto, alpn_expected, client_proto_len) != 0)) { BIO_printf(bio_stdout, "ALPN selected protocols not equal to expected protocol: %s\n", alpn_expected); goto err; } return 0; err: BIO_printf(bio_stdout, "ALPN results: client: '"); BIO_write(bio_stdout, client_proto, client_proto_len); BIO_printf(bio_stdout, "', server: '"); BIO_write(bio_stdout, server_proto, server_proto_len); BIO_printf(bio_stdout, "'\n"); BIO_printf(bio_stdout, "ALPN configured: client: '%s', server: ", alpn_client); if (SSL_get_SSL_CTX(server) == s_ctx2) { BIO_printf(bio_stdout, "'%s'\n", alpn_server2); } else if (SSL_get_SSL_CTX(server) == s_ctx){ BIO_printf(bio_stdout, "'%s'\n", alpn_server); } else { BIO_printf(bio_stdout, "unknown\n"); } return -1; } #ifndef OPENSSL_NO_TLSEXT static int cb_ticket0(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { return 0; } static int cb_ticket1(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { static unsigned char key[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; static char name[] = "ticket11ticket11"; if (SSL_get_options(s) & SSL_OP_NO_TICKET) return 0; if (enc) { RAND_pseudo_bytes(iv, EVP_MAX_IV_LENGTH); EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); HMAC_Init_ex(hctx, key, sizeof(key), EVP_sha1(), NULL); memcpy(key_name, name, 16); return 1; } else { if (memcmp(key_name, name, 16) == 0) { EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); HMAC_Init_ex(hctx, key, sizeof(key), EVP_sha1(), NULL); return 1; } } return 0; } static int cb_ticket2(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { fprintf(stderr, "ticket callback for SNI context should never be called\n"); EXIT(1); + return 0; } #endif #define SCT_EXT_TYPE 18 /* * WARNING : below extension types are *NOT* IETF assigned, and could * conflict if these types are reassigned and handled specially by OpenSSL * in the future */ #define TACK_EXT_TYPE 62208 #define CUSTOM_EXT_TYPE_0 1000 #define CUSTOM_EXT_TYPE_1 1001 #define CUSTOM_EXT_TYPE_2 1002 #define CUSTOM_EXT_TYPE_3 1003 const char custom_ext_cli_string[] = "abc"; const char custom_ext_srv_string[] = "defg"; /* These set from cmdline */ char *serverinfo_file = NULL; int serverinfo_sct = 0; int serverinfo_tack = 0; /* These set based on extension callbacks */ int serverinfo_sct_seen = 0; int serverinfo_tack_seen = 0; int serverinfo_other_seen = 0; /* This set from cmdline */ int custom_ext = 0; /* This set based on extension callbacks */ int custom_ext_error = 0; static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type == SCT_EXT_TYPE) serverinfo_sct_seen++; else if (ext_type == TACK_EXT_TYPE) serverinfo_tack_seen++; else serverinfo_other_seen++; return 1; } static int verify_serverinfo() { if (serverinfo_sct != serverinfo_sct_seen) return -1; if (serverinfo_tack != serverinfo_tack_seen) return -1; if (serverinfo_other_seen) return -1; return 0; } /*- * Four test cases for custom extensions: * 0 - no ClientHello extension or ServerHello response * 1 - ClientHello with "abc", no response * 2 - ClientHello with "abc", empty response * 3 - ClientHello with "abc", "defg" response */ static int custom_ext_0_cli_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_0) custom_ext_error = 1; return 0; /* Don't send an extension */ } static int custom_ext_0_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { return 1; } static int custom_ext_1_cli_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_1) custom_ext_error = 1; *out = (const unsigned char *)custom_ext_cli_string; *outlen = strlen(custom_ext_cli_string); return 1; /* Send "abc" */ } static int custom_ext_1_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { return 1; } static int custom_ext_2_cli_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_2) custom_ext_error = 1; *out = (const unsigned char *)custom_ext_cli_string; *outlen = strlen(custom_ext_cli_string); return 1; /* Send "abc" */ } static int custom_ext_2_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_2) custom_ext_error = 1; if (inlen != 0) custom_ext_error = 1; /* Should be empty response */ return 1; } static int custom_ext_3_cli_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_3) custom_ext_error = 1; *out = (const unsigned char *)custom_ext_cli_string; *outlen = strlen(custom_ext_cli_string); return 1; /* Send "abc" */ } static int custom_ext_3_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_3) custom_ext_error = 1; if (inlen != strlen(custom_ext_srv_string)) custom_ext_error = 1; if (memcmp(custom_ext_srv_string, in, inlen) != 0) custom_ext_error = 1; /* Check for "defg" */ return 1; } /* * custom_ext_0_cli_add_cb returns 0 - the server won't receive a callback * for this extension */ static int custom_ext_0_srv_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { custom_ext_error = 1; return 1; } /* 'add' callbacks are only called if the 'parse' callback is called */ static int custom_ext_0_srv_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { /* Error: should not have been called */ custom_ext_error = 1; return 0; /* Don't send an extension */ } static int custom_ext_1_srv_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_1) custom_ext_error = 1; /* Check for "abc" */ if (inlen != strlen(custom_ext_cli_string)) custom_ext_error = 1; if (memcmp(in, custom_ext_cli_string, inlen) != 0) custom_ext_error = 1; return 1; } static int custom_ext_1_srv_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { return 0; /* Don't send an extension */ } static int custom_ext_2_srv_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_2) custom_ext_error = 1; /* Check for "abc" */ if (inlen != strlen(custom_ext_cli_string)) custom_ext_error = 1; if (memcmp(in, custom_ext_cli_string, inlen) != 0) custom_ext_error = 1; return 1; } static int custom_ext_2_srv_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { *out = NULL; *outlen = 0; return 1; /* Send empty extension */ } static int custom_ext_3_srv_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *arg) { if (ext_type != CUSTOM_EXT_TYPE_3) custom_ext_error = 1; /* Check for "abc" */ if (inlen != strlen(custom_ext_cli_string)) custom_ext_error = 1; if (memcmp(in, custom_ext_cli_string, inlen) != 0) custom_ext_error = 1; return 1; } static int custom_ext_3_srv_add_cb(SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *arg) { *out = (const unsigned char *)custom_ext_srv_string; *outlen = strlen(custom_ext_srv_string); return 1; /* Send "defg" */ } static char *cipher = NULL; static int verbose = 0; static int debug = 0; #if 0 /* Not used yet. */ # ifdef FIONBIO static int s_nbio = 0; # endif #endif static const char rnd_seed[] = "string to make the random number generator think it has entropy"; int doit_biopair(SSL *s_ssl, SSL *c_ssl, long bytes, clock_t *s_time, clock_t *c_time); int doit(SSL *s_ssl, SSL *c_ssl, long bytes); static int do_test_cipherlist(void); static void sv_usage(void) { fprintf(stderr, "usage: ssltest [args ...]\n"); fprintf(stderr, "\n"); #ifdef OPENSSL_FIPS fprintf(stderr, "-F - run test in FIPS mode\n"); #endif fprintf(stderr, " -server_auth - check server certificate\n"); fprintf(stderr, " -client_auth - do client authentication\n"); fprintf(stderr, " -proxy - allow proxy certificates\n"); fprintf(stderr, " -proxy_auth - set proxy policy rights\n"); fprintf(stderr, " -proxy_cond - expression to test proxy policy rights\n"); fprintf(stderr, " -v - more output\n"); fprintf(stderr, " -d - debug output\n"); fprintf(stderr, " -reuse - use session-id reuse\n"); fprintf(stderr, " -num - number of connections to perform\n"); fprintf(stderr, " -bytes - number of bytes to swap between client/server\n"); #ifndef OPENSSL_NO_DH fprintf(stderr, " -dhe512 - use 512 bit key for DHE (to test failure)\n"); fprintf(stderr, " -dhe1024 - use 1024 bit key (safe prime) for DHE (default, no-op)\n"); fprintf(stderr, " -dhe1024dsa - use 1024 bit key (with 160-bit subprime) for DHE\n"); fprintf(stderr, " -no_dhe - disable DHE\n"); #endif #ifndef OPENSSL_NO_ECDH fprintf(stderr, " -no_ecdhe - disable ECDHE\n"); #endif #ifndef OPENSSL_NO_PSK fprintf(stderr, " -psk arg - PSK in hex (without 0x)\n"); #endif #ifndef OPENSSL_NO_SRP fprintf(stderr, " -srpuser user - SRP username to use\n"); fprintf(stderr, " -srppass arg - password for 'user'\n"); #endif #ifndef OPENSSL_NO_SSL2 fprintf(stderr, " -ssl2 - use SSLv2\n"); #endif #ifndef OPENSSL_NO_SSL3_METHOD fprintf(stderr, " -ssl3 - use SSLv3\n"); #endif #ifndef OPENSSL_NO_TLS1 fprintf(stderr, " -tls1 - use TLSv1\n"); fprintf(stderr, " -tls12 - use TLSv1.2\n"); #endif #ifndef OPENSSL_NO_DTLS fprintf(stderr, " -dtls1 - use DTLSv1\n"); fprintf(stderr, " -dtls12 - use DTLSv1.2\n"); #endif fprintf(stderr, " -CApath arg - PEM format directory of CA's\n"); fprintf(stderr, " -CAfile arg - PEM format file of CA's\n"); fprintf(stderr, " -cert arg - Server certificate file\n"); fprintf(stderr, " -key arg - Server key file (default: same as -cert)\n"); fprintf(stderr, " -c_cert arg - Client certificate file\n"); fprintf(stderr, " -c_key arg - Client key file (default: same as -c_cert)\n"); fprintf(stderr, " -cipher arg - The cipher list\n"); fprintf(stderr, " -bio_pair - Use BIO pairs\n"); fprintf(stderr, " -f - Test even cases that can't work\n"); fprintf(stderr, " -time - measure processor time used by client and server\n"); fprintf(stderr, " -zlib - use zlib compression\n"); fprintf(stderr, " -rle - use rle compression\n"); #ifndef OPENSSL_NO_ECDH fprintf(stderr, " -named_curve arg - Elliptic curve name to use for ephemeral ECDH keys.\n" " Use \"openssl ecparam -list_curves\" for all names\n" " (default is sect163r2).\n"); #endif fprintf(stderr, " -test_cipherlist - Verifies the order of the ssl cipher lists.\n" " When this option is requested, the cipherlist\n" " tests are run instead of handshake tests.\n"); fprintf(stderr, " -serverinfo_file file - have server use this file\n"); fprintf(stderr, " -serverinfo_sct - have client offer and expect SCT\n"); fprintf(stderr, " -serverinfo_tack - have client offer and expect TACK\n"); fprintf(stderr, " -custom_ext - try various custom extension callbacks\n"); fprintf(stderr, " -alpn_client - have client side offer ALPN\n"); fprintf(stderr, " -alpn_server - have server side offer ALPN\n"); fprintf(stderr, " -alpn_server1 - alias for -alpn_server\n"); fprintf(stderr, " -alpn_server2 - have server side context 2 offer ALPN\n"); fprintf(stderr, " -alpn_expected - the ALPN protocol that should be negotiated\n"); fprintf(stderr, " -sn_client - have client request this servername\n"); fprintf(stderr, " -sn_server1 - have server context 1 respond to this servername\n"); fprintf(stderr, " -sn_server2 - have server context 2 respond to this servername\n"); fprintf(stderr, " -sn_expect1 - expected server 1\n"); fprintf(stderr, " -sn_expect2 - expected server 2\n"); #ifndef OPENSSL_NO_TLSEXT fprintf(stderr, " -s_ticket1 - enable/disable session tickets on context 1\n"); fprintf(stderr, " -s_ticket2 - enable/disable session tickets on context 2\n"); fprintf(stderr, " -c_ticket - enable/disable session tickets on the client\n"); fprintf(stderr, " -ticket_expect - indicate that the client should (or should not) have a ticket\n"); #endif fprintf(stderr, " -sni_in_cert_cb - have the server handle SNI in the certificate callback\n"); fprintf(stderr, " -client_sigalgs arg - the signature algorithms to configure on the client\n"); fprintf(stderr, " -server_digest_expect arg - the expected server signing digest\n"); } static void print_details(SSL *c_ssl, const char *prefix) { const SSL_CIPHER *ciph; X509 *cert; ciph = SSL_get_current_cipher(c_ssl); BIO_printf(bio_stdout, "%s%s, cipher %s %s", prefix, SSL_get_version(c_ssl), SSL_CIPHER_get_version(ciph), SSL_CIPHER_get_name(ciph)); cert = SSL_get_peer_certificate(c_ssl); if (cert != NULL) { EVP_PKEY *pkey = X509_get_pubkey(cert); if (pkey != NULL) { if (0) ; #ifndef OPENSSL_NO_RSA else if (pkey->type == EVP_PKEY_RSA && pkey->pkey.rsa != NULL && pkey->pkey.rsa->n != NULL) { BIO_printf(bio_stdout, ", %d bit RSA", BN_num_bits(pkey->pkey.rsa->n)); } #endif #ifndef OPENSSL_NO_DSA else if (pkey->type == EVP_PKEY_DSA && pkey->pkey.dsa != NULL && pkey->pkey.dsa->p != NULL) { BIO_printf(bio_stdout, ", %d bit DSA", BN_num_bits(pkey->pkey.dsa->p)); } #endif EVP_PKEY_free(pkey); } X509_free(cert); } /* * The SSL API does not allow us to look at temporary RSA/DH keys, * otherwise we should print their lengths too */ BIO_printf(bio_stdout, "\n"); } static void lock_dbg_cb(int mode, int type, const char *file, int line) { static int modes[CRYPTO_NUM_LOCKS]; /* = {0, 0, ... } */ const char *errstr = NULL; int rw; rw = mode & (CRYPTO_READ | CRYPTO_WRITE); if (!((rw == CRYPTO_READ) || (rw == CRYPTO_WRITE))) { errstr = "invalid mode"; goto err; } if (type < 0 || type >= CRYPTO_NUM_LOCKS) { errstr = "type out of bounds"; goto err; } if (mode & CRYPTO_LOCK) { if (modes[type]) { errstr = "already locked"; /* * must not happen in a single-threaded program (would deadlock) */ goto err; } modes[type] = rw; } else if (mode & CRYPTO_UNLOCK) { if (!modes[type]) { errstr = "not locked"; goto err; } if (modes[type] != rw) { errstr = (rw == CRYPTO_READ) ? "CRYPTO_r_unlock on write lock" : "CRYPTO_w_unlock on read lock"; } modes[type] = 0; } else { errstr = "invalid mode"; goto err; } err: if (errstr) { /* we cannot use bio_err here */ fprintf(stderr, "openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n", errstr, mode, type, file, line); } } #ifdef TLSEXT_TYPE_opaque_prf_input struct cb_info_st { void *input; size_t len; int ret; }; struct cb_info_st co1 = { "C", 1, 1 }; /* try to negotiate oqaque PRF input */ struct cb_info_st co2 = { "C", 1, 2 }; /* insist on oqaque PRF input */ struct cb_info_st so1 = { "S", 1, 1 }; /* try to negotiate oqaque PRF input */ struct cb_info_st so2 = { "S", 1, 2 }; /* insist on oqaque PRF input */ int opaque_prf_input_cb(SSL *ssl, void *peerinput, size_t len, void *arg_) { struct cb_info_st *arg = arg_; if (arg == NULL) return 1; if (!SSL_set_tlsext_opaque_prf_input(ssl, arg->input, arg->len)) return 0; return arg->ret; } #endif int main(int argc, char *argv[]) { char *CApath = NULL, *CAfile = NULL; int badop = 0; int bio_pair = 0; int force = 0; int dtls1 = 0, dtls12 = 0, tls1 = 0, tls12 = 0, ssl2 = 0, ssl3 = 0, ret = 1; int client_auth = 0; int server_auth = 0, i; struct app_verify_arg app_verify_arg = { APP_CALLBACK_STRING, 0, 0, NULL, NULL }; char *server_cert = TEST_SERVER_CERT; char *server_key = NULL; char *client_cert = TEST_CLIENT_CERT; char *client_key = NULL; #ifndef OPENSSL_NO_ECDH char *named_curve = NULL; #endif SSL_CTX *c_ctx = NULL; const SSL_METHOD *meth = NULL; SSL *c_ssl, *s_ssl; int number = 1, reuse = 0; long bytes = 256L; #ifndef OPENSSL_NO_DH DH *dh; int dhe512 = 0, dhe1024dsa = 0; #endif #ifndef OPENSSL_NO_ECDH EC_KEY *ecdh = NULL; #endif #ifndef OPENSSL_NO_SRP /* client */ SRP_CLIENT_ARG srp_client_arg = { NULL, NULL }; /* server */ SRP_SERVER_ARG srp_server_arg = { NULL, NULL }; #endif int no_dhe = 0; int no_ecdhe = 0; int no_psk = 0; int print_time = 0; clock_t s_time = 0, c_time = 0; #ifndef OPENSSL_NO_COMP int comp = 0; COMP_METHOD *cm = NULL; STACK_OF(SSL_COMP) *ssl_comp_methods = NULL; #endif int test_cipherlist = 0; #ifdef OPENSSL_FIPS int fips_mode = 0; #endif int no_protocol = 0; verbose = 0; debug = 0; cipher = 0; bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT); CRYPTO_set_locking_callback(lock_dbg_cb); /* enable memory leak checking unless explicitly disabled */ if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) { CRYPTO_malloc_debug_init(); CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); } else { /* OPENSSL_DEBUG_MEMORY=off */ CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); RAND_seed(rnd_seed, sizeof rnd_seed); bio_stdout = BIO_new_fp(stdout, BIO_NOCLOSE | BIO_FP_TEXT); argc--; argv++; while (argc >= 1) { if (!strcmp(*argv, "-F")) { #ifdef OPENSSL_FIPS fips_mode = 1; #else fprintf(stderr, "not compiled with FIPS support, so exiting without running.\n"); EXIT(0); #endif } else if (strcmp(*argv, "-server_auth") == 0) server_auth = 1; else if (strcmp(*argv, "-client_auth") == 0) client_auth = 1; else if (strcmp(*argv, "-proxy_auth") == 0) { if (--argc < 1) goto bad; app_verify_arg.proxy_auth = *(++argv); } else if (strcmp(*argv, "-proxy_cond") == 0) { if (--argc < 1) goto bad; app_verify_arg.proxy_cond = *(++argv); } else if (strcmp(*argv, "-v") == 0) verbose = 1; else if (strcmp(*argv, "-d") == 0) debug = 1; else if (strcmp(*argv, "-reuse") == 0) reuse = 1; else if (strcmp(*argv, "-dhe512") == 0) { #ifndef OPENSSL_NO_DH dhe512 = 1; #else fprintf(stderr, "ignoring -dhe512, since I'm compiled without DH\n"); #endif } else if (strcmp(*argv, "-dhe1024dsa") == 0) { #ifndef OPENSSL_NO_DH dhe1024dsa = 1; #else fprintf(stderr, "ignoring -dhe1024dsa, since I'm compiled without DH\n"); #endif } else if (strcmp(*argv, "-no_dhe") == 0) no_dhe = 1; else if (strcmp(*argv, "-no_ecdhe") == 0) no_ecdhe = 1; else if (strcmp(*argv, "-psk") == 0) { if (--argc < 1) goto bad; psk_key = *(++argv); #ifndef OPENSSL_NO_PSK if (strspn(psk_key, "abcdefABCDEF1234567890") != strlen(psk_key)) { BIO_printf(bio_err, "Not a hex number '%s'\n", *argv); goto bad; } #else no_psk = 1; #endif } #ifndef OPENSSL_NO_SRP else if (strcmp(*argv, "-srpuser") == 0) { if (--argc < 1) goto bad; srp_server_arg.expected_user = srp_client_arg.srplogin = *(++argv); tls1 = 1; } else if (strcmp(*argv, "-srppass") == 0) { if (--argc < 1) goto bad; srp_server_arg.pass = srp_client_arg.srppassin = *(++argv); tls1 = 1; } #endif else if (strcmp(*argv, "-ssl2") == 0) { #ifdef OPENSSL_NO_SSL2 no_protocol = 1; #endif ssl2 = 1; } else if (strcmp(*argv, "-tls1") == 0) { #ifdef OPENSSL_NO_TLS1 no_protocol = 1; #endif tls1 = 1; } else if (strcmp(*argv, "-tls12") == 0) { #ifdef OPENSSL_NO_TLS1 no_protocol = 1; #endif tls12 = 1; } else if (strcmp(*argv, "-ssl3") == 0) { #ifdef OPENSSL_NO_SSL3_METHOD no_protocol = 1; #endif ssl3 = 1; } else if (strcmp(*argv, "-dtls1") == 0) { #ifdef OPENSSL_NO_DTLS no_protocol = 1; #endif dtls1 = 1; } else if (strcmp(*argv, "-dtls12") == 0) { #ifdef OPENSSL_NO_DTLS no_protocol = 1; #endif dtls12 = 1; } else if (strncmp(*argv, "-num", 4) == 0) { if (--argc < 1) goto bad; number = atoi(*(++argv)); if (number == 0) number = 1; } else if (strcmp(*argv, "-bytes") == 0) { if (--argc < 1) goto bad; bytes = atol(*(++argv)); if (bytes == 0L) bytes = 1L; i = strlen(argv[0]); if (argv[0][i - 1] == 'k') bytes *= 1024L; if (argv[0][i - 1] == 'm') bytes *= 1024L * 1024L; } else if (strcmp(*argv, "-cert") == 0) { if (--argc < 1) goto bad; server_cert = *(++argv); } else if (strcmp(*argv, "-s_cert") == 0) { if (--argc < 1) goto bad; server_cert = *(++argv); } else if (strcmp(*argv, "-key") == 0) { if (--argc < 1) goto bad; server_key = *(++argv); } else if (strcmp(*argv, "-s_key") == 0) { if (--argc < 1) goto bad; server_key = *(++argv); } else if (strcmp(*argv, "-c_cert") == 0) { if (--argc < 1) goto bad; client_cert = *(++argv); } else if (strcmp(*argv, "-c_key") == 0) { if (--argc < 1) goto bad; client_key = *(++argv); } else if (strcmp(*argv, "-cipher") == 0) { if (--argc < 1) goto bad; cipher = *(++argv); } else if (strcmp(*argv, "-CApath") == 0) { if (--argc < 1) goto bad; CApath = *(++argv); } else if (strcmp(*argv, "-CAfile") == 0) { if (--argc < 1) goto bad; CAfile = *(++argv); } else if (strcmp(*argv, "-bio_pair") == 0) { bio_pair = 1; } else if (strcmp(*argv, "-f") == 0) { force = 1; } else if (strcmp(*argv, "-time") == 0) { print_time = 1; } else if (strcmp(*argv, "-zlib") == 0) { #ifndef OPENSSL_NO_COMP comp = COMP_ZLIB; #else fprintf(stderr, "ignoring -zlib, since I'm compiled without COMP\n"); #endif } else if (strcmp(*argv, "-rle") == 0) { #ifndef OPENSSL_NO_COMP comp = COMP_RLE; #else fprintf(stderr, "ignoring -rle, since I'm compiled without COMP\n"); #endif } else if (strcmp(*argv, "-named_curve") == 0) { if (--argc < 1) goto bad; #ifndef OPENSSL_NO_ECDH named_curve = *(++argv); #else fprintf(stderr, "ignoring -named_curve, since I'm compiled without ECDH\n"); ++argv; #endif } else if (strcmp(*argv, "-app_verify") == 0) { app_verify_arg.app_verify = 1; } else if (strcmp(*argv, "-proxy") == 0) { app_verify_arg.allow_proxy_certs = 1; } else if (strcmp(*argv, "-test_cipherlist") == 0) { test_cipherlist = 1; } else if (strcmp(*argv, "-serverinfo_sct") == 0) { serverinfo_sct = 1; } else if (strcmp(*argv, "-serverinfo_tack") == 0) { serverinfo_tack = 1; } else if (strcmp(*argv, "-serverinfo_file") == 0) { if (--argc < 1) goto bad; serverinfo_file = *(++argv); } else if (strcmp(*argv, "-custom_ext") == 0) { custom_ext = 1; } else if (strcmp(*argv, "-alpn_client") == 0) { if (--argc < 1) goto bad; alpn_client = *(++argv); } else if (strcmp(*argv, "-alpn_server") == 0 || strcmp(*argv, "-alpn_server1") == 0) { if (--argc < 1) goto bad; alpn_server = *(++argv); } else if (strcmp(*argv, "-alpn_server2") == 0) { if (--argc < 1) goto bad; alpn_server2 = *(++argv); } else if (strcmp(*argv, "-alpn_expected") == 0) { if (--argc < 1) goto bad; alpn_expected = *(++argv); } else if (strcmp(*argv, "-sn_client") == 0) { if (--argc < 1) goto bad; sn_client = *(++argv); } else if (strcmp(*argv, "-sn_server1") == 0) { if (--argc < 1) goto bad; sn_server1 = *(++argv); } else if (strcmp(*argv, "-sn_server2") == 0) { if (--argc < 1) goto bad; sn_server2 = *(++argv); } else if (strcmp(*argv, "-sn_expect1") == 0) { sn_expect = 1; } else if (strcmp(*argv, "-sn_expect2") == 0) { sn_expect = 2; #ifndef OPENSSL_NO_TLSEXT } else if (strcmp(*argv, "-s_ticket1") == 0) { if (--argc < 1) goto bad; argv++; if (strcmp(*argv, "yes") == 0) s_ticket1 = 1; if (strcmp(*argv, "broken") == 0) s_ticket1 = 2; } else if (strcmp(*argv, "-s_ticket2") == 0) { if (--argc < 1) goto bad; argv++; if (strcmp(*argv, "yes") == 0) s_ticket2 = 1; } else if (strcmp(*argv, "-c_ticket") == 0) { if (--argc < 1) goto bad; argv++; if (strcmp(*argv, "yes") == 0) c_ticket = 1; } else if (strcmp(*argv, "-ticket_expect") == 0) { if (--argc < 1) goto bad; argv++; if (strcmp(*argv, "yes") == 0) ticket_expect = 1; else if (strcmp(*argv, "no") == 0) ticket_expect = 0; #endif } else if (strcmp(*argv, "-sni_in_cert_cb") == 0) { sni_in_cert_cb = 1; } else if (strcmp(*argv, "-client_sigalgs") == 0) { if (--argc < 1) goto bad; client_sigalgs = *(++argv); } else if (strcmp(*argv, "-server_digest_expect") == 0) { if (--argc < 1) goto bad; server_digest_expect = *(++argv); } else { fprintf(stderr, "unknown option %s\n", *argv); badop = 1; break; } argc--; argv++; } if (badop) { bad: sv_usage(); goto end; } /* * test_cipherlist prevails over protocol switch: we test the cipherlist * for all enabled protocols. */ if (test_cipherlist == 1) { /* * ensure that the cipher list are correctly sorted and exit */ fprintf(stdout, "Testing cipherlist order only. Ignoring all " "other options.\n"); if (do_test_cipherlist() == 0) EXIT(1); ret = 0; goto end; } if (ssl2 + ssl3 + tls1 + tls12 + dtls1 + dtls12 > 1) { fprintf(stderr, "At most one of -ssl2, -ssl3, -tls1, -tls12, -dtls1 or " "-dtls12 should be requested.\n"); EXIT(1); } /* * Testing was requested for a compiled-out protocol (e.g. SSLv2). * Ideally, we would error out, but the generic test wrapper can't know * when to expect failure. So we do nothing and return success. */ if (no_protocol) { fprintf(stderr, "Testing was requested for a disabled protocol. " "Skipping tests.\n"); ret = 0; goto end; } if (!ssl2 && !ssl3 && !tls1 && !tls12 && !dtls1 && !dtls12 && number > 1 && !reuse && !force) { fprintf(stderr, "This case cannot work. Use -f to perform " "the test anyway (and\n-d to see what happens), " "or add one of ssl2, -ssl3, -tls1, -tls12, -dtls1, -dtls12, -reuse\n" "to avoid protocol mismatch.\n"); EXIT(1); } #ifdef OPENSSL_FIPS if (fips_mode) { if (!FIPS_mode_set(1)) { ERR_load_crypto_strings(); ERR_print_errors(BIO_new_fp(stderr, BIO_NOCLOSE)); EXIT(1); } else fprintf(stderr, "*** IN FIPS MODE ***\n"); } #endif if (print_time) { if (!bio_pair) { fprintf(stderr, "Using BIO pair (-bio_pair)\n"); bio_pair = 1; } if (number < 50 && !force) fprintf(stderr, "Warning: For accurate timings, use more connections (e.g. -num 1000)\n"); } /* if (cipher == NULL) cipher=getenv("SSL_CIPHER"); */ SSL_library_init(); SSL_load_error_strings(); #ifndef OPENSSL_NO_COMP if (comp == COMP_ZLIB) cm = COMP_zlib(); if (comp == COMP_RLE) cm = COMP_rle(); if (cm != NULL) { if (cm->type != NID_undef) { if (SSL_COMP_add_compression_method(comp, cm) != 0) { fprintf(stderr, "Failed to add compression method\n"); ERR_print_errors_fp(stderr); } } else { fprintf(stderr, "Warning: %s compression not supported\n", (comp == COMP_RLE ? "rle" : (comp == COMP_ZLIB ? "zlib" : "unknown"))); ERR_print_errors_fp(stderr); } } ssl_comp_methods = SSL_COMP_get_compression_methods(); fprintf(stderr, "Available compression methods:\n"); { int j, n = sk_SSL_COMP_num(ssl_comp_methods); if (n == 0) fprintf(stderr, " NONE\n"); else for (j = 0; j < n; j++) { SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j); fprintf(stderr, " %d: %s\n", c->id, c->name); } } #endif /* * At this point, ssl2/ssl3/tls1/tls12 is only set if the protocol is * available. (Otherwise we exit early.) However the compiler doesn't * know this, so we ifdef. */ #ifndef OPENSSL_NO_SSL2 if (ssl2) meth = SSLv2_method(); else #endif #ifndef OPENSSL_NO_SSL3 if (ssl3) meth = SSLv3_method(); else #endif #ifndef OPENSSL_NO_DTLS if (dtls1) meth = DTLSv1_method(); else if (dtls12) meth = DTLSv1_2_method(); else #endif #ifndef OPENSSL_NO_TLS1 if (tls1) meth = TLSv1_method(); else if (tls12) meth = TLSv1_2_method(); else #endif meth = SSLv23_method(); c_ctx = SSL_CTX_new(meth); s_ctx = SSL_CTX_new(meth); s_ctx2 = SSL_CTX_new(meth); /* no SSL_CTX_dup! */ if ((c_ctx == NULL) || (s_ctx == NULL) || (s_ctx2 == NULL)) { ERR_print_errors(bio_err); goto end; } if (cipher != NULL) { SSL_CTX_set_cipher_list(c_ctx, cipher); SSL_CTX_set_cipher_list(s_ctx, cipher); SSL_CTX_set_cipher_list(s_ctx2, cipher); } #ifndef OPENSSL_NO_DH if (!no_dhe) { if (dhe1024dsa) { /* * use SSL_OP_SINGLE_DH_USE to avoid small subgroup attacks */ SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_DH_USE); SSL_CTX_set_options(s_ctx2, SSL_OP_SINGLE_DH_USE); dh = get_dh1024dsa(); } else if (dhe512) dh = get_dh512(); else dh = get_dh1024(); SSL_CTX_set_tmp_dh(s_ctx, dh); SSL_CTX_set_tmp_dh(s_ctx2, dh); DH_free(dh); } #else (void)no_dhe; #endif #ifndef OPENSSL_NO_ECDH if (!no_ecdhe) { int nid; if (named_curve != NULL) { nid = OBJ_sn2nid(named_curve); if (nid == 0) { BIO_printf(bio_err, "unknown curve name (%s)\n", named_curve); goto end; } } else { nid = NID_X9_62_prime256v1; } ecdh = EC_KEY_new_by_curve_name(nid); if (ecdh == NULL) { BIO_printf(bio_err, "unable to create curve\n"); goto end; } SSL_CTX_set_tmp_ecdh(s_ctx, ecdh); SSL_CTX_set_tmp_ecdh(s_ctx2, ecdh); SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE); SSL_CTX_set_options(s_ctx2, SSL_OP_SINGLE_ECDH_USE); EC_KEY_free(ecdh); } #else (void)no_ecdhe; #endif #ifndef OPENSSL_NO_RSA SSL_CTX_set_tmp_rsa_callback(s_ctx, tmp_rsa_cb); SSL_CTX_set_tmp_rsa_callback(s_ctx2, tmp_rsa_cb); #endif #ifdef TLSEXT_TYPE_opaque_prf_input SSL_CTX_set_tlsext_opaque_prf_input_callback(c_ctx, opaque_prf_input_cb); SSL_CTX_set_tlsext_opaque_prf_input_callback(s_ctx, opaque_prf_input_cb); SSL_CTX_set_tlsext_opaque_prf_input_callback(s_ctx2, opaque_prf_input_cb); /* or &co2 or NULL */ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(c_ctx, &co1); /* or &so2 or NULL */ SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(s_ctx, &so1); SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(s_ctx2, &so1); #endif if (!SSL_CTX_use_certificate_file(s_ctx, server_cert, SSL_FILETYPE_PEM)) { ERR_print_errors(bio_err); } else if (!SSL_CTX_use_PrivateKey_file(s_ctx, (server_key ? server_key : server_cert), SSL_FILETYPE_PEM)) { ERR_print_errors(bio_err); goto end; } if (!SSL_CTX_use_certificate_file(s_ctx2, server_cert, SSL_FILETYPE_PEM)) { ERR_print_errors(bio_err); } else if (!SSL_CTX_use_PrivateKey_file(s_ctx2, (server_key ? server_key : server_cert), SSL_FILETYPE_PEM)) { ERR_print_errors(bio_err); goto end; } if (client_auth) { SSL_CTX_use_certificate_file(c_ctx, client_cert, SSL_FILETYPE_PEM); SSL_CTX_use_PrivateKey_file(c_ctx, (client_key ? client_key : client_cert), SSL_FILETYPE_PEM); } if ((!SSL_CTX_load_verify_locations(s_ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(s_ctx)) || (!SSL_CTX_load_verify_locations(s_ctx2, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(s_ctx2)) || (!SSL_CTX_load_verify_locations(c_ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(c_ctx))) { /* fprintf(stderr,"SSL_load_verify_locations\n"); */ ERR_print_errors(bio_err); /* goto end; */ } if (client_auth) { BIO_printf(bio_err, "client authentication\n"); SSL_CTX_set_verify(s_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback); SSL_CTX_set_cert_verify_callback(s_ctx, app_verify_callback, &app_verify_arg); SSL_CTX_set_verify(s_ctx2, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback); SSL_CTX_set_cert_verify_callback(s_ctx2, app_verify_callback, &app_verify_arg); } if (server_auth) { BIO_printf(bio_err, "server authentication\n"); SSL_CTX_set_verify(c_ctx, SSL_VERIFY_PEER, verify_callback); SSL_CTX_set_cert_verify_callback(c_ctx, app_verify_callback, &app_verify_arg); } { int session_id_context = 0; SSL_CTX_set_session_id_context(s_ctx, (void *)&session_id_context, sizeof session_id_context); SSL_CTX_set_session_id_context(s_ctx2, (void *)&session_id_context, sizeof session_id_context); } /* Use PSK only if PSK key is given */ if (psk_key != NULL) { /* * no_psk is used to avoid putting psk command to openssl tool */ if (no_psk) { /* * if PSK is not compiled in and psk key is given, do nothing and * exit successfully */ ret = 0; goto end; } #ifndef OPENSSL_NO_PSK SSL_CTX_set_psk_client_callback(c_ctx, psk_client_callback); SSL_CTX_set_psk_server_callback(s_ctx, psk_server_callback); SSL_CTX_set_psk_server_callback(s_ctx2, psk_server_callback); if (debug) BIO_printf(bio_err, "setting PSK identity hint to s_ctx\n"); if (!SSL_CTX_use_psk_identity_hint(s_ctx, "ctx server identity_hint")) { BIO_printf(bio_err, "error setting PSK identity hint to s_ctx\n"); ERR_print_errors(bio_err); goto end; } if (!SSL_CTX_use_psk_identity_hint(s_ctx2, "ctx server identity_hint")) { BIO_printf(bio_err, "error setting PSK identity hint to s_ctx2\n"); ERR_print_errors(bio_err); goto end; } #endif } #ifndef OPENSSL_NO_SRP if (srp_client_arg.srplogin) { if (!SSL_CTX_set_srp_username(c_ctx, srp_client_arg.srplogin)) { BIO_printf(bio_err, "Unable to set SRP username\n"); goto end; } SSL_CTX_set_srp_cb_arg(c_ctx, &srp_client_arg); SSL_CTX_set_srp_client_pwd_callback(c_ctx, ssl_give_srp_client_pwd_cb); /* * SSL_CTX_set_srp_strength(c_ctx, srp_client_arg.strength); */ } if (srp_server_arg.expected_user != NULL) { SSL_CTX_set_verify(s_ctx, SSL_VERIFY_NONE, verify_callback); SSL_CTX_set_verify(s_ctx2, SSL_VERIFY_NONE, verify_callback); SSL_CTX_set_srp_cb_arg(s_ctx, &srp_server_arg); SSL_CTX_set_srp_cb_arg(s_ctx2, &srp_server_arg); SSL_CTX_set_srp_username_callback(s_ctx, ssl_srp_server_param_cb); SSL_CTX_set_srp_username_callback(s_ctx2, ssl_srp_server_param_cb); } #endif if (serverinfo_sct) SSL_CTX_add_client_custom_ext(c_ctx, SCT_EXT_TYPE, NULL, NULL, NULL, serverinfo_cli_parse_cb, NULL); if (serverinfo_tack) SSL_CTX_add_client_custom_ext(c_ctx, TACK_EXT_TYPE, NULL, NULL, NULL, serverinfo_cli_parse_cb, NULL); if (serverinfo_file) { if (!SSL_CTX_use_serverinfo_file(s_ctx, serverinfo_file)) { BIO_printf(bio_err, "missing serverinfo file\n"); goto end; } if (!SSL_CTX_use_serverinfo_file(s_ctx2, serverinfo_file)) { BIO_printf(bio_err, "missing serverinfo file\n"); goto end; } } if (custom_ext) { SSL_CTX_add_client_custom_ext(c_ctx, CUSTOM_EXT_TYPE_0, custom_ext_0_cli_add_cb, NULL, NULL, custom_ext_0_cli_parse_cb, NULL); SSL_CTX_add_client_custom_ext(c_ctx, CUSTOM_EXT_TYPE_1, custom_ext_1_cli_add_cb, NULL, NULL, custom_ext_1_cli_parse_cb, NULL); SSL_CTX_add_client_custom_ext(c_ctx, CUSTOM_EXT_TYPE_2, custom_ext_2_cli_add_cb, NULL, NULL, custom_ext_2_cli_parse_cb, NULL); SSL_CTX_add_client_custom_ext(c_ctx, CUSTOM_EXT_TYPE_3, custom_ext_3_cli_add_cb, NULL, NULL, custom_ext_3_cli_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx, CUSTOM_EXT_TYPE_0, custom_ext_0_srv_add_cb, NULL, NULL, custom_ext_0_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx, CUSTOM_EXT_TYPE_1, custom_ext_1_srv_add_cb, NULL, NULL, custom_ext_1_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx, CUSTOM_EXT_TYPE_2, custom_ext_2_srv_add_cb, NULL, NULL, custom_ext_2_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx, CUSTOM_EXT_TYPE_3, custom_ext_3_srv_add_cb, NULL, NULL, custom_ext_3_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_0, custom_ext_0_srv_add_cb, NULL, NULL, custom_ext_0_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_1, custom_ext_1_srv_add_cb, NULL, NULL, custom_ext_1_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_2, custom_ext_2_srv_add_cb, NULL, NULL, custom_ext_2_srv_parse_cb, NULL); SSL_CTX_add_server_custom_ext(s_ctx2, CUSTOM_EXT_TYPE_3, custom_ext_3_srv_add_cb, NULL, NULL, custom_ext_3_srv_parse_cb, NULL); } if (alpn_server) SSL_CTX_set_alpn_select_cb(s_ctx, cb_server_alpn, alpn_server); if (alpn_server2) SSL_CTX_set_alpn_select_cb(s_ctx2, cb_server_alpn, alpn_server2); if (alpn_client) { unsigned short alpn_len; unsigned char *alpn = next_protos_parse(&alpn_len, alpn_client); if (alpn == NULL) { BIO_printf(bio_err, "Error parsing -alpn_client argument\n"); goto end; } SSL_CTX_set_alpn_protos(c_ctx, alpn, alpn_len); OPENSSL_free(alpn); } if (sn_server1 || sn_server2) { if (sni_in_cert_cb) SSL_CTX_set_cert_cb(s_ctx, cert_cb, NULL); else SSL_CTX_set_tlsext_servername_callback(s_ctx, servername_cb); } #ifndef OPENSSL_NO_TLSEXT if (s_ticket1 == 0) SSL_CTX_set_options(s_ctx, SSL_OP_NO_TICKET); /* always set the callback */ if (s_ticket1 == 2) SSL_CTX_set_tlsext_ticket_key_cb(s_ctx, cb_ticket0); else SSL_CTX_set_tlsext_ticket_key_cb(s_ctx, cb_ticket1); if (!s_ticket2) SSL_CTX_set_options(s_ctx2, SSL_OP_NO_TICKET); /* always set the callback - this should never be called */ SSL_CTX_set_tlsext_ticket_key_cb(s_ctx2, cb_ticket2); if (!c_ticket) SSL_CTX_set_options(c_ctx, SSL_OP_NO_TICKET); #endif if (client_sigalgs != NULL) SSL_CTX_set1_sigalgs_list(c_ctx, client_sigalgs); c_ssl = SSL_new(c_ctx); s_ssl = SSL_new(s_ctx); if (sn_client) SSL_set_tlsext_host_name(c_ssl, sn_client); #ifndef OPENSSL_NO_KRB5 if (c_ssl && c_ssl->kssl_ctx) { char localhost[MAXHOSTNAMELEN + 2]; if (gethostname(localhost, sizeof localhost - 1) == 0) { localhost[sizeof localhost - 1] = '\0'; if (strlen(localhost) == sizeof localhost - 1) { BIO_printf(bio_err, "localhost name too long\n"); goto end; } kssl_ctx_setstring(c_ssl->kssl_ctx, KSSL_SERVER, localhost); } } #endif /* OPENSSL_NO_KRB5 */ for (i = 0; i < number; i++) { if (!reuse) SSL_set_session(c_ssl, NULL); if (bio_pair) ret = doit_biopair(s_ssl, c_ssl, bytes, &s_time, &c_time); else ret = doit(s_ssl, c_ssl, bytes); } if (!verbose) { print_details(c_ssl, ""); } if ((number > 1) || (bytes > 1L)) BIO_printf(bio_stdout, "%d handshakes of %ld bytes done\n", number, bytes); if (print_time) { #ifdef CLOCKS_PER_SEC /* * "To determine the time in seconds, the value returned by the clock * function should be divided by the value of the macro * CLOCKS_PER_SEC." -- ISO/IEC 9899 */ BIO_printf(bio_stdout, "Approximate total server time: %6.2f s\n" "Approximate total client time: %6.2f s\n", (double)s_time / CLOCKS_PER_SEC, (double)c_time / CLOCKS_PER_SEC); #else /* * "`CLOCKS_PER_SEC' undeclared (first use this function)" -- cc on * NeXTstep/OpenStep */ BIO_printf(bio_stdout, "Approximate total server time: %6.2f units\n" "Approximate total client time: %6.2f units\n", (double)s_time, (double)c_time); #endif } if (verify_alpn(c_ssl, s_ssl) < 0) ret = 1; if (verify_servername(c_ssl, s_ssl) < 0) ret = 1; if (verify_ticket(c_ssl) < 0) ret = 1; if (verify_server_digest(c_ssl) < 0) ret = 1; SSL_free(s_ssl); SSL_free(c_ssl); end: if (s_ctx != NULL) SSL_CTX_free(s_ctx); if (s_ctx2 != NULL) SSL_CTX_free(s_ctx2); if (c_ctx != NULL) SSL_CTX_free(c_ctx); if (bio_stdout != NULL) BIO_free(bio_stdout); #ifndef OPENSSL_NO_RSA free_tmp_rsa(); #endif #ifndef OPENSSL_NO_ENGINE ENGINE_cleanup(); #endif CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); ERR_remove_thread_state(NULL); EVP_cleanup(); CRYPTO_mem_leaks(bio_err); if (bio_err != NULL) BIO_free(bio_err); EXIT(ret); return ret; } int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count, clock_t *s_time, clock_t *c_time) { long cw_num = count, cr_num = count, sw_num = count, sr_num = count; BIO *s_ssl_bio = NULL, *c_ssl_bio = NULL; BIO *server = NULL, *server_io = NULL, *client = NULL, *client_io = NULL; int ret = 1; size_t bufsiz = 256; /* small buffer for testing */ if (!BIO_new_bio_pair(&server, bufsiz, &server_io, bufsiz)) goto err; if (!BIO_new_bio_pair(&client, bufsiz, &client_io, bufsiz)) goto err; s_ssl_bio = BIO_new(BIO_f_ssl()); if (!s_ssl_bio) goto err; c_ssl_bio = BIO_new(BIO_f_ssl()); if (!c_ssl_bio) goto err; SSL_set_connect_state(c_ssl); SSL_set_bio(c_ssl, client, client); (void)BIO_set_ssl(c_ssl_bio, c_ssl, BIO_NOCLOSE); SSL_set_accept_state(s_ssl); SSL_set_bio(s_ssl, server, server); (void)BIO_set_ssl(s_ssl_bio, s_ssl, BIO_NOCLOSE); do { /*- * c_ssl_bio: SSL filter BIO * * client: pseudo-I/O for SSL library * * client_io: client's SSL communication; usually to be * relayed over some I/O facility, but in this * test program, we're the server, too: * * server_io: server's SSL communication * * server: pseudo-I/O for SSL library * * s_ssl_bio: SSL filter BIO * * The client and the server each employ a "BIO pair": * client + client_io, server + server_io. * BIO pairs are symmetric. A BIO pair behaves similar * to a non-blocking socketpair (but both endpoints must * be handled by the same thread). * [Here we could connect client and server to the ends * of a single BIO pair, but then this code would be less * suitable as an example for BIO pairs in general.] * * Useful functions for querying the state of BIO pair endpoints: * * BIO_ctrl_pending(bio) number of bytes we can read now * BIO_ctrl_get_read_request(bio) number of bytes needed to fulfil * other side's read attempt * BIO_ctrl_get_write_guarantee(bio) number of bytes we can write now * * ..._read_request is never more than ..._write_guarantee; * it depends on the application which one you should use. */ /* * We have non-blocking behaviour throughout this test program, but * can be sure that there is *some* progress in each iteration; so we * don't have to worry about ..._SHOULD_READ or ..._SHOULD_WRITE -- * we just try everything in each iteration */ { /* CLIENT */ MS_STATIC char cbuf[1024 * 8]; int i, r; clock_t c_clock = clock(); memset(cbuf, 0, sizeof(cbuf)); if (debug) if (SSL_in_init(c_ssl)) printf("client waiting in SSL_connect - %s\n", SSL_state_string_long(c_ssl)); if (cw_num > 0) { /* Write to server. */ if (cw_num > (long)sizeof cbuf) i = sizeof cbuf; else i = (int)cw_num; r = BIO_write(c_ssl_bio, cbuf, i); if (r < 0) { if (!BIO_should_retry(c_ssl_bio)) { fprintf(stderr, "ERROR in CLIENT\n"); goto err; } /* * BIO_should_retry(...) can just be ignored here. The * library expects us to call BIO_write with the same * arguments again, and that's what we will do in the * next iteration. */ } else if (r == 0) { fprintf(stderr, "SSL CLIENT STARTUP FAILED\n"); goto err; } else { if (debug) printf("client wrote %d\n", r); cw_num -= r; } } if (cr_num > 0) { /* Read from server. */ r = BIO_read(c_ssl_bio, cbuf, sizeof(cbuf)); if (r < 0) { if (!BIO_should_retry(c_ssl_bio)) { fprintf(stderr, "ERROR in CLIENT\n"); goto err; } /* * Again, "BIO_should_retry" can be ignored. */ } else if (r == 0) { fprintf(stderr, "SSL CLIENT STARTUP FAILED\n"); goto err; } else { if (debug) printf("client read %d\n", r); cr_num -= r; } } /* * c_time and s_time increments will typically be very small * (depending on machine speed and clock tick intervals), but * sampling over a large number of connections should result in * fairly accurate figures. We cannot guarantee a lot, however * -- if each connection lasts for exactly one clock tick, it * will be counted only for the client or only for the server or * even not at all. */ *c_time += (clock() - c_clock); } { /* SERVER */ MS_STATIC char sbuf[1024 * 8]; int i, r; clock_t s_clock = clock(); memset(sbuf, 0, sizeof(sbuf)); if (debug) if (SSL_in_init(s_ssl)) printf("server waiting in SSL_accept - %s\n", SSL_state_string_long(s_ssl)); if (sw_num > 0) { /* Write to client. */ if (sw_num > (long)sizeof sbuf) i = sizeof sbuf; else i = (int)sw_num; r = BIO_write(s_ssl_bio, sbuf, i); if (r < 0) { if (!BIO_should_retry(s_ssl_bio)) { fprintf(stderr, "ERROR in SERVER\n"); goto err; } /* Ignore "BIO_should_retry". */ } else if (r == 0) { fprintf(stderr, "SSL SERVER STARTUP FAILED\n"); goto err; } else { if (debug) printf("server wrote %d\n", r); sw_num -= r; } } if (sr_num > 0) { /* Read from client. */ r = BIO_read(s_ssl_bio, sbuf, sizeof(sbuf)); if (r < 0) { if (!BIO_should_retry(s_ssl_bio)) { fprintf(stderr, "ERROR in SERVER\n"); goto err; } /* blah, blah */ } else if (r == 0) { fprintf(stderr, "SSL SERVER STARTUP FAILED\n"); goto err; } else { if (debug) printf("server read %d\n", r); sr_num -= r; } } *s_time += (clock() - s_clock); } { /* "I/O" BETWEEN CLIENT AND SERVER. */ size_t r1, r2; BIO *io1 = server_io, *io2 = client_io; /* * we use the non-copying interface for io1 and the standard * BIO_write/BIO_read interface for io2 */ static int prev_progress = 1; int progress = 0; /* io1 to io2 */ do { size_t num; int r; r1 = BIO_ctrl_pending(io1); r2 = BIO_ctrl_get_write_guarantee(io2); num = r1; if (r2 < num) num = r2; if (num) { char *dataptr; if (INT_MAX < num) /* yeah, right */ num = INT_MAX; r = BIO_nread(io1, &dataptr, (int)num); assert(r > 0); assert(r <= (int)num); /* * possibly r < num (non-contiguous data) */ num = r; r = BIO_write(io2, dataptr, (int)num); if (r != (int)num) { /* can't happen */ fprintf(stderr, "ERROR: BIO_write could not write " "BIO_ctrl_get_write_guarantee() bytes"); goto err; } progress = 1; if (debug) printf((io1 == client_io) ? "C->S relaying: %d bytes\n" : "S->C relaying: %d bytes\n", (int)num); } } while (r1 && r2); /* io2 to io1 */ { size_t num; int r; r1 = BIO_ctrl_pending(io2); r2 = BIO_ctrl_get_read_request(io1); /* * here we could use ..._get_write_guarantee instead of * ..._get_read_request, but by using the latter we test * restartability of the SSL implementation more thoroughly */ num = r1; if (r2 < num) num = r2; if (num) { char *dataptr; if (INT_MAX < num) num = INT_MAX; if (num > 1) --num; /* test restartability even more thoroughly */ r = BIO_nwrite0(io1, &dataptr); assert(r > 0); if (r < (int)num) num = r; r = BIO_read(io2, dataptr, (int)num); if (r != (int)num) { /* can't happen */ fprintf(stderr, "ERROR: BIO_read could not read " "BIO_ctrl_pending() bytes"); goto err; } progress = 1; r = BIO_nwrite(io1, &dataptr, (int)num); if (r != (int)num) { /* can't happen */ fprintf(stderr, "ERROR: BIO_nwrite() did not accept " "BIO_nwrite0() bytes"); goto err; } if (debug) printf((io2 == client_io) ? "C->S relaying: %d bytes\n" : "S->C relaying: %d bytes\n", (int)num); } } /* no loop, BIO_ctrl_get_read_request now * returns 0 anyway */ if (!progress && !prev_progress) if (cw_num > 0 || cr_num > 0 || sw_num > 0 || sr_num > 0) { fprintf(stderr, "ERROR: got stuck\n"); if (strcmp("SSLv2", SSL_get_version(c_ssl)) == 0) { fprintf(stderr, "This can happen for SSL2 because " "CLIENT-FINISHED and SERVER-VERIFY are written \n" "concurrently ..."); if (strncmp("2SCF", SSL_state_string(c_ssl), 4) == 0 && strncmp("2SSV", SSL_state_string(s_ssl), 4) == 0) { fprintf(stderr, " ok.\n"); goto end; } } fprintf(stderr, " ERROR.\n"); goto err; } prev_progress = progress; } } while (cw_num > 0 || cr_num > 0 || sw_num > 0 || sr_num > 0); if (verbose) print_details(c_ssl, "DONE via BIO pair: "); if (verify_serverinfo() < 0) { ret = 1; goto err; } if (custom_ext_error) { ret = 1; goto err; } end: ret = 0; err: ERR_print_errors(bio_err); if (server) BIO_free(server); if (server_io) BIO_free(server_io); if (client) BIO_free(client); if (client_io) BIO_free(client_io); if (s_ssl_bio) BIO_free(s_ssl_bio); if (c_ssl_bio) BIO_free(c_ssl_bio); return ret; } #define W_READ 1 #define W_WRITE 2 #define C_DONE 1 #define S_DONE 2 int doit(SSL *s_ssl, SSL *c_ssl, long count) { char *cbuf = NULL, *sbuf = NULL; long bufsiz; long cw_num = count, cr_num = count; long sw_num = count, sr_num = count; int ret = 1; BIO *c_to_s = NULL; BIO *s_to_c = NULL; BIO *c_bio = NULL; BIO *s_bio = NULL; int c_r, c_w, s_r, s_w; int i, j; int done = 0; int c_write, s_write; int do_server = 0, do_client = 0; int max_frag = 5 * 1024; bufsiz = count > 40 * 1024 ? 40 * 1024 : count; if ((cbuf = OPENSSL_malloc(bufsiz)) == NULL) goto err; if ((sbuf = OPENSSL_malloc(bufsiz)) == NULL) goto err; memset(cbuf, 0, bufsiz); memset(sbuf, 0, bufsiz); c_to_s = BIO_new(BIO_s_mem()); s_to_c = BIO_new(BIO_s_mem()); if ((s_to_c == NULL) || (c_to_s == NULL)) { ERR_print_errors(bio_err); goto err; } c_bio = BIO_new(BIO_f_ssl()); s_bio = BIO_new(BIO_f_ssl()); if ((c_bio == NULL) || (s_bio == NULL)) { ERR_print_errors(bio_err); goto err; } SSL_set_connect_state(c_ssl); SSL_set_bio(c_ssl, s_to_c, c_to_s); SSL_set_max_send_fragment(c_ssl, max_frag); BIO_set_ssl(c_bio, c_ssl, BIO_NOCLOSE); SSL_set_accept_state(s_ssl); SSL_set_bio(s_ssl, c_to_s, s_to_c); SSL_set_max_send_fragment(s_ssl, max_frag); BIO_set_ssl(s_bio, s_ssl, BIO_NOCLOSE); c_r = 0; s_r = 1; c_w = 1; s_w = 0; c_write = 1, s_write = 0; /* We can always do writes */ for (;;) { do_server = 0; do_client = 0; i = (int)BIO_pending(s_bio); if ((i && s_r) || s_w) do_server = 1; i = (int)BIO_pending(c_bio); if ((i && c_r) || c_w) do_client = 1; if (do_server && debug) { if (SSL_in_init(s_ssl)) printf("server waiting in SSL_accept - %s\n", SSL_state_string_long(s_ssl)); /*- else if (s_write) printf("server:SSL_write()\n"); else printf("server:SSL_read()\n"); */ } if (do_client && debug) { if (SSL_in_init(c_ssl)) printf("client waiting in SSL_connect - %s\n", SSL_state_string_long(c_ssl)); /*- else if (c_write) printf("client:SSL_write()\n"); else printf("client:SSL_read()\n"); */ } if (!do_client && !do_server) { fprintf(stdout, "ERROR IN STARTUP\n"); ERR_print_errors(bio_err); goto err; } if (do_client && !(done & C_DONE)) { if (c_write) { j = (cw_num > bufsiz) ? (int)bufsiz : (int)cw_num; i = BIO_write(c_bio, cbuf, j); if (i < 0) { c_r = 0; c_w = 0; if (BIO_should_retry(c_bio)) { if (BIO_should_read(c_bio)) c_r = 1; if (BIO_should_write(c_bio)) c_w = 1; } else { fprintf(stderr, "ERROR in CLIENT\n"); ERR_print_errors(bio_err); goto err; } } else if (i == 0) { fprintf(stderr, "SSL CLIENT STARTUP FAILED\n"); goto err; } else { if (debug) printf("client wrote %d\n", i); /* ok */ s_r = 1; c_write = 0; cw_num -= i; if (max_frag > 1029) SSL_set_max_send_fragment(c_ssl, max_frag -= 5); } } else { i = BIO_read(c_bio, cbuf, bufsiz); if (i < 0) { c_r = 0; c_w = 0; if (BIO_should_retry(c_bio)) { if (BIO_should_read(c_bio)) c_r = 1; if (BIO_should_write(c_bio)) c_w = 1; } else { fprintf(stderr, "ERROR in CLIENT\n"); ERR_print_errors(bio_err); goto err; } } else if (i == 0) { fprintf(stderr, "SSL CLIENT STARTUP FAILED\n"); goto err; } else { if (debug) printf("client read %d\n", i); cr_num -= i; if (sw_num > 0) { s_write = 1; s_w = 1; } if (cr_num <= 0) { s_write = 1; s_w = 1; done = S_DONE | C_DONE; } } } } if (do_server && !(done & S_DONE)) { if (!s_write) { i = BIO_read(s_bio, sbuf, bufsiz); if (i < 0) { s_r = 0; s_w = 0; if (BIO_should_retry(s_bio)) { if (BIO_should_read(s_bio)) s_r = 1; if (BIO_should_write(s_bio)) s_w = 1; } else { fprintf(stderr, "ERROR in SERVER\n"); ERR_print_errors(bio_err); goto err; } } else if (i == 0) { ERR_print_errors(bio_err); fprintf(stderr, "SSL SERVER STARTUP FAILED in SSL_read\n"); goto err; } else { if (debug) printf("server read %d\n", i); sr_num -= i; if (cw_num > 0) { c_write = 1; c_w = 1; } if (sr_num <= 0) { s_write = 1; s_w = 1; c_write = 0; } } } else { j = (sw_num > bufsiz) ? (int)bufsiz : (int)sw_num; i = BIO_write(s_bio, sbuf, j); if (i < 0) { s_r = 0; s_w = 0; if (BIO_should_retry(s_bio)) { if (BIO_should_read(s_bio)) s_r = 1; if (BIO_should_write(s_bio)) s_w = 1; } else { fprintf(stderr, "ERROR in SERVER\n"); ERR_print_errors(bio_err); goto err; } } else if (i == 0) { ERR_print_errors(bio_err); fprintf(stderr, "SSL SERVER STARTUP FAILED in SSL_write\n"); goto err; } else { if (debug) printf("server wrote %d\n", i); sw_num -= i; s_write = 0; c_r = 1; if (sw_num <= 0) done |= S_DONE; if (max_frag > 1029) SSL_set_max_send_fragment(s_ssl, max_frag -= 5); } } } if ((done & S_DONE) && (done & C_DONE)) break; } if (verbose) print_details(c_ssl, "DONE: "); if (verify_serverinfo() < 0) { ret = 1; goto err; } if (custom_ext_error) { ret = 1; goto err; } ret = 0; err: /* * We have to set the BIO's to NULL otherwise they will be * OPENSSL_free()ed twice. Once when th s_ssl is SSL_free()ed and again * when c_ssl is SSL_free()ed. This is a hack required because s_ssl and * c_ssl are sharing the same BIO structure and SSL_set_bio() and * SSL_free() automatically BIO_free non NULL entries. You should not * normally do this or be required to do this */ if (s_ssl != NULL) { s_ssl->rbio = NULL; s_ssl->wbio = NULL; } if (c_ssl != NULL) { c_ssl->rbio = NULL; c_ssl->wbio = NULL; } if (c_to_s != NULL) BIO_free(c_to_s); if (s_to_c != NULL) BIO_free(s_to_c); if (c_bio != NULL) BIO_free_all(c_bio); if (s_bio != NULL) BIO_free_all(s_bio); if (cbuf) OPENSSL_free(cbuf); if (sbuf) OPENSSL_free(sbuf); return (ret); } static int get_proxy_auth_ex_data_idx(void) { static volatile int idx = -1; if (idx < 0) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); if (idx < 0) { idx = X509_STORE_CTX_get_ex_new_index(0, "SSLtest for verify callback", NULL, NULL, NULL); } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); } return idx; } static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx) { char *s, buf[256]; s = X509_NAME_oneline(X509_get_subject_name(ctx->current_cert), buf, sizeof buf); if (s != NULL) { if (ok) fprintf(stderr, "depth=%d %s\n", ctx->error_depth, buf); else { fprintf(stderr, "depth=%d error=%d %s\n", ctx->error_depth, ctx->error, buf); } } if (ok == 0) { fprintf(stderr, "Error string: %s\n", X509_verify_cert_error_string(ctx->error)); switch (ctx->error) { case X509_V_ERR_CERT_NOT_YET_VALID: case X509_V_ERR_CERT_HAS_EXPIRED: case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: fprintf(stderr, " ... ignored.\n"); ok = 1; } } if (ok == 1) { X509 *xs = ctx->current_cert; #if 0 X509 *xi = ctx->current_issuer; #endif if (xs->ex_flags & EXFLAG_PROXY) { unsigned int *letters = X509_STORE_CTX_get_ex_data(ctx, get_proxy_auth_ex_data_idx ()); if (letters) { int found_any = 0; int i; PROXY_CERT_INFO_EXTENSION *pci = X509_get_ext_d2i(xs, NID_proxyCertInfo, NULL, NULL); switch (OBJ_obj2nid(pci->proxyPolicy->policyLanguage)) { case NID_Independent: /* * Completely meaningless in this program, as there's no * way to grant explicit rights to a specific PrC. * Basically, using id-ppl-Independent is the perfect way * to grant no rights at all. */ fprintf(stderr, " Independent proxy certificate"); for (i = 0; i < 26; i++) letters[i] = 0; break; case NID_id_ppl_inheritAll: /* * This is basically a NOP, we simply let the current * rights stand as they are. */ fprintf(stderr, " Proxy certificate inherits all"); break; default: s = (char *) pci->proxyPolicy->policy->data; i = pci->proxyPolicy->policy->length; /* * The algorithm works as follows: it is assumed that * previous iterations or the initial granted rights has * already set some elements of `letters'. What we need * to do is to clear those that weren't granted by the * current PrC as well. The easiest way to do this is to * add 1 to all the elements whose letters are given with * the current policy. That way, all elements that are * set by the current policy and were already set by * earlier policies and through the original grant of * rights will get the value 2 or higher. The last thing * to do is to sweep through `letters' and keep the * elements having the value 2 as set, and clear all the * others. */ fprintf(stderr, " Certificate proxy rights = %*.*s", i, i, s); while (i-- > 0) { int c = *s++; if (isascii(c) && isalpha(c)) { if (islower(c)) c = toupper(c); letters[c - 'A']++; } } for (i = 0; i < 26; i++) if (letters[i] < 2) letters[i] = 0; else letters[i] = 1; } found_any = 0; fprintf(stderr, ", resulting proxy rights = "); for (i = 0; i < 26; i++) if (letters[i]) { fprintf(stderr, "%c", i + 'A'); found_any = 1; } if (!found_any) fprintf(stderr, "none"); fprintf(stderr, "\n"); PROXY_CERT_INFO_EXTENSION_free(pci); } } } return (ok); } static void process_proxy_debug(int indent, const char *format, ...) { /* That's 80 > */ static const char indentation[] = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; char my_format[256]; va_list args; BIO_snprintf(my_format, sizeof(my_format), "%*.*s %s", indent, indent, indentation, format); va_start(args, format); vfprintf(stderr, my_format, args); va_end(args); } /*- * Priority levels: * 0 [!]var, () * 1 & ^ * 2 | */ static int process_proxy_cond_adders(unsigned int letters[26], const char *cond, const char **cond_end, int *pos, int indent); static int process_proxy_cond_val(unsigned int letters[26], const char *cond, const char **cond_end, int *pos, int indent) { int c; int ok = 1; int negate = 0; while (isspace((int)*cond)) { cond++; (*pos)++; } c = *cond; if (debug) process_proxy_debug(indent, "Start process_proxy_cond_val at position %d: %s\n", *pos, cond); while (c == '!') { negate = !negate; cond++; (*pos)++; while (isspace((int)*cond)) { cond++; (*pos)++; } c = *cond; } if (c == '(') { cond++; (*pos)++; ok = process_proxy_cond_adders(letters, cond, cond_end, pos, indent + 1); cond = *cond_end; if (ok < 0) goto end; while (isspace((int)*cond)) { cond++; (*pos)++; } c = *cond; if (c != ')') { fprintf(stderr, "Weird condition character in position %d: " "%c\n", *pos, c); ok = -1; goto end; } cond++; (*pos)++; } else if (isascii(c) && isalpha(c)) { if (islower(c)) c = toupper(c); ok = letters[c - 'A']; cond++; (*pos)++; } else { fprintf(stderr, "Weird condition character in position %d: " "%c\n", *pos, c); ok = -1; goto end; } end: *cond_end = cond; if (ok >= 0 && negate) ok = !ok; if (debug) process_proxy_debug(indent, "End process_proxy_cond_val at position %d: %s, returning %d\n", *pos, cond, ok); return ok; } static int process_proxy_cond_multipliers(unsigned int letters[26], const char *cond, const char **cond_end, int *pos, int indent) { int ok; char c; if (debug) process_proxy_debug(indent, "Start process_proxy_cond_multipliers at position %d: %s\n", *pos, cond); ok = process_proxy_cond_val(letters, cond, cond_end, pos, indent + 1); cond = *cond_end; if (ok < 0) goto end; while (ok >= 0) { while (isspace((int)*cond)) { cond++; (*pos)++; } c = *cond; switch (c) { case '&': case '^': { int save_ok = ok; cond++; (*pos)++; ok = process_proxy_cond_val(letters, cond, cond_end, pos, indent + 1); cond = *cond_end; if (ok < 0) break; switch (c) { case '&': ok &= save_ok; break; case '^': ok ^= save_ok; break; default: fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" " STOPPING\n"); EXIT(1); } } break; default: goto end; } } end: if (debug) process_proxy_debug(indent, "End process_proxy_cond_multipliers at position %d: %s, returning %d\n", *pos, cond, ok); *cond_end = cond; return ok; } static int process_proxy_cond_adders(unsigned int letters[26], const char *cond, const char **cond_end, int *pos, int indent) { int ok; char c; if (debug) process_proxy_debug(indent, "Start process_proxy_cond_adders at position %d: %s\n", *pos, cond); ok = process_proxy_cond_multipliers(letters, cond, cond_end, pos, indent + 1); cond = *cond_end; if (ok < 0) goto end; while (ok >= 0) { while (isspace((int)*cond)) { cond++; (*pos)++; } c = *cond; switch (c) { case '|': { int save_ok = ok; cond++; (*pos)++; ok = process_proxy_cond_multipliers(letters, cond, cond_end, pos, indent + 1); cond = *cond_end; if (ok < 0) break; switch (c) { case '|': ok |= save_ok; break; default: fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" " STOPPING\n"); EXIT(1); } } break; default: goto end; } } end: if (debug) process_proxy_debug(indent, "End process_proxy_cond_adders at position %d: %s, returning %d\n", *pos, cond, ok); *cond_end = cond; return ok; } static int process_proxy_cond(unsigned int letters[26], const char *cond, const char **cond_end) { int pos = 1; return process_proxy_cond_adders(letters, cond, cond_end, &pos, 1); } static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg) { int ok = 1; struct app_verify_arg *cb_arg = arg; unsigned int letters[26]; /* only used with proxy_auth */ if (cb_arg->app_verify) { char *s = NULL, buf[256]; fprintf(stderr, "In app_verify_callback, allowing cert. "); fprintf(stderr, "Arg is: %s\n", cb_arg->string); fprintf(stderr, "Finished printing do we have a context? 0x%p a cert? 0x%p\n", (void *)ctx, (void *)ctx->cert); if (ctx->cert) s = X509_NAME_oneline(X509_get_subject_name(ctx->cert), buf, 256); if (s != NULL) { fprintf(stderr, "cert depth=%d %s\n", ctx->error_depth, buf); } return (1); } if (cb_arg->proxy_auth) { int found_any = 0, i; char *sp; for (i = 0; i < 26; i++) letters[i] = 0; for (sp = cb_arg->proxy_auth; *sp; sp++) { int c = *sp; if (isascii(c) && isalpha(c)) { if (islower(c)) c = toupper(c); letters[c - 'A'] = 1; } } fprintf(stderr, " Initial proxy rights = "); for (i = 0; i < 26; i++) if (letters[i]) { fprintf(stderr, "%c", i + 'A'); found_any = 1; } if (!found_any) fprintf(stderr, "none"); fprintf(stderr, "\n"); X509_STORE_CTX_set_ex_data(ctx, get_proxy_auth_ex_data_idx(), letters); } if (cb_arg->allow_proxy_certs) { X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS); } #ifndef OPENSSL_NO_X509_VERIFY ok = X509_verify_cert(ctx); #endif if (cb_arg->proxy_auth) { if (ok > 0) { const char *cond_end = NULL; ok = process_proxy_cond(letters, cb_arg->proxy_cond, &cond_end); if (ok < 0) EXIT(3); if (*cond_end) { fprintf(stderr, "Stopped processing condition before it's end.\n"); ok = 0; } if (!ok) fprintf(stderr, "Proxy rights check with condition '%s' proved invalid\n", cb_arg->proxy_cond); else fprintf(stderr, "Proxy rights check with condition '%s' proved valid\n", cb_arg->proxy_cond); } } return (ok); } #ifndef OPENSSL_NO_RSA static RSA *rsa_tmp = NULL; static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength) { BIGNUM *bn = NULL; if (rsa_tmp == NULL) { bn = BN_new(); rsa_tmp = RSA_new(); if (!bn || !rsa_tmp || !BN_set_word(bn, RSA_F4)) { BIO_printf(bio_err, "Memory error..."); goto end; } BIO_printf(bio_err, "Generating temp (%d bit) RSA key...", keylength); (void)BIO_flush(bio_err); if (!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { BIO_printf(bio_err, "Error generating key."); RSA_free(rsa_tmp); rsa_tmp = NULL; } end: BIO_printf(bio_err, "\n"); (void)BIO_flush(bio_err); } if (bn) BN_free(bn); return (rsa_tmp); } static void free_tmp_rsa(void) { if (rsa_tmp != NULL) { RSA_free(rsa_tmp); rsa_tmp = NULL; } } #endif #ifndef OPENSSL_NO_DH /*- * These DH parameters have been generated as follows: * $ openssl dhparam -C -noout 512 * $ openssl dhparam -C -noout 1024 * $ openssl dhparam -C -noout -dsaparam 1024 * (The third function has been renamed to avoid name conflicts.) */ static DH *get_dh512() { static unsigned char dh512_p[] = { 0xCB, 0xC8, 0xE1, 0x86, 0xD0, 0x1F, 0x94, 0x17, 0xA6, 0x99, 0xF0, 0xC6, 0x1F, 0x0D, 0xAC, 0xB6, 0x25, 0x3E, 0x06, 0x39, 0xCA, 0x72, 0x04, 0xB0, 0x6E, 0xDA, 0xC0, 0x61, 0xE6, 0x7A, 0x77, 0x25, 0xE8, 0x3B, 0xB9, 0x5F, 0x9A, 0xB6, 0xB5, 0xFE, 0x99, 0x0B, 0xA1, 0x93, 0x4E, 0x35, 0x33, 0xB8, 0xE1, 0xF1, 0x13, 0x4F, 0x59, 0x1A, 0xD2, 0x57, 0xC0, 0x26, 0x21, 0x33, 0x02, 0xC5, 0xAE, 0x23, }; static unsigned char dh512_g[] = { 0x02, }; DH *dh; if ((dh = DH_new()) == NULL) return (NULL); dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); if ((dh->p == NULL) || (dh->g == NULL)) { DH_free(dh); return (NULL); } return (dh); } static DH *get_dh1024() { static unsigned char dh1024_p[] = { 0xF8, 0x81, 0x89, 0x7D, 0x14, 0x24, 0xC5, 0xD1, 0xE6, 0xF7, 0xBF, 0x3A, 0xE4, 0x90, 0xF4, 0xFC, 0x73, 0xFB, 0x34, 0xB5, 0xFA, 0x4C, 0x56, 0xA2, 0xEA, 0xA7, 0xE9, 0xC0, 0xC0, 0xCE, 0x89, 0xE1, 0xFA, 0x63, 0x3F, 0xB0, 0x6B, 0x32, 0x66, 0xF1, 0xD1, 0x7B, 0xB0, 0x00, 0x8F, 0xCA, 0x87, 0xC2, 0xAE, 0x98, 0x89, 0x26, 0x17, 0xC2, 0x05, 0xD2, 0xEC, 0x08, 0xD0, 0x8C, 0xFF, 0x17, 0x52, 0x8C, 0xC5, 0x07, 0x93, 0x03, 0xB1, 0xF6, 0x2F, 0xB8, 0x1C, 0x52, 0x47, 0x27, 0x1B, 0xDB, 0xD1, 0x8D, 0x9D, 0x69, 0x1D, 0x52, 0x4B, 0x32, 0x81, 0xAA, 0x7F, 0x00, 0xC8, 0xDC, 0xE6, 0xD9, 0xCC, 0xC1, 0x11, 0x2D, 0x37, 0x34, 0x6C, 0xEA, 0x02, 0x97, 0x4B, 0x0E, 0xBB, 0xB1, 0x71, 0x33, 0x09, 0x15, 0xFD, 0xDD, 0x23, 0x87, 0x07, 0x5E, 0x89, 0xAB, 0x6B, 0x7C, 0x5F, 0xEC, 0xA6, 0x24, 0xDC, 0x53, }; static unsigned char dh1024_g[] = { 0x02, }; DH *dh; if ((dh = DH_new()) == NULL) return (NULL); dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); if ((dh->p == NULL) || (dh->g == NULL)) { DH_free(dh); return (NULL); } return (dh); } static DH *get_dh1024dsa() { static unsigned char dh1024_p[] = { 0xC8, 0x00, 0xF7, 0x08, 0x07, 0x89, 0x4D, 0x90, 0x53, 0xF3, 0xD5, 0x00, 0x21, 0x1B, 0xF7, 0x31, 0xA6, 0xA2, 0xDA, 0x23, 0x9A, 0xC7, 0x87, 0x19, 0x3B, 0x47, 0xB6, 0x8C, 0x04, 0x6F, 0xFF, 0xC6, 0x9B, 0xB8, 0x65, 0xD2, 0xC2, 0x5F, 0x31, 0x83, 0x4A, 0xA7, 0x5F, 0x2F, 0x88, 0x38, 0xB6, 0x55, 0xCF, 0xD9, 0x87, 0x6D, 0x6F, 0x9F, 0xDA, 0xAC, 0xA6, 0x48, 0xAF, 0xFC, 0x33, 0x84, 0x37, 0x5B, 0x82, 0x4A, 0x31, 0x5D, 0xE7, 0xBD, 0x52, 0x97, 0xA1, 0x77, 0xBF, 0x10, 0x9E, 0x37, 0xEA, 0x64, 0xFA, 0xCA, 0x28, 0x8D, 0x9D, 0x3B, 0xD2, 0x6E, 0x09, 0x5C, 0x68, 0xC7, 0x45, 0x90, 0xFD, 0xBB, 0x70, 0xC9, 0x3A, 0xBB, 0xDF, 0xD4, 0x21, 0x0F, 0xC4, 0x6A, 0x3C, 0xF6, 0x61, 0xCF, 0x3F, 0xD6, 0x13, 0xF1, 0x5F, 0xBC, 0xCF, 0xBC, 0x26, 0x9E, 0xBC, 0x0B, 0xBD, 0xAB, 0x5D, 0xC9, 0x54, 0x39, }; static unsigned char dh1024_g[] = { 0x3B, 0x40, 0x86, 0xE7, 0xF3, 0x6C, 0xDE, 0x67, 0x1C, 0xCC, 0x80, 0x05, 0x5A, 0xDF, 0xFE, 0xBD, 0x20, 0x27, 0x74, 0x6C, 0x24, 0xC9, 0x03, 0xF3, 0xE1, 0x8D, 0xC3, 0x7D, 0x98, 0x27, 0x40, 0x08, 0xB8, 0x8C, 0x6A, 0xE9, 0xBB, 0x1A, 0x3A, 0xD6, 0x86, 0x83, 0x5E, 0x72, 0x41, 0xCE, 0x85, 0x3C, 0xD2, 0xB3, 0xFC, 0x13, 0xCE, 0x37, 0x81, 0x9E, 0x4C, 0x1C, 0x7B, 0x65, 0xD3, 0xE6, 0xA6, 0x00, 0xF5, 0x5A, 0x95, 0x43, 0x5E, 0x81, 0xCF, 0x60, 0xA2, 0x23, 0xFC, 0x36, 0xA7, 0x5D, 0x7A, 0x4C, 0x06, 0x91, 0x6E, 0xF6, 0x57, 0xEE, 0x36, 0xCB, 0x06, 0xEA, 0xF5, 0x3D, 0x95, 0x49, 0xCB, 0xA7, 0xDD, 0x81, 0xDF, 0x80, 0x09, 0x4A, 0x97, 0x4D, 0xA8, 0x22, 0x72, 0xA1, 0x7F, 0xC4, 0x70, 0x56, 0x70, 0xE8, 0x20, 0x10, 0x18, 0x8F, 0x2E, 0x60, 0x07, 0xE7, 0x68, 0x1A, 0x82, 0x5D, 0x32, 0xA2, }; DH *dh; if ((dh = DH_new()) == NULL) return (NULL); dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); if ((dh->p == NULL) || (dh->g == NULL)) { DH_free(dh); return (NULL); } dh->length = 160; return (dh); } #endif #ifndef OPENSSL_NO_PSK /* convert the PSK key (psk_key) in ascii to binary (psk) */ static int psk_key2bn(const char *pskkey, unsigned char *psk, unsigned int max_psk_len) { int ret; BIGNUM *bn = NULL; ret = BN_hex2bn(&bn, pskkey); if (!ret) { BIO_printf(bio_err, "Could not convert PSK key '%s' to BIGNUM\n", pskkey); if (bn) BN_free(bn); return 0; } if (BN_num_bytes(bn) > (int)max_psk_len) { BIO_printf(bio_err, "psk buffer of callback is too small (%d) for key (%d)\n", max_psk_len, BN_num_bytes(bn)); BN_free(bn); return 0; } ret = BN_bn2bin(bn, psk); BN_free(bn); return ret; } static unsigned int psk_client_callback(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len) { int ret; unsigned int psk_len = 0; ret = BIO_snprintf(identity, max_identity_len, "Client_identity"); if (ret < 0) goto out_err; if (debug) fprintf(stderr, "client: created identity '%s' len=%d\n", identity, ret); ret = psk_key2bn(psk_key, psk, max_psk_len); if (ret < 0) goto out_err; psk_len = ret; out_err: return psk_len; } static unsigned int psk_server_callback(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len) { unsigned int psk_len = 0; if (strcmp(identity, "Client_identity") != 0) { BIO_printf(bio_err, "server: PSK error: client identity not found\n"); return 0; } psk_len = psk_key2bn(psk_key, psk, max_psk_len); return psk_len; } #endif static int do_test_cipherlist(void) { #if !defined(OPENSSL_NO_SSL2) || !defined(OPENSSL_NO_SSL3) || \ !defined(OPENSSL_NO_TLS1) int i = 0; const SSL_METHOD *meth; const SSL_CIPHER *ci, *tci = NULL; #endif #ifndef OPENSSL_NO_SSL2 fprintf(stderr, "testing SSLv2 cipher list order: "); meth = SSLv2_method(); while ((ci = meth->get_cipher(i++)) != NULL) { if (tci != NULL) if (ci->id >= tci->id) { fprintf(stderr, "failed %lx vs. %lx\n", ci->id, tci->id); return 0; } tci = ci; } fprintf(stderr, "ok\n"); #endif #ifndef OPENSSL_NO_SSL3 fprintf(stderr, "testing SSLv3 cipher list order: "); meth = SSLv3_method(); tci = NULL; while ((ci = meth->get_cipher(i++)) != NULL) { if (tci != NULL) if (ci->id >= tci->id) { fprintf(stderr, "failed %lx vs. %lx\n", ci->id, tci->id); return 0; } tci = ci; } fprintf(stderr, "ok\n"); #endif #ifndef OPENSSL_NO_TLS1 fprintf(stderr, "testing TLSv1 cipher list order: "); meth = TLSv1_method(); tci = NULL; while ((ci = meth->get_cipher(i++)) != NULL) { if (tci != NULL) if (ci->id >= tci->id) { fprintf(stderr, "failed %lx vs. %lx\n", ci->id, tci->id); return 0; } tci = ci; } fprintf(stderr, "ok\n"); #endif return 1; } diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 6587e8bb685c..1a4387b78eb9 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -1,4559 +1,4559 @@ /* ssl/t1_lib.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #include #include #ifndef OPENSSL_NO_EC #ifdef OPENSSL_NO_EC2M # include #endif #endif #include #include #include "ssl_locl.h" const char tls1_version_str[] = "TLSv1" OPENSSL_VERSION_PTEXT; #ifndef OPENSSL_NO_TLSEXT static int tls_decrypt_ticket(SSL *s, const unsigned char *tick, int ticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess); static int ssl_check_clienthello_tlsext_early(SSL *s); int ssl_check_serverhello_tlsext(SSL *s); #endif #define CHECKLEN(curr, val, limit) \ (((curr) >= (limit)) || (size_t)((limit) - (curr)) < (size_t)(val)) SSL3_ENC_METHOD TLSv1_enc_data = { tls1_enc, tls1_mac, tls1_setup_key_block, tls1_generate_master_secret, tls1_change_cipher_state, tls1_final_finish_mac, TLS1_FINISH_MAC_LENGTH, tls1_cert_verify_mac, TLS_MD_CLIENT_FINISH_CONST, TLS_MD_CLIENT_FINISH_CONST_SIZE, TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE, tls1_alert_code, tls1_export_keying_material, 0, SSL3_HM_HEADER_LENGTH, ssl3_set_handshake_header, ssl3_handshake_write }; SSL3_ENC_METHOD TLSv1_1_enc_data = { tls1_enc, tls1_mac, tls1_setup_key_block, tls1_generate_master_secret, tls1_change_cipher_state, tls1_final_finish_mac, TLS1_FINISH_MAC_LENGTH, tls1_cert_verify_mac, TLS_MD_CLIENT_FINISH_CONST, TLS_MD_CLIENT_FINISH_CONST_SIZE, TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE, tls1_alert_code, tls1_export_keying_material, SSL_ENC_FLAG_EXPLICIT_IV, SSL3_HM_HEADER_LENGTH, ssl3_set_handshake_header, ssl3_handshake_write }; SSL3_ENC_METHOD TLSv1_2_enc_data = { tls1_enc, tls1_mac, tls1_setup_key_block, tls1_generate_master_secret, tls1_change_cipher_state, tls1_final_finish_mac, TLS1_FINISH_MAC_LENGTH, tls1_cert_verify_mac, TLS_MD_CLIENT_FINISH_CONST, TLS_MD_CLIENT_FINISH_CONST_SIZE, TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE, tls1_alert_code, tls1_export_keying_material, SSL_ENC_FLAG_EXPLICIT_IV | SSL_ENC_FLAG_SIGALGS | SSL_ENC_FLAG_SHA256_PRF | SSL_ENC_FLAG_TLS1_2_CIPHERS, SSL3_HM_HEADER_LENGTH, ssl3_set_handshake_header, ssl3_handshake_write }; long tls1_default_timeout(void) { /* * 2 hours, the 24 hours mentioned in the TLSv1 spec is way too long for * http, the cache would over fill */ return (60 * 60 * 2); } int tls1_new(SSL *s) { if (!ssl3_new(s)) return (0); s->method->ssl_clear(s); return (1); } void tls1_free(SSL *s) { #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_session_ticket) { OPENSSL_free(s->tlsext_session_ticket); } #endif /* OPENSSL_NO_TLSEXT */ ssl3_free(s); } void tls1_clear(SSL *s) { ssl3_clear(s); s->version = s->method->version; } #ifndef OPENSSL_NO_EC static int nid_list[] = { NID_sect163k1, /* sect163k1 (1) */ NID_sect163r1, /* sect163r1 (2) */ NID_sect163r2, /* sect163r2 (3) */ NID_sect193r1, /* sect193r1 (4) */ NID_sect193r2, /* sect193r2 (5) */ NID_sect233k1, /* sect233k1 (6) */ NID_sect233r1, /* sect233r1 (7) */ NID_sect239k1, /* sect239k1 (8) */ NID_sect283k1, /* sect283k1 (9) */ NID_sect283r1, /* sect283r1 (10) */ NID_sect409k1, /* sect409k1 (11) */ NID_sect409r1, /* sect409r1 (12) */ NID_sect571k1, /* sect571k1 (13) */ NID_sect571r1, /* sect571r1 (14) */ NID_secp160k1, /* secp160k1 (15) */ NID_secp160r1, /* secp160r1 (16) */ NID_secp160r2, /* secp160r2 (17) */ NID_secp192k1, /* secp192k1 (18) */ NID_X9_62_prime192v1, /* secp192r1 (19) */ NID_secp224k1, /* secp224k1 (20) */ NID_secp224r1, /* secp224r1 (21) */ NID_secp256k1, /* secp256k1 (22) */ NID_X9_62_prime256v1, /* secp256r1 (23) */ NID_secp384r1, /* secp384r1 (24) */ NID_secp521r1, /* secp521r1 (25) */ NID_brainpoolP256r1, /* brainpoolP256r1 (26) */ NID_brainpoolP384r1, /* brainpoolP384r1 (27) */ NID_brainpoolP512r1 /* brainpool512r1 (28) */ }; static const unsigned char ecformats_default[] = { TLSEXT_ECPOINTFORMAT_uncompressed, TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime, TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 }; /* The client's default curves / the server's 'auto' curves. */ static const unsigned char eccurves_auto[] = { /* Prefer P-256 which has the fastest and most secure implementations. */ 0, 23, /* secp256r1 (23) */ /* Other >= 256-bit prime curves. */ 0, 25, /* secp521r1 (25) */ 0, 28, /* brainpool512r1 (28) */ 0, 27, /* brainpoolP384r1 (27) */ 0, 24, /* secp384r1 (24) */ 0, 26, /* brainpoolP256r1 (26) */ 0, 22, /* secp256k1 (22) */ # ifndef OPENSSL_NO_EC2M /* >= 256-bit binary curves. */ 0, 14, /* sect571r1 (14) */ 0, 13, /* sect571k1 (13) */ 0, 11, /* sect409k1 (11) */ 0, 12, /* sect409r1 (12) */ 0, 9, /* sect283k1 (9) */ 0, 10, /* sect283r1 (10) */ # endif }; static const unsigned char eccurves_all[] = { /* Prefer P-256 which has the fastest and most secure implementations. */ 0, 23, /* secp256r1 (23) */ /* Other >= 256-bit prime curves. */ 0, 25, /* secp521r1 (25) */ 0, 28, /* brainpool512r1 (28) */ 0, 27, /* brainpoolP384r1 (27) */ 0, 24, /* secp384r1 (24) */ 0, 26, /* brainpoolP256r1 (26) */ 0, 22, /* secp256k1 (22) */ # ifndef OPENSSL_NO_EC2M /* >= 256-bit binary curves. */ 0, 14, /* sect571r1 (14) */ 0, 13, /* sect571k1 (13) */ 0, 11, /* sect409k1 (11) */ 0, 12, /* sect409r1 (12) */ 0, 9, /* sect283k1 (9) */ 0, 10, /* sect283r1 (10) */ # endif /* * Remaining curves disabled by default but still permitted if set * via an explicit callback or parameters. */ 0, 20, /* secp224k1 (20) */ 0, 21, /* secp224r1 (21) */ 0, 18, /* secp192k1 (18) */ 0, 19, /* secp192r1 (19) */ 0, 15, /* secp160k1 (15) */ 0, 16, /* secp160r1 (16) */ 0, 17, /* secp160r2 (17) */ # ifndef OPENSSL_NO_EC2M 0, 8, /* sect239k1 (8) */ 0, 6, /* sect233k1 (6) */ 0, 7, /* sect233r1 (7) */ 0, 4, /* sect193r1 (4) */ 0, 5, /* sect193r2 (5) */ 0, 1, /* sect163k1 (1) */ 0, 2, /* sect163r1 (2) */ 0, 3, /* sect163r2 (3) */ # endif }; static const unsigned char suiteb_curves[] = { 0, TLSEXT_curve_P_256, 0, TLSEXT_curve_P_384 }; # ifdef OPENSSL_FIPS /* Brainpool not allowed in FIPS mode */ static const unsigned char fips_curves_default[] = { # ifndef OPENSSL_NO_EC2M 0, 14, /* sect571r1 (14) */ 0, 13, /* sect571k1 (13) */ # endif 0, 25, /* secp521r1 (25) */ # ifndef OPENSSL_NO_EC2M 0, 11, /* sect409k1 (11) */ 0, 12, /* sect409r1 (12) */ # endif 0, 24, /* secp384r1 (24) */ # ifndef OPENSSL_NO_EC2M 0, 9, /* sect283k1 (9) */ 0, 10, /* sect283r1 (10) */ # endif 0, 22, /* secp256k1 (22) */ 0, 23, /* secp256r1 (23) */ # ifndef OPENSSL_NO_EC2M 0, 8, /* sect239k1 (8) */ 0, 6, /* sect233k1 (6) */ 0, 7, /* sect233r1 (7) */ # endif 0, 20, /* secp224k1 (20) */ 0, 21, /* secp224r1 (21) */ # ifndef OPENSSL_NO_EC2M 0, 4, /* sect193r1 (4) */ 0, 5, /* sect193r2 (5) */ # endif 0, 18, /* secp192k1 (18) */ 0, 19, /* secp192r1 (19) */ # ifndef OPENSSL_NO_EC2M 0, 1, /* sect163k1 (1) */ 0, 2, /* sect163r1 (2) */ 0, 3, /* sect163r2 (3) */ # endif 0, 15, /* secp160k1 (15) */ 0, 16, /* secp160r1 (16) */ 0, 17, /* secp160r2 (17) */ }; # endif int tls1_ec_curve_id2nid(int curve_id) { /* ECC curves from RFC 4492 and RFC 7027 */ if ((curve_id < 1) || ((unsigned int)curve_id > sizeof(nid_list) / sizeof(nid_list[0]))) return 0; return nid_list[curve_id - 1]; } int tls1_ec_nid2curve_id(int nid) { /* ECC curves from RFC 4492 and RFC 7027 */ switch (nid) { case NID_sect163k1: /* sect163k1 (1) */ return 1; case NID_sect163r1: /* sect163r1 (2) */ return 2; case NID_sect163r2: /* sect163r2 (3) */ return 3; case NID_sect193r1: /* sect193r1 (4) */ return 4; case NID_sect193r2: /* sect193r2 (5) */ return 5; case NID_sect233k1: /* sect233k1 (6) */ return 6; case NID_sect233r1: /* sect233r1 (7) */ return 7; case NID_sect239k1: /* sect239k1 (8) */ return 8; case NID_sect283k1: /* sect283k1 (9) */ return 9; case NID_sect283r1: /* sect283r1 (10) */ return 10; case NID_sect409k1: /* sect409k1 (11) */ return 11; case NID_sect409r1: /* sect409r1 (12) */ return 12; case NID_sect571k1: /* sect571k1 (13) */ return 13; case NID_sect571r1: /* sect571r1 (14) */ return 14; case NID_secp160k1: /* secp160k1 (15) */ return 15; case NID_secp160r1: /* secp160r1 (16) */ return 16; case NID_secp160r2: /* secp160r2 (17) */ return 17; case NID_secp192k1: /* secp192k1 (18) */ return 18; case NID_X9_62_prime192v1: /* secp192r1 (19) */ return 19; case NID_secp224k1: /* secp224k1 (20) */ return 20; case NID_secp224r1: /* secp224r1 (21) */ return 21; case NID_secp256k1: /* secp256k1 (22) */ return 22; case NID_X9_62_prime256v1: /* secp256r1 (23) */ return 23; case NID_secp384r1: /* secp384r1 (24) */ return 24; case NID_secp521r1: /* secp521r1 (25) */ return 25; case NID_brainpoolP256r1: /* brainpoolP256r1 (26) */ return 26; case NID_brainpoolP384r1: /* brainpoolP384r1 (27) */ return 27; case NID_brainpoolP512r1: /* brainpool512r1 (28) */ return 28; default: return 0; } } /* * Get curves list, if "sess" is set return client curves otherwise * preferred list. * Sets |num_curves| to the number of curves in the list, i.e., * the length of |pcurves| is 2 * num_curves. * Returns 1 on success and 0 if the client curves list has invalid format. * The latter indicates an internal error: we should not be accepting such * lists in the first place. * TODO(emilia): we should really be storing the curves list in explicitly * parsed form instead. (However, this would affect binary compatibility * so cannot happen in the 1.0.x series.) */ static int tls1_get_curvelist(SSL *s, int sess, const unsigned char **pcurves, size_t *num_curves) { size_t pcurveslen = 0; if (sess) { *pcurves = s->session->tlsext_ellipticcurvelist; pcurveslen = s->session->tlsext_ellipticcurvelist_length; } else { /* For Suite B mode only include P-256, P-384 */ switch (tls1_suiteb(s)) { case SSL_CERT_FLAG_SUITEB_128_LOS: *pcurves = suiteb_curves; pcurveslen = sizeof(suiteb_curves); break; case SSL_CERT_FLAG_SUITEB_128_LOS_ONLY: *pcurves = suiteb_curves; pcurveslen = 2; break; case SSL_CERT_FLAG_SUITEB_192_LOS: *pcurves = suiteb_curves + 2; pcurveslen = 2; break; default: *pcurves = s->tlsext_ellipticcurvelist; pcurveslen = s->tlsext_ellipticcurvelist_length; } if (!*pcurves) { # ifdef OPENSSL_FIPS if (FIPS_mode()) { *pcurves = fips_curves_default; pcurveslen = sizeof(fips_curves_default); } else # endif { if (!s->server || s->cert->ecdh_tmp_auto) { *pcurves = eccurves_auto; pcurveslen = sizeof(eccurves_auto); } else { *pcurves = eccurves_all; pcurveslen = sizeof(eccurves_all); } } } } /* We do not allow odd length arrays to enter the system. */ if (pcurveslen & 1) { SSLerr(SSL_F_TLS1_GET_CURVELIST, ERR_R_INTERNAL_ERROR); *num_curves = 0; return 0; } else { *num_curves = pcurveslen / 2; return 1; } } /* Check a curve is one of our preferences */ int tls1_check_curve(SSL *s, const unsigned char *p, size_t len) { const unsigned char *curves; size_t num_curves, i; unsigned int suiteb_flags = tls1_suiteb(s); if (len != 3 || p[0] != NAMED_CURVE_TYPE) return 0; /* Check curve matches Suite B preferences */ if (suiteb_flags) { unsigned long cid = s->s3->tmp.new_cipher->id; if (p[1]) return 0; if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) { if (p[2] != TLSEXT_curve_P_256) return 0; } else if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) { if (p[2] != TLSEXT_curve_P_384) return 0; } else /* Should never happen */ return 0; } if (!tls1_get_curvelist(s, 0, &curves, &num_curves)) return 0; for (i = 0; i < num_curves; i++, curves += 2) { if (p[1] == curves[0] && p[2] == curves[1]) return 1; } return 0; } /*- * Return |nmatch|th shared curve or NID_undef if there is no match. * For nmatch == -1, return number of matches * For nmatch == -2, return the NID of the curve to use for * an EC tmp key, or NID_undef if there is no match. */ int tls1_shared_curve(SSL *s, int nmatch) { const unsigned char *pref, *supp; size_t num_pref, num_supp, i, j; int k; /* Can't do anything on client side */ if (s->server == 0) return -1; if (nmatch == -2) { if (tls1_suiteb(s)) { /* * For Suite B ciphersuite determines curve: we already know * these are acceptable due to previous checks. */ unsigned long cid = s->s3->tmp.new_cipher->id; if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) return NID_X9_62_prime256v1; /* P-256 */ if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) return NID_secp384r1; /* P-384 */ /* Should never happen */ return NID_undef; } /* If not Suite B just return first preference shared curve */ nmatch = 0; } /* * Avoid truncation. tls1_get_curvelist takes an int * but s->options is a long... */ if (!tls1_get_curvelist (s, (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE) != 0, &supp, &num_supp)) /* In practice, NID_undef == 0 but let's be precise. */ return nmatch == -1 ? 0 : NID_undef; if (!tls1_get_curvelist (s, !(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE), &pref, &num_pref)) return nmatch == -1 ? 0 : NID_undef; /* * If the client didn't send the elliptic_curves extension all of them * are allowed. */ if (num_supp == 0 && (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE) != 0) { supp = eccurves_all; num_supp = sizeof(eccurves_all) / 2; } else if (num_pref == 0 && (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) { pref = eccurves_all; num_pref = sizeof(eccurves_all) / 2; } k = 0; for (i = 0; i < num_pref; i++, pref += 2) { const unsigned char *tsupp = supp; for (j = 0; j < num_supp; j++, tsupp += 2) { if (pref[0] == tsupp[0] && pref[1] == tsupp[1]) { if (nmatch == k) { int id = (pref[0] << 8) | pref[1]; return tls1_ec_curve_id2nid(id); } k++; } } } if (nmatch == -1) return k; /* Out of range (nmatch > k). */ return NID_undef; } int tls1_set_curves(unsigned char **pext, size_t *pextlen, int *curves, size_t ncurves) { unsigned char *clist, *p; size_t i; /* * Bitmap of curves included to detect duplicates: only works while curve * ids < 32 */ unsigned long dup_list = 0; # ifdef OPENSSL_NO_EC2M EC_GROUP *curve; # endif clist = OPENSSL_malloc(ncurves * 2); if (!clist) return 0; for (i = 0, p = clist; i < ncurves; i++) { unsigned long idmask; int id; id = tls1_ec_nid2curve_id(curves[i]); # ifdef OPENSSL_FIPS /* NB: 25 is last curve ID supported by FIPS module */ if (FIPS_mode() && id > 25) { OPENSSL_free(clist); return 0; } # endif # ifdef OPENSSL_NO_EC2M curve = EC_GROUP_new_by_curve_name(curves[i]); if (!curve || EC_METHOD_get_field_type(EC_GROUP_method_of(curve)) == NID_X9_62_characteristic_two_field) { if (curve) EC_GROUP_free(curve); OPENSSL_free(clist); return 0; } else EC_GROUP_free(curve); # endif idmask = 1L << id; if (!id || (dup_list & idmask)) { OPENSSL_free(clist); return 0; } dup_list |= idmask; s2n(id, p); } if (*pext) OPENSSL_free(*pext); *pext = clist; *pextlen = ncurves * 2; return 1; } # define MAX_CURVELIST 28 typedef struct { size_t nidcnt; int nid_arr[MAX_CURVELIST]; } nid_cb_st; static int nid_cb(const char *elem, int len, void *arg) { nid_cb_st *narg = arg; size_t i; int nid; char etmp[20]; if (elem == NULL) return 0; if (narg->nidcnt == MAX_CURVELIST) return 0; if (len > (int)(sizeof(etmp) - 1)) return 0; memcpy(etmp, elem, len); etmp[len] = 0; nid = EC_curve_nist2nid(etmp); if (nid == NID_undef) nid = OBJ_sn2nid(etmp); if (nid == NID_undef) nid = OBJ_ln2nid(etmp); if (nid == NID_undef) return 0; for (i = 0; i < narg->nidcnt; i++) if (narg->nid_arr[i] == nid) return 0; narg->nid_arr[narg->nidcnt++] = nid; return 1; } /* Set curves based on a colon separate list */ int tls1_set_curves_list(unsigned char **pext, size_t *pextlen, const char *str) { nid_cb_st ncb; ncb.nidcnt = 0; if (!CONF_parse_list(str, ':', 1, nid_cb, &ncb)) return 0; if (pext == NULL) return 1; return tls1_set_curves(pext, pextlen, ncb.nid_arr, ncb.nidcnt); } /* For an EC key set TLS id and required compression based on parameters */ static int tls1_set_ec_id(unsigned char *curve_id, unsigned char *comp_id, EC_KEY *ec) { int is_prime, id; const EC_GROUP *grp; const EC_METHOD *meth; if (!ec) return 0; /* Determine if it is a prime field */ grp = EC_KEY_get0_group(ec); if (!grp) return 0; meth = EC_GROUP_method_of(grp); if (!meth) return 0; if (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field) is_prime = 1; else is_prime = 0; /* Determine curve ID */ id = EC_GROUP_get_curve_name(grp); id = tls1_ec_nid2curve_id(id); /* If we have an ID set it, otherwise set arbitrary explicit curve */ if (id) { curve_id[0] = 0; curve_id[1] = (unsigned char)id; } else { curve_id[0] = 0xff; if (is_prime) curve_id[1] = 0x01; else curve_id[1] = 0x02; } if (comp_id) { if (EC_KEY_get0_public_key(ec) == NULL) return 0; if (EC_KEY_get_conv_form(ec) == POINT_CONVERSION_COMPRESSED) { if (is_prime) *comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime; else *comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2; } else *comp_id = TLSEXT_ECPOINTFORMAT_uncompressed; } return 1; } /* Check an EC key is compatible with extensions */ static int tls1_check_ec_key(SSL *s, unsigned char *curve_id, unsigned char *comp_id) { const unsigned char *pformats, *pcurves; size_t num_formats, num_curves, i; int j; /* * If point formats extension present check it, otherwise everything is * supported (see RFC4492). */ if (comp_id && s->session->tlsext_ecpointformatlist) { pformats = s->session->tlsext_ecpointformatlist; num_formats = s->session->tlsext_ecpointformatlist_length; for (i = 0; i < num_formats; i++, pformats++) { if (*comp_id == *pformats) break; } if (i == num_formats) return 0; } if (!curve_id) return 1; /* Check curve is consistent with client and server preferences */ for (j = 0; j <= 1; j++) { if (!tls1_get_curvelist(s, j, &pcurves, &num_curves)) return 0; if (j == 1 && num_curves == 0) { /* * If we've not received any curves then skip this check. * RFC 4492 does not require the supported elliptic curves extension * so if it is not sent we can just choose any curve. * It is invalid to send an empty list in the elliptic curves * extension, so num_curves == 0 always means no extension. */ break; } for (i = 0; i < num_curves; i++, pcurves += 2) { if (pcurves[0] == curve_id[0] && pcurves[1] == curve_id[1]) break; } if (i == num_curves) return 0; /* For clients can only check sent curve list */ if (!s->server) return 1; } return 1; } static void tls1_get_formatlist(SSL *s, const unsigned char **pformats, size_t *num_formats) { /* * If we have a custom point format list use it otherwise use default */ if (s->tlsext_ecpointformatlist) { *pformats = s->tlsext_ecpointformatlist; *num_formats = s->tlsext_ecpointformatlist_length; } else { *pformats = ecformats_default; /* For Suite B we don't support char2 fields */ if (tls1_suiteb(s)) *num_formats = sizeof(ecformats_default) - 1; else *num_formats = sizeof(ecformats_default); } } /* * Check cert parameters compatible with extensions: currently just checks EC * certificates have compatible curves and compression. */ static int tls1_check_cert_param(SSL *s, X509 *x, int set_ee_md) { unsigned char comp_id, curve_id[2]; EVP_PKEY *pkey; int rv; pkey = X509_get_pubkey(x); if (!pkey) return 0; /* If not EC nothing to do */ if (pkey->type != EVP_PKEY_EC) { EVP_PKEY_free(pkey); return 1; } rv = tls1_set_ec_id(curve_id, &comp_id, pkey->pkey.ec); EVP_PKEY_free(pkey); if (!rv) return 0; /* * Can't check curve_id for client certs as we don't have a supported * curves extension. */ rv = tls1_check_ec_key(s, s->server ? curve_id : NULL, &comp_id); if (!rv) return 0; /* * Special case for suite B. We *MUST* sign using SHA256+P-256 or * SHA384+P-384, adjust digest if necessary. */ if (set_ee_md && tls1_suiteb(s)) { int check_md; size_t i; CERT *c = s->cert; if (curve_id[0]) return 0; /* Check to see we have necessary signing algorithm */ if (curve_id[1] == TLSEXT_curve_P_256) check_md = NID_ecdsa_with_SHA256; else if (curve_id[1] == TLSEXT_curve_P_384) check_md = NID_ecdsa_with_SHA384; else return 0; /* Should never happen */ for (i = 0; i < c->shared_sigalgslen; i++) if (check_md == c->shared_sigalgs[i].signandhash_nid) break; if (i == c->shared_sigalgslen) return 0; if (set_ee_md == 2) { if (check_md == NID_ecdsa_with_SHA256) c->pkeys[SSL_PKEY_ECC].digest = EVP_sha256(); else c->pkeys[SSL_PKEY_ECC].digest = EVP_sha384(); } } return rv; } # ifndef OPENSSL_NO_ECDH /* Check EC temporary key is compatible with client extensions */ int tls1_check_ec_tmp_key(SSL *s, unsigned long cid) { unsigned char curve_id[2]; EC_KEY *ec = s->cert->ecdh_tmp; # ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL /* Allow any curve: not just those peer supports */ if (s->cert->cert_flags & SSL_CERT_FLAG_BROKEN_PROTOCOL) return 1; # endif /* * If Suite B, AES128 MUST use P-256 and AES256 MUST use P-384, no other * curves permitted. */ if (tls1_suiteb(s)) { /* Curve to check determined by ciphersuite */ if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) curve_id[1] = TLSEXT_curve_P_256; else if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) curve_id[1] = TLSEXT_curve_P_384; else return 0; curve_id[0] = 0; /* Check this curve is acceptable */ if (!tls1_check_ec_key(s, curve_id, NULL)) return 0; /* If auto or setting curve from callback assume OK */ if (s->cert->ecdh_tmp_auto || s->cert->ecdh_tmp_cb) return 1; /* Otherwise check curve is acceptable */ else { unsigned char curve_tmp[2]; if (!ec) return 0; if (!tls1_set_ec_id(curve_tmp, NULL, ec)) return 0; if (!curve_tmp[0] || curve_tmp[1] == curve_id[1]) return 1; return 0; } } if (s->cert->ecdh_tmp_auto) { /* Need a shared curve */ if (tls1_shared_curve(s, 0)) return 1; else return 0; } if (!ec) { if (s->cert->ecdh_tmp_cb) return 1; else return 0; } if (!tls1_set_ec_id(curve_id, NULL, ec)) return 0; /* Set this to allow use of invalid curves for testing */ # if 0 return 1; # else return tls1_check_ec_key(s, curve_id, NULL); # endif } # endif /* OPENSSL_NO_ECDH */ #else static int tls1_check_cert_param(SSL *s, X509 *x, int set_ee_md) { return 1; } #endif /* OPENSSL_NO_EC */ #ifndef OPENSSL_NO_TLSEXT /* * List of supported signature algorithms and hashes. Should make this * customisable at some point, for now include everything we support. */ # ifdef OPENSSL_NO_RSA # define tlsext_sigalg_rsa(md) /* */ # else # define tlsext_sigalg_rsa(md) md, TLSEXT_signature_rsa, # endif # ifdef OPENSSL_NO_DSA # define tlsext_sigalg_dsa(md) /* */ # else # define tlsext_sigalg_dsa(md) md, TLSEXT_signature_dsa, # endif # ifdef OPENSSL_NO_ECDSA # define tlsext_sigalg_ecdsa(md) /* */ # else # define tlsext_sigalg_ecdsa(md) md, TLSEXT_signature_ecdsa, # endif # define tlsext_sigalg(md) \ tlsext_sigalg_rsa(md) \ tlsext_sigalg_dsa(md) \ tlsext_sigalg_ecdsa(md) static unsigned char tls12_sigalgs[] = { # ifndef OPENSSL_NO_SHA512 tlsext_sigalg(TLSEXT_hash_sha512) tlsext_sigalg(TLSEXT_hash_sha384) # endif # ifndef OPENSSL_NO_SHA256 tlsext_sigalg(TLSEXT_hash_sha256) tlsext_sigalg(TLSEXT_hash_sha224) # endif # ifndef OPENSSL_NO_SHA tlsext_sigalg(TLSEXT_hash_sha1) # endif }; # ifndef OPENSSL_NO_ECDSA static unsigned char suiteb_sigalgs[] = { tlsext_sigalg_ecdsa(TLSEXT_hash_sha256) tlsext_sigalg_ecdsa(TLSEXT_hash_sha384) }; # endif size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs) { /* * If Suite B mode use Suite B sigalgs only, ignore any other * preferences. */ # ifndef OPENSSL_NO_EC switch (tls1_suiteb(s)) { case SSL_CERT_FLAG_SUITEB_128_LOS: *psigs = suiteb_sigalgs; return sizeof(suiteb_sigalgs); case SSL_CERT_FLAG_SUITEB_128_LOS_ONLY: *psigs = suiteb_sigalgs; return 2; case SSL_CERT_FLAG_SUITEB_192_LOS: *psigs = suiteb_sigalgs + 2; return 2; } # endif /* If server use client authentication sigalgs if not NULL */ if (s->server == sent && s->cert->client_sigalgs) { *psigs = s->cert->client_sigalgs; return s->cert->client_sigalgslen; } else if (s->cert->conf_sigalgs) { *psigs = s->cert->conf_sigalgs; return s->cert->conf_sigalgslen; } else { *psigs = tls12_sigalgs; return sizeof(tls12_sigalgs); } } /* * Check signature algorithm is consistent with sent supported signature * algorithms and if so return relevant digest. */ int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s, const unsigned char *sig, EVP_PKEY *pkey) { const unsigned char *sent_sigs; size_t sent_sigslen, i; int sigalg = tls12_get_sigid(pkey); /* Should never happen */ if (sigalg == -1) return -1; /* Check key type is consistent with signature */ if (sigalg != (int)sig[1]) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } # ifndef OPENSSL_NO_EC if (pkey->type == EVP_PKEY_EC) { unsigned char curve_id[2], comp_id; /* Check compression and curve matches extensions */ if (!tls1_set_ec_id(curve_id, &comp_id, pkey->pkey.ec)) return 0; if (!s->server && !tls1_check_ec_key(s, curve_id, &comp_id)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_CURVE); return 0; } /* If Suite B only P-384+SHA384 or P-256+SHA-256 allowed */ if (tls1_suiteb(s)) { if (curve_id[0]) return 0; if (curve_id[1] == TLSEXT_curve_P_256) { if (sig[0] != TLSEXT_hash_sha256) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else if (curve_id[1] == TLSEXT_curve_P_384) { if (sig[0] != TLSEXT_hash_sha384) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else return 0; } } else if (tls1_suiteb(s)) return 0; # endif /* Check signature matches a type we sent */ sent_sigslen = tls12_get_psigalgs(s, 1, &sent_sigs); for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) { if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1]) break; } /* Allow fallback to SHA1 if not strict mode */ if (i == sent_sigslen && (sig[0] != TLSEXT_hash_sha1 || s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } *pmd = tls12_get_hash(sig[0]); if (*pmd == NULL) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_UNKNOWN_DIGEST); return 0; } /* * Store the digest used so applications can retrieve it if they wish. */ if (s->session && s->session->sess_cert) s->session->sess_cert->peer_key->digest = *pmd; return 1; } /* * Get a mask of disabled algorithms: an algorithm is disabled if it isn't * supported or doesn't appear in supported signature algorithms. Unlike * ssl_cipher_get_disabled this applies to a specific session and not global * settings. */ void ssl_set_client_disabled(SSL *s) { CERT *c = s->cert; const unsigned char *sigalgs; size_t i, sigalgslen; int have_rsa = 0, have_dsa = 0, have_ecdsa = 0; c->mask_a = 0; c->mask_k = 0; /* Don't allow TLS 1.2 only ciphers if we don't suppport them */ if (!SSL_CLIENT_USE_TLS1_2_CIPHERS(s)) c->mask_ssl = SSL_TLSV1_2; else c->mask_ssl = 0; /* * Now go through all signature algorithms seeing if we support any for * RSA, DSA, ECDSA. Do this for all versions not just TLS 1.2. */ sigalgslen = tls12_get_psigalgs(s, 1, &sigalgs); for (i = 0; i < sigalgslen; i += 2, sigalgs += 2) { switch (sigalgs[1]) { # ifndef OPENSSL_NO_RSA case TLSEXT_signature_rsa: have_rsa = 1; break; # endif # ifndef OPENSSL_NO_DSA case TLSEXT_signature_dsa: have_dsa = 1; break; # endif # ifndef OPENSSL_NO_ECDSA case TLSEXT_signature_ecdsa: have_ecdsa = 1; break; # endif } } /* * Disable auth and static DH if we don't include any appropriate * signature algorithms. */ if (!have_rsa) { c->mask_a |= SSL_aRSA; c->mask_k |= SSL_kDHr | SSL_kECDHr; } if (!have_dsa) { c->mask_a |= SSL_aDSS; c->mask_k |= SSL_kDHd; } if (!have_ecdsa) { c->mask_a |= SSL_aECDSA; c->mask_k |= SSL_kECDHe; } # ifndef OPENSSL_NO_KRB5 if (!kssl_tgt_is_available(s->kssl_ctx)) { c->mask_a |= SSL_aKRB5; c->mask_k |= SSL_kKRB5; } # endif # ifndef OPENSSL_NO_PSK /* with PSK there must be client callback set */ if (!s->psk_client_callback) { c->mask_a |= SSL_aPSK; c->mask_k |= SSL_kPSK; } # endif /* OPENSSL_NO_PSK */ # ifndef OPENSSL_NO_SRP if (!(s->srp_ctx.srp_Mask & SSL_kSRP)) { c->mask_a |= SSL_aSRP; c->mask_k |= SSL_kSRP; } # endif c->valid = 1; } unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit, int *al) { int extdatalen = 0; unsigned char *orig = buf; unsigned char *ret = buf; # ifndef OPENSSL_NO_EC /* See if we support any ECC ciphersuites */ int using_ecc = 0; if (s->version >= TLS1_VERSION || SSL_IS_DTLS(s)) { int i; unsigned long alg_k, alg_a; STACK_OF(SSL_CIPHER) *cipher_stack = SSL_get_ciphers(s); for (i = 0; i < sk_SSL_CIPHER_num(cipher_stack); i++) { SSL_CIPHER *c = sk_SSL_CIPHER_value(cipher_stack, i); alg_k = c->algorithm_mkey; alg_a = c->algorithm_auth; if ((alg_k & (SSL_kEECDH | SSL_kECDHr | SSL_kECDHe) || (alg_a & SSL_aECDSA))) { using_ecc = 1; break; } } } # endif /* don't add extensions for SSLv3 unless doing secure renegotiation */ if (s->client_version == SSL3_VERSION && !s->s3->send_connection_binding) return orig; ret += 2; if (ret >= limit) return NULL; /* this really never occurs, but ... */ if (s->tlsext_hostname != NULL) { /* Add TLS extension servername to the Client Hello message */ size_t size_str; /*- * check for enough space. * 4 for the servername type and entension length * 2 for servernamelist length * 1 for the hostname type * 2 for hostname length * + hostname length */ size_str = strlen(s->tlsext_hostname); if (CHECKLEN(ret, 9 + size_str, limit)) return NULL; /* extension type and length */ s2n(TLSEXT_TYPE_server_name, ret); s2n(size_str + 5, ret); /* length of servername list */ s2n(size_str + 3, ret); /* hostname type, length and hostname */ *(ret++) = (unsigned char)TLSEXT_NAMETYPE_host_name; s2n(size_str, ret); memcpy(ret, s->tlsext_hostname, size_str); ret += size_str; } /* Add RI if renegotiating */ if (s->renegotiate) { int el; if (!ssl_add_clienthello_renegotiate_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } if ((limit - ret - 4 - el) < 0) return NULL; s2n(TLSEXT_TYPE_renegotiate, ret); s2n(el, ret); if (!ssl_add_clienthello_renegotiate_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } # ifndef OPENSSL_NO_SRP /* Add SRP username if there is one */ if (s->srp_ctx.login != NULL) { /* Add TLS extension SRP username to the * Client Hello message */ size_t login_len = strlen(s->srp_ctx.login); if (login_len > 255 || login_len == 0) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 for the srp type type and entension length * 1 for the srp user identity * + srp user identity length */ if (CHECKLEN(ret, 5 + login_len, limit)) return NULL; /* fill in the extension */ s2n(TLSEXT_TYPE_srp, ret); s2n(login_len + 1, ret); (*ret++) = (unsigned char)login_len; memcpy(ret, s->srp_ctx.login, login_len); ret += login_len; } # endif # ifndef OPENSSL_NO_EC if (using_ecc) { /* * Add TLS extension ECPointFormats to the ClientHello message */ const unsigned char *pcurves, *pformats; size_t num_curves, num_formats, curves_list_len; tls1_get_formatlist(s, &pformats, &num_formats); if (num_formats > 255) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the ec point formats type and extension length * 1 byte for the length of the formats * + formats length */ if (CHECKLEN(ret, 5 + num_formats, limit)) return NULL; s2n(TLSEXT_TYPE_ec_point_formats, ret); /* The point format list has 1-byte length. */ s2n(num_formats + 1, ret); *(ret++) = (unsigned char)num_formats; memcpy(ret, pformats, num_formats); ret += num_formats; /* * Add TLS extension EllipticCurves to the ClientHello message */ pcurves = s->tlsext_ellipticcurvelist; if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) return NULL; if (num_curves > 65532 / 2) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } curves_list_len = 2 * num_curves; /*- * check for enough space. * 4 bytes for the ec curves type and extension length * 2 bytes for the curve list length * + curve list length */ if (CHECKLEN(ret, 6 + curves_list_len, limit)) return NULL; s2n(TLSEXT_TYPE_elliptic_curves, ret); s2n(curves_list_len + 2, ret); s2n(curves_list_len, ret); memcpy(ret, pcurves, curves_list_len); ret += curves_list_len; } # endif /* OPENSSL_NO_EC */ if (!(SSL_get_options(s) & SSL_OP_NO_TICKET)) { size_t ticklen; if (!s->new_session && s->session && s->session->tlsext_tick) ticklen = s->session->tlsext_ticklen; else if (s->session && s->tlsext_session_ticket && s->tlsext_session_ticket->data) { ticklen = s->tlsext_session_ticket->length; s->session->tlsext_tick = OPENSSL_malloc(ticklen); if (!s->session->tlsext_tick) return NULL; memcpy(s->session->tlsext_tick, s->tlsext_session_ticket->data, ticklen); s->session->tlsext_ticklen = ticklen; } else ticklen = 0; if (ticklen == 0 && s->tlsext_session_ticket && s->tlsext_session_ticket->data == NULL) goto skip_ext; /* * Check for enough room 2 for extension type, 2 for len rest for * ticket */ if (CHECKLEN(ret, 4 + ticklen, limit)) return NULL; s2n(TLSEXT_TYPE_session_ticket, ret); s2n(ticklen, ret); if (ticklen > 0) { memcpy(ret, s->session->tlsext_tick, ticklen); ret += ticklen; } } skip_ext: if (SSL_CLIENT_USE_SIGALGS(s)) { size_t salglen; const unsigned char *salg; salglen = tls12_get_psigalgs(s, 1, &salg); /*- * check for enough space. * 4 bytes for the sigalgs type and extension length * 2 bytes for the sigalg list length * + sigalg list length */ if (CHECKLEN(ret, salglen + 6, limit)) return NULL; s2n(TLSEXT_TYPE_signature_algorithms, ret); s2n(salglen + 2, ret); s2n(salglen, ret); memcpy(ret, salg, salglen); ret += salglen; } # ifdef TLSEXT_TYPE_opaque_prf_input if (s->s3->client_opaque_prf_input != NULL) { size_t col = s->s3->client_opaque_prf_input_len; if ((long)(limit - ret - 6 - col < 0)) return NULL; if (col > 0xFFFD) /* can't happen */ return NULL; s2n(TLSEXT_TYPE_opaque_prf_input, ret); s2n(col + 2, ret); s2n(col, ret); memcpy(ret, s->s3->client_opaque_prf_input, col); ret += col; } # endif if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) { int i; size_t extlen, idlen; int lentmp; OCSP_RESPID *id; idlen = 0; for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); lentmp = i2d_OCSP_RESPID(id, NULL); if (lentmp <= 0) return NULL; idlen += (size_t)lentmp + 2; } if (s->tlsext_ocsp_exts) { lentmp = i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, NULL); if (lentmp < 0) return NULL; extlen = (size_t)lentmp; } else extlen = 0; if (extlen + idlen > 0xFFF0) return NULL; /* * 2 bytes for status request type * 2 bytes for status request len * 1 byte for OCSP request type * 2 bytes for length of ids * 2 bytes for length of extensions * + length of ids * + length of extensions */ if (CHECKLEN(ret, 9 + idlen + extlen, limit)) return NULL; s2n(TLSEXT_TYPE_status_request, ret); s2n(extlen + idlen + 5, ret); *(ret++) = TLSEXT_STATUSTYPE_ocsp; s2n(idlen, ret); for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { /* save position of id len */ unsigned char *q = ret; id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); /* skip over id len */ ret += 2; lentmp = i2d_OCSP_RESPID(id, &ret); /* write id len */ s2n(lentmp, q); } s2n(extlen, ret); if (extlen > 0) i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &ret); } # ifndef OPENSSL_NO_HEARTBEATS /* Add Heartbeat extension */ /*- * check for enough space. * 4 bytes for the heartbeat ext type and extension length * 1 byte for the mode */ if (CHECKLEN(ret, 5, limit)) return NULL; s2n(TLSEXT_TYPE_heartbeat, ret); s2n(1, ret); /*- * Set mode: * 1: peer may send requests * 2: peer not allowed to send requests */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS) *(ret++) = SSL_TLSEXT_HB_DONT_SEND_REQUESTS; else *(ret++) = SSL_TLSEXT_HB_ENABLED; # endif # ifndef OPENSSL_NO_NEXTPROTONEG if (s->ctx->next_proto_select_cb && !s->s3->tmp.finish_md_len) { /* * The client advertises an emtpy extension to indicate its support * for Next Protocol Negotiation */ /*- * check for enough space. * 4 bytes for the NPN ext type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_next_proto_neg, ret); s2n(0, ret); } # endif if (s->alpn_client_proto_list && !s->s3->tmp.finish_md_len) { /*- * check for enough space. * 4 bytes for the ALPN type and extension length * 2 bytes for the ALPN protocol list length * + ALPN protocol list length */ if (CHECKLEN(ret, 6 + s->alpn_client_proto_list_len, limit)) return NULL; s2n(TLSEXT_TYPE_application_layer_protocol_negotiation, ret); s2n(2 + s->alpn_client_proto_list_len, ret); s2n(s->alpn_client_proto_list_len, ret); memcpy(ret, s->alpn_client_proto_list, s->alpn_client_proto_list_len); ret += s->alpn_client_proto_list_len; s->cert->alpn_sent = 1; } # ifndef OPENSSL_NO_SRTP if (SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s)) { int el; ssl_add_clienthello_use_srtp_ext(s, 0, &el, 0); /*- * check for enough space. * 4 bytes for the SRTP type and extension length * + SRTP profiles length */ if (CHECKLEN(ret, 4 + el, limit)) return NULL; s2n(TLSEXT_TYPE_use_srtp, ret); s2n(el, ret); if (ssl_add_clienthello_use_srtp_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } # endif custom_ext_init(&s->cert->cli_ext); /* Add custom TLS Extensions to ClientHello */ if (!custom_ext_add(s, 0, &ret, limit, al)) return NULL; /* * Add padding to workaround bugs in F5 terminators. See * https://tools.ietf.org/html/draft-agl-tls-padding-03 NB: because this * code works out the length of all existing extensions it MUST always * appear last. */ if (s->options & SSL_OP_TLSEXT_PADDING) { int hlen = ret - (unsigned char *)s->init_buf->data; /* * The code in s23_clnt.c to build ClientHello messages includes the * 5-byte record header in the buffer, while the code in s3_clnt.c * does not. */ if (s->state == SSL23_ST_CW_CLNT_HELLO_A) hlen -= 5; if (hlen > 0xff && hlen < 0x200) { hlen = 0x200 - hlen; if (hlen >= 4) hlen -= 4; else hlen = 0; /*- * check for enough space. Strictly speaking we know we've already * got enough space because to get here the message size is < 0x200, * but we know that we've allocated far more than that in the buffer * - but for consistency and robustness we're going to check anyway. * * 4 bytes for the padding type and extension length * + padding length */ if (CHECKLEN(ret, 4 + hlen, limit)) return NULL; s2n(TLSEXT_TYPE_padding, ret); s2n(hlen, ret); memset(ret, 0, hlen); ret += hlen; } } if ((extdatalen = ret - orig - 2) == 0) return orig; s2n(extdatalen, orig); return ret; } unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit, int *al) { int extdatalen = 0; unsigned char *orig = buf; unsigned char *ret = buf; # ifndef OPENSSL_NO_NEXTPROTONEG int next_proto_neg_seen; # endif # ifndef OPENSSL_NO_EC unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey; unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth; int using_ecc = (alg_k & (SSL_kEECDH | SSL_kECDHr | SSL_kECDHe)) || (alg_a & SSL_aECDSA); using_ecc = using_ecc && (s->session->tlsext_ecpointformatlist != NULL); # endif /* * don't add extensions for SSLv3, unless doing secure renegotiation */ if (s->version == SSL3_VERSION && !s->s3->send_connection_binding) return orig; ret += 2; if (ret >= limit) return NULL; /* this really never occurs, but ... */ if (!s->hit && s->servername_done == 1 && s->session->tlsext_hostname != NULL) { if ((long)(limit - ret - 4) < 0) return NULL; s2n(TLSEXT_TYPE_server_name, ret); s2n(0, ret); } if (s->s3->send_connection_binding) { int el; if (!ssl_add_serverhello_renegotiate_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the reneg type and extension length * + reneg data length */ if (CHECKLEN(ret, 4 + el, limit)) return NULL; s2n(TLSEXT_TYPE_renegotiate, ret); s2n(el, ret); if (!ssl_add_serverhello_renegotiate_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } # ifndef OPENSSL_NO_EC if (using_ecc) { const unsigned char *plist; size_t plistlen; /* * Add TLS extension ECPointFormats to the ServerHello message */ tls1_get_formatlist(s, &plist, &plistlen); if (plistlen > 255) { SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the ec points format type and extension length * 1 byte for the points format list length * + length of points format list */ if (CHECKLEN(ret, 5 + plistlen, limit)) return NULL; s2n(TLSEXT_TYPE_ec_point_formats, ret); s2n(plistlen + 1, ret); *(ret++) = (unsigned char)plistlen; memcpy(ret, plist, plistlen); ret += plistlen; } /* * Currently the server should not respond with a SupportedCurves * extension */ # endif /* OPENSSL_NO_EC */ if (s->tlsext_ticket_expected && !(SSL_get_options(s) & SSL_OP_NO_TICKET)) { /*- * check for enough space. * 4 bytes for the Ticket type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_session_ticket, ret); s2n(0, ret); } else { /* if we don't add the above TLSEXT, we can't add a session ticket later */ s->tlsext_ticket_expected = 0; } if (s->tlsext_status_expected) { /*- * check for enough space. * 4 bytes for the Status request type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_status_request, ret); s2n(0, ret); } # ifdef TLSEXT_TYPE_opaque_prf_input if (s->s3->server_opaque_prf_input != NULL) { size_t sol = s->s3->server_opaque_prf_input_len; if ((long)(limit - ret - 6 - sol) < 0) return NULL; if (sol > 0xFFFD) /* can't happen */ return NULL; s2n(TLSEXT_TYPE_opaque_prf_input, ret); s2n(sol + 2, ret); s2n(sol, ret); memcpy(ret, s->s3->server_opaque_prf_input, sol); ret += sol; } # endif # ifndef OPENSSL_NO_SRTP if (SSL_IS_DTLS(s) && s->srtp_profile) { int el; ssl_add_serverhello_use_srtp_ext(s, 0, &el, 0); /*- * check for enough space. * 4 bytes for the SRTP profiles type and extension length * + length of the SRTP profiles list */ if (CHECKLEN(ret, 4 + el, limit)) return NULL; s2n(TLSEXT_TYPE_use_srtp, ret); s2n(el, ret); if (ssl_add_serverhello_use_srtp_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } # endif if (((s->s3->tmp.new_cipher->id & 0xFFFF) == 0x80 || (s->s3->tmp.new_cipher->id & 0xFFFF) == 0x81) && (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG)) { const unsigned char cryptopro_ext[36] = { 0xfd, 0xe8, /* 65000 */ 0x00, 0x20, /* 32 bytes length */ 0x30, 0x1e, 0x30, 0x08, 0x06, 0x06, 0x2a, 0x85, 0x03, 0x02, 0x02, 0x09, 0x30, 0x08, 0x06, 0x06, 0x2a, 0x85, 0x03, 0x02, 0x02, 0x16, 0x30, 0x08, 0x06, 0x06, 0x2a, 0x85, 0x03, 0x02, 0x02, 0x17 }; /* check for enough space. */ if (CHECKLEN(ret, sizeof(cryptopro_ext), limit)) return NULL; memcpy(ret, cryptopro_ext, sizeof(cryptopro_ext)); ret += sizeof(cryptopro_ext); } # ifndef OPENSSL_NO_HEARTBEATS /* Add Heartbeat extension if we've received one */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) { /*- * check for enough space. * 4 bytes for the Heartbeat type and extension length * 1 byte for the mode */ if (CHECKLEN(ret, 5, limit)) return NULL; s2n(TLSEXT_TYPE_heartbeat, ret); s2n(1, ret); /*- * Set mode: * 1: peer may send requests * 2: peer not allowed to send requests */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS) *(ret++) = SSL_TLSEXT_HB_DONT_SEND_REQUESTS; else *(ret++) = SSL_TLSEXT_HB_ENABLED; } # endif # ifndef OPENSSL_NO_NEXTPROTONEG next_proto_neg_seen = s->s3->next_proto_neg_seen; s->s3->next_proto_neg_seen = 0; if (next_proto_neg_seen && s->ctx->next_protos_advertised_cb) { const unsigned char *npa; unsigned int npalen; int r; r = s->ctx->next_protos_advertised_cb(s, &npa, &npalen, s-> ctx->next_protos_advertised_cb_arg); if (r == SSL_TLSEXT_ERR_OK) { /*- * check for enough space. * 4 bytes for the NPN type and extension length * + length of protocols list */ if (CHECKLEN(ret, 4 + npalen, limit)) return NULL; s2n(TLSEXT_TYPE_next_proto_neg, ret); s2n(npalen, ret); memcpy(ret, npa, npalen); ret += npalen; s->s3->next_proto_neg_seen = 1; } } # endif if (!custom_ext_add(s, 1, &ret, limit, al)) return NULL; if (s->s3->alpn_selected) { const unsigned char *selected = s->s3->alpn_selected; size_t len = s->s3->alpn_selected_len; /*- * check for enough space. * 4 bytes for the ALPN type and extension length * 2 bytes for ALPN data length * 1 byte for selected protocol length * + length of the selected protocol */ if (CHECKLEN(ret, 7 + len, limit)) return NULL; s2n(TLSEXT_TYPE_application_layer_protocol_negotiation, ret); s2n(3 + len, ret); s2n(1 + len, ret); - *ret++ = len; + *ret++ = (unsigned char)len; memcpy(ret, selected, len); ret += len; } if ((extdatalen = ret - orig - 2) == 0) return orig; s2n(extdatalen, orig); return ret; } # ifndef OPENSSL_NO_EC /*- * ssl_check_for_safari attempts to fingerprint Safari using OS X * SecureTransport using the TLS extension block in |d|, of length |n|. * Safari, since 10.6, sends exactly these extensions, in this order: * SNI, * elliptic_curves * ec_point_formats * * We wish to fingerprint Safari because they broke ECDHE-ECDSA support in 10.8, * but they advertise support. So enabling ECDHE-ECDSA ciphers breaks them. * Sadly we cannot differentiate 10.6, 10.7 and 10.8.4 (which work), from * 10.8..10.8.3 (which don't work). */ static void ssl_check_for_safari(SSL *s, const unsigned char *data, const unsigned char *limit) { unsigned short type, size; static const unsigned char kSafariExtensionsBlock[] = { 0x00, 0x0a, /* elliptic_curves extension */ 0x00, 0x08, /* 8 bytes */ 0x00, 0x06, /* 6 bytes of curve ids */ 0x00, 0x17, /* P-256 */ 0x00, 0x18, /* P-384 */ 0x00, 0x19, /* P-521 */ 0x00, 0x0b, /* ec_point_formats */ 0x00, 0x02, /* 2 bytes */ 0x01, /* 1 point format */ 0x00, /* uncompressed */ }; /* The following is only present in TLS 1.2 */ static const unsigned char kSafariTLS12ExtensionsBlock[] = { 0x00, 0x0d, /* signature_algorithms */ 0x00, 0x0c, /* 12 bytes */ 0x00, 0x0a, /* 10 bytes */ 0x05, 0x01, /* SHA-384/RSA */ 0x04, 0x01, /* SHA-256/RSA */ 0x02, 0x01, /* SHA-1/RSA */ 0x04, 0x03, /* SHA-256/ECDSA */ 0x02, 0x03, /* SHA-1/ECDSA */ }; if (limit - data <= 2) return; data += 2; if (limit - data < 4) return; n2s(data, type); n2s(data, size); if (type != TLSEXT_TYPE_server_name) return; if (limit - data < size) return; data += size; if (TLS1_get_client_version(s) >= TLS1_2_VERSION) { const size_t len1 = sizeof(kSafariExtensionsBlock); const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); if (limit - data != (int)(len1 + len2)) return; if (memcmp(data, kSafariExtensionsBlock, len1) != 0) return; if (memcmp(data + len1, kSafariTLS12ExtensionsBlock, len2) != 0) return; } else { const size_t len = sizeof(kSafariExtensionsBlock); if (limit - data != (int)(len)) return; if (memcmp(data, kSafariExtensionsBlock, len) != 0) return; } s->s3->is_probably_safari = 1; } # endif /* !OPENSSL_NO_EC */ /* * tls1_alpn_handle_client_hello is called to save the ALPN extension in a * ClientHello. data: the contents of the extension, not including the type * and length. data_len: the number of bytes in |data| al: a pointer to the * alert value to send in the event of a non-zero return. returns: 0 on * success. */ static int tls1_alpn_handle_client_hello(SSL *s, const unsigned char *data, unsigned data_len, int *al) { unsigned i; unsigned proto_len; if (data_len < 2) goto parse_error; /* * data should contain a uint16 length followed by a series of 8-bit, * length-prefixed strings. */ i = ((unsigned)data[0]) << 8 | ((unsigned)data[1]); data_len -= 2; data += 2; if (data_len != i) goto parse_error; if (data_len < 2) goto parse_error; for (i = 0; i < data_len;) { proto_len = data[i]; i++; if (proto_len == 0) goto parse_error; if (i + proto_len < i || i + proto_len > data_len) goto parse_error; i += proto_len; } if (s->cert->alpn_proposed != NULL) OPENSSL_free(s->cert->alpn_proposed); s->cert->alpn_proposed = OPENSSL_malloc(data_len); if (s->cert->alpn_proposed == NULL) { *al = SSL_AD_INTERNAL_ERROR; return -1; } memcpy(s->cert->alpn_proposed, data, data_len); s->cert->alpn_proposed_len = data_len; return 0; parse_error: *al = SSL_AD_DECODE_ERROR; return -1; } /* * Process the ALPN extension in a ClientHello. * al: a pointer to the alert value to send in the event of a failure. * returns 1 on success, 0 on failure: al set only on failure */ static int tls1_alpn_handle_client_hello_late(SSL *s, int *al) { const unsigned char *selected = NULL; unsigned char selected_len = 0; if (s->ctx->alpn_select_cb != NULL && s->cert->alpn_proposed != NULL) { int r = s->ctx->alpn_select_cb(s, &selected, &selected_len, s->cert->alpn_proposed, s->cert->alpn_proposed_len, s->ctx->alpn_select_cb_arg); if (r == SSL_TLSEXT_ERR_OK) { OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = OPENSSL_malloc(selected_len); if (s->s3->alpn_selected == NULL) { *al = SSL_AD_INTERNAL_ERROR; return 0; } memcpy(s->s3->alpn_selected, selected, selected_len); s->s3->alpn_selected_len = selected_len; # ifndef OPENSSL_NO_NEXTPROTONEG /* ALPN takes precedence over NPN. */ s->s3->next_proto_neg_seen = 0; # endif } } return 1; } static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *limit, int *al) { unsigned short type; unsigned short size; unsigned short len; unsigned char *data = *p; int renegotiate_seen = 0; s->servername_done = 0; s->tlsext_status_type = -1; # ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; # endif if (s->s3->alpn_selected) { OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = NULL; } s->s3->alpn_selected_len = 0; if (s->cert->alpn_proposed) { OPENSSL_free(s->cert->alpn_proposed); s->cert->alpn_proposed = NULL; } s->cert->alpn_proposed_len = 0; # ifndef OPENSSL_NO_HEARTBEATS s->tlsext_heartbeat &= ~(SSL_TLSEXT_HB_ENABLED | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); # endif # ifndef OPENSSL_NO_EC if (s->options & SSL_OP_SAFARI_ECDHE_ECDSA_BUG) ssl_check_for_safari(s, data, limit); # endif /* !OPENSSL_NO_EC */ /* Clear any signature algorithms extension received */ if (s->cert->peer_sigalgs) { OPENSSL_free(s->cert->peer_sigalgs); s->cert->peer_sigalgs = NULL; } # ifndef OPENSSL_NO_SRP if (s->srp_ctx.login != NULL) { OPENSSL_free(s->srp_ctx.login); s->srp_ctx.login = NULL; } # endif s->srtp_profile = NULL; if (data == limit) goto ri_check; if (limit - data < 2) goto err; n2s(data, len); if (limit - data != len) goto err; while (limit - data >= 4) { n2s(data, type); n2s(data, size); if (limit - data < size) goto err; # if 0 fprintf(stderr, "Received extension type %d size %d\n", type, size); # endif if (s->tlsext_debug_cb) s->tlsext_debug_cb(s, 0, type, data, size, s->tlsext_debug_arg); /*- * The servername extension is treated as follows: * * - Only the hostname type is supported with a maximum length of 255. * - The servername is rejected if too long or if it contains zeros, * in which case an fatal alert is generated. * - The servername field is maintained together with the session cache. * - When a session is resumed, the servername call back invoked in order * to allow the application to position itself to the right context. * - The servername is acknowledged if it is new for a session or when * it is identical to a previously used for the same session. * Applications can control the behaviour. They can at any time * set a 'desirable' servername for a new SSL object. This can be the * case for example with HTTPS when a Host: header field is received and * a renegotiation is requested. In this case, a possible servername * presented in the new client hello is only acknowledged if it matches * the value of the Host: field. * - Applications must use SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION * if they provide for changing an explicit servername context for the * session, i.e. when the session has been established with a servername * extension. * - On session reconnect, the servername extension may be absent. * */ if (type == TLSEXT_TYPE_server_name) { unsigned char *sdata; int servname_type; int dsize; if (size < 2) goto err; n2s(data, dsize); size -= 2; if (dsize > size) goto err; sdata = data; while (dsize > 3) { servname_type = *(sdata++); n2s(sdata, len); dsize -= 3; if (len > dsize) goto err; if (s->servername_done == 0) switch (servname_type) { case TLSEXT_NAMETYPE_host_name: if (!s->hit) { if (s->session->tlsext_hostname) goto err; if (len > TLSEXT_MAXLEN_host_name) { *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } if ((s->session->tlsext_hostname = OPENSSL_malloc(len + 1)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->session->tlsext_hostname, sdata, len); s->session->tlsext_hostname[len] = '\0'; if (strlen(s->session->tlsext_hostname) != len) { OPENSSL_free(s->session->tlsext_hostname); s->session->tlsext_hostname = NULL; *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } s->servername_done = 1; } else s->servername_done = s->session->tlsext_hostname && strlen(s->session->tlsext_hostname) == len && strncmp(s->session->tlsext_hostname, (char *)sdata, len) == 0; break; default: break; } dsize -= len; } if (dsize != 0) goto err; } # ifndef OPENSSL_NO_SRP else if (type == TLSEXT_TYPE_srp) { if (size == 0 || ((len = data[0])) != (size - 1)) goto err; if (s->srp_ctx.login != NULL) goto err; if ((s->srp_ctx.login = OPENSSL_malloc(len + 1)) == NULL) return -1; memcpy(s->srp_ctx.login, &data[1], len); s->srp_ctx.login[len] = '\0'; if (strlen(s->srp_ctx.login) != len) goto err; } # endif # ifndef OPENSSL_NO_EC else if (type == TLSEXT_TYPE_ec_point_formats) { unsigned char *sdata = data; int ecpointformatlist_length = *(sdata++); if (ecpointformatlist_length != size - 1 || ecpointformatlist_length < 1) goto err; if (!s->hit) { if (s->session->tlsext_ecpointformatlist) { OPENSSL_free(s->session->tlsext_ecpointformatlist); s->session->tlsext_ecpointformatlist = NULL; } s->session->tlsext_ecpointformatlist_length = 0; if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length; memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length); } # if 0 fprintf(stderr, "ssl_parse_clienthello_tlsext s->session->tlsext_ecpointformatlist (length=%i) ", s->session->tlsext_ecpointformatlist_length); sdata = s->session->tlsext_ecpointformatlist; for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++) fprintf(stderr, "%i ", *(sdata++)); fprintf(stderr, "\n"); # endif } else if (type == TLSEXT_TYPE_elliptic_curves) { unsigned char *sdata = data; int ellipticcurvelist_length = (*(sdata++) << 8); ellipticcurvelist_length += (*(sdata++)); if (ellipticcurvelist_length != size - 2 || ellipticcurvelist_length < 1 || /* Each NamedCurve is 2 bytes. */ ellipticcurvelist_length & 1) goto err; if (!s->hit) { if (s->session->tlsext_ellipticcurvelist) goto err; s->session->tlsext_ellipticcurvelist_length = 0; if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length; memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length); } # if 0 fprintf(stderr, "ssl_parse_clienthello_tlsext s->session->tlsext_ellipticcurvelist (length=%i) ", s->session->tlsext_ellipticcurvelist_length); sdata = s->session->tlsext_ellipticcurvelist; for (i = 0; i < s->session->tlsext_ellipticcurvelist_length; i++) fprintf(stderr, "%i ", *(sdata++)); fprintf(stderr, "\n"); # endif } # endif /* OPENSSL_NO_EC */ # ifdef TLSEXT_TYPE_opaque_prf_input else if (type == TLSEXT_TYPE_opaque_prf_input) { unsigned char *sdata = data; if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(sdata, s->s3->client_opaque_prf_input_len); if (s->s3->client_opaque_prf_input_len != size - 2) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->s3->client_opaque_prf_input != NULL) { /* shouldn't really happen */ OPENSSL_free(s->s3->client_opaque_prf_input); } /* dummy byte just to get non-NULL */ if (s->s3->client_opaque_prf_input_len == 0) s->s3->client_opaque_prf_input = OPENSSL_malloc(1); else s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); if (s->s3->client_opaque_prf_input == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } # endif else if (type == TLSEXT_TYPE_session_ticket) { if (s->tls_session_ticket_ext_cb && !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg)) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } else if (type == TLSEXT_TYPE_renegotiate) { if (!ssl_parse_clienthello_renegotiate_ext(s, data, size, al)) return 0; renegotiate_seen = 1; } else if (type == TLSEXT_TYPE_signature_algorithms) { int dsize; if (s->cert->peer_sigalgs || size < 2) goto err; n2s(data, dsize); size -= 2; if (dsize != size || dsize & 1 || !dsize) goto err; if (!tls1_save_sigalgs(s, data, dsize)) goto err; } else if (type == TLSEXT_TYPE_status_request) { if (size < 5) goto err; s->tlsext_status_type = *data++; size--; if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) { const unsigned char *sdata; int dsize; /* Read in responder_id_list */ n2s(data, dsize); size -= 2; if (dsize > size) goto err; /* * We remove any OCSP_RESPIDs from a previous handshake * to prevent unbounded memory growth - CVE-2016-6304 */ sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); if (dsize > 0) { s->tlsext_ocsp_ids = sk_OCSP_RESPID_new_null(); if (s->tlsext_ocsp_ids == NULL) { *al = SSL_AD_INTERNAL_ERROR; return 0; } } else { s->tlsext_ocsp_ids = NULL; } while (dsize > 0) { OCSP_RESPID *id; int idsize; if (dsize < 4) goto err; n2s(data, idsize); dsize -= 2 + idsize; size -= 2 + idsize; if (dsize < 0) goto err; sdata = data; data += idsize; id = d2i_OCSP_RESPID(NULL, &sdata, idsize); if (!id) goto err; if (data != sdata) { OCSP_RESPID_free(id); goto err; } if (!sk_OCSP_RESPID_push(s->tlsext_ocsp_ids, id)) { OCSP_RESPID_free(id); *al = SSL_AD_INTERNAL_ERROR; return 0; } } /* Read in request_extensions */ if (size < 2) goto err; n2s(data, dsize); size -= 2; if (dsize != size) goto err; sdata = data; if (dsize > 0) { if (s->tlsext_ocsp_exts) { sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, X509_EXTENSION_free); } s->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL, &sdata, dsize); if (!s->tlsext_ocsp_exts || (data + dsize != sdata)) goto err; } } /* * We don't know what to do with any other type * so ignore it. */ else s->tlsext_status_type = -1; } # ifndef OPENSSL_NO_HEARTBEATS else if (type == TLSEXT_TYPE_heartbeat) { switch (data[0]) { case 0x01: /* Client allows us to send HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; break; case 0x02: /* Client doesn't accept HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_SEND_REQUESTS; break; default: *al = SSL_AD_ILLEGAL_PARAMETER; return 0; } } # endif # ifndef OPENSSL_NO_NEXTPROTONEG else if (type == TLSEXT_TYPE_next_proto_neg && s->s3->tmp.finish_md_len == 0) { /*- * We shouldn't accept this extension on a * renegotiation. * * s->new_session will be set on renegotiation, but we * probably shouldn't rely that it couldn't be set on * the initial renegotation too in certain cases (when * there's some other reason to disallow resuming an * earlier session -- the current code won't be doing * anything like that, but this might change). * * A valid sign that there's been a previous handshake * in this connection is if s->s3->tmp.finish_md_len > * 0. (We are talking about a check that will happen * in the Hello protocol round, well before a new * Finished message could have been computed.) */ s->s3->next_proto_neg_seen = 1; } # endif else if (type == TLSEXT_TYPE_application_layer_protocol_negotiation && s->s3->tmp.finish_md_len == 0) { if (tls1_alpn_handle_client_hello(s, data, size, al) != 0) return 0; } /* session ticket processed earlier */ # ifndef OPENSSL_NO_SRTP else if (SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s) && type == TLSEXT_TYPE_use_srtp) { if (ssl_parse_clienthello_use_srtp_ext(s, data, size, al)) return 0; } # endif data += size; } /* Spurious data on the end */ if (data != limit) goto err; *p = data; ri_check: /* Need RI if renegotiating */ if (!renegotiate_seen && s->renegotiate && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { *al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); return 0; } return 1; err: *al = SSL_AD_DECODE_ERROR; return 0; } /* * Parse any custom extensions found. "data" is the start of the extension data * and "limit" is the end of the record. TODO: add strict syntax checking. */ static int ssl_scan_clienthello_custom_tlsext(SSL *s, const unsigned char *data, const unsigned char *limit, int *al) { unsigned short type, size, len; /* If resumed session or no custom extensions nothing to do */ if (s->hit || s->cert->srv_ext.meths_count == 0) return 1; if (limit - data <= 2) return 1; n2s(data, len); if (limit - data < len) return 1; while (limit - data >= 4) { n2s(data, type); n2s(data, size); if (limit - data < size) return 1; if (custom_ext_parse(s, 1 /* server */ , type, data, size, al) <= 0) return 0; data += size; } return 1; } int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *limit) { int al = -1; unsigned char *ptmp = *p; /* * Internally supported extensions are parsed first so SNI can be handled * before custom extensions. An application processing SNI will typically * switch the parent context using SSL_set_SSL_CTX and custom extensions * need to be handled by the new SSL_CTX structure. */ if (ssl_scan_clienthello_tlsext(s, p, limit, &al) <= 0) { ssl3_send_alert(s, SSL3_AL_FATAL, al); return 0; } if (ssl_check_clienthello_tlsext_early(s) <= 0) { SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT, SSL_R_CLIENTHELLO_TLSEXT); return 0; } custom_ext_init(&s->cert->srv_ext); if (ssl_scan_clienthello_custom_tlsext(s, ptmp, limit, &al) <= 0) { ssl3_send_alert(s, SSL3_AL_FATAL, al); return 0; } return 1; } # ifndef OPENSSL_NO_NEXTPROTONEG /* * ssl_next_proto_validate validates a Next Protocol Negotiation block. No * elements of zero length are allowed and the set of elements must exactly * fill the length of the block. */ static char ssl_next_proto_validate(unsigned char *d, unsigned len) { unsigned int off = 0; while (off < len) { if (d[off] == 0) return 0; off += d[off]; off++; } return off == len; } # endif static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) { unsigned short length; unsigned short type; unsigned short size; unsigned char *data = *p; int tlsext_servername = 0; int renegotiate_seen = 0; # ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; # endif s->tlsext_ticket_expected = 0; if (s->s3->alpn_selected) { OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = NULL; } # ifndef OPENSSL_NO_HEARTBEATS s->tlsext_heartbeat &= ~(SSL_TLSEXT_HB_ENABLED | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); # endif if ((d + n) - data <= 2) goto ri_check; n2s(data, length); if ((d + n) - data != length) { *al = SSL_AD_DECODE_ERROR; return 0; } while ((d + n) - data >= 4) { n2s(data, type); n2s(data, size); if ((d + n) - data < size) goto ri_check; if (s->tlsext_debug_cb) s->tlsext_debug_cb(s, 1, type, data, size, s->tlsext_debug_arg); if (type == TLSEXT_TYPE_server_name) { if (s->tlsext_hostname == NULL || size > 0) { *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } tlsext_servername = 1; } # ifndef OPENSSL_NO_EC else if (type == TLSEXT_TYPE_ec_point_formats) { unsigned char *sdata = data; int ecpointformatlist_length = *(sdata++); if (ecpointformatlist_length != size - 1) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (!s->hit) { s->session->tlsext_ecpointformatlist_length = 0; if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist); if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length; memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length); } # if 0 fprintf(stderr, "ssl_parse_serverhello_tlsext s->session->tlsext_ecpointformatlist "); sdata = s->session->tlsext_ecpointformatlist; for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++) fprintf(stderr, "%i ", *(sdata++)); fprintf(stderr, "\n"); # endif } # endif /* OPENSSL_NO_EC */ else if (type == TLSEXT_TYPE_session_ticket) { if (s->tls_session_ticket_ext_cb && !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg)) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } if ((SSL_get_options(s) & SSL_OP_NO_TICKET) || (size > 0)) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } s->tlsext_ticket_expected = 1; } # ifdef TLSEXT_TYPE_opaque_prf_input else if (type == TLSEXT_TYPE_opaque_prf_input) { unsigned char *sdata = data; if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(sdata, s->s3->server_opaque_prf_input_len); if (s->s3->server_opaque_prf_input_len != size - 2) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->s3->server_opaque_prf_input != NULL) { /* shouldn't really happen */ OPENSSL_free(s->s3->server_opaque_prf_input); } if (s->s3->server_opaque_prf_input_len == 0) { /* dummy byte just to get non-NULL */ s->s3->server_opaque_prf_input = OPENSSL_malloc(1); } else { s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); } if (s->s3->server_opaque_prf_input == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } # endif else if (type == TLSEXT_TYPE_status_request) { /* * MUST be empty and only sent if we've requested a status * request message. */ if ((s->tlsext_status_type == -1) || (size > 0)) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } /* Set flag to expect CertificateStatus message */ s->tlsext_status_expected = 1; } # ifndef OPENSSL_NO_NEXTPROTONEG else if (type == TLSEXT_TYPE_next_proto_neg && s->s3->tmp.finish_md_len == 0) { unsigned char *selected; unsigned char selected_len; /* We must have requested it. */ if (s->ctx->next_proto_select_cb == NULL) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } /* The data must be valid */ if (!ssl_next_proto_validate(data, size)) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (s-> ctx->next_proto_select_cb(s, &selected, &selected_len, data, size, s->ctx->next_proto_select_cb_arg) != SSL_TLSEXT_ERR_OK) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } /* * Could be non-NULL if server has sent multiple NPN extensions in * a single Serverhello */ OPENSSL_free(s->next_proto_negotiated); s->next_proto_negotiated = OPENSSL_malloc(selected_len); if (!s->next_proto_negotiated) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->next_proto_negotiated, selected, selected_len); s->next_proto_negotiated_len = selected_len; s->s3->next_proto_neg_seen = 1; } # endif else if (type == TLSEXT_TYPE_application_layer_protocol_negotiation) { unsigned len; /* We must have requested it. */ if (!s->cert->alpn_sent) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } if (size < 4) { *al = TLS1_AD_DECODE_ERROR; return 0; } /*- * The extension data consists of: * uint16 list_length * uint8 proto_length; * uint8 proto[proto_length]; */ len = data[0]; len <<= 8; len |= data[1]; if (len != (unsigned)size - 2) { *al = TLS1_AD_DECODE_ERROR; return 0; } len = data[2]; if (len != (unsigned)size - 3) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (s->s3->alpn_selected) OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = OPENSSL_malloc(len); if (!s->s3->alpn_selected) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->s3->alpn_selected, data + 3, len); s->s3->alpn_selected_len = len; } else if (type == TLSEXT_TYPE_renegotiate) { if (!ssl_parse_serverhello_renegotiate_ext(s, data, size, al)) return 0; renegotiate_seen = 1; } # ifndef OPENSSL_NO_HEARTBEATS else if (type == TLSEXT_TYPE_heartbeat) { switch (data[0]) { case 0x01: /* Server allows us to send HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; break; case 0x02: /* Server doesn't accept HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_SEND_REQUESTS; break; default: *al = SSL_AD_ILLEGAL_PARAMETER; return 0; } } # endif # ifndef OPENSSL_NO_SRTP else if (SSL_IS_DTLS(s) && type == TLSEXT_TYPE_use_srtp) { if (ssl_parse_serverhello_use_srtp_ext(s, data, size, al)) return 0; } # endif /* * If this extension type was not otherwise handled, but matches a * custom_cli_ext_record, then send it to the c callback */ else if (custom_ext_parse(s, 0, type, data, size, al) <= 0) return 0; data += size; } if (data != d + n) { *al = SSL_AD_DECODE_ERROR; return 0; } if (!s->hit && tlsext_servername == 1) { if (s->tlsext_hostname) { if (s->session->tlsext_hostname == NULL) { s->session->tlsext_hostname = BUF_strdup(s->tlsext_hostname); if (!s->session->tlsext_hostname) { *al = SSL_AD_UNRECOGNIZED_NAME; return 0; } } else { *al = SSL_AD_DECODE_ERROR; return 0; } } } *p = data; ri_check: /* * Determine if we need to see RI. Strictly speaking if we want to avoid * an attack we should *always* see RI even on initial server hello * because the client doesn't see any renegotiation during an attack. * However this would mean we could not connect to any server which * doesn't support RI so for the immediate future tolerate RI absence on * initial connect only. */ if (!renegotiate_seen && !(s->options & SSL_OP_LEGACY_SERVER_CONNECT) && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { *al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); return 0; } return 1; } int ssl_prepare_clienthello_tlsext(SSL *s) { # ifdef TLSEXT_TYPE_opaque_prf_input { int r = 1; if (s->ctx->tlsext_opaque_prf_input_callback != 0) { r = s->ctx->tlsext_opaque_prf_input_callback(s, NULL, 0, s-> ctx->tlsext_opaque_prf_input_callback_arg); if (!r) return -1; } if (s->tlsext_opaque_prf_input != NULL) { if (s->s3->client_opaque_prf_input != NULL) { /* shouldn't really happen */ OPENSSL_free(s->s3->client_opaque_prf_input); } if (s->tlsext_opaque_prf_input_len == 0) { /* dummy byte just to get non-NULL */ s->s3->client_opaque_prf_input = OPENSSL_malloc(1); } else { s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); } if (s->s3->client_opaque_prf_input == NULL) { SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); return -1; } s->s3->client_opaque_prf_input_len = s->tlsext_opaque_prf_input_len; } if (r == 2) /* * at callback's request, insist on receiving an appropriate * server opaque PRF input */ s->s3->server_opaque_prf_input_len = s->tlsext_opaque_prf_input_len; } # endif s->cert->alpn_sent = 0; return 1; } int ssl_prepare_serverhello_tlsext(SSL *s) { return 1; } static int ssl_check_clienthello_tlsext_early(SSL *s) { int ret = SSL_TLSEXT_ERR_NOACK; int al = SSL_AD_UNRECOGNIZED_NAME; # ifndef OPENSSL_NO_EC /* * The handling of the ECPointFormats extension is done elsewhere, namely * in ssl3_choose_cipher in s3_lib.c. */ /* * The handling of the EllipticCurves extension is done elsewhere, namely * in ssl3_choose_cipher in s3_lib.c. */ # endif if (s->ctx != NULL && s->ctx->tlsext_servername_callback != 0) ret = s->ctx->tlsext_servername_callback(s, &al, s->ctx->tlsext_servername_arg); else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0) ret = s->initial_ctx->tlsext_servername_callback(s, &al, s-> initial_ctx->tlsext_servername_arg); # ifdef TLSEXT_TYPE_opaque_prf_input { /* * This sort of belongs into ssl_prepare_serverhello_tlsext(), but we * might be sending an alert in response to the client hello, so this * has to happen here in ssl_check_clienthello_tlsext_early(). */ int r = 1; if (s->ctx->tlsext_opaque_prf_input_callback != 0) { r = s->ctx->tlsext_opaque_prf_input_callback(s, NULL, 0, s-> ctx->tlsext_opaque_prf_input_callback_arg); if (!r) { ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_INTERNAL_ERROR; goto err; } } if (s->s3->server_opaque_prf_input != NULL) { /* shouldn't really happen */ OPENSSL_free(s->s3->server_opaque_prf_input); } s->s3->server_opaque_prf_input = NULL; if (s->tlsext_opaque_prf_input != NULL) { if (s->s3->client_opaque_prf_input != NULL && s->s3->client_opaque_prf_input_len == s->tlsext_opaque_prf_input_len) { /* * can only use this extension if we have a server opaque PRF * input of the same length as the client opaque PRF input! */ if (s->tlsext_opaque_prf_input_len == 0) { /* dummy byte just to get non-NULL */ s->s3->server_opaque_prf_input = OPENSSL_malloc(1); } else { s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); } if (s->s3->server_opaque_prf_input == NULL) { ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_INTERNAL_ERROR; goto err; } s->s3->server_opaque_prf_input_len = s->tlsext_opaque_prf_input_len; } } if (r == 2 && s->s3->server_opaque_prf_input == NULL) { /* * The callback wants to enforce use of the extension, but we * can't do that with the client opaque PRF input; abort the * handshake. */ ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_HANDSHAKE_FAILURE; } } err: # endif switch (ret) { case SSL_TLSEXT_ERR_ALERT_FATAL: ssl3_send_alert(s, SSL3_AL_FATAL, al); return -1; case SSL_TLSEXT_ERR_ALERT_WARNING: ssl3_send_alert(s, SSL3_AL_WARNING, al); return 1; case SSL_TLSEXT_ERR_NOACK: s->servername_done = 0; default: return 1; } } int tls1_set_server_sigalgs(SSL *s) { int al; size_t i; /* Clear any shared sigtnature algorithms */ if (s->cert->shared_sigalgs) { OPENSSL_free(s->cert->shared_sigalgs); s->cert->shared_sigalgs = NULL; s->cert->shared_sigalgslen = 0; } /* Clear certificate digests and validity flags */ for (i = 0; i < SSL_PKEY_NUM; i++) { s->cert->pkeys[i].digest = NULL; s->cert->pkeys[i].valid_flags = 0; } /* If sigalgs received process it. */ if (s->cert->peer_sigalgs) { if (!tls1_process_sigalgs(s)) { SSLerr(SSL_F_TLS1_SET_SERVER_SIGALGS, ERR_R_MALLOC_FAILURE); al = SSL_AD_INTERNAL_ERROR; goto err; } /* Fatal error is no shared signature algorithms */ if (!s->cert->shared_sigalgs) { SSLerr(SSL_F_TLS1_SET_SERVER_SIGALGS, SSL_R_NO_SHARED_SIGATURE_ALGORITHMS); al = SSL_AD_ILLEGAL_PARAMETER; goto err; } } else ssl_cert_set_default_md(s->cert); return 1; err: ssl3_send_alert(s, SSL3_AL_FATAL, al); return 0; } /* * Upon success, returns 1. * Upon failure, returns 0 and sets |al| to the appropriate fatal alert. */ int ssl_check_clienthello_tlsext_late(SSL *s, int *al) { /* * If status request then ask callback what to do. Note: this must be * called after servername callbacks in case the certificate has changed, * and must be called after the cipher has been chosen because this may * influence which certificate is sent */ if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) { int ret; CERT_PKEY *certpkey; certpkey = ssl_get_server_send_pkey(s); /* If no certificate can't return certificate status */ if (certpkey != NULL) { /* * Set current certificate to one we will use so SSL_get_certificate * et al can pick it up. */ s->cert->key = certpkey; ret = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); switch (ret) { /* We don't want to send a status request response */ case SSL_TLSEXT_ERR_NOACK: s->tlsext_status_expected = 0; break; /* status request response should be sent */ case SSL_TLSEXT_ERR_OK: if (s->tlsext_ocsp_resp) s->tlsext_status_expected = 1; break; /* something bad happened */ case SSL_TLSEXT_ERR_ALERT_FATAL: default: *al = SSL_AD_INTERNAL_ERROR; return 0; } } } if (!tls1_alpn_handle_client_hello_late(s, al)) { return 0; } return 1; } int ssl_check_serverhello_tlsext(SSL *s) { int ret = SSL_TLSEXT_ERR_NOACK; int al = SSL_AD_UNRECOGNIZED_NAME; # ifndef OPENSSL_NO_EC /* * If we are client and using an elliptic curve cryptography cipher * suite, then if server returns an EC point formats lists extension it * must contain uncompressed. */ unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey; unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth; if ((s->tlsext_ecpointformatlist != NULL) && (s->tlsext_ecpointformatlist_length > 0) && (s->session->tlsext_ecpointformatlist != NULL) && (s->session->tlsext_ecpointformatlist_length > 0) && ((alg_k & (SSL_kEECDH | SSL_kECDHr | SSL_kECDHe)) || (alg_a & SSL_aECDSA))) { /* we are using an ECC cipher */ size_t i; unsigned char *list; int found_uncompressed = 0; list = s->session->tlsext_ecpointformatlist; for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++) { if (*(list++) == TLSEXT_ECPOINTFORMAT_uncompressed) { found_uncompressed = 1; break; } } if (!found_uncompressed) { SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST); return -1; } } ret = SSL_TLSEXT_ERR_OK; # endif /* OPENSSL_NO_EC */ if (s->ctx != NULL && s->ctx->tlsext_servername_callback != 0) ret = s->ctx->tlsext_servername_callback(s, &al, s->ctx->tlsext_servername_arg); else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0) ret = s->initial_ctx->tlsext_servername_callback(s, &al, s-> initial_ctx->tlsext_servername_arg); # ifdef TLSEXT_TYPE_opaque_prf_input if (s->s3->server_opaque_prf_input_len > 0) { /* * This case may indicate that we, as a client, want to insist on * using opaque PRF inputs. So first verify that we really have a * value from the server too. */ if (s->s3->server_opaque_prf_input == NULL) { ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_HANDSHAKE_FAILURE; } /* * Anytime the server *has* sent an opaque PRF input, we need to * check that we have a client opaque PRF input of the same size. */ if (s->s3->client_opaque_prf_input == NULL || s->s3->client_opaque_prf_input_len != s->s3->server_opaque_prf_input_len) { ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_ILLEGAL_PARAMETER; } } # endif OPENSSL_free(s->tlsext_ocsp_resp); s->tlsext_ocsp_resp = NULL; s->tlsext_ocsp_resplen = -1; /* * If we've requested certificate status and we wont get one tell the * callback */ if ((s->tlsext_status_type != -1) && !(s->tlsext_status_expected) && !(s->hit) && s->ctx && s->ctx->tlsext_status_cb) { int r; /* * Call callback with resp == NULL and resplen == -1 so callback * knows there is no response */ r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); if (r == 0) { al = SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE; ret = SSL_TLSEXT_ERR_ALERT_FATAL; } if (r < 0) { al = SSL_AD_INTERNAL_ERROR; ret = SSL_TLSEXT_ERR_ALERT_FATAL; } } switch (ret) { case SSL_TLSEXT_ERR_ALERT_FATAL: ssl3_send_alert(s, SSL3_AL_FATAL, al); return -1; case SSL_TLSEXT_ERR_ALERT_WARNING: ssl3_send_alert(s, SSL3_AL_WARNING, al); return 1; case SSL_TLSEXT_ERR_NOACK: s->servername_done = 0; default: return 1; } } int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n) { int al = -1; if (s->version < SSL3_VERSION) return 1; if (ssl_scan_serverhello_tlsext(s, p, d, n, &al) <= 0) { ssl3_send_alert(s, SSL3_AL_FATAL, al); return 0; } if (ssl_check_serverhello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT, SSL_R_SERVERHELLO_TLSEXT); return 0; } return 1; } /*- * Since the server cache lookup is done early on in the processing of the * ClientHello, and other operations depend on the result, we need to handle * any TLS session ticket extension at the same time. * * session_id: points at the session ID in the ClientHello. This code will * read past the end of this in order to parse out the session ticket * extension, if any. * len: the length of the session ID. * limit: a pointer to the first byte after the ClientHello. * ret: (output) on return, if a ticket was decrypted, then this is set to * point to the resulting session. * * If s->tls_session_secret_cb is set then we are expecting a pre-shared key * ciphersuite, in which case we have no use for session tickets and one will * never be decrypted, nor will s->tlsext_ticket_expected be set to 1. * * Returns: * -1: fatal error, either from parsing or decrypting the ticket. * 0: no ticket was found (or was ignored, based on settings). * 1: a zero length extension was found, indicating that the client supports * session tickets but doesn't currently have one to offer. * 2: either s->tls_session_secret_cb was set, or a ticket was offered but * couldn't be decrypted because of a non-fatal error. * 3: a ticket was successfully decrypted and *ret was set. * * Side effects: * Sets s->tlsext_ticket_expected to 1 if the server will have to issue * a new session ticket to the client because the client indicated support * (and s->tls_session_secret_cb is NULL) but the client either doesn't have * a session ticket or we couldn't use the one it gave us, or if * s->ctx->tlsext_ticket_key_cb asked to renew the client's ticket. * Otherwise, s->tlsext_ticket_expected is set to 0. */ int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, const unsigned char *limit, SSL_SESSION **ret) { /* Point after session ID in client hello */ const unsigned char *p = session_id + len; unsigned short i; *ret = NULL; s->tlsext_ticket_expected = 0; /* * If tickets disabled behave as if no ticket present to permit stateful * resumption. */ if (SSL_get_options(s) & SSL_OP_NO_TICKET) return 0; if ((s->version <= SSL3_VERSION) || !limit) return 0; if (p >= limit) return -1; /* Skip past DTLS cookie */ if (SSL_IS_DTLS(s)) { i = *(p++); if (limit - p <= i) return -1; p += i; } /* Skip past cipher list */ n2s(p, i); if (limit - p <= i) return -1; p += i; /* Skip past compression algorithm list */ i = *(p++); if (limit - p < i) return -1; p += i; /* Now at start of extensions */ if (limit - p <= 2) return 0; n2s(p, i); while (limit - p >= 4) { unsigned short type, size; n2s(p, type); n2s(p, size); if (limit - p < size) return 0; if (type == TLSEXT_TYPE_session_ticket) { int r; if (size == 0) { /* * The client will accept a ticket but doesn't currently have * one. */ s->tlsext_ticket_expected = 1; return 1; } if (s->tls_session_secret_cb) { /* * Indicate that the ticket couldn't be decrypted rather than * generating the session from ticket now, trigger * abbreviated handshake based on external mechanism to * calculate the master secret later. */ return 2; } r = tls_decrypt_ticket(s, p, size, session_id, len, ret); switch (r) { case 2: /* ticket couldn't be decrypted */ s->tlsext_ticket_expected = 1; return 2; case 3: /* ticket was decrypted */ return r; case 4: /* ticket decrypted but need to renew */ s->tlsext_ticket_expected = 1; return 3; default: /* fatal error */ return -1; } } p += size; } return 0; } /*- * tls_decrypt_ticket attempts to decrypt a session ticket. * * etick: points to the body of the session ticket extension. * eticklen: the length of the session tickets extenion. * sess_id: points at the session ID. * sesslen: the length of the session ID. * psess: (output) on return, if a ticket was decrypted, then this is set to * point to the resulting session. * * Returns: * -1: fatal error, either from parsing or decrypting the ticket. * 2: the ticket couldn't be decrypted. * 3: a ticket was successfully decrypted and *psess was set. * 4: same as 3, but the ticket needs to be renewed. */ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess) { SSL_SESSION *sess; unsigned char *sdec; const unsigned char *p; int slen, mlen, renew_ticket = 0; unsigned char tick_hmac[EVP_MAX_MD_SIZE]; HMAC_CTX hctx; EVP_CIPHER_CTX ctx; SSL_CTX *tctx = s->initial_ctx; /* Initialize session ticket encryption and HMAC contexts */ HMAC_CTX_init(&hctx); EVP_CIPHER_CTX_init(&ctx); if (tctx->tlsext_ticket_key_cb) { unsigned char *nctick = (unsigned char *)etick; int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, &ctx, &hctx, 0); if (rv < 0) return -1; if (rv == 0) return 2; if (rv == 2) renew_ticket = 1; } else { /* Check key name matches */ if (memcmp(etick, tctx->tlsext_tick_key_name, 16)) return 2; if (HMAC_Init_ex(&hctx, tctx->tlsext_tick_hmac_key, 16, tlsext_tick_md(), NULL) <= 0 || EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, tctx->tlsext_tick_aes_key, etick + 16) <= 0) { goto err; } } /* * Attempt to process session ticket, first conduct sanity and integrity * checks on ticket. */ mlen = HMAC_size(&hctx); if (mlen < 0) { goto err; } /* Sanity check ticket length: must exceed keyname + IV + HMAC */ if (eticklen <= 16 + EVP_CIPHER_CTX_iv_length(&ctx) + mlen) { HMAC_CTX_cleanup(&hctx); EVP_CIPHER_CTX_cleanup(&ctx); return 2; } eticklen -= mlen; /* Check HMAC of encrypted ticket */ if (HMAC_Update(&hctx, etick, eticklen) <= 0 || HMAC_Final(&hctx, tick_hmac, NULL) <= 0) { goto err; } HMAC_CTX_cleanup(&hctx); if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) { EVP_CIPHER_CTX_cleanup(&ctx); return 2; } /* Attempt to decrypt session data */ /* Move p after IV to start of encrypted ticket, update length */ p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); sdec = OPENSSL_malloc(eticklen); if (sdec == NULL || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); OPENSSL_free(sdec); return -1; } if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); OPENSSL_free(sdec); return 2; } slen += mlen; EVP_CIPHER_CTX_cleanup(&ctx); p = sdec; sess = d2i_SSL_SESSION(NULL, &p, slen); slen -= p - sdec; OPENSSL_free(sdec); if (sess) { /* Some additional consistency checks */ if (slen != 0 || sess->session_id_length != 0) { SSL_SESSION_free(sess); return 2; } /* * The session ID, if non-empty, is used by some clients to detect * that the ticket has been accepted. So we copy it to the session * structure. If it is empty set length to zero as required by * standard. */ if (sesslen) memcpy(sess->session_id, sess_id, sesslen); sess->session_id_length = sesslen; *psess = sess; if (renew_ticket) return 4; else return 3; } ERR_clear_error(); /* * For session parse failure, indicate that we need to send a new ticket. */ return 2; err: EVP_CIPHER_CTX_cleanup(&ctx); HMAC_CTX_cleanup(&hctx); return -1; } /* Tables to translate from NIDs to TLS v1.2 ids */ typedef struct { int nid; int id; } tls12_lookup; static tls12_lookup tls12_md[] = { {NID_md5, TLSEXT_hash_md5}, {NID_sha1, TLSEXT_hash_sha1}, {NID_sha224, TLSEXT_hash_sha224}, {NID_sha256, TLSEXT_hash_sha256}, {NID_sha384, TLSEXT_hash_sha384}, {NID_sha512, TLSEXT_hash_sha512} }; static tls12_lookup tls12_sig[] = { {EVP_PKEY_RSA, TLSEXT_signature_rsa}, {EVP_PKEY_DSA, TLSEXT_signature_dsa}, {EVP_PKEY_EC, TLSEXT_signature_ecdsa} }; static int tls12_find_id(int nid, tls12_lookup *table, size_t tlen) { size_t i; for (i = 0; i < tlen; i++) { if (table[i].nid == nid) return table[i].id; } return -1; } static int tls12_find_nid(int id, tls12_lookup *table, size_t tlen) { size_t i; for (i = 0; i < tlen; i++) { if ((table[i].id) == id) return table[i].nid; } return NID_undef; } int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md) { int sig_id, md_id; if (!md) return 0; md_id = tls12_find_id(EVP_MD_type(md), tls12_md, sizeof(tls12_md) / sizeof(tls12_lookup)); if (md_id == -1) return 0; sig_id = tls12_get_sigid(pk); if (sig_id == -1) return 0; p[0] = (unsigned char)md_id; p[1] = (unsigned char)sig_id; return 1; } int tls12_get_sigid(const EVP_PKEY *pk) { return tls12_find_id(pk->type, tls12_sig, sizeof(tls12_sig) / sizeof(tls12_lookup)); } const EVP_MD *tls12_get_hash(unsigned char hash_alg) { switch (hash_alg) { # ifndef OPENSSL_NO_MD5 case TLSEXT_hash_md5: # ifdef OPENSSL_FIPS if (FIPS_mode()) return NULL; # endif return EVP_md5(); # endif # ifndef OPENSSL_NO_SHA case TLSEXT_hash_sha1: return EVP_sha1(); # endif # ifndef OPENSSL_NO_SHA256 case TLSEXT_hash_sha224: return EVP_sha224(); case TLSEXT_hash_sha256: return EVP_sha256(); # endif # ifndef OPENSSL_NO_SHA512 case TLSEXT_hash_sha384: return EVP_sha384(); case TLSEXT_hash_sha512: return EVP_sha512(); # endif default: return NULL; } } static int tls12_get_pkey_idx(unsigned char sig_alg) { switch (sig_alg) { # ifndef OPENSSL_NO_RSA case TLSEXT_signature_rsa: return SSL_PKEY_RSA_SIGN; # endif # ifndef OPENSSL_NO_DSA case TLSEXT_signature_dsa: return SSL_PKEY_DSA_SIGN; # endif # ifndef OPENSSL_NO_ECDSA case TLSEXT_signature_ecdsa: return SSL_PKEY_ECC; # endif } return -1; } /* Convert TLS 1.2 signature algorithm extension values into NIDs */ static void tls1_lookup_sigalg(int *phash_nid, int *psign_nid, int *psignhash_nid, const unsigned char *data) { int sign_nid = NID_undef, hash_nid = NID_undef; if (!phash_nid && !psign_nid && !psignhash_nid) return; if (phash_nid || psignhash_nid) { hash_nid = tls12_find_nid(data[0], tls12_md, sizeof(tls12_md) / sizeof(tls12_lookup)); if (phash_nid) *phash_nid = hash_nid; } if (psign_nid || psignhash_nid) { sign_nid = tls12_find_nid(data[1], tls12_sig, sizeof(tls12_sig) / sizeof(tls12_lookup)); if (psign_nid) *psign_nid = sign_nid; } if (psignhash_nid) { if (sign_nid == NID_undef || hash_nid == NID_undef || OBJ_find_sigid_by_algs(psignhash_nid, hash_nid, sign_nid) <= 0) *psignhash_nid = NID_undef; } } /* Given preference and allowed sigalgs set shared sigalgs */ static int tls12_do_shared_sigalgs(TLS_SIGALGS *shsig, const unsigned char *pref, size_t preflen, const unsigned char *allow, size_t allowlen) { const unsigned char *ptmp, *atmp; size_t i, j, nmatch = 0; for (i = 0, ptmp = pref; i < preflen; i += 2, ptmp += 2) { /* Skip disabled hashes or signature algorithms */ if (tls12_get_hash(ptmp[0]) == NULL) continue; if (tls12_get_pkey_idx(ptmp[1]) == -1) continue; for (j = 0, atmp = allow; j < allowlen; j += 2, atmp += 2) { if (ptmp[0] == atmp[0] && ptmp[1] == atmp[1]) { nmatch++; if (shsig) { shsig->rhash = ptmp[0]; shsig->rsign = ptmp[1]; tls1_lookup_sigalg(&shsig->hash_nid, &shsig->sign_nid, &shsig->signandhash_nid, ptmp); shsig++; } break; } } } return nmatch; } /* Set shared signature algorithms for SSL structures */ static int tls1_set_shared_sigalgs(SSL *s) { const unsigned char *pref, *allow, *conf; size_t preflen, allowlen, conflen; size_t nmatch; TLS_SIGALGS *salgs = NULL; CERT *c = s->cert; unsigned int is_suiteb = tls1_suiteb(s); if (c->shared_sigalgs) { OPENSSL_free(c->shared_sigalgs); c->shared_sigalgs = NULL; c->shared_sigalgslen = 0; } /* If client use client signature algorithms if not NULL */ if (!s->server && c->client_sigalgs && !is_suiteb) { conf = c->client_sigalgs; conflen = c->client_sigalgslen; } else if (c->conf_sigalgs && !is_suiteb) { conf = c->conf_sigalgs; conflen = c->conf_sigalgslen; } else conflen = tls12_get_psigalgs(s, 0, &conf); if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || is_suiteb) { pref = conf; preflen = conflen; allow = c->peer_sigalgs; allowlen = c->peer_sigalgslen; } else { allow = conf; allowlen = conflen; pref = c->peer_sigalgs; preflen = c->peer_sigalgslen; } nmatch = tls12_do_shared_sigalgs(NULL, pref, preflen, allow, allowlen); if (nmatch) { salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS)); if (!salgs) return 0; nmatch = tls12_do_shared_sigalgs(salgs, pref, preflen, allow, allowlen); } else { salgs = NULL; } c->shared_sigalgs = salgs; c->shared_sigalgslen = nmatch; return 1; } /* Set preferred digest for each key type */ int tls1_save_sigalgs(SSL *s, const unsigned char *data, int dsize) { CERT *c = s->cert; /* Extension ignored for inappropriate versions */ if (!SSL_USE_SIGALGS(s)) return 1; /* Should never happen */ if (!c) return 0; if (c->peer_sigalgs) OPENSSL_free(c->peer_sigalgs); c->peer_sigalgs = OPENSSL_malloc(dsize); if (!c->peer_sigalgs) return 0; c->peer_sigalgslen = dsize; memcpy(c->peer_sigalgs, data, dsize); return 1; } int tls1_process_sigalgs(SSL *s) { int idx; size_t i; const EVP_MD *md; CERT *c = s->cert; TLS_SIGALGS *sigptr; if (!tls1_set_shared_sigalgs(s)) return 0; # ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL if (s->cert->cert_flags & SSL_CERT_FLAG_BROKEN_PROTOCOL) { /* * Use first set signature preference to force message digest, * ignoring any peer preferences. */ const unsigned char *sigs = NULL; if (s->server) sigs = c->conf_sigalgs; else sigs = c->client_sigalgs; if (sigs) { idx = tls12_get_pkey_idx(sigs[1]); md = tls12_get_hash(sigs[0]); c->pkeys[idx].digest = md; c->pkeys[idx].valid_flags = CERT_PKEY_EXPLICIT_SIGN; if (idx == SSL_PKEY_RSA_SIGN) { c->pkeys[SSL_PKEY_RSA_ENC].valid_flags = CERT_PKEY_EXPLICIT_SIGN; c->pkeys[SSL_PKEY_RSA_ENC].digest = md; } } } # endif for (i = 0, sigptr = c->shared_sigalgs; i < c->shared_sigalgslen; i++, sigptr++) { idx = tls12_get_pkey_idx(sigptr->rsign); if (idx > 0 && c->pkeys[idx].digest == NULL) { md = tls12_get_hash(sigptr->rhash); c->pkeys[idx].digest = md; c->pkeys[idx].valid_flags = CERT_PKEY_EXPLICIT_SIGN; if (idx == SSL_PKEY_RSA_SIGN) { c->pkeys[SSL_PKEY_RSA_ENC].valid_flags = CERT_PKEY_EXPLICIT_SIGN; c->pkeys[SSL_PKEY_RSA_ENC].digest = md; } } } /* * In strict mode leave unset digests as NULL to indicate we can't use * the certificate for signing. */ if (!(s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)) { /* * Set any remaining keys to default values. NOTE: if alg is not * supported it stays as NULL. */ # ifndef OPENSSL_NO_DSA if (!c->pkeys[SSL_PKEY_DSA_SIGN].digest) c->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_sha1(); # endif # ifndef OPENSSL_NO_RSA if (!c->pkeys[SSL_PKEY_RSA_SIGN].digest) { c->pkeys[SSL_PKEY_RSA_SIGN].digest = EVP_sha1(); c->pkeys[SSL_PKEY_RSA_ENC].digest = EVP_sha1(); } # endif # ifndef OPENSSL_NO_ECDSA if (!c->pkeys[SSL_PKEY_ECC].digest) c->pkeys[SSL_PKEY_ECC].digest = EVP_sha1(); # endif } return 1; } int SSL_get_sigalgs(SSL *s, int idx, int *psign, int *phash, int *psignhash, unsigned char *rsig, unsigned char *rhash) { const unsigned char *psig = s->cert->peer_sigalgs; if (psig == NULL) return 0; if (idx >= 0) { idx <<= 1; if (idx >= (int)s->cert->peer_sigalgslen) return 0; psig += idx; if (rhash) *rhash = psig[0]; if (rsig) *rsig = psig[1]; tls1_lookup_sigalg(phash, psign, psignhash, psig); } return s->cert->peer_sigalgslen / 2; } int SSL_get_shared_sigalgs(SSL *s, int idx, int *psign, int *phash, int *psignhash, unsigned char *rsig, unsigned char *rhash) { TLS_SIGALGS *shsigalgs = s->cert->shared_sigalgs; if (!shsigalgs || idx >= (int)s->cert->shared_sigalgslen) return 0; shsigalgs += idx; if (phash) *phash = shsigalgs->hash_nid; if (psign) *psign = shsigalgs->sign_nid; if (psignhash) *psignhash = shsigalgs->signandhash_nid; if (rsig) *rsig = shsigalgs->rsign; if (rhash) *rhash = shsigalgs->rhash; return s->cert->shared_sigalgslen; } # ifndef OPENSSL_NO_HEARTBEATS int tls1_process_heartbeat(SSL *s) { unsigned char *p = &s->s3->rrec.data[0], *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, &s->s3->rrec.data[0], s->s3->rrec.length, s, s->msg_callback_arg); /* Read type and payload length first */ if (1 + 2 + 16 > s->s3->rrec.length) return 0; /* silently discard */ hbtype = *p++; n2s(p, payload); if (1 + 2 + payload + 16 > s->s3->rrec.length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; if (hbtype == TLS1_HB_REQUEST) { unsigned char *buffer, *bp; int r; /* * Allocate memory for the response, size is 1 bytes message type, * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); if (buffer == NULL) return -1; bp = buffer; /* Enter response type, length and copy payload */ *bp++ = TLS1_HB_RESPONSE; s2n(payload, bp); memcpy(bp, pl, payload); bp += payload; /* Random padding */ if (RAND_bytes(bp, padding) <= 0) { OPENSSL_free(buffer); return -1; } r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); if (r >= 0 && s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding, s, s->msg_callback_arg); OPENSSL_free(buffer); if (r < 0) return r; } else if (hbtype == TLS1_HB_RESPONSE) { unsigned int seq; /* * We only send sequence numbers (2 bytes unsigned int), and 16 * random bytes, so we just try to read the sequence number */ n2s(pl, seq); if (payload == 18 && seq == s->tlsext_hb_seq) { s->tlsext_hb_seq++; s->tlsext_hb_pending = 0; } } return 0; } int tls1_heartbeat(SSL *s) { unsigned char *buf, *p; int ret = -1; unsigned int payload = 18; /* Sequence number + random bytes */ unsigned int padding = 16; /* Use minimum padding */ /* Only send if peer supports and accepts HB requests... */ if (!(s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) || s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_SEND_REQUESTS) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT); return -1; } /* ...and there is none in flight yet... */ if (s->tlsext_hb_pending) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_TLS_HEARTBEAT_PENDING); return -1; } /* ...and no handshake in progress. */ if (SSL_in_init(s) || s->in_handshake) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_UNEXPECTED_MESSAGE); return -1; } /* * Check if padding is too long, payload and padding must not exceed 2^14 * - 3 = 16381 bytes in total. */ OPENSSL_assert(payload + padding <= 16381); /*- * Create HeartBeat message, we just use a sequence number * as payload to distuingish different messages and add * some random stuff. * - Message Type, 1 byte * - Payload Length, 2 bytes (unsigned int) * - Payload, the sequence number (2 bytes uint) * - Payload, random bytes (16 bytes uint) * - Padding */ buf = OPENSSL_malloc(1 + 2 + payload + padding); if (buf == NULL) return -1; p = buf; /* Message Type */ *p++ = TLS1_HB_REQUEST; /* Payload length (18 bytes here) */ s2n(payload, p); /* Sequence number */ s2n(s->tlsext_hb_seq, p); /* 16 random bytes */ if (RAND_bytes(p, 16) <= 0) { SSLerr(SSL_F_TLS1_HEARTBEAT, ERR_R_INTERNAL_ERROR); goto err; } p += 16; /* Random padding */ if (RAND_bytes(p, padding) <= 0) { SSLerr(SSL_F_TLS1_HEARTBEAT, ERR_R_INTERNAL_ERROR); goto err; } ret = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding); if (ret >= 0) { if (s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding, s, s->msg_callback_arg); s->tlsext_hb_pending = 1; } err: OPENSSL_free(buf); return ret; } # endif # define MAX_SIGALGLEN (TLSEXT_hash_num * TLSEXT_signature_num * 2) typedef struct { size_t sigalgcnt; int sigalgs[MAX_SIGALGLEN]; } sig_cb_st; static int sig_cb(const char *elem, int len, void *arg) { sig_cb_st *sarg = arg; size_t i; char etmp[20], *p; int sig_alg, hash_alg; if (elem == NULL) return 0; if (sarg->sigalgcnt == MAX_SIGALGLEN) return 0; if (len > (int)(sizeof(etmp) - 1)) return 0; memcpy(etmp, elem, len); etmp[len] = 0; p = strchr(etmp, '+'); if (!p) return 0; *p = 0; p++; if (!*p) return 0; if (!strcmp(etmp, "RSA")) sig_alg = EVP_PKEY_RSA; else if (!strcmp(etmp, "DSA")) sig_alg = EVP_PKEY_DSA; else if (!strcmp(etmp, "ECDSA")) sig_alg = EVP_PKEY_EC; else return 0; hash_alg = OBJ_sn2nid(p); if (hash_alg == NID_undef) hash_alg = OBJ_ln2nid(p); if (hash_alg == NID_undef) return 0; for (i = 0; i < sarg->sigalgcnt; i += 2) { if (sarg->sigalgs[i] == sig_alg && sarg->sigalgs[i + 1] == hash_alg) return 0; } sarg->sigalgs[sarg->sigalgcnt++] = hash_alg; sarg->sigalgs[sarg->sigalgcnt++] = sig_alg; return 1; } /* * Set suppored signature algorithms based on a colon separated list of the * form sig+hash e.g. RSA+SHA512:DSA+SHA512 */ int tls1_set_sigalgs_list(CERT *c, const char *str, int client) { sig_cb_st sig; sig.sigalgcnt = 0; if (!CONF_parse_list(str, ':', 1, sig_cb, &sig)) return 0; if (c == NULL) return 1; return tls1_set_sigalgs(c, sig.sigalgs, sig.sigalgcnt, client); } int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client) { unsigned char *sigalgs, *sptr; int rhash, rsign; size_t i; if (salglen & 1) return 0; sigalgs = OPENSSL_malloc(salglen); if (sigalgs == NULL) return 0; for (i = 0, sptr = sigalgs; i < salglen; i += 2) { rhash = tls12_find_id(*psig_nids++, tls12_md, sizeof(tls12_md) / sizeof(tls12_lookup)); rsign = tls12_find_id(*psig_nids++, tls12_sig, sizeof(tls12_sig) / sizeof(tls12_lookup)); if (rhash == -1 || rsign == -1) goto err; *sptr++ = rhash; *sptr++ = rsign; } if (client) { if (c->client_sigalgs) OPENSSL_free(c->client_sigalgs); c->client_sigalgs = sigalgs; c->client_sigalgslen = salglen; } else { if (c->conf_sigalgs) OPENSSL_free(c->conf_sigalgs); c->conf_sigalgs = sigalgs; c->conf_sigalgslen = salglen; } return 1; err: OPENSSL_free(sigalgs); return 0; } static int tls1_check_sig_alg(CERT *c, X509 *x, int default_nid) { int sig_nid; size_t i; if (default_nid == -1) return 1; sig_nid = X509_get_signature_nid(x); if (default_nid) return sig_nid == default_nid ? 1 : 0; for (i = 0; i < c->shared_sigalgslen; i++) if (sig_nid == c->shared_sigalgs[i].signandhash_nid) return 1; return 0; } /* Check to see if a certificate issuer name matches list of CA names */ static int ssl_check_ca_name(STACK_OF(X509_NAME) *names, X509 *x) { X509_NAME *nm; int i; nm = X509_get_issuer_name(x); for (i = 0; i < sk_X509_NAME_num(names); i++) { if (!X509_NAME_cmp(nm, sk_X509_NAME_value(names, i))) return 1; } return 0; } /* * Check certificate chain is consistent with TLS extensions and is usable by * server. This servers two purposes: it allows users to check chains before * passing them to the server and it allows the server to check chains before * attempting to use them. */ /* Flags which need to be set for a certificate when stict mode not set */ # define CERT_PKEY_VALID_FLAGS \ (CERT_PKEY_EE_SIGNATURE|CERT_PKEY_EE_PARAM) /* Strict mode flags */ # define CERT_PKEY_STRICT_FLAGS \ (CERT_PKEY_VALID_FLAGS|CERT_PKEY_CA_SIGNATURE|CERT_PKEY_CA_PARAM \ | CERT_PKEY_ISSUER_NAME|CERT_PKEY_CERT_TYPE) int tls1_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain, int idx) { int i; int rv = 0; int check_flags = 0, strict_mode; CERT_PKEY *cpk = NULL; CERT *c = s->cert; unsigned int suiteb_flags = tls1_suiteb(s); /* idx == -1 means checking server chains */ if (idx != -1) { /* idx == -2 means checking client certificate chains */ if (idx == -2) { cpk = c->key; idx = cpk - c->pkeys; } else cpk = c->pkeys + idx; x = cpk->x509; pk = cpk->privatekey; chain = cpk->chain; strict_mode = c->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT; /* If no cert or key, forget it */ if (!x || !pk) goto end; # ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL /* Allow any certificate to pass test */ if (s->cert->cert_flags & SSL_CERT_FLAG_BROKEN_PROTOCOL) { rv = CERT_PKEY_STRICT_FLAGS | CERT_PKEY_EXPLICIT_SIGN | CERT_PKEY_VALID | CERT_PKEY_SIGN; cpk->valid_flags = rv; return rv; } # endif } else { if (!x || !pk) return 0; idx = ssl_cert_type(x, pk); if (idx == -1) return 0; cpk = c->pkeys + idx; if (c->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT) check_flags = CERT_PKEY_STRICT_FLAGS; else check_flags = CERT_PKEY_VALID_FLAGS; strict_mode = 1; } if (suiteb_flags) { int ok; if (check_flags) check_flags |= CERT_PKEY_SUITEB; ok = X509_chain_check_suiteb(NULL, x, chain, suiteb_flags); if (ok == X509_V_OK) rv |= CERT_PKEY_SUITEB; else if (!check_flags) goto end; } /* * Check all signature algorithms are consistent with signature * algorithms extension if TLS 1.2 or later and strict mode. */ if (TLS1_get_version(s) >= TLS1_2_VERSION && strict_mode) { int default_nid; unsigned char rsign = 0; if (c->peer_sigalgs) default_nid = 0; /* If no sigalgs extension use defaults from RFC5246 */ else { switch (idx) { case SSL_PKEY_RSA_ENC: case SSL_PKEY_RSA_SIGN: case SSL_PKEY_DH_RSA: rsign = TLSEXT_signature_rsa; default_nid = NID_sha1WithRSAEncryption; break; case SSL_PKEY_DSA_SIGN: case SSL_PKEY_DH_DSA: rsign = TLSEXT_signature_dsa; default_nid = NID_dsaWithSHA1; break; case SSL_PKEY_ECC: rsign = TLSEXT_signature_ecdsa; default_nid = NID_ecdsa_with_SHA1; break; default: default_nid = -1; break; } } /* * If peer sent no signature algorithms extension and we have set * preferred signature algorithms check we support sha1. */ if (default_nid > 0 && c->conf_sigalgs) { size_t j; const unsigned char *p = c->conf_sigalgs; for (j = 0; j < c->conf_sigalgslen; j += 2, p += 2) { if (p[0] == TLSEXT_hash_sha1 && p[1] == rsign) break; } if (j == c->conf_sigalgslen) { if (check_flags) goto skip_sigs; else goto end; } } /* Check signature algorithm of each cert in chain */ if (!tls1_check_sig_alg(c, x, default_nid)) { if (!check_flags) goto end; } else rv |= CERT_PKEY_EE_SIGNATURE; rv |= CERT_PKEY_CA_SIGNATURE; for (i = 0; i < sk_X509_num(chain); i++) { if (!tls1_check_sig_alg(c, sk_X509_value(chain, i), default_nid)) { if (check_flags) { rv &= ~CERT_PKEY_CA_SIGNATURE; break; } else goto end; } } } /* Else not TLS 1.2, so mark EE and CA signing algorithms OK */ else if (check_flags) rv |= CERT_PKEY_EE_SIGNATURE | CERT_PKEY_CA_SIGNATURE; skip_sigs: /* Check cert parameters are consistent */ if (tls1_check_cert_param(s, x, check_flags ? 1 : 2)) rv |= CERT_PKEY_EE_PARAM; else if (!check_flags) goto end; if (!s->server) rv |= CERT_PKEY_CA_PARAM; /* In strict mode check rest of chain too */ else if (strict_mode) { rv |= CERT_PKEY_CA_PARAM; for (i = 0; i < sk_X509_num(chain); i++) { X509 *ca = sk_X509_value(chain, i); if (!tls1_check_cert_param(s, ca, 0)) { if (check_flags) { rv &= ~CERT_PKEY_CA_PARAM; break; } else goto end; } } } if (!s->server && strict_mode) { STACK_OF(X509_NAME) *ca_dn; int check_type = 0; switch (pk->type) { case EVP_PKEY_RSA: check_type = TLS_CT_RSA_SIGN; break; case EVP_PKEY_DSA: check_type = TLS_CT_DSS_SIGN; break; case EVP_PKEY_EC: check_type = TLS_CT_ECDSA_SIGN; break; case EVP_PKEY_DH: case EVP_PKEY_DHX: { int cert_type = X509_certificate_type(x, pk); if (cert_type & EVP_PKS_RSA) check_type = TLS_CT_RSA_FIXED_DH; if (cert_type & EVP_PKS_DSA) check_type = TLS_CT_DSS_FIXED_DH; } } if (check_type) { const unsigned char *ctypes; int ctypelen; if (c->ctypes) { ctypes = c->ctypes; ctypelen = (int)c->ctype_num; } else { ctypes = (unsigned char *)s->s3->tmp.ctype; ctypelen = s->s3->tmp.ctype_num; } for (i = 0; i < ctypelen; i++) { if (ctypes[i] == check_type) { rv |= CERT_PKEY_CERT_TYPE; break; } } if (!(rv & CERT_PKEY_CERT_TYPE) && !check_flags) goto end; } else rv |= CERT_PKEY_CERT_TYPE; ca_dn = s->s3->tmp.ca_names; if (!sk_X509_NAME_num(ca_dn)) rv |= CERT_PKEY_ISSUER_NAME; if (!(rv & CERT_PKEY_ISSUER_NAME)) { if (ssl_check_ca_name(ca_dn, x)) rv |= CERT_PKEY_ISSUER_NAME; } if (!(rv & CERT_PKEY_ISSUER_NAME)) { for (i = 0; i < sk_X509_num(chain); i++) { X509 *xtmp = sk_X509_value(chain, i); if (ssl_check_ca_name(ca_dn, xtmp)) { rv |= CERT_PKEY_ISSUER_NAME; break; } } } if (!check_flags && !(rv & CERT_PKEY_ISSUER_NAME)) goto end; } else rv |= CERT_PKEY_ISSUER_NAME | CERT_PKEY_CERT_TYPE; if (!check_flags || (rv & check_flags) == check_flags) rv |= CERT_PKEY_VALID; end: if (TLS1_get_version(s) >= TLS1_2_VERSION) { if (cpk->valid_flags & CERT_PKEY_EXPLICIT_SIGN) rv |= CERT_PKEY_EXPLICIT_SIGN | CERT_PKEY_SIGN; else if (cpk->digest) rv |= CERT_PKEY_SIGN; } else rv |= CERT_PKEY_SIGN | CERT_PKEY_EXPLICIT_SIGN; /* * When checking a CERT_PKEY structure all flags are irrelevant if the * chain is invalid. */ if (!check_flags) { if (rv & CERT_PKEY_VALID) cpk->valid_flags = rv; else { /* Preserve explicit sign flag, clear rest */ cpk->valid_flags &= CERT_PKEY_EXPLICIT_SIGN; return 0; } } return rv; } /* Set validity of certificates in an SSL structure */ void tls1_set_cert_validity(SSL *s) { tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_RSA_ENC); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_RSA_SIGN); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DSA_SIGN); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DH_RSA); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DH_DSA); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_ECC); } /* User level utiity function to check a chain is suitable */ int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain) { return tls1_check_chain(s, x, pk, chain, -1); } #endif diff --git a/util/copy-if-different.pl b/util/copy-if-different.pl index e1245f54aff1..5420f3f2bd30 100755 --- a/util/copy-if-different.pl +++ b/util/copy-if-different.pl @@ -1,78 +1,79 @@ #!/usr/local/bin/perl use strict; use Fcntl; # copy-if-different.pl # Copy to the destination if the source is not the same as it. my @filelist; foreach my $arg (@ARGV) { $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... - foreach (glob qq("$arg")) + $arg = qq("$arg") if ($arg =~ /\s/); # compensate for bug in 5.10... + foreach (glob $arg) { push @filelist, $_; } } my $fnum = @filelist; if ($fnum <= 1) { die "Need at least two filenames"; } my $dest = pop @filelist; if ($fnum > 2 && ! -d $dest) { die "Destination must be a directory"; } foreach (@filelist) { my $dfile; if (-d $dest) { $dfile = $_; $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; $dfile = "$dest/$dfile"; } else { $dfile = $dest; } my $buf; if (-f $dfile) { sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; sysopen(OUT, $dfile, O_RDONLY|O_BINARY) || die "Can't Open $dfile"; while (sysread IN, $buf, 10240) { my $b2; goto copy if !sysread(OUT, $b2, 10240) || $buf ne $b2; } goto copy if sysread(OUT, $buf, 1); close(IN); close(OUT); print "NOT copying: $_ to $dfile\n"; next; } copy: sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) || die "Can't Open $dfile"; while (sysread IN, $buf, 10240) { syswrite(OUT, $buf, length($buf)); } close(IN); close(OUT); print "Copying: $_ to $dfile\n"; } diff --git a/util/copy.pl b/util/copy.pl index a6b2a54ec6f0..9c0e68c41467 100644 --- a/util/copy.pl +++ b/util/copy.pl @@ -1,70 +1,71 @@ #!/usr/local/bin/perl use Fcntl; # copy.pl # Perl script 'copy' comment. On Windows the built in "copy" command also # copies timestamps: this messes up Makefile dependencies. my $stripcr = 0; my $arg; foreach $arg (@ARGV) { if ($arg eq "-stripcr") { $stripcr = 1; next; } $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... - foreach (glob qq("$arg")) + $arg = qq("$arg") if ($arg =~ /\s/); # compensate for bug in 5.10... + foreach (glob $arg) { push @filelist, $_; } } $fnum = @filelist; if ($fnum <= 1) { die "Need at least two filenames"; } $dest = pop @filelist; if ($fnum > 2 && ! -d $dest) { die "Destination must be a directory"; } foreach (@filelist) { if (-d $dest) { $dfile = $_; $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; $dfile = "$dest/$dfile"; } else { $dfile = $dest; } sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) || die "Can't Open $dfile"; while (sysread IN, $buf, 10240) { if ($stripcr) { $buf =~ tr/\015//d; } syswrite(OUT, $buf, length($buf)); } close(IN); close(OUT); print "Copying: $_ to $dfile\n"; } diff --git a/util/libeay.num b/util/libeay.num index fddfe1cbb202..f5b4f215098e 100755 --- a/util/libeay.num +++ b/util/libeay.num @@ -1,4432 +1,4433 @@ SSLeay 1 EXIST::FUNCTION: SSLeay_version 2 EXIST::FUNCTION: ASN1_BIT_STRING_asn1_meth 3 NOEXIST::FUNCTION: ASN1_HEADER_free 4 NOEXIST::FUNCTION: ASN1_HEADER_new 5 NOEXIST::FUNCTION: ASN1_IA5STRING_asn1_meth 6 NOEXIST::FUNCTION: ASN1_INTEGER_get 7 EXIST::FUNCTION: ASN1_INTEGER_set 8 EXIST::FUNCTION: ASN1_INTEGER_to_BN 9 EXIST::FUNCTION: ASN1_OBJECT_create 10 EXIST::FUNCTION: ASN1_OBJECT_free 11 EXIST::FUNCTION: ASN1_OBJECT_new 12 EXIST::FUNCTION: ASN1_PRINTABLE_type 13 EXIST::FUNCTION: ASN1_STRING_cmp 14 EXIST::FUNCTION: ASN1_STRING_dup 15 EXIST::FUNCTION: ASN1_STRING_free 16 EXIST::FUNCTION: ASN1_STRING_new 17 EXIST::FUNCTION: ASN1_STRING_print 18 EXIST::FUNCTION:BIO ASN1_STRING_set 19 EXIST::FUNCTION: ASN1_STRING_type_new 20 EXIST::FUNCTION: ASN1_TYPE_free 21 EXIST::FUNCTION: ASN1_TYPE_new 22 EXIST::FUNCTION: ASN1_UNIVERSALSTRING_to_string 23 EXIST::FUNCTION: ASN1_UTCTIME_check 24 EXIST::FUNCTION: ASN1_UTCTIME_print 25 EXIST::FUNCTION:BIO ASN1_UTCTIME_set 26 EXIST::FUNCTION: ASN1_check_infinite_end 27 EXIST::FUNCTION: ASN1_d2i_bio 28 EXIST::FUNCTION:BIO ASN1_d2i_fp 29 EXIST::FUNCTION:FP_API ASN1_digest 30 EXIST::FUNCTION:EVP ASN1_dup 31 EXIST::FUNCTION: ASN1_get_object 32 EXIST::FUNCTION: ASN1_i2d_bio 33 EXIST::FUNCTION:BIO ASN1_i2d_fp 34 EXIST::FUNCTION:FP_API ASN1_object_size 35 EXIST::FUNCTION: ASN1_parse 36 EXIST::FUNCTION:BIO ASN1_put_object 37 EXIST::FUNCTION: ASN1_sign 38 EXIST::FUNCTION:EVP ASN1_verify 39 EXIST::FUNCTION:EVP BF_cbc_encrypt 40 EXIST::FUNCTION:BF BF_cfb64_encrypt 41 EXIST::FUNCTION:BF BF_ecb_encrypt 42 EXIST::FUNCTION:BF BF_encrypt 43 EXIST::FUNCTION:BF BF_ofb64_encrypt 44 EXIST::FUNCTION:BF BF_options 45 EXIST::FUNCTION:BF BF_set_key 46 EXIST::FUNCTION:BF BIO_CONNECT_free 47 NOEXIST::FUNCTION: BIO_CONNECT_new 48 NOEXIST::FUNCTION: BIO_accept 51 EXIST::FUNCTION: BIO_ctrl 52 EXIST::FUNCTION: BIO_int_ctrl 53 EXIST::FUNCTION: BIO_debug_callback 54 EXIST::FUNCTION: BIO_dump 55 EXIST::FUNCTION: BIO_dup_chain 56 EXIST::FUNCTION: BIO_f_base64 57 EXIST::FUNCTION:BIO BIO_f_buffer 58 EXIST::FUNCTION: BIO_f_cipher 59 EXIST::FUNCTION:BIO BIO_f_md 60 EXIST::FUNCTION:BIO BIO_f_null 61 EXIST::FUNCTION: BIO_f_proxy_server 62 NOEXIST::FUNCTION: BIO_fd_non_fatal_error 63 EXIST::FUNCTION: BIO_fd_should_retry 64 EXIST::FUNCTION: BIO_find_type 65 EXIST::FUNCTION: BIO_free 66 EXIST::FUNCTION: BIO_free_all 67 EXIST::FUNCTION: BIO_get_accept_socket 69 EXIST::FUNCTION: BIO_get_filter_bio 70 NOEXIST::FUNCTION: BIO_get_host_ip 71 EXIST::FUNCTION: BIO_get_port 72 EXIST::FUNCTION: BIO_get_retry_BIO 73 EXIST::FUNCTION: BIO_get_retry_reason 74 EXIST::FUNCTION: BIO_gethostbyname 75 EXIST::FUNCTION: BIO_gets 76 EXIST::FUNCTION: BIO_new 78 EXIST::FUNCTION: BIO_new_accept 79 EXIST::FUNCTION: BIO_new_connect 80 EXIST::FUNCTION: BIO_new_fd 81 EXIST::FUNCTION: BIO_new_file 82 EXIST::FUNCTION:FP_API BIO_new_fp 83 EXIST::FUNCTION:FP_API BIO_new_socket 84 EXIST::FUNCTION: BIO_pop 85 EXIST::FUNCTION: BIO_printf 86 EXIST::FUNCTION: BIO_push 87 EXIST::FUNCTION: BIO_puts 88 EXIST::FUNCTION: BIO_read 89 EXIST::FUNCTION: BIO_s_accept 90 EXIST::FUNCTION: BIO_s_connect 91 EXIST::FUNCTION: BIO_s_fd 92 EXIST::FUNCTION: BIO_s_file 93 EXIST::FUNCTION:FP_API BIO_s_mem 95 EXIST::FUNCTION: BIO_s_null 96 EXIST::FUNCTION: BIO_s_proxy_client 97 NOEXIST::FUNCTION: BIO_s_socket 98 EXIST::FUNCTION: BIO_set 100 EXIST::FUNCTION: BIO_set_cipher 101 EXIST::FUNCTION:BIO BIO_set_tcp_ndelay 102 EXIST::FUNCTION: BIO_sock_cleanup 103 EXIST::FUNCTION: BIO_sock_error 104 EXIST::FUNCTION: BIO_sock_init 105 EXIST::FUNCTION: BIO_sock_non_fatal_error 106 EXIST::FUNCTION: BIO_sock_should_retry 107 EXIST::FUNCTION: BIO_socket_ioctl 108 EXIST::FUNCTION: BIO_write 109 EXIST::FUNCTION: BN_CTX_free 110 EXIST::FUNCTION: BN_CTX_new 111 EXIST::FUNCTION: BN_MONT_CTX_free 112 EXIST::FUNCTION: BN_MONT_CTX_new 113 EXIST::FUNCTION: BN_MONT_CTX_set 114 EXIST::FUNCTION: BN_add 115 EXIST::FUNCTION: BN_add_word 116 EXIST::FUNCTION: BN_hex2bn 117 EXIST::FUNCTION: BN_bin2bn 118 EXIST::FUNCTION: BN_bn2hex 119 EXIST::FUNCTION: BN_bn2bin 120 EXIST::FUNCTION: BN_clear 121 EXIST::FUNCTION: BN_clear_bit 122 EXIST::FUNCTION: BN_clear_free 123 EXIST::FUNCTION: BN_cmp 124 EXIST::FUNCTION: BN_copy 125 EXIST::FUNCTION: BN_div 126 EXIST::FUNCTION: BN_div_word 127 EXIST::FUNCTION: BN_dup 128 EXIST::FUNCTION: BN_free 129 EXIST::FUNCTION: BN_from_montgomery 130 EXIST::FUNCTION: BN_gcd 131 EXIST::FUNCTION: BN_generate_prime 132 EXIST::FUNCTION:DEPRECATED BN_get_word 133 EXIST::FUNCTION: BN_is_bit_set 134 EXIST::FUNCTION: BN_is_prime 135 EXIST::FUNCTION:DEPRECATED BN_lshift 136 EXIST::FUNCTION: BN_lshift1 137 EXIST::FUNCTION: BN_mask_bits 138 EXIST::FUNCTION: BN_mod 139 NOEXIST::FUNCTION: BN_mod_exp 140 EXIST::FUNCTION: BN_mod_exp_mont 141 EXIST::FUNCTION: BN_mod_exp_simple 143 EXIST::FUNCTION: BN_mod_inverse 144 EXIST::FUNCTION: BN_mod_mul 145 EXIST::FUNCTION: BN_mod_mul_montgomery 146 EXIST::FUNCTION: BN_mod_word 148 EXIST::FUNCTION: BN_mul 149 EXIST::FUNCTION: BN_new 150 EXIST::FUNCTION: BN_num_bits 151 EXIST::FUNCTION: BN_num_bits_word 152 EXIST::FUNCTION: BN_options 153 EXIST::FUNCTION: BN_print 154 EXIST::FUNCTION: BN_print_fp 155 EXIST::FUNCTION:FP_API BN_rand 156 EXIST::FUNCTION: BN_reciprocal 157 EXIST::FUNCTION: BN_rshift 158 EXIST::FUNCTION: BN_rshift1 159 EXIST::FUNCTION: BN_set_bit 160 EXIST::FUNCTION: BN_set_word 161 EXIST::FUNCTION: BN_sqr 162 EXIST::FUNCTION: BN_sub 163 EXIST::FUNCTION: BN_to_ASN1_INTEGER 164 EXIST::FUNCTION: BN_ucmp 165 EXIST::FUNCTION: BN_value_one 166 EXIST::FUNCTION: BUF_MEM_free 167 EXIST::FUNCTION: BUF_MEM_grow 168 EXIST::FUNCTION: BUF_MEM_new 169 EXIST::FUNCTION: BUF_strdup 170 EXIST::FUNCTION: CONF_free 171 EXIST::FUNCTION: CONF_get_number 172 EXIST::FUNCTION: CONF_get_section 173 EXIST::FUNCTION: CONF_get_string 174 EXIST::FUNCTION: CONF_load 175 EXIST::FUNCTION: CRYPTO_add_lock 176 EXIST::FUNCTION: CRYPTO_dbg_free 177 EXIST::FUNCTION: CRYPTO_dbg_malloc 178 EXIST::FUNCTION: CRYPTO_dbg_realloc 179 EXIST::FUNCTION: CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION: CRYPTO_free 181 EXIST::FUNCTION: CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION: CRYPTO_get_id_callback 183 EXIST::FUNCTION:DEPRECATED CRYPTO_get_lock_name 184 EXIST::FUNCTION: CRYPTO_get_locking_callback 185 EXIST::FUNCTION: CRYPTO_get_mem_functions 186 EXIST::FUNCTION: CRYPTO_lock 187 EXIST::FUNCTION: CRYPTO_malloc 188 EXIST::FUNCTION: CRYPTO_mem_ctrl 189 EXIST::FUNCTION: CRYPTO_mem_leaks 190 EXIST::FUNCTION: CRYPTO_mem_leaks_cb 191 EXIST::FUNCTION: CRYPTO_mem_leaks_fp 192 EXIST::FUNCTION:FP_API CRYPTO_realloc 193 EXIST::FUNCTION: CRYPTO_remalloc 194 EXIST::FUNCTION: CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION: CRYPTO_set_id_callback 196 EXIST::FUNCTION:DEPRECATED CRYPTO_set_locking_callback 197 EXIST::FUNCTION: CRYPTO_set_mem_functions 198 EXIST::FUNCTION: CRYPTO_thread_id 199 EXIST::FUNCTION:DEPRECATED DH_check 200 EXIST::FUNCTION:DH DH_compute_key 201 EXIST::FUNCTION:DH DH_free 202 EXIST::FUNCTION:DH DH_generate_key 203 EXIST::FUNCTION:DH DH_generate_parameters 204 EXIST::FUNCTION:DEPRECATED,DH DH_new 205 EXIST::FUNCTION:DH DH_size 206 EXIST::FUNCTION:DH DHparams_print 207 EXIST::FUNCTION:BIO,DH DHparams_print_fp 208 EXIST::FUNCTION:DH,FP_API DSA_free 209 EXIST::FUNCTION:DSA DSA_generate_key 210 EXIST::FUNCTION:DSA DSA_generate_parameters 211 EXIST::FUNCTION:DEPRECATED,DSA DSA_is_prime 212 NOEXIST::FUNCTION: DSA_new 213 EXIST::FUNCTION:DSA DSA_print 214 EXIST::FUNCTION:BIO,DSA DSA_print_fp 215 EXIST::FUNCTION:DSA,FP_API DSA_sign 216 EXIST::FUNCTION:DSA DSA_sign_setup 217 EXIST::FUNCTION:DSA DSA_size 218 EXIST::FUNCTION:DSA DSA_verify 219 EXIST::FUNCTION:DSA DSAparams_print 220 EXIST::FUNCTION:BIO,DSA DSAparams_print_fp 221 EXIST::FUNCTION:DSA,FP_API ERR_clear_error 222 EXIST::FUNCTION: ERR_error_string 223 EXIST::FUNCTION: ERR_free_strings 224 EXIST::FUNCTION: ERR_func_error_string 225 EXIST::FUNCTION: ERR_get_err_state_table 226 EXIST::FUNCTION:LHASH ERR_get_error 227 EXIST::FUNCTION: ERR_get_error_line 228 EXIST::FUNCTION: ERR_get_state 229 EXIST::FUNCTION: ERR_get_string_table 230 EXIST::FUNCTION:LHASH ERR_lib_error_string 231 EXIST::FUNCTION: ERR_load_ASN1_strings 232 EXIST::FUNCTION: ERR_load_BIO_strings 233 EXIST::FUNCTION: ERR_load_BN_strings 234 EXIST::FUNCTION: ERR_load_BUF_strings 235 EXIST::FUNCTION: ERR_load_CONF_strings 236 EXIST::FUNCTION: ERR_load_DH_strings 237 EXIST::FUNCTION:DH ERR_load_DSA_strings 238 EXIST::FUNCTION:DSA ERR_load_ERR_strings 239 EXIST::FUNCTION: ERR_load_EVP_strings 240 EXIST::FUNCTION: ERR_load_OBJ_strings 241 EXIST::FUNCTION: ERR_load_PEM_strings 242 EXIST::FUNCTION: ERR_load_PROXY_strings 243 NOEXIST::FUNCTION: ERR_load_RSA_strings 244 EXIST::FUNCTION:RSA ERR_load_X509_strings 245 EXIST::FUNCTION: ERR_load_crypto_strings 246 EXIST::FUNCTION: ERR_load_strings 247 EXIST::FUNCTION: ERR_peek_error 248 EXIST::FUNCTION: ERR_peek_error_line 249 EXIST::FUNCTION: ERR_print_errors 250 EXIST::FUNCTION:BIO ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API ERR_put_error 252 EXIST::FUNCTION: ERR_reason_error_string 253 EXIST::FUNCTION: ERR_remove_state 254 EXIST::FUNCTION:DEPRECATED EVP_BytesToKey 255 EXIST::FUNCTION: EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION: EVP_CipherFinal 257 EXIST::FUNCTION: EVP_CipherInit 258 EXIST::FUNCTION: EVP_CipherUpdate 259 EXIST::FUNCTION: EVP_DecodeBlock 260 EXIST::FUNCTION: EVP_DecodeFinal 261 EXIST::FUNCTION: EVP_DecodeInit 262 EXIST::FUNCTION: EVP_DecodeUpdate 263 EXIST::FUNCTION: EVP_DecryptFinal 264 EXIST::FUNCTION: EVP_DecryptInit 265 EXIST::FUNCTION: EVP_DecryptUpdate 266 EXIST::FUNCTION: EVP_DigestFinal 267 EXIST::FUNCTION: EVP_DigestInit 268 EXIST::FUNCTION: EVP_DigestUpdate 269 EXIST::FUNCTION: EVP_EncodeBlock 270 EXIST::FUNCTION: EVP_EncodeFinal 271 EXIST::FUNCTION: EVP_EncodeInit 272 EXIST::FUNCTION: EVP_EncodeUpdate 273 EXIST::FUNCTION: EVP_EncryptFinal 274 EXIST::FUNCTION: EVP_EncryptInit 275 EXIST::FUNCTION: EVP_EncryptUpdate 276 EXIST::FUNCTION: EVP_OpenFinal 277 EXIST::FUNCTION:RSA EVP_OpenInit 278 EXIST::FUNCTION:RSA EVP_PKEY_assign 279 EXIST::FUNCTION: EVP_PKEY_copy_parameters 280 EXIST::FUNCTION: EVP_PKEY_free 281 EXIST::FUNCTION: EVP_PKEY_missing_parameters 282 EXIST::FUNCTION: EVP_PKEY_new 283 EXIST::FUNCTION: EVP_PKEY_save_parameters 284 EXIST::FUNCTION: EVP_PKEY_size 285 EXIST::FUNCTION: EVP_PKEY_type 286 EXIST::FUNCTION: EVP_SealFinal 287 EXIST::FUNCTION:RSA EVP_SealInit 288 EXIST::FUNCTION:RSA EVP_SignFinal 289 EXIST::FUNCTION: EVP_VerifyFinal 290 EXIST::FUNCTION: EVP_add_alias 291 NOEXIST::FUNCTION: EVP_add_cipher 292 EXIST::FUNCTION: EVP_add_digest 293 EXIST::FUNCTION: EVP_bf_cbc 294 EXIST::FUNCTION:BF EVP_bf_cfb64 295 EXIST::FUNCTION:BF EVP_bf_ecb 296 EXIST::FUNCTION:BF EVP_bf_ofb 297 EXIST::FUNCTION:BF EVP_cleanup 298 EXIST::FUNCTION: EVP_des_cbc 299 EXIST::FUNCTION:DES EVP_des_cfb64 300 EXIST::FUNCTION:DES EVP_des_ecb 301 EXIST::FUNCTION:DES EVP_des_ede 302 EXIST::FUNCTION:DES EVP_des_ede3 303 EXIST::FUNCTION:DES EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES EVP_des_ede3_cfb64 305 EXIST::FUNCTION:DES EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES EVP_des_ede_cbc 307 EXIST::FUNCTION:DES EVP_des_ede_cfb64 308 EXIST::FUNCTION:DES EVP_des_ede_ofb 309 EXIST::FUNCTION:DES EVP_des_ofb 310 EXIST::FUNCTION:DES EVP_desx_cbc 311 EXIST::FUNCTION:DES EVP_dss 312 EXIST::FUNCTION:DSA,SHA EVP_dss1 313 EXIST::FUNCTION:DSA,SHA EVP_enc_null 314 EXIST::FUNCTION: EVP_get_cipherbyname 315 EXIST::FUNCTION: EVP_get_digestbyname 316 EXIST::FUNCTION: EVP_get_pw_prompt 317 EXIST::FUNCTION: EVP_idea_cbc 318 EXIST::FUNCTION:IDEA EVP_idea_cfb64 319 EXIST::FUNCTION:IDEA EVP_idea_ecb 320 EXIST::FUNCTION:IDEA EVP_idea_ofb 321 EXIST::FUNCTION:IDEA EVP_md2 322 EXIST::FUNCTION:MD2 EVP_md5 323 EXIST::FUNCTION:MD5 EVP_md_null 324 EXIST::FUNCTION: EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 EVP_rc2_cfb64 326 EXIST::FUNCTION:RC2 EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 EVP_rc4 329 EXIST::FUNCTION:RC4 EVP_read_pw_string 330 EXIST::FUNCTION: EVP_set_pw_prompt 331 EXIST::FUNCTION: EVP_sha 332 EXIST::FUNCTION:SHA EVP_sha1 333 EXIST::FUNCTION:SHA MD2 334 EXIST::FUNCTION:MD2 MD2_Final 335 EXIST::FUNCTION:MD2 MD2_Init 336 EXIST::FUNCTION:MD2 MD2_Update 337 EXIST::FUNCTION:MD2 MD2_options 338 EXIST::FUNCTION:MD2 MD5 339 EXIST::FUNCTION:MD5 MD5_Final 340 EXIST::FUNCTION:MD5 MD5_Init 341 EXIST::FUNCTION:MD5 MD5_Update 342 EXIST::FUNCTION:MD5 MDC2 343 EXIST::FUNCTION:MDC2 MDC2_Final 344 EXIST::FUNCTION:MDC2 MDC2_Init 345 EXIST::FUNCTION:MDC2 MDC2_Update 346 EXIST::FUNCTION:MDC2 NETSCAPE_SPKAC_free 347 EXIST::FUNCTION: NETSCAPE_SPKAC_new 348 EXIST::FUNCTION: NETSCAPE_SPKI_free 349 EXIST::FUNCTION: NETSCAPE_SPKI_new 350 EXIST::FUNCTION: NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP OBJ_add_object 353 EXIST::FUNCTION: OBJ_bsearch 354 NOEXIST::FUNCTION: OBJ_cleanup 355 EXIST::FUNCTION: OBJ_cmp 356 EXIST::FUNCTION: OBJ_create 357 EXIST::FUNCTION: OBJ_dup 358 EXIST::FUNCTION: OBJ_ln2nid 359 EXIST::FUNCTION: OBJ_new_nid 360 EXIST::FUNCTION: OBJ_nid2ln 361 EXIST::FUNCTION: OBJ_nid2obj 362 EXIST::FUNCTION: OBJ_nid2sn 363 EXIST::FUNCTION: OBJ_obj2nid 364 EXIST::FUNCTION: OBJ_sn2nid 365 EXIST::FUNCTION: OBJ_txt2nid 366 EXIST::FUNCTION: PEM_ASN1_read 367 EXIST::FUNCTION: PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO PEM_ASN1_write 369 EXIST::FUNCTION: PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO PEM_SealFinal 371 EXIST::FUNCTION:RSA PEM_SealInit 372 EXIST::FUNCTION:RSA PEM_SealUpdate 373 EXIST::FUNCTION:RSA PEM_SignFinal 374 EXIST::FUNCTION: PEM_SignInit 375 EXIST::FUNCTION: PEM_SignUpdate 376 EXIST::FUNCTION: PEM_X509_INFO_read 377 EXIST::FUNCTION: PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO PEM_dek_info 380 EXIST::FUNCTION: PEM_do_header 381 EXIST::FUNCTION: PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION: PEM_proc_type 383 EXIST::FUNCTION: PEM_read 384 EXIST::FUNCTION: PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA PEM_read_PKCS7 388 EXIST:!WIN16:FUNCTION: PEM_read_PrivateKey 389 EXIST:!WIN16:FUNCTION: PEM_read_RSAPrivateKey 390 EXIST:!WIN16:FUNCTION:RSA PEM_read_X509 391 EXIST:!WIN16:FUNCTION: PEM_read_X509_CRL 392 EXIST:!WIN16:FUNCTION: PEM_read_X509_REQ 393 EXIST:!WIN16:FUNCTION: PEM_read_bio 394 EXIST::FUNCTION:BIO PEM_read_bio_DHparams 395 EXIST::FUNCTION:DH PEM_read_bio_DSAPrivateKey 396 EXIST::FUNCTION:DSA PEM_read_bio_DSAparams 397 EXIST::FUNCTION:DSA PEM_read_bio_PKCS7 398 EXIST::FUNCTION: PEM_read_bio_PrivateKey 399 EXIST::FUNCTION: PEM_read_bio_RSAPrivateKey 400 EXIST::FUNCTION:RSA PEM_read_bio_X509 401 EXIST::FUNCTION: PEM_read_bio_X509_CRL 402 EXIST::FUNCTION: PEM_read_bio_X509_REQ 403 EXIST::FUNCTION: PEM_write 404 EXIST::FUNCTION: PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA PEM_write_PKCS7 408 EXIST:!WIN16:FUNCTION: PEM_write_PrivateKey 409 EXIST:!WIN16:FUNCTION: PEM_write_RSAPrivateKey 410 EXIST:!WIN16:FUNCTION:RSA PEM_write_X509 411 EXIST:!WIN16:FUNCTION: PEM_write_X509_CRL 412 EXIST:!WIN16:FUNCTION: PEM_write_X509_REQ 413 EXIST:!WIN16:FUNCTION: PEM_write_bio 414 EXIST::FUNCTION:BIO PEM_write_bio_DHparams 415 EXIST::FUNCTION:DH PEM_write_bio_DSAPrivateKey 416 EXIST::FUNCTION:DSA PEM_write_bio_DSAparams 417 EXIST::FUNCTION:DSA PEM_write_bio_PKCS7 418 EXIST::FUNCTION: PEM_write_bio_PrivateKey 419 EXIST::FUNCTION: PEM_write_bio_RSAPrivateKey 420 EXIST::FUNCTION:RSA PEM_write_bio_X509 421 EXIST::FUNCTION: PEM_write_bio_X509_CRL 422 EXIST::FUNCTION: PEM_write_bio_X509_REQ 423 EXIST::FUNCTION: PKCS7_DIGEST_free 424 EXIST::FUNCTION: PKCS7_DIGEST_new 425 EXIST::FUNCTION: PKCS7_ENCRYPT_free 426 EXIST::FUNCTION: PKCS7_ENCRYPT_new 427 EXIST::FUNCTION: PKCS7_ENC_CONTENT_free 428 EXIST::FUNCTION: PKCS7_ENC_CONTENT_new 429 EXIST::FUNCTION: PKCS7_ENVELOPE_free 430 EXIST::FUNCTION: PKCS7_ENVELOPE_new 431 EXIST::FUNCTION: PKCS7_ISSUER_AND_SERIAL_digest 432 EXIST::FUNCTION: PKCS7_ISSUER_AND_SERIAL_free 433 EXIST::FUNCTION: PKCS7_ISSUER_AND_SERIAL_new 434 EXIST::FUNCTION: PKCS7_RECIP_INFO_free 435 EXIST::FUNCTION: PKCS7_RECIP_INFO_new 436 EXIST::FUNCTION: PKCS7_SIGNED_free 437 EXIST::FUNCTION: PKCS7_SIGNED_new 438 EXIST::FUNCTION: PKCS7_SIGNER_INFO_free 439 EXIST::FUNCTION: PKCS7_SIGNER_INFO_new 440 EXIST::FUNCTION: PKCS7_SIGN_ENVELOPE_free 441 EXIST::FUNCTION: PKCS7_SIGN_ENVELOPE_new 442 EXIST::FUNCTION: PKCS7_dup 443 EXIST::FUNCTION: PKCS7_free 444 EXIST::FUNCTION: PKCS7_new 445 EXIST::FUNCTION: PROXY_ENTRY_add_noproxy 446 NOEXIST::FUNCTION: PROXY_ENTRY_clear_noproxy 447 NOEXIST::FUNCTION: PROXY_ENTRY_free 448 NOEXIST::FUNCTION: PROXY_ENTRY_get_noproxy 449 NOEXIST::FUNCTION: PROXY_ENTRY_new 450 NOEXIST::FUNCTION: PROXY_ENTRY_set_server 451 NOEXIST::FUNCTION: PROXY_add_noproxy 452 NOEXIST::FUNCTION: PROXY_add_server 453 NOEXIST::FUNCTION: PROXY_check_by_host 454 NOEXIST::FUNCTION: PROXY_check_url 455 NOEXIST::FUNCTION: PROXY_clear_noproxy 456 NOEXIST::FUNCTION: PROXY_free 457 NOEXIST::FUNCTION: PROXY_get_noproxy 458 NOEXIST::FUNCTION: PROXY_get_proxies 459 NOEXIST::FUNCTION: PROXY_get_proxy_entry 460 NOEXIST::FUNCTION: PROXY_load_conf 461 NOEXIST::FUNCTION: PROXY_new 462 NOEXIST::FUNCTION: PROXY_print 463 NOEXIST::FUNCTION: RAND_bytes 464 EXIST::FUNCTION: RAND_cleanup 465 EXIST::FUNCTION: RAND_file_name 466 EXIST::FUNCTION: RAND_load_file 467 EXIST::FUNCTION: RAND_screen 468 EXIST:WIN32:FUNCTION: RAND_seed 469 EXIST::FUNCTION: RAND_write_file 470 EXIST::FUNCTION: RC2_cbc_encrypt 471 EXIST::FUNCTION:RC2 RC2_cfb64_encrypt 472 EXIST::FUNCTION:RC2 RC2_ecb_encrypt 473 EXIST::FUNCTION:RC2 RC2_encrypt 474 EXIST::FUNCTION:RC2 RC2_ofb64_encrypt 475 EXIST::FUNCTION:RC2 RC2_set_key 476 EXIST::FUNCTION:RC2 RC4 477 EXIST::FUNCTION:RC4 RC4_options 478 EXIST::FUNCTION:RC4 RC4_set_key 479 EXIST::FUNCTION:RC4 RSAPrivateKey_asn1_meth 480 NOEXIST::FUNCTION: RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA RSAPublicKey_dup 482 EXIST::FUNCTION:RSA RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA RSA_free 484 EXIST::FUNCTION:RSA RSA_generate_key 485 EXIST::FUNCTION:DEPRECATED,RSA RSA_new 486 EXIST::FUNCTION:RSA RSA_new_method 487 EXIST::FUNCTION:RSA RSA_print 488 EXIST::FUNCTION:BIO,RSA RSA_print_fp 489 EXIST::FUNCTION:FP_API,RSA RSA_private_decrypt 490 EXIST::FUNCTION:RSA RSA_private_encrypt 491 EXIST::FUNCTION:RSA RSA_public_decrypt 492 EXIST::FUNCTION:RSA RSA_public_encrypt 493 EXIST::FUNCTION:RSA RSA_set_default_method 494 EXIST::FUNCTION:RSA RSA_sign 495 EXIST::FUNCTION:RSA RSA_sign_ASN1_OCTET_STRING 496 EXIST::FUNCTION:RSA RSA_size 497 EXIST::FUNCTION:RSA RSA_verify 498 EXIST::FUNCTION:RSA RSA_verify_ASN1_OCTET_STRING 499 EXIST::FUNCTION:RSA SHA 500 EXIST::FUNCTION:SHA,SHA0 SHA1 501 EXIST::FUNCTION:SHA,SHA1 SHA1_Final 502 EXIST::FUNCTION:SHA,SHA1 SHA1_Init 503 EXIST::FUNCTION:SHA,SHA1 SHA1_Update 504 EXIST::FUNCTION:SHA,SHA1 SHA_Final 505 EXIST::FUNCTION:SHA,SHA0 SHA_Init 506 EXIST::FUNCTION:SHA,SHA0 SHA_Update 507 EXIST::FUNCTION:SHA,SHA0 OpenSSL_add_all_algorithms 508 NOEXIST::FUNCTION: OpenSSL_add_all_ciphers 509 EXIST::FUNCTION: OpenSSL_add_all_digests 510 EXIST::FUNCTION: TXT_DB_create_index 511 EXIST::FUNCTION: TXT_DB_free 512 EXIST::FUNCTION: TXT_DB_get_by_index 513 EXIST::FUNCTION: TXT_DB_insert 514 EXIST::FUNCTION: TXT_DB_read 515 EXIST::FUNCTION:BIO TXT_DB_write 516 EXIST::FUNCTION:BIO X509_ALGOR_free 517 EXIST::FUNCTION: X509_ALGOR_new 518 EXIST::FUNCTION: X509_ATTRIBUTE_free 519 EXIST::FUNCTION: X509_ATTRIBUTE_new 520 EXIST::FUNCTION: X509_CINF_free 521 EXIST::FUNCTION: X509_CINF_new 522 EXIST::FUNCTION: X509_CRL_INFO_free 523 EXIST::FUNCTION: X509_CRL_INFO_new 524 EXIST::FUNCTION: X509_CRL_add_ext 525 EXIST::FUNCTION: X509_CRL_cmp 526 EXIST::FUNCTION: X509_CRL_delete_ext 527 EXIST::FUNCTION: X509_CRL_dup 528 EXIST::FUNCTION: X509_CRL_free 529 EXIST::FUNCTION: X509_CRL_get_ext 530 EXIST::FUNCTION: X509_CRL_get_ext_by_NID 531 EXIST::FUNCTION: X509_CRL_get_ext_by_OBJ 532 EXIST::FUNCTION: X509_CRL_get_ext_by_critical 533 EXIST::FUNCTION: X509_CRL_get_ext_count 534 EXIST::FUNCTION: X509_CRL_new 535 EXIST::FUNCTION: X509_CRL_sign 536 EXIST::FUNCTION:EVP X509_CRL_verify 537 EXIST::FUNCTION:EVP X509_EXTENSION_create_by_NID 538 EXIST::FUNCTION: X509_EXTENSION_create_by_OBJ 539 EXIST::FUNCTION: X509_EXTENSION_dup 540 EXIST::FUNCTION: X509_EXTENSION_free 541 EXIST::FUNCTION: X509_EXTENSION_get_critical 542 EXIST::FUNCTION: X509_EXTENSION_get_data 543 EXIST::FUNCTION: X509_EXTENSION_get_object 544 EXIST::FUNCTION: X509_EXTENSION_new 545 EXIST::FUNCTION: X509_EXTENSION_set_critical 546 EXIST::FUNCTION: X509_EXTENSION_set_data 547 EXIST::FUNCTION: X509_EXTENSION_set_object 548 EXIST::FUNCTION: X509_INFO_free 549 EXIST::FUNCTION:EVP X509_INFO_new 550 EXIST::FUNCTION:EVP X509_LOOKUP_by_alias 551 EXIST::FUNCTION: X509_LOOKUP_by_fingerprint 552 EXIST::FUNCTION: X509_LOOKUP_by_issuer_serial 553 EXIST::FUNCTION: X509_LOOKUP_by_subject 554 EXIST::FUNCTION: X509_LOOKUP_ctrl 555 EXIST::FUNCTION: X509_LOOKUP_file 556 EXIST::FUNCTION: X509_LOOKUP_free 557 EXIST::FUNCTION: X509_LOOKUP_hash_dir 558 EXIST::FUNCTION: X509_LOOKUP_init 559 EXIST::FUNCTION: X509_LOOKUP_new 560 EXIST::FUNCTION: X509_LOOKUP_shutdown 561 EXIST::FUNCTION: X509_NAME_ENTRY_create_by_NID 562 EXIST::FUNCTION: X509_NAME_ENTRY_create_by_OBJ 563 EXIST::FUNCTION: X509_NAME_ENTRY_dup 564 EXIST::FUNCTION: X509_NAME_ENTRY_free 565 EXIST::FUNCTION: X509_NAME_ENTRY_get_data 566 EXIST::FUNCTION: X509_NAME_ENTRY_get_object 567 EXIST::FUNCTION: X509_NAME_ENTRY_new 568 EXIST::FUNCTION: X509_NAME_ENTRY_set_data 569 EXIST::FUNCTION: X509_NAME_ENTRY_set_object 570 EXIST::FUNCTION: X509_NAME_add_entry 571 EXIST::FUNCTION: X509_NAME_cmp 572 EXIST::FUNCTION: X509_NAME_delete_entry 573 EXIST::FUNCTION: X509_NAME_digest 574 EXIST::FUNCTION:EVP X509_NAME_dup 575 EXIST::FUNCTION: X509_NAME_entry_count 576 EXIST::FUNCTION: X509_NAME_free 577 EXIST::FUNCTION: X509_NAME_get_entry 578 EXIST::FUNCTION: X509_NAME_get_index_by_NID 579 EXIST::FUNCTION: X509_NAME_get_index_by_OBJ 580 EXIST::FUNCTION: X509_NAME_get_text_by_NID 581 EXIST::FUNCTION: X509_NAME_get_text_by_OBJ 582 EXIST::FUNCTION: X509_NAME_hash 583 EXIST::FUNCTION: X509_NAME_new 584 EXIST::FUNCTION: X509_NAME_oneline 585 EXIST::FUNCTION:EVP X509_NAME_print 586 EXIST::FUNCTION:BIO X509_NAME_set 587 EXIST::FUNCTION: X509_OBJECT_free_contents 588 EXIST::FUNCTION: X509_OBJECT_retrieve_by_subject 589 EXIST::FUNCTION: X509_OBJECT_up_ref_count 590 EXIST::FUNCTION: X509_PKEY_free 591 EXIST::FUNCTION: X509_PKEY_new 592 EXIST::FUNCTION: X509_PUBKEY_free 593 EXIST::FUNCTION: X509_PUBKEY_get 594 EXIST::FUNCTION: X509_PUBKEY_new 595 EXIST::FUNCTION: X509_PUBKEY_set 596 EXIST::FUNCTION: X509_REQ_INFO_free 597 EXIST::FUNCTION: X509_REQ_INFO_new 598 EXIST::FUNCTION: X509_REQ_dup 599 EXIST::FUNCTION: X509_REQ_free 600 EXIST::FUNCTION: X509_REQ_get_pubkey 601 EXIST::FUNCTION: X509_REQ_new 602 EXIST::FUNCTION: X509_REQ_print 603 EXIST::FUNCTION:BIO X509_REQ_print_fp 604 EXIST::FUNCTION:FP_API X509_REQ_set_pubkey 605 EXIST::FUNCTION: X509_REQ_set_subject_name 606 EXIST::FUNCTION: X509_REQ_set_version 607 EXIST::FUNCTION: X509_REQ_sign 608 EXIST::FUNCTION:EVP X509_REQ_to_X509 609 EXIST::FUNCTION: X509_REQ_verify 610 EXIST::FUNCTION:EVP X509_REVOKED_add_ext 611 EXIST::FUNCTION: X509_REVOKED_delete_ext 612 EXIST::FUNCTION: X509_REVOKED_free 613 EXIST::FUNCTION: X509_REVOKED_get_ext 614 EXIST::FUNCTION: X509_REVOKED_get_ext_by_NID 615 EXIST::FUNCTION: X509_REVOKED_get_ext_by_OBJ 616 EXIST::FUNCTION: X509_REVOKED_get_ext_by_critical 617 EXIST:!VMS:FUNCTION: X509_REVOKED_get_ext_by_critic 617 EXIST:VMS:FUNCTION: X509_REVOKED_get_ext_count 618 EXIST::FUNCTION: X509_REVOKED_new 619 EXIST::FUNCTION: X509_SIG_free 620 EXIST::FUNCTION: X509_SIG_new 621 EXIST::FUNCTION: X509_STORE_CTX_cleanup 622 EXIST::FUNCTION: X509_STORE_CTX_init 623 EXIST::FUNCTION: X509_STORE_add_cert 624 EXIST::FUNCTION: X509_STORE_add_lookup 625 EXIST::FUNCTION: X509_STORE_free 626 EXIST::FUNCTION: X509_STORE_get_by_subject 627 EXIST::FUNCTION: X509_STORE_load_locations 628 EXIST::FUNCTION:STDIO X509_STORE_new 629 EXIST::FUNCTION: X509_STORE_set_default_paths 630 EXIST::FUNCTION:STDIO X509_VAL_free 631 EXIST::FUNCTION: X509_VAL_new 632 EXIST::FUNCTION: X509_add_ext 633 EXIST::FUNCTION: X509_asn1_meth 634 NOEXIST::FUNCTION: X509_certificate_type 635 EXIST::FUNCTION: X509_check_private_key 636 EXIST::FUNCTION: X509_cmp_current_time 637 EXIST::FUNCTION: X509_delete_ext 638 EXIST::FUNCTION: X509_digest 639 EXIST::FUNCTION:EVP X509_dup 640 EXIST::FUNCTION: X509_free 641 EXIST::FUNCTION: X509_get_default_cert_area 642 EXIST::FUNCTION: X509_get_default_cert_dir 643 EXIST::FUNCTION: X509_get_default_cert_dir_env 644 EXIST::FUNCTION: X509_get_default_cert_file 645 EXIST::FUNCTION: X509_get_default_cert_file_env 646 EXIST::FUNCTION: X509_get_default_private_dir 647 EXIST::FUNCTION: X509_get_ext 648 EXIST::FUNCTION: X509_get_ext_by_NID 649 EXIST::FUNCTION: X509_get_ext_by_OBJ 650 EXIST::FUNCTION: X509_get_ext_by_critical 651 EXIST::FUNCTION: X509_get_ext_count 652 EXIST::FUNCTION: X509_get_issuer_name 653 EXIST::FUNCTION: X509_get_pubkey 654 EXIST::FUNCTION: X509_get_pubkey_parameters 655 EXIST::FUNCTION: X509_get_serialNumber 656 EXIST::FUNCTION: X509_get_subject_name 657 EXIST::FUNCTION: X509_gmtime_adj 658 EXIST::FUNCTION: X509_issuer_and_serial_cmp 659 EXIST::FUNCTION: X509_issuer_and_serial_hash 660 EXIST::FUNCTION: X509_issuer_name_cmp 661 EXIST::FUNCTION: X509_issuer_name_hash 662 EXIST::FUNCTION: X509_load_cert_file 663 EXIST::FUNCTION:STDIO X509_new 664 EXIST::FUNCTION: X509_print 665 EXIST::FUNCTION:BIO X509_print_fp 666 EXIST::FUNCTION:FP_API X509_set_issuer_name 667 EXIST::FUNCTION: X509_set_notAfter 668 EXIST::FUNCTION: X509_set_notBefore 669 EXIST::FUNCTION: X509_set_pubkey 670 EXIST::FUNCTION: X509_set_serialNumber 671 EXIST::FUNCTION: X509_set_subject_name 672 EXIST::FUNCTION: X509_set_version 673 EXIST::FUNCTION: X509_sign 674 EXIST::FUNCTION:EVP X509_subject_name_cmp 675 EXIST::FUNCTION: X509_subject_name_hash 676 EXIST::FUNCTION: X509_to_X509_REQ 677 EXIST::FUNCTION: X509_verify 678 EXIST::FUNCTION:EVP X509_verify_cert 679 EXIST::FUNCTION: X509_verify_cert_error_string 680 EXIST::FUNCTION: X509v3_add_ext 681 EXIST::FUNCTION: X509v3_add_extension 682 NOEXIST::FUNCTION: X509v3_add_netscape_extensions 683 NOEXIST::FUNCTION: X509v3_add_standard_extensions 684 NOEXIST::FUNCTION: X509v3_cleanup_extensions 685 NOEXIST::FUNCTION: X509v3_data_type_by_NID 686 NOEXIST::FUNCTION: X509v3_data_type_by_OBJ 687 NOEXIST::FUNCTION: X509v3_delete_ext 688 EXIST::FUNCTION: X509v3_get_ext 689 EXIST::FUNCTION: X509v3_get_ext_by_NID 690 EXIST::FUNCTION: X509v3_get_ext_by_OBJ 691 EXIST::FUNCTION: X509v3_get_ext_by_critical 692 EXIST::FUNCTION: X509v3_get_ext_count 693 EXIST::FUNCTION: X509v3_pack_string 694 NOEXIST::FUNCTION: X509v3_pack_type_by_NID 695 NOEXIST::FUNCTION: X509v3_pack_type_by_OBJ 696 NOEXIST::FUNCTION: X509v3_unpack_string 697 NOEXIST::FUNCTION: _des_crypt 698 NOEXIST::FUNCTION: a2d_ASN1_OBJECT 699 EXIST::FUNCTION: a2i_ASN1_INTEGER 700 EXIST::FUNCTION:BIO a2i_ASN1_STRING 701 EXIST::FUNCTION:BIO asn1_Finish 702 EXIST::FUNCTION: asn1_GetSequence 703 EXIST::FUNCTION: bn_div_words 704 EXIST::FUNCTION: bn_expand2 705 EXIST::FUNCTION: bn_mul_add_words 706 EXIST::FUNCTION: bn_mul_words 707 EXIST::FUNCTION: BN_uadd 708 EXIST::FUNCTION: BN_usub 709 EXIST::FUNCTION: bn_sqr_words 710 EXIST::FUNCTION: _ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION: d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION: d2i_ASN1_HEADER 714 NOEXIST::FUNCTION: d2i_ASN1_IA5STRING 715 EXIST::FUNCTION: d2i_ASN1_INTEGER 716 EXIST::FUNCTION: d2i_ASN1_OBJECT 717 EXIST::FUNCTION: d2i_ASN1_OCTET_STRING 718 EXIST::FUNCTION: d2i_ASN1_PRINTABLE 719 EXIST::FUNCTION: d2i_ASN1_PRINTABLESTRING 720 EXIST::FUNCTION: d2i_ASN1_SET 721 EXIST::FUNCTION: d2i_ASN1_T61STRING 722 EXIST::FUNCTION: d2i_ASN1_TYPE 723 EXIST::FUNCTION: d2i_ASN1_UTCTIME 724 EXIST::FUNCTION: d2i_ASN1_bytes 725 EXIST::FUNCTION: d2i_ASN1_type_bytes 726 EXIST::FUNCTION: d2i_DHparams 727 EXIST::FUNCTION:DH d2i_DSAPrivateKey 728 EXIST::FUNCTION:DSA d2i_DSAPrivateKey_bio 729 EXIST::FUNCTION:BIO,DSA d2i_DSAPrivateKey_fp 730 EXIST::FUNCTION:DSA,FP_API d2i_DSAPublicKey 731 EXIST::FUNCTION:DSA d2i_DSAparams 732 EXIST::FUNCTION:DSA d2i_NETSCAPE_SPKAC 733 EXIST::FUNCTION: d2i_NETSCAPE_SPKI 734 EXIST::FUNCTION: d2i_Netscape_RSA 735 EXIST::FUNCTION:RC4,RSA d2i_PKCS7 736 EXIST::FUNCTION: d2i_PKCS7_DIGEST 737 EXIST::FUNCTION: d2i_PKCS7_ENCRYPT 738 EXIST::FUNCTION: d2i_PKCS7_ENC_CONTENT 739 EXIST::FUNCTION: d2i_PKCS7_ENVELOPE 740 EXIST::FUNCTION: d2i_PKCS7_ISSUER_AND_SERIAL 741 EXIST::FUNCTION: d2i_PKCS7_RECIP_INFO 742 EXIST::FUNCTION: d2i_PKCS7_SIGNED 743 EXIST::FUNCTION: d2i_PKCS7_SIGNER_INFO 744 EXIST::FUNCTION: d2i_PKCS7_SIGN_ENVELOPE 745 EXIST::FUNCTION: d2i_PKCS7_bio 746 EXIST::FUNCTION: d2i_PKCS7_fp 747 EXIST::FUNCTION:FP_API d2i_PrivateKey 748 EXIST::FUNCTION: d2i_PublicKey 749 EXIST::FUNCTION: d2i_RSAPrivateKey 750 EXIST::FUNCTION:RSA d2i_RSAPrivateKey_bio 751 EXIST::FUNCTION:BIO,RSA d2i_RSAPrivateKey_fp 752 EXIST::FUNCTION:FP_API,RSA d2i_RSAPublicKey 753 EXIST::FUNCTION:RSA d2i_X509 754 EXIST::FUNCTION: d2i_X509_ALGOR 755 EXIST::FUNCTION: d2i_X509_ATTRIBUTE 756 EXIST::FUNCTION: d2i_X509_CINF 757 EXIST::FUNCTION: d2i_X509_CRL 758 EXIST::FUNCTION: d2i_X509_CRL_INFO 759 EXIST::FUNCTION: d2i_X509_CRL_bio 760 EXIST::FUNCTION:BIO d2i_X509_CRL_fp 761 EXIST::FUNCTION:FP_API d2i_X509_EXTENSION 762 EXIST::FUNCTION: d2i_X509_NAME 763 EXIST::FUNCTION: d2i_X509_NAME_ENTRY 764 EXIST::FUNCTION: d2i_X509_PKEY 765 EXIST::FUNCTION: d2i_X509_PUBKEY 766 EXIST::FUNCTION: d2i_X509_REQ 767 EXIST::FUNCTION: d2i_X509_REQ_INFO 768 EXIST::FUNCTION: d2i_X509_REQ_bio 769 EXIST::FUNCTION:BIO d2i_X509_REQ_fp 770 EXIST::FUNCTION:FP_API d2i_X509_REVOKED 771 EXIST::FUNCTION: d2i_X509_SIG 772 EXIST::FUNCTION: d2i_X509_VAL 773 EXIST::FUNCTION: d2i_X509_bio 774 EXIST::FUNCTION:BIO d2i_X509_fp 775 EXIST::FUNCTION:FP_API DES_cbc_cksum 777 EXIST::FUNCTION:DES DES_cbc_encrypt 778 EXIST::FUNCTION:DES DES_cblock_print_file 779 NOEXIST::FUNCTION: DES_cfb64_encrypt 780 EXIST::FUNCTION:DES DES_cfb_encrypt 781 EXIST::FUNCTION:DES DES_decrypt3 782 EXIST::FUNCTION:DES DES_ecb3_encrypt 783 EXIST::FUNCTION:DES DES_ecb_encrypt 784 EXIST::FUNCTION:DES DES_ede3_cbc_encrypt 785 EXIST::FUNCTION:DES DES_ede3_cfb64_encrypt 786 EXIST::FUNCTION:DES DES_ede3_ofb64_encrypt 787 EXIST::FUNCTION:DES DES_enc_read 788 EXIST::FUNCTION:DES DES_enc_write 789 EXIST::FUNCTION:DES DES_encrypt1 790 EXIST::FUNCTION:DES DES_encrypt2 791 EXIST::FUNCTION:DES DES_encrypt3 792 EXIST::FUNCTION:DES DES_fcrypt 793 EXIST::FUNCTION:DES DES_is_weak_key 794 EXIST::FUNCTION:DES DES_key_sched 795 EXIST::FUNCTION:DES DES_ncbc_encrypt 796 EXIST::FUNCTION:DES DES_ofb64_encrypt 797 EXIST::FUNCTION:DES DES_ofb_encrypt 798 EXIST::FUNCTION:DES DES_options 799 EXIST::FUNCTION:DES DES_pcbc_encrypt 800 EXIST::FUNCTION:DES DES_quad_cksum 801 EXIST::FUNCTION:DES DES_random_key 802 EXIST::FUNCTION:DES _ossl_old_des_random_seed 803 EXIST::FUNCTION:DES _ossl_old_des_read_2passwords 804 EXIST::FUNCTION:DES _ossl_old_des_read_password 805 EXIST::FUNCTION:DES _ossl_old_des_read_pw 806 EXIST::FUNCTION: _ossl_old_des_read_pw_string 807 EXIST::FUNCTION: DES_set_key 808 EXIST::FUNCTION:DES DES_set_odd_parity 809 EXIST::FUNCTION:DES DES_string_to_2keys 810 EXIST::FUNCTION:DES DES_string_to_key 811 EXIST::FUNCTION:DES DES_xcbc_encrypt 812 EXIST::FUNCTION:DES DES_xwhite_in2out 813 NOEXIST::FUNCTION: fcrypt_body 814 NOEXIST::FUNCTION: i2a_ASN1_INTEGER 815 EXIST::FUNCTION:BIO i2a_ASN1_OBJECT 816 EXIST::FUNCTION:BIO i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION: i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION: i2d_ASN1_HEADER 820 NOEXIST::FUNCTION: i2d_ASN1_IA5STRING 821 EXIST::FUNCTION: i2d_ASN1_INTEGER 822 EXIST::FUNCTION: i2d_ASN1_OBJECT 823 EXIST::FUNCTION: i2d_ASN1_OCTET_STRING 824 EXIST::FUNCTION: i2d_ASN1_PRINTABLE 825 EXIST::FUNCTION: i2d_ASN1_SET 826 EXIST::FUNCTION: i2d_ASN1_TYPE 827 EXIST::FUNCTION: i2d_ASN1_UTCTIME 828 EXIST::FUNCTION: i2d_ASN1_bytes 829 EXIST::FUNCTION: i2d_DHparams 830 EXIST::FUNCTION:DH i2d_DSAPrivateKey 831 EXIST::FUNCTION:DSA i2d_DSAPrivateKey_bio 832 EXIST::FUNCTION:BIO,DSA i2d_DSAPrivateKey_fp 833 EXIST::FUNCTION:DSA,FP_API i2d_DSAPublicKey 834 EXIST::FUNCTION:DSA i2d_DSAparams 835 EXIST::FUNCTION:DSA i2d_NETSCAPE_SPKAC 836 EXIST::FUNCTION: i2d_NETSCAPE_SPKI 837 EXIST::FUNCTION: i2d_Netscape_RSA 838 EXIST::FUNCTION:RC4,RSA i2d_PKCS7 839 EXIST::FUNCTION: i2d_PKCS7_DIGEST 840 EXIST::FUNCTION: i2d_PKCS7_ENCRYPT 841 EXIST::FUNCTION: i2d_PKCS7_ENC_CONTENT 842 EXIST::FUNCTION: i2d_PKCS7_ENVELOPE 843 EXIST::FUNCTION: i2d_PKCS7_ISSUER_AND_SERIAL 844 EXIST::FUNCTION: i2d_PKCS7_RECIP_INFO 845 EXIST::FUNCTION: i2d_PKCS7_SIGNED 846 EXIST::FUNCTION: i2d_PKCS7_SIGNER_INFO 847 EXIST::FUNCTION: i2d_PKCS7_SIGN_ENVELOPE 848 EXIST::FUNCTION: i2d_PKCS7_bio 849 EXIST::FUNCTION: i2d_PKCS7_fp 850 EXIST::FUNCTION:FP_API i2d_PrivateKey 851 EXIST::FUNCTION: i2d_PublicKey 852 EXIST::FUNCTION: i2d_RSAPrivateKey 853 EXIST::FUNCTION:RSA i2d_RSAPrivateKey_bio 854 EXIST::FUNCTION:BIO,RSA i2d_RSAPrivateKey_fp 855 EXIST::FUNCTION:FP_API,RSA i2d_RSAPublicKey 856 EXIST::FUNCTION:RSA i2d_X509 857 EXIST::FUNCTION: i2d_X509_ALGOR 858 EXIST::FUNCTION: i2d_X509_ATTRIBUTE 859 EXIST::FUNCTION: i2d_X509_CINF 860 EXIST::FUNCTION: i2d_X509_CRL 861 EXIST::FUNCTION: i2d_X509_CRL_INFO 862 EXIST::FUNCTION: i2d_X509_CRL_bio 863 EXIST::FUNCTION:BIO i2d_X509_CRL_fp 864 EXIST::FUNCTION:FP_API i2d_X509_EXTENSION 865 EXIST::FUNCTION: i2d_X509_NAME 866 EXIST::FUNCTION: i2d_X509_NAME_ENTRY 867 EXIST::FUNCTION: i2d_X509_PKEY 868 EXIST::FUNCTION: i2d_X509_PUBKEY 869 EXIST::FUNCTION: i2d_X509_REQ 870 EXIST::FUNCTION: i2d_X509_REQ_INFO 871 EXIST::FUNCTION: i2d_X509_REQ_bio 872 EXIST::FUNCTION:BIO i2d_X509_REQ_fp 873 EXIST::FUNCTION:FP_API i2d_X509_REVOKED 874 EXIST::FUNCTION: i2d_X509_SIG 875 EXIST::FUNCTION: i2d_X509_VAL 876 EXIST::FUNCTION: i2d_X509_bio 877 EXIST::FUNCTION:BIO i2d_X509_fp 878 EXIST::FUNCTION:FP_API idea_cbc_encrypt 879 EXIST::FUNCTION:IDEA idea_cfb64_encrypt 880 EXIST::FUNCTION:IDEA idea_ecb_encrypt 881 EXIST::FUNCTION:IDEA idea_encrypt 882 EXIST::FUNCTION:IDEA idea_ofb64_encrypt 883 EXIST::FUNCTION:IDEA idea_options 884 EXIST::FUNCTION:IDEA idea_set_decrypt_key 885 EXIST::FUNCTION:IDEA idea_set_encrypt_key 886 EXIST::FUNCTION:IDEA lh_delete 887 EXIST::FUNCTION: lh_doall 888 EXIST::FUNCTION: lh_doall_arg 889 EXIST::FUNCTION: lh_free 890 EXIST::FUNCTION: lh_insert 891 EXIST::FUNCTION: lh_new 892 EXIST::FUNCTION: lh_node_stats 893 EXIST::FUNCTION:FP_API lh_node_stats_bio 894 EXIST::FUNCTION:BIO lh_node_usage_stats 895 EXIST::FUNCTION:FP_API lh_node_usage_stats_bio 896 EXIST::FUNCTION:BIO lh_retrieve 897 EXIST::FUNCTION: lh_stats 898 EXIST::FUNCTION:FP_API lh_stats_bio 899 EXIST::FUNCTION:BIO lh_strhash 900 EXIST::FUNCTION: sk_delete 901 EXIST::FUNCTION: sk_delete_ptr 902 EXIST::FUNCTION: sk_dup 903 EXIST::FUNCTION: sk_find 904 EXIST::FUNCTION: sk_free 905 EXIST::FUNCTION: sk_insert 906 EXIST::FUNCTION: sk_new 907 EXIST::FUNCTION: sk_pop 908 EXIST::FUNCTION: sk_pop_free 909 EXIST::FUNCTION: sk_push 910 EXIST::FUNCTION: sk_set_cmp_func 911 EXIST::FUNCTION: sk_shift 912 EXIST::FUNCTION: sk_unshift 913 EXIST::FUNCTION: sk_zero 914 EXIST::FUNCTION: BIO_f_nbio_test 915 EXIST::FUNCTION: ASN1_TYPE_get 916 EXIST::FUNCTION: ASN1_TYPE_set 917 EXIST::FUNCTION: PKCS7_content_free 918 NOEXIST::FUNCTION: ERR_load_PKCS7_strings 919 EXIST::FUNCTION: X509_find_by_issuer_and_serial 920 EXIST::FUNCTION: X509_find_by_subject 921 EXIST::FUNCTION: PKCS7_ctrl 927 EXIST::FUNCTION: PKCS7_set_type 928 EXIST::FUNCTION: PKCS7_set_content 929 EXIST::FUNCTION: PKCS7_SIGNER_INFO_set 930 EXIST::FUNCTION: PKCS7_add_signer 931 EXIST::FUNCTION: PKCS7_add_certificate 932 EXIST::FUNCTION: PKCS7_add_crl 933 EXIST::FUNCTION: PKCS7_content_new 934 EXIST::FUNCTION: PKCS7_dataSign 935 NOEXIST::FUNCTION: PKCS7_dataVerify 936 EXIST::FUNCTION: PKCS7_dataInit 937 EXIST::FUNCTION: PKCS7_add_signature 938 EXIST::FUNCTION: PKCS7_cert_from_signer_info 939 EXIST::FUNCTION: PKCS7_get_signer_info 940 EXIST::FUNCTION: EVP_delete_alias 941 NOEXIST::FUNCTION: EVP_mdc2 942 EXIST::FUNCTION:MDC2 PEM_read_bio_RSAPublicKey 943 EXIST::FUNCTION:RSA PEM_write_bio_RSAPublicKey 944 EXIST::FUNCTION:RSA d2i_RSAPublicKey_bio 945 EXIST::FUNCTION:BIO,RSA i2d_RSAPublicKey_bio 946 EXIST::FUNCTION:BIO,RSA PEM_read_RSAPublicKey 947 EXIST:!WIN16:FUNCTION:RSA PEM_write_RSAPublicKey 949 EXIST:!WIN16:FUNCTION:RSA d2i_RSAPublicKey_fp 952 EXIST::FUNCTION:FP_API,RSA i2d_RSAPublicKey_fp 954 EXIST::FUNCTION:FP_API,RSA BIO_copy_next_retry 955 EXIST::FUNCTION: RSA_flags 956 EXIST::FUNCTION:RSA X509_STORE_add_crl 957 EXIST::FUNCTION: X509_load_crl_file 958 EXIST::FUNCTION:STDIO EVP_rc2_40_cbc 959 EXIST::FUNCTION:RC2 EVP_rc4_40 960 EXIST::FUNCTION:RC4 EVP_CIPHER_CTX_init 961 EXIST::FUNCTION: HMAC 962 EXIST::FUNCTION:HMAC HMAC_Init 963 EXIST::FUNCTION:HMAC HMAC_Update 964 EXIST::FUNCTION:HMAC HMAC_Final 965 EXIST::FUNCTION:HMAC ERR_get_next_error_library 966 EXIST::FUNCTION: EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION: HMAC_cleanup 968 NOEXIST::FUNCTION: BIO_ptr_ctrl 969 EXIST::FUNCTION: BIO_new_file_internal 970 NOEXIST::FUNCTION: BIO_new_fp_internal 971 NOEXIST::FUNCTION: BIO_s_file_internal 972 NOEXIST::FUNCTION: BN_BLINDING_convert 973 EXIST::FUNCTION: BN_BLINDING_invert 974 EXIST::FUNCTION: BN_BLINDING_update 975 EXIST::FUNCTION: RSA_blinding_on 977 EXIST::FUNCTION:RSA RSA_blinding_off 978 EXIST::FUNCTION:RSA i2t_ASN1_OBJECT 979 EXIST::FUNCTION: BN_BLINDING_new 980 EXIST::FUNCTION: BN_BLINDING_free 981 EXIST::FUNCTION: EVP_cast5_cbc 983 EXIST::FUNCTION:CAST EVP_cast5_cfb64 984 EXIST::FUNCTION:CAST EVP_cast5_ecb 985 EXIST::FUNCTION:CAST EVP_cast5_ofb 986 EXIST::FUNCTION:CAST BF_decrypt 987 EXIST::FUNCTION:BF CAST_set_key 988 EXIST::FUNCTION:CAST CAST_encrypt 989 EXIST::FUNCTION:CAST CAST_decrypt 990 EXIST::FUNCTION:CAST CAST_ecb_encrypt 991 EXIST::FUNCTION:CAST CAST_cbc_encrypt 992 EXIST::FUNCTION:CAST CAST_cfb64_encrypt 993 EXIST::FUNCTION:CAST CAST_ofb64_encrypt 994 EXIST::FUNCTION:CAST RC2_decrypt 995 EXIST::FUNCTION:RC2 OBJ_create_objects 997 EXIST::FUNCTION: BN_exp 998 EXIST::FUNCTION: BN_mul_word 999 EXIST::FUNCTION: BN_sub_word 1000 EXIST::FUNCTION: BN_dec2bn 1001 EXIST::FUNCTION: BN_bn2dec 1002 EXIST::FUNCTION: BIO_ghbn_ctrl 1003 NOEXIST::FUNCTION: CRYPTO_free_ex_data 1004 EXIST::FUNCTION: CRYPTO_get_ex_data 1005 EXIST::FUNCTION: CRYPTO_set_ex_data 1007 EXIST::FUNCTION: ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS:FUNCTION: ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS:FUNCTION: EVP_PKEY_bits 1010 EXIST::FUNCTION: MD5_Transform 1011 EXIST::FUNCTION:MD5 SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1 SHA_Transform 1013 EXIST::FUNCTION:SHA,SHA0 X509_STORE_CTX_get_chain 1014 EXIST::FUNCTION: X509_STORE_CTX_get_current_cert 1015 EXIST::FUNCTION: X509_STORE_CTX_get_error 1016 EXIST::FUNCTION: X509_STORE_CTX_get_error_depth 1017 EXIST::FUNCTION: X509_STORE_CTX_get_ex_data 1018 EXIST::FUNCTION: X509_STORE_CTX_set_cert 1020 EXIST::FUNCTION: X509_STORE_CTX_set_chain 1021 EXIST::FUNCTION: X509_STORE_CTX_set_error 1022 EXIST::FUNCTION: X509_STORE_CTX_set_ex_data 1023 EXIST::FUNCTION: CRYPTO_dup_ex_data 1025 EXIST::FUNCTION: CRYPTO_get_new_lockid 1026 EXIST::FUNCTION: CRYPTO_new_ex_data 1027 EXIST::FUNCTION: RSA_set_ex_data 1028 EXIST::FUNCTION:RSA RSA_get_ex_data 1029 EXIST::FUNCTION:RSA RSA_get_ex_new_index 1030 EXIST::FUNCTION:RSA RSA_padding_add_PKCS1_type_1 1031 EXIST::FUNCTION:RSA RSA_padding_add_PKCS1_type_2 1032 EXIST::FUNCTION:RSA RSA_padding_add_SSLv23 1033 EXIST::FUNCTION:RSA RSA_padding_add_none 1034 EXIST::FUNCTION:RSA RSA_padding_check_PKCS1_type_1 1035 EXIST::FUNCTION:RSA RSA_padding_check_PKCS1_type_2 1036 EXIST::FUNCTION:RSA RSA_padding_check_SSLv23 1037 EXIST::FUNCTION:RSA RSA_padding_check_none 1038 EXIST::FUNCTION:RSA bn_add_words 1039 EXIST::FUNCTION: d2i_Netscape_RSA_2 1040 NOEXIST::FUNCTION: CRYPTO_get_ex_new_index 1041 EXIST::FUNCTION: RIPEMD160_Init 1042 EXIST::FUNCTION:RIPEMD RIPEMD160_Update 1043 EXIST::FUNCTION:RIPEMD RIPEMD160_Final 1044 EXIST::FUNCTION:RIPEMD RIPEMD160 1045 EXIST::FUNCTION:RIPEMD RIPEMD160_Transform 1046 EXIST::FUNCTION:RIPEMD RC5_32_set_key 1047 EXIST::FUNCTION:RC5 RC5_32_ecb_encrypt 1048 EXIST::FUNCTION:RC5 RC5_32_encrypt 1049 EXIST::FUNCTION:RC5 RC5_32_decrypt 1050 EXIST::FUNCTION:RC5 RC5_32_cbc_encrypt 1051 EXIST::FUNCTION:RC5 RC5_32_cfb64_encrypt 1052 EXIST::FUNCTION:RC5 RC5_32_ofb64_encrypt 1053 EXIST::FUNCTION:RC5 BN_bn2mpi 1058 EXIST::FUNCTION: BN_mpi2bn 1059 EXIST::FUNCTION: ASN1_BIT_STRING_get_bit 1060 EXIST::FUNCTION: ASN1_BIT_STRING_set_bit 1061 EXIST::FUNCTION: BIO_get_ex_data 1062 EXIST::FUNCTION: BIO_get_ex_new_index 1063 EXIST::FUNCTION: BIO_set_ex_data 1064 EXIST::FUNCTION: X509v3_get_key_usage 1066 NOEXIST::FUNCTION: X509v3_set_key_usage 1067 NOEXIST::FUNCTION: a2i_X509v3_key_usage 1068 NOEXIST::FUNCTION: i2a_X509v3_key_usage 1069 NOEXIST::FUNCTION: EVP_PKEY_decrypt 1070 EXIST::FUNCTION: EVP_PKEY_encrypt 1071 EXIST::FUNCTION: PKCS7_RECIP_INFO_set 1072 EXIST::FUNCTION: PKCS7_add_recipient 1073 EXIST::FUNCTION: PKCS7_add_recipient_info 1074 EXIST::FUNCTION: PKCS7_set_cipher 1075 EXIST::FUNCTION: ASN1_TYPE_get_int_octetstring 1076 EXIST::FUNCTION: ASN1_TYPE_get_octetstring 1077 EXIST::FUNCTION: ASN1_TYPE_set_int_octetstring 1078 EXIST::FUNCTION: ASN1_TYPE_set_octetstring 1079 EXIST::FUNCTION: ASN1_UTCTIME_set_string 1080 EXIST::FUNCTION: ERR_add_error_data 1081 EXIST::FUNCTION: ERR_set_error_data 1082 EXIST::FUNCTION: EVP_CIPHER_asn1_to_param 1083 EXIST::FUNCTION: EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION: EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 EVP_rc5_32_12_16_cfb64 1088 EXIST::FUNCTION:RC5 EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 asn1_add_error 1091 EXIST::FUNCTION: d2i_ASN1_BMPSTRING 1092 EXIST::FUNCTION: i2d_ASN1_BMPSTRING 1093 EXIST::FUNCTION: BIO_f_ber 1094 NOEXIST::FUNCTION: BN_init 1095 EXIST::FUNCTION: COMP_CTX_new 1096 EXIST::FUNCTION:COMP COMP_CTX_free 1097 EXIST::FUNCTION:COMP COMP_CTX_compress_block 1098 NOEXIST::FUNCTION: COMP_CTX_expand_block 1099 NOEXIST::FUNCTION: X509_STORE_CTX_get_ex_new_index 1100 EXIST::FUNCTION: OBJ_NAME_add 1101 EXIST::FUNCTION: BIO_socket_nbio 1102 EXIST::FUNCTION: EVP_rc2_64_cbc 1103 EXIST::FUNCTION:RC2 OBJ_NAME_cleanup 1104 EXIST::FUNCTION: OBJ_NAME_get 1105 EXIST::FUNCTION: OBJ_NAME_init 1106 EXIST::FUNCTION: OBJ_NAME_new_index 1107 EXIST::FUNCTION: OBJ_NAME_remove 1108 EXIST::FUNCTION: BN_MONT_CTX_copy 1109 EXIST::FUNCTION: BIO_new_socks4a_connect 1110 NOEXIST::FUNCTION: BIO_s_socks4a_connect 1111 NOEXIST::FUNCTION: PROXY_set_connect_mode 1112 NOEXIST::FUNCTION: RAND_SSLeay 1113 EXIST::FUNCTION: RAND_set_rand_method 1114 EXIST::FUNCTION: RSA_memory_lock 1115 EXIST::FUNCTION:RSA bn_sub_words 1116 EXIST::FUNCTION: bn_mul_normal 1117 NOEXIST::FUNCTION: bn_mul_comba8 1118 NOEXIST::FUNCTION: bn_mul_comba4 1119 NOEXIST::FUNCTION: bn_sqr_normal 1120 NOEXIST::FUNCTION: bn_sqr_comba8 1121 NOEXIST::FUNCTION: bn_sqr_comba4 1122 NOEXIST::FUNCTION: bn_cmp_words 1123 NOEXIST::FUNCTION: bn_mul_recursive 1124 NOEXIST::FUNCTION: bn_mul_part_recursive 1125 NOEXIST::FUNCTION: bn_sqr_recursive 1126 NOEXIST::FUNCTION: bn_mul_low_normal 1127 NOEXIST::FUNCTION: BN_RECP_CTX_init 1128 EXIST::FUNCTION: BN_RECP_CTX_new 1129 EXIST::FUNCTION: BN_RECP_CTX_free 1130 EXIST::FUNCTION: BN_RECP_CTX_set 1131 EXIST::FUNCTION: BN_mod_mul_reciprocal 1132 EXIST::FUNCTION: BN_mod_exp_recp 1133 EXIST::FUNCTION: BN_div_recp 1134 EXIST::FUNCTION: BN_CTX_init 1135 EXIST::FUNCTION:DEPRECATED BN_MONT_CTX_init 1136 EXIST::FUNCTION: RAND_get_rand_method 1137 EXIST::FUNCTION: PKCS7_add_attribute 1138 EXIST::FUNCTION: PKCS7_add_signed_attribute 1139 EXIST::FUNCTION: PKCS7_digest_from_attributes 1140 EXIST::FUNCTION: PKCS7_get_attribute 1141 EXIST::FUNCTION: PKCS7_get_issuer_and_serial 1142 EXIST::FUNCTION: PKCS7_get_signed_attribute 1143 EXIST::FUNCTION: COMP_compress_block 1144 EXIST::FUNCTION:COMP COMP_expand_block 1145 EXIST::FUNCTION:COMP COMP_rle 1146 EXIST::FUNCTION:COMP COMP_zlib 1147 EXIST::FUNCTION:COMP ms_time_diff 1148 NOEXIST::FUNCTION: ms_time_new 1149 NOEXIST::FUNCTION: ms_time_free 1150 NOEXIST::FUNCTION: ms_time_cmp 1151 NOEXIST::FUNCTION: ms_time_get 1152 NOEXIST::FUNCTION: PKCS7_set_attributes 1153 EXIST::FUNCTION: PKCS7_set_signed_attributes 1154 EXIST::FUNCTION: X509_ATTRIBUTE_create 1155 EXIST::FUNCTION: X509_ATTRIBUTE_dup 1156 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_check 1157 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_print 1158 EXIST::FUNCTION:BIO ASN1_GENERALIZEDTIME_set 1159 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_set_string 1160 EXIST::FUNCTION: ASN1_TIME_print 1161 EXIST::FUNCTION:BIO BASIC_CONSTRAINTS_free 1162 EXIST::FUNCTION: BASIC_CONSTRAINTS_new 1163 EXIST::FUNCTION: ERR_load_X509V3_strings 1164 EXIST::FUNCTION: NETSCAPE_CERT_SEQUENCE_free 1165 EXIST::FUNCTION: NETSCAPE_CERT_SEQUENCE_new 1166 EXIST::FUNCTION: OBJ_txt2obj 1167 EXIST::FUNCTION: PEM_read_NETSCAPE_CERT_SEQUENCE 1168 EXIST:!VMS,!WIN16:FUNCTION: PEM_read_NS_CERT_SEQ 1168 EXIST:VMS:FUNCTION: PEM_read_bio_NETSCAPE_CERT_SEQUENCE 1169 EXIST:!VMS:FUNCTION: PEM_read_bio_NS_CERT_SEQ 1169 EXIST:VMS:FUNCTION: PEM_write_NETSCAPE_CERT_SEQUENCE 1170 EXIST:!VMS,!WIN16:FUNCTION: PEM_write_NS_CERT_SEQ 1170 EXIST:VMS:FUNCTION: PEM_write_bio_NETSCAPE_CERT_SEQUENCE 1171 EXIST:!VMS:FUNCTION: PEM_write_bio_NS_CERT_SEQ 1171 EXIST:VMS:FUNCTION: X509V3_EXT_add 1172 EXIST::FUNCTION: X509V3_EXT_add_alias 1173 EXIST::FUNCTION: X509V3_EXT_add_conf 1174 EXIST::FUNCTION: X509V3_EXT_cleanup 1175 EXIST::FUNCTION: X509V3_EXT_conf 1176 EXIST::FUNCTION: X509V3_EXT_conf_nid 1177 EXIST::FUNCTION: X509V3_EXT_get 1178 EXIST::FUNCTION: X509V3_EXT_get_nid 1179 EXIST::FUNCTION: X509V3_EXT_print 1180 EXIST::FUNCTION: X509V3_EXT_print_fp 1181 EXIST::FUNCTION: X509V3_add_standard_extensions 1182 EXIST::FUNCTION: X509V3_add_value 1183 EXIST::FUNCTION: X509V3_add_value_bool 1184 EXIST::FUNCTION: X509V3_add_value_int 1185 EXIST::FUNCTION: X509V3_conf_free 1186 EXIST::FUNCTION: X509V3_get_value_bool 1187 EXIST::FUNCTION: X509V3_get_value_int 1188 EXIST::FUNCTION: X509V3_parse_list 1189 EXIST::FUNCTION: d2i_ASN1_GENERALIZEDTIME 1190 EXIST::FUNCTION: d2i_ASN1_TIME 1191 EXIST::FUNCTION: d2i_BASIC_CONSTRAINTS 1192 EXIST::FUNCTION: d2i_NETSCAPE_CERT_SEQUENCE 1193 EXIST::FUNCTION: d2i_ext_ku 1194 NOEXIST::FUNCTION: ext_ku_free 1195 NOEXIST::FUNCTION: ext_ku_new 1196 NOEXIST::FUNCTION: i2d_ASN1_GENERALIZEDTIME 1197 EXIST::FUNCTION: i2d_ASN1_TIME 1198 EXIST::FUNCTION: i2d_BASIC_CONSTRAINTS 1199 EXIST::FUNCTION: i2d_NETSCAPE_CERT_SEQUENCE 1200 EXIST::FUNCTION: i2d_ext_ku 1201 NOEXIST::FUNCTION: EVP_MD_CTX_copy 1202 EXIST::FUNCTION: i2d_ASN1_ENUMERATED 1203 EXIST::FUNCTION: d2i_ASN1_ENUMERATED 1204 EXIST::FUNCTION: ASN1_ENUMERATED_set 1205 EXIST::FUNCTION: ASN1_ENUMERATED_get 1206 EXIST::FUNCTION: BN_to_ASN1_ENUMERATED 1207 EXIST::FUNCTION: ASN1_ENUMERATED_to_BN 1208 EXIST::FUNCTION: i2a_ASN1_ENUMERATED 1209 EXIST::FUNCTION:BIO a2i_ASN1_ENUMERATED 1210 EXIST::FUNCTION:BIO i2d_GENERAL_NAME 1211 EXIST::FUNCTION: d2i_GENERAL_NAME 1212 EXIST::FUNCTION: GENERAL_NAME_new 1213 EXIST::FUNCTION: GENERAL_NAME_free 1214 EXIST::FUNCTION: GENERAL_NAMES_new 1215 EXIST::FUNCTION: GENERAL_NAMES_free 1216 EXIST::FUNCTION: d2i_GENERAL_NAMES 1217 EXIST::FUNCTION: i2d_GENERAL_NAMES 1218 EXIST::FUNCTION: i2v_GENERAL_NAMES 1219 EXIST::FUNCTION: i2s_ASN1_OCTET_STRING 1220 EXIST::FUNCTION: s2i_ASN1_OCTET_STRING 1221 EXIST::FUNCTION: X509V3_EXT_check_conf 1222 NOEXIST::FUNCTION: hex_to_string 1223 EXIST::FUNCTION: string_to_hex 1224 EXIST::FUNCTION: DES_ede3_cbcm_encrypt 1225 EXIST::FUNCTION:DES RSA_padding_add_PKCS1_OAEP 1226 EXIST::FUNCTION:RSA RSA_padding_check_PKCS1_OAEP 1227 EXIST::FUNCTION:RSA X509_CRL_print_fp 1228 EXIST::FUNCTION:FP_API X509_CRL_print 1229 EXIST::FUNCTION:BIO i2v_GENERAL_NAME 1230 EXIST::FUNCTION: v2i_GENERAL_NAME 1231 EXIST::FUNCTION: i2d_PKEY_USAGE_PERIOD 1232 EXIST::FUNCTION: d2i_PKEY_USAGE_PERIOD 1233 EXIST::FUNCTION: PKEY_USAGE_PERIOD_new 1234 EXIST::FUNCTION: PKEY_USAGE_PERIOD_free 1235 EXIST::FUNCTION: v2i_GENERAL_NAMES 1236 EXIST::FUNCTION: i2s_ASN1_INTEGER 1237 EXIST::FUNCTION: X509V3_EXT_d2i 1238 EXIST::FUNCTION: name_cmp 1239 EXIST::FUNCTION: str_dup 1240 NOEXIST::FUNCTION: i2s_ASN1_ENUMERATED 1241 EXIST::FUNCTION: i2s_ASN1_ENUMERATED_TABLE 1242 EXIST::FUNCTION: BIO_s_log 1243 EXIST:!OS2,!WIN16,!WIN32,!macintosh:FUNCTION: BIO_f_reliable 1244 EXIST::FUNCTION:BIO PKCS7_dataFinal 1245 EXIST::FUNCTION: PKCS7_dataDecode 1246 EXIST::FUNCTION: X509V3_EXT_CRL_add_conf 1247 EXIST::FUNCTION: BN_set_params 1248 EXIST::FUNCTION:DEPRECATED BN_get_params 1249 EXIST::FUNCTION:DEPRECATED BIO_get_ex_num 1250 NOEXIST::FUNCTION: BIO_set_ex_free_func 1251 NOEXIST::FUNCTION: EVP_ripemd160 1252 EXIST::FUNCTION:RIPEMD ASN1_TIME_set 1253 EXIST::FUNCTION: i2d_AUTHORITY_KEYID 1254 EXIST::FUNCTION: d2i_AUTHORITY_KEYID 1255 EXIST::FUNCTION: AUTHORITY_KEYID_new 1256 EXIST::FUNCTION: AUTHORITY_KEYID_free 1257 EXIST::FUNCTION: ASN1_seq_unpack 1258 EXIST::FUNCTION: ASN1_seq_pack 1259 EXIST::FUNCTION: ASN1_unpack_string 1260 EXIST::FUNCTION: ASN1_pack_string 1261 EXIST::FUNCTION: PKCS12_pack_safebag 1262 NOEXIST::FUNCTION: PKCS12_MAKE_KEYBAG 1263 EXIST::FUNCTION: PKCS8_encrypt 1264 EXIST::FUNCTION: PKCS12_MAKE_SHKEYBAG 1265 EXIST::FUNCTION: PKCS12_pack_p7data 1266 EXIST::FUNCTION: PKCS12_pack_p7encdata 1267 EXIST::FUNCTION: PKCS12_add_localkeyid 1268 EXIST::FUNCTION: PKCS12_add_friendlyname_asc 1269 EXIST::FUNCTION: PKCS12_add_friendlyname_uni 1270 EXIST::FUNCTION: PKCS12_get_friendlyname 1271 EXIST::FUNCTION: PKCS12_pbe_crypt 1272 EXIST::FUNCTION: PKCS12_decrypt_d2i 1273 NOEXIST::FUNCTION: PKCS12_i2d_encrypt 1274 NOEXIST::FUNCTION: PKCS12_init 1275 EXIST::FUNCTION: PKCS12_key_gen_asc 1276 EXIST::FUNCTION: PKCS12_key_gen_uni 1277 EXIST::FUNCTION: PKCS12_gen_mac 1278 EXIST::FUNCTION: PKCS12_verify_mac 1279 EXIST::FUNCTION: PKCS12_set_mac 1280 EXIST::FUNCTION: PKCS12_setup_mac 1281 EXIST::FUNCTION: OPENSSL_asc2uni 1282 EXIST::FUNCTION: OPENSSL_uni2asc 1283 EXIST::FUNCTION: i2d_PKCS12_BAGS 1284 EXIST::FUNCTION: PKCS12_BAGS_new 1285 EXIST::FUNCTION: d2i_PKCS12_BAGS 1286 EXIST::FUNCTION: PKCS12_BAGS_free 1287 EXIST::FUNCTION: i2d_PKCS12 1288 EXIST::FUNCTION: d2i_PKCS12 1289 EXIST::FUNCTION: PKCS12_new 1290 EXIST::FUNCTION: PKCS12_free 1291 EXIST::FUNCTION: i2d_PKCS12_MAC_DATA 1292 EXIST::FUNCTION: PKCS12_MAC_DATA_new 1293 EXIST::FUNCTION: d2i_PKCS12_MAC_DATA 1294 EXIST::FUNCTION: PKCS12_MAC_DATA_free 1295 EXIST::FUNCTION: i2d_PKCS12_SAFEBAG 1296 EXIST::FUNCTION: PKCS12_SAFEBAG_new 1297 EXIST::FUNCTION: d2i_PKCS12_SAFEBAG 1298 EXIST::FUNCTION: PKCS12_SAFEBAG_free 1299 EXIST::FUNCTION: ERR_load_PKCS12_strings 1300 EXIST::FUNCTION: PKCS12_PBE_add 1301 EXIST::FUNCTION: PKCS8_add_keyusage 1302 EXIST::FUNCTION: PKCS12_get_attr_gen 1303 EXIST::FUNCTION: PKCS12_parse 1304 EXIST::FUNCTION: PKCS12_create 1305 EXIST::FUNCTION: i2d_PKCS12_bio 1306 EXIST::FUNCTION: i2d_PKCS12_fp 1307 EXIST::FUNCTION: d2i_PKCS12_bio 1308 EXIST::FUNCTION: d2i_PKCS12_fp 1309 EXIST::FUNCTION: i2d_PBEPARAM 1310 EXIST::FUNCTION: PBEPARAM_new 1311 EXIST::FUNCTION: d2i_PBEPARAM 1312 EXIST::FUNCTION: PBEPARAM_free 1313 EXIST::FUNCTION: i2d_PKCS8_PRIV_KEY_INFO 1314 EXIST::FUNCTION: PKCS8_PRIV_KEY_INFO_new 1315 EXIST::FUNCTION: d2i_PKCS8_PRIV_KEY_INFO 1316 EXIST::FUNCTION: PKCS8_PRIV_KEY_INFO_free 1317 EXIST::FUNCTION: EVP_PKCS82PKEY 1318 EXIST::FUNCTION: EVP_PKEY2PKCS8 1319 EXIST::FUNCTION: PKCS8_set_broken 1320 EXIST::FUNCTION: EVP_PBE_ALGOR_CipherInit 1321 NOEXIST::FUNCTION: EVP_PBE_alg_add 1322 EXIST::FUNCTION: PKCS5_pbe_set 1323 EXIST::FUNCTION: EVP_PBE_cleanup 1324 EXIST::FUNCTION: i2d_SXNET 1325 EXIST::FUNCTION: d2i_SXNET 1326 EXIST::FUNCTION: SXNET_new 1327 EXIST::FUNCTION: SXNET_free 1328 EXIST::FUNCTION: i2d_SXNETID 1329 EXIST::FUNCTION: d2i_SXNETID 1330 EXIST::FUNCTION: SXNETID_new 1331 EXIST::FUNCTION: SXNETID_free 1332 EXIST::FUNCTION: DSA_SIG_new 1333 EXIST::FUNCTION:DSA DSA_SIG_free 1334 EXIST::FUNCTION:DSA DSA_do_sign 1335 EXIST::FUNCTION:DSA DSA_do_verify 1336 EXIST::FUNCTION:DSA d2i_DSA_SIG 1337 EXIST::FUNCTION:DSA i2d_DSA_SIG 1338 EXIST::FUNCTION:DSA i2d_ASN1_VISIBLESTRING 1339 EXIST::FUNCTION: d2i_ASN1_VISIBLESTRING 1340 EXIST::FUNCTION: i2d_ASN1_UTF8STRING 1341 EXIST::FUNCTION: d2i_ASN1_UTF8STRING 1342 EXIST::FUNCTION: i2d_DIRECTORYSTRING 1343 EXIST::FUNCTION: d2i_DIRECTORYSTRING 1344 EXIST::FUNCTION: i2d_DISPLAYTEXT 1345 EXIST::FUNCTION: d2i_DISPLAYTEXT 1346 EXIST::FUNCTION: d2i_ASN1_SET_OF_X509 1379 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509 1380 NOEXIST::FUNCTION: i2d_PBKDF2PARAM 1397 EXIST::FUNCTION: PBKDF2PARAM_new 1398 EXIST::FUNCTION: d2i_PBKDF2PARAM 1399 EXIST::FUNCTION: PBKDF2PARAM_free 1400 EXIST::FUNCTION: i2d_PBE2PARAM 1401 EXIST::FUNCTION: PBE2PARAM_new 1402 EXIST::FUNCTION: d2i_PBE2PARAM 1403 EXIST::FUNCTION: PBE2PARAM_free 1404 EXIST::FUNCTION: d2i_ASN1_SET_OF_GENERAL_NAME 1421 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_GENERAL_NAME 1422 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_SXNETID 1439 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_SXNETID 1440 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_POLICYQUALINFO 1457 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_POLICYQUALINFO 1458 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_POLICYINFO 1475 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_POLICYINFO 1476 NOEXIST::FUNCTION: SXNET_add_id_asc 1477 EXIST::FUNCTION: SXNET_add_id_ulong 1478 EXIST::FUNCTION: SXNET_add_id_INTEGER 1479 EXIST::FUNCTION: SXNET_get_id_asc 1480 EXIST::FUNCTION: SXNET_get_id_ulong 1481 EXIST::FUNCTION: SXNET_get_id_INTEGER 1482 EXIST::FUNCTION: X509V3_set_conf_lhash 1483 EXIST::FUNCTION: i2d_CERTIFICATEPOLICIES 1484 EXIST::FUNCTION: CERTIFICATEPOLICIES_new 1485 EXIST::FUNCTION: CERTIFICATEPOLICIES_free 1486 EXIST::FUNCTION: d2i_CERTIFICATEPOLICIES 1487 EXIST::FUNCTION: i2d_POLICYINFO 1488 EXIST::FUNCTION: POLICYINFO_new 1489 EXIST::FUNCTION: d2i_POLICYINFO 1490 EXIST::FUNCTION: POLICYINFO_free 1491 EXIST::FUNCTION: i2d_POLICYQUALINFO 1492 EXIST::FUNCTION: POLICYQUALINFO_new 1493 EXIST::FUNCTION: d2i_POLICYQUALINFO 1494 EXIST::FUNCTION: POLICYQUALINFO_free 1495 EXIST::FUNCTION: i2d_USERNOTICE 1496 EXIST::FUNCTION: USERNOTICE_new 1497 EXIST::FUNCTION: d2i_USERNOTICE 1498 EXIST::FUNCTION: USERNOTICE_free 1499 EXIST::FUNCTION: i2d_NOTICEREF 1500 EXIST::FUNCTION: NOTICEREF_new 1501 EXIST::FUNCTION: d2i_NOTICEREF 1502 EXIST::FUNCTION: NOTICEREF_free 1503 EXIST::FUNCTION: X509V3_get_string 1504 EXIST::FUNCTION: X509V3_get_section 1505 EXIST::FUNCTION: X509V3_string_free 1506 EXIST::FUNCTION: X509V3_section_free 1507 EXIST::FUNCTION: X509V3_set_ctx 1508 EXIST::FUNCTION: s2i_ASN1_INTEGER 1509 EXIST::FUNCTION: CRYPTO_set_locked_mem_functions 1510 EXIST::FUNCTION: CRYPTO_get_locked_mem_functions 1511 EXIST::FUNCTION: CRYPTO_malloc_locked 1512 EXIST::FUNCTION: CRYPTO_free_locked 1513 EXIST::FUNCTION: BN_mod_exp2_mont 1514 EXIST::FUNCTION: ERR_get_error_line_data 1515 EXIST::FUNCTION: ERR_peek_error_line_data 1516 EXIST::FUNCTION: PKCS12_PBE_keyivgen 1517 EXIST::FUNCTION: X509_ALGOR_dup 1518 EXIST::FUNCTION: d2i_ASN1_SET_OF_DIST_POINT 1535 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_DIST_POINT 1536 NOEXIST::FUNCTION: i2d_CRL_DIST_POINTS 1537 EXIST::FUNCTION: CRL_DIST_POINTS_new 1538 EXIST::FUNCTION: CRL_DIST_POINTS_free 1539 EXIST::FUNCTION: d2i_CRL_DIST_POINTS 1540 EXIST::FUNCTION: i2d_DIST_POINT 1541 EXIST::FUNCTION: DIST_POINT_new 1542 EXIST::FUNCTION: d2i_DIST_POINT 1543 EXIST::FUNCTION: DIST_POINT_free 1544 EXIST::FUNCTION: i2d_DIST_POINT_NAME 1545 EXIST::FUNCTION: DIST_POINT_NAME_new 1546 EXIST::FUNCTION: DIST_POINT_NAME_free 1547 EXIST::FUNCTION: d2i_DIST_POINT_NAME 1548 EXIST::FUNCTION: X509V3_add_value_uchar 1549 EXIST::FUNCTION: d2i_ASN1_SET_OF_X509_ATTRIBUTE 1555 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_ASN1_TYPE 1560 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_X509_EXTENSION 1567 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_X509_NAME_ENTRY 1574 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_ASN1_TYPE 1589 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509_ATTRIBUTE 1615 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509_EXTENSION 1624 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509_NAME_ENTRY 1633 NOEXIST::FUNCTION: X509V3_EXT_i2d 1646 EXIST::FUNCTION: X509V3_EXT_val_prn 1647 EXIST::FUNCTION: X509V3_EXT_add_list 1648 EXIST::FUNCTION: EVP_CIPHER_type 1649 EXIST::FUNCTION: EVP_PBE_CipherInit 1650 EXIST::FUNCTION: X509V3_add_value_bool_nf 1651 EXIST::FUNCTION: d2i_ASN1_UINTEGER 1652 EXIST::FUNCTION: sk_value 1653 EXIST::FUNCTION: sk_num 1654 EXIST::FUNCTION: sk_set 1655 EXIST::FUNCTION: i2d_ASN1_SET_OF_X509_REVOKED 1661 NOEXIST::FUNCTION: sk_sort 1671 EXIST::FUNCTION: d2i_ASN1_SET_OF_X509_REVOKED 1674 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509_ALGOR 1682 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_X509_CRL 1685 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_X509_ALGOR 1696 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_X509_CRL 1702 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO 1723 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_PKCS7_RECIP_INFO 1738 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO 1748 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_PKCS7_RECIP_INFO 1753 NOEXIST::FUNCTION: PKCS5_PBE_add 1775 EXIST::FUNCTION: PEM_write_bio_PKCS8 1776 EXIST::FUNCTION: i2d_PKCS8_fp 1777 EXIST::FUNCTION:FP_API PEM_read_bio_PKCS8_PRIV_KEY_INFO 1778 EXIST:!VMS:FUNCTION: PEM_read_bio_P8_PRIV_KEY_INFO 1778 EXIST:VMS:FUNCTION: d2i_PKCS8_bio 1779 EXIST::FUNCTION:BIO d2i_PKCS8_PRIV_KEY_INFO_fp 1780 EXIST::FUNCTION:FP_API PEM_write_bio_PKCS8_PRIV_KEY_INFO 1781 EXIST:!VMS:FUNCTION: PEM_write_bio_P8_PRIV_KEY_INFO 1781 EXIST:VMS:FUNCTION: PEM_read_PKCS8 1782 EXIST:!WIN16:FUNCTION: d2i_PKCS8_PRIV_KEY_INFO_bio 1783 EXIST::FUNCTION:BIO d2i_PKCS8_fp 1784 EXIST::FUNCTION:FP_API PEM_write_PKCS8 1785 EXIST:!WIN16:FUNCTION: PEM_read_PKCS8_PRIV_KEY_INFO 1786 EXIST:!VMS,!WIN16:FUNCTION: PEM_read_P8_PRIV_KEY_INFO 1786 EXIST:VMS:FUNCTION: PEM_read_bio_PKCS8 1787 EXIST::FUNCTION: PEM_write_PKCS8_PRIV_KEY_INFO 1788 EXIST:!VMS,!WIN16:FUNCTION: PEM_write_P8_PRIV_KEY_INFO 1788 EXIST:VMS:FUNCTION: PKCS5_PBE_keyivgen 1789 EXIST::FUNCTION: i2d_PKCS8_bio 1790 EXIST::FUNCTION:BIO i2d_PKCS8_PRIV_KEY_INFO_fp 1791 EXIST::FUNCTION:FP_API i2d_PKCS8_PRIV_KEY_INFO_bio 1792 EXIST::FUNCTION:BIO BIO_s_bio 1793 EXIST::FUNCTION: PKCS5_pbe2_set 1794 EXIST::FUNCTION: PKCS5_PBKDF2_HMAC_SHA1 1795 EXIST::FUNCTION: PKCS5_v2_PBE_keyivgen 1796 EXIST::FUNCTION: PEM_write_bio_PKCS8PrivateKey 1797 EXIST::FUNCTION: PEM_write_PKCS8PrivateKey 1798 EXIST::FUNCTION: BIO_ctrl_get_read_request 1799 EXIST::FUNCTION: BIO_ctrl_pending 1800 EXIST::FUNCTION: BIO_ctrl_wpending 1801 EXIST::FUNCTION: BIO_new_bio_pair 1802 EXIST::FUNCTION: BIO_ctrl_get_write_guarantee 1803 EXIST::FUNCTION: CRYPTO_num_locks 1804 EXIST::FUNCTION: CONF_load_bio 1805 EXIST::FUNCTION: CONF_load_fp 1806 EXIST::FUNCTION:FP_API i2d_ASN1_SET_OF_ASN1_OBJECT 1837 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_ASN1_OBJECT 1844 NOEXIST::FUNCTION: PKCS7_signatureVerify 1845 EXIST::FUNCTION: RSA_set_method 1846 EXIST::FUNCTION:RSA RSA_get_method 1847 EXIST::FUNCTION:RSA RSA_get_default_method 1848 EXIST::FUNCTION:RSA RSA_check_key 1869 EXIST::FUNCTION:RSA OBJ_obj2txt 1870 EXIST::FUNCTION: DSA_dup_DH 1871 EXIST::FUNCTION:DH,DSA X509_REQ_get_extensions 1872 EXIST::FUNCTION: X509_REQ_set_extension_nids 1873 EXIST::FUNCTION: BIO_nwrite 1874 EXIST::FUNCTION: X509_REQ_extension_nid 1875 EXIST::FUNCTION: BIO_nread 1876 EXIST::FUNCTION: X509_REQ_get_extension_nids 1877 EXIST::FUNCTION: BIO_nwrite0 1878 EXIST::FUNCTION: X509_REQ_add_extensions_nid 1879 EXIST::FUNCTION: BIO_nread0 1880 EXIST::FUNCTION: X509_REQ_add_extensions 1881 EXIST::FUNCTION: BIO_new_mem_buf 1882 EXIST::FUNCTION: DH_set_ex_data 1883 EXIST::FUNCTION:DH DH_set_method 1884 EXIST::FUNCTION:DH DSA_OpenSSL 1885 EXIST::FUNCTION:DSA DH_get_ex_data 1886 EXIST::FUNCTION:DH DH_get_ex_new_index 1887 EXIST::FUNCTION:DH DSA_new_method 1888 EXIST::FUNCTION:DSA DH_new_method 1889 EXIST::FUNCTION:DH DH_OpenSSL 1890 EXIST::FUNCTION:DH DSA_get_ex_new_index 1891 EXIST::FUNCTION:DSA DH_get_default_method 1892 EXIST::FUNCTION:DH DSA_set_ex_data 1893 EXIST::FUNCTION:DSA DH_set_default_method 1894 EXIST::FUNCTION:DH DSA_get_ex_data 1895 EXIST::FUNCTION:DSA X509V3_EXT_REQ_add_conf 1896 EXIST::FUNCTION: NETSCAPE_SPKI_print 1897 EXIST::FUNCTION:EVP NETSCAPE_SPKI_set_pubkey 1898 EXIST::FUNCTION:EVP NETSCAPE_SPKI_b64_encode 1899 EXIST::FUNCTION:EVP NETSCAPE_SPKI_get_pubkey 1900 EXIST::FUNCTION:EVP NETSCAPE_SPKI_b64_decode 1901 EXIST::FUNCTION:EVP UTF8_putc 1902 EXIST::FUNCTION: UTF8_getc 1903 EXIST::FUNCTION: RSA_null_method 1904 EXIST::FUNCTION:RSA ASN1_tag2str 1905 EXIST::FUNCTION: BIO_ctrl_reset_read_request 1906 EXIST::FUNCTION: DISPLAYTEXT_new 1907 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_free 1908 EXIST::FUNCTION: X509_REVOKED_get_ext_d2i 1909 EXIST::FUNCTION: X509_set_ex_data 1910 EXIST::FUNCTION: X509_reject_set_bit_asc 1911 NOEXIST::FUNCTION: X509_NAME_add_entry_by_txt 1912 EXIST::FUNCTION: X509_NAME_add_entry_by_NID 1914 EXIST::FUNCTION: X509_PURPOSE_get0 1915 EXIST::FUNCTION: PEM_read_X509_AUX 1917 EXIST:!WIN16:FUNCTION: d2i_AUTHORITY_INFO_ACCESS 1918 EXIST::FUNCTION: PEM_write_PUBKEY 1921 EXIST:!WIN16:FUNCTION: ACCESS_DESCRIPTION_new 1925 EXIST::FUNCTION: X509_CERT_AUX_free 1926 EXIST::FUNCTION: d2i_ACCESS_DESCRIPTION 1927 EXIST::FUNCTION: X509_trust_clear 1928 EXIST::FUNCTION: X509_TRUST_add 1931 EXIST::FUNCTION: ASN1_VISIBLESTRING_new 1932 EXIST::FUNCTION: X509_alias_set1 1933 EXIST::FUNCTION: ASN1_PRINTABLESTRING_free 1934 EXIST::FUNCTION: EVP_PKEY_get1_DSA 1935 EXIST::FUNCTION:DSA ASN1_BMPSTRING_new 1936 EXIST::FUNCTION: ASN1_mbstring_copy 1937 EXIST::FUNCTION: ASN1_UTF8STRING_new 1938 EXIST::FUNCTION: DSA_get_default_method 1941 EXIST::FUNCTION:DSA i2d_ASN1_SET_OF_ACCESS_DESCRIPTION 1945 NOEXIST::FUNCTION: ASN1_T61STRING_free 1946 EXIST::FUNCTION: DSA_set_method 1949 EXIST::FUNCTION:DSA X509_get_ex_data 1950 EXIST::FUNCTION: ASN1_STRING_type 1951 EXIST::FUNCTION: X509_PURPOSE_get_by_sname 1952 EXIST::FUNCTION: ASN1_TIME_free 1954 EXIST::FUNCTION: ASN1_OCTET_STRING_cmp 1955 EXIST::FUNCTION: ASN1_BIT_STRING_new 1957 EXIST::FUNCTION: X509_get_ext_d2i 1958 EXIST::FUNCTION: PEM_read_bio_X509_AUX 1959 EXIST::FUNCTION: ASN1_STRING_set_default_mask_asc 1960 EXIST:!VMS:FUNCTION: ASN1_STRING_set_def_mask_asc 1960 EXIST:VMS:FUNCTION: PEM_write_bio_RSA_PUBKEY 1961 EXIST::FUNCTION:RSA ASN1_INTEGER_cmp 1963 EXIST::FUNCTION: d2i_RSA_PUBKEY_fp 1964 EXIST::FUNCTION:FP_API,RSA X509_trust_set_bit_asc 1967 NOEXIST::FUNCTION: PEM_write_bio_DSA_PUBKEY 1968 EXIST::FUNCTION:DSA X509_STORE_CTX_free 1969 EXIST::FUNCTION: EVP_PKEY_set1_DSA 1970 EXIST::FUNCTION:DSA i2d_DSA_PUBKEY_fp 1971 EXIST::FUNCTION:DSA,FP_API X509_load_cert_crl_file 1972 EXIST::FUNCTION:STDIO ASN1_TIME_new 1973 EXIST::FUNCTION: i2d_RSA_PUBKEY 1974 EXIST::FUNCTION:RSA X509_STORE_CTX_purpose_inherit 1976 EXIST::FUNCTION: PEM_read_RSA_PUBKEY 1977 EXIST:!WIN16:FUNCTION:RSA d2i_X509_AUX 1980 EXIST::FUNCTION: i2d_DSA_PUBKEY 1981 EXIST::FUNCTION:DSA X509_CERT_AUX_print 1982 EXIST::FUNCTION:BIO PEM_read_DSA_PUBKEY 1984 EXIST:!WIN16:FUNCTION:DSA i2d_RSA_PUBKEY_bio 1985 EXIST::FUNCTION:BIO,RSA ASN1_BIT_STRING_num_asc 1986 EXIST::FUNCTION: i2d_PUBKEY 1987 EXIST::FUNCTION: ASN1_UTCTIME_free 1988 EXIST::FUNCTION: DSA_set_default_method 1989 EXIST::FUNCTION:DSA X509_PURPOSE_get_by_id 1990 EXIST::FUNCTION: ACCESS_DESCRIPTION_free 1994 EXIST::FUNCTION: PEM_read_bio_PUBKEY 1995 EXIST::FUNCTION: ASN1_STRING_set_by_NID 1996 EXIST::FUNCTION: X509_PURPOSE_get_id 1997 EXIST::FUNCTION: DISPLAYTEXT_free 1998 EXIST::FUNCTION: OTHERNAME_new 1999 EXIST::FUNCTION: X509_CERT_AUX_new 2001 EXIST::FUNCTION: X509_TRUST_cleanup 2007 EXIST::FUNCTION: X509_NAME_add_entry_by_OBJ 2008 EXIST::FUNCTION: X509_CRL_get_ext_d2i 2009 EXIST::FUNCTION: X509_PURPOSE_get0_name 2011 EXIST::FUNCTION: PEM_read_PUBKEY 2012 EXIST:!WIN16:FUNCTION: i2d_DSA_PUBKEY_bio 2014 EXIST::FUNCTION:BIO,DSA i2d_OTHERNAME 2015 EXIST::FUNCTION: ASN1_OCTET_STRING_free 2016 EXIST::FUNCTION: ASN1_BIT_STRING_set_asc 2017 EXIST::FUNCTION: X509_get_ex_new_index 2019 EXIST::FUNCTION: ASN1_STRING_TABLE_cleanup 2020 EXIST::FUNCTION: X509_TRUST_get_by_id 2021 EXIST::FUNCTION: X509_PURPOSE_get_trust 2022 EXIST::FUNCTION: ASN1_STRING_length 2023 EXIST::FUNCTION: d2i_ASN1_SET_OF_ACCESS_DESCRIPTION 2024 NOEXIST::FUNCTION: ASN1_PRINTABLESTRING_new 2025 EXIST::FUNCTION: X509V3_get_d2i 2026 EXIST::FUNCTION: ASN1_ENUMERATED_free 2027 EXIST::FUNCTION: i2d_X509_CERT_AUX 2028 EXIST::FUNCTION: X509_STORE_CTX_set_trust 2030 EXIST::FUNCTION: ASN1_STRING_set_default_mask 2032 EXIST::FUNCTION: X509_STORE_CTX_new 2033 EXIST::FUNCTION: EVP_PKEY_get1_RSA 2034 EXIST::FUNCTION:RSA DIRECTORYSTRING_free 2038 EXIST::FUNCTION: PEM_write_X509_AUX 2039 EXIST:!WIN16:FUNCTION: ASN1_OCTET_STRING_set 2040 EXIST::FUNCTION: d2i_DSA_PUBKEY_fp 2041 EXIST::FUNCTION:DSA,FP_API d2i_RSA_PUBKEY 2044 EXIST::FUNCTION:RSA X509_TRUST_get0_name 2046 EXIST::FUNCTION: X509_TRUST_get0 2047 EXIST::FUNCTION: AUTHORITY_INFO_ACCESS_free 2048 EXIST::FUNCTION: ASN1_IA5STRING_new 2049 EXIST::FUNCTION: d2i_DSA_PUBKEY 2050 EXIST::FUNCTION:DSA X509_check_purpose 2051 EXIST::FUNCTION: ASN1_ENUMERATED_new 2052 EXIST::FUNCTION: d2i_RSA_PUBKEY_bio 2053 EXIST::FUNCTION:BIO,RSA d2i_PUBKEY 2054 EXIST::FUNCTION: X509_TRUST_get_trust 2055 EXIST::FUNCTION: X509_TRUST_get_flags 2056 EXIST::FUNCTION: ASN1_BMPSTRING_free 2057 EXIST::FUNCTION: ASN1_T61STRING_new 2058 EXIST::FUNCTION: ASN1_UTCTIME_new 2060 EXIST::FUNCTION: i2d_AUTHORITY_INFO_ACCESS 2062 EXIST::FUNCTION: EVP_PKEY_set1_RSA 2063 EXIST::FUNCTION:RSA X509_STORE_CTX_set_purpose 2064 EXIST::FUNCTION: ASN1_IA5STRING_free 2065 EXIST::FUNCTION: PEM_write_bio_X509_AUX 2066 EXIST::FUNCTION: X509_PURPOSE_get_count 2067 EXIST::FUNCTION: CRYPTO_add_info 2068 NOEXIST::FUNCTION: X509_NAME_ENTRY_create_by_txt 2071 EXIST::FUNCTION: ASN1_STRING_get_default_mask 2072 EXIST::FUNCTION: X509_alias_get0 2074 EXIST::FUNCTION: ASN1_STRING_data 2075 EXIST::FUNCTION: i2d_ACCESS_DESCRIPTION 2077 EXIST::FUNCTION: X509_trust_set_bit 2078 NOEXIST::FUNCTION: ASN1_BIT_STRING_free 2080 EXIST::FUNCTION: PEM_read_bio_RSA_PUBKEY 2081 EXIST::FUNCTION:RSA X509_add1_reject_object 2082 EXIST::FUNCTION: X509_check_trust 2083 EXIST::FUNCTION: PEM_read_bio_DSA_PUBKEY 2088 EXIST::FUNCTION:DSA X509_PURPOSE_add 2090 EXIST::FUNCTION: ASN1_STRING_TABLE_get 2091 EXIST::FUNCTION: ASN1_UTF8STRING_free 2092 EXIST::FUNCTION: d2i_DSA_PUBKEY_bio 2093 EXIST::FUNCTION:BIO,DSA PEM_write_RSA_PUBKEY 2095 EXIST:!WIN16:FUNCTION:RSA d2i_OTHERNAME 2096 EXIST::FUNCTION: X509_reject_set_bit 2098 NOEXIST::FUNCTION: PEM_write_DSA_PUBKEY 2101 EXIST:!WIN16:FUNCTION:DSA X509_PURPOSE_get0_sname 2105 EXIST::FUNCTION: EVP_PKEY_set1_DH 2107 EXIST::FUNCTION:DH ASN1_OCTET_STRING_dup 2108 EXIST::FUNCTION: ASN1_BIT_STRING_set 2109 EXIST::FUNCTION: X509_TRUST_get_count 2110 EXIST::FUNCTION: ASN1_INTEGER_free 2111 EXIST::FUNCTION: OTHERNAME_free 2112 EXIST::FUNCTION: i2d_RSA_PUBKEY_fp 2113 EXIST::FUNCTION:FP_API,RSA ASN1_INTEGER_dup 2114 EXIST::FUNCTION: d2i_X509_CERT_AUX 2115 EXIST::FUNCTION: PEM_write_bio_PUBKEY 2117 EXIST::FUNCTION: ASN1_VISIBLESTRING_free 2118 EXIST::FUNCTION: X509_PURPOSE_cleanup 2119 EXIST::FUNCTION: ASN1_mbstring_ncopy 2123 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_new 2126 EXIST::FUNCTION: EVP_PKEY_get1_DH 2128 EXIST::FUNCTION:DH ASN1_OCTET_STRING_new 2130 EXIST::FUNCTION: ASN1_INTEGER_new 2131 EXIST::FUNCTION: i2d_X509_AUX 2132 EXIST::FUNCTION: ASN1_BIT_STRING_name_print 2134 EXIST::FUNCTION:BIO X509_cmp 2135 EXIST::FUNCTION: ASN1_STRING_length_set 2136 EXIST::FUNCTION: DIRECTORYSTRING_new 2137 EXIST::FUNCTION: X509_add1_trust_object 2140 EXIST::FUNCTION: PKCS12_newpass 2141 EXIST::FUNCTION: SMIME_write_PKCS7 2142 EXIST::FUNCTION: SMIME_read_PKCS7 2143 EXIST::FUNCTION: DES_set_key_checked 2144 EXIST::FUNCTION:DES PKCS7_verify 2145 EXIST::FUNCTION: PKCS7_encrypt 2146 EXIST::FUNCTION: DES_set_key_unchecked 2147 EXIST::FUNCTION:DES SMIME_crlf_copy 2148 EXIST::FUNCTION: i2d_ASN1_PRINTABLESTRING 2149 EXIST::FUNCTION: PKCS7_get0_signers 2150 EXIST::FUNCTION: PKCS7_decrypt 2151 EXIST::FUNCTION: SMIME_text 2152 EXIST::FUNCTION: PKCS7_simple_smimecap 2153 EXIST::FUNCTION: PKCS7_get_smimecap 2154 EXIST::FUNCTION: PKCS7_sign 2155 EXIST::FUNCTION: PKCS7_add_attrib_smimecap 2156 EXIST::FUNCTION: CRYPTO_dbg_set_options 2157 EXIST::FUNCTION: CRYPTO_remove_all_info 2158 EXIST::FUNCTION: CRYPTO_get_mem_debug_functions 2159 EXIST::FUNCTION: CRYPTO_is_mem_check_on 2160 EXIST::FUNCTION: CRYPTO_set_mem_debug_functions 2161 EXIST::FUNCTION: CRYPTO_pop_info 2162 EXIST::FUNCTION: CRYPTO_push_info_ 2163 EXIST::FUNCTION: CRYPTO_set_mem_debug_options 2164 EXIST::FUNCTION: PEM_write_PKCS8PrivateKey_nid 2165 EXIST::FUNCTION: PEM_write_bio_PKCS8PrivateKey_nid 2166 EXIST:!VMS:FUNCTION: PEM_write_bio_PKCS8PrivKey_nid 2166 EXIST:VMS:FUNCTION: d2i_PKCS8PrivateKey_bio 2167 EXIST::FUNCTION: ASN1_NULL_free 2168 EXIST::FUNCTION: d2i_ASN1_NULL 2169 EXIST::FUNCTION: ASN1_NULL_new 2170 EXIST::FUNCTION: i2d_PKCS8PrivateKey_bio 2171 EXIST::FUNCTION: i2d_PKCS8PrivateKey_fp 2172 EXIST::FUNCTION: i2d_ASN1_NULL 2173 EXIST::FUNCTION: i2d_PKCS8PrivateKey_nid_fp 2174 EXIST::FUNCTION: d2i_PKCS8PrivateKey_fp 2175 EXIST::FUNCTION: i2d_PKCS8PrivateKey_nid_bio 2176 EXIST::FUNCTION: i2d_PKCS8PrivateKeyInfo_fp 2177 EXIST::FUNCTION:FP_API i2d_PKCS8PrivateKeyInfo_bio 2178 EXIST::FUNCTION:BIO PEM_cb 2179 NOEXIST::FUNCTION: i2d_PrivateKey_fp 2180 EXIST::FUNCTION:FP_API d2i_PrivateKey_bio 2181 EXIST::FUNCTION:BIO d2i_PrivateKey_fp 2182 EXIST::FUNCTION:FP_API i2d_PrivateKey_bio 2183 EXIST::FUNCTION:BIO X509_reject_clear 2184 EXIST::FUNCTION: X509_TRUST_set_default 2185 EXIST::FUNCTION: d2i_AutoPrivateKey 2186 EXIST::FUNCTION: X509_ATTRIBUTE_get0_type 2187 EXIST::FUNCTION: X509_ATTRIBUTE_set1_data 2188 EXIST::FUNCTION: X509at_get_attr 2189 EXIST::FUNCTION: X509at_get_attr_count 2190 EXIST::FUNCTION: X509_ATTRIBUTE_create_by_NID 2191 EXIST::FUNCTION: X509_ATTRIBUTE_set1_object 2192 EXIST::FUNCTION: X509_ATTRIBUTE_count 2193 EXIST::FUNCTION: X509_ATTRIBUTE_create_by_OBJ 2194 EXIST::FUNCTION: X509_ATTRIBUTE_get0_object 2195 EXIST::FUNCTION: X509at_get_attr_by_NID 2196 EXIST::FUNCTION: X509at_add1_attr 2197 EXIST::FUNCTION: X509_ATTRIBUTE_get0_data 2198 EXIST::FUNCTION: X509at_delete_attr 2199 EXIST::FUNCTION: X509at_get_attr_by_OBJ 2200 EXIST::FUNCTION: RAND_add 2201 EXIST::FUNCTION: BIO_number_written 2202 EXIST::FUNCTION: BIO_number_read 2203 EXIST::FUNCTION: X509_STORE_CTX_get1_chain 2204 EXIST::FUNCTION: ERR_load_RAND_strings 2205 EXIST::FUNCTION: RAND_pseudo_bytes 2206 EXIST::FUNCTION: X509_REQ_get_attr_by_NID 2207 EXIST::FUNCTION: X509_REQ_get_attr 2208 EXIST::FUNCTION: X509_REQ_add1_attr_by_NID 2209 EXIST::FUNCTION: X509_REQ_get_attr_by_OBJ 2210 EXIST::FUNCTION: X509at_add1_attr_by_NID 2211 EXIST::FUNCTION: X509_REQ_add1_attr_by_OBJ 2212 EXIST::FUNCTION: X509_REQ_get_attr_count 2213 EXIST::FUNCTION: X509_REQ_add1_attr 2214 EXIST::FUNCTION: X509_REQ_delete_attr 2215 EXIST::FUNCTION: X509at_add1_attr_by_OBJ 2216 EXIST::FUNCTION: X509_REQ_add1_attr_by_txt 2217 EXIST::FUNCTION: X509_ATTRIBUTE_create_by_txt 2218 EXIST::FUNCTION: X509at_add1_attr_by_txt 2219 EXIST::FUNCTION: BN_pseudo_rand 2239 EXIST::FUNCTION: BN_is_prime_fasttest 2240 EXIST::FUNCTION:DEPRECATED BN_CTX_end 2241 EXIST::FUNCTION: BN_CTX_start 2242 EXIST::FUNCTION: BN_CTX_get 2243 EXIST::FUNCTION: EVP_PKEY2PKCS8_broken 2244 EXIST::FUNCTION: ASN1_STRING_TABLE_add 2245 EXIST::FUNCTION: CRYPTO_dbg_get_options 2246 EXIST::FUNCTION: AUTHORITY_INFO_ACCESS_new 2247 EXIST::FUNCTION: CRYPTO_get_mem_debug_options 2248 EXIST::FUNCTION: DES_crypt 2249 EXIST::FUNCTION:DES PEM_write_bio_X509_REQ_NEW 2250 EXIST::FUNCTION: PEM_write_X509_REQ_NEW 2251 EXIST:!WIN16:FUNCTION: BIO_callback_ctrl 2252 EXIST::FUNCTION: RAND_egd 2253 EXIST::FUNCTION: RAND_status 2254 EXIST::FUNCTION: bn_dump1 2255 NOEXIST::FUNCTION: DES_check_key_parity 2256 EXIST::FUNCTION:DES lh_num_items 2257 EXIST::FUNCTION: RAND_event 2258 EXIST:WIN32:FUNCTION: DSO_new 2259 EXIST::FUNCTION: DSO_new_method 2260 EXIST::FUNCTION: DSO_free 2261 EXIST::FUNCTION: DSO_flags 2262 EXIST::FUNCTION: DSO_up 2263 NOEXIST::FUNCTION: DSO_set_default_method 2264 EXIST::FUNCTION: DSO_get_default_method 2265 EXIST::FUNCTION: DSO_get_method 2266 EXIST::FUNCTION: DSO_set_method 2267 EXIST::FUNCTION: DSO_load 2268 EXIST::FUNCTION: DSO_bind_var 2269 EXIST::FUNCTION: DSO_METHOD_null 2270 EXIST::FUNCTION: DSO_METHOD_openssl 2271 EXIST::FUNCTION: DSO_METHOD_dlfcn 2272 EXIST::FUNCTION: DSO_METHOD_win32 2273 EXIST::FUNCTION: ERR_load_DSO_strings 2274 EXIST::FUNCTION: DSO_METHOD_dl 2275 EXIST::FUNCTION: NCONF_load 2276 EXIST::FUNCTION: NCONF_load_fp 2278 EXIST::FUNCTION:FP_API NCONF_new 2279 EXIST::FUNCTION: NCONF_get_string 2280 EXIST::FUNCTION: NCONF_free 2281 EXIST::FUNCTION: NCONF_get_number 2282 NOEXIST::FUNCTION: CONF_dump_fp 2283 EXIST::FUNCTION: NCONF_load_bio 2284 EXIST::FUNCTION: NCONF_dump_fp 2285 EXIST::FUNCTION: NCONF_get_section 2286 EXIST::FUNCTION: NCONF_dump_bio 2287 EXIST::FUNCTION: CONF_dump_bio 2288 EXIST::FUNCTION: NCONF_free_data 2289 EXIST::FUNCTION: CONF_set_default_method 2290 EXIST::FUNCTION: ERR_error_string_n 2291 EXIST::FUNCTION: BIO_snprintf 2292 EXIST::FUNCTION: DSO_ctrl 2293 EXIST::FUNCTION: i2d_ASN1_SET_OF_ASN1_INTEGER 2317 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_PKCS12_SAFEBAG 2320 NOEXIST::FUNCTION: i2d_ASN1_SET_OF_PKCS7 2328 NOEXIST::FUNCTION: BIO_vfree 2334 EXIST::FUNCTION: d2i_ASN1_SET_OF_ASN1_INTEGER 2339 NOEXIST::FUNCTION: d2i_ASN1_SET_OF_PKCS12_SAFEBAG 2341 NOEXIST::FUNCTION: ASN1_UTCTIME_get 2350 NOEXIST::FUNCTION: X509_REQ_digest 2362 EXIST::FUNCTION:EVP X509_CRL_digest 2391 EXIST::FUNCTION:EVP ASN1_STRING_clear_free 2392 EXIST::FUNCTION: SRP_VBASE_get1_by_user 2393 EXIST::FUNCTION:SRP SRP_user_pwd_free 2394 EXIST::FUNCTION:SRP d2i_ASN1_SET_OF_PKCS7 2397 NOEXIST::FUNCTION: X509_ALGOR_cmp 2398 EXIST::FUNCTION: EVP_CIPHER_CTX_set_key_length 2399 EXIST::FUNCTION: EVP_CIPHER_CTX_ctrl 2400 EXIST::FUNCTION: BN_mod_exp_mont_word 2401 EXIST::FUNCTION: RAND_egd_bytes 2402 EXIST::FUNCTION: X509_REQ_get1_email 2403 EXIST::FUNCTION: X509_get1_email 2404 EXIST::FUNCTION: X509_email_free 2405 EXIST::FUNCTION: i2d_RSA_NET 2406 EXIST::FUNCTION:RC4,RSA d2i_RSA_NET_2 2407 NOEXIST::FUNCTION: d2i_RSA_NET 2408 EXIST::FUNCTION:RC4,RSA DSO_bind_func 2409 EXIST::FUNCTION: CRYPTO_get_new_dynlockid 2410 EXIST::FUNCTION: sk_new_null 2411 EXIST::FUNCTION: CRYPTO_set_dynlock_destroy_callback 2412 EXIST:!VMS:FUNCTION: CRYPTO_set_dynlock_destroy_cb 2412 EXIST:VMS:FUNCTION: CRYPTO_destroy_dynlockid 2413 EXIST::FUNCTION: CRYPTO_set_dynlock_size 2414 NOEXIST::FUNCTION: CRYPTO_set_dynlock_create_callback 2415 EXIST:!VMS:FUNCTION: CRYPTO_set_dynlock_create_cb 2415 EXIST:VMS:FUNCTION: CRYPTO_set_dynlock_lock_callback 2416 EXIST:!VMS:FUNCTION: CRYPTO_set_dynlock_lock_cb 2416 EXIST:VMS:FUNCTION: CRYPTO_get_dynlock_lock_callback 2417 EXIST:!VMS:FUNCTION: CRYPTO_get_dynlock_lock_cb 2417 EXIST:VMS:FUNCTION: CRYPTO_get_dynlock_destroy_callback 2418 EXIST:!VMS:FUNCTION: CRYPTO_get_dynlock_destroy_cb 2418 EXIST:VMS:FUNCTION: CRYPTO_get_dynlock_value 2419 EXIST::FUNCTION: CRYPTO_get_dynlock_create_callback 2420 EXIST:!VMS:FUNCTION: CRYPTO_get_dynlock_create_cb 2420 EXIST:VMS:FUNCTION: c2i_ASN1_BIT_STRING 2421 EXIST::FUNCTION: i2c_ASN1_BIT_STRING 2422 EXIST::FUNCTION: RAND_poll 2423 EXIST::FUNCTION: c2i_ASN1_INTEGER 2424 EXIST::FUNCTION: i2c_ASN1_INTEGER 2425 EXIST::FUNCTION: BIO_dump_indent 2426 EXIST::FUNCTION: ASN1_parse_dump 2427 EXIST::FUNCTION:BIO c2i_ASN1_OBJECT 2428 EXIST::FUNCTION: X509_NAME_print_ex_fp 2429 EXIST::FUNCTION:FP_API ASN1_STRING_print_ex_fp 2430 EXIST::FUNCTION:FP_API X509_NAME_print_ex 2431 EXIST::FUNCTION:BIO ASN1_STRING_print_ex 2432 EXIST::FUNCTION:BIO MD4 2433 EXIST::FUNCTION:MD4 MD4_Transform 2434 EXIST::FUNCTION:MD4 MD4_Final 2435 EXIST::FUNCTION:MD4 MD4_Update 2436 EXIST::FUNCTION:MD4 MD4_Init 2437 EXIST::FUNCTION:MD4 EVP_md4 2438 EXIST::FUNCTION:MD4 i2d_PUBKEY_bio 2439 EXIST::FUNCTION:BIO i2d_PUBKEY_fp 2440 EXIST::FUNCTION:FP_API d2i_PUBKEY_bio 2441 EXIST::FUNCTION:BIO ASN1_STRING_to_UTF8 2442 EXIST::FUNCTION: BIO_vprintf 2443 EXIST::FUNCTION: BIO_vsnprintf 2444 EXIST::FUNCTION: d2i_PUBKEY_fp 2445 EXIST::FUNCTION:FP_API X509_cmp_time 2446 EXIST::FUNCTION: X509_STORE_CTX_set_time 2447 EXIST::FUNCTION: X509_STORE_CTX_get1_issuer 2448 EXIST::FUNCTION: X509_OBJECT_retrieve_match 2449 EXIST::FUNCTION: X509_OBJECT_idx_by_subject 2450 EXIST::FUNCTION: X509_STORE_CTX_set_flags 2451 EXIST::FUNCTION: X509_STORE_CTX_trusted_stack 2452 EXIST::FUNCTION: X509_time_adj 2453 EXIST::FUNCTION: X509_check_issued 2454 EXIST::FUNCTION: ASN1_UTCTIME_cmp_time_t 2455 EXIST::FUNCTION: DES_set_weak_key_flag 2456 NOEXIST::FUNCTION: DES_check_key 2457 NOEXIST::FUNCTION: DES_rw_mode 2458 NOEXIST::FUNCTION: RSA_PKCS1_RSAref 2459 NOEXIST::FUNCTION: X509_keyid_set1 2460 EXIST::FUNCTION: BIO_next 2461 EXIST::FUNCTION: DSO_METHOD_vms 2462 EXIST::FUNCTION: BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: BN_bntest_rand 2464 EXIST::FUNCTION: OPENSSL_issetugid 2465 EXIST::FUNCTION: BN_rand_range 2466 EXIST::FUNCTION: ERR_load_ENGINE_strings 2467 EXIST::FUNCTION:ENGINE ENGINE_set_DSA 2468 EXIST::FUNCTION:ENGINE ENGINE_get_finish_function 2469 EXIST::FUNCTION:ENGINE ENGINE_get_default_RSA 2470 EXIST::FUNCTION:ENGINE ENGINE_get_BN_mod_exp 2471 NOEXIST::FUNCTION: DSA_get_default_openssl_method 2472 NOEXIST::FUNCTION: ENGINE_set_DH 2473 EXIST::FUNCTION:ENGINE ENGINE_set_def_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: ENGINE_set_default_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: ENGINE_init 2475 EXIST::FUNCTION:ENGINE DH_get_default_openssl_method 2476 NOEXIST::FUNCTION: RSA_set_default_openssl_method 2477 NOEXIST::FUNCTION: ENGINE_finish 2478 EXIST::FUNCTION:ENGINE ENGINE_load_public_key 2479 EXIST::FUNCTION:ENGINE ENGINE_get_DH 2480 EXIST::FUNCTION:ENGINE ENGINE_ctrl 2481 EXIST::FUNCTION:ENGINE ENGINE_get_init_function 2482 EXIST::FUNCTION:ENGINE ENGINE_set_init_function 2483 EXIST::FUNCTION:ENGINE ENGINE_set_default_DSA 2484 EXIST::FUNCTION:ENGINE ENGINE_get_name 2485 EXIST::FUNCTION:ENGINE ENGINE_get_last 2486 EXIST::FUNCTION:ENGINE ENGINE_get_prev 2487 EXIST::FUNCTION:ENGINE ENGINE_get_default_DH 2488 EXIST::FUNCTION:ENGINE ENGINE_get_RSA 2489 EXIST::FUNCTION:ENGINE ENGINE_set_default 2490 EXIST::FUNCTION:ENGINE ENGINE_get_RAND 2491 EXIST::FUNCTION:ENGINE ENGINE_get_first 2492 EXIST::FUNCTION:ENGINE ENGINE_by_id 2493 EXIST::FUNCTION:ENGINE ENGINE_set_finish_function 2494 EXIST::FUNCTION:ENGINE ENGINE_get_def_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: ENGINE_get_default_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: RSA_get_default_openssl_method 2496 NOEXIST::FUNCTION: ENGINE_set_RSA 2497 EXIST::FUNCTION:ENGINE ENGINE_load_private_key 2498 EXIST::FUNCTION:ENGINE ENGINE_set_default_RAND 2499 EXIST::FUNCTION:ENGINE ENGINE_set_BN_mod_exp 2500 NOEXIST::FUNCTION: ENGINE_remove 2501 EXIST::FUNCTION:ENGINE ENGINE_free 2502 EXIST::FUNCTION:ENGINE ENGINE_get_BN_mod_exp_crt 2503 NOEXIST::FUNCTION: ENGINE_get_next 2504 EXIST::FUNCTION:ENGINE ENGINE_set_name 2505 EXIST::FUNCTION:ENGINE ENGINE_get_default_DSA 2506 EXIST::FUNCTION:ENGINE ENGINE_set_default_BN_mod_exp 2507 NOEXIST::FUNCTION: ENGINE_set_default_RSA 2508 EXIST::FUNCTION:ENGINE ENGINE_get_default_RAND 2509 EXIST::FUNCTION:ENGINE ENGINE_get_default_BN_mod_exp 2510 NOEXIST::FUNCTION: ENGINE_set_RAND 2511 EXIST::FUNCTION:ENGINE ENGINE_set_id 2512 EXIST::FUNCTION:ENGINE ENGINE_set_BN_mod_exp_crt 2513 NOEXIST::FUNCTION: ENGINE_set_default_DH 2514 EXIST::FUNCTION:ENGINE ENGINE_new 2515 EXIST::FUNCTION:ENGINE ENGINE_get_id 2516 EXIST::FUNCTION:ENGINE DSA_set_default_openssl_method 2517 NOEXIST::FUNCTION: ENGINE_add 2518 EXIST::FUNCTION:ENGINE DH_set_default_openssl_method 2519 NOEXIST::FUNCTION: ENGINE_get_DSA 2520 EXIST::FUNCTION:ENGINE ENGINE_get_ctrl_function 2521 EXIST::FUNCTION:ENGINE ENGINE_set_ctrl_function 2522 EXIST::FUNCTION:ENGINE BN_pseudo_rand_range 2523 EXIST::FUNCTION: X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION: ERR_load_COMP_strings 2525 EXIST::FUNCTION:COMP PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION: ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_unregister_ciphers 2528 EXIST::FUNCTION:ENGINE ENGINE_get_ciphers 2529 EXIST::FUNCTION:ENGINE d2i_OCSP_BASICRESP 2530 EXIST::FUNCTION: KRB5_CHECKSUM_it 2531 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_CHECKSUM_it 2531 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_POINT_add 2532 EXIST::FUNCTION:EC ASN1_item_ex_i2d 2533 EXIST::FUNCTION: OCSP_CERTID_it 2534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_CERTID_it 2534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_OCSP_RESPBYTES 2535 EXIST::FUNCTION: X509V3_add1_i2d 2536 EXIST::FUNCTION: PKCS7_ENVELOPE_it 2537 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ENVELOPE_it 2537 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_add_input_boolean 2538 EXIST::FUNCTION: ENGINE_unregister_RSA 2539 EXIST::FUNCTION:ENGINE X509V3_EXT_nconf 2540 EXIST::FUNCTION: ASN1_GENERALSTRING_free 2541 EXIST::FUNCTION: d2i_OCSP_CERTSTATUS 2542 EXIST::FUNCTION: X509_REVOKED_set_serialNumber 2543 EXIST::FUNCTION: X509_print_ex 2544 EXIST::FUNCTION:BIO OCSP_ONEREQ_get1_ext_d2i 2545 EXIST::FUNCTION: ENGINE_register_all_RAND 2546 EXIST::FUNCTION:ENGINE ENGINE_load_dynamic 2547 EXIST::FUNCTION:ENGINE PBKDF2PARAM_it 2548 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PBKDF2PARAM_it 2548 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EXTENDED_KEY_USAGE_new 2549 EXIST::FUNCTION: EC_GROUP_clear_free 2550 EXIST::FUNCTION:EC OCSP_sendreq_bio 2551 EXIST::FUNCTION: ASN1_item_digest 2552 EXIST::FUNCTION:EVP OCSP_BASICRESP_delete_ext 2553 EXIST::FUNCTION: OCSP_SIGNATURE_it 2554 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_SIGNATURE_it 2554 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_CRL_it 2555 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_CRL_it 2555 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_BASICRESP_add_ext 2556 EXIST::FUNCTION: KRB5_ENCKEY_it 2557 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_ENCKEY_it 2557 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_method_set_closer 2558 EXIST::FUNCTION: X509_STORE_set_purpose 2559 EXIST::FUNCTION: i2d_ASN1_GENERALSTRING 2560 EXIST::FUNCTION: OCSP_response_status 2561 EXIST::FUNCTION: i2d_OCSP_SERVICELOC 2562 EXIST::FUNCTION: ENGINE_get_digest_engine 2563 EXIST::FUNCTION:ENGINE EC_GROUP_set_curve_GFp 2564 EXIST::FUNCTION:EC OCSP_REQUEST_get_ext_by_OBJ 2565 EXIST::FUNCTION: _ossl_old_des_random_key 2566 EXIST::FUNCTION:DES ASN1_T61STRING_it 2567 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_T61STRING_it 2567 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_GROUP_method_of 2568 EXIST::FUNCTION:EC i2d_KRB5_APREQ 2569 EXIST::FUNCTION: _ossl_old_des_encrypt 2570 EXIST::FUNCTION:DES ASN1_PRINTABLE_new 2571 EXIST::FUNCTION: HMAC_Init_ex 2572 EXIST::FUNCTION:HMAC d2i_KRB5_AUTHENT 2573 EXIST::FUNCTION: OCSP_archive_cutoff_new 2574 EXIST::FUNCTION: EC_POINT_set_Jprojective_coordinates_GFp 2575 EXIST:!VMS:FUNCTION:EC EC_POINT_set_Jproj_coords_GFp 2575 EXIST:VMS:FUNCTION:EC _ossl_old_des_is_weak_key 2576 EXIST::FUNCTION:DES OCSP_BASICRESP_get_ext_by_OBJ 2577 EXIST::FUNCTION: EC_POINT_oct2point 2578 EXIST::FUNCTION:EC OCSP_SINGLERESP_get_ext_count 2579 EXIST::FUNCTION: UI_ctrl 2580 EXIST::FUNCTION: _shadow_DES_rw_mode 2581 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES _shadow_DES_rw_mode 2581 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES asn1_do_adb 2582 EXIST::FUNCTION: ASN1_template_i2d 2583 EXIST::FUNCTION: ENGINE_register_DH 2584 EXIST::FUNCTION:ENGINE UI_construct_prompt 2585 EXIST::FUNCTION: X509_STORE_set_trust 2586 EXIST::FUNCTION: UI_dup_input_string 2587 EXIST::FUNCTION: d2i_KRB5_APREQ 2588 EXIST::FUNCTION: EVP_MD_CTX_copy_ex 2589 EXIST::FUNCTION: OCSP_request_is_signed 2590 EXIST::FUNCTION: i2d_OCSP_REQINFO 2591 EXIST::FUNCTION: KRB5_ENCKEY_free 2592 EXIST::FUNCTION: OCSP_resp_get0 2593 EXIST::FUNCTION: GENERAL_NAME_it 2594 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: GENERAL_NAME_it 2594 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_GENERALIZEDTIME_it 2595 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_GENERALIZEDTIME_it 2595 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_STORE_set_flags 2596 EXIST::FUNCTION: EC_POINT_set_compressed_coordinates_GFp 2597 EXIST:!VMS:FUNCTION:EC EC_POINT_set_compr_coords_GFp 2597 EXIST:VMS:FUNCTION:EC OCSP_response_status_str 2598 EXIST::FUNCTION: d2i_OCSP_REVOKEDINFO 2599 EXIST::FUNCTION: OCSP_basic_add1_cert 2600 EXIST::FUNCTION: ERR_get_implementation 2601 EXIST::FUNCTION: EVP_CipherFinal_ex 2602 EXIST::FUNCTION: OCSP_CERTSTATUS_new 2603 EXIST::FUNCTION: CRYPTO_cleanup_all_ex_data 2604 EXIST::FUNCTION: OCSP_resp_find 2605 EXIST::FUNCTION: BN_nnmod 2606 EXIST::FUNCTION: X509_CRL_sort 2607 EXIST::FUNCTION: X509_REVOKED_set_revocationDate 2608 EXIST::FUNCTION: ENGINE_register_RAND 2609 EXIST::FUNCTION:ENGINE OCSP_SERVICELOC_new 2610 EXIST::FUNCTION: EC_POINT_set_affine_coordinates_GFp 2611 EXIST:!VMS:FUNCTION:EC EC_POINT_set_affine_coords_GFp 2611 EXIST:VMS:FUNCTION:EC _ossl_old_des_options 2612 EXIST::FUNCTION:DES SXNET_it 2613 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: SXNET_it 2613 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_dup_input_boolean 2614 EXIST::FUNCTION: PKCS12_add_CSPName_asc 2615 EXIST::FUNCTION: EC_POINT_is_at_infinity 2616 EXIST::FUNCTION:EC ENGINE_load_cryptodev 2617 EXIST::FUNCTION:ENGINE DSO_convert_filename 2618 EXIST::FUNCTION: POLICYQUALINFO_it 2619 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: POLICYQUALINFO_it 2619 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_register_ciphers 2620 EXIST::FUNCTION:ENGINE BN_mod_lshift_quick 2621 EXIST::FUNCTION: DSO_set_filename 2622 EXIST::FUNCTION: ASN1_item_free 2623 EXIST::FUNCTION: KRB5_TKTBODY_free 2624 EXIST::FUNCTION: AUTHORITY_KEYID_it 2625 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: AUTHORITY_KEYID_it 2625 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: KRB5_APREQBODY_new 2626 EXIST::FUNCTION: X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION: ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION: EVP_MD_CTX_init 2630 EXIST::FUNCTION: EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION: PKCS7_ATTR_SIGN_it 2632 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_add_error_string 2633 EXIST::FUNCTION: KRB5_CHECKSUM_free 2634 EXIST::FUNCTION: OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION: ENGINE_load_ubsec 2636 EXIST::FUNCTION:ENGINE,STATIC_ENGINE ENGINE_register_all_digests 2637 EXIST::FUNCTION:ENGINE PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PKCS12_unpack_authsafes 2639 EXIST::FUNCTION: ASN1_item_unpack 2640 EXIST::FUNCTION: NETSCAPE_SPKAC_it 2641 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_STRING_encode 2643 NOEXIST::FUNCTION: EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES KRB5_AUTHENT_free 2645 EXIST::FUNCTION: OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION: OCSP_BASICRESP_get_ext_by_crit 2646 EXIST:VMS:FUNCTION: OCSP_cert_status_str 2647 EXIST::FUNCTION: d2i_OCSP_REQUEST 2648 EXIST::FUNCTION: UI_dup_info_string 2649 EXIST::FUNCTION: _ossl_old_des_xwhite_in2out 2650 NOEXIST::FUNCTION: PKCS12_it 2651 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_it 2651 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_SINGLERESP_get_ext_by_critical 2652 EXIST:!VMS:FUNCTION: OCSP_SINGLERESP_get_ext_by_crit 2652 EXIST:VMS:FUNCTION: OCSP_CERTSTATUS_free 2653 EXIST::FUNCTION: _ossl_old_des_crypt 2654 EXIST::FUNCTION:DES ASN1_item_i2d 2655 EXIST::FUNCTION: EVP_DecryptFinal_ex 2656 EXIST::FUNCTION: ENGINE_load_openssl 2657 EXIST::FUNCTION:ENGINE ENGINE_get_cmd_defns 2658 EXIST::FUNCTION:ENGINE ENGINE_set_load_privkey_function 2659 EXIST:!VMS:FUNCTION:ENGINE ENGINE_set_load_privkey_fn 2659 EXIST:VMS:FUNCTION:ENGINE EVP_EncryptFinal_ex 2660 EXIST::FUNCTION: ENGINE_set_default_digests 2661 EXIST::FUNCTION:ENGINE X509_get0_pubkey_bitstr 2662 EXIST::FUNCTION: asn1_ex_i2c 2663 EXIST::FUNCTION: ENGINE_register_RSA 2664 EXIST::FUNCTION:ENGINE ENGINE_unregister_DSA 2665 EXIST::FUNCTION:ENGINE _ossl_old_des_key_sched 2666 EXIST::FUNCTION:DES X509_EXTENSION_it 2667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_EXTENSION_it 2667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: i2d_KRB5_AUTHENT 2668 EXIST::FUNCTION: SXNETID_it 2669 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: SXNETID_it 2669 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_OCSP_SINGLERESP 2670 EXIST::FUNCTION: EDIPARTYNAME_new 2671 EXIST::FUNCTION: PKCS12_certbag2x509 2672 EXIST::FUNCTION: _ossl_old_des_ofb64_encrypt 2673 EXIST::FUNCTION:DES d2i_EXTENDED_KEY_USAGE 2674 EXIST::FUNCTION: ERR_print_errors_cb 2675 EXIST::FUNCTION: ENGINE_set_ciphers 2676 EXIST::FUNCTION:ENGINE d2i_KRB5_APREQBODY 2677 EXIST::FUNCTION: UI_method_get_flusher 2678 EXIST::FUNCTION: X509_PUBKEY_it 2679 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_PUBKEY_it 2679 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: _ossl_old_des_enc_read 2680 EXIST::FUNCTION:DES PKCS7_ENCRYPT_it 2681 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ENCRYPT_it 2681 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: i2d_OCSP_RESPONSE 2682 EXIST::FUNCTION: EC_GROUP_get_cofactor 2683 EXIST::FUNCTION:EC PKCS12_unpack_p7data 2684 EXIST::FUNCTION: d2i_KRB5_AUTHDATA 2685 EXIST::FUNCTION: OCSP_copy_nonce 2686 EXIST::FUNCTION: KRB5_AUTHDATA_new 2687 EXIST::FUNCTION: OCSP_RESPDATA_new 2688 EXIST::FUNCTION: EC_GFp_mont_method 2689 EXIST::FUNCTION:EC OCSP_REVOKEDINFO_free 2690 EXIST::FUNCTION: UI_get_ex_data 2691 EXIST::FUNCTION: KRB5_APREQBODY_free 2692 EXIST::FUNCTION: EC_GROUP_get0_generator 2693 EXIST::FUNCTION:EC UI_get_default_method 2694 EXIST::FUNCTION: X509V3_set_nconf 2695 EXIST::FUNCTION: PKCS12_item_i2d_encrypt 2696 EXIST::FUNCTION: X509_add1_ext_i2d 2697 EXIST::FUNCTION: PKCS7_SIGNER_INFO_it 2698 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_SIGNER_INFO_it 2698 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: KRB5_PRINCNAME_new 2699 EXIST::FUNCTION: PKCS12_SAFEBAG_it 2700 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_SAFEBAG_it 2700 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_GROUP_get_order 2701 EXIST::FUNCTION:EC d2i_OCSP_RESPID 2702 EXIST::FUNCTION: OCSP_request_verify 2703 EXIST::FUNCTION: NCONF_get_number_e 2704 EXIST::FUNCTION: _ossl_old_des_decrypt3 2705 EXIST::FUNCTION:DES X509_signature_print 2706 EXIST::FUNCTION:EVP OCSP_SINGLERESP_free 2707 EXIST::FUNCTION: ENGINE_load_builtin_engines 2708 EXIST::FUNCTION:ENGINE i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION: OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION: OCSP_RESPBYTES_new 2711 EXIST::FUNCTION: EVP_MD_CTX_create 2712 EXIST::FUNCTION: OCSP_resp_find_status 2713 EXIST::FUNCTION: X509_ALGOR_it 2714 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_ALGOR_it 2714 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_TIME_it 2715 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_TIME_it 2715 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_request_set1_name 2716 EXIST::FUNCTION: OCSP_ONEREQ_get_ext_count 2717 EXIST::FUNCTION: UI_get0_result 2718 EXIST::FUNCTION: PKCS12_AUTHSAFES_it 2719 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_AUTHSAFES_it 2719 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_aes_256_ecb 2720 EXIST::FUNCTION:AES PKCS12_pack_authsafes 2721 EXIST::FUNCTION: ASN1_IA5STRING_it 2722 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_IA5STRING_it 2722 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_get_input_flags 2723 EXIST::FUNCTION: EC_GROUP_set_generator 2724 EXIST::FUNCTION:EC _ossl_old_des_string_to_2keys 2725 EXIST::FUNCTION:DES OCSP_CERTID_free 2726 EXIST::FUNCTION: X509_CERT_AUX_it 2727 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_CERT_AUX_it 2727 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: CERTIFICATEPOLICIES_it 2728 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: CERTIFICATEPOLICIES_it 2728 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: _ossl_old_des_ede3_cbc_encrypt 2729 EXIST::FUNCTION:DES RAND_set_rand_engine 2730 EXIST::FUNCTION:ENGINE DSO_get_loaded_filename 2731 EXIST::FUNCTION: X509_ATTRIBUTE_it 2732 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_ATTRIBUTE_it 2732 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_ONEREQ_get_ext_by_NID 2733 EXIST::FUNCTION: PKCS12_decrypt_skey 2734 EXIST::FUNCTION: KRB5_AUTHENT_it 2735 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_AUTHENT_it 2735 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_dup_error_string 2736 EXIST::FUNCTION: RSAPublicKey_it 2737 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA RSAPublicKey_it 2737 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA i2d_OCSP_REQUEST 2738 EXIST::FUNCTION: PKCS12_x509crl2certbag 2739 EXIST::FUNCTION: OCSP_SERVICELOC_it 2740 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_SERVICELOC_it 2740 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_item_sign 2741 EXIST::FUNCTION:EVP X509_CRL_set_issuer_name 2742 EXIST::FUNCTION: OBJ_NAME_do_all_sorted 2743 EXIST::FUNCTION: i2d_OCSP_BASICRESP 2744 EXIST::FUNCTION: i2d_OCSP_RESPBYTES 2745 EXIST::FUNCTION: PKCS12_unpack_p7encdata 2746 EXIST::FUNCTION: HMAC_CTX_init 2747 EXIST::FUNCTION:HMAC ENGINE_get_digest 2748 EXIST::FUNCTION:ENGINE OCSP_RESPONSE_print 2749 EXIST::FUNCTION: KRB5_TKTBODY_it 2750 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_TKTBODY_it 2750 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ACCESS_DESCRIPTION_it 2751 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ACCESS_DESCRIPTION_it 2751 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PBE2PARAM_it 2753 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PBE2PARAM_it 2753 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PKCS12_certbag2x509crl 2754 EXIST::FUNCTION: PKCS7_SIGNED_it 2755 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_SIGNED_it 2755 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_get_cipher 2756 EXIST::FUNCTION:ENGINE i2d_OCSP_CRLID 2757 EXIST::FUNCTION: OCSP_SINGLERESP_new 2758 EXIST::FUNCTION: ENGINE_cmd_is_executable 2759 EXIST::FUNCTION:ENGINE RSA_up_ref 2760 EXIST::FUNCTION:RSA ASN1_GENERALSTRING_it 2761 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_GENERALSTRING_it 2761 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_register_DSA 2762 EXIST::FUNCTION:ENGINE X509V3_EXT_add_nconf_sk 2763 EXIST::FUNCTION: ENGINE_set_load_pubkey_function 2764 EXIST::FUNCTION:ENGINE PKCS8_decrypt 2765 EXIST::FUNCTION: PEM_bytes_read_bio 2766 EXIST::FUNCTION:BIO DIRECTORYSTRING_it 2767 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: DIRECTORYSTRING_it 2767 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_OCSP_CRLID 2768 EXIST::FUNCTION: EC_POINT_is_on_curve 2769 EXIST::FUNCTION:EC CRYPTO_set_locked_mem_ex_functions 2770 EXIST:!VMS:FUNCTION: CRYPTO_set_locked_mem_ex_funcs 2770 EXIST:VMS:FUNCTION: d2i_KRB5_CHECKSUM 2771 EXIST::FUNCTION: ASN1_item_dup 2772 EXIST::FUNCTION: X509_it 2773 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_it 2773 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: BN_mod_add 2774 EXIST::FUNCTION: KRB5_AUTHDATA_free 2775 EXIST::FUNCTION: _ossl_old_des_cbc_cksum 2776 EXIST::FUNCTION:DES ASN1_item_verify 2777 EXIST::FUNCTION:EVP CRYPTO_set_mem_ex_functions 2778 EXIST::FUNCTION: EC_POINT_get_Jprojective_coordinates_GFp 2779 EXIST:!VMS:FUNCTION:EC EC_POINT_get_Jproj_coords_GFp 2779 EXIST:VMS:FUNCTION:EC ZLONG_it 2780 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ZLONG_it 2780 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: CRYPTO_get_locked_mem_ex_functions 2781 EXIST:!VMS:FUNCTION: CRYPTO_get_locked_mem_ex_funcs 2781 EXIST:VMS:FUNCTION: ASN1_TIME_check 2782 EXIST::FUNCTION: UI_get0_user_data 2783 EXIST::FUNCTION: HMAC_CTX_cleanup 2784 EXIST::FUNCTION:HMAC DSA_up_ref 2785 EXIST::FUNCTION:DSA _ossl_old_des_ede3_cfb64_encrypt 2786 EXIST:!VMS:FUNCTION:DES _ossl_odes_ede3_cfb64_encrypt 2786 EXIST:VMS:FUNCTION:DES ASN1_BMPSTRING_it 2787 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_BMPSTRING_it 2787 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_tag2bit 2788 EXIST::FUNCTION: UI_method_set_flusher 2789 EXIST::FUNCTION: X509_ocspid_print 2790 EXIST::FUNCTION:BIO KRB5_ENCDATA_it 2791 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_ENCDATA_it 2791 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_get_load_pubkey_function 2792 EXIST::FUNCTION:ENGINE UI_add_user_data 2793 EXIST::FUNCTION: OCSP_REQUEST_delete_ext 2794 EXIST::FUNCTION: UI_get_method 2795 EXIST::FUNCTION: OCSP_ONEREQ_free 2796 EXIST::FUNCTION: ASN1_PRINTABLESTRING_it 2797 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_PRINTABLESTRING_it 2797 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_CRL_set_nextUpdate 2798 EXIST::FUNCTION: OCSP_REQUEST_it 2799 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_REQUEST_it 2799 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_BASICRESP_it 2800 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_BASICRESP_it 2800 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: AES_ecb_encrypt 2801 EXIST::FUNCTION:AES BN_mod_sqr 2802 EXIST::FUNCTION: NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: GENERAL_NAMES_it 2804 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: GENERAL_NAMES_it 2804 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: AUTHORITY_INFO_ACCESS_it 2805 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: AUTHORITY_INFO_ACCESS_it 2805 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_FBOOLEAN_it 2806 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_FBOOLEAN_it 2806 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_set_ex_data 2807 EXIST::FUNCTION: _ossl_old_des_string_to_key 2808 EXIST::FUNCTION:DES ENGINE_register_all_RSA 2809 EXIST::FUNCTION:ENGINE d2i_KRB5_PRINCNAME 2810 EXIST::FUNCTION: OCSP_RESPBYTES_it 2811 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_RESPBYTES_it 2811 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_CINF_it 2812 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_CINF_it 2812 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_unregister_digests 2813 EXIST::FUNCTION:ENGINE d2i_EDIPARTYNAME 2814 EXIST::FUNCTION: d2i_OCSP_SERVICELOC 2815 EXIST::FUNCTION: ENGINE_get_digests 2816 EXIST::FUNCTION:ENGINE _ossl_old_des_set_odd_parity 2817 EXIST::FUNCTION:DES OCSP_RESPDATA_free 2818 EXIST::FUNCTION: d2i_KRB5_TICKET 2819 EXIST::FUNCTION: OTHERNAME_it 2820 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OTHERNAME_it 2820 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_MD_CTX_cleanup 2821 EXIST::FUNCTION: d2i_ASN1_GENERALSTRING 2822 EXIST::FUNCTION: X509_CRL_set_version 2823 EXIST::FUNCTION: BN_mod_sub 2824 EXIST::FUNCTION: OCSP_SINGLERESP_get_ext_by_NID 2825 EXIST::FUNCTION: ENGINE_get_ex_new_index 2826 EXIST::FUNCTION:ENGINE OCSP_REQUEST_free 2827 EXIST::FUNCTION: OCSP_REQUEST_add1_ext_i2d 2828 EXIST::FUNCTION: X509_VAL_it 2829 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_VAL_it 2829 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_POINTs_make_affine 2830 EXIST::FUNCTION:EC EC_POINT_mul 2831 EXIST::FUNCTION:EC X509V3_EXT_add_nconf 2832 EXIST::FUNCTION: X509_TRUST_set 2833 EXIST::FUNCTION: X509_CRL_add1_ext_i2d 2834 EXIST::FUNCTION: _ossl_old_des_fcrypt 2835 EXIST::FUNCTION:DES DISPLAYTEXT_it 2836 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: DISPLAYTEXT_it 2836 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_CRL_set_lastUpdate 2837 EXIST::FUNCTION: OCSP_BASICRESP_free 2838 EXIST::FUNCTION: OCSP_BASICRESP_add1_ext_i2d 2839 EXIST::FUNCTION: d2i_KRB5_AUTHENTBODY 2840 EXIST::FUNCTION: CRYPTO_set_ex_data_implementation 2841 EXIST:!VMS:FUNCTION: CRYPTO_set_ex_data_impl 2841 EXIST:VMS:FUNCTION: KRB5_ENCDATA_new 2842 EXIST::FUNCTION: DSO_up_ref 2843 EXIST::FUNCTION: OCSP_crl_reason_str 2844 EXIST::FUNCTION: UI_get0_result_string 2845 EXIST::FUNCTION: ASN1_GENERALSTRING_new 2846 EXIST::FUNCTION: X509_SIG_it 2847 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_SIG_it 2847 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ERR_set_implementation 2848 EXIST::FUNCTION: ERR_load_EC_strings 2849 EXIST::FUNCTION:EC UI_get0_action_string 2850 EXIST::FUNCTION: OCSP_ONEREQ_get_ext 2851 EXIST::FUNCTION: EC_POINT_method_of 2852 EXIST::FUNCTION:EC i2d_KRB5_APREQBODY 2853 EXIST::FUNCTION: _ossl_old_des_ecb3_encrypt 2854 EXIST::FUNCTION:DES CRYPTO_get_mem_ex_functions 2855 EXIST::FUNCTION: ENGINE_get_ex_data 2856 EXIST::FUNCTION:ENGINE UI_destroy_method 2857 EXIST::FUNCTION: ASN1_item_i2d_bio 2858 EXIST::FUNCTION:BIO OCSP_ONEREQ_get_ext_by_OBJ 2859 EXIST::FUNCTION: ASN1_primitive_new 2860 EXIST::FUNCTION: ASN1_PRINTABLE_it 2861 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_PRINTABLE_it 2861 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_aes_192_ecb 2862 EXIST::FUNCTION:AES OCSP_SIGNATURE_new 2863 EXIST::FUNCTION: LONG_it 2864 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: LONG_it 2864 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_VISIBLESTRING_it 2865 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_VISIBLESTRING_it 2865 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_SINGLERESP_add1_ext_i2d 2866 EXIST::FUNCTION: d2i_OCSP_CERTID 2867 EXIST::FUNCTION: ASN1_item_d2i_fp 2868 EXIST::FUNCTION:FP_API CRL_DIST_POINTS_it 2869 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: CRL_DIST_POINTS_it 2869 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: GENERAL_NAME_print 2870 EXIST::FUNCTION: OCSP_SINGLERESP_delete_ext 2871 EXIST::FUNCTION: PKCS12_SAFEBAGS_it 2872 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_SAFEBAGS_it 2872 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_OCSP_SIGNATURE 2873 EXIST::FUNCTION: OCSP_request_add1_nonce 2874 EXIST::FUNCTION: ENGINE_set_cmd_defns 2875 EXIST::FUNCTION:ENGINE OCSP_SERVICELOC_free 2876 EXIST::FUNCTION: EC_GROUP_free 2877 EXIST::FUNCTION:EC ASN1_BIT_STRING_it 2878 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_BIT_STRING_it 2878 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_REQ_it 2879 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_REQ_it 2879 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: _ossl_old_des_cbc_encrypt 2880 EXIST::FUNCTION:DES ERR_unload_strings 2881 EXIST::FUNCTION: PKCS7_SIGN_ENVELOPE_it 2882 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_SIGN_ENVELOPE_it 2882 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EDIPARTYNAME_free 2883 EXIST::FUNCTION: OCSP_REQINFO_free 2884 EXIST::FUNCTION: EC_GROUP_new_curve_GFp 2885 EXIST::FUNCTION:EC OCSP_REQUEST_get1_ext_d2i 2886 EXIST::FUNCTION: PKCS12_item_pack_safebag 2887 EXIST::FUNCTION: asn1_ex_c2i 2888 EXIST::FUNCTION: ENGINE_register_digests 2889 EXIST::FUNCTION:ENGINE i2d_OCSP_REVOKEDINFO 2890 EXIST::FUNCTION: asn1_enc_restore 2891 EXIST::FUNCTION: UI_free 2892 EXIST::FUNCTION: UI_new_method 2893 EXIST::FUNCTION: EVP_EncryptInit_ex 2894 EXIST::FUNCTION: X509_pubkey_digest 2895 EXIST::FUNCTION:EVP EC_POINT_invert 2896 EXIST::FUNCTION:EC OCSP_basic_sign 2897 EXIST::FUNCTION: i2d_OCSP_RESPID 2898 EXIST::FUNCTION: OCSP_check_nonce 2899 EXIST::FUNCTION: ENGINE_ctrl_cmd 2900 EXIST::FUNCTION:ENGINE d2i_KRB5_ENCKEY 2901 EXIST::FUNCTION: OCSP_parse_url 2902 EXIST::FUNCTION: OCSP_SINGLERESP_get_ext 2903 EXIST::FUNCTION: OCSP_CRLID_free 2904 EXIST::FUNCTION: OCSP_BASICRESP_get1_ext_d2i 2905 EXIST::FUNCTION: RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA ENGINE_register_all_DH 2907 EXIST::FUNCTION:ENGINE i2d_EDIPARTYNAME 2908 EXIST::FUNCTION: EC_POINT_get_affine_coordinates_GFp 2909 EXIST:!VMS:FUNCTION:EC EC_POINT_get_affine_coords_GFp 2909 EXIST:VMS:FUNCTION:EC OCSP_CRLID_new 2910 EXIST::FUNCTION: ENGINE_get_flags 2911 EXIST::FUNCTION:ENGINE OCSP_ONEREQ_it 2912 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_ONEREQ_it 2912 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_process 2913 EXIST::FUNCTION: ASN1_INTEGER_it 2914 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_INTEGER_it 2914 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_CipherInit_ex 2915 EXIST::FUNCTION: UI_get_string_type 2916 EXIST::FUNCTION: ENGINE_unregister_DH 2917 EXIST::FUNCTION:ENGINE ENGINE_register_all_DSA 2918 EXIST::FUNCTION:ENGINE OCSP_ONEREQ_get_ext_by_critical 2919 EXIST::FUNCTION: bn_dup_expand 2920 EXIST::FUNCTION:DEPRECATED OCSP_cert_id_new 2921 EXIST::FUNCTION: BASIC_CONSTRAINTS_it 2922 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: BASIC_CONSTRAINTS_it 2922 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: BN_mod_add_quick 2923 EXIST::FUNCTION: EC_POINT_new 2924 EXIST::FUNCTION:EC EVP_MD_CTX_destroy 2925 EXIST::FUNCTION: OCSP_RESPBYTES_free 2926 EXIST::FUNCTION: EVP_aes_128_cbc 2927 EXIST::FUNCTION:AES OCSP_SINGLERESP_get1_ext_d2i 2928 EXIST::FUNCTION: EC_POINT_free 2929 EXIST::FUNCTION:EC DH_up_ref 2930 EXIST::FUNCTION:DH X509_NAME_ENTRY_it 2931 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_NAME_ENTRY_it 2931 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_get_ex_new_index 2932 EXIST::FUNCTION: BN_mod_sub_quick 2933 EXIST::FUNCTION: OCSP_ONEREQ_add_ext 2934 EXIST::FUNCTION: OCSP_request_sign 2935 EXIST::FUNCTION: EVP_DigestFinal_ex 2936 EXIST::FUNCTION: ENGINE_set_digests 2937 EXIST::FUNCTION:ENGINE OCSP_id_issuer_cmp 2938 EXIST::FUNCTION: OBJ_NAME_do_all 2939 EXIST::FUNCTION: EC_POINTs_mul 2940 EXIST::FUNCTION:EC ENGINE_register_complete 2941 EXIST::FUNCTION:ENGINE X509V3_EXT_nconf_nid 2942 EXIST::FUNCTION: ASN1_SEQUENCE_it 2943 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_SEQUENCE_it 2943 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_set_default_method 2944 EXIST::FUNCTION: RAND_query_egd_bytes 2945 EXIST::FUNCTION: UI_method_get_writer 2946 EXIST::FUNCTION: UI_OpenSSL 2947 EXIST::FUNCTION: PEM_def_callback 2948 EXIST::FUNCTION: ENGINE_cleanup 2949 EXIST::FUNCTION:ENGINE DIST_POINT_it 2950 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: DIST_POINT_it 2950 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_SINGLERESP_it 2951 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_SINGLERESP_it 2951 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_KRB5_TKTBODY 2952 EXIST::FUNCTION: EC_POINT_cmp 2953 EXIST::FUNCTION:EC OCSP_REVOKEDINFO_new 2954 EXIST::FUNCTION: i2d_OCSP_CERTSTATUS 2955 EXIST::FUNCTION: OCSP_basic_add1_nonce 2956 EXIST::FUNCTION: ASN1_item_ex_d2i 2957 EXIST::FUNCTION: BN_mod_lshift1_quick 2958 EXIST::FUNCTION: UI_set_method 2959 EXIST::FUNCTION: OCSP_id_get0_info 2960 EXIST::FUNCTION: BN_mod_sqrt 2961 EXIST::FUNCTION: EC_GROUP_copy 2962 EXIST::FUNCTION:EC KRB5_ENCDATA_free 2963 EXIST::FUNCTION: _ossl_old_des_cfb_encrypt 2964 EXIST::FUNCTION:DES OCSP_SINGLERESP_get_ext_by_OBJ 2965 EXIST::FUNCTION: OCSP_cert_to_id 2966 EXIST::FUNCTION: OCSP_RESPID_new 2967 EXIST::FUNCTION: OCSP_RESPDATA_it 2968 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_RESPDATA_it 2968 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_OCSP_RESPDATA 2969 EXIST::FUNCTION: ENGINE_register_all_complete 2970 EXIST::FUNCTION:ENGINE OCSP_check_validity 2971 EXIST::FUNCTION: PKCS12_BAGS_it 2972 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_BAGS_it 2972 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_url_svcloc_new 2973 EXIST::FUNCTION: ASN1_template_free 2974 EXIST::FUNCTION: OCSP_SINGLERESP_add_ext 2975 EXIST::FUNCTION: KRB5_AUTHENTBODY_it 2976 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_AUTHENTBODY_it 2976 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_supported_extension 2977 EXIST::FUNCTION: i2d_KRB5_AUTHDATA 2978 EXIST::FUNCTION: UI_method_get_opener 2979 EXIST::FUNCTION: ENGINE_set_ex_data 2980 EXIST::FUNCTION:ENGINE OCSP_REQUEST_print 2981 EXIST::FUNCTION: CBIGNUM_it 2982 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: CBIGNUM_it 2982 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: KRB5_TICKET_new 2983 EXIST::FUNCTION: KRB5_APREQ_new 2984 EXIST::FUNCTION: EC_GROUP_get_curve_GFp 2985 EXIST::FUNCTION:EC KRB5_ENCKEY_new 2986 EXIST::FUNCTION: ASN1_template_d2i 2987 EXIST::FUNCTION: _ossl_old_des_quad_cksum 2988 EXIST::FUNCTION:DES OCSP_single_get0_status 2989 EXIST::FUNCTION: BN_swap 2990 EXIST::FUNCTION: POLICYINFO_it 2991 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: POLICYINFO_it 2991 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_set_destroy_function 2992 EXIST::FUNCTION:ENGINE asn1_enc_free 2993 EXIST::FUNCTION: OCSP_RESPID_it 2994 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_RESPID_it 2994 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_GROUP_new 2995 EXIST::FUNCTION:EC EVP_aes_256_cbc 2996 EXIST::FUNCTION:AES i2d_KRB5_PRINCNAME 2997 EXIST::FUNCTION: _ossl_old_des_encrypt2 2998 EXIST::FUNCTION:DES _ossl_old_des_encrypt3 2999 EXIST::FUNCTION:DES PKCS8_PRIV_KEY_INFO_it 3000 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS8_PRIV_KEY_INFO_it 3000 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_REQINFO_it 3001 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_REQINFO_it 3001 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PBEPARAM_it 3002 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PBEPARAM_it 3002 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: KRB5_AUTHENTBODY_new 3003 EXIST::FUNCTION: X509_CRL_add0_revoked 3004 EXIST::FUNCTION: EDIPARTYNAME_it 3005 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: EDIPARTYNAME_it 3005 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: NETSCAPE_SPKI_it 3006 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NETSCAPE_SPKI_it 3006 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_get0_test_string 3007 EXIST::FUNCTION: ENGINE_get_cipher_engine 3008 EXIST::FUNCTION:ENGINE ENGINE_register_all_ciphers 3009 EXIST::FUNCTION:ENGINE EC_POINT_copy 3010 EXIST::FUNCTION:EC BN_kronecker 3011 EXIST::FUNCTION: _ossl_old_des_ede3_ofb64_encrypt 3012 EXIST:!VMS:FUNCTION:DES _ossl_odes_ede3_ofb64_encrypt 3012 EXIST:VMS:FUNCTION:DES UI_method_get_reader 3013 EXIST::FUNCTION: OCSP_BASICRESP_get_ext_count 3014 EXIST::FUNCTION: ASN1_ENUMERATED_it 3015 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_ENUMERATED_it 3015 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_set_result 3016 EXIST::FUNCTION: i2d_KRB5_TICKET 3017 EXIST::FUNCTION: X509_print_ex_fp 3018 EXIST::FUNCTION:FP_API EVP_CIPHER_CTX_set_padding 3019 EXIST::FUNCTION: d2i_OCSP_RESPONSE 3020 EXIST::FUNCTION: ASN1_UTCTIME_it 3021 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_UTCTIME_it 3021 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: _ossl_old_des_enc_write 3022 EXIST::FUNCTION:DES OCSP_RESPONSE_new 3023 EXIST::FUNCTION: AES_set_encrypt_key 3024 EXIST::FUNCTION:AES OCSP_resp_count 3025 EXIST::FUNCTION: KRB5_CHECKSUM_new 3026 EXIST::FUNCTION: ENGINE_load_cswift 3027 EXIST::FUNCTION:ENGINE,STATIC_ENGINE OCSP_onereq_get0_id 3028 EXIST::FUNCTION: ENGINE_set_default_ciphers 3029 EXIST::FUNCTION:ENGINE NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NOTICEREF_it 3030 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509V3_EXT_CRL_add_nconf 3031 EXIST::FUNCTION: OCSP_REVOKEDINFO_it 3032 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_REVOKEDINFO_it 3032 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: AES_encrypt 3033 EXIST::FUNCTION:AES OCSP_REQUEST_new 3034 EXIST::FUNCTION: ASN1_ANY_it 3035 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_ANY_it 3035 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: CRYPTO_ex_data_new_class 3036 EXIST::FUNCTION: _ossl_old_des_ncbc_encrypt 3037 EXIST::FUNCTION:DES i2d_KRB5_TKTBODY 3038 EXIST::FUNCTION: EC_POINT_clear_free 3039 EXIST::FUNCTION:EC AES_decrypt 3040 EXIST::FUNCTION:AES asn1_enc_init 3041 EXIST::FUNCTION: UI_get_result_maxsize 3042 EXIST::FUNCTION: OCSP_CERTID_new 3043 EXIST::FUNCTION: ENGINE_unregister_RAND 3044 EXIST::FUNCTION:ENGINE UI_method_get_closer 3045 EXIST::FUNCTION: d2i_KRB5_ENCDATA 3046 EXIST::FUNCTION: OCSP_request_onereq_count 3047 EXIST::FUNCTION: OCSP_basic_verify 3048 EXIST::FUNCTION: KRB5_AUTHENTBODY_free 3049 EXIST::FUNCTION: ASN1_item_d2i 3050 EXIST::FUNCTION: ASN1_primitive_free 3051 EXIST::FUNCTION: i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION: i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION: asn1_enc_save 3054 EXIST::FUNCTION: ENGINE_load_nuron 3055 EXIST::FUNCTION:ENGINE,STATIC_ENGINE _ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_accept_responses_new 3058 EXIST::FUNCTION: asn1_do_lock 3059 EXIST::FUNCTION: PKCS7_ATTR_VERIFY_it 3060 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ATTR_VERIFY_it 3060 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: KRB5_APREQBODY_it 3061 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_APREQBODY_it 3061 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: i2d_OCSP_SINGLERESP 3062 EXIST::FUNCTION: ASN1_item_ex_new 3063 EXIST::FUNCTION: UI_add_verify_string 3064 EXIST::FUNCTION: _ossl_old_des_set_key 3065 EXIST::FUNCTION:DES KRB5_PRINCNAME_it 3066 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_PRINCNAME_it 3066 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_DecryptInit_ex 3067 EXIST::FUNCTION: i2d_OCSP_CERTID 3068 EXIST::FUNCTION: ASN1_item_d2i_bio 3069 EXIST::FUNCTION:BIO EC_POINT_dbl 3070 EXIST::FUNCTION:EC asn1_get_choice_selector 3071 EXIST::FUNCTION: i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION: ENGINE_set_table_flags 3073 EXIST::FUNCTION:ENGINE AES_options 3074 EXIST::FUNCTION:AES ENGINE_load_chil 3075 EXIST::FUNCTION:ENGINE,STATIC_ENGINE OCSP_id_cmp 3076 EXIST::FUNCTION: OCSP_BASICRESP_new 3077 EXIST::FUNCTION: OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION: KRB5_APREQ_it 3079 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_APREQ_it 3079 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_get_destroy_function 3080 EXIST::FUNCTION:ENGINE CONF_set_nconf 3081 EXIST::FUNCTION: ASN1_PRINTABLE_free 3082 EXIST::FUNCTION: OCSP_BASICRESP_get_ext_by_NID 3083 EXIST::FUNCTION: DIST_POINT_NAME_it 3084 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: DIST_POINT_NAME_it 3084 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509V3_extensions_print 3085 EXIST::FUNCTION: _ossl_old_des_cfb64_encrypt 3086 EXIST::FUNCTION:DES X509_REVOKED_add1_ext_i2d 3087 EXIST::FUNCTION: _ossl_old_des_ofb_encrypt 3088 EXIST::FUNCTION:DES KRB5_TKTBODY_new 3089 EXIST::FUNCTION: ASN1_OCTET_STRING_it 3090 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_OCTET_STRING_it 3090 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ERR_load_UI_strings 3091 EXIST::FUNCTION: i2d_KRB5_ENCKEY 3092 EXIST::FUNCTION: ASN1_template_new 3093 EXIST::FUNCTION: OCSP_SIGNATURE_free 3094 EXIST::FUNCTION: ASN1_item_i2d_fp 3095 EXIST::FUNCTION:FP_API KRB5_PRINCNAME_free 3096 EXIST::FUNCTION: PKCS7_RECIP_INFO_it 3097 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_RECIP_INFO_it 3097 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EXTENDED_KEY_USAGE_it 3098 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: EXTENDED_KEY_USAGE_it 3098 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_GFp_simple_method 3099 EXIST::FUNCTION:EC EC_GROUP_precompute_mult 3100 EXIST::FUNCTION:EC OCSP_request_onereq_get0 3101 EXIST::FUNCTION: UI_method_set_writer 3102 EXIST::FUNCTION: KRB5_AUTHENT_new 3103 EXIST::FUNCTION: X509_CRL_INFO_it 3104 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_CRL_INFO_it 3104 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: DSO_set_name_converter 3105 EXIST::FUNCTION: AES_set_decrypt_key 3106 EXIST::FUNCTION:AES PKCS7_DIGEST_it 3107 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_DIGEST_it 3107 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PKCS12_x5092certbag 3108 EXIST::FUNCTION: EVP_DigestInit_ex 3109 EXIST::FUNCTION: i2a_ACCESS_DESCRIPTION 3110 EXIST::FUNCTION: OCSP_RESPONSE_it 3111 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_RESPONSE_it 3111 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PKCS7_ENC_CONTENT_it 3112 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_ENC_CONTENT_it 3112 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_request_add0_id 3113 EXIST::FUNCTION: EC_POINT_make_affine 3114 EXIST::FUNCTION:EC DSO_get_filename 3115 EXIST::FUNCTION: OCSP_CERTSTATUS_it 3116 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_CERTSTATUS_it 3116 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_request_add1_cert 3117 EXIST::FUNCTION: UI_get0_output_string 3118 EXIST::FUNCTION: UI_dup_verify_string 3119 EXIST::FUNCTION: BN_mod_lshift 3120 EXIST::FUNCTION: KRB5_AUTHDATA_it 3121 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_AUTHDATA_it 3121 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: asn1_set_choice_selector 3122 EXIST::FUNCTION: OCSP_basic_add1_status 3123 EXIST::FUNCTION: OCSP_RESPID_free 3124 EXIST::FUNCTION: asn1_get_field_ptr 3125 EXIST::FUNCTION: UI_add_input_string 3126 EXIST::FUNCTION: OCSP_CRLID_it 3127 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION: OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION: ENGINE_load_atalla 3130 EXIST::FUNCTION:ENGINE,STATIC_ENGINE X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: USERNOTICE_it 3132 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_REQINFO_new 3133 EXIST::FUNCTION: OCSP_BASICRESP_get_ext 3134 EXIST::FUNCTION: CRYPTO_get_ex_data_implementation 3135 EXIST:!VMS:FUNCTION: CRYPTO_get_ex_data_impl 3135 EXIST:VMS:FUNCTION: ASN1_item_pack 3136 EXIST::FUNCTION: i2d_KRB5_ENCDATA 3137 EXIST::FUNCTION: X509_PURPOSE_set 3138 EXIST::FUNCTION: X509_REQ_INFO_it 3139 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_REQ_INFO_it 3139 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: UI_method_set_opener 3140 EXIST::FUNCTION: ASN1_item_ex_free 3141 EXIST::FUNCTION: ASN1_BOOLEAN_it 3142 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_BOOLEAN_it 3142 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ENGINE_get_table_flags 3143 EXIST::FUNCTION:ENGINE UI_create_method 3144 EXIST::FUNCTION: OCSP_ONEREQ_add1_ext_i2d 3145 EXIST::FUNCTION: _shadow_DES_check_key 3146 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES _shadow_DES_check_key 3146 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES d2i_OCSP_REQINFO 3147 EXIST::FUNCTION: UI_add_info_string 3148 EXIST::FUNCTION: UI_get_result_minsize 3149 EXIST::FUNCTION: ASN1_NULL_it 3150 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_NULL_it 3150 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: BN_mod_lshift1 3151 EXIST::FUNCTION: d2i_OCSP_ONEREQ 3152 EXIST::FUNCTION: OCSP_ONEREQ_new 3153 EXIST::FUNCTION: KRB5_TICKET_it 3154 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: KRB5_TICKET_it 3154 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_aes_192_cbc 3155 EXIST::FUNCTION:AES KRB5_TICKET_free 3156 EXIST::FUNCTION: UI_new 3157 EXIST::FUNCTION: OCSP_response_create 3158 EXIST::FUNCTION: _ossl_old_des_xcbc_encrypt 3159 EXIST::FUNCTION:DES PKCS7_it 3160 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PKCS7_it 3160 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_REQUEST_get_ext_by_critical 3161 EXIST:!VMS:FUNCTION: OCSP_REQUEST_get_ext_by_crit 3161 EXIST:VMS:FUNCTION: ENGINE_set_flags 3162 EXIST::FUNCTION:ENGINE _ossl_old_des_ecb_encrypt 3163 EXIST::FUNCTION:DES OCSP_response_get1_basic 3164 EXIST::FUNCTION: EVP_Digest 3165 EXIST::FUNCTION: OCSP_ONEREQ_delete_ext 3166 EXIST::FUNCTION: ASN1_TBOOLEAN_it 3167 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_TBOOLEAN_it 3167 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ASN1_item_new 3168 EXIST::FUNCTION: ASN1_TIME_to_generalizedtime 3169 EXIST::FUNCTION: BIGNUM_it 3170 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: BIGNUM_it 3170 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: AES_cbc_encrypt 3171 EXIST::FUNCTION:AES ENGINE_get_load_privkey_function 3172 EXIST:!VMS:FUNCTION:ENGINE ENGINE_get_load_privkey_fn 3172 EXIST:VMS:FUNCTION:ENGINE OCSP_RESPONSE_free 3173 EXIST::FUNCTION: UI_method_set_reader 3174 EXIST::FUNCTION: i2d_ASN1_T61STRING 3175 EXIST::FUNCTION: EC_POINT_set_to_infinity 3176 EXIST::FUNCTION:EC ERR_load_OCSP_strings 3177 EXIST::FUNCTION: EC_POINT_point2oct 3178 EXIST::FUNCTION:EC KRB5_APREQ_free 3179 EXIST::FUNCTION: ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: OCSP_crlID_new 3181 EXIST:!OS2,!VMS:FUNCTION: OCSP_crlID2_new 3181 EXIST:OS2,VMS:FUNCTION: CONF_modules_load_file 3182 EXIST::FUNCTION: CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE CONF_module_get_usr_data 3185 EXIST::FUNCTION: ASN1_add_oid_module 3186 EXIST::FUNCTION: CONF_modules_finish 3187 EXIST::FUNCTION: OPENSSL_config 3188 EXIST::FUNCTION: CONF_modules_unload 3189 EXIST::FUNCTION: CONF_imodule_get_value 3190 EXIST::FUNCTION: CONF_module_set_usr_data 3191 EXIST::FUNCTION: CONF_parse_list 3192 EXIST::FUNCTION: CONF_module_add 3193 EXIST::FUNCTION: CONF_get1_default_config_file 3194 EXIST::FUNCTION: CONF_imodule_get_flags 3195 EXIST::FUNCTION: CONF_imodule_get_module 3196 EXIST::FUNCTION: CONF_modules_load 3197 EXIST::FUNCTION: CONF_imodule_get_name 3198 EXIST::FUNCTION: ERR_peek_top_error 3199 NOEXIST::FUNCTION: CONF_imodule_get_usr_data 3200 EXIST::FUNCTION: CONF_imodule_set_flags 3201 EXIST::FUNCTION: ENGINE_add_conf_module 3202 EXIST::FUNCTION:ENGINE ERR_peek_last_error_line 3203 EXIST::FUNCTION: ERR_peek_last_error_line_data 3204 EXIST::FUNCTION: ERR_peek_last_error 3205 EXIST::FUNCTION: DES_read_2passwords 3206 EXIST::FUNCTION:DES DES_read_password 3207 EXIST::FUNCTION:DES UI_UTIL_read_pw 3208 EXIST::FUNCTION: UI_UTIL_read_pw_string 3209 EXIST::FUNCTION: ENGINE_load_aep 3210 EXIST::FUNCTION:ENGINE,STATIC_ENGINE ENGINE_load_sureware 3211 EXIST::FUNCTION:ENGINE,STATIC_ENGINE OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION: OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION: OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION: OPENSSL_add_all_algo_conf 3213 EXIST:VMS:FUNCTION: OPENSSL_load_builtin_modules 3214 EXIST::FUNCTION: AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE,STATIC_ENGINE _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES EVP_aes_128_cfb128 3222 EXIST::FUNCTION:AES EVP_aes_256_cfb128 3223 EXIST::FUNCTION:AES EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES EVP_aes_192_cfb128 3225 EXIST::FUNCTION:AES CONF_modules_free 3226 EXIST::FUNCTION: NCONF_default 3227 EXIST::FUNCTION: OPENSSL_no_config 3228 EXIST::FUNCTION: NCONF_WIN32 3229 EXIST::FUNCTION: ASN1_UNIVERSALSTRING_new 3230 EXIST::FUNCTION: EVP_des_ede_ecb 3231 EXIST::FUNCTION:DES i2d_ASN1_UNIVERSALSTRING 3232 EXIST::FUNCTION: ASN1_UNIVERSALSTRING_free 3233 EXIST::FUNCTION: ASN1_UNIVERSALSTRING_it 3234 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_UNIVERSALSTRING_it 3234 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_ASN1_UNIVERSALSTRING 3235 EXIST::FUNCTION: EVP_des_ede3_ecb 3236 EXIST::FUNCTION:DES X509_REQ_print_ex 3237 EXIST::FUNCTION:BIO ENGINE_up_ref 3238 EXIST::FUNCTION:ENGINE BUF_MEM_grow_clean 3239 EXIST::FUNCTION: CRYPTO_realloc_clean 3240 EXIST::FUNCTION: BUF_strlcat 3241 EXIST::FUNCTION: BIO_indent 3242 EXIST::FUNCTION: BUF_strlcpy 3243 EXIST::FUNCTION: OpenSSLDie 3244 EXIST::FUNCTION: OPENSSL_cleanse 3245 EXIST::FUNCTION: ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION: FIPS_selftest_des 3250 NOEXIST::FUNCTION: EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES FIPS_mode_set 3253 EXIST::FUNCTION: FIPS_selftest_dsa 3254 NOEXIST::FUNCTION: EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES FIPS_allow_md5 3256 NOEXIST::FUNCTION: DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES FIPS_rand_seeded 3259 NOEXIST::FUNCTION: AES_cfbr_encrypt_block 3260 NOEXIST::FUNCTION: AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES FIPS_rand_seed 3262 NOEXIST::FUNCTION: FIPS_corrupt_des 3263 NOEXIST::FUNCTION: EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES FIPS_selftest_aes 3265 NOEXIST::FUNCTION: FIPS_set_prng_key 3266 NOEXIST::FUNCTION: EVP_des_cfb8 3267 EXIST::FUNCTION:DES FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION: FIPS_test_mode 3269 NOEXIST::FUNCTION: FIPS_rand_method 3270 NOEXIST::FUNCTION: EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION: FIPS_corrupt_aes 3273 NOEXIST::FUNCTION: FIPS_selftest_sha1 3274 NOEXIST::FUNCTION: FIPS_selftest_rsa 3275 NOEXIST::FUNCTION: FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION: EVP_des_cfb1 3277 EXIST::FUNCTION:DES FIPS_dsa_check 3278 NOEXIST::FUNCTION: AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES FIPS_rand_check 3281 NOEXIST::FUNCTION: FIPS_md5_allowed 3282 NOEXIST::FUNCTION: FIPS_mode 3283 EXIST::FUNCTION: FIPS_selftest_failed 3284 NOEXIST::FUNCTION: sk_is_sorted 3285 EXIST::FUNCTION: X509_check_ca 3286 EXIST::FUNCTION: private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0 private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD private_RC5_32_set_key 3292 NOEXIST::FUNCTION: private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5 private_RC4_set_key 3294 EXIST::FUNCTION:RC4 private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2 private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2 private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4 private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2 d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: i2d_PROXY_POLICY 3302 EXIST::FUNCTION: i2d_PROXY_CERT_INFO_EXTENSION 3303 EXIST::FUNCTION: d2i_PROXY_POLICY 3304 EXIST::FUNCTION: PROXY_CERT_INFO_EXTENSION_new 3305 EXIST::FUNCTION: PROXY_CERT_INFO_EXTENSION_free 3306 EXIST::FUNCTION: PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: PROXY_POLICY_free 3308 EXIST::FUNCTION: PROXY_POLICY_new 3309 EXIST::FUNCTION: BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: FIPS_selftest_rng 3311 NOEXIST::FUNCTION: EVP_sha384 3312 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 EVP_sha512 3313 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256 EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256 FIPS_selftest_hmac 3316 NOEXIST::FUNCTION: FIPS_corrupt_rng 3317 NOEXIST::FUNCTION: BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA PKCS1_MGF1 3324 EXIST::FUNCTION:RSA BN_X931_generate_Xpq 3325 EXIST::FUNCTION: RSA_X931_generate_key 3326 NOEXIST::FUNCTION: BN_X931_derive_prime 3327 NOEXIST::FUNCTION: BN_X931_generate_prime 3328 NOEXIST::FUNCTION: RSA_X931_derive 3329 NOEXIST::FUNCTION: BIO_new_dgram 3330 EXIST::FUNCTION: BN_get0_nist_prime_384 3331 EXIST::FUNCTION: ERR_set_mark 3332 EXIST::FUNCTION: X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION: ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE STORE_meth_set_list_start_fn 3336 NOEXIST::FUNCTION: STORE_method_set_list_start_function 3336 NOEXIST::FUNCTION: BN_BLINDING_invert_ex 3337 EXIST::FUNCTION: NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION: STORE_ATTR_INFO_set_number 3339 NOEXIST::FUNCTION: BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:DEPRECATED X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION: POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: STORE_parse_attrs_start 3343 NOEXIST::FUNCTION: POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION: EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION: BN_nist_mod_192 3346 EXIST::FUNCTION: EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC,EC2M STORE_set_method 3348 NOEXIST::FUNCTION: GENERAL_SUBTREE_free 3349 EXIST::FUNCTION: NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH PKCS12_add_safe 3352 EXIST::FUNCTION: EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC STORE_meth_get_update_store_fn 3354 NOEXIST::FUNCTION: STORE_method_get_update_store_function 3354 NOEXIST::FUNCTION: ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE SHA512_Update 3356 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC BN_get0_nist_prime_192 3358 EXIST::FUNCTION: STORE_modify_certificate 3359 NOEXIST::FUNCTION: EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC,EC2M EC_POINT_set_affine_coords_GF2m 3360 EXIST:VMS:FUNCTION:EC,EC2M BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION:EC2M STORE_ATTR_INFO_modify_number 3362 NOEXIST::FUNCTION: X509_keyid_get0 3363 EXIST::FUNCTION: ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE pitem_new 3365 EXIST::FUNCTION: BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION:EC2M STORE_list_public_key_endp 3367 NOEXIST::FUNCTION: o2i_ECPublicKey 3368 EXIST::FUNCTION:EC EC_KEY_copy 3369 EXIST::FUNCTION:EC BIO_dump_fp 3370 EXIST::FUNCTION:FP_API X509_policy_node_get0_parent 3371 EXIST::FUNCTION: EC_GROUP_check_discriminant 3372 EXIST::FUNCTION:EC i2o_ECPublicKey 3373 EXIST::FUNCTION:EC EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC a2i_IPADDRESS 3375 EXIST::FUNCTION: STORE_meth_set_initialise_fn 3376 NOEXIST::FUNCTION: STORE_method_set_initialise_function 3376 NOEXIST::FUNCTION: X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION: X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION: EC_POINT_point2bn 3379 EXIST::FUNCTION:EC STORE_ATTR_INFO_set_dn 3380 NOEXIST::FUNCTION: X509_policy_tree_get0_policies 3381 EXIST::FUNCTION: EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC,EC2M STORE_destroy_method 3383 NOEXIST::FUNCTION: ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC STORE_ATTR_INFO_get0_number 3386 NOEXIST::FUNCTION: ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC ASN1_OCTET_STRING_NDEF_it 3389 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_OCTET_STRING_NDEF_it 3389 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: STORE_delete_public_key 3390 NOEXIST::FUNCTION: STORE_get_public_key 3391 NOEXIST::FUNCTION: STORE_modify_arbitrary 3392 NOEXIST::FUNCTION: ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE pqueue_iterator 3394 EXIST::FUNCTION: ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA OPENSSL_DIR_end 3396 EXIST::FUNCTION: BN_GF2m_mod_sqr 3397 EXIST::FUNCTION:EC2M EC_POINT_bn2point 3398 EXIST::FUNCTION:EC X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION: EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC STORE_get_method 3401 NOEXIST::FUNCTION: EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA STORE_parse_attrs_end 3404 NOEXIST::FUNCTION: EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC EC_GROUP_get_point_conv_form 3405 EXIST:VMS:FUNCTION:EC STORE_method_set_store_function 3406 NOEXIST::FUNCTION: STORE_ATTR_INFO_in 3407 NOEXIST::FUNCTION: PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC,EC2M EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION: BN_BLINDING_set_flags 3411 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION: X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION: STORE_get_number 3415 NOEXIST::FUNCTION: ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION:EC2M EC_KEY_up_ref 3418 EXIST::FUNCTION:EC POLICY_MAPPING_free 3419 EXIST::FUNCTION: BN_GF2m_mod_div 3420 EXIST::FUNCTION:EC2M X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION: EC_KEY_free 3422 EXIST::FUNCTION:EC STORE_meth_set_list_next_fn 3423 NOEXIST::FUNCTION: STORE_method_set_list_next_function 3423 NOEXIST::FUNCTION: PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC STORE_meth_get_generate_fn 3426 NOEXIST::FUNCTION: STORE_method_get_generate_function 3426 NOEXIST::FUNCTION: STORE_meth_set_list_end_fn 3427 NOEXIST::FUNCTION: STORE_method_set_list_end_function 3427 NOEXIST::FUNCTION: pqueue_print 3428 EXIST::FUNCTION: EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API BN_GF2m_mod_arr 3431 EXIST::FUNCTION:EC2M PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION: EVP_PKEY_cmp 3433 EXIST::FUNCTION: X509_policy_level_node_count 3434 EXIST::FUNCTION: STORE_new_engine 3435 NOEXIST::FUNCTION: STORE_list_public_key_start 3436 NOEXIST::FUNCTION: X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION: ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH EVP_PKEY_get_attr 3439 EXIST::FUNCTION: ECDSA_do_sign 3440 EXIST::FUNCTION:ECDSA ENGINE_unregister_ECDH 3441 EXIST::FUNCTION:ENGINE ECDH_OpenSSL 3442 EXIST::FUNCTION:ECDH EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC EC_POINT_dup 3444 EXIST::FUNCTION:EC GENERAL_SUBTREE_new 3445 EXIST::FUNCTION: STORE_list_crl_endp 3446 NOEXIST::FUNCTION: EC_get_builtin_curves 3447 EXIST::FUNCTION:EC X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION: X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION: STORE_list_crl_end 3449 NOEXIST::FUNCTION: EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION:EC2M i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC ECPKParameters_print_fp 3453 EXIST::FUNCTION:EC,FP_API pqueue_find 3454 EXIST::FUNCTION: ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC STORE_method_set_ctrl_function 3457 NOEXIST::FUNCTION: STORE_list_public_key_end 3458 NOEXIST::FUNCTION: EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC pqueue_peek 3460 EXIST::FUNCTION: STORE_get_arbitrary 3461 NOEXIST::FUNCTION: STORE_store_crl 3462 NOEXIST::FUNCTION: X509_policy_node_get0_policy 3463 EXIST::FUNCTION: PKCS12_add_safes 3464 EXIST::FUNCTION: BN_BLINDING_convert_ex 3465 EXIST::FUNCTION: X509_policy_tree_free 3466 EXIST::FUNCTION: OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION: BN_GF2m_poly2arr 3468 EXIST::FUNCTION:EC2M STORE_ctrl 3469 NOEXIST::FUNCTION: STORE_ATTR_INFO_compare 3470 NOEXIST::FUNCTION: BN_get0_nist_prime_224 3471 EXIST::FUNCTION: i2d_ECParameters 3472 EXIST::FUNCTION:EC i2d_ECPKParameters 3473 EXIST::FUNCTION:EC BN_GENCB_call 3474 EXIST::FUNCTION: d2i_ECPKParameters 3475 EXIST::FUNCTION:EC STORE_meth_set_generate_fn 3476 NOEXIST::FUNCTION: STORE_method_set_generate_function 3476 NOEXIST::FUNCTION: ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION: SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256 EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC STORE_ATTR_INFO_set_cstr 3482 NOEXIST::FUNCTION: STORE_list_crl_next 3483 NOEXIST::FUNCTION: STORE_ATTR_INFO_in_range 3484 NOEXIST::FUNCTION: ECParameters_print 3485 EXIST::FUNCTION:BIO,EC STORE_meth_set_delete_fn 3486 NOEXIST::FUNCTION: STORE_method_set_delete_function 3486 NOEXIST::FUNCTION: STORE_list_certificate_next 3487 NOEXIST::FUNCTION: ASN1_generate_nconf 3488 EXIST::FUNCTION: BUF_memdup 3489 EXIST::FUNCTION: BN_GF2m_mod_mul 3490 EXIST::FUNCTION:EC2M STORE_meth_get_list_next_fn 3491 NOEXIST::FUNCTION: STORE_method_get_list_next_function 3491 NOEXIST::FUNCTION: STORE_ATTR_INFO_get0_dn 3492 NOEXIST::FUNCTION: STORE_list_private_key_next 3493 NOEXIST::FUNCTION: EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION: STORE_ATTR_INFO_free 3496 NOEXIST::FUNCTION: STORE_get_private_key 3497 NOEXIST::FUNCTION: EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION: STORE_ATTR_INFO_new 3499 NOEXIST::FUNCTION: EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC,EC2M STORE_meth_set_revoke_fn 3501 NOEXIST::FUNCTION: STORE_method_set_revoke_function 3501 NOEXIST::FUNCTION: STORE_store_number 3502 NOEXIST::FUNCTION: BN_is_prime_ex 3503 EXIST::FUNCTION: STORE_revoke_public_key 3504 NOEXIST::FUNCTION: X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION: STORE_delete_arbitrary 3506 NOEXIST::FUNCTION: PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION: X509_STORE_set_depth 3508 EXIST::FUNCTION: ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA SHA224 3510 EXIST::FUNCTION:SHA,SHA256 BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API EC_KEY_set_group 3512 EXIST::FUNCTION:EC BUF_strndup 3513 EXIST::FUNCTION: STORE_list_certificate_start 3514 NOEXIST::FUNCTION: BN_GF2m_mod 3515 EXIST::FUNCTION:EC2M X509_REQ_check_private_key 3516 EXIST::FUNCTION: EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC ERR_load_STORE_strings 3518 NOEXIST::FUNCTION: PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC STORE_list_private_key_end 3520 NOEXIST::FUNCTION: i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA ASN1_put_eoc 3523 EXIST::FUNCTION: X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION: X509_STORE_CTX_get_expl_policy 3524 EXIST:VMS:FUNCTION: X509_VERIFY_PARAM_table_cleanup 3525 EXIST::FUNCTION: STORE_modify_private_key 3526 NOEXIST::FUNCTION: X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION: EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC EC_GFp_nist_method 3529 EXIST::FUNCTION:EC STORE_meth_set_modify_fn 3530 NOEXIST::FUNCTION: STORE_method_set_modify_function 3530 NOEXIST::FUNCTION: STORE_parse_attrs_next 3531 NOEXIST::FUNCTION: ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE,STATIC_ENGINE EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: STORE_meth_get_revoke_fn 3535 NOEXIST::FUNCTION: STORE_method_get_revoke_function 3535 NOEXIST::FUNCTION: STORE_method_set_get_function 3536 NOEXIST::FUNCTION: STORE_modify_number 3537 NOEXIST::FUNCTION: STORE_method_get_store_function 3538 NOEXIST::FUNCTION: STORE_store_private_key 3539 NOEXIST::FUNCTION: BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION:EC2M RSA_setup_blinding 3541 EXIST::FUNCTION:RSA BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM STORE_Memory 3543 NOEXIST::FUNCTION: sk_find_ex 3544 EXIST::FUNCTION: EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC,EC2M ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE POLICY_CONSTRAINTS_new 3547 EXIST::FUNCTION: BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION:EC2M ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH EC_KEY_generate_key 3550 EXIST::FUNCTION:EC SHA384_Update 3551 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 BN_GF2m_arr2poly 3552 EXIST::FUNCTION:EC2M STORE_method_get_get_function 3553 NOEXIST::FUNCTION: STORE_meth_set_cleanup_fn 3554 NOEXIST::FUNCTION: STORE_method_set_cleanup_function 3554 NOEXIST::FUNCTION: EC_GROUP_check 3555 EXIST::FUNCTION:EC d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC STORE_meth_get_lock_store_fn 3558 NOEXIST::FUNCTION: STORE_method_get_lock_store_function 3558 NOEXIST::FUNCTION: X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION: SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256 STORE_meth_set_update_store_fn 3561 NOEXIST::FUNCTION: STORE_method_set_update_store_function 3561 NOEXIST::FUNCTION: SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256 d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC ASN1_item_ndef_i2d 3564 EXIST::FUNCTION: STORE_delete_private_key 3565 NOEXIST::FUNCTION: ERR_pop_to_mark 3566 EXIST::FUNCTION: ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE X509_policy_level_get0_node 3568 EXIST::FUNCTION: i2d_PKCS7_NDEF 3569 EXIST::FUNCTION: EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC ASN1_generate_v3 3571 EXIST::FUNCTION: STORE_ATTR_INFO_modify_cstr 3572 NOEXIST::FUNCTION: X509_policy_tree_level_count 3573 EXIST::FUNCTION: BN_GF2m_add 3574 EXIST::FUNCTION:EC2M EC_KEY_get0_group 3575 EXIST::FUNCTION:EC STORE_generate_crl 3576 NOEXIST::FUNCTION: STORE_store_public_key 3577 NOEXIST::FUNCTION: X509_CERT_PAIR_free 3578 EXIST::FUNCTION: STORE_revoke_private_key 3579 NOEXIST::FUNCTION: BN_nist_mod_224 3580 EXIST::FUNCTION: SHA512_Final 3581 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 STORE_ATTR_INFO_modify_dn 3582 NOEXIST::FUNCTION: STORE_meth_get_initialise_fn 3583 NOEXIST::FUNCTION: STORE_method_get_initialise_function 3583 NOEXIST::FUNCTION: STORE_delete_number 3584 NOEXIST::FUNCTION: i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION: EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC STORE_ATTR_INFO_in_ex 3588 NOEXIST::FUNCTION: STORE_list_crl_start 3589 NOEXIST::FUNCTION: ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH STORE_meth_get_modify_fn 3591 NOEXIST::FUNCTION: STORE_method_get_modify_function 3591 NOEXIST::FUNCTION: v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION: STORE_store_certificate 3593 NOEXIST::FUNCTION: OBJ_bsearch_ex 3594 NOEXIST::FUNCTION: X509_STORE_CTX_set_default 3595 EXIST::FUNCTION: STORE_ATTR_INFO_set_sha1str 3596 NOEXIST::FUNCTION: BN_GF2m_mod_inv 3597 EXIST::FUNCTION:EC2M BN_GF2m_mod_exp 3598 EXIST::FUNCTION:EC2M STORE_modify_public_key 3599 NOEXIST::FUNCTION: STORE_meth_get_list_start_fn 3600 NOEXIST::FUNCTION: STORE_method_get_list_start_function 3600 NOEXIST::FUNCTION: EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC STORE_store_arbitrary 3602 NOEXIST::FUNCTION: STORE_meth_set_unlock_store_fn 3603 NOEXIST::FUNCTION: STORE_method_set_unlock_store_function 3603 NOEXIST::FUNCTION: BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION:EC2M ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE STORE_create_method 3606 NOEXIST::FUNCTION: ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC X509_VERIFY_PARAM_set1 3610 EXIST::FUNCTION: ECDH_set_method 3611 EXIST::FUNCTION:ECDH v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION: ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH STORE_generate_key 3614 NOEXIST::FUNCTION: BN_nist_mod_521 3615 EXIST::FUNCTION: X509_policy_tree_get0_level 3616 EXIST::FUNCTION: EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC EC_GROUP_set_point_conv_form 3617 EXIST:VMS:FUNCTION:EC PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA STORE_delete_crl 3621 NOEXIST::FUNCTION: EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC ASN1_const_check_infinite_end 3623 EXIST::FUNCTION: EVP_PKEY_delete_attr 3624 EXIST::FUNCTION: ECDSA_set_default_method 3625 EXIST::FUNCTION:ECDSA EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC,EC2M EC_POINT_set_compr_coords_GF2m 3626 EXIST:VMS:FUNCTION:EC,EC2M EC_GROUP_cmp 3627 EXIST::FUNCTION:EC STORE_revoke_certificate 3628 NOEXIST::FUNCTION: BN_get0_nist_prime_256 3629 EXIST::FUNCTION: STORE_meth_get_delete_fn 3630 NOEXIST::FUNCTION: STORE_method_get_delete_function 3630 NOEXIST::FUNCTION: SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256 PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC SHA512_Init 3633 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 STORE_parse_attrs_endp 3634 NOEXIST::FUNCTION: BN_set_negative 3635 EXIST::FUNCTION: ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC STORE_list_public_key_next 3638 NOEXIST::FUNCTION: i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION: STORE_OBJECT_free 3640 NOEXIST::FUNCTION: BN_nist_mod_384 3641 EXIST::FUNCTION: i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION: PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC ECDH_compute_key 3644 EXIST::FUNCTION:ECDH STORE_ATTR_INFO_get0_sha1str 3645 NOEXIST::FUNCTION: ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE pqueue_pop 3647 EXIST::FUNCTION: STORE_ATTR_INFO_get0_cstr 3648 NOEXIST::FUNCTION: POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: STORE_get_ex_new_index 3650 NOEXIST::FUNCTION: EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION: X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION: BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION:EC2M SHA256 3654 EXIST::FUNCTION:SHA,SHA256 i2d_ECPrivateKey_fp 3655 EXIST::FUNCTION:EC,FP_API X509_policy_tree_get0_user_policies 3656 EXIST:!VMS:FUNCTION: X509_pcy_tree_get0_usr_policies 3656 EXIST:VMS:FUNCTION: OPENSSL_DIR_read 3657 EXIST::FUNCTION: ENGINE_register_all_ECDSA 3658 EXIST::FUNCTION:ENGINE X509_VERIFY_PARAM_lookup 3659 EXIST::FUNCTION: EC_POINT_get_affine_coordinates_GF2m 3660 EXIST:!VMS:FUNCTION:EC,EC2M EC_POINT_get_affine_coords_GF2m 3660 EXIST:VMS:FUNCTION:EC,EC2M EC_GROUP_dup 3661 EXIST::FUNCTION:EC ENGINE_get_default_ECDSA 3662 EXIST::FUNCTION:ENGINE EC_KEY_new 3663 EXIST::FUNCTION:EC SHA256_Transform 3664 EXIST::FUNCTION:SHA,SHA256 EC_KEY_set_enc_flags 3665 EXIST::FUNCTION:EC ECDSA_verify 3666 EXIST::FUNCTION:ECDSA EC_POINT_point2hex 3667 EXIST::FUNCTION:EC ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE SHA512 3669 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 STORE_get_certificate 3670 NOEXIST::FUNCTION: ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API STORE_delete_certificate 3674 NOEXIST::FUNCTION: SHA512_Transform 3675 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 X509_STORE_set1_param 3676 EXIST::FUNCTION: STORE_method_get_ctrl_function 3677 NOEXIST::FUNCTION: STORE_free 3678 NOEXIST::FUNCTION: PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC STORE_meth_get_unlock_store_fn 3680 NOEXIST::FUNCTION: STORE_method_get_unlock_store_function 3680 NOEXIST::FUNCTION: STORE_get_ex_data 3681 NOEXIST::FUNCTION: EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC X509_CERT_PAIR_new 3684 EXIST::FUNCTION: ENGINE_register_STORE 3685 EXIST::FUNCTION:ENGINE RSA_generate_key_ex 3686 EXIST::FUNCTION:RSA DSA_generate_parameters_ex 3687 EXIST::FUNCTION:DSA ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API X509V3_NAME_from_section 3689 EXIST::FUNCTION: EVP_PKEY_add1_attr 3690 EXIST::FUNCTION: STORE_modify_crl 3691 NOEXIST::FUNCTION: STORE_list_private_key_start 3692 NOEXIST::FUNCTION: POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: GENERAL_SUBTREE_it 3694 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EC_GROUP_get_curve_name 3695 EXIST::FUNCTION:EC PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION: BIO_dump_indent_cb 3697 EXIST::FUNCTION: d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION: STORE_list_private_key_endp 3699 NOEXIST::FUNCTION: asn1_const_Finish 3700 EXIST::FUNCTION: i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API BN_nist_mod_256 3702 EXIST::FUNCTION: X509_VERIFY_PARAM_add0_table 3703 EXIST::FUNCTION: pqueue_free 3704 EXIST::FUNCTION: BN_BLINDING_create_param 3705 EXIST::FUNCTION: ECDSA_size 3706 EXIST::FUNCTION:ECDSA d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC BN_get0_nist_prime_521 3708 EXIST::FUNCTION: STORE_ATTR_INFO_modify_sha1str 3709 NOEXIST::FUNCTION: BN_generate_prime_ex 3710 EXIST::FUNCTION: EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256 DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC STORE_meth_get_cleanup_fn 3715 NOEXIST::FUNCTION: STORE_method_get_cleanup_function 3715 NOEXIST::FUNCTION: ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION: ECDSA_sign 3719 EXIST::FUNCTION:ECDSA X509_policy_check 3720 EXIST::FUNCTION: EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION: STORE_set_ex_data 3722 NOEXIST::FUNCTION: ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE EVP_ecdsa 3724 EXIST::FUNCTION:SHA BN_BLINDING_get_flags 3725 EXIST::FUNCTION: PKCS12_add_cert 3726 EXIST::FUNCTION: STORE_OBJECT_new 3727 NOEXIST::FUNCTION: ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH EC_KEY_dup 3729 EXIST::FUNCTION:EC EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION: ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA a2i_IPADDRESS_NC 3732 EXIST::FUNCTION: d2i_ECParameters 3733 EXIST::FUNCTION:EC STORE_list_certificate_end 3734 NOEXIST::FUNCTION: STORE_get_crl 3735 NOEXIST::FUNCTION: X509_POLICY_NODE_print 3736 EXIST::FUNCTION: SHA384_Init 3737 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC,EC2M ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA SHA384_Final 3740 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 PKCS7_set_digest 3741 EXIST::FUNCTION: EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC STORE_meth_set_lock_store_fn 3743 NOEXIST::FUNCTION: STORE_method_set_lock_store_function 3743 NOEXIST::FUNCTION: ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA SHA384 3745 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 POLICY_MAPPING_new 3746 EXIST::FUNCTION: STORE_list_certificate_endp 3747 NOEXIST::FUNCTION: X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION: EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC EC_KEY_check_key 3750 EXIST::FUNCTION:EC d2i_EC_PUBKEY_fp 3751 EXIST::FUNCTION:EC,FP_API PKCS7_set0_type_other 3752 EXIST::FUNCTION: PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION: pqueue_next 3754 EXIST::FUNCTION: STORE_meth_get_list_end_fn 3755 NOEXIST::FUNCTION: STORE_method_get_list_end_function 3755 NOEXIST::FUNCTION: EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION: X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION: pqueue_new 3758 EXIST::FUNCTION: ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE STORE_new_method 3760 NOEXIST::FUNCTION: PKCS12_add_key 3761 EXIST::FUNCTION: DSO_merge 3762 EXIST::FUNCTION: EC_POINT_hex2point 3763 EXIST::FUNCTION:EC BIO_dump_cb 3764 EXIST::FUNCTION: SHA256_Update 3765 EXIST::FUNCTION:SHA,SHA256 pqueue_insert 3766 EXIST::FUNCTION: pitem_free 3767 EXIST::FUNCTION: BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION:EC2M ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:DEPRECATED get_rfc3526_prime_8192 3771 EXIST::FUNCTION: X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION: get_rfc2409_prime_1024 3773 EXIST::FUNCTION: DH_check_pub_key 3774 EXIST::FUNCTION:DH get_rfc3526_prime_2048 3775 EXIST::FUNCTION: get_rfc3526_prime_6144 3776 EXIST::FUNCTION: get_rfc3526_prime_1536 3777 EXIST::FUNCTION: get_rfc3526_prime_3072 3778 EXIST::FUNCTION: get_rfc3526_prime_4096 3779 EXIST::FUNCTION: get_rfc2409_prime_768 3780 EXIST::FUNCTION: X509_VERIFY_PARAM_get_flags 3781 EXIST::FUNCTION: EVP_CIPHER_CTX_new 3782 EXIST::FUNCTION: EVP_CIPHER_CTX_free 3783 EXIST::FUNCTION: Camellia_cbc_encrypt 3784 EXIST::FUNCTION:CAMELLIA Camellia_cfb128_encrypt 3785 EXIST::FUNCTION:CAMELLIA Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA Camellia_cfbr_encrypt_block 3789 NOEXIST::FUNCTION: Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA Camellia_ofb128_encrypt 3793 EXIST::FUNCTION:CAMELLIA Camellia_set_key 3794 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_cbc 3795 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_cfb128 3796 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_cfb1 3797 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_cfb8 3798 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_ecb 3799 EXIST::FUNCTION:CAMELLIA EVP_camellia_128_ofb 3800 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_cbc 3801 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_cfb128 3802 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_cfb1 3803 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_cfb8 3804 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_ecb 3805 EXIST::FUNCTION:CAMELLIA EVP_camellia_192_ofb 3806 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_cbc 3807 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_cfb128 3808 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_cfb1 3809 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_cfb8 3810 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_ecb 3811 EXIST::FUNCTION:CAMELLIA EVP_camellia_256_ofb 3812 EXIST::FUNCTION:CAMELLIA a2i_ipadd 3813 EXIST::FUNCTION: ASIdentifiers_free 3814 EXIST::FUNCTION:RFC3779 i2d_ASIdOrRange 3815 EXIST::FUNCTION:RFC3779 EVP_CIPHER_block_size 3816 EXIST::FUNCTION: v3_asid_is_canonical 3817 EXIST::FUNCTION:RFC3779 IPAddressChoice_free 3818 EXIST::FUNCTION:RFC3779 EVP_CIPHER_CTX_set_app_data 3819 EXIST::FUNCTION: BIO_set_callback_arg 3820 EXIST::FUNCTION: v3_addr_add_prefix 3821 EXIST::FUNCTION:RFC3779 IPAddressOrRange_it 3822 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 IPAddressOrRange_it 3822 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 BIO_set_flags 3823 EXIST::FUNCTION: ASIdentifiers_it 3824 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 ASIdentifiers_it 3824 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 v3_addr_get_range 3825 EXIST::FUNCTION:RFC3779 BIO_method_type 3826 EXIST::FUNCTION: v3_addr_inherits 3827 EXIST::FUNCTION:RFC3779 IPAddressChoice_it 3828 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 IPAddressChoice_it 3828 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 AES_ige_encrypt 3829 EXIST::FUNCTION:AES v3_addr_add_range 3830 EXIST::FUNCTION:RFC3779 EVP_CIPHER_CTX_nid 3831 EXIST::FUNCTION: d2i_ASRange 3832 EXIST::FUNCTION:RFC3779 v3_addr_add_inherit 3833 EXIST::FUNCTION:RFC3779 v3_asid_add_id_or_range 3834 EXIST::FUNCTION:RFC3779 v3_addr_validate_resource_set 3835 EXIST::FUNCTION:RFC3779 EVP_CIPHER_iv_length 3836 EXIST::FUNCTION: EVP_MD_type 3837 EXIST::FUNCTION: v3_asid_canonize 3838 EXIST::FUNCTION:RFC3779 IPAddressRange_free 3839 EXIST::FUNCTION:RFC3779 v3_asid_add_inherit 3840 EXIST::FUNCTION:RFC3779 EVP_CIPHER_CTX_key_length 3841 EXIST::FUNCTION: IPAddressRange_new 3842 EXIST::FUNCTION:RFC3779 ASIdOrRange_new 3843 EXIST::FUNCTION:RFC3779 EVP_MD_size 3844 EXIST::FUNCTION: EVP_MD_CTX_test_flags 3845 EXIST::FUNCTION: BIO_clear_flags 3846 EXIST::FUNCTION: i2d_ASRange 3847 EXIST::FUNCTION:RFC3779 IPAddressRange_it 3848 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 IPAddressRange_it 3848 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 IPAddressChoice_new 3849 EXIST::FUNCTION:RFC3779 ASIdentifierChoice_new 3850 EXIST::FUNCTION:RFC3779 ASRange_free 3851 EXIST::FUNCTION:RFC3779 EVP_MD_pkey_type 3852 EXIST::FUNCTION: EVP_MD_CTX_clear_flags 3853 EXIST::FUNCTION: IPAddressFamily_free 3854 EXIST::FUNCTION:RFC3779 i2d_IPAddressFamily 3855 EXIST::FUNCTION:RFC3779 IPAddressOrRange_new 3856 EXIST::FUNCTION:RFC3779 EVP_CIPHER_flags 3857 EXIST::FUNCTION: v3_asid_validate_resource_set 3858 EXIST::FUNCTION:RFC3779 d2i_IPAddressRange 3859 EXIST::FUNCTION:RFC3779 AES_bi_ige_encrypt 3860 EXIST::FUNCTION:AES BIO_get_callback 3861 EXIST::FUNCTION: IPAddressOrRange_free 3862 EXIST::FUNCTION:RFC3779 v3_addr_subset 3863 EXIST::FUNCTION:RFC3779 d2i_IPAddressFamily 3864 EXIST::FUNCTION:RFC3779 v3_asid_subset 3865 EXIST::FUNCTION:RFC3779 BIO_test_flags 3866 EXIST::FUNCTION: i2d_ASIdentifierChoice 3867 EXIST::FUNCTION:RFC3779 ASRange_it 3868 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 ASRange_it 3868 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 d2i_ASIdentifiers 3869 EXIST::FUNCTION:RFC3779 ASRange_new 3870 EXIST::FUNCTION:RFC3779 d2i_IPAddressChoice 3871 EXIST::FUNCTION:RFC3779 v3_addr_get_afi 3872 EXIST::FUNCTION:RFC3779 EVP_CIPHER_key_length 3873 EXIST::FUNCTION: EVP_Cipher 3874 EXIST::FUNCTION: i2d_IPAddressOrRange 3875 EXIST::FUNCTION:RFC3779 ASIdOrRange_it 3876 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 ASIdOrRange_it 3876 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 EVP_CIPHER_nid 3877 EXIST::FUNCTION: i2d_IPAddressChoice 3878 EXIST::FUNCTION:RFC3779 EVP_CIPHER_CTX_block_size 3879 EXIST::FUNCTION: ASIdentifiers_new 3880 EXIST::FUNCTION:RFC3779 v3_addr_validate_path 3881 EXIST::FUNCTION:RFC3779 IPAddressFamily_new 3882 EXIST::FUNCTION:RFC3779 EVP_MD_CTX_set_flags 3883 EXIST::FUNCTION: v3_addr_is_canonical 3884 EXIST::FUNCTION:RFC3779 i2d_IPAddressRange 3885 EXIST::FUNCTION:RFC3779 IPAddressFamily_it 3886 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 IPAddressFamily_it 3886 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 v3_asid_inherits 3887 EXIST::FUNCTION:RFC3779 EVP_CIPHER_CTX_cipher 3888 EXIST::FUNCTION: EVP_CIPHER_CTX_get_app_data 3889 EXIST::FUNCTION: EVP_MD_block_size 3890 EXIST::FUNCTION: EVP_CIPHER_CTX_flags 3891 EXIST::FUNCTION: v3_asid_validate_path 3892 EXIST::FUNCTION:RFC3779 d2i_IPAddressOrRange 3893 EXIST::FUNCTION:RFC3779 v3_addr_canonize 3894 EXIST::FUNCTION:RFC3779 ASIdentifierChoice_it 3895 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 ASIdentifierChoice_it 3895 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 EVP_MD_CTX_md 3896 EXIST::FUNCTION: d2i_ASIdentifierChoice 3897 EXIST::FUNCTION:RFC3779 BIO_method_name 3898 EXIST::FUNCTION: EVP_CIPHER_CTX_iv_length 3899 EXIST::FUNCTION: ASIdOrRange_free 3900 EXIST::FUNCTION:RFC3779 ASIdentifierChoice_free 3901 EXIST::FUNCTION:RFC3779 BIO_get_callback_arg 3902 EXIST::FUNCTION: BIO_set_callback 3903 EXIST::FUNCTION: d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 CRYPTO_memcmp 3906 EXIST::FUNCTION: BN_consttime_swap 3907 EXIST::FUNCTION: SEED_decrypt 3908 EXIST::FUNCTION:SEED SEED_encrypt 3909 EXIST::FUNCTION:SEED SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED EVP_seed_ofb 3911 EXIST::FUNCTION:SEED SEED_cfb128_encrypt 3912 EXIST::FUNCTION:SEED SEED_ofb128_encrypt 3913 EXIST::FUNCTION:SEED EVP_seed_cbc 3914 EXIST::FUNCTION:SEED SEED_ecb_encrypt 3915 EXIST::FUNCTION:SEED EVP_seed_ecb 3916 EXIST::FUNCTION:SEED SEED_set_key 3917 EXIST::FUNCTION:SEED EVP_seed_cfb128 3918 EXIST::FUNCTION:SEED X509_EXTENSIONS_it 3919 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_EXTENSIONS_it 3919 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_get1_ocsp 3920 EXIST::FUNCTION: OCSP_REQ_CTX_free 3921 EXIST::FUNCTION: i2d_X509_EXTENSIONS 3922 EXIST::FUNCTION: OCSP_sendreq_nbio 3923 EXIST::FUNCTION: OCSP_sendreq_new 3924 EXIST::FUNCTION: d2i_X509_EXTENSIONS 3925 EXIST::FUNCTION: X509_ALGORS_it 3926 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: X509_ALGORS_it 3926 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509_ALGOR_get0 3927 EXIST::FUNCTION: X509_ALGOR_set0 3928 EXIST::FUNCTION: AES_unwrap_key 3929 EXIST::FUNCTION:AES AES_wrap_key 3930 EXIST::FUNCTION:AES X509at_get0_data_by_OBJ 3931 EXIST::FUNCTION: ASN1_TYPE_set1 3932 EXIST::FUNCTION: ASN1_STRING_set0 3933 EXIST::FUNCTION: i2d_X509_ALGORS 3934 EXIST::FUNCTION: BIO_f_zlib 3935 EXIST:ZLIB:FUNCTION:COMP COMP_zlib_cleanup 3936 EXIST::FUNCTION:COMP d2i_X509_ALGORS 3937 EXIST::FUNCTION: CMS_ReceiptRequest_free 3938 EXIST::FUNCTION:CMS PEM_write_CMS 3939 EXIST:!WIN16:FUNCTION:CMS CMS_add0_CertificateChoices 3940 EXIST::FUNCTION:CMS CMS_unsigned_add1_attr_by_OBJ 3941 EXIST::FUNCTION:CMS ERR_load_CMS_strings 3942 EXIST::FUNCTION:CMS CMS_sign_receipt 3943 EXIST::FUNCTION:CMS i2d_CMS_ContentInfo 3944 EXIST::FUNCTION:CMS CMS_signed_delete_attr 3945 EXIST::FUNCTION:CMS d2i_CMS_bio 3946 EXIST::FUNCTION:CMS CMS_unsigned_get_attr_by_NID 3947 EXIST::FUNCTION:CMS CMS_verify 3948 EXIST::FUNCTION:CMS SMIME_read_CMS 3949 EXIST::FUNCTION:CMS CMS_decrypt_set1_key 3950 EXIST::FUNCTION:CMS CMS_SignerInfo_get0_algs 3951 EXIST::FUNCTION:CMS CMS_add1_cert 3952 EXIST::FUNCTION:CMS CMS_set_detached 3953 EXIST::FUNCTION:CMS CMS_encrypt 3954 EXIST::FUNCTION:CMS CMS_EnvelopedData_create 3955 EXIST::FUNCTION:CMS CMS_uncompress 3956 EXIST::FUNCTION:CMS CMS_add0_crl 3957 EXIST::FUNCTION:CMS CMS_SignerInfo_verify_content 3958 EXIST::FUNCTION:CMS CMS_unsigned_get0_data_by_OBJ 3959 EXIST::FUNCTION:CMS PEM_write_bio_CMS 3960 EXIST::FUNCTION:CMS CMS_unsigned_get_attr 3961 EXIST::FUNCTION:CMS CMS_RecipientInfo_ktri_cert_cmp 3962 EXIST::FUNCTION:CMS CMS_RecipientInfo_ktri_get0_algs 3963 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_ktri_get0_algs 3963 EXIST:VMS:FUNCTION:CMS CMS_ContentInfo_free 3964 EXIST::FUNCTION:CMS CMS_final 3965 EXIST::FUNCTION:CMS CMS_add_simple_smimecap 3966 EXIST::FUNCTION:CMS CMS_SignerInfo_verify 3967 EXIST::FUNCTION:CMS CMS_data 3968 EXIST::FUNCTION:CMS CMS_ContentInfo_it 3969 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS CMS_ContentInfo_it 3969 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS d2i_CMS_ReceiptRequest 3970 EXIST::FUNCTION:CMS CMS_compress 3971 EXIST::FUNCTION:CMS CMS_digest_create 3972 EXIST::FUNCTION:CMS CMS_SignerInfo_cert_cmp 3973 EXIST::FUNCTION:CMS CMS_SignerInfo_sign 3974 EXIST::FUNCTION:CMS CMS_data_create 3975 EXIST::FUNCTION:CMS i2d_CMS_bio 3976 EXIST::FUNCTION:CMS CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS CMS_decrypt 3978 EXIST::FUNCTION:CMS int_smime_write_ASN1 3979 NOEXIST::FUNCTION: CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS CMS_add_smimecap 3982 EXIST::FUNCTION:CMS PEM_read_CMS 3983 EXIST:!WIN16:FUNCTION:CMS CMS_signed_get_attr_by_OBJ 3984 EXIST::FUNCTION:CMS d2i_CMS_ContentInfo 3985 EXIST::FUNCTION:CMS CMS_add_standard_smimecap 3986 EXIST::FUNCTION:CMS CMS_ContentInfo_new 3987 EXIST::FUNCTION:CMS CMS_RecipientInfo_type 3988 EXIST::FUNCTION:CMS CMS_get0_type 3989 EXIST::FUNCTION:CMS CMS_is_detached 3990 EXIST::FUNCTION:CMS CMS_sign 3991 EXIST::FUNCTION:CMS CMS_signed_add1_attr 3992 EXIST::FUNCTION:CMS CMS_unsigned_get_attr_by_OBJ 3993 EXIST::FUNCTION:CMS SMIME_write_CMS 3994 EXIST::FUNCTION:CMS CMS_EncryptedData_decrypt 3995 EXIST::FUNCTION:CMS CMS_get0_RecipientInfos 3996 EXIST::FUNCTION:CMS CMS_add0_RevocationInfoChoice 3997 EXIST::FUNCTION:CMS CMS_decrypt_set1_pkey 3998 EXIST::FUNCTION:CMS CMS_SignerInfo_set1_signer_cert 3999 EXIST::FUNCTION:CMS CMS_get0_signers 4000 EXIST::FUNCTION:CMS CMS_ReceiptRequest_get0_values 4001 EXIST::FUNCTION:CMS CMS_signed_get0_data_by_OBJ 4002 EXIST::FUNCTION:CMS CMS_get0_SignerInfos 4003 EXIST::FUNCTION:CMS CMS_add0_cert 4004 EXIST::FUNCTION:CMS CMS_EncryptedData_encrypt 4005 EXIST::FUNCTION:CMS CMS_digest_verify 4006 EXIST::FUNCTION:CMS CMS_set1_signers_certs 4007 EXIST::FUNCTION:CMS CMS_signed_get_attr 4008 EXIST::FUNCTION:CMS CMS_RecipientInfo_set0_key 4009 EXIST::FUNCTION:CMS CMS_SignedData_init 4010 EXIST::FUNCTION:CMS CMS_RecipientInfo_kekri_get0_id 4011 EXIST::FUNCTION:CMS CMS_verify_receipt 4012 EXIST::FUNCTION:CMS CMS_ReceiptRequest_it 4013 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS CMS_ReceiptRequest_it 4013 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS PEM_read_bio_CMS 4014 EXIST::FUNCTION:CMS CMS_get1_crls 4015 EXIST::FUNCTION:CMS CMS_add0_recipient_key 4016 EXIST::FUNCTION:CMS SMIME_read_ASN1 4017 EXIST::FUNCTION: CMS_ReceiptRequest_new 4018 EXIST::FUNCTION:CMS CMS_get0_content 4019 EXIST::FUNCTION:CMS CMS_get1_ReceiptRequest 4020 EXIST::FUNCTION:CMS CMS_signed_add1_attr_by_OBJ 4021 EXIST::FUNCTION:CMS CMS_RecipientInfo_kekri_id_cmp 4022 EXIST::FUNCTION:CMS CMS_add1_ReceiptRequest 4023 EXIST::FUNCTION:CMS CMS_SignerInfo_get0_signer_id 4024 EXIST::FUNCTION:CMS CMS_unsigned_add1_attr_by_NID 4025 EXIST::FUNCTION:CMS CMS_unsigned_add1_attr 4026 EXIST::FUNCTION:CMS CMS_signed_get_attr_by_NID 4027 EXIST::FUNCTION:CMS CMS_get1_certs 4028 EXIST::FUNCTION:CMS CMS_signed_add1_attr_by_NID 4029 EXIST::FUNCTION:CMS CMS_unsigned_add1_attr_by_txt 4030 EXIST::FUNCTION:CMS CMS_dataFinal 4031 EXIST::FUNCTION:CMS CMS_RecipientInfo_ktri_get0_signer_id 4032 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_ktri_get0_sigr_id 4032 EXIST:VMS:FUNCTION:CMS i2d_CMS_ReceiptRequest 4033 EXIST::FUNCTION:CMS CMS_add1_recipient_cert 4034 EXIST::FUNCTION:CMS CMS_dataInit 4035 EXIST::FUNCTION:CMS CMS_signed_add1_attr_by_txt 4036 EXIST::FUNCTION:CMS CMS_RecipientInfo_decrypt 4037 EXIST::FUNCTION:CMS CMS_signed_get_attr_count 4038 EXIST::FUNCTION:CMS CMS_get0_eContentType 4039 EXIST::FUNCTION:CMS CMS_set1_eContentType 4040 EXIST::FUNCTION:CMS CMS_ReceiptRequest_create0 4041 EXIST::FUNCTION:CMS CMS_add1_signer 4042 EXIST::FUNCTION:CMS CMS_RecipientInfo_set0_pkey 4043 EXIST::FUNCTION:CMS ENGINE_set_load_ssl_client_cert_function 4044 EXIST:!VMS:FUNCTION:ENGINE ENGINE_set_ld_ssl_clnt_cert_fn 4044 EXIST:VMS:FUNCTION:ENGINE ENGINE_get_ssl_client_cert_function 4045 EXIST:!VMS:FUNCTION:ENGINE ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE ENGINE_load_capi 4047 EXIST::FUNCTION:ENGINE,STATIC_ENGINE OPENSSL_isservice 4048 EXIST::FUNCTION: FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION: EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION: FIPS_rand_status 4051 NOEXIST::FUNCTION: FIPS_rand_set_key 4052 NOEXIST::FUNCTION: CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION: RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION: int_ERR_set_state_func 4055 NOEXIST::FUNCTION: int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION: int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION: FIPS_rng_stick 4058 NOEXIST::FUNCTION: EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION: BN_X931_generate_prime_ex 4060 EXIST::FUNCTION: FIPS_selftest_check 4061 NOEXIST::FUNCTION: FIPS_rand_set_dt 4062 NOEXIST::FUNCTION: CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION: FIPS_dsa_free 4064 NOEXIST::FUNCTION: RSA_X931_derive_ex 4065 NOEXIST::FUNCTION: FIPS_rsa_new 4066 NOEXIST::FUNCTION: FIPS_rand_bytes 4067 NOEXIST::FUNCTION: fips_cipher_test 4068 NOEXIST::FUNCTION: EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION: CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION: CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION: FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION: FIPS_dh_new 4073 NOEXIST::FUNCTION: FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: FIPS_dh_free 4075 NOEXIST::FUNCTION: fips_pkey_signature_test 4076 NOEXIST::FUNCTION: EVP_add_alg_module 4077 EXIST::FUNCTION: int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: FIPS_rand_test_mode 4081 NOEXIST::FUNCTION: FIPS_rand_reset 4082 NOEXIST::FUNCTION: FIPS_dsa_new 4083 NOEXIST::FUNCTION: int_RAND_set_callbacks 4084 NOEXIST::FUNCTION: BN_X931_derive_prime_ex 4085 EXIST::FUNCTION: int_ERR_lib_init 4086 NOEXIST::FUNCTION: int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION: FIPS_rsa_free 4088 NOEXIST::FUNCTION: FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION: CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION: OPENSSL_init 4091 EXIST::FUNCTION: private_Camellia_set_key 4092 EXIST:OPENSSL_FIPS:FUNCTION:CAMELLIA CRYPTO_strdup 4093 EXIST::FUNCTION: JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE JPAKE_get_shared_key 4096 EXIST::FUNCTION:JPAKE JPAKE_STEP3B_init 4097 EXIST::FUNCTION:JPAKE JPAKE_STEP1_generate 4098 EXIST::FUNCTION:JPAKE JPAKE_STEP1_init 4099 EXIST::FUNCTION:JPAKE JPAKE_STEP3B_process 4100 EXIST::FUNCTION:JPAKE JPAKE_STEP2_generate 4101 EXIST::FUNCTION:JPAKE JPAKE_CTX_new 4102 EXIST::FUNCTION:JPAKE JPAKE_CTX_free 4103 EXIST::FUNCTION:JPAKE JPAKE_STEP3B_release 4104 EXIST::FUNCTION:JPAKE JPAKE_STEP3A_release 4105 EXIST::FUNCTION:JPAKE JPAKE_STEP2_process 4106 EXIST::FUNCTION:JPAKE JPAKE_STEP3B_generate 4107 EXIST::FUNCTION:JPAKE JPAKE_STEP1_process 4108 EXIST::FUNCTION:JPAKE JPAKE_STEP3A_generate 4109 EXIST::FUNCTION:JPAKE JPAKE_STEP2_release 4110 EXIST::FUNCTION:JPAKE JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE pqueue_size 4114 EXIST::FUNCTION: i2d_TS_ACCURACY 4115 EXIST::FUNCTION: i2d_TS_MSG_IMPRINT_fp 4116 EXIST::FUNCTION: i2d_TS_MSG_IMPRINT 4117 EXIST::FUNCTION: EVP_PKEY_print_public 4118 EXIST::FUNCTION: EVP_PKEY_CTX_new 4119 EXIST::FUNCTION: i2d_TS_TST_INFO 4120 EXIST::FUNCTION: EVP_PKEY_asn1_find 4121 EXIST::FUNCTION: DSO_METHOD_beos 4122 EXIST::FUNCTION: TS_CONF_load_cert 4123 EXIST::FUNCTION: TS_REQ_get_ext 4124 EXIST::FUNCTION: EVP_PKEY_sign_init 4125 EXIST::FUNCTION: ASN1_item_print 4126 EXIST::FUNCTION: TS_TST_INFO_set_nonce 4127 EXIST::FUNCTION: TS_RESP_dup 4128 EXIST::FUNCTION: ENGINE_register_pkey_meths 4129 EXIST::FUNCTION:ENGINE EVP_PKEY_asn1_add0 4130 EXIST::FUNCTION: PKCS7_add0_attrib_signing_time 4131 EXIST::FUNCTION: i2d_TS_TST_INFO_fp 4132 EXIST::FUNCTION: BIO_asn1_get_prefix 4133 EXIST::FUNCTION: TS_TST_INFO_set_time 4134 EXIST::FUNCTION: EVP_PKEY_meth_set_decrypt 4135 EXIST::FUNCTION: EVP_PKEY_set_type_str 4136 EXIST::FUNCTION: EVP_PKEY_CTX_get_keygen_info 4137 EXIST::FUNCTION: TS_REQ_set_policy_id 4138 EXIST::FUNCTION: d2i_TS_RESP_fp 4139 EXIST::FUNCTION: ENGINE_get_pkey_asn1_meth_engine 4140 EXIST:!VMS:FUNCTION:ENGINE ENGINE_get_pkey_asn1_meth_eng 4140 EXIST:VMS:FUNCTION:ENGINE WHIRLPOOL_Init 4141 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL TS_RESP_set_status_info 4142 EXIST::FUNCTION: EVP_PKEY_keygen 4143 EXIST::FUNCTION: EVP_DigestSignInit 4144 EXIST::FUNCTION: TS_ACCURACY_set_millis 4145 EXIST::FUNCTION: TS_REQ_dup 4146 EXIST::FUNCTION: GENERAL_NAME_dup 4147 EXIST::FUNCTION: ASN1_SEQUENCE_ANY_it 4148 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_SEQUENCE_ANY_it 4148 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: WHIRLPOOL 4149 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL X509_STORE_get1_crls 4150 EXIST::FUNCTION: ENGINE_get_pkey_asn1_meth 4151 EXIST::FUNCTION:ENGINE EVP_PKEY_asn1_new 4152 EXIST::FUNCTION: BIO_new_NDEF 4153 EXIST::FUNCTION: ENGINE_get_pkey_meth 4154 EXIST::FUNCTION:ENGINE TS_MSG_IMPRINT_set_algo 4155 EXIST::FUNCTION: i2d_TS_TST_INFO_bio 4156 EXIST::FUNCTION: TS_TST_INFO_set_ordering 4157 EXIST::FUNCTION: TS_TST_INFO_get_ext_by_OBJ 4158 EXIST::FUNCTION: CRYPTO_THREADID_set_pointer 4159 EXIST::FUNCTION: TS_CONF_get_tsa_section 4160 EXIST::FUNCTION: SMIME_write_ASN1 4161 EXIST::FUNCTION: TS_RESP_CTX_set_signer_key 4162 EXIST::FUNCTION: EVP_PKEY_encrypt_old 4163 EXIST::FUNCTION: EVP_PKEY_encrypt_init 4164 EXIST::FUNCTION: CRYPTO_THREADID_cpy 4165 EXIST::FUNCTION: ASN1_PCTX_get_cert_flags 4166 EXIST::FUNCTION: i2d_ESS_SIGNING_CERT 4167 EXIST::FUNCTION: TS_CONF_load_key 4168 EXIST::FUNCTION: i2d_ASN1_SEQUENCE_ANY 4169 EXIST::FUNCTION: d2i_TS_MSG_IMPRINT_bio 4170 EXIST::FUNCTION: EVP_PKEY_asn1_set_public 4171 EXIST::FUNCTION: b2i_PublicKey_bio 4172 EXIST::FUNCTION: BIO_asn1_set_prefix 4173 EXIST::FUNCTION: EVP_PKEY_new_mac_key 4174 EXIST::FUNCTION: BIO_new_CMS 4175 EXIST::FUNCTION:CMS CRYPTO_THREADID_cmp 4176 EXIST::FUNCTION: TS_REQ_ext_free 4177 EXIST::FUNCTION: EVP_PKEY_asn1_set_free 4178 EXIST::FUNCTION: EVP_PKEY_get0_asn1 4179 EXIST::FUNCTION: d2i_NETSCAPE_X509 4180 EXIST::FUNCTION: EVP_PKEY_verify_recover_init 4181 EXIST::FUNCTION: EVP_PKEY_CTX_set_data 4182 EXIST::FUNCTION: EVP_PKEY_keygen_init 4183 EXIST::FUNCTION: TS_RESP_CTX_set_status_info 4184 EXIST::FUNCTION: TS_MSG_IMPRINT_get_algo 4185 EXIST::FUNCTION: TS_REQ_print_bio 4186 EXIST::FUNCTION: EVP_PKEY_CTX_ctrl_str 4187 EXIST::FUNCTION: EVP_PKEY_get_default_digest_nid 4188 EXIST::FUNCTION: PEM_write_bio_PKCS7_stream 4189 EXIST::FUNCTION: TS_MSG_IMPRINT_print_bio 4190 EXIST::FUNCTION: BN_asc2bn 4191 EXIST::FUNCTION: TS_REQ_get_policy_id 4192 EXIST::FUNCTION: ENGINE_set_default_pkey_asn1_meths 4193 EXIST:!VMS:FUNCTION:ENGINE ENGINE_set_def_pkey_asn1_meths 4193 EXIST:VMS:FUNCTION:ENGINE d2i_TS_ACCURACY 4194 EXIST::FUNCTION: DSO_global_lookup 4195 EXIST::FUNCTION: TS_CONF_set_tsa_name 4196 EXIST::FUNCTION: i2d_ASN1_SET_ANY 4197 EXIST::FUNCTION: ENGINE_load_gost 4198 EXIST::FUNCTION:ENGINE,GOST,STATIC_ENGINE WHIRLPOOL_BitUpdate 4199 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL ASN1_PCTX_get_flags 4200 EXIST::FUNCTION: TS_TST_INFO_get_ext_by_NID 4201 EXIST::FUNCTION: TS_RESP_new 4202 EXIST::FUNCTION: ESS_CERT_ID_dup 4203 EXIST::FUNCTION: TS_STATUS_INFO_dup 4204 EXIST::FUNCTION: TS_REQ_delete_ext 4205 EXIST::FUNCTION: EVP_DigestVerifyFinal 4206 EXIST::FUNCTION: EVP_PKEY_print_params 4207 EXIST::FUNCTION: i2d_CMS_bio_stream 4208 EXIST::FUNCTION:CMS TS_REQ_get_msg_imprint 4209 EXIST::FUNCTION: OBJ_find_sigid_by_algs 4210 EXIST::FUNCTION: TS_TST_INFO_get_serial 4211 EXIST::FUNCTION: TS_REQ_get_nonce 4212 EXIST::FUNCTION: X509_PUBKEY_set0_param 4213 EXIST::FUNCTION: EVP_PKEY_CTX_set0_keygen_info 4214 EXIST::FUNCTION: DIST_POINT_set_dpname 4215 EXIST::FUNCTION: i2d_ISSUING_DIST_POINT 4216 EXIST::FUNCTION: ASN1_SET_ANY_it 4217 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ASN1_SET_ANY_it 4217 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: EVP_PKEY_CTX_get_data 4218 EXIST::FUNCTION: TS_STATUS_INFO_print_bio 4219 EXIST::FUNCTION: EVP_PKEY_derive_init 4220 EXIST::FUNCTION: d2i_TS_TST_INFO 4221 EXIST::FUNCTION: EVP_PKEY_asn1_add_alias 4222 EXIST::FUNCTION: d2i_TS_RESP_bio 4223 EXIST::FUNCTION: OTHERNAME_cmp 4224 EXIST::FUNCTION: GENERAL_NAME_set0_value 4225 EXIST::FUNCTION: PKCS7_RECIP_INFO_get0_alg 4226 EXIST::FUNCTION: TS_RESP_CTX_new 4227 EXIST::FUNCTION: TS_RESP_set_tst_info 4228 EXIST::FUNCTION: PKCS7_final 4229 EXIST::FUNCTION: EVP_PKEY_base_id 4230 EXIST::FUNCTION: TS_RESP_CTX_set_signer_cert 4231 EXIST::FUNCTION: TS_REQ_set_msg_imprint 4232 EXIST::FUNCTION: EVP_PKEY_CTX_ctrl 4233 EXIST::FUNCTION: TS_CONF_set_digests 4234 EXIST::FUNCTION: d2i_TS_MSG_IMPRINT 4235 EXIST::FUNCTION: EVP_PKEY_meth_set_ctrl 4236 EXIST::FUNCTION: TS_REQ_get_ext_by_NID 4237 EXIST::FUNCTION: PKCS5_pbe_set0_algor 4238 EXIST::FUNCTION: BN_BLINDING_thread_id 4239 EXIST::FUNCTION: TS_ACCURACY_new 4240 EXIST::FUNCTION: X509_CRL_METHOD_free 4241 EXIST::FUNCTION: ASN1_PCTX_get_nm_flags 4242 EXIST::FUNCTION: EVP_PKEY_meth_set_sign 4243 EXIST::FUNCTION: CRYPTO_THREADID_current 4244 EXIST::FUNCTION: EVP_PKEY_decrypt_init 4245 EXIST::FUNCTION: NETSCAPE_X509_free 4246 EXIST::FUNCTION: i2b_PVK_bio 4247 EXIST::FUNCTION:RC4 EVP_PKEY_print_private 4248 EXIST::FUNCTION: GENERAL_NAME_get0_value 4249 EXIST::FUNCTION: b2i_PVK_bio 4250 EXIST::FUNCTION:RC4 ASN1_UTCTIME_adj 4251 EXIST::FUNCTION: TS_TST_INFO_new 4252 EXIST::FUNCTION: EVP_MD_do_all_sorted 4253 EXIST::FUNCTION: TS_CONF_set_default_engine 4254 EXIST::FUNCTION: TS_ACCURACY_set_seconds 4255 EXIST::FUNCTION: TS_TST_INFO_get_time 4256 EXIST::FUNCTION: PKCS8_pkey_get0 4257 EXIST::FUNCTION: EVP_PKEY_asn1_get0 4258 EXIST::FUNCTION: OBJ_add_sigid 4259 EXIST::FUNCTION: PKCS7_SIGNER_INFO_sign 4260 EXIST::FUNCTION: EVP_PKEY_paramgen_init 4261 EXIST::FUNCTION: EVP_PKEY_sign 4262 EXIST::FUNCTION: OBJ_sigid_free 4263 EXIST::FUNCTION: EVP_PKEY_meth_set_init 4264 EXIST::FUNCTION: d2i_ESS_ISSUER_SERIAL 4265 EXIST::FUNCTION: ISSUING_DIST_POINT_new 4266 EXIST::FUNCTION: ASN1_TIME_adj 4267 EXIST::FUNCTION: TS_OBJ_print_bio 4268 EXIST::FUNCTION: EVP_PKEY_meth_set_verify_recover 4269 EXIST:!VMS:FUNCTION: EVP_PKEY_meth_set_vrfy_recover 4269 EXIST:VMS:FUNCTION: TS_RESP_get_status_info 4270 EXIST::FUNCTION: CMS_stream 4271 EXIST::FUNCTION:CMS EVP_PKEY_CTX_set_cb 4272 EXIST::FUNCTION: PKCS7_to_TS_TST_INFO 4273 EXIST::FUNCTION: ASN1_PCTX_get_oid_flags 4274 EXIST::FUNCTION: TS_TST_INFO_add_ext 4275 EXIST::FUNCTION: EVP_PKEY_meth_set_derive 4276 EXIST::FUNCTION: i2d_TS_RESP_fp 4277 EXIST::FUNCTION: i2d_TS_MSG_IMPRINT_bio 4278 EXIST::FUNCTION: TS_RESP_CTX_set_accuracy 4279 EXIST::FUNCTION: TS_REQ_set_nonce 4280 EXIST::FUNCTION: ESS_CERT_ID_new 4281 EXIST::FUNCTION: ENGINE_pkey_asn1_find_str 4282 EXIST::FUNCTION:ENGINE TS_REQ_get_ext_count 4283 EXIST::FUNCTION: BUF_reverse 4284 EXIST::FUNCTION: TS_TST_INFO_print_bio 4285 EXIST::FUNCTION: d2i_ISSUING_DIST_POINT 4286 EXIST::FUNCTION: ENGINE_get_pkey_meths 4287 EXIST::FUNCTION:ENGINE i2b_PrivateKey_bio 4288 EXIST::FUNCTION: i2d_TS_RESP 4289 EXIST::FUNCTION: b2i_PublicKey 4290 EXIST::FUNCTION: TS_VERIFY_CTX_cleanup 4291 EXIST::FUNCTION: TS_STATUS_INFO_free 4292 EXIST::FUNCTION: TS_RESP_verify_token 4293 EXIST::FUNCTION: OBJ_bsearch_ex_ 4294 EXIST::FUNCTION: ASN1_bn_print 4295 EXIST::FUNCTION:BIO EVP_PKEY_asn1_get_count 4296 EXIST::FUNCTION: ENGINE_register_pkey_asn1_meths 4297 EXIST::FUNCTION:ENGINE ASN1_PCTX_set_nm_flags 4298 EXIST::FUNCTION: EVP_DigestVerifyInit 4299 EXIST::FUNCTION: ENGINE_set_default_pkey_meths 4300 EXIST::FUNCTION:ENGINE TS_TST_INFO_get_policy_id 4301 EXIST::FUNCTION: TS_REQ_get_cert_req 4302 EXIST::FUNCTION: X509_CRL_set_meth_data 4303 EXIST::FUNCTION: PKCS8_pkey_set0 4304 EXIST::FUNCTION: ASN1_STRING_copy 4305 EXIST::FUNCTION: d2i_TS_TST_INFO_fp 4306 EXIST::FUNCTION: X509_CRL_match 4307 EXIST::FUNCTION: EVP_PKEY_asn1_set_private 4308 EXIST::FUNCTION: TS_TST_INFO_get_ext_d2i 4309 EXIST::FUNCTION: TS_RESP_CTX_add_policy 4310 EXIST::FUNCTION: d2i_TS_RESP 4311 EXIST::FUNCTION: TS_CONF_load_certs 4312 EXIST::FUNCTION: TS_TST_INFO_get_msg_imprint 4313 EXIST::FUNCTION: ERR_load_TS_strings 4314 EXIST::FUNCTION: TS_TST_INFO_get_version 4315 EXIST::FUNCTION: EVP_PKEY_CTX_dup 4316 EXIST::FUNCTION: EVP_PKEY_meth_set_verify 4317 EXIST::FUNCTION: i2b_PublicKey_bio 4318 EXIST::FUNCTION: TS_CONF_set_certs 4319 EXIST::FUNCTION: EVP_PKEY_asn1_get0_info 4320 EXIST::FUNCTION: TS_VERIFY_CTX_free 4321 EXIST::FUNCTION: TS_REQ_get_ext_by_critical 4322 EXIST::FUNCTION: TS_RESP_CTX_set_serial_cb 4323 EXIST::FUNCTION: X509_CRL_get_meth_data 4324 EXIST::FUNCTION: TS_RESP_CTX_set_time_cb 4325 EXIST::FUNCTION: TS_MSG_IMPRINT_get_msg 4326 EXIST::FUNCTION: TS_TST_INFO_ext_free 4327 EXIST::FUNCTION: TS_REQ_get_version 4328 EXIST::FUNCTION: TS_REQ_add_ext 4329 EXIST::FUNCTION: EVP_PKEY_CTX_set_app_data 4330 EXIST::FUNCTION: OBJ_bsearch_ 4331 EXIST::FUNCTION: EVP_PKEY_meth_set_verifyctx 4332 EXIST::FUNCTION: i2d_PKCS7_bio_stream 4333 EXIST::FUNCTION: CRYPTO_THREADID_set_numeric 4334 EXIST::FUNCTION: PKCS7_sign_add_signer 4335 EXIST::FUNCTION: d2i_TS_TST_INFO_bio 4336 EXIST::FUNCTION: TS_TST_INFO_get_ordering 4337 EXIST::FUNCTION: TS_RESP_print_bio 4338 EXIST::FUNCTION: TS_TST_INFO_get_exts 4339 EXIST::FUNCTION: HMAC_CTX_copy 4340 EXIST::FUNCTION:HMAC PKCS5_pbe2_set_iv 4341 EXIST::FUNCTION: ENGINE_get_pkey_asn1_meths 4342 EXIST::FUNCTION:ENGINE b2i_PrivateKey 4343 EXIST::FUNCTION: EVP_PKEY_CTX_get_app_data 4344 EXIST::FUNCTION: TS_REQ_set_cert_req 4345 EXIST::FUNCTION: CRYPTO_THREADID_set_callback 4346 EXIST::FUNCTION: TS_CONF_set_serial 4347 EXIST::FUNCTION: TS_TST_INFO_free 4348 EXIST::FUNCTION: d2i_TS_REQ_fp 4349 EXIST::FUNCTION: TS_RESP_verify_response 4350 EXIST::FUNCTION: i2d_ESS_ISSUER_SERIAL 4351 EXIST::FUNCTION: TS_ACCURACY_get_seconds 4352 EXIST::FUNCTION: EVP_CIPHER_do_all 4353 EXIST::FUNCTION: b2i_PrivateKey_bio 4354 EXIST::FUNCTION: OCSP_CERTID_dup 4355 EXIST::FUNCTION: X509_PUBKEY_get0_param 4356 EXIST::FUNCTION: TS_MSG_IMPRINT_dup 4357 EXIST::FUNCTION: PKCS7_print_ctx 4358 EXIST::FUNCTION: i2d_TS_REQ_bio 4359 EXIST::FUNCTION: EVP_whirlpool 4360 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL EVP_PKEY_asn1_set_param 4361 EXIST::FUNCTION: EVP_PKEY_meth_set_encrypt 4362 EXIST::FUNCTION: ASN1_PCTX_set_flags 4363 EXIST::FUNCTION: i2d_ESS_CERT_ID 4364 EXIST::FUNCTION: TS_VERIFY_CTX_new 4365 EXIST::FUNCTION: TS_RESP_CTX_set_extension_cb 4366 EXIST::FUNCTION: ENGINE_register_all_pkey_meths 4367 EXIST::FUNCTION:ENGINE TS_RESP_CTX_set_status_info_cond 4368 EXIST:!VMS:FUNCTION: TS_RESP_CTX_set_stat_info_cond 4368 EXIST:VMS:FUNCTION: EVP_PKEY_verify 4369 EXIST::FUNCTION: WHIRLPOOL_Final 4370 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL X509_CRL_METHOD_new 4371 EXIST::FUNCTION: EVP_DigestSignFinal 4372 EXIST::FUNCTION: TS_RESP_CTX_set_def_policy 4373 EXIST::FUNCTION: NETSCAPE_X509_it 4374 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: NETSCAPE_X509_it 4374 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: TS_RESP_create_response 4375 EXIST::FUNCTION: PKCS7_SIGNER_INFO_get0_algs 4376 EXIST::FUNCTION: TS_TST_INFO_get_nonce 4377 EXIST::FUNCTION: EVP_PKEY_decrypt_old 4378 EXIST::FUNCTION: TS_TST_INFO_set_policy_id 4379 EXIST::FUNCTION: TS_CONF_set_ess_cert_id_chain 4380 EXIST::FUNCTION: EVP_PKEY_CTX_get0_pkey 4381 EXIST::FUNCTION: d2i_TS_REQ 4382 EXIST::FUNCTION: EVP_PKEY_asn1_find_str 4383 EXIST::FUNCTION: BIO_f_asn1 4384 EXIST::FUNCTION: ESS_SIGNING_CERT_new 4385 EXIST::FUNCTION: EVP_PBE_find 4386 EXIST::FUNCTION: X509_CRL_get0_by_cert 4387 EXIST::FUNCTION: EVP_PKEY_derive 4388 EXIST::FUNCTION: i2d_TS_REQ 4389 EXIST::FUNCTION: TS_TST_INFO_delete_ext 4390 EXIST::FUNCTION: ESS_ISSUER_SERIAL_free 4391 EXIST::FUNCTION: ASN1_PCTX_set_str_flags 4392 EXIST::FUNCTION: ENGINE_get_pkey_asn1_meth_str 4393 EXIST::FUNCTION:ENGINE TS_CONF_set_signer_key 4394 EXIST::FUNCTION: TS_ACCURACY_get_millis 4395 EXIST::FUNCTION: TS_RESP_get_token 4396 EXIST::FUNCTION: TS_ACCURACY_dup 4397 EXIST::FUNCTION: ENGINE_register_all_pkey_asn1_meths 4398 EXIST:!VMS:FUNCTION:ENGINE ENGINE_reg_all_pkey_asn1_meths 4398 EXIST:VMS:FUNCTION:ENGINE X509_CRL_set_default_method 4399 EXIST::FUNCTION: CRYPTO_THREADID_hash 4400 EXIST::FUNCTION: CMS_ContentInfo_print_ctx 4401 EXIST::FUNCTION:CMS TS_RESP_free 4402 EXIST::FUNCTION: ISSUING_DIST_POINT_free 4403 EXIST::FUNCTION: ESS_ISSUER_SERIAL_new 4404 EXIST::FUNCTION: CMS_add1_crl 4405 EXIST::FUNCTION:CMS PKCS7_add1_attrib_digest 4406 EXIST::FUNCTION: TS_RESP_CTX_add_md 4407 EXIST::FUNCTION: TS_TST_INFO_dup 4408 EXIST::FUNCTION: ENGINE_set_pkey_asn1_meths 4409 EXIST::FUNCTION:ENGINE PEM_write_bio_Parameters 4410 EXIST::FUNCTION: TS_TST_INFO_get_accuracy 4411 EXIST::FUNCTION: X509_CRL_get0_by_serial 4412 EXIST::FUNCTION: TS_TST_INFO_set_version 4413 EXIST::FUNCTION: TS_RESP_CTX_get_tst_info 4414 EXIST::FUNCTION: TS_RESP_verify_signature 4415 EXIST::FUNCTION: CRYPTO_THREADID_get_callback 4416 EXIST::FUNCTION: TS_TST_INFO_get_tsa 4417 EXIST::FUNCTION: TS_STATUS_INFO_new 4418 EXIST::FUNCTION: EVP_PKEY_CTX_get_cb 4419 EXIST::FUNCTION: TS_REQ_get_ext_d2i 4420 EXIST::FUNCTION: GENERAL_NAME_set0_othername 4421 EXIST::FUNCTION: TS_TST_INFO_get_ext_count 4422 EXIST::FUNCTION: TS_RESP_CTX_get_request 4423 EXIST::FUNCTION: i2d_NETSCAPE_X509 4424 EXIST::FUNCTION: ENGINE_get_pkey_meth_engine 4425 EXIST::FUNCTION:ENGINE EVP_PKEY_meth_set_signctx 4426 EXIST::FUNCTION: EVP_PKEY_asn1_copy 4427 EXIST::FUNCTION: ASN1_TYPE_cmp 4428 EXIST::FUNCTION: EVP_CIPHER_do_all_sorted 4429 EXIST::FUNCTION: EVP_PKEY_CTX_free 4430 EXIST::FUNCTION: ISSUING_DIST_POINT_it 4431 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: ISSUING_DIST_POINT_it 4431 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: d2i_TS_MSG_IMPRINT_fp 4432 EXIST::FUNCTION: X509_STORE_get1_certs 4433 EXIST::FUNCTION: EVP_PKEY_CTX_get_operation 4434 EXIST::FUNCTION: d2i_ESS_SIGNING_CERT 4435 EXIST::FUNCTION: TS_CONF_set_ordering 4436 EXIST::FUNCTION: EVP_PBE_alg_add_type 4437 EXIST::FUNCTION: TS_REQ_set_version 4438 EXIST::FUNCTION: EVP_PKEY_get0 4439 EXIST::FUNCTION: BIO_asn1_set_suffix 4440 EXIST::FUNCTION: i2d_TS_STATUS_INFO 4441 EXIST::FUNCTION: EVP_MD_do_all 4442 EXIST::FUNCTION: TS_TST_INFO_set_accuracy 4443 EXIST::FUNCTION: PKCS7_add_attrib_content_type 4444 EXIST::FUNCTION: ERR_remove_thread_state 4445 EXIST::FUNCTION: EVP_PKEY_meth_add0 4446 EXIST::FUNCTION: TS_TST_INFO_set_tsa 4447 EXIST::FUNCTION: EVP_PKEY_meth_new 4448 EXIST::FUNCTION: WHIRLPOOL_Update 4449 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL TS_CONF_set_accuracy 4450 EXIST::FUNCTION: ASN1_PCTX_set_oid_flags 4451 EXIST::FUNCTION: ESS_SIGNING_CERT_dup 4452 EXIST::FUNCTION: d2i_TS_REQ_bio 4453 EXIST::FUNCTION: X509_time_adj_ex 4454 EXIST::FUNCTION: TS_RESP_CTX_add_flags 4455 EXIST::FUNCTION: d2i_TS_STATUS_INFO 4456 EXIST::FUNCTION: TS_MSG_IMPRINT_set_msg 4457 EXIST::FUNCTION: BIO_asn1_get_suffix 4458 EXIST::FUNCTION: TS_REQ_free 4459 EXIST::FUNCTION: EVP_PKEY_meth_free 4460 EXIST::FUNCTION: TS_REQ_get_exts 4461 EXIST::FUNCTION: TS_RESP_CTX_set_clock_precision_digits 4462 EXIST:!VMS:FUNCTION: TS_RESP_CTX_set_clk_prec_digits 4462 EXIST:VMS:FUNCTION: TS_RESP_CTX_add_failure_info 4463 EXIST::FUNCTION: i2d_TS_RESP_bio 4464 EXIST::FUNCTION: EVP_PKEY_CTX_get0_peerkey 4465 EXIST::FUNCTION: PEM_write_bio_CMS_stream 4466 EXIST::FUNCTION:CMS TS_REQ_new 4467 EXIST::FUNCTION: TS_MSG_IMPRINT_new 4468 EXIST::FUNCTION: EVP_PKEY_meth_find 4469 EXIST::FUNCTION: EVP_PKEY_id 4470 EXIST::FUNCTION: TS_TST_INFO_set_serial 4471 EXIST::FUNCTION: a2i_GENERAL_NAME 4472 EXIST::FUNCTION: TS_CONF_set_crypto_device 4473 EXIST::FUNCTION: EVP_PKEY_verify_init 4474 EXIST::FUNCTION: TS_CONF_set_policies 4475 EXIST::FUNCTION: ASN1_PCTX_new 4476 EXIST::FUNCTION: ESS_CERT_ID_free 4477 EXIST::FUNCTION: ENGINE_unregister_pkey_meths 4478 EXIST::FUNCTION:ENGINE TS_MSG_IMPRINT_free 4479 EXIST::FUNCTION: TS_VERIFY_CTX_init 4480 EXIST::FUNCTION: PKCS7_stream 4481 EXIST::FUNCTION: TS_RESP_CTX_set_certs 4482 EXIST::FUNCTION: TS_CONF_set_def_policy 4483 EXIST::FUNCTION: ASN1_GENERALIZEDTIME_adj 4484 EXIST::FUNCTION: NETSCAPE_X509_new 4485 EXIST::FUNCTION: TS_ACCURACY_free 4486 EXIST::FUNCTION: TS_RESP_get_tst_info 4487 EXIST::FUNCTION: EVP_PKEY_derive_set_peer 4488 EXIST::FUNCTION: PEM_read_bio_Parameters 4489 EXIST::FUNCTION: TS_CONF_set_clock_precision_digits 4490 EXIST:!VMS:FUNCTION: TS_CONF_set_clk_prec_digits 4490 EXIST:VMS:FUNCTION: ESS_ISSUER_SERIAL_dup 4491 EXIST::FUNCTION: TS_ACCURACY_get_micros 4492 EXIST::FUNCTION: ASN1_PCTX_get_str_flags 4493 EXIST::FUNCTION: NAME_CONSTRAINTS_check 4494 EXIST::FUNCTION: ASN1_BIT_STRING_check 4495 EXIST::FUNCTION: X509_check_akid 4496 EXIST::FUNCTION: ENGINE_unregister_pkey_asn1_meths 4497 EXIST:!VMS:FUNCTION:ENGINE ENGINE_unreg_pkey_asn1_meths 4497 EXIST:VMS:FUNCTION:ENGINE ASN1_PCTX_free 4498 EXIST::FUNCTION: PEM_write_bio_ASN1_stream 4499 EXIST::FUNCTION: i2d_ASN1_bio_stream 4500 EXIST::FUNCTION: TS_X509_ALGOR_print_bio 4501 EXIST::FUNCTION: EVP_PKEY_meth_set_cleanup 4502 EXIST::FUNCTION: EVP_PKEY_asn1_free 4503 EXIST::FUNCTION: ESS_SIGNING_CERT_free 4504 EXIST::FUNCTION: TS_TST_INFO_set_msg_imprint 4505 EXIST::FUNCTION: GENERAL_NAME_cmp 4506 EXIST::FUNCTION: d2i_ASN1_SET_ANY 4507 EXIST::FUNCTION: ENGINE_set_pkey_meths 4508 EXIST::FUNCTION:ENGINE i2d_TS_REQ_fp 4509 EXIST::FUNCTION: d2i_ASN1_SEQUENCE_ANY 4510 EXIST::FUNCTION: GENERAL_NAME_get0_otherName 4511 EXIST::FUNCTION: d2i_ESS_CERT_ID 4512 EXIST::FUNCTION: OBJ_find_sigid_algs 4513 EXIST::FUNCTION: EVP_PKEY_meth_set_keygen 4514 EXIST::FUNCTION: PKCS5_PBKDF2_HMAC 4515 EXIST::FUNCTION: EVP_PKEY_paramgen 4516 EXIST::FUNCTION: EVP_PKEY_meth_set_paramgen 4517 EXIST::FUNCTION: BIO_new_PKCS7 4518 EXIST::FUNCTION: EVP_PKEY_verify_recover 4519 EXIST::FUNCTION: TS_ext_print_bio 4520 EXIST::FUNCTION: TS_ASN1_INTEGER_print_bio 4521 EXIST::FUNCTION: check_defer 4522 EXIST::FUNCTION: DSO_pathbyaddr 4523 EXIST::FUNCTION: EVP_PKEY_set_type 4524 EXIST::FUNCTION: TS_ACCURACY_set_micros 4525 EXIST::FUNCTION: TS_REQ_to_TS_VERIFY_CTX 4526 EXIST::FUNCTION: EVP_PKEY_meth_set_copy 4527 EXIST::FUNCTION: ASN1_PCTX_set_cert_flags 4528 EXIST::FUNCTION: TS_TST_INFO_get_ext 4529 EXIST::FUNCTION: EVP_PKEY_asn1_set_ctrl 4530 EXIST::FUNCTION: TS_TST_INFO_get_ext_by_critical 4531 EXIST::FUNCTION: EVP_PKEY_CTX_new_id 4532 EXIST::FUNCTION: TS_REQ_get_ext_by_OBJ 4533 EXIST::FUNCTION: TS_CONF_set_signer_cert 4534 EXIST::FUNCTION: X509_NAME_hash_old 4535 EXIST::FUNCTION: ASN1_TIME_set_string 4536 EXIST::FUNCTION: EVP_MD_flags 4537 EXIST::FUNCTION: TS_RESP_CTX_free 4538 EXIST::FUNCTION: DSAparams_dup 4539 EXIST::FUNCTION:DSA DHparams_dup 4540 EXIST::FUNCTION:DH OCSP_REQ_CTX_add1_header 4541 EXIST::FUNCTION: OCSP_REQ_CTX_set1_req 4542 EXIST::FUNCTION: X509_STORE_set_verify_cb 4543 EXIST::FUNCTION: X509_STORE_CTX_get0_current_crl 4544 EXIST::FUNCTION: X509_STORE_CTX_get0_parent_ctx 4545 EXIST::FUNCTION: X509_STORE_CTX_get0_current_issuer 4546 EXIST:!VMS:FUNCTION: X509_STORE_CTX_get0_cur_issuer 4546 EXIST:VMS:FUNCTION: X509_issuer_name_hash_old 4547 EXIST::FUNCTION:MD5 X509_subject_name_hash_old 4548 EXIST::FUNCTION:MD5 EVP_CIPHER_CTX_copy 4549 EXIST::FUNCTION: UI_method_get_prompt_constructor 4550 EXIST:!VMS:FUNCTION: UI_method_get_prompt_constructr 4550 EXIST:VMS:FUNCTION: UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION: UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION: EVP_read_pw_string_min 4552 EXIST::FUNCTION: CRYPTO_cts128_encrypt 4553 EXIST::FUNCTION: CRYPTO_cts128_decrypt_block 4554 EXIST::FUNCTION: CRYPTO_cfb128_1_encrypt 4555 EXIST::FUNCTION: CRYPTO_cbc128_encrypt 4556 EXIST::FUNCTION: CRYPTO_ctr128_encrypt 4557 EXIST::FUNCTION: CRYPTO_ofb128_encrypt 4558 EXIST::FUNCTION: CRYPTO_cts128_decrypt 4559 EXIST::FUNCTION: CRYPTO_cts128_encrypt_block 4560 EXIST::FUNCTION: CRYPTO_cbc128_decrypt 4561 EXIST::FUNCTION: CRYPTO_cfb128_encrypt 4562 EXIST::FUNCTION: CRYPTO_cfb128_8_encrypt 4563 EXIST::FUNCTION: OPENSSL_strcasecmp 4564 EXIST::FUNCTION: OPENSSL_memcmp 4565 EXIST::FUNCTION: OPENSSL_strncasecmp 4566 EXIST::FUNCTION: OPENSSL_gmtime 4567 EXIST::FUNCTION: OPENSSL_gmtime_adj 4568 EXIST::FUNCTION: SRP_VBASE_get_by_user 4569 EXIST::FUNCTION:SRP SRP_Calc_server_key 4570 EXIST::FUNCTION:SRP SRP_create_verifier 4571 EXIST::FUNCTION:SRP SRP_create_verifier_BN 4572 EXIST::FUNCTION:SRP SRP_Calc_u 4573 EXIST::FUNCTION:SRP SRP_VBASE_free 4574 EXIST::FUNCTION:SRP SRP_Calc_client_key 4575 EXIST::FUNCTION:SRP SRP_get_default_gN 4576 EXIST::FUNCTION:SRP SRP_Calc_x 4577 EXIST::FUNCTION:SRP SRP_Calc_B 4578 EXIST::FUNCTION:SRP SRP_VBASE_new 4579 EXIST::FUNCTION:SRP SRP_check_known_gN_param 4580 EXIST::FUNCTION:SRP SRP_Calc_A 4581 EXIST::FUNCTION:SRP SRP_Verify_A_mod_N 4582 EXIST::FUNCTION:SRP SRP_VBASE_init 4583 EXIST::FUNCTION:SRP SRP_Verify_B_mod_N 4584 EXIST::FUNCTION:SRP EC_KEY_set_public_key_affine_coordinates 4585 EXIST:!VMS:FUNCTION:EC EC_KEY_set_pub_key_aff_coords 4585 EXIST:VMS:FUNCTION:EC EVP_aes_192_ctr 4586 EXIST::FUNCTION:AES EVP_PKEY_meth_get0_info 4587 EXIST::FUNCTION: EVP_PKEY_meth_copy 4588 EXIST::FUNCTION: ERR_add_error_vdata 4589 EXIST::FUNCTION: EVP_aes_128_ctr 4590 EXIST::FUNCTION:AES EVP_aes_256_ctr 4591 EXIST::FUNCTION:AES EC_GFp_nistp224_method 4592 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128 EC_KEY_get_flags 4593 EXIST::FUNCTION:EC RSA_padding_add_PKCS1_PSS_mgf1 4594 EXIST::FUNCTION:RSA EVP_aes_128_xts 4595 EXIST::FUNCTION:AES private_SHA224_Init 4596 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 private_AES_set_decrypt_key 4597 EXIST::FUNCTION:AES private_WHIRLPOOL_Init 4598 EXIST:OPENSSL_FIPS:FUNCTION:WHIRLPOOL EVP_aes_256_xts 4599 EXIST::FUNCTION:AES private_SHA512_Init 4600 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 EVP_aes_128_gcm 4601 EXIST::FUNCTION:AES EC_KEY_clear_flags 4602 EXIST::FUNCTION:EC EC_KEY_set_flags 4603 EXIST::FUNCTION:EC private_DES_set_key_unchecked 4604 EXIST:OPENSSL_FIPS:FUNCTION:DES EVP_aes_256_ccm 4605 EXIST::FUNCTION:AES private_AES_set_encrypt_key 4606 EXIST::FUNCTION:AES RSA_verify_PKCS1_PSS_mgf1 4607 EXIST::FUNCTION:RSA private_SHA1_Init 4608 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA1 EVP_aes_128_ccm 4609 EXIST::FUNCTION:AES private_SEED_set_key 4610 EXIST:OPENSSL_FIPS:FUNCTION:SEED EVP_aes_192_gcm 4611 EXIST::FUNCTION:AES X509_ALGOR_set_md 4612 EXIST::FUNCTION: private_SHA256_Init 4613 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 RAND_init_fips 4614 EXIST:OPENSSL_FIPS:FUNCTION: EVP_aes_256_gcm 4615 EXIST::FUNCTION:AES private_SHA384_Init 4616 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 EVP_aes_192_ccm 4617 EXIST::FUNCTION:AES CMAC_CTX_copy 4618 EXIST::FUNCTION: CMAC_CTX_free 4619 EXIST::FUNCTION: CMAC_CTX_get0_cipher_ctx 4620 EXIST::FUNCTION: CMAC_CTX_cleanup 4621 EXIST::FUNCTION: CMAC_Init 4622 EXIST::FUNCTION: CMAC_Update 4623 EXIST::FUNCTION: CMAC_resume 4624 EXIST::FUNCTION: CMAC_CTX_new 4625 EXIST::FUNCTION: CMAC_Final 4626 EXIST::FUNCTION: CRYPTO_ctr128_encrypt_ctr32 4627 EXIST::FUNCTION: CRYPTO_gcm128_release 4628 EXIST::FUNCTION: CRYPTO_ccm128_decrypt_ccm64 4629 EXIST::FUNCTION: CRYPTO_ccm128_encrypt 4630 EXIST::FUNCTION: CRYPTO_gcm128_encrypt 4631 EXIST::FUNCTION: CRYPTO_xts128_encrypt 4632 EXIST::FUNCTION: EVP_rc4_hmac_md5 4633 EXIST::FUNCTION:MD5,RC4 CRYPTO_nistcts128_decrypt_block 4634 EXIST::FUNCTION: CRYPTO_gcm128_setiv 4635 EXIST::FUNCTION: CRYPTO_nistcts128_encrypt 4636 EXIST::FUNCTION: EVP_aes_128_cbc_hmac_sha1 4637 EXIST::FUNCTION:AES,SHA,SHA1 CRYPTO_gcm128_tag 4638 EXIST::FUNCTION: CRYPTO_ccm128_encrypt_ccm64 4639 EXIST::FUNCTION: ENGINE_load_rdrand 4640 EXIST::FUNCTION:ENGINE CRYPTO_ccm128_setiv 4641 EXIST::FUNCTION: CRYPTO_nistcts128_encrypt_block 4642 EXIST::FUNCTION: CRYPTO_gcm128_aad 4643 EXIST::FUNCTION: CRYPTO_ccm128_init 4644 EXIST::FUNCTION: CRYPTO_nistcts128_decrypt 4645 EXIST::FUNCTION: CRYPTO_gcm128_new 4646 EXIST::FUNCTION: CRYPTO_ccm128_tag 4647 EXIST::FUNCTION: CRYPTO_ccm128_decrypt 4648 EXIST::FUNCTION: CRYPTO_ccm128_aad 4649 EXIST::FUNCTION: CRYPTO_gcm128_init 4650 EXIST::FUNCTION: CRYPTO_gcm128_decrypt 4651 EXIST::FUNCTION: ENGINE_load_rsax 4652 NOEXIST::FUNCTION: CRYPTO_gcm128_decrypt_ctr32 4653 EXIST::FUNCTION: CRYPTO_gcm128_encrypt_ctr32 4654 EXIST::FUNCTION: CRYPTO_gcm128_finish 4655 EXIST::FUNCTION: EVP_aes_256_cbc_hmac_sha1 4656 EXIST::FUNCTION:AES,SHA,SHA1 PKCS5_pbkdf2_set 4657 EXIST::FUNCTION: CMS_add0_recipient_password 4658 EXIST::FUNCTION:CMS CMS_decrypt_set1_password 4659 EXIST::FUNCTION:CMS CMS_RecipientInfo_set0_password 4660 EXIST::FUNCTION:CMS RAND_set_fips_drbg_type 4661 EXIST:OPENSSL_FIPS:FUNCTION: X509_REQ_sign_ctx 4662 EXIST::FUNCTION:EVP RSA_PSS_PARAMS_new 4663 EXIST::FUNCTION:RSA X509_CRL_sign_ctx 4664 EXIST::FUNCTION:EVP X509_signature_dump 4665 EXIST::FUNCTION:EVP d2i_RSA_PSS_PARAMS 4666 EXIST::FUNCTION:RSA RSA_PSS_PARAMS_it 4667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA RSA_PSS_PARAMS_it 4667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA RSA_PSS_PARAMS_free 4668 EXIST::FUNCTION:RSA X509_sign_ctx 4669 EXIST::FUNCTION:EVP i2d_RSA_PSS_PARAMS 4670 EXIST::FUNCTION:RSA ASN1_item_sign_ctx 4671 EXIST::FUNCTION:EVP EC_GFp_nistp521_method 4672 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128 EC_GFp_nistp256_method 4673 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128 OPENSSL_stderr 4674 EXIST::FUNCTION: OPENSSL_cpuid_setup 4675 EXIST::FUNCTION: OPENSSL_showfatal 4676 EXIST::FUNCTION: BIO_new_dgram_sctp 4677 EXIST::FUNCTION:SCTP BIO_dgram_sctp_msg_waiting 4678 EXIST::FUNCTION:SCTP BIO_dgram_sctp_wait_for_dry 4679 EXIST::FUNCTION:SCTP BIO_s_datagram_sctp 4680 EXIST::FUNCTION:DGRAM,SCTP BIO_dgram_is_sctp 4681 EXIST::FUNCTION:SCTP BIO_dgram_sctp_notification_cb 4682 EXIST::FUNCTION:SCTP i2d_DHxparams 4683 EXIST::FUNCTION:DH EC_curve_nist2nid 4684 EXIST::FUNCTION:EC DH_get_1024_160 4685 EXIST::FUNCTION:DH PEM_write_DHxparams 4686 EXIST:!WIN16:FUNCTION:DH d2i_DHxparams 4687 EXIST::FUNCTION:DH EC_curve_nid2nist 4688 EXIST::FUNCTION:EC DH_get_2048_256 4689 EXIST::FUNCTION:DH PEM_write_bio_DHxparams 4690 EXIST::FUNCTION:DH DH_get_2048_224 4691 EXIST::FUNCTION:DH X509_chain_check_suiteb 4692 EXIST::FUNCTION: X509_chain_up_ref 4693 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_ip_asc 4694 EXIST::FUNCTION: X509_CRL_check_suiteb 4695 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_email 4696 EXIST::FUNCTION: X509_check_email 4697 EXIST::FUNCTION: X509_check_host 4698 EXIST::FUNCTION: X509_check_ip_asc 4699 EXIST::FUNCTION: X509_get0_signature 4700 EXIST::FUNCTION: X509_get_signature_nid 4701 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_host 4702 EXIST::FUNCTION: X509_VERIFY_PARAM_set1_ip 4703 EXIST::FUNCTION: X509_check_ip 4704 EXIST::FUNCTION: X509_STORE_set_lookup_crls_cb 4705 EXIST::FUNCTION: X509_CRL_diff 4706 EXIST::FUNCTION: X509_CRL_http_nbio 4707 EXIST::FUNCTION:EVP OCSP_REQ_CTX_i2d 4708 EXIST::FUNCTION: OCSP_REQ_CTX_get0_mem_bio 4709 EXIST::FUNCTION: X509_STORE_CTX_get0_store 4710 EXIST::FUNCTION: X509_REVOKED_dup 4711 EXIST::FUNCTION: CMS_RecipientInfo_encrypt 4712 EXIST::FUNCTION:CMS OCSP_REQ_CTX_http 4713 EXIST::FUNCTION: OCSP_REQ_CTX_nbio 4714 EXIST::FUNCTION: X509_http_nbio 4715 EXIST::FUNCTION:EVP OCSP_set_max_response_length 4716 EXIST::FUNCTION: OCSP_REQ_CTX_new 4717 EXIST::FUNCTION: OCSP_REQ_CTX_nbio_d2i 4718 EXIST::FUNCTION: EVP_aes_256_wrap 4719 EXIST::FUNCTION:AES CRYPTO_128_wrap 4720 EXIST::FUNCTION: RSA_OAEP_PARAMS_new 4721 EXIST::FUNCTION:RSA CRYPTO_128_unwrap 4722 EXIST::FUNCTION: ECDSA_METHOD_set_name 4723 EXIST::FUNCTION:ECDSA CMS_RecipientInfo_kari_decrypt 4724 EXIST::FUNCTION:CMS CMS_SignerInfo_get0_pkey_ctx 4725 EXIST::FUNCTION:CMS ECDSA_METHOD_set_flags 4726 EXIST::FUNCTION:ECDSA ECDSA_METHOD_set_sign_setup 4727 EXIST::FUNCTION:ECDSA CMS_RecipientInfo_kari_orig_id_cmp 4728 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_kari_orig_id_cmp 4728 EXIST:VMS:FUNCTION:CMS CMS_RecipientInfo_kari_get0_alg 4729 EXIST::FUNCTION:CMS EVP_aes_192_wrap 4730 EXIST::FUNCTION:AES EVP_aes_128_cbc_hmac_sha256 4731 EXIST::FUNCTION:AES,SHA256 DH_compute_key_padded 4732 EXIST::FUNCTION:DH ECDSA_METHOD_set_sign 4733 EXIST::FUNCTION:ECDSA CMS_RecipientEncryptedKey_cert_cmp 4734 EXIST:!VMS:FUNCTION:CMS CMS_RecipEncryptedKey_cert_cmp 4734 EXIST:VMS:FUNCTION:CMS DH_KDF_X9_42 4735 EXIST::FUNCTION:CMS,DH RSA_OAEP_PARAMS_free 4736 EXIST::FUNCTION:RSA EVP_des_ede3_wrap 4737 EXIST::FUNCTION:DES RSA_OAEP_PARAMS_it 4738 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA RSA_OAEP_PARAMS_it 4738 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA ASN1_TIME_diff 4739 EXIST::FUNCTION: EVP_aes_256_cbc_hmac_sha256 4740 EXIST::FUNCTION:AES,SHA256 CMS_SignerInfo_get0_signature 4741 EXIST::FUNCTION:CMS CMS_RecipientInfo_kari_get0_reks 4742 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_kari_get0_reks 4742 EXIST:VMS:FUNCTION:CMS EVP_aes_128_wrap 4743 EXIST::FUNCTION:AES CMS_SignerInfo_get0_md_ctx 4744 EXIST::FUNCTION:CMS OPENSSL_gmtime_diff 4745 EXIST::FUNCTION: CMS_RecipientInfo_kari_set0_pkey 4746 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_kari_set0_pkey 4746 EXIST:VMS:FUNCTION:CMS i2d_RSA_OAEP_PARAMS 4747 EXIST::FUNCTION:RSA d2i_RSA_OAEP_PARAMS 4748 EXIST::FUNCTION:RSA ECDH_KDF_X9_62 4749 EXIST::FUNCTION:ECDH CMS_RecipientInfo_kari_get0_ctx 4750 EXIST::FUNCTION:CMS ECDSA_METHOD_new 4751 EXIST::FUNCTION:ECDSA CMS_RecipientInfo_get0_pkey_ctx 4752 EXIST::FUNCTION:CMS CMS_RecipientEncryptedKey_get0_id 4753 EXIST:!VMS:FUNCTION:CMS CMS_RecipEncryptedKey_get0_id 4753 EXIST:VMS:FUNCTION:CMS RSA_padding_check_PKCS1_OAEP_mgf1 4754 EXIST:!VMS:FUNCTION:RSA RSA_pad_check_PKCS1_OAEP_mgf1 4754 EXIST:VMS:FUNCTION:RSA ECDSA_METHOD_set_verify 4755 EXIST::FUNCTION:ECDSA CMS_SharedInfo_encode 4756 EXIST::FUNCTION:CMS RSA_padding_add_PKCS1_OAEP_mgf1 4757 EXIST::FUNCTION:RSA CMS_RecipientInfo_kari_get0_orig_id 4758 EXIST:!VMS:FUNCTION:CMS CMS_RecipInfo_kari_get0_orig_id 4758 EXIST:VMS:FUNCTION:CMS ECDSA_METHOD_free 4759 EXIST::FUNCTION:ECDSA X509_VERIFY_PARAM_get_count 4760 EXIST::FUNCTION: X509_VERIFY_PARAM_get0_name 4761 EXIST::FUNCTION: X509_VERIFY_PARAM_get0 4762 EXIST::FUNCTION: X509V3_EXT_free 4763 EXIST::FUNCTION: BIO_hex_string 4764 EXIST::FUNCTION: X509_VERIFY_PARAM_set_hostflags 4765 EXIST::FUNCTION: BUF_strnlen 4766 EXIST::FUNCTION: X509_VERIFY_PARAM_get0_peername 4767 EXIST::FUNCTION: ECDSA_METHOD_set_app_data 4768 EXIST::FUNCTION:ECDSA sk_deep_copy 4769 EXIST::FUNCTION: ECDSA_METHOD_get_app_data 4770 EXIST::FUNCTION:ECDSA X509_VERIFY_PARAM_add1_host 4771 EXIST::FUNCTION: EC_GROUP_get_mont_data 4772 EXIST::FUNCTION:EC i2d_re_X509_tbs 4773 EXIST::FUNCTION: EVP_PKEY_asn1_set_item 4774 EXIST::FUNCTION: EVP_PKEY_meth_get_init 4775 EXIST::FUNCTION: -EVP_PKEY_meth_get_verify_recover 4776 EXIST::FUNCTION: +EVP_PKEY_meth_get_verify_recover 4776 EXIST:!VMS:FUNCTION: +EVP_PKEY_meth_get_vrfy_recover 4776 EXIST:VMS:FUNCTION: EVP_PKEY_meth_get_keygen 4777 EXIST::FUNCTION: EVP_PKEY_meth_get_derive 4778 EXIST::FUNCTION: EVP_PKEY_meth_get_verifyctx 4779 EXIST::FUNCTION: EVP_PKEY_meth_get_paramgen 4780 EXIST::FUNCTION: EVP_PKEY_meth_get_verify 4781 EXIST::FUNCTION: EVP_PKEY_meth_get_sign 4782 EXIST::FUNCTION: EVP_PKEY_meth_get_signctx 4783 EXIST::FUNCTION: EVP_PKEY_meth_get_ctrl 4784 EXIST::FUNCTION: EVP_PKEY_meth_get_decrypt 4785 EXIST::FUNCTION: EVP_PKEY_meth_get_cleanup 4786 EXIST::FUNCTION: EVP_PKEY_meth_get_encrypt 4787 EXIST::FUNCTION: EVP_PKEY_meth_get_copy 4788 EXIST::FUNCTION: diff --git a/util/mk1mf.pl b/util/mk1mf.pl index 6b31496ed1e6..ee14dafea6e0 100755 --- a/util/mk1mf.pl +++ b/util/mk1mf.pl @@ -1,1328 +1,1328 @@ #!/usr/local/bin/perl # A bit of an evil hack but it post processes the file ../MINFO which # is generated by `make files` in the top directory. # This script outputs one mega makefile that has no shell stuff or any # funny stuff (if the target is not "copy"). # If the target is "copy", then it tries to create a makefile that can be # safely used with the -j flag and that is compatible with the top-level # Makefile, in the sense that it uses the same options and assembler files etc. use Cwd; $INSTALLTOP="/usr/local/ssl"; $OPENSSLDIR="/usr/local/ssl"; $OPTIONS=""; $ssl_version=""; $banner="\t\@echo Building OpenSSL"; my $no_static_engine = 1; my $engines = ""; my $otherlibs = ""; local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic local $zlib_lib = ""; local $perl_asm = 0; # 1 to autobuild asm files from perl scripts my $ex_l_libs = ""; # Options to import from top level Makefile my %mf_import = ( VERSION => \$ssl_version, OPTIONS => \$OPTIONS, INSTALLTOP => \$INSTALLTOP, OPENSSLDIR => \$OPENSSLDIR, PLATFORM => \$mf_platform, CC => \$mf_cc, CFLAG => \$mf_cflag, DEPFLAG => \$mf_depflag, CPUID_OBJ => \$mf_cpuid_asm, BN_ASM => \$mf_bn_asm, DES_ENC => \$mf_des_asm, AES_ENC => \$mf_aes_asm, BF_ENC => \$mf_bf_asm, CAST_ENC => \$mf_cast_asm, RC4_ENC => \$mf_rc4_asm, RC5_ENC => \$mf_rc5_asm, MD5_ASM_OBJ => \$mf_md5_asm, SHA1_ASM_OBJ => \$mf_sha_asm, RMD160_ASM_OBJ => \$mf_rmd_asm, WP_ASM_OBJ => \$mf_wp_asm, CMLL_ENC => \$mf_cm_asm, MODES_ASM_OBJ => \$mf_modes_asm, ENGINES_ASM_OBJ=> \$mf_engines_asm, BASEADDR => \$baseaddr, FIPSDIR => \$fipsdir, EC_ASM => \$mf_ec_asm, ); open(IN,") { my ($mf_opt, $mf_ref); while (($mf_opt, $mf_ref) = each %mf_import) { if (/^$mf_opt\s*=\s*(.*)$/ && !defined($$mfref)) { $$mf_ref = $1; } } } close(IN); $debug = 1 if $mf_platform =~ /^debug-/; die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; $infile="MINFO"; %ops=( "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", "VC-WIN64A", "Microsoft C/C++ - Win64/x64", "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", "Mingw32", "GNU C++ - Windows NT or 9x", "Mingw32-files", "Create files with DOS copy ...", "BC-NT", "Borland C++ 4.5 - Windows NT", "linux-elf","Linux elf", "ultrix-mips","DEC mips ultrix", "FreeBSD","FreeBSD distribution", "OS2-EMX", "EMX GCC OS/2", "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", "default","cc under unix", "auto", "auto detect from top level Makefile", "copy", "copy from top level Makefile" ); $platform=""; my $xcflags=""; foreach (@ARGV) { if (!&read_options && !defined($ops{$_})) { print STDERR "unknown option - $_\n"; print STDERR "usage: perl mk1mf.pl [options] [system]\n"; print STDERR "\nwhere [system] can be one of the following\n"; foreach $i (sort keys %ops) { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } print STDERR <<"EOF"; and [options] can be one of no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest no-ripemd no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher no-bf no-cast no-aes no-camellia no-seed no-rsa no-dsa no-dh - Skip this public key cipher no-ssl2 no-ssl3 - Skip this version of SSL just-ssl - remove all non-ssl keys/digest no-asm - No x86 asm no-krb5 - No KRB5 no-srp - No SRP no-ec - No EC no-ecdsa - No ECDSA no-ecdh - No ECDH no-engine - No engine no-hw - No hw nasm - Use NASM for x86 asm nw-nasm - Use NASM x86 asm for NetWare nw-mwasm - Use Metrowerks x86 asm for NetWare gaswin - Use GNU as with Mingw32 no-socks - No socket code no-err - No error strings dll/shlib - Build shared libraries (MS) debug - Debug build profile - Profiling build gcc - Use Gcc (unix) Values that can be set TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler -L -l - extra library flags (unix) - - extra 'cc' flags, added (MS), or replace (unix) EOF exit(1); } $platform=$_; } foreach (grep(!/^$/, split(/ /, $OPTIONS))) { print STDERR "unknown option - $_\n" if !&read_options; } $no_static_engine = 0 if (!$shlib); $no_mdc2=1 if ($no_des); $no_ssl3=1 if ($no_md5 || $no_sha); $no_ssl3=1 if ($no_rsa && $no_dh); $no_ssl2=1 if ($no_md5); $no_ssl2=1 if ($no_rsa); $out_def="out"; $inc_def="outinc"; $tmp_def="tmp"; $perl="perl" unless defined $perl; $mkdir="-mkdir" unless defined $mkdir; ($ssl,$crypto)=("ssl","crypto"); $ranlib="echo ranlib"; $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}: $platform eq 'copy' ? getcwd() : '.'; $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; # $bin_dir.=$o causes a core dump on my sparc :-( $NT=0; push(@INC,"util/pl","pl"); if ($platform eq "auto" || $platform eq 'copy') { $orig_platform = $platform; $platform = $mf_platform; print STDERR "Imported platform $mf_platform\n"; } if (($platform =~ /VC-(.+)/)) { $FLAVOR=$1; $NT = 1 if $1 eq "NT"; require 'VC-32.pl'; } elsif ($platform eq "Mingw32") { require 'Mingw32.pl'; } elsif ($platform eq "Mingw32-files") { require 'Mingw32f.pl'; } elsif ($platform eq "BC-NT") { $bc=1; require 'BC-32.pl'; } elsif ($platform eq "FreeBSD") { require 'unix.pl'; $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; } elsif ($platform eq "linux-elf") { require "unix.pl"; require "linux.pl"; $unix=1; } elsif ($platform eq "ultrix-mips") { require "unix.pl"; require "ultrix.pl"; $unix=1; } elsif ($platform eq "OS2-EMX") { $wc=1; require 'OS2-EMX.pl'; } elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) { $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); require 'netware.pl'; } else { require "unix.pl"; $unix=1; $cflags.=' -DTERMIO'; } $fipsdir =~ s/\//${o}/g; $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); $cflags= "$xcflags$cflags" if $xcflags ne ""; $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; $cflags.=" -DOPENSSL_NO_AES" if $no_aes; $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; $cflags.=" -DOPENSSL_NO_SEED" if $no_seed; $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; $cflags.=" -DOPENSSL_NO_MD2" if $no_md2; $cflags.=" -DOPENSSL_NO_MD4" if $no_md4; $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; $cflags.=" -DOPENSSL_NO_BF" if $no_bf; $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; $cflags.=" -DOPENSSL_NO_DES" if $no_des; $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; $cflags.=" -DOPENSSL_NO_DH" if $no_dh; $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; $cflags.=" -DOPENSSL_NO_TLS1" if $no_tls1; $cflags.=" -DOPENSSL_NO_SRP" if $no_srp; $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; $cflags.=" -DOPENSSL_NO_ERR" if $no_err; $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; $cflags.=" -DOPENSSL_NO_EC" if $no_ec; $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; $cflags.=" -DOPENSSL_NO_GOST" if $no_gost; $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; $cflags.=" -DOPENSSL_NO_HW" if $no_hw; $cflags.=" -DOPENSSL_FIPS" if $fips; $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; $cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m; $cflags.=" -DOPENSSL_NO_WEAK_SSL_CIPHERS" if $no_weak_ssl; $cflags.=" -DZLIB" if $zlib_opt; $cflags.=" -DZLIB_SHARED" if $zlib_opt == 2; $cflags.=" -DOPENSSL_NO_COMP" if $no_comp; if ($no_static_engine) { $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; } else { $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; } #$cflags.=" -DRSAref" if $rsaref ne ""; ## if ($unix) ## { $cflags="$c_flags" if ($c_flags ne ""); } ##else { $cflags="$c_flags$cflags" if ($c_flags ne ""); } if ($orig_platform eq 'copy') { $cflags = $mf_cflag; $cc = $mf_cc; } $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); if ($msdos) { $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; $banner.="\t\@echo documentation for details.\n"; } # have to do this to allow $(CC) under unix $link="$bin_dir$link" if ($link !~ /^\$/); $INSTALLTOP =~ s|/|$o|g; $OPENSSLDIR =~ s|/|$o|g; ############################################# # We parse in input file and 'store' info for later printing. open(IN,"<$infile") || die "unable to open $infile:$!\n"; $_=; for (;;) { s/\s*$//; # was chop, didn't work in mixture of perls for Windows... ($key,$val)=/^([^=]+)=(.*)/; if ($key eq "RELATIVE_DIRECTORY") { if ($lib ne "") { $uc=$lib; $uc =~ s/^lib(.*)\.a/$1/; $uc =~ tr/a-z/A-Z/; $lib_nam{$uc}=$uc; $lib_obj{$uc}.=$libobj." "; } last if ($val eq "FINISHED"); $lib=""; $libobj=""; $dir=$val; } if ($key eq "KRB5_INCLUDES") { $cflags .= " $val";} if ($key eq "ZLIB_INCLUDE") { $cflags .= " $val" if $val ne "";} if ($key eq "LIBZLIB") { $zlib_lib = "$val" if $val ne "";} if ($key eq "LIBKRB5") { $ex_libs .= " $val" if $val ne "";} if ($key eq "TEST") { $test.=&var_add($dir,$val, 0); } if (($key eq "PROGS") || ($key eq "E_OBJ")) { $e_exe.=&var_add($dir,$val, 0); } if ($key eq "LIB") { $lib=$val; $lib =~ s/^.*\/([^\/]+)$/$1/; } if ($key eq "LIBNAME" && $no_static_engine) { $lib=$val; $lib =~ s/^.*\/([^\/]+)$/$1/; $otherlibs .= " $lib"; } if ($key eq "EXHEADER") { $exheader.=&var_add($dir,$val, 1); } if ($key eq "HEADER") { $header.=&var_add($dir,$val, 1); } if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) { $libobj=&var_add($dir,$val, 0); } if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) { $engines.=$val } if (!($_=)) { $_="RELATIVE_DIRECTORY=FINISHED\n"; } } close(IN); if ($orig_platform eq 'copy') { # Remove opensslconf.h so it doesn't get updated if we configure a # different branch. $exheader =~ s/[^ ]+\/opensslconf.h//; $header =~ s/[^ ]+\/opensslconf.h//; } if ($shlib) { $extra_install= <<"EOF"; \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" EOF if ($no_static_engine) { $extra_install .= <<"EOF" \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" \$(CP) \$(E_SHLIB) \"\$(INSTALLTOP)${o}lib${o}engines\" EOF } } else { $extra_install= <<"EOF"; \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" EOF $ex_libs .= " $zlib_lib" if $zlib_opt == 1; if ($fips) { $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; $ex_l_libs .= " \$(O_FIPSCANISTER)"; } } $defs= <<"EOF"; # N.B. You MUST use -j on FreeBSD. # This makefile has been automatically generated from the OpenSSL distribution. # This single makefile will build the complete OpenSSL distribution and # by default leave the 'interesting' output files in .${o}out and the stuff # that needs deleting in .${o}tmp. # The file was generated by running 'make makefile.one', which # does a 'make files', which writes all the environment variables from all # the makefiles to the file call MINFO. This file is used by # util${o}mk1mf.pl to generate makefile.one. # The 'makefile per directory' system suites me when developing this # library and also so I can 'distribute' indervidual library sections. # The one monster makefile better suits building in non-unix # environments. EOF $defs .= $preamble if defined $preamble; $defs.= <<"EOF"; INSTALLTOP=$INSTALLTOP OPENSSLDIR=$OPENSSLDIR # Set your compiler options PLATFORM=$platform CC=$bin_dir${cc} CFLAG=$cflags APP_CFLAG=$app_cflag LIB_CFLAG=$lib_cflag SHLIB_CFLAG=$shl_cflag APP_EX_OBJ=$app_ex_obj SHLIB_EX_OBJ=$shlib_ex_obj # add extra libraries to this define, for solaris -lsocket -lnsl would # be added EX_LIBS=$ex_libs # The OpenSSL directory SRC_D=$src_dir LINK_CMD=$link LFLAGS=$lflags RSC=$rsc # The output directory for everything interesting OUT_D=$out_dir # The output directory for all the temporary muck TMP_D=$tmp_dir # The output directory for the header files INC_D=$inc_dir INCO_D=$inc_dir${o}openssl PERL=$perl CP=$cp RM=$rm RANLIB=$ranlib MKDIR=$mkdir MKLIB=$bin_dir$mklib MLFLAGS=$mlflags ASM=$bin_dir$asm # FIPS validated module and support file locations E_PREMAIN_DSO=fips_premain_dso FIPSDIR=$fipsdir BASEADDR=$baseaddr FIPSLIB_D=\$(FIPSDIR)${o}lib FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep} PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl ###################################################### # You should not need to touch anything below this point ###################################################### E_EXE=openssl SSL=$ssl CRYPTO=$crypto # BIN_D - Binary output directory # TEST_D - Binary test file output directory # LIB_D - library output directory # ENG_D - dynamic engine output directory # Note: if you change these point to different directories then uncomment out # the lines around the 'NB' comment below. # BIN_D=\$(OUT_D) TEST_D=\$(OUT_D) LIB_D=\$(OUT_D) ENG_D=\$(OUT_D) # INCL_D - local library directory # OBJ_D - temp object file directory OBJ_D=\$(TMP_D) INCL_D=\$(TMP_D) O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp SO_SSL= $plib\$(SSL)$so_shlibp SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs ###################################################### # Don't touch anything below this point ###################################################### INC=-I\$(INC_D) -I\$(INCL_D) APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) ############################################# EOF $rules=<<"EOF"; all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets banner: $banner \$(TMP_D): \$(MKDIR) \"\$(TMP_D)\" # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different #\$(BIN_D): # \$(MKDIR) \$(BIN_D) # #\$(TEST_D): # \$(MKDIR) \$(TEST_D) \$(LIB_D): \$(MKDIR) \"\$(LIB_D)\" \$(INCO_D): \$(INC_D) \$(MKDIR) \"\$(INCO_D)\" \$(INC_D): \$(MKDIR) \"\$(INC_D)\" # This needs to be invoked once, when the makefile is first constructed, or # after cleaning. init: \$(TMP_D) \$(LIB_D) \$(INC_D) \$(INCO_D) \$(BIN_D) \$(TEST_D) headers \$(PERL) \$(SRC_D)/util/copy-if-different.pl "\$(SRC_D)/crypto/opensslconf.h" "\$(INCO_D)/opensslconf.h" headers: \$(HEADER) \$(EXHEADER) lib: \$(LIBS_DEP) \$(E_SHLIB) exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep install: all \$(MKDIR) \"\$(INSTALLTOP)\" \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" \$(MKDIR) \"\$(INSTALLTOP)${o}include\" \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\" \$(MKDIR) \"\$(OPENSSLDIR)\" \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" $extra_install clean: \$(RM) \$(TMP_D)$o*.* vclean: \$(RM) \$(TMP_D)$o*.* \$(RM) \$(OUT_D)$o*.* reallyclean: \$(RM) -rf \$(TMP_D) \$(RM) -rf \$(BIN_D) \$(RM) -rf \$(TEST_D) \$(RM) -rf \$(LIB_D) \$(RM) -rf \$(INC_D) EOF if ($orig_platform ne 'copy') { $rules .= <<"EOF"; test: \$(T_EXE) cd \$(BIN_D) ..${o}ms${o}test EOF } my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; $platform_cpp_symbol =~ s/-/_/g; if (open(IN,"crypto/buildinf.h")) { # Remove entry for this platform in existing file buildinf.h. my $old_buildinf_h = ""; while () { if (/^\#ifdef $platform_cpp_symbol$/) { while () { last if (/^\#endif/); } } else { $old_buildinf_h .= $_; } } close(IN); open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; print OUT $old_buildinf_h; close(OUT); } open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; printf OUT < \$no_rc2, "no-rc4" => \$no_rc4, "no-rc5" => \$no_rc5, "no-idea" => \$no_idea, "no-aes" => \$no_aes, "no-camellia" => \$no_camellia, "no-seed" => \$no_seed, "no-des" => \$no_des, "no-bf" => \$no_bf, "no-cast" => \$no_cast, "no-md2" => \$no_md2, "no-md4" => \$no_md4, "no-md5" => \$no_md5, "no-sha" => \$no_sha, "no-sha1" => \$no_sha1, "no-ripemd" => \$no_ripemd, "no-mdc2" => \$no_mdc2, "no-whirlpool" => \$no_whirlpool, "no-patents" => [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], "no-rsa" => \$no_rsa, "no-dsa" => \$no_dsa, "no-dh" => \$no_dh, "no-hmac" => \$no_hmac, "no-asm" => \$no_asm, "nasm" => \$nasm, "nw-nasm" => \$nw_nasm, "nw-mwasm" => \$nw_mwasm, "gaswin" => \$gaswin, "no-ssl2" => \$no_ssl2, "no-ssl2-method" => 0, "no-ssl3" => \$no_ssl3, "no-ssl3-method" => 0, "no-tlsext" => \$no_tlsext, "no-tls1" => \$no_tls1, "no-dtls1" => 0, "no-srp" => \$no_srp, "no-cms" => \$no_cms, "no-jpake" => \$no_jpake, "no-ec2m" => \$no_ec2m, "no-ec_nistp_64_gcc_128" => 0, "no-weak-ssl-ciphers" => \$no_weak_ssl, "no-err" => \$no_err, "no-sock" => \$no_sock, "no-krb5" => \$no_krb5, "no-ec" => \$no_ec, "no-ecdsa" => \$no_ecdsa, "no-ecdh" => \$no_ecdh, "no-gost" => \$no_gost, "no-engine" => \$no_engine, "no-hw" => \$no_hw, "no-rsax" => 0, "just-ssl" => [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, \$no_aes, \$no_camellia, \$no_seed, \$no_srp], "rsaref" => 0, "gcc" => \$gcc, "debug" => \$debug, "profile" => \$profile, "shlib" => \$shlib, "dll" => \$shlib, "shared" => 0, "no-sctp" => 0, "no-srtp" => 0, "no-gmp" => 0, "no-rfc3779" => 0, "no-montasm" => 0, "no-shared" => 0, "no-store" => 0, "no-zlib" => 0, "no-zlib-dynamic" => 0, "no-ssl-trace" => 0, "no-unit-test" => 0, "no-libunbound" => 0, "no-multiblock" => 0, "no-comp" => \$no_comp, "fips" => \$fips ); if (exists $valid_options{$_}) { my $r = $valid_options{$_}; if ( ref $r eq "SCALAR") { $$r = 1;} elsif ( ref $r eq "ARRAY") { my $r2; foreach $r2 (@$r) { $$r2 = 1; } } } elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } elsif (/^enable-zlib-dynamic$/) { $zlib_opt = 2; } elsif (/^no-static-engine/) { $no_static_engine = 1; } elsif (/^enable-static-engine/) { $no_static_engine = 0; } # There are also enable-xxx options which correspond to # the no-xxx. Since the scalars are enabled by default # these can be ignored. elsif (/^enable-/) { my $t = $_; $t =~ s/^enable/no/; if (exists $valid_options{$t}) {return 1;} return 0; } # experimental-xxx is mostly like enable-xxx, but opensslconf.v # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) elsif (/^experimental-/) { my $algo, $ALGO; ($algo = $_) =~ s/^experimental-//; ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; } elsif (/^--with-krb5-flavor=(.*)$/) { my $krb5_flavor = $1; if ($krb5_flavor =~ /^force-[Hh]eimdal$/) { $xcflags="-DKRB5_HEIMDAL $xcflags"; } elsif ($krb5_flavor =~ /^MIT/i) { $xcflags="-DKRB5_MIT $xcflags"; if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) { $xcflags="-DKRB5_MIT_OLD11 $xcflags" } } } elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } elsif (/^-[lL].*$/) { $l_flags.="$_ "; } elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) { $c_flags.="$_ "; } else { return(0); } return(1); }