Compare commits
106 Commits
OpenSSL_1_
...
OpenSSL_1_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3df69d3aef | ||
![]() |
921095d4d3 | ||
![]() |
5cc6509dae | ||
![]() |
18029a3d07 | ||
![]() |
7b22e8d01f | ||
![]() |
da947c9758 | ||
![]() |
128b271c8d | ||
![]() |
a8b1e52ff4 | ||
![]() |
d6e903d188 | ||
![]() |
86f8fb0e34 | ||
![]() |
c0334c2c92 | ||
![]() |
c3c7fb07dc | ||
![]() |
b19d814321 | ||
![]() |
76343947ad | ||
![]() |
4b22cce381 | ||
![]() |
b717b08307 | ||
![]() |
819418110b | ||
![]() |
77c77f0a1b | ||
![]() |
8b84495380 | ||
![]() |
c1559f5046 | ||
![]() |
d8d2e50359 | ||
![]() |
6c4ce00753 | ||
![]() |
fcb61b6c92 | ||
![]() |
b2b8163964 | ||
![]() |
56490fc26f | ||
![]() |
f2e95a02b1 | ||
![]() |
912c8c92b5 | ||
![]() |
94be83127b | ||
![]() |
be109b9eec | ||
![]() |
c0d69ddb33 | ||
![]() |
8cd6714084 | ||
![]() |
327de270d5 | ||
![]() |
8e91b3d991 | ||
![]() |
20223855e4 | ||
![]() |
563fc239d2 | ||
![]() |
15919ecadc | ||
![]() |
289c06823e | ||
![]() |
ff2459b918 | ||
![]() |
8944d10e2d | ||
![]() |
df57e42baa | ||
![]() |
9c5c18500b | ||
![]() |
35fafc4dbc | ||
![]() |
0c14565c5b | ||
![]() |
5a9e9669d8 | ||
![]() |
2b31fcc0b5 | ||
![]() |
b65b4c3481 | ||
![]() |
ef116b0003 | ||
![]() |
0d691e0e27 | ||
![]() |
ae3fcdf1e5 | ||
![]() |
d6ca1cee8b | ||
![]() |
bfa34f551c | ||
![]() |
f9aa27dc78 | ||
![]() |
f417997a32 | ||
![]() |
6ee3997134 | ||
![]() |
f9a21ed069 | ||
![]() |
d6b4a41d10 | ||
![]() |
9fdbaf3a32 | ||
![]() |
6fff54b0ce | ||
![]() |
6e20f55646 | ||
![]() |
87cd297d14 | ||
![]() |
195f6302bb | ||
![]() |
8f51c206b3 | ||
![]() |
f2aff60f6f | ||
![]() |
fbabc6c06e | ||
![]() |
bfb14d724b | ||
![]() |
4d2207f097 | ||
![]() |
b42e4a9f6b | ||
![]() |
78a6b77976 | ||
![]() |
ba5d0113e8 | ||
![]() |
f747572547 | ||
![]() |
36b619a06e | ||
![]() |
13c1807041 | ||
![]() |
f243def213 | ||
![]() |
1f956f9cda | ||
![]() |
98e6f07901 | ||
![]() |
f95519538a | ||
![]() |
79e2e927e6 | ||
![]() |
7f3563b576 | ||
![]() |
458a55af16 | ||
![]() |
681da86ebb | ||
![]() |
872f91c403 | ||
![]() |
ee1ccd0a41 | ||
![]() |
62bfff2d99 | ||
![]() |
95929797a0 | ||
![]() |
bcfaa4eeee | ||
![]() |
cb43fd0467 | ||
![]() |
ba25221226 | ||
![]() |
506805e708 | ||
![]() |
04222b630e | ||
![]() |
16064539ad | ||
![]() |
75c77a71fa | ||
![]() |
3b740cebd5 | ||
![]() |
f17a4ad7d7 | ||
![]() |
79e0285755 | ||
![]() |
8d5d455988 | ||
![]() |
1d5668c258 | ||
![]() |
bc1544d8c5 | ||
![]() |
6ca1dc9737 | ||
![]() |
0ed9ca21ae | ||
![]() |
11b32d6e29 | ||
![]() |
63ac16ccac | ||
![]() |
db7cb7ab9a | ||
![]() |
6d09851694 | ||
![]() |
63c1d16bb8 | ||
![]() |
6fa805f516 | ||
![]() |
06aab26874 |
538
CHANGES
538
CHANGES
@@ -2,47 +2,171 @@
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
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]
|
||||
|
||||
*) 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]
|
||||
|
||||
*) 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
|
||||
@@ -378,6 +502,29 @@
|
||||
|
||||
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.
|
||||
|
||||
@@ -395,6 +542,17 @@
|
||||
(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.
|
||||
|
||||
@@ -439,6 +597,17 @@
|
||||
(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
|
||||
@@ -598,18 +767,6 @@
|
||||
bogus results, with non-infinity inputs mapped to infinity too.)
|
||||
[Bodo Moeller]
|
||||
|
||||
Changes between 1.0.1i and 1.0.1j [xx XXX xxxx]
|
||||
|
||||
*) 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.1g and 1.0.1h [5 Jun 2014]
|
||||
|
||||
*) Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted
|
||||
@@ -1107,63 +1264,6 @@
|
||||
Add command line options to s_client/s_server.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 1.0.0j and 1.0.0k [5 Feb 2013]
|
||||
|
||||
*) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
|
||||
|
||||
This addresses the flaw in CBC record processing discovered by
|
||||
Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
|
||||
at: http://www.isg.rhul.ac.uk/tls/
|
||||
|
||||
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]
|
||||
|
||||
*) Return an error when checking OCSP signatures when key is NULL.
|
||||
This fixes a DoS attack. (CVE-2013-0166)
|
||||
[Steve Henson]
|
||||
|
||||
*) 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.
|
||||
(This is a backport)
|
||||
[Rob Stradling <rob.stradling@comodo.com>]
|
||||
|
||||
*) Fix possible deadlock when decoding public keys.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 1.0.0i and 1.0.0j [10 May 2012]
|
||||
|
||||
[NB: OpenSSL 1.0.0i and later 1.0.0 patch levels were released after
|
||||
OpenSSL 1.0.1.]
|
||||
|
||||
*) Sanity check record length before skipping explicit IV in 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]
|
||||
|
||||
Changes between 1.0.0h and 1.0.0i [19 Apr 2012]
|
||||
|
||||
*) Check for potentially exploitable overflows in asn1_d2i_read_bio
|
||||
BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
|
||||
in CRYPTO_realloc_clean.
|
||||
|
||||
Thanks to Tavis Ormandy, Google Security Team, for discovering this
|
||||
issue and to Adam Langley <agl@chromium.org> for fixing it.
|
||||
(CVE-2012-2110)
|
||||
[Adam Langley (Google), Tavis Ormandy, Google Security Team]
|
||||
|
||||
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
|
||||
@@ -2154,228 +2254,6 @@
|
||||
*) Change 'Configure' script to enable Camellia by default.
|
||||
[NTT]
|
||||
|
||||
Changes between 0.9.8x and 0.9.8y [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]
|
||||
|
||||
*) Return an error when checking OCSP signatures when key is NULL.
|
||||
This fixes a DoS attack. (CVE-2013-0166)
|
||||
[Steve Henson]
|
||||
|
||||
*) 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.
|
||||
(This is a backport)
|
||||
[Rob Stradling <rob.stradling@comodo.com>]
|
||||
|
||||
*) Fix possible deadlock when decoding public keys.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8w and 0.9.8x [10 May 2012]
|
||||
|
||||
*) Sanity check record length before skipping explicit IV in 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]
|
||||
|
||||
Changes between 0.9.8v and 0.9.8w [23 Apr 2012]
|
||||
|
||||
*) The fix for CVE-2012-2110 did not take into account that the
|
||||
'len' argument to BUF_MEM_grow and BUF_MEM_grow_clean is an
|
||||
int in OpenSSL 0.9.8, making it still vulnerable. Fix by
|
||||
rejecting negative len parameter. (CVE-2012-2131)
|
||||
[Tomas Hoger <thoger@redhat.com>]
|
||||
|
||||
Changes between 0.9.8u and 0.9.8v [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 <agl@chromium.org> for fixing it.
|
||||
(CVE-2012-2110)
|
||||
[Adam Langley (Google), Tavis Ormandy, Google Security Team]
|
||||
|
||||
Changes between 0.9.8t and 0.9.8u [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 <inestlerode@us.ibm.com> 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 <inestlerode@us.ibm.com> for discovering this bug.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8s and 0.9.8t [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 0.9.8r and 0.9.8s [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
|
||||
<seggelmann@fh-muenster.de> and Michael Tuexen <tuexen@fh-muenster.de>
|
||||
for preparing the fix. (CVE-2011-4108)
|
||||
[Robin Seggelmann, Michael Tuexen]
|
||||
|
||||
*) Stop policy check failure freeing same buffer twice. (CVE-2011-4109)
|
||||
[Ben Laurie, Kasper <ekasper@google.com>]
|
||||
|
||||
*) 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 <desnacked@gmail.com> for discovering this issue and
|
||||
Adam Langley for preparing the fix. (CVE-2011-4619)
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Prevent malformed RFC3779 data triggering an assertion failure.
|
||||
Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
|
||||
and Rob Austein <sra@hactrn.net> for fixing it. (CVE-2011-4577)
|
||||
[Rob Austein <sra@hactrn.net>]
|
||||
|
||||
*) 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)]
|
||||
|
||||
*) Fix SSL memory handling for (EC)DH ciphersuites, in particular
|
||||
for multi-threaded use of ECDH.
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Fix x509_name_ex_d2i memory leak on bad inputs.
|
||||
[Bodo Moeller]
|
||||
|
||||
*) 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 0.9.8q and 0.9.8r [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 0.9.8p and 0.9.8q [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 0.9.8o and 0.9.8p [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 for double free bug in ssl/s3_clnt.c CVE-2010-2939
|
||||
[Steve Henson]
|
||||
|
||||
*) Don't reencode certificate when calculating signature: cache and use
|
||||
the original encoding instead. This makes signature verification of
|
||||
some broken encodings work correctly.
|
||||
[Steve Henson]
|
||||
|
||||
*) ec2_GF2m_simple_mul bugfix: compute correct result if the output EC_POINT
|
||||
is also one of the inputs.
|
||||
[Emilia K<>sper <emilia.kasper@esat.kuleuven.be> (Google)]
|
||||
|
||||
*) Don't repeatedly append PBE algorithms to table if they already exist.
|
||||
Sort table on each new add. This effectively makes the table read only
|
||||
after all algorithms are added and subsequent calls to PKCS12_pbe_add
|
||||
etc are non-op.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8n and 0.9.8o [01 Jun 2010]
|
||||
|
||||
[NB: OpenSSL 0.9.8o and later 0.9.8 patch levels were released after
|
||||
OpenSSL 1.0.0.]
|
||||
|
||||
*) Correct a typo in the CMS ASN1 module which can result in invalid memory
|
||||
access or freeing data twice (CVE-2010-0742)
|
||||
[Steve Henson, Ronald Moesbergen <intercommit@gmail.com>]
|
||||
|
||||
*) Add SHA2 algorithms to SSL_library_init(). SHA2 is becoming far more
|
||||
common in certificates and some applications which only call
|
||||
SSL_library_init and not OpenSSL_add_all_algorithms() will fail.
|
||||
[Steve Henson]
|
||||
|
||||
*) VMS fixes:
|
||||
Reduce copying into .apps and .test in makevms.com
|
||||
Don't try to use blank CA certificate in CA.com
|
||||
Allow use of C files from original directories in maketests.com
|
||||
[Steven M. Schweda" <sms@antinode.info>]
|
||||
|
||||
Changes between 0.9.8m and 0.9.8n [24 Mar 2010]
|
||||
|
||||
*) When rejecting SSL/TLS records due to an incorrect version number, never
|
||||
|
114
Configure
114
Configure
@@ -188,18 +188,18 @@ my %table=(
|
||||
"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 -DTERMIO -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 -DTERMIO -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-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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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-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 -DTERMIO -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",
|
||||
"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
|
||||
@@ -259,16 +259,16 @@ my %table=(
|
||||
|
||||
#### IRIX 5.x configs
|
||||
# -mips2 flag is added by ./config when appropriate.
|
||||
"irix-gcc","gcc:-O3 -DTERMIOS -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 -DTERMIOS -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-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 -DTERMIOS -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 -DTERMIOS -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",
|
||||
"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 -DTERMIOS -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 -DTERMIOS -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",
|
||||
"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:
|
||||
@@ -348,8 +348,8 @@ my %table=(
|
||||
####
|
||||
# *-generic* is endian-neutral target, but ./config is free to
|
||||
# throw in -D[BL]_ENDIAN, whichever appropriate...
|
||||
"linux-generic32","gcc:-DTERMIO -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 -DTERMIO -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)",
|
||||
"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
|
||||
@@ -378,30 +378,30 @@ my %table=(
|
||||
#
|
||||
# ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
|
||||
#
|
||||
"linux-armv4", "gcc:-DTERMIO -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:-DTERMIO -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)",
|
||||
"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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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",
|
||||
"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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
|
||||
"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:-DTERMIO -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 -DTERMIO -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 -DTERMIO -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-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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -O3 -Weverything $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 -DTERMIO -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 -DTERMIO -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 -DTERMIO -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",
|
||||
"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 -Weverything $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
|
||||
@@ -415,16 +415,16 @@ my %table=(
|
||||
# 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 -DTERMIO -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",
|
||||
"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 <ray.miller@computing-services.oxford.ac.uk> has patiently
|
||||
# assisted with debugging of following two configs.
|
||||
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -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)",
|
||||
"linux-sparcv8","gcc:-mv8 -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 -DTERMIO -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)",
|
||||
"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 -DTERMIO -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",
|
||||
"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
|
||||
@@ -438,31 +438,31 @@ my %table=(
|
||||
#
|
||||
# <appro@fy.chalmers.se>
|
||||
#
|
||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-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 -DTERMIO::-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 -DTERMIO::-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 -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
|
||||
"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 -DTERMIO and pointers to headers and libs.
|
||||
# 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:-DTERMIOS -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 -DTERMIOS -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 -DTERMIOS -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 -DTERMIOS -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 -DTERMIOS -O3 -mv8 -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-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 -mv8 -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:-DTERMIOS -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)",
|
||||
"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 -DTERMIOS -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 -DTERMIOS -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", "gcc:-DL_ENDIAN -DTERMIOS -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)",
|
||||
"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", "gcc:-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)",
|
||||
|
||||
@@ -474,8 +474,8 @@ my %table=(
|
||||
|
||||
# QNX
|
||||
"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
|
||||
"QNX6", "gcc:-DTERMIOS::::-lsocket::${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"QNX6-i386", "gcc:-DL_ENDIAN -DTERMIOS -O2 -Wall::::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"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",
|
||||
@@ -548,7 +548,7 @@ my %table=(
|
||||
"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 -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
|
||||
"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
|
||||
@@ -607,7 +607,7 @@ my %table=(
|
||||
"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 -DTERMIOS -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:",
|
||||
"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 <simon@zid.tuwien.ac.at>
|
||||
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
|
||||
@@ -634,7 +634,7 @@ my %table=(
|
||||
"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 -DTERMIOS -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",
|
||||
"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::::::::",
|
||||
|
86
NEWS
86
NEWS
@@ -5,6 +5,22 @@
|
||||
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.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
|
||||
@@ -54,6 +70,7 @@
|
||||
|
||||
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
|
||||
@@ -113,19 +130,6 @@
|
||||
o Preliminary FIPS capability for unvalidated 2.0 FIPS module.
|
||||
o SRP support.
|
||||
|
||||
Major changes between OpenSSL 1.0.0j and OpenSSL 1.0.0k [5 Feb 2013]:
|
||||
|
||||
o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
|
||||
o Fix OCSP bad key DoS attack CVE-2013-0166
|
||||
|
||||
Major changes between OpenSSL 1.0.0i and OpenSSL 1.0.0j [10 May 2012]:
|
||||
|
||||
o Fix DTLS record length checking bug CVE-2012-2333
|
||||
|
||||
Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.0i [19 Apr 2012]:
|
||||
|
||||
o Fix for ASN1 overflow bug CVE-2012-2110
|
||||
|
||||
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
|
||||
@@ -198,62 +202,6 @@
|
||||
o Opaque PRF Input TLS extension support.
|
||||
o Updated time routines to avoid OS limitations.
|
||||
|
||||
Major changes between OpenSSL 0.9.8x and OpenSSL 0.9.8y [5 Feb 2013]:
|
||||
|
||||
o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
|
||||
o Fix OCSP bad key DoS attack CVE-2013-0166
|
||||
|
||||
Major changes between OpenSSL 0.9.8w and OpenSSL 0.9.8x [10 May 2012]:
|
||||
|
||||
o Fix DTLS record length checking bug CVE-2012-2333
|
||||
|
||||
Major changes between OpenSSL 0.9.8v and OpenSSL 0.9.8w [23 Apr 2012]:
|
||||
|
||||
o Fix for CVE-2012-2131 (corrected fix for 0.9.8 and CVE-2012-2110)
|
||||
|
||||
Major changes between OpenSSL 0.9.8u and OpenSSL 0.9.8v [19 Apr 2012]:
|
||||
|
||||
o Fix for ASN1 overflow bug CVE-2012-2110
|
||||
|
||||
Major changes between OpenSSL 0.9.8t and OpenSSL 0.9.8u [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 0.9.8s and OpenSSL 0.9.8t [18 Jan 2012]:
|
||||
|
||||
o Fix for DTLS DoS issue CVE-2012-0050
|
||||
|
||||
Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s [4 Jan 2012]:
|
||||
|
||||
o Fix for DTLS plaintext recovery attack CVE-2011-4108
|
||||
o Fix policy check double free error CVE-2011-4109
|
||||
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 for malformed RFC3779 data CVE-2011-4577
|
||||
|
||||
Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r [8 Feb 2011]:
|
||||
|
||||
o Fix for security issue CVE-2011-0014
|
||||
|
||||
Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q [2 Dec 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-4180
|
||||
o Fix for CVE-2010-4252
|
||||
|
||||
Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p [16 Nov 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-3864.
|
||||
|
||||
Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o [1 Jun 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-0742.
|
||||
o Various DTLS fixes.
|
||||
o Recognise SHA2 certificates if only SSL algorithms added.
|
||||
o Fix for no-rc4 compilation.
|
||||
o Chil ENGINE unload workaround.
|
||||
|
||||
Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]:
|
||||
|
||||
o CFB cipher definition fixes.
|
||||
|
2
README
2
README
@@ -1,5 +1,5 @@
|
||||
|
||||
OpenSSL 1.0.2 22 Jan 2015
|
||||
OpenSSL 1.0.2a 19 Mar 2015
|
||||
|
||||
Copyright (c) 1998-2011 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
|
13
apps/apps.c
13
apps/apps.c
@@ -574,6 +574,11 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
|
||||
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);
|
||||
@@ -583,6 +588,12 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
|
||||
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);
|
||||
}
|
||||
@@ -2775,7 +2786,7 @@ void print_cert_checks(BIO *bio, X509 *x,
|
||||
return;
|
||||
if (checkhost) {
|
||||
BIO_printf(bio, "Hostname %s does%s match certificate\n",
|
||||
checkhost, X509_check_host(x, checkhost, 0, 0, NULL)
|
||||
checkhost, X509_check_host(x, checkhost, 0, 0, NULL) == 1
|
||||
? "" : " NOT");
|
||||
}
|
||||
|
||||
|
21
apps/ca.c
21
apps/ca.c
@@ -563,10 +563,18 @@ int MAIN(int argc, char **argv)
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
len = strlen(s) + sizeof(CONFIG_FILE);
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
strcpy(tofree, s);
|
||||
#else
|
||||
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
BUF_strlcpy(tofree, s, len);
|
||||
BUF_strlcat(tofree, "/", len);
|
||||
#endif
|
||||
@@ -2813,6 +2821,11 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
||||
tmp = BUF_strdup(str);
|
||||
|
||||
if(!tmp) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
p = strchr(tmp, ',');
|
||||
|
||||
rtime_str = tmp;
|
||||
@@ -2830,6 +2843,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
|
||||
if (prevtm) {
|
||||
*prevtm = ASN1_UTCTIME_new();
|
||||
if(!*prevtm) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) {
|
||||
BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str);
|
||||
goto err;
|
||||
@@ -2870,6 +2887,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
goto err;
|
||||
}
|
||||
comp_time = ASN1_GENERALIZEDTIME_new();
|
||||
if(!comp_time) {
|
||||
BIO_printf(bio_err, "memory allocation failure\n");
|
||||
goto err;
|
||||
}
|
||||
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) {
|
||||
BIO_printf(bio_err, "invalid compromised time %s\n", arg_str);
|
||||
goto err;
|
||||
|
@@ -463,6 +463,10 @@ int MAIN(int argc, char **argv)
|
||||
if (key_param == NULL || key_param->idx != keyidx) {
|
||||
cms_key_param *nparam;
|
||||
nparam = OPENSSL_malloc(sizeof(cms_key_param));
|
||||
if(!nparam) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto argerr;
|
||||
}
|
||||
nparam->idx = keyidx;
|
||||
nparam->param = sk_OPENSSL_STRING_new_null();
|
||||
nparam->next = NULL;
|
||||
|
15
apps/dgst.c
15
apps/dgst.c
@@ -293,6 +293,11 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
in = BIO_new(BIO_s_file());
|
||||
bmd = BIO_new(BIO_f_md());
|
||||
if ((in == NULL) || (bmd == NULL)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
BIO_set_callback(in, BIO_debug_callback);
|
||||
/* needed for windows 3.1 */
|
||||
@@ -304,11 +309,6 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((in == NULL) || (bmd == NULL)) {
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (out_bin == -1) {
|
||||
if (keyfile)
|
||||
out_bin = 1;
|
||||
@@ -460,6 +460,11 @@ int MAIN(int argc, char **argv)
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (!sigbuf) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
siglen = BIO_read(sigbio, sigbuf, siglen);
|
||||
BIO_free(sigbio);
|
||||
if (siglen <= 0) {
|
||||
|
@@ -428,10 +428,6 @@ int main(int Argc, char *ARGV[])
|
||||
if (arg.data != NULL)
|
||||
OPENSSL_free(arg.data);
|
||||
|
||||
if (bio_err != NULL) {
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
}
|
||||
#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
|
||||
/* Free any duplicate Argv[] storage. */
|
||||
if (free_Argv) {
|
||||
@@ -440,6 +436,10 @@ int main(int Argc, char *ARGV[])
|
||||
#endif
|
||||
apps_shutdown();
|
||||
CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL) {
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
}
|
||||
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
10
apps/pkcs7.c
10
apps/pkcs7.c
@@ -189,11 +189,11 @@ int MAIN(int argc, char **argv)
|
||||
if (infile == NULL)
|
||||
BIO_set_fp(in, stdin, BIO_NOCLOSE);
|
||||
else {
|
||||
if (BIO_read_filename(in, infile) <= 0)
|
||||
if (in == NULL) {
|
||||
perror(infile);
|
||||
goto end;
|
||||
}
|
||||
if (BIO_read_filename(in, infile) <= 0) {
|
||||
BIO_printf(bio_err, "unable to load input file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (informat == FORMAT_ASN1)
|
||||
|
@@ -268,6 +268,11 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
rsa_in = OPENSSL_malloc(keysize * 2);
|
||||
rsa_out = OPENSSL_malloc(keysize);
|
||||
if (!rsa_in || !rsa_out) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Read the input data */
|
||||
rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
|
||||
|
@@ -456,8 +456,13 @@ int ssl_print_curves(BIO *out, SSL *s, int noshared)
|
||||
if (ncurves <= 0)
|
||||
return 1;
|
||||
curves = OPENSSL_malloc(ncurves * sizeof(int));
|
||||
if(!curves) {
|
||||
BIO_puts(out, "Malloc error getting supported curves\n");
|
||||
return 0;
|
||||
}
|
||||
SSL_get1_curves(s, curves);
|
||||
|
||||
|
||||
BIO_puts(out, "Supported Elliptic Curves: ");
|
||||
for (i = 0; i < ncurves; i++) {
|
||||
if (i)
|
||||
|
@@ -560,6 +560,11 @@ static char *MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
|
||||
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) {
|
||||
@@ -1295,12 +1300,6 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
if (exc)
|
||||
ssl_ctx_set_excert(ctx, exc);
|
||||
/*
|
||||
* DTLS: partial reads end up discarding unread UDP bytes :-( Setting
|
||||
* read ahead solves this problem.
|
||||
*/
|
||||
if (socket_type == SOCK_DGRAM)
|
||||
SSL_CTX_set_read_ahead(ctx, 1);
|
||||
|
||||
#if !defined(OPENSSL_NO_TLSEXT)
|
||||
# if !defined(OPENSSL_NO_NEXTPROTONEG)
|
||||
|
@@ -347,7 +347,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
|
||||
}
|
||||
if (s_debug)
|
||||
BIO_printf(bio_s_out, "identity_len=%d identity=%s\n",
|
||||
identity ? (int)strlen(identity) : 0, identity);
|
||||
(int)strlen(identity), identity);
|
||||
|
||||
/* here we could lookup the given identity e.g. from a database */
|
||||
if (strcmp(identity, psk_identity) != 0) {
|
||||
@@ -696,6 +696,8 @@ static int ebcdic_new(BIO *bi)
|
||||
EBCDIC_OUTBUFF *wbuf;
|
||||
|
||||
wbuf = (EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
|
||||
if (!wbuf)
|
||||
return 0;
|
||||
wbuf->alloced = 1024;
|
||||
wbuf->buff[0] = '\0';
|
||||
|
||||
@@ -750,9 +752,11 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
|
||||
num = num + num; /* double the size */
|
||||
if (num < inl)
|
||||
num = inl;
|
||||
OPENSSL_free(wbuf);
|
||||
wbuf =
|
||||
(EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
|
||||
if(!wbuf)
|
||||
return 0;
|
||||
OPENSSL_free(b->ptr);
|
||||
|
||||
wbuf->alloced = num;
|
||||
wbuf->buff[0] = '\0';
|
||||
@@ -1736,12 +1740,6 @@ int MAIN(int argc, char *argv[])
|
||||
SSL_CTX_set_options(ctx, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
|
||||
if (exc)
|
||||
ssl_ctx_set_excert(ctx, exc);
|
||||
/*
|
||||
* DTLS: partial reads end up discarding unread UDP bytes :-( Setting
|
||||
* read ahead solves this problem.
|
||||
*/
|
||||
if (socket_type == SOCK_DGRAM)
|
||||
SSL_CTX_set_read_ahead(ctx, 1);
|
||||
|
||||
if (state)
|
||||
SSL_CTX_set_info_callback(ctx, apps_ssl_info_callback);
|
||||
@@ -1821,12 +1819,6 @@ int MAIN(int argc, char *argv[])
|
||||
SSL_CTX_set_options(ctx2, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
|
||||
if (exc)
|
||||
ssl_ctx_set_excert(ctx2, exc);
|
||||
/*
|
||||
* DTLS: partial reads end up discarding unread UDP bytes :-(
|
||||
* Setting read ahead solves this problem.
|
||||
*/
|
||||
if (socket_type == SOCK_DGRAM)
|
||||
SSL_CTX_set_read_ahead(ctx2, 1);
|
||||
|
||||
if (state)
|
||||
SSL_CTX_set_info_callback(ctx2, apps_ssl_info_callback);
|
||||
@@ -2877,7 +2869,7 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
|
||||
/* else we have data */
|
||||
if (((www == 1) && (strncmp("GET ", buf, 4) == 0)) ||
|
||||
((www == 2) && (strncmp("GET /stats ", buf, 10) == 0))) {
|
||||
((www == 2) && (strncmp("GET /stats ", buf, 11) == 0))) {
|
||||
char *p;
|
||||
X509 *peer;
|
||||
STACK_OF(SSL_CIPHER) *sk;
|
||||
@@ -3331,6 +3323,10 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
|
||||
unsigned char *p;
|
||||
|
||||
sess = OPENSSL_malloc(sizeof(simple_ssl_session));
|
||||
if(!sess) {
|
||||
BIO_printf(bio_err, "Out of memory adding session to external cache\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
SSL_SESSION_get_id(session, &sess->idlen);
|
||||
sess->derlen = i2d_SSL_SESSION(session, NULL);
|
||||
@@ -3338,6 +3334,16 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
|
||||
sess->id = BUF_memdup(SSL_SESSION_get_id(session, NULL), sess->idlen);
|
||||
|
||||
sess->der = OPENSSL_malloc(sess->derlen);
|
||||
if(!sess->id || !sess->der) {
|
||||
BIO_printf(bio_err, "Out of memory adding session to external cache\n");
|
||||
|
||||
if(sess->id)
|
||||
OPENSSL_free(sess->id);
|
||||
if(sess->der)
|
||||
OPENSSL_free(sess->der);
|
||||
OPENSSL_free(sess);
|
||||
return 0;
|
||||
}
|
||||
p = sess->der;
|
||||
i2d_SSL_SESSION(session, &p);
|
||||
|
||||
|
@@ -302,6 +302,10 @@ static int parseArgs(int argc, char **argv)
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
maxTime = atoi(*(++argv));
|
||||
if(maxTime <= 0) {
|
||||
BIO_printf(bio_err, "time must be > 0\n");
|
||||
badop = 1;
|
||||
}
|
||||
} else {
|
||||
BIO_printf(bio_err, "unknown option %s\n", *argv);
|
||||
badop = 1;
|
||||
@@ -550,7 +554,8 @@ int MAIN(int argc, char **argv)
|
||||
nConn, totalTime, ((double)nConn / totalTime), bytes_read);
|
||||
printf
|
||||
("%d connections in %ld real seconds, %ld bytes read per connection\n",
|
||||
nConn, (long)time(NULL) - finishtime + maxTime, bytes_read / nConn);
|
||||
nConn, (long)time(NULL) - finishtime + maxTime,
|
||||
bytes_read / (nConn?nConn:1));
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
|
12
apps/speed.c
12
apps/speed.c
@@ -2775,6 +2775,11 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
|
||||
|
||||
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);
|
||||
@@ -2859,7 +2864,10 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
OPENSSL_free(inp);
|
||||
OPENSSL_free(out);
|
||||
end:
|
||||
if(inp)
|
||||
OPENSSL_free(inp);
|
||||
if(out)
|
||||
OPENSSL_free(out);
|
||||
}
|
||||
#endif
|
||||
|
@@ -435,10 +435,18 @@ int MAIN(int argc, char **argv)
|
||||
# ifdef OPENSSL_SYS_VMS
|
||||
len = strlen(s) + sizeof(CONFIG_FILE);
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
strcpy(tofree, s);
|
||||
# else
|
||||
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
|
||||
tofree = OPENSSL_malloc(len);
|
||||
if(!tofree) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
goto err;
|
||||
}
|
||||
BUF_strlcpy(tofree, s, len);
|
||||
BUF_strlcat(tofree, "/", len);
|
||||
# endif
|
||||
|
@@ -829,6 +829,11 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
z = i2d_X509(x, NULL);
|
||||
m = OPENSSL_malloc(z);
|
||||
if (!m) {
|
||||
BIO_printf(bio_err, "Out of memory\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
d = (unsigned char *)m;
|
||||
z = i2d_X509_NAME(X509_get_subject_name(x), &d);
|
||||
|
@@ -72,7 +72,7 @@ aesni-mb-x86_64.s: asm/aesni-mb-x86_64.pl
|
||||
|
||||
aes-sparcv9.s: asm/aes-sparcv9.pl
|
||||
$(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
|
||||
aest4-sparcv9.s: asm/aest4-sparcv9.pl
|
||||
aest4-sparcv9.s: asm/aest4-sparcv9.pl ../perlasm/sparcv9_modes.pl
|
||||
$(PERL) asm/aest4-sparcv9.pl $(CFLAGS) > $@
|
||||
|
||||
aes-ppc.s: asm/aes-ppc.pl
|
||||
|
@@ -1130,31 +1130,31 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
* map cipher state to byte array block:
|
||||
*/
|
||||
s0 =
|
||||
(Td4[(t0 >> 24) ] << 24) ^
|
||||
(Td4[(t3 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(t2 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(t1 ) & 0xff]) ^
|
||||
((u32)Td4[(t0 >> 24) ] << 24) ^
|
||||
((u32)Td4[(t3 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(t2 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(t1 ) & 0xff]) ^
|
||||
rk[0];
|
||||
PUTU32(out , s0);
|
||||
s1 =
|
||||
(Td4[(t1 >> 24) ] << 24) ^
|
||||
(Td4[(t0 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(t3 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(t2 ) & 0xff]) ^
|
||||
((u32)Td4[(t1 >> 24) ] << 24) ^
|
||||
((u32)Td4[(t0 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(t3 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(t2 ) & 0xff]) ^
|
||||
rk[1];
|
||||
PUTU32(out + 4, s1);
|
||||
s2 =
|
||||
(Td4[(t2 >> 24) ] << 24) ^
|
||||
(Td4[(t1 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(t0 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(t3 ) & 0xff]) ^
|
||||
((u32)Td4[(t2 >> 24) ] << 24) ^
|
||||
((u32)Td4[(t1 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(t0 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(t3 ) & 0xff]) ^
|
||||
rk[2];
|
||||
PUTU32(out + 8, s2);
|
||||
s3 =
|
||||
(Td4[(t3 >> 24) ] << 24) ^
|
||||
(Td4[(t2 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(t1 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(t0 ) & 0xff]) ^
|
||||
((u32)Td4[(t3 >> 24) ] << 24) ^
|
||||
((u32)Td4[(t2 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(t1 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(t0 ) & 0xff]) ^
|
||||
rk[3];
|
||||
PUTU32(out + 12, s3);
|
||||
}
|
||||
@@ -1233,10 +1233,10 @@ int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
@@ -1253,10 +1253,10 @@ int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[ 5];
|
||||
rk[ 6] = rk[ 0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[ 7] = rk[ 1] ^ rk[ 6];
|
||||
rk[ 8] = rk[ 2] ^ rk[ 7];
|
||||
@@ -1275,10 +1275,10 @@ int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[ 7];
|
||||
rk[ 8] = rk[ 0] ^
|
||||
(Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ]) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ]) ^
|
||||
rcon[i];
|
||||
rk[ 9] = rk[ 1] ^ rk[ 8];
|
||||
rk[10] = rk[ 2] ^ rk[ 9];
|
||||
@@ -1288,10 +1288,10 @@ int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
}
|
||||
temp = rk[11];
|
||||
rk[12] = rk[ 4] ^
|
||||
(Te4[(temp >> 24) ] << 24) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 16) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 8) ^
|
||||
(Te4[(temp ) & 0xff]);
|
||||
((u32)Te4[(temp >> 24) ] << 24) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 16) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp ) & 0xff]);
|
||||
rk[13] = rk[ 5] ^ rk[12];
|
||||
rk[14] = rk[ 6] ^ rk[13];
|
||||
rk[15] = rk[ 7] ^ rk[14];
|
||||
|
@@ -499,10 +499,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^
|
||||
(Te4[(temp >> 8) & 0xff] ) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] ) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 24) ^
|
||||
rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
@@ -519,10 +519,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[ 5];
|
||||
rk[ 6] = rk[ 0] ^
|
||||
(Te4[(temp >> 8) & 0xff] ) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] ) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 24) ^
|
||||
rcon[i];
|
||||
rk[ 7] = rk[ 1] ^ rk[ 6];
|
||||
rk[ 8] = rk[ 2] ^ rk[ 7];
|
||||
@@ -541,10 +541,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
while (1) {
|
||||
temp = rk[ 7];
|
||||
rk[ 8] = rk[ 0] ^
|
||||
(Te4[(temp >> 8) & 0xff] ) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 24) ] << 16) ^
|
||||
(Te4[(temp ) & 0xff] << 24) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] ) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 24) ] << 16) ^
|
||||
((u32)Te4[(temp ) & 0xff] << 24) ^
|
||||
rcon[i];
|
||||
rk[ 9] = rk[ 1] ^ rk[ 8];
|
||||
rk[10] = rk[ 2] ^ rk[ 9];
|
||||
@@ -554,10 +554,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
}
|
||||
temp = rk[11];
|
||||
rk[12] = rk[ 4] ^
|
||||
(Te4[(temp ) & 0xff] ) ^
|
||||
(Te4[(temp >> 8) & 0xff] << 8) ^
|
||||
(Te4[(temp >> 16) & 0xff] << 16) ^
|
||||
(Te4[(temp >> 24) ] << 24);
|
||||
((u32)Te4[(temp ) & 0xff] ) ^
|
||||
((u32)Te4[(temp >> 8) & 0xff] << 8) ^
|
||||
((u32)Te4[(temp >> 16) & 0xff] << 16) ^
|
||||
((u32)Te4[(temp >> 24) ] << 24);
|
||||
rk[13] = rk[ 5] ^ rk[12];
|
||||
rk[14] = rk[ 6] ^ rk[13];
|
||||
rk[15] = rk[ 7] ^ rk[14];
|
||||
@@ -676,22 +676,22 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
#if defined(AES_COMPACT_IN_OUTER_ROUNDS)
|
||||
prefetch256(Te4);
|
||||
|
||||
t[0] = Te4[(s0 ) & 0xff] ^
|
||||
Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s3 >> 24) ] << 24;
|
||||
t[1] = Te4[(s1 ) & 0xff] ^
|
||||
Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s0 >> 24) ] << 24;
|
||||
t[2] = Te4[(s2 ) & 0xff] ^
|
||||
Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s1 >> 24) ] << 24;
|
||||
t[3] = Te4[(s3 ) & 0xff] ^
|
||||
Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s2 >> 24) ] << 24;
|
||||
t[0] = (u32)Te4[(s0 ) & 0xff] ^
|
||||
(u32)Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s3 >> 24) ] << 24;
|
||||
t[1] = (u32)Te4[(s1 ) & 0xff] ^
|
||||
(u32)Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s0 >> 24) ] << 24;
|
||||
t[2] = (u32)Te4[(s2 ) & 0xff] ^
|
||||
(u32)Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s1 >> 24) ] << 24;
|
||||
t[3] = (u32)Te4[(s3 ) & 0xff] ^
|
||||
(u32)Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s2 >> 24) ] << 24;
|
||||
|
||||
/* now do the linear transform using words */
|
||||
{ int i;
|
||||
@@ -742,22 +742,22 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
*/
|
||||
for (rk+=8,r=key->rounds-2; r>0; rk+=4,r--) {
|
||||
#if defined(AES_COMPACT_IN_INNER_ROUNDS)
|
||||
t[0] = Te4[(s0 ) & 0xff] ^
|
||||
Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s3 >> 24) ] << 24;
|
||||
t[1] = Te4[(s1 ) & 0xff] ^
|
||||
Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s0 >> 24) ] << 24;
|
||||
t[2] = Te4[(s2 ) & 0xff] ^
|
||||
Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s1 >> 24) ] << 24;
|
||||
t[3] = Te4[(s3 ) & 0xff] ^
|
||||
Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s2 >> 24) ] << 24;
|
||||
t[0] = (u32)Te4[(s0 ) & 0xff] ^
|
||||
(u32)Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s3 >> 24) ] << 24;
|
||||
t[1] = (u32)Te4[(s1 ) & 0xff] ^
|
||||
(u32)Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s0 >> 24) ] << 24;
|
||||
t[2] = (u32)Te4[(s2 ) & 0xff] ^
|
||||
(u32)Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s1 >> 24) ] << 24;
|
||||
t[3] = (u32)Te4[(s3 ) & 0xff] ^
|
||||
(u32)Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s2 >> 24) ] << 24;
|
||||
|
||||
/* now do the linear transform using words */
|
||||
{
|
||||
@@ -812,28 +812,28 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
prefetch256(Te4);
|
||||
|
||||
*(u32*)(out+0) =
|
||||
Te4[(s0 ) & 0xff] ^
|
||||
Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s3 >> 24) ] << 24 ^
|
||||
(u32)Te4[(s0 ) & 0xff] ^
|
||||
(u32)Te4[(s1 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s2 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s3 >> 24) ] << 24 ^
|
||||
rk[0];
|
||||
*(u32*)(out+4) =
|
||||
Te4[(s1 ) & 0xff] ^
|
||||
Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s0 >> 24) ] << 24 ^
|
||||
(u32)Te4[(s1 ) & 0xff] ^
|
||||
(u32)Te4[(s2 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s3 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s0 >> 24) ] << 24 ^
|
||||
rk[1];
|
||||
*(u32*)(out+8) =
|
||||
Te4[(s2 ) & 0xff] ^
|
||||
Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s1 >> 24) ] << 24 ^
|
||||
(u32)Te4[(s2 ) & 0xff] ^
|
||||
(u32)Te4[(s3 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s0 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s1 >> 24) ] << 24 ^
|
||||
rk[2];
|
||||
*(u32*)(out+12) =
|
||||
Te4[(s3 ) & 0xff] ^
|
||||
Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
Te4[(s2 >> 24) ] << 24 ^
|
||||
(u32)Te4[(s3 ) & 0xff] ^
|
||||
(u32)Te4[(s0 >> 8) & 0xff] << 8 ^
|
||||
(u32)Te4[(s1 >> 16) & 0xff] << 16 ^
|
||||
(u32)Te4[(s2 >> 24) ] << 24 ^
|
||||
rk[3];
|
||||
#else
|
||||
*(u32*)(out+0) =
|
||||
@@ -890,22 +890,22 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
#if defined(AES_COMPACT_IN_OUTER_ROUNDS)
|
||||
prefetch256(Td4);
|
||||
|
||||
t[0] = Td4[(s0 ) & 0xff] ^
|
||||
Td4[(s3 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s2 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s1 >> 24) ] << 24;
|
||||
t[1] = Td4[(s1 ) & 0xff] ^
|
||||
Td4[(s0 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s3 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s2 >> 24) ] << 24;
|
||||
t[2] = Td4[(s2 ) & 0xff] ^
|
||||
Td4[(s1 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s0 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s3 >> 24) ] << 24;
|
||||
t[3] = Td4[(s3 ) & 0xff] ^
|
||||
Td4[(s2 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s1 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s0 >> 24) ] << 24;
|
||||
t[0] = (u32)Td4[(s0 ) & 0xff] ^
|
||||
(u32)Td4[(s3 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s2 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s1 >> 24) ] << 24;
|
||||
t[1] = (u32)Td4[(s1 ) & 0xff] ^
|
||||
(u32)Td4[(s0 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s3 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s2 >> 24) ] << 24;
|
||||
t[2] = (u32)Td4[(s2 ) & 0xff] ^
|
||||
(u32)Td4[(s1 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s0 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s3 >> 24) ] << 24;
|
||||
t[3] = (u32)Td4[(s3 ) & 0xff] ^
|
||||
(u32)Td4[(s2 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s1 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s0 >> 24) ] << 24;
|
||||
|
||||
/* now do the linear transform using words */
|
||||
{
|
||||
@@ -967,22 +967,22 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
*/
|
||||
for (rk+=8,r=key->rounds-2; r>0; rk+=4,r--) {
|
||||
#if defined(AES_COMPACT_IN_INNER_ROUNDS)
|
||||
t[0] = Td4[(s0 ) & 0xff] ^
|
||||
Td4[(s3 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s2 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s1 >> 24) ] << 24;
|
||||
t[1] = Td4[(s1 ) & 0xff] ^
|
||||
Td4[(s0 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s3 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s2 >> 24) ] << 24;
|
||||
t[2] = Td4[(s2 ) & 0xff] ^
|
||||
Td4[(s1 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s0 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s3 >> 24) ] << 24;
|
||||
t[3] = Td4[(s3 ) & 0xff] ^
|
||||
Td4[(s2 >> 8) & 0xff] << 8 ^
|
||||
Td4[(s1 >> 16) & 0xff] << 16 ^
|
||||
Td4[(s0 >> 24) ] << 24;
|
||||
t[0] = (u32)Td4[(s0 ) & 0xff] ^
|
||||
(u32)Td4[(s3 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s2 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s1 >> 24) ] << 24;
|
||||
t[1] = (u32)Td4[(s1 ) & 0xff] ^
|
||||
(u32)Td4[(s0 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s3 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s2 >> 24) ] << 24;
|
||||
t[2] = (u32)Td4[(s2 ) & 0xff] ^
|
||||
(u32)Td4[(s1 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s0 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s3 >> 24) ] << 24;
|
||||
t[3] = (u32)Td4[(s3 ) & 0xff] ^
|
||||
(u32)Td4[(s2 >> 8) & 0xff] << 8 ^
|
||||
(u32)Td4[(s1 >> 16) & 0xff] << 16 ^
|
||||
(u32)Td4[(s0 >> 24) ] << 24;
|
||||
|
||||
/* now do the linear transform using words */
|
||||
{
|
||||
@@ -1046,27 +1046,27 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
prefetch256(Td4);
|
||||
|
||||
*(u32*)(out+0) =
|
||||
(Td4[(s0 ) & 0xff]) ^
|
||||
(Td4[(s3 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(s2 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(s1 >> 24) ] << 24) ^
|
||||
((u32)Td4[(s0 ) & 0xff]) ^
|
||||
((u32)Td4[(s3 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(s2 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(s1 >> 24) ] << 24) ^
|
||||
rk[0];
|
||||
*(u32*)(out+4) =
|
||||
(Td4[(s1 ) & 0xff]) ^
|
||||
(Td4[(s0 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(s3 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(s2 >> 24) ] << 24) ^
|
||||
((u32)Td4[(s1 ) & 0xff]) ^
|
||||
((u32)Td4[(s0 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(s3 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(s2 >> 24) ] << 24) ^
|
||||
rk[1];
|
||||
*(u32*)(out+8) =
|
||||
(Td4[(s2 ) & 0xff]) ^
|
||||
(Td4[(s1 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(s0 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(s3 >> 24) ] << 24) ^
|
||||
((u32)Td4[(s2 ) & 0xff]) ^
|
||||
((u32)Td4[(s1 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(s0 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(s3 >> 24) ] << 24) ^
|
||||
rk[2];
|
||||
*(u32*)(out+12) =
|
||||
(Td4[(s3 ) & 0xff]) ^
|
||||
(Td4[(s2 >> 8) & 0xff] << 8) ^
|
||||
(Td4[(s1 >> 16) & 0xff] << 16) ^
|
||||
(Td4[(s0 >> 24) ] << 24) ^
|
||||
((u32)Td4[(s3 ) & 0xff]) ^
|
||||
((u32)Td4[(s2 >> 8) & 0xff] << 8) ^
|
||||
((u32)Td4[(s1 >> 16) & 0xff] << 16) ^
|
||||
((u32)Td4[(s0 >> 24) ] << 24) ^
|
||||
rk[3];
|
||||
}
|
||||
|
@@ -119,6 +119,9 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b)
|
||||
case V_ASN1_OBJECT:
|
||||
result = OBJ_cmp(a->value.object, b->value.object);
|
||||
break;
|
||||
case V_ASN1_BOOLEAN:
|
||||
result = a->value.boolean - b->value.boolean;
|
||||
break;
|
||||
case V_ASN1_NULL:
|
||||
result = 0; /* They do not have content. */
|
||||
break;
|
||||
|
@@ -297,7 +297,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
|
||||
if (!OPENSSL_gmtime(&t, &ttm))
|
||||
return -2;
|
||||
|
||||
if (!OPENSSL_gmtime_diff(&day, &sec, &stm, &ttm))
|
||||
if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm))
|
||||
return -2;
|
||||
|
||||
if (day > 0)
|
||||
|
@@ -795,6 +795,7 @@ DECLARE_ASN1_SET_OF(ASN1_OBJECT)
|
||||
|
||||
ASN1_STRING *ASN1_STRING_new(void);
|
||||
void ASN1_STRING_free(ASN1_STRING *a);
|
||||
void ASN1_STRING_clear_free(ASN1_STRING *a);
|
||||
int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
|
||||
ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
|
||||
ASN1_STRING *ASN1_STRING_type_new(int type);
|
||||
|
@@ -279,6 +279,9 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
|
||||
|
||||
int tmp_tag, tmp_class;
|
||||
|
||||
if (elem == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0, p = elem; i < len; p++, i++) {
|
||||
/* Look for the ':' in name value pairs */
|
||||
if (*p == ':') {
|
||||
@@ -350,13 +353,17 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_FORMAT:
|
||||
if(!vstart) {
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_FORMAT);
|
||||
return -1;
|
||||
}
|
||||
if (!strncmp(vstart, "ASCII", 5))
|
||||
arg->format = ASN1_GEN_FORMAT_ASCII;
|
||||
else if (!strncmp(vstart, "UTF8", 4))
|
||||
arg->format = ASN1_GEN_FORMAT_UTF8;
|
||||
else if (!strncmp(vstart, "HEX", 3))
|
||||
arg->format = ASN1_GEN_FORMAT_HEX;
|
||||
else if (!strncmp(vstart, "BITLIST", 3))
|
||||
else if (!strncmp(vstart, "BITLIST", 7))
|
||||
arg->format = ASN1_GEN_FORMAT_BITLIST;
|
||||
else {
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKOWN_FORMAT);
|
||||
|
@@ -430,6 +430,13 @@ void ASN1_STRING_free(ASN1_STRING *a)
|
||||
OPENSSL_free(a);
|
||||
}
|
||||
|
||||
void ASN1_STRING_clear_free(ASN1_STRING *a)
|
||||
{
|
||||
if (a && a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
|
||||
OPENSSL_cleanse(a->data, a->length);
|
||||
ASN1_STRING_free(a);
|
||||
}
|
||||
|
||||
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
|
||||
{
|
||||
int i;
|
||||
|
@@ -337,7 +337,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
if (BIO_write(bp, "BAD ENUMERATED", 11) <= 0)
|
||||
if (BIO_write(bp, "BAD ENUMERATED", 14) <= 0)
|
||||
goto end;
|
||||
}
|
||||
M_ASN1_ENUMERATED_free(bs);
|
||||
|
@@ -162,6 +162,9 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if(!p)
|
||||
return 0;
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
*pbuf = p;
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
|
||||
@@ -229,6 +232,9 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if(!p)
|
||||
return 0;
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
*pbuf = p;
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
|
||||
|
@@ -69,7 +69,8 @@ static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
/* Since the structure must still be valid use ASN1_OP_FREE_PRE */
|
||||
if (operation == ASN1_OP_FREE_PRE) {
|
||||
PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval;
|
||||
if (key->pkey->value.octet_string)
|
||||
if (key->pkey && key->pkey->type == V_ASN1_OCTET_STRING
|
||||
&& key->pkey->value.octet_string != NULL)
|
||||
OPENSSL_cleanse(key->pkey->value.octet_string->data,
|
||||
key->pkey->value.octet_string->length);
|
||||
}
|
||||
|
@@ -304,9 +304,16 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
case ASN1_ITYPE_CHOICE:
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
|
||||
goto auxerr;
|
||||
|
||||
/* Allocate structure */
|
||||
if (!*pval && !ASN1_item_ex_new(pval, it)) {
|
||||
if (*pval) {
|
||||
/* Free up and zero CHOICE value if initialised */
|
||||
i = asn1_get_choice_selector(pval, it);
|
||||
if ((i >= 0) && (i < it->tcount)) {
|
||||
tt = it->templates + i;
|
||||
pchptr = asn1_get_field_ptr(pval, tt);
|
||||
ASN1_template_free(pchptr, tt);
|
||||
asn1_set_choice_selector(pval, -1, it);
|
||||
}
|
||||
} else if (!ASN1_item_ex_new(pval, it)) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
@@ -386,6 +393,17 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
|
||||
goto auxerr;
|
||||
|
||||
/* Free up and zero any ADB found */
|
||||
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
|
||||
if (tt->flags & ASN1_TFLG_ADB_MASK) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
ASN1_VALUE **pseqval;
|
||||
seqtt = asn1_do_adb(pval, tt, 1);
|
||||
pseqval = asn1_get_field_ptr(pval, seqtt);
|
||||
ASN1_template_free(pseqval, seqtt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get each field entry */
|
||||
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
|
@@ -315,13 +315,16 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
ASN1_STRING *str;
|
||||
int utype;
|
||||
|
||||
if (it && it->funcs) {
|
||||
if (!it)
|
||||
return 0;
|
||||
|
||||
if (it->funcs) {
|
||||
const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
|
||||
if (pf->prim_new)
|
||||
return pf->prim_new(pval, it);
|
||||
}
|
||||
|
||||
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
|
||||
if (it->itype == ASN1_ITYPE_MSTRING)
|
||||
utype = -1;
|
||||
else
|
||||
utype = it->utype;
|
||||
|
@@ -220,6 +220,7 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
if (!asn1_template_print_ctx(out, fld, indent,
|
||||
it->templates, pctx))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
/* fall thru */
|
||||
case ASN1_ITYPE_MSTRING:
|
||||
@@ -289,6 +290,8 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
seqtt = asn1_do_adb(fld, tt, 1);
|
||||
if(!seqtt)
|
||||
return 0;
|
||||
tmpfld = asn1_get_field_ptr(fld, seqtt);
|
||||
if (!asn1_template_print_ctx(out, tmpfld,
|
||||
indent + 2, seqtt, pctx))
|
||||
|
@@ -98,46 +98,55 @@ ASN1_ITEM_end(CBIGNUM)
|
||||
|
||||
static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
*pval = (ASN1_VALUE *)BN_new();
|
||||
if(*pval) return 1;
|
||||
else return 0;
|
||||
*pval = (ASN1_VALUE *)BN_new();
|
||||
if (*pval)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
if(!*pval) return;
|
||||
if(it->size & BN_SENSITIVE) BN_clear_free((BIGNUM *)*pval);
|
||||
else BN_free((BIGNUM *)*pval);
|
||||
*pval = NULL;
|
||||
if (!*pval)
|
||||
return;
|
||||
if (it->size & BN_SENSITIVE)
|
||||
BN_clear_free((BIGNUM *)*pval);
|
||||
else
|
||||
BN_free((BIGNUM *)*pval);
|
||||
*pval = NULL;
|
||||
}
|
||||
|
||||
static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)
|
||||
static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
|
||||
const ASN1_ITEM *it)
|
||||
{
|
||||
BIGNUM *bn;
|
||||
int pad;
|
||||
if(!*pval) return -1;
|
||||
bn = (BIGNUM *)*pval;
|
||||
/* If MSB set in an octet we need a padding byte */
|
||||
if(BN_num_bits(bn) & 0x7) pad = 0;
|
||||
else pad = 1;
|
||||
if(cont) {
|
||||
if(pad) *cont++ = 0;
|
||||
BN_bn2bin(bn, cont);
|
||||
}
|
||||
return pad + BN_num_bytes(bn);
|
||||
BIGNUM *bn;
|
||||
int pad;
|
||||
if (!*pval)
|
||||
return -1;
|
||||
bn = (BIGNUM *)*pval;
|
||||
/* If MSB set in an octet we need a padding byte */
|
||||
if (BN_num_bits(bn) & 0x7)
|
||||
pad = 0;
|
||||
else
|
||||
pad = 1;
|
||||
if (cont) {
|
||||
if (pad)
|
||||
*cont++ = 0;
|
||||
BN_bn2bin(bn, cont);
|
||||
}
|
||||
return pad + BN_num_bytes(bn);
|
||||
}
|
||||
|
||||
static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it)
|
||||
{
|
||||
BIGNUM *bn;
|
||||
if(!*pval) bn_new(pval, it);
|
||||
bn = (BIGNUM *)*pval;
|
||||
if(!BN_bin2bn(cont, len, bn)) {
|
||||
bn_free(pval, it);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
BIGNUM *bn;
|
||||
if (!*pval)
|
||||
bn_new(pval, it);
|
||||
bn = (BIGNUM *)*pval;
|
||||
if (!BN_bin2bn(cont, len, bn)) {
|
||||
bn_free(pval, it);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -97,87 +97,100 @@ ASN1_ITEM_end(ZLONG)
|
||||
|
||||
static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
*(long *)pval = it->size;
|
||||
return 1;
|
||||
*(long *)pval = it->size;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
*(long *)pval = it->size;
|
||||
*(long *)pval = it->size;
|
||||
}
|
||||
|
||||
static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)
|
||||
static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
|
||||
const ASN1_ITEM *it)
|
||||
{
|
||||
long ltmp;
|
||||
unsigned long utmp;
|
||||
int clen, pad, i;
|
||||
/* this exists to bypass broken gcc optimization */
|
||||
char *cp = (char *)pval;
|
||||
long ltmp;
|
||||
unsigned long utmp;
|
||||
int clen, pad, i;
|
||||
/* this exists to bypass broken gcc optimization */
|
||||
char *cp = (char *)pval;
|
||||
|
||||
/* use memcpy, because we may not be long aligned */
|
||||
memcpy(<mp, cp, sizeof(long));
|
||||
/* use memcpy, because we may not be long aligned */
|
||||
memcpy(<mp, cp, sizeof(long));
|
||||
|
||||
if(ltmp == it->size) return -1;
|
||||
/* Convert the long to positive: we subtract one if negative so
|
||||
* we can cleanly handle the padding if only the MSB of the leading
|
||||
* octet is set.
|
||||
*/
|
||||
if(ltmp < 0) utmp = -ltmp - 1;
|
||||
else utmp = ltmp;
|
||||
clen = BN_num_bits_word(utmp);
|
||||
/* If MSB of leading octet set we need to pad */
|
||||
if(!(clen & 0x7)) pad = 1;
|
||||
else pad = 0;
|
||||
if (ltmp == it->size)
|
||||
return -1;
|
||||
/*
|
||||
* Convert the long to positive: we subtract one if negative so we can
|
||||
* cleanly handle the padding if only the MSB of the leading octet is
|
||||
* set.
|
||||
*/
|
||||
if (ltmp < 0)
|
||||
utmp = -ltmp - 1;
|
||||
else
|
||||
utmp = ltmp;
|
||||
clen = BN_num_bits_word(utmp);
|
||||
/* If MSB of leading octet set we need to pad */
|
||||
if (!(clen & 0x7))
|
||||
pad = 1;
|
||||
else
|
||||
pad = 0;
|
||||
|
||||
/* Convert number of bits to number of octets */
|
||||
clen = (clen + 7) >> 3;
|
||||
/* Convert number of bits to number of octets */
|
||||
clen = (clen + 7) >> 3;
|
||||
|
||||
if(cont) {
|
||||
if(pad) *cont++ = (ltmp < 0) ? 0xff : 0;
|
||||
for(i = clen - 1; i >= 0; i--) {
|
||||
cont[i] = (unsigned char)(utmp & 0xff);
|
||||
if(ltmp < 0) cont[i] ^= 0xff;
|
||||
utmp >>= 8;
|
||||
}
|
||||
if (cont) {
|
||||
if (pad)
|
||||
*cont++ = (ltmp < 0) ? 0xff : 0;
|
||||
for (i = clen - 1; i >= 0; i--) {
|
||||
cont[i] = (unsigned char)(utmp & 0xff);
|
||||
if (ltmp < 0)
|
||||
cont[i] ^= 0xff;
|
||||
utmp >>= 8;
|
||||
}
|
||||
return clen + pad;
|
||||
}
|
||||
return clen + pad;
|
||||
}
|
||||
|
||||
static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it)
|
||||
{
|
||||
int neg, i;
|
||||
long ltmp;
|
||||
unsigned long utmp = 0;
|
||||
char *cp = (char *)pval;
|
||||
if(len > (int)sizeof(long)) {
|
||||
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
||||
return 0;
|
||||
}
|
||||
/* Is it negative? */
|
||||
if(len && (cont[0] & 0x80)) neg = 1;
|
||||
else neg = 0;
|
||||
utmp = 0;
|
||||
for(i = 0; i < len; i++) {
|
||||
utmp <<= 8;
|
||||
if(neg) utmp |= cont[i] ^ 0xff;
|
||||
else utmp |= cont[i];
|
||||
}
|
||||
ltmp = (long)utmp;
|
||||
if(neg) {
|
||||
ltmp++;
|
||||
ltmp = -ltmp;
|
||||
}
|
||||
if(ltmp == it->size) {
|
||||
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
||||
return 0;
|
||||
}
|
||||
memcpy(cp, <mp, sizeof(long));
|
||||
return 1;
|
||||
int neg, i;
|
||||
long ltmp;
|
||||
unsigned long utmp = 0;
|
||||
char *cp = (char *)pval;
|
||||
if (len > (int)sizeof(long)) {
|
||||
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
||||
return 0;
|
||||
}
|
||||
/* Is it negative? */
|
||||
if (len && (cont[0] & 0x80))
|
||||
neg = 1;
|
||||
else
|
||||
neg = 0;
|
||||
utmp = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
utmp <<= 8;
|
||||
if (neg)
|
||||
utmp |= cont[i] ^ 0xff;
|
||||
else
|
||||
utmp |= cont[i];
|
||||
}
|
||||
ltmp = (long)utmp;
|
||||
if (neg) {
|
||||
ltmp++;
|
||||
ltmp = -ltmp;
|
||||
}
|
||||
if (ltmp == it->size) {
|
||||
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
||||
return 0;
|
||||
}
|
||||
memcpy(cp, <mp, sizeof(long));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
int indent, const ASN1_PCTX *pctx)
|
||||
{
|
||||
return BIO_printf(out, "%ld\n", *(long *)pval);
|
||||
}
|
||||
int indent, const ASN1_PCTX *pctx)
|
||||
{
|
||||
return BIO_printf(out, "%ld\n", *(long *)pval);
|
||||
}
|
||||
|
@@ -172,8 +172,14 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
{
|
||||
const unsigned char *q;
|
||||
X509 *ret;
|
||||
int freeret = 0;
|
||||
|
||||
/* Save start position */
|
||||
q = *pp;
|
||||
|
||||
if(!a || *a == NULL) {
|
||||
freeret = 1;
|
||||
}
|
||||
ret = d2i_X509(a, pp, length);
|
||||
/* If certificate unreadable then forget it */
|
||||
if (!ret)
|
||||
@@ -186,7 +192,11 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
goto err;
|
||||
return ret;
|
||||
err:
|
||||
X509_free(ret);
|
||||
if(freeret) {
|
||||
X509_free(ret);
|
||||
if (a)
|
||||
*a = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -592,7 +592,6 @@ fmtfp(char **sbuffer,
|
||||
int fplace = 0;
|
||||
int padlen = 0;
|
||||
int zpadlen = 0;
|
||||
int caps = 0;
|
||||
long intpart;
|
||||
long fracpart;
|
||||
long max10;
|
||||
@@ -630,8 +629,7 @@ fmtfp(char **sbuffer,
|
||||
|
||||
/* convert integer part */
|
||||
do {
|
||||
iconvert[iplace++] =
|
||||
(caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
|
||||
iconvert[iplace++] = "0123456789"[intpart % 10];
|
||||
intpart = (intpart / 10);
|
||||
} while (intpart && (iplace < (int)sizeof(iconvert)));
|
||||
if (iplace == sizeof iconvert)
|
||||
@@ -640,8 +638,7 @@ fmtfp(char **sbuffer,
|
||||
|
||||
/* convert fractional part */
|
||||
do {
|
||||
fconvert[fplace++] =
|
||||
(caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10];
|
||||
fconvert[fplace++] = "0123456789"[fracpart % 10];
|
||||
fracpart = (fracpart / 10);
|
||||
} while (fplace < max);
|
||||
if (fplace == sizeof fconvert)
|
||||
@@ -713,6 +710,10 @@ doapr_outch(char **sbuffer,
|
||||
if (*maxlen == 0)
|
||||
*maxlen = 1024;
|
||||
*buffer = OPENSSL_malloc(*maxlen);
|
||||
if(!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
if (*currlen > 0) {
|
||||
assert(*sbuffer != NULL);
|
||||
memcpy(*buffer, *sbuffer, *currlen);
|
||||
@@ -721,6 +722,10 @@ doapr_outch(char **sbuffer,
|
||||
} else {
|
||||
*maxlen += 1024;
|
||||
*buffer = OPENSSL_realloc(*buffer, *maxlen);
|
||||
if(!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* What to do if *buffer is NULL? */
|
||||
|
@@ -833,6 +833,7 @@ void ERR_load_BIO_strings(void);
|
||||
# define BIO_F_CONN_CTRL 127
|
||||
# define BIO_F_CONN_STATE 115
|
||||
# define BIO_F_DGRAM_SCTP_READ 132
|
||||
# define BIO_F_DGRAM_SCTP_WRITE 133
|
||||
# define BIO_F_FILE_CTRL 116
|
||||
# define BIO_F_FILE_READ 130
|
||||
# define BIO_F_LINEBUFFER_CTRL 129
|
||||
|
@@ -70,14 +70,17 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
|
||||
MS_STATIC char buf[256];
|
||||
char *p;
|
||||
long r = 1;
|
||||
int len;
|
||||
size_t p_maxlen;
|
||||
|
||||
if (BIO_CB_RETURN & cmd)
|
||||
r = ret;
|
||||
|
||||
BIO_snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio);
|
||||
p = &(buf[14]);
|
||||
p_maxlen = sizeof buf - 14;
|
||||
len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio);
|
||||
|
||||
p = buf + len;
|
||||
p_maxlen = sizeof(buf) - len;
|
||||
|
||||
switch (cmd) {
|
||||
case BIO_CB_FREE:
|
||||
BIO_snprintf(p, p_maxlen, "Free - %s\n", bio->method->name);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* crypto/bio/bio_err.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1999-2015 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
|
||||
@@ -96,6 +96,7 @@ static ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_FUNC(BIO_F_CONN_CTRL), "CONN_CTRL"},
|
||||
{ERR_FUNC(BIO_F_CONN_STATE), "CONN_STATE"},
|
||||
{ERR_FUNC(BIO_F_DGRAM_SCTP_READ), "DGRAM_SCTP_READ"},
|
||||
{ERR_FUNC(BIO_F_DGRAM_SCTP_WRITE), "DGRAM_SCTP_WRITE"},
|
||||
{ERR_FUNC(BIO_F_FILE_CTRL), "FILE_CTRL"},
|
||||
{ERR_FUNC(BIO_F_FILE_READ), "FILE_READ"},
|
||||
{ERR_FUNC(BIO_F_LINEBUFFER_CTRL), "LINEBUFFER_CTRL"},
|
||||
|
@@ -1012,6 +1012,10 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
|
||||
*/
|
||||
sockopt_len = (socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
|
||||
authchunks = OPENSSL_malloc(sockopt_len);
|
||||
if(!authchunks) {
|
||||
BIO_vfree(bio);
|
||||
return (NULL);
|
||||
}
|
||||
memset(authchunks, 0, sizeof(sockopt_len));
|
||||
ret =
|
||||
getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks,
|
||||
@@ -1347,6 +1351,10 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
|
||||
optlen =
|
||||
(socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
|
||||
authchunks = OPENSSL_malloc(optlen);
|
||||
if (!authchunks) {
|
||||
BIOerr(BIO_F_DGRAM_SCTP_READ, ERR_R_MALLOC_ERROR);
|
||||
return -1;
|
||||
}
|
||||
memset(authchunks, 0, sizeof(optlen));
|
||||
ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS,
|
||||
authchunks, &optlen);
|
||||
@@ -1413,10 +1421,15 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||
* yet, we have to save it and send it as soon as the socket gets dry.
|
||||
*/
|
||||
if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
|
||||
char *tmp;
|
||||
data->saved_message.bio = b;
|
||||
if(!(tmp = OPENSSL_malloc(inl))) {
|
||||
BIOerr(BIO_F_DGRAM_SCTP_WRITE, ERR_R_MALLOC_ERROR);
|
||||
return -1;
|
||||
}
|
||||
if (data->saved_message.data)
|
||||
OPENSSL_free(data->saved_message.data);
|
||||
data->saved_message.data = OPENSSL_malloc(inl);
|
||||
data->saved_message.data = tmp;
|
||||
memcpy(data->saved_message.data, in, inl);
|
||||
data->saved_message.length = inl;
|
||||
return inl;
|
||||
|
@@ -108,8 +108,6 @@ x86_64-mont5.s: asm/x86_64-mont5.pl
|
||||
$(PERL) asm/x86_64-mont5.pl $(PERLASM_SCHEME) > $@
|
||||
x86_64-gf2m.s: asm/x86_64-gf2m.pl
|
||||
$(PERL) asm/x86_64-gf2m.pl $(PERLASM_SCHEME) > $@
|
||||
modexp512-x86_64.s: asm/modexp512-x86_64.pl
|
||||
$(PERL) asm/modexp512-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
rsaz-x86_64.s: asm/rsaz-x86_64.pl
|
||||
$(PERL) asm/rsaz-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
rsaz-avx2.s: asm/rsaz-avx2.pl
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -185,10 +185,10 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
err:
|
||||
if (r != rr)
|
||||
BN_copy(r, rr);
|
||||
ret = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
bn_check_top(r);
|
||||
return (ret);
|
||||
|
@@ -48,7 +48,7 @@ cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl
|
||||
$(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
|
||||
cmll-x86_64.s: asm/cmll-x86_64.pl
|
||||
$(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@
|
||||
cmllt4-sparcv9.s: asm/cmllt4-sparcv9.pl
|
||||
cmllt4-sparcv9.s: asm/cmllt4-sparcv9.pl ../perlasm/sparcv9_modes.pl
|
||||
$(PERL) asm/cmllt4-sparcv9.pl $(CFLAGS) > $@
|
||||
|
||||
files:
|
||||
|
@@ -231,6 +231,8 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
|
||||
return 0;
|
||||
}
|
||||
tmp = OPENSSL_malloc(inlen);
|
||||
if(!tmp)
|
||||
return 0;
|
||||
/* setup IV by decrypting last two blocks */
|
||||
EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
|
||||
in + inlen - 2 * blocklen, blocklen * 2);
|
||||
|
@@ -585,7 +585,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
|
||||
CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_HAS_NO_VALUE);
|
||||
goto err;
|
||||
}
|
||||
BUF_MEM_grow_clean(buf, (strlen(p) + buf->length - (e - from)));
|
||||
if (!BUF_MEM_grow_clean(buf,
|
||||
(strlen(p) + buf->length - (e - from)))) {
|
||||
CONFerr(CONF_F_STR_COPY, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
while (*p)
|
||||
buf->data[to++] = *(p++);
|
||||
|
||||
|
@@ -86,23 +86,10 @@ void OPENSSL_config(const char *config_name)
|
||||
/* Need to load ENGINEs */
|
||||
ENGINE_load_builtin_engines();
|
||||
#endif
|
||||
/* Add others here? */
|
||||
|
||||
ERR_clear_error();
|
||||
if (CONF_modules_load_file(NULL, config_name,
|
||||
CONF_modules_load_file(NULL, config_name,
|
||||
CONF_MFLAGS_DEFAULT_SECTION |
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
|
||||
BIO *bio_err;
|
||||
ERR_load_crypto_strings();
|
||||
if ((bio_err = BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) {
|
||||
BIO_printf(bio_err, "Auto configuration failed\n");
|
||||
ERR_print_errors(bio_err);
|
||||
BIO_free(bio_err);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return;
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE);
|
||||
}
|
||||
|
||||
void OPENSSL_no_config()
|
||||
|
327
crypto/des/spr.h
327
crypto/des/spr.h
@@ -58,180 +58,155 @@
|
||||
|
||||
OPENSSL_GLOBAL const DES_LONG DES_SPtrans[8][64] = {
|
||||
{
|
||||
/* nibble 0 */
|
||||
0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L,
|
||||
0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L,
|
||||
0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L,
|
||||
0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L,
|
||||
0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L,
|
||||
0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L,
|
||||
0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L,
|
||||
0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L,
|
||||
0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L,
|
||||
0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L,
|
||||
0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L,
|
||||
0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L,
|
||||
0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L,
|
||||
0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L,
|
||||
0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L,
|
||||
0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L,
|
||||
}, {
|
||||
/* nibble 1 */
|
||||
0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L,
|
||||
0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L,
|
||||
0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L,
|
||||
0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L,
|
||||
0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L,
|
||||
0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L,
|
||||
0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L,
|
||||
0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L,
|
||||
0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L,
|
||||
0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L,
|
||||
0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L,
|
||||
0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L,
|
||||
0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L,
|
||||
0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L,
|
||||
0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L,
|
||||
0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L,
|
||||
}, {
|
||||
/* nibble 2 */
|
||||
0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L,
|
||||
0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L,
|
||||
0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L,
|
||||
0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L,
|
||||
0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L,
|
||||
0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L,
|
||||
0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L,
|
||||
0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L,
|
||||
0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L,
|
||||
0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L,
|
||||
0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L,
|
||||
0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L,
|
||||
0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L,
|
||||
0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L,
|
||||
}, {
|
||||
/* nibble 3 */
|
||||
0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L,
|
||||
0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L,
|
||||
0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L,
|
||||
0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L,
|
||||
0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L,
|
||||
0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L,
|
||||
0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L,
|
||||
0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L,
|
||||
0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L,
|
||||
0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L,
|
||||
0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L,
|
||||
0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L,
|
||||
0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L,
|
||||
0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L,
|
||||
0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L,
|
||||
0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L,
|
||||
}, {
|
||||
/* nibble 4 */
|
||||
0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L,
|
||||
0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L,
|
||||
0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L,
|
||||
0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L,
|
||||
0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L,
|
||||
0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L,
|
||||
0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L,
|
||||
0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L,
|
||||
0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L,
|
||||
0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L,
|
||||
0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L,
|
||||
0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L,
|
||||
0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L,
|
||||
0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L,
|
||||
}, {
|
||||
/* nibble 5 */
|
||||
0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L,
|
||||
0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L,
|
||||
0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L,
|
||||
0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L,
|
||||
0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L,
|
||||
0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L,
|
||||
0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L,
|
||||
0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L,
|
||||
0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L,
|
||||
0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L,
|
||||
0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L,
|
||||
0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L,
|
||||
0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L,
|
||||
0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L,
|
||||
0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L,
|
||||
0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L,
|
||||
}, {
|
||||
/* nibble 6 */
|
||||
0x00004000L, 0x00000200L, 0x01000200L,
|
||||
0x01000004L,
|
||||
0x01004204L, 0x00004004L, 0x00004200L,
|
||||
0x00000000L,
|
||||
0x01000000L, 0x01000204L, 0x00000204L,
|
||||
0x01004000L,
|
||||
0x00000004L, 0x01004200L, 0x01004000L,
|
||||
0x00000204L,
|
||||
0x01000204L, 0x00004000L, 0x00004004L,
|
||||
0x01004204L,
|
||||
0x00000000L, 0x01000200L, 0x01000004L,
|
||||
0x00004200L,
|
||||
0x01004004L, 0x00004204L, 0x01004200L,
|
||||
0x00000004L,
|
||||
0x00004204L, 0x01004004L, 0x00000200L,
|
||||
0x01000000L,
|
||||
0x00004204L, 0x01004000L, 0x01004004L,
|
||||
0x00000204L,
|
||||
0x00004000L, 0x00000200L, 0x01000000L,
|
||||
0x01004004L,
|
||||
0x01000204L, 0x00004204L, 0x00004200L,
|
||||
0x00000000L,
|
||||
0x00000200L, 0x01000004L, 0x00000004L,
|
||||
0x01000200L,
|
||||
0x00000000L, 0x01000204L, 0x01000200L,
|
||||
0x00004200L,
|
||||
0x00000204L, 0x00004000L, 0x01004204L,
|
||||
0x01000000L,
|
||||
0x01004200L, 0x00000004L, 0x00004004L,
|
||||
0x01004204L,
|
||||
0x01000004L, 0x01004200L, 0x01004000L,
|
||||
0x00004004L,
|
||||
}, {
|
||||
/* nibble 7 */
|
||||
0x20800080L, 0x20820000L, 0x00020080L,
|
||||
0x00000000L,
|
||||
0x20020000L, 0x00800080L, 0x20800000L,
|
||||
0x20820080L,
|
||||
0x00000080L, 0x20000000L, 0x00820000L,
|
||||
0x00020080L,
|
||||
0x00820080L, 0x20020080L, 0x20000080L,
|
||||
0x20800000L,
|
||||
0x00020000L, 0x00820080L, 0x00800080L,
|
||||
0x20020000L,
|
||||
0x20820080L, 0x20000080L, 0x00000000L,
|
||||
0x00820000L,
|
||||
0x20000000L, 0x00800000L, 0x20020080L,
|
||||
0x20800080L,
|
||||
0x00800000L, 0x00020000L, 0x20820000L,
|
||||
0x00000080L,
|
||||
0x00800000L, 0x00020000L, 0x20000080L,
|
||||
0x20820080L,
|
||||
0x00020080L, 0x20000000L, 0x00000000L,
|
||||
0x00820000L,
|
||||
0x20800080L, 0x20020080L, 0x20020000L,
|
||||
0x00800080L,
|
||||
0x20820000L, 0x00000080L, 0x00800080L,
|
||||
0x20020000L,
|
||||
0x20820080L, 0x00800000L, 0x20800000L,
|
||||
0x20000080L,
|
||||
0x00820000L, 0x00020080L, 0x20020080L,
|
||||
0x20800000L,
|
||||
0x00000080L, 0x20820000L, 0x00820080L,
|
||||
0x00000000L,
|
||||
0x20000000L, 0x20800080L, 0x00020000L,
|
||||
0x00820080L,
|
||||
}
|
||||
/* nibble 0 */
|
||||
0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L,
|
||||
0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L,
|
||||
0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L,
|
||||
0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L,
|
||||
0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L,
|
||||
0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L,
|
||||
0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L,
|
||||
0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L,
|
||||
0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L,
|
||||
0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L,
|
||||
0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L,
|
||||
0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L,
|
||||
0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L,
|
||||
0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L,
|
||||
0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L,
|
||||
0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L,
|
||||
},
|
||||
{
|
||||
/* nibble 1 */
|
||||
0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L,
|
||||
0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L,
|
||||
0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L,
|
||||
0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L,
|
||||
0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L,
|
||||
0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L,
|
||||
0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L,
|
||||
0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L,
|
||||
0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L,
|
||||
0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L,
|
||||
0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L,
|
||||
0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L,
|
||||
0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L,
|
||||
0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L,
|
||||
0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L,
|
||||
0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L,
|
||||
},
|
||||
{
|
||||
/* nibble 2 */
|
||||
0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L,
|
||||
0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L,
|
||||
0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L,
|
||||
0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L,
|
||||
0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L,
|
||||
0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L,
|
||||
0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L,
|
||||
0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L,
|
||||
0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L,
|
||||
0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L,
|
||||
0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L,
|
||||
0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L,
|
||||
0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L,
|
||||
0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L,
|
||||
0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L,
|
||||
},
|
||||
{
|
||||
/* nibble 3 */
|
||||
0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L,
|
||||
0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L,
|
||||
0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L,
|
||||
0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L,
|
||||
0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L,
|
||||
0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L,
|
||||
0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L,
|
||||
0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L,
|
||||
0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L,
|
||||
0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L,
|
||||
0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L,
|
||||
0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L,
|
||||
0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L,
|
||||
0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L,
|
||||
0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L,
|
||||
0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L,
|
||||
},
|
||||
{
|
||||
/* nibble 4 */
|
||||
0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L,
|
||||
0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L,
|
||||
0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L,
|
||||
0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L,
|
||||
0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L,
|
||||
0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L,
|
||||
0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L,
|
||||
0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L,
|
||||
0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L,
|
||||
0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L,
|
||||
0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L,
|
||||
0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L,
|
||||
0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L,
|
||||
0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L,
|
||||
0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L,
|
||||
},
|
||||
{
|
||||
/* nibble 5 */
|
||||
0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L,
|
||||
0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L,
|
||||
0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L,
|
||||
0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L,
|
||||
0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L,
|
||||
0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L,
|
||||
0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L,
|
||||
0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L,
|
||||
0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L,
|
||||
0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L,
|
||||
0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L,
|
||||
0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L,
|
||||
0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L,
|
||||
0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L,
|
||||
0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L,
|
||||
0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L,
|
||||
},
|
||||
{
|
||||
/* nibble 6 */
|
||||
0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L,
|
||||
0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L,
|
||||
0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L,
|
||||
0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L,
|
||||
0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L,
|
||||
0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L,
|
||||
0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L,
|
||||
0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L,
|
||||
0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L,
|
||||
0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L,
|
||||
0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L,
|
||||
0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L,
|
||||
0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L,
|
||||
0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L,
|
||||
0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L,
|
||||
0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L,
|
||||
},
|
||||
{
|
||||
/* nibble 7 */
|
||||
0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L,
|
||||
0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L,
|
||||
0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L,
|
||||
0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L,
|
||||
0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L,
|
||||
0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L,
|
||||
0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L,
|
||||
0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L,
|
||||
0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L,
|
||||
0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L,
|
||||
0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L,
|
||||
0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L,
|
||||
0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L,
|
||||
0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L,
|
||||
0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L,
|
||||
0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L,
|
||||
}
|
||||
};
|
||||
|
@@ -151,7 +151,6 @@ static int dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
|
||||
static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
{
|
||||
DH *dh;
|
||||
void *pval = NULL;
|
||||
int ptype;
|
||||
unsigned char *penc = NULL;
|
||||
int penclen;
|
||||
@@ -161,12 +160,15 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
dh = pkey->pkey.dh;
|
||||
|
||||
str = ASN1_STRING_new();
|
||||
if(!str) {
|
||||
DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
str->length = i2d_dhp(pkey, dh, &str->data);
|
||||
if (str->length <= 0) {
|
||||
DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
pval = str;
|
||||
ptype = V_ASN1_SEQUENCE;
|
||||
|
||||
pub_key = BN_to_ASN1_INTEGER(dh->pub_key, NULL);
|
||||
@@ -183,14 +185,14 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
}
|
||||
|
||||
if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
|
||||
ptype, pval, penc, penclen))
|
||||
ptype, str, penc, penclen))
|
||||
return 1;
|
||||
|
||||
err:
|
||||
if (penc)
|
||||
OPENSSL_free(penc);
|
||||
if (pval)
|
||||
ASN1_STRING_free(pval);
|
||||
if (str)
|
||||
ASN1_STRING_free(str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -240,7 +242,7 @@ static int dh_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
|
||||
|
||||
EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
|
||||
|
||||
ASN1_INTEGER_free(privkey);
|
||||
ASN1_STRING_clear_free(privkey);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -248,6 +250,7 @@ static int dh_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
|
||||
DHerr(DH_F_DH_PRIV_DECODE, EVP_R_DECODE_ERROR);
|
||||
dherr:
|
||||
DH_free(dh);
|
||||
ASN1_STRING_clear_free(privkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -282,7 +285,8 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
|
||||
|
||||
dplen = i2d_ASN1_INTEGER(prkey, &dp);
|
||||
|
||||
ASN1_INTEGER_free(prkey);
|
||||
ASN1_STRING_clear_free(prkey);
|
||||
prkey = NULL;
|
||||
|
||||
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
|
||||
V_ASN1_SEQUENCE, params, dp, dplen))
|
||||
@@ -296,7 +300,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
|
||||
if (params != NULL)
|
||||
ASN1_STRING_free(params);
|
||||
if (prkey != NULL)
|
||||
ASN1_INTEGER_free(prkey);
|
||||
ASN1_STRING_clear_free(prkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -462,6 +462,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
|
||||
ret = 0;
|
||||
Zlen = DH_size(dh);
|
||||
Z = OPENSSL_malloc(Zlen);
|
||||
if(!Z) {
|
||||
goto err;
|
||||
}
|
||||
if (DH_compute_key_padded(Z, dhpub, dh) <= 0)
|
||||
goto err;
|
||||
if (!DH_KDF_X9_42(key, *keylen, Z, Zlen, dctx->kdf_oid,
|
||||
|
@@ -129,21 +129,23 @@ static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
|
||||
static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
{
|
||||
DSA *dsa;
|
||||
void *pval = NULL;
|
||||
int ptype;
|
||||
unsigned char *penc = NULL;
|
||||
int penclen;
|
||||
ASN1_STRING *str = NULL;
|
||||
|
||||
dsa = pkey->pkey.dsa;
|
||||
if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) {
|
||||
ASN1_STRING *str;
|
||||
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;
|
||||
}
|
||||
pval = str;
|
||||
ptype = V_ASN1_SEQUENCE;
|
||||
} else
|
||||
ptype = V_ASN1_UNDEF;
|
||||
@@ -158,14 +160,14 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
}
|
||||
|
||||
if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA),
|
||||
ptype, pval, penc, penclen))
|
||||
ptype, str, penc, penclen))
|
||||
return 1;
|
||||
|
||||
err:
|
||||
if (penc)
|
||||
OPENSSL_free(penc);
|
||||
if (pval)
|
||||
ASN1_STRING_free(pval);
|
||||
if (str)
|
||||
ASN1_STRING_free(str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -226,7 +228,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
|
||||
goto decerr;
|
||||
if (privkey->type == V_ASN1_NEG_INTEGER) {
|
||||
p8->broken = PKCS8_NEG_PRIVKEY;
|
||||
ASN1_INTEGER_free(privkey);
|
||||
ASN1_STRING_clear_free(privkey);
|
||||
if (!(privkey = d2i_ASN1_UINTEGER(NULL, &q, pklen)))
|
||||
goto decerr;
|
||||
}
|
||||
@@ -264,7 +266,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
|
||||
if (ndsa)
|
||||
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
|
||||
else
|
||||
ASN1_INTEGER_free(privkey);
|
||||
ASN1_STRING_clear_free(privkey);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -273,7 +275,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
|
||||
dsaerr:
|
||||
BN_CTX_free(ctx);
|
||||
if (privkey)
|
||||
ASN1_INTEGER_free(privkey);
|
||||
ASN1_STRING_clear_free(privkey);
|
||||
sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
|
||||
DSA_free(dsa);
|
||||
return 0;
|
||||
@@ -315,7 +317,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
|
||||
|
||||
dplen = i2d_ASN1_INTEGER(prkey, &dp);
|
||||
|
||||
ASN1_INTEGER_free(prkey);
|
||||
ASN1_STRING_clear_free(prkey);
|
||||
|
||||
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0,
|
||||
V_ASN1_SEQUENCE, params, dp, dplen))
|
||||
@@ -329,7 +331,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
|
||||
if (params != NULL)
|
||||
ASN1_STRING_free(params);
|
||||
if (prkey != NULL)
|
||||
ASN1_INTEGER_free(prkey);
|
||||
ASN1_STRING_clear_free(prkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -314,7 +314,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
|
||||
return (NULL);
|
||||
}
|
||||
strcpy(merged, filespec2);
|
||||
} else
|
||||
} else {
|
||||
/*
|
||||
* This part isn't as trivial as it looks. It assumes that the
|
||||
* second file specification really is a directory, and makes no
|
||||
@@ -322,13 +322,12 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
|
||||
* concatenation of filespec2 followed by a slash followed by
|
||||
* filespec1.
|
||||
*/
|
||||
{
|
||||
int spec2len, len;
|
||||
|
||||
spec2len = strlen(filespec2);
|
||||
len = spec2len + (filespec1 ? strlen(filespec1) : 0);
|
||||
len = spec2len + strlen(filespec1);
|
||||
|
||||
if (filespec2 && filespec2[spec2len - 1] == '/') {
|
||||
if (spec2len && filespec2[spec2len - 1] == '/') {
|
||||
spec2len--;
|
||||
len--;
|
||||
}
|
||||
|
@@ -172,6 +172,7 @@ static int vms_load(DSO *dso)
|
||||
# endif /* __INITIAL_POINTER_SIZE == 64 */
|
||||
|
||||
const char *sp1, *sp2; /* Search result */
|
||||
const char *ext = NULL; /* possible extension to add */
|
||||
|
||||
if (filename == NULL) {
|
||||
DSOerr(DSO_F_VMS_LOAD, DSO_R_NO_FILENAME);
|
||||
@@ -213,12 +214,20 @@ static int vms_load(DSO *dso)
|
||||
sp1++; /* The byte after the found character */
|
||||
/* Now, let's see if there's a type, and save the position in sp2 */
|
||||
sp2 = strchr(sp1, '.');
|
||||
/*
|
||||
* If there is a period and the next character is a semi-colon,
|
||||
* we need to add an extension
|
||||
*/
|
||||
if (sp2 != NULL && sp2[1] == ';')
|
||||
ext = ".EXE";
|
||||
/*
|
||||
* If we found it, that's where we'll cut. Otherwise, look for a version
|
||||
* number and save the position in sp2
|
||||
*/
|
||||
if (sp2 == NULL)
|
||||
if (sp2 == NULL) {
|
||||
sp2 = strchr(sp1, ';');
|
||||
ext = ".EXE";
|
||||
}
|
||||
/*
|
||||
* If there was still nothing to find, set sp2 to point at the end of the
|
||||
* string
|
||||
@@ -244,6 +253,11 @@ static int vms_load(DSO *dso)
|
||||
|
||||
strncpy(p->imagename, filename, sp1 - filename);
|
||||
p->imagename[sp1 - filename] = '\0';
|
||||
if (ext) {
|
||||
strcat(p->imagename, ext);
|
||||
if (*sp2 == '.')
|
||||
sp2++;
|
||||
}
|
||||
strcat(p->imagename, sp2);
|
||||
|
||||
p->filename_dsc.dsc$w_length = strlen(p->filename);
|
||||
@@ -525,7 +539,8 @@ static char *vms_name_converter(DSO *dso, const char *filename)
|
||||
{
|
||||
int len = strlen(filename);
|
||||
char *not_translated = OPENSSL_malloc(len + 1);
|
||||
strcpy(not_translated, filename);
|
||||
if(not_translated)
|
||||
strcpy(not_translated, filename);
|
||||
return (not_translated);
|
||||
}
|
||||
|
||||
|
@@ -1017,14 +1017,8 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
|
||||
EC_KEY *ret = NULL;
|
||||
EC_PRIVATEKEY *priv_key = NULL;
|
||||
|
||||
if ((priv_key = EC_PRIVATEKEY_new()) == NULL) {
|
||||
ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((priv_key = d2i_EC_PRIVATEKEY(&priv_key, in, len)) == NULL) {
|
||||
if ((priv_key = d2i_EC_PRIVATEKEY(NULL, in, len)) == NULL) {
|
||||
ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_EC_LIB);
|
||||
EC_PRIVATEKEY_free(priv_key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1033,8 +1027,6 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
|
||||
ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
if (a)
|
||||
*a = ret;
|
||||
} else
|
||||
ret = *a;
|
||||
|
||||
@@ -1102,10 +1094,12 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
|
||||
ret->enc_flag |= EC_PKEY_NO_PUBKEY;
|
||||
}
|
||||
|
||||
if (a)
|
||||
*a = ret;
|
||||
ok = 1;
|
||||
err:
|
||||
if (!ok) {
|
||||
if (ret)
|
||||
if (ret && (a == NULL || *a != ret))
|
||||
EC_KEY_free(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
@@ -1232,16 +1226,19 @@ EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len)
|
||||
ECerr(EC_F_D2I_ECPARAMETERS, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
if (a)
|
||||
*a = ret;
|
||||
} else
|
||||
ret = *a;
|
||||
|
||||
if (!d2i_ECPKParameters(&ret->group, in, len)) {
|
||||
ECerr(EC_F_D2I_ECPARAMETERS, ERR_R_EC_LIB);
|
||||
if (a == NULL || *a != ret)
|
||||
EC_KEY_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (a)
|
||||
*a = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -69,16 +69,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
# include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "ec_lcl.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
# include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int field_type, /* either NID_X9_62_prime_field or
|
||||
* NID_X9_62_characteristic_two_field */
|
||||
|
@@ -69,13 +69,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include "ec_lcl.h"
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
# include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include "ec_lcl.h"
|
||||
|
||||
EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
|
||||
const BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
|
@@ -321,7 +321,7 @@ static void bin28_to_felem(felem out, const u8 in[28])
|
||||
out[0] = *((const uint64_t *)(in)) & 0x00ffffffffffffff;
|
||||
out[1] = (*((const uint64_t *)(in + 7))) & 0x00ffffffffffffff;
|
||||
out[2] = (*((const uint64_t *)(in + 14))) & 0x00ffffffffffffff;
|
||||
out[3] = (*((const uint64_t *)(in + 21))) & 0x00ffffffffffffff;
|
||||
out[3] = (*((const uint64_t *)(in+20))) >> 8;
|
||||
}
|
||||
|
||||
static void felem_to_bin28(u8 out[28], const felem in)
|
||||
|
@@ -103,6 +103,8 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags)
|
||||
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))
|
||||
|
@@ -1,701 +0,0 @@
|
||||
/* crypto/engine/eng_rsax.c */
|
||||
/* Copyright (c) 2010-2010 Intel Corp.
|
||||
* Author: Vinodh.Gopal@intel.com
|
||||
* Jim Guilford
|
||||
* Erdinc.Ozturk@intel.com
|
||||
* Maxim.Perminov@intel.com
|
||||
* Ying.Huang@intel.com
|
||||
*
|
||||
* More information about algorithm used can be found at:
|
||||
* http://www.cse.buffalo.edu/srds2009/escs2009_submission_Gopal.pdf
|
||||
*/
|
||||
/* ====================================================================
|
||||
* 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).
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/engine.h>
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
# include <openssl/rsa.h>
|
||||
#endif
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
/* RSAX is available **ONLY* on x86_64 CPUs */
|
||||
#undef COMPILE_RSAX
|
||||
|
||||
#if (defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(_M_AMD64) || defined (_M_X64)) && !defined(OPENSSL_NO_ASM)
|
||||
# define COMPILE_RSAX
|
||||
static ENGINE *ENGINE_rsax(void);
|
||||
#endif
|
||||
|
||||
void ENGINE_load_rsax(void)
|
||||
{
|
||||
/* On non-x86 CPUs it just returns. */
|
||||
#ifdef COMPILE_RSAX
|
||||
ENGINE *toadd = ENGINE_rsax();
|
||||
if (!toadd)
|
||||
return;
|
||||
ENGINE_add(toadd);
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef COMPILE_RSAX
|
||||
# define E_RSAX_LIB_NAME "rsax engine"
|
||||
|
||||
static int e_rsax_destroy(ENGINE *e);
|
||||
static int e_rsax_init(ENGINE *e);
|
||||
static int e_rsax_finish(ENGINE *e);
|
||||
static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
/* RSA stuff */
|
||||
static int e_rsax_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa,
|
||||
BN_CTX *ctx);
|
||||
static int e_rsax_rsa_finish(RSA *r);
|
||||
# endif
|
||||
|
||||
static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] = {
|
||||
{0, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
/* Our internal RSA_METHOD that we provide pointers to */
|
||||
static RSA_METHOD e_rsax_rsa = {
|
||||
"Intel RSA-X method",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
e_rsax_rsa_mod_exp,
|
||||
NULL,
|
||||
NULL,
|
||||
e_rsax_rsa_finish,
|
||||
RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
# endif
|
||||
|
||||
/* Constants used when creating the ENGINE */
|
||||
static const char *engine_e_rsax_id = "rsax";
|
||||
static const char *engine_e_rsax_name = "RSAX engine support";
|
||||
|
||||
/* This internal function is used by ENGINE_rsax() */
|
||||
static int bind_helper(ENGINE *e)
|
||||
{
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
const RSA_METHOD *meth1;
|
||||
# endif
|
||||
if (!ENGINE_set_id(e, engine_e_rsax_id) ||
|
||||
!ENGINE_set_name(e, engine_e_rsax_name) ||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
!ENGINE_set_RSA(e, &e_rsax_rsa) ||
|
||||
# endif
|
||||
!ENGINE_set_destroy_function(e, e_rsax_destroy) ||
|
||||
!ENGINE_set_init_function(e, e_rsax_init) ||
|
||||
!ENGINE_set_finish_function(e, e_rsax_finish) ||
|
||||
!ENGINE_set_ctrl_function(e, e_rsax_ctrl) ||
|
||||
!ENGINE_set_cmd_defns(e, e_rsax_cmd_defns))
|
||||
return 0;
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
meth1 = RSA_PKCS1_SSLeay();
|
||||
e_rsax_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
|
||||
e_rsax_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
|
||||
e_rsax_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
|
||||
e_rsax_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
|
||||
e_rsax_rsa.bn_mod_exp = meth1->bn_mod_exp;
|
||||
# endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ENGINE *ENGINE_rsax(void)
|
||||
{
|
||||
ENGINE *ret = ENGINE_new();
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if (!bind_helper(ret)) {
|
||||
ENGINE_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
/* Used to attach our own key-data to an RSA structure */
|
||||
static int rsax_ex_data_idx = -1;
|
||||
# endif
|
||||
|
||||
static int e_rsax_destroy(ENGINE *e)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* (de)initialisation functions. */
|
||||
static int e_rsax_init(ENGINE *e)
|
||||
{
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
if (rsax_ex_data_idx == -1)
|
||||
rsax_ex_data_idx = RSA_get_ex_new_index(0, NULL, NULL, NULL, NULL);
|
||||
# endif
|
||||
if (rsax_ex_data_idx == -1)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int e_rsax_finish(ENGINE *e)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
|
||||
{
|
||||
int to_return = 1;
|
||||
|
||||
switch (cmd) {
|
||||
/* The command isn't understood by this engine */
|
||||
default:
|
||||
to_return = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return to_return;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
|
||||
# ifdef _WIN32
|
||||
typedef unsigned __int64 UINT64;
|
||||
# else
|
||||
typedef unsigned long long UINT64;
|
||||
# endif
|
||||
typedef unsigned short UINT16;
|
||||
|
||||
/*
|
||||
* Table t is interleaved in the following manner: The order in memory is
|
||||
* t[0][0], t[0][1], ..., t[0][7], t[1][0], ... A particular 512-bit value is
|
||||
* stored in t[][index] rather than the more normal t[index][]; i.e. the
|
||||
* qwords of a particular entry in t are not adjacent in memory
|
||||
*/
|
||||
|
||||
/* Init BIGNUM b from the interleaved UINT64 array */
|
||||
static int interleaved_array_to_bn_512(BIGNUM *b, UINT64 *array);
|
||||
|
||||
/*
|
||||
* Extract array elements from BIGNUM b To set the whole array from b, call
|
||||
* with n=8
|
||||
*/
|
||||
static int bn_extract_to_array_512(const BIGNUM *b, unsigned int n,
|
||||
UINT64 *array);
|
||||
|
||||
struct mod_ctx_512 {
|
||||
UINT64 t[8][8];
|
||||
UINT64 m[8];
|
||||
UINT64 m1[8]; /* 2^278 % m */
|
||||
UINT64 m2[8]; /* 2^640 % m */
|
||||
UINT64 k1[2]; /* (- 1/m) % 2^128 */
|
||||
};
|
||||
|
||||
static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *data);
|
||||
|
||||
void mod_exp_512(UINT64 *result, /* 512 bits, 8 qwords */
|
||||
UINT64 *g, /* 512 bits, 8 qwords */
|
||||
UINT64 *exp, /* 512 bits, 8 qwords */
|
||||
struct mod_ctx_512 *data);
|
||||
|
||||
typedef struct st_e_rsax_mod_ctx {
|
||||
UINT64 type;
|
||||
union {
|
||||
struct mod_ctx_512 b512;
|
||||
} ctx;
|
||||
|
||||
} E_RSAX_MOD_CTX;
|
||||
|
||||
static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM *m)
|
||||
{
|
||||
E_RSAX_MOD_CTX *hptr;
|
||||
|
||||
if (idx < 0 || idx > 2)
|
||||
return NULL;
|
||||
|
||||
hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
|
||||
if (!hptr) {
|
||||
hptr = OPENSSL_malloc(3 * sizeof(E_RSAX_MOD_CTX));
|
||||
if (!hptr)
|
||||
return NULL;
|
||||
hptr[2].type = hptr[1].type = hptr[0].type = 0;
|
||||
RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);
|
||||
}
|
||||
|
||||
if (hptr[idx].type == (UINT64)BN_num_bits(m))
|
||||
return hptr + idx;
|
||||
|
||||
if (BN_num_bits(m) == 512) {
|
||||
UINT64 _m[8];
|
||||
bn_extract_to_array_512(m, 8, _m);
|
||||
memset(&hptr[idx].ctx.b512, 0, sizeof(struct mod_ctx_512));
|
||||
mod_exp_pre_compute_data_512(_m, &hptr[idx].ctx.b512);
|
||||
}
|
||||
|
||||
hptr[idx].type = BN_num_bits(m);
|
||||
return hptr + idx;
|
||||
}
|
||||
|
||||
static int e_rsax_rsa_finish(RSA *rsa)
|
||||
{
|
||||
E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
|
||||
if (hptr) {
|
||||
OPENSSL_free(hptr);
|
||||
RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
|
||||
}
|
||||
if (rsa->_method_mod_n)
|
||||
BN_MONT_CTX_free(rsa->_method_mod_n);
|
||||
if (rsa->_method_mod_p)
|
||||
BN_MONT_CTX_free(rsa->_method_mod_p);
|
||||
if (rsa->_method_mod_q)
|
||||
BN_MONT_CTX_free(rsa->_method_mod_q);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int e_rsax_bn_mod_exp(BIGNUM *r, const BIGNUM *g, const BIGNUM *e,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont,
|
||||
E_RSAX_MOD_CTX *rsax_mod_ctx)
|
||||
{
|
||||
if (rsax_mod_ctx && BN_get_flags(e, BN_FLG_CONSTTIME) != 0) {
|
||||
if (BN_num_bits(m) == 512) {
|
||||
UINT64 _r[8];
|
||||
UINT64 _g[8];
|
||||
UINT64 _e[8];
|
||||
|
||||
/* Init the arrays from the BIGNUMs */
|
||||
bn_extract_to_array_512(g, 8, _g);
|
||||
bn_extract_to_array_512(e, 8, _e);
|
||||
|
||||
mod_exp_512(_r, _g, _e, &rsax_mod_ctx->ctx.b512);
|
||||
/* Return the result in the BIGNUM */
|
||||
interleaved_array_to_bn_512(r, _r);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return BN_mod_exp_mont(r, g, e, m, ctx, in_mont);
|
||||
}
|
||||
|
||||
/*
|
||||
* Declares for the Intel CIAP 512-bit / CRT / 1024 bit RSA modular
|
||||
* exponentiation routine precalculations and a structure to hold the
|
||||
* necessary values. These files are meant to live in crypto/rsa/ in the
|
||||
* target openssl.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local method: extracts a piece from a BIGNUM, to fit it into
|
||||
* an array. Call with n=8 to extract an entire 512-bit BIGNUM
|
||||
*/
|
||||
static int bn_extract_to_array_512(const BIGNUM *b, unsigned int n,
|
||||
UINT64 *array)
|
||||
{
|
||||
int i;
|
||||
UINT64 tmp;
|
||||
unsigned char bn_buff[64];
|
||||
memset(bn_buff, 0, 64);
|
||||
if (BN_num_bytes(b) > 64) {
|
||||
printf("Can't support this byte size\n");
|
||||
return 0;
|
||||
}
|
||||
if (BN_num_bytes(b) != 0) {
|
||||
if (!BN_bn2bin(b, bn_buff + (64 - BN_num_bytes(b)))) {
|
||||
printf("Error's in bn2bin\n");
|
||||
/* We have to error, here */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
while (n-- > 0) {
|
||||
array[n] = 0;
|
||||
for (i = 7; i >= 0; i--) {
|
||||
tmp = bn_buff[63 - (n * 8 + i)];
|
||||
array[n] |= tmp << (8 * i);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Init a 512-bit BIGNUM from the UINT64*_ (8 * 64) interleaved array */
|
||||
static int interleaved_array_to_bn_512(BIGNUM *b, UINT64 *array)
|
||||
{
|
||||
unsigned char tmp[64];
|
||||
int n = 8;
|
||||
int i;
|
||||
while (n-- > 0) {
|
||||
for (i = 7; i >= 0; i--) {
|
||||
tmp[63 - (n * 8 + i)] = (unsigned char)(array[n] >> (8 * i));
|
||||
}}
|
||||
BN_bin2bn(tmp, 64, b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The main 512bit precompute call */
|
||||
static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *data)
|
||||
{
|
||||
BIGNUM two_768, two_640, two_128, two_512, tmp, _m, tmp2;
|
||||
|
||||
/* We need a BN_CTX for the modulo functions */
|
||||
BN_CTX *ctx;
|
||||
/* Some tmps */
|
||||
UINT64 _t[8];
|
||||
int i, j, ret = 0;
|
||||
|
||||
/* Init _m with m */
|
||||
BN_init(&_m);
|
||||
interleaved_array_to_bn_512(&_m, m);
|
||||
memset(_t, 0, 64);
|
||||
|
||||
/* Inits */
|
||||
BN_init(&two_768);
|
||||
BN_init(&two_640);
|
||||
BN_init(&two_128);
|
||||
BN_init(&two_512);
|
||||
BN_init(&tmp);
|
||||
BN_init(&tmp2);
|
||||
|
||||
/* Create our context */
|
||||
if ((ctx = BN_CTX_new()) == NULL) {
|
||||
goto err;
|
||||
}
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
/*
|
||||
* For production, if you care, these only need to be set once,
|
||||
* and may be made constants.
|
||||
*/
|
||||
BN_lshift(&two_768, BN_value_one(), 768);
|
||||
BN_lshift(&two_640, BN_value_one(), 640);
|
||||
BN_lshift(&two_128, BN_value_one(), 128);
|
||||
BN_lshift(&two_512, BN_value_one(), 512);
|
||||
|
||||
if (0 == (m[7] & 0x8000000000000000)) {
|
||||
exit(1);
|
||||
}
|
||||
if (0 == (m[0] & 0x1)) { /* Odd modulus required for Mont */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Precompute m1 */
|
||||
BN_mod(&tmp, &two_768, &_m, ctx);
|
||||
if (!bn_extract_to_array_512(&tmp, 8, &data->m1[0])) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Precompute m2 */
|
||||
BN_mod(&tmp, &two_640, &_m, ctx);
|
||||
if (!bn_extract_to_array_512(&tmp, 8, &data->m2[0])) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Precompute k1, a 128b number = ((-1)* m-1 ) mod 2128; k1 should
|
||||
* be non-negative.
|
||||
*/
|
||||
BN_mod_inverse(&tmp, &_m, &two_128, ctx);
|
||||
if (!BN_is_zero(&tmp)) {
|
||||
BN_sub(&tmp, &two_128, &tmp);
|
||||
}
|
||||
if (!bn_extract_to_array_512(&tmp, 2, &data->k1[0])) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Precompute t */
|
||||
for (i = 0; i < 8; i++) {
|
||||
BN_zero(&tmp);
|
||||
if (i & 1) {
|
||||
BN_add(&tmp, &two_512, &tmp);
|
||||
}
|
||||
if (i & 2) {
|
||||
BN_add(&tmp, &two_512, &tmp);
|
||||
}
|
||||
if (i & 4) {
|
||||
BN_add(&tmp, &two_640, &tmp);
|
||||
}
|
||||
|
||||
BN_nnmod(&tmp2, &tmp, &_m, ctx);
|
||||
if (!bn_extract_to_array_512(&tmp2, 8, _t)) {
|
||||
goto err;
|
||||
}
|
||||
for (j = 0; j < 8; j++)
|
||||
data->t[j][i] = _t[j];
|
||||
}
|
||||
|
||||
/* Precompute m */
|
||||
for (i = 0; i < 8; i++) {
|
||||
data->m[i] = m[i];
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
/* Cleanup */
|
||||
if (ctx != NULL) {
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx);
|
||||
}
|
||||
BN_free(&two_768);
|
||||
BN_free(&two_640);
|
||||
BN_free(&two_128);
|
||||
BN_free(&two_512);
|
||||
BN_free(&tmp);
|
||||
BN_free(&tmp2);
|
||||
BN_free(&_m);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int e_rsax_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *r1, *m1, *vrfy;
|
||||
BIGNUM local_dmp1, local_dmq1, local_c, local_r1;
|
||||
BIGNUM *dmp1, *dmq1, *c, *pr1;
|
||||
int ret = 0;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
r1 = BN_CTX_get(ctx);
|
||||
m1 = BN_CTX_get(ctx);
|
||||
vrfy = BN_CTX_get(ctx);
|
||||
|
||||
{
|
||||
BIGNUM local_p, local_q;
|
||||
BIGNUM *p = NULL, *q = NULL;
|
||||
int error = 0;
|
||||
|
||||
/*
|
||||
* Make sure BN_mod_inverse in Montgomery intialization uses the
|
||||
* BN_FLG_CONSTTIME flag (unless RSA_FLAG_NO_CONSTTIME is set)
|
||||
*/
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
BN_init(&local_p);
|
||||
p = &local_p;
|
||||
BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
|
||||
|
||||
BN_init(&local_q);
|
||||
q = &local_q;
|
||||
BN_with_flags(q, rsa->q, BN_FLG_CONSTTIME);
|
||||
} else {
|
||||
p = rsa->p;
|
||||
q = rsa->q;
|
||||
}
|
||||
|
||||
if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) {
|
||||
if (!BN_MONT_CTX_set_locked
|
||||
(&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx))
|
||||
error = 1;
|
||||
if (!BN_MONT_CTX_set_locked
|
||||
(&rsa->_method_mod_q, CRYPTO_LOCK_RSA, q, ctx))
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
BN_free(&local_p);
|
||||
BN_free(&local_q);
|
||||
}
|
||||
if (error)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
|
||||
if (!BN_MONT_CTX_set_locked
|
||||
(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx))
|
||||
goto err;
|
||||
|
||||
/* compute I mod q */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
c = &local_c;
|
||||
BN_with_flags(c, I, BN_FLG_CONSTTIME);
|
||||
if (!BN_mod(r1, c, rsa->q, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod(r1, I, rsa->q, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* compute r1^dmq1 mod q */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
dmq1 = &local_dmq1;
|
||||
BN_with_flags(dmq1, rsa->dmq1, BN_FLG_CONSTTIME);
|
||||
} else
|
||||
dmq1 = rsa->dmq1;
|
||||
|
||||
if (!e_rsax_bn_mod_exp(m1, r1, dmq1, rsa->q, ctx,
|
||||
rsa->_method_mod_q, e_rsax_get_ctx(rsa, 0,
|
||||
rsa->q)))
|
||||
goto err;
|
||||
|
||||
/* compute I mod p */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
c = &local_c;
|
||||
BN_with_flags(c, I, BN_FLG_CONSTTIME);
|
||||
if (!BN_mod(r1, c, rsa->p, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod(r1, I, rsa->p, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* compute r1^dmp1 mod p */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
dmp1 = &local_dmp1;
|
||||
BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME);
|
||||
} else
|
||||
dmp1 = rsa->dmp1;
|
||||
|
||||
if (!e_rsax_bn_mod_exp(r0, r1, dmp1, rsa->p, ctx,
|
||||
rsa->_method_mod_p, e_rsax_get_ctx(rsa, 1,
|
||||
rsa->p)))
|
||||
goto err;
|
||||
|
||||
if (!BN_sub(r0, r0, m1))
|
||||
goto err;
|
||||
/*
|
||||
* This will help stop the size of r0 increasing, which does affect the
|
||||
* multiply if it optimised for a power of 2 size
|
||||
*/
|
||||
if (BN_is_negative(r0))
|
||||
if (!BN_add(r0, r0, rsa->p))
|
||||
goto err;
|
||||
|
||||
if (!BN_mul(r1, r0, rsa->iqmp, ctx))
|
||||
goto err;
|
||||
|
||||
/* Turn BN_FLG_CONSTTIME flag on before division operation */
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
pr1 = &local_r1;
|
||||
BN_with_flags(pr1, r1, BN_FLG_CONSTTIME);
|
||||
} else
|
||||
pr1 = r1;
|
||||
if (!BN_mod(r0, pr1, rsa->p, ctx))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* If p < q it is occasionally possible for the correction of adding 'p'
|
||||
* if r0 is negative above to leave the result still negative. This can
|
||||
* break the private key operations: the following second correction
|
||||
* should *always* correct this rare occurrence. This will *never* happen
|
||||
* with OpenSSL generated keys because they ensure p > q [steve]
|
||||
*/
|
||||
if (BN_is_negative(r0))
|
||||
if (!BN_add(r0, r0, rsa->p))
|
||||
goto err;
|
||||
if (!BN_mul(r1, r0, rsa->q, ctx))
|
||||
goto err;
|
||||
if (!BN_add(r0, r1, m1))
|
||||
goto err;
|
||||
|
||||
if (rsa->e && rsa->n) {
|
||||
if (!e_rsax_bn_mod_exp
|
||||
(vrfy, r0, rsa->e, rsa->n, ctx, rsa->_method_mod_n,
|
||||
e_rsax_get_ctx(rsa, 2, rsa->n)))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* If 'I' was greater than (or equal to) rsa->n, the operation will
|
||||
* be equivalent to using 'I mod n'. However, the result of the
|
||||
* verify will *always* be less than 'n' so we don't check for
|
||||
* absolute equality, just congruency.
|
||||
*/
|
||||
if (!BN_sub(vrfy, vrfy, I))
|
||||
goto err;
|
||||
if (!BN_mod(vrfy, vrfy, rsa->n, ctx))
|
||||
goto err;
|
||||
if (BN_is_negative(vrfy))
|
||||
if (!BN_add(vrfy, vrfy, rsa->n))
|
||||
goto err;
|
||||
if (!BN_is_zero(vrfy)) {
|
||||
/*
|
||||
* 'I' and 'vrfy' aren't congruent mod n. Don't leak
|
||||
* miscalculated CRT output, just do a raw (slower) mod_exp and
|
||||
* return that instead.
|
||||
*/
|
||||
|
||||
BIGNUM local_d;
|
||||
BIGNUM *d = NULL;
|
||||
|
||||
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
|
||||
d = &local_d;
|
||||
BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
|
||||
} else
|
||||
d = rsa->d;
|
||||
if (!e_rsax_bn_mod_exp(r0, I, d, rsa->n, ctx,
|
||||
rsa->_method_mod_n, e_rsax_get_ctx(rsa, 2,
|
||||
rsa->n)))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
# endif /* !OPENSSL_NO_RSA */
|
||||
#endif /* !COMPILE_RSAX */
|
@@ -13,7 +13,7 @@ AR= ar r
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=evp_test.c
|
||||
TEST=evp_test.c evp_extra_test.c
|
||||
TESTDATA=evptests.txt
|
||||
APPS=
|
||||
|
||||
|
@@ -203,9 +203,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
|
||||
ctx->engine = impl;
|
||||
} else
|
||||
ctx->engine = NULL;
|
||||
} else if (!ctx->digest) {
|
||||
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
|
||||
return 0;
|
||||
} else {
|
||||
if (!ctx->digest) {
|
||||
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
|
||||
return 0;
|
||||
}
|
||||
type = ctx->digest;
|
||||
}
|
||||
#endif
|
||||
if (ctx->digest != type) {
|
||||
|
@@ -790,6 +790,8 @@ static int aes_t4_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
cctx->str = NULL;
|
||||
# endif
|
||||
cctx->key_set = 1;
|
||||
}
|
||||
|
489
crypto/evp/evp_extra_test.c
Normal file
489
crypto/evp/evp_extra_test.c
Normal file
@@ -0,0 +1,489 @@
|
||||
/* Copyright (c) 2014, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2015 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
/*
|
||||
* kExampleRSAKeyDER is an RSA private key in ASN.1, DER format. Of course, you
|
||||
* should never use this key anywhere but in an example.
|
||||
*/
|
||||
static const unsigned char kExampleRSAKeyDER[] = {
|
||||
0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xf8,
|
||||
0xb8, 0x6c, 0x83, 0xb4, 0xbc, 0xd9, 0xa8, 0x57, 0xc0, 0xa5, 0xb4, 0x59,
|
||||
0x76, 0x8c, 0x54, 0x1d, 0x79, 0xeb, 0x22, 0x52, 0x04, 0x7e, 0xd3, 0x37,
|
||||
0xeb, 0x41, 0xfd, 0x83, 0xf9, 0xf0, 0xa6, 0x85, 0x15, 0x34, 0x75, 0x71,
|
||||
0x5a, 0x84, 0xa8, 0x3c, 0xd2, 0xef, 0x5a, 0x4e, 0xd3, 0xde, 0x97, 0x8a,
|
||||
0xdd, 0xff, 0xbb, 0xcf, 0x0a, 0xaa, 0x86, 0x92, 0xbe, 0xb8, 0x50, 0xe4,
|
||||
0xcd, 0x6f, 0x80, 0x33, 0x30, 0x76, 0x13, 0x8f, 0xca, 0x7b, 0xdc, 0xec,
|
||||
0x5a, 0xca, 0x63, 0xc7, 0x03, 0x25, 0xef, 0xa8, 0x8a, 0x83, 0x58, 0x76,
|
||||
0x20, 0xfa, 0x16, 0x77, 0xd7, 0x79, 0x92, 0x63, 0x01, 0x48, 0x1a, 0xd8,
|
||||
0x7b, 0x67, 0xf1, 0x52, 0x55, 0x49, 0x4e, 0xd6, 0x6e, 0x4a, 0x5c, 0xd7,
|
||||
0x7a, 0x37, 0x36, 0x0c, 0xde, 0xdd, 0x8f, 0x44, 0xe8, 0xc2, 0xa7, 0x2c,
|
||||
0x2b, 0xb5, 0xaf, 0x64, 0x4b, 0x61, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01,
|
||||
0x02, 0x81, 0x80, 0x74, 0x88, 0x64, 0x3f, 0x69, 0x45, 0x3a, 0x6d, 0xc7,
|
||||
0x7f, 0xb9, 0xa3, 0xc0, 0x6e, 0xec, 0xdc, 0xd4, 0x5a, 0xb5, 0x32, 0x85,
|
||||
0x5f, 0x19, 0xd4, 0xf8, 0xd4, 0x3f, 0x3c, 0xfa, 0xc2, 0xf6, 0x5f, 0xee,
|
||||
0xe6, 0xba, 0x87, 0x74, 0x2e, 0xc7, 0x0c, 0xd4, 0x42, 0xb8, 0x66, 0x85,
|
||||
0x9c, 0x7b, 0x24, 0x61, 0xaa, 0x16, 0x11, 0xf6, 0xb5, 0xb6, 0xa4, 0x0a,
|
||||
0xc9, 0x55, 0x2e, 0x81, 0xa5, 0x47, 0x61, 0xcb, 0x25, 0x8f, 0xc2, 0x15,
|
||||
0x7b, 0x0e, 0x7c, 0x36, 0x9f, 0x3a, 0xda, 0x58, 0x86, 0x1c, 0x5b, 0x83,
|
||||
0x79, 0xe6, 0x2b, 0xcc, 0xe6, 0xfa, 0x2c, 0x61, 0xf2, 0x78, 0x80, 0x1b,
|
||||
0xe2, 0xf3, 0x9d, 0x39, 0x2b, 0x65, 0x57, 0x91, 0x3d, 0x71, 0x99, 0x73,
|
||||
0xa5, 0xc2, 0x79, 0x20, 0x8c, 0x07, 0x4f, 0xe5, 0xb4, 0x60, 0x1f, 0x99,
|
||||
0xa2, 0xb1, 0x4f, 0x0c, 0xef, 0xbc, 0x59, 0x53, 0x00, 0x7d, 0xb1, 0x02,
|
||||
0x41, 0x00, 0xfc, 0x7e, 0x23, 0x65, 0x70, 0xf8, 0xce, 0xd3, 0x40, 0x41,
|
||||
0x80, 0x6a, 0x1d, 0x01, 0xd6, 0x01, 0xff, 0xb6, 0x1b, 0x3d, 0x3d, 0x59,
|
||||
0x09, 0x33, 0x79, 0xc0, 0x4f, 0xde, 0x96, 0x27, 0x4b, 0x18, 0xc6, 0xd9,
|
||||
0x78, 0xf1, 0xf4, 0x35, 0x46, 0xe9, 0x7c, 0x42, 0x7a, 0x5d, 0x9f, 0xef,
|
||||
0x54, 0xb8, 0xf7, 0x9f, 0xc4, 0x33, 0x6c, 0xf3, 0x8c, 0x32, 0x46, 0x87,
|
||||
0x67, 0x30, 0x7b, 0xa7, 0xac, 0xe3, 0x02, 0x41, 0x00, 0xfc, 0x2c, 0xdf,
|
||||
0x0c, 0x0d, 0x88, 0xf5, 0xb1, 0x92, 0xa8, 0x93, 0x47, 0x63, 0x55, 0xf5,
|
||||
0xca, 0x58, 0x43, 0xba, 0x1c, 0xe5, 0x9e, 0xb6, 0x95, 0x05, 0xcd, 0xb5,
|
||||
0x82, 0xdf, 0xeb, 0x04, 0x53, 0x9d, 0xbd, 0xc2, 0x38, 0x16, 0xb3, 0x62,
|
||||
0xdd, 0xa1, 0x46, 0xdb, 0x6d, 0x97, 0x93, 0x9f, 0x8a, 0xc3, 0x9b, 0x64,
|
||||
0x7e, 0x42, 0xe3, 0x32, 0x57, 0x19, 0x1b, 0xd5, 0x6e, 0x85, 0xfa, 0xb8,
|
||||
0x8d, 0x02, 0x41, 0x00, 0xbc, 0x3d, 0xde, 0x6d, 0xd6, 0x97, 0xe8, 0xba,
|
||||
0x9e, 0x81, 0x37, 0x17, 0xe5, 0xa0, 0x64, 0xc9, 0x00, 0xb7, 0xe7, 0xfe,
|
||||
0xf4, 0x29, 0xd9, 0x2e, 0x43, 0x6b, 0x19, 0x20, 0xbd, 0x99, 0x75, 0xe7,
|
||||
0x76, 0xf8, 0xd3, 0xae, 0xaf, 0x7e, 0xb8, 0xeb, 0x81, 0xf4, 0x9d, 0xfe,
|
||||
0x07, 0x2b, 0x0b, 0x63, 0x0b, 0x5a, 0x55, 0x90, 0x71, 0x7d, 0xf1, 0xdb,
|
||||
0xd9, 0xb1, 0x41, 0x41, 0x68, 0x2f, 0x4e, 0x39, 0x02, 0x40, 0x5a, 0x34,
|
||||
0x66, 0xd8, 0xf5, 0xe2, 0x7f, 0x18, 0xb5, 0x00, 0x6e, 0x26, 0x84, 0x27,
|
||||
0x14, 0x93, 0xfb, 0xfc, 0xc6, 0x0f, 0x5e, 0x27, 0xe6, 0xe1, 0xe9, 0xc0,
|
||||
0x8a, 0xe4, 0x34, 0xda, 0xe9, 0xa2, 0x4b, 0x73, 0xbc, 0x8c, 0xb9, 0xba,
|
||||
0x13, 0x6c, 0x7a, 0x2b, 0x51, 0x84, 0xa3, 0x4a, 0xe0, 0x30, 0x10, 0x06,
|
||||
0x7e, 0xed, 0x17, 0x5a, 0x14, 0x00, 0xc9, 0xef, 0x85, 0xea, 0x52, 0x2c,
|
||||
0xbc, 0x65, 0x02, 0x40, 0x51, 0xe3, 0xf2, 0x83, 0x19, 0x9b, 0xc4, 0x1e,
|
||||
0x2f, 0x50, 0x3d, 0xdf, 0x5a, 0xa2, 0x18, 0xca, 0x5f, 0x2e, 0x49, 0xaf,
|
||||
0x6f, 0xcc, 0xfa, 0x65, 0x77, 0x94, 0xb5, 0xa1, 0x0a, 0xa9, 0xd1, 0x8a,
|
||||
0x39, 0x37, 0xf4, 0x0b, 0xa0, 0xd7, 0x82, 0x27, 0x5e, 0xae, 0x17, 0x17,
|
||||
0xa1, 0x1e, 0x54, 0x34, 0xbf, 0x6e, 0xc4, 0x8e, 0x99, 0x5d, 0x08, 0xf1,
|
||||
0x2d, 0x86, 0x9d, 0xa5, 0x20, 0x1b, 0xe5, 0xdf,
|
||||
};
|
||||
|
||||
static const unsigned char kMsg[] = { 1, 2, 3, 4 };
|
||||
|
||||
static const unsigned char kSignature[] = {
|
||||
0xa5, 0xf0, 0x8a, 0x47, 0x5d, 0x3c, 0xb3, 0xcc, 0xa9, 0x79, 0xaf, 0x4d,
|
||||
0x8c, 0xae, 0x4c, 0x14, 0xef, 0xc2, 0x0b, 0x34, 0x36, 0xde, 0xf4, 0x3e,
|
||||
0x3d, 0xbb, 0x4a, 0x60, 0x5c, 0xc8, 0x91, 0x28, 0xda, 0xfb, 0x7e, 0x04,
|
||||
0x96, 0x7e, 0x63, 0x13, 0x90, 0xce, 0xb9, 0xb4, 0x62, 0x7a, 0xfd, 0x09,
|
||||
0x3d, 0xc7, 0x67, 0x78, 0x54, 0x04, 0xeb, 0x52, 0x62, 0x6e, 0x24, 0x67,
|
||||
0xb4, 0x40, 0xfc, 0x57, 0x62, 0xc6, 0xf1, 0x67, 0xc1, 0x97, 0x8f, 0x6a,
|
||||
0xa8, 0xae, 0x44, 0x46, 0x5e, 0xab, 0x67, 0x17, 0x53, 0x19, 0x3a, 0xda,
|
||||
0x5a, 0xc8, 0x16, 0x3e, 0x86, 0xd5, 0xc5, 0x71, 0x2f, 0xfc, 0x23, 0x48,
|
||||
0xd9, 0x0b, 0x13, 0xdd, 0x7b, 0x5a, 0x25, 0x79, 0xef, 0xa5, 0x7b, 0x04,
|
||||
0xed, 0x44, 0xf6, 0x18, 0x55, 0xe4, 0x0a, 0xe9, 0x57, 0x79, 0x5d, 0xd7,
|
||||
0x55, 0xa7, 0xab, 0x45, 0x02, 0x97, 0x60, 0x42,
|
||||
};
|
||||
|
||||
/*
|
||||
* kExampleRSAKeyPKCS8 is kExampleRSAKeyDER encoded in a PKCS #8
|
||||
* PrivateKeyInfo.
|
||||
*/
|
||||
static const unsigned char kExampleRSAKeyPKCS8[] = {
|
||||
0x30, 0x82, 0x02, 0x76, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a,
|
||||
0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
|
||||
0x02, 0x60, 0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
|
||||
0x00, 0xf8, 0xb8, 0x6c, 0x83, 0xb4, 0xbc, 0xd9, 0xa8, 0x57, 0xc0, 0xa5,
|
||||
0xb4, 0x59, 0x76, 0x8c, 0x54, 0x1d, 0x79, 0xeb, 0x22, 0x52, 0x04, 0x7e,
|
||||
0xd3, 0x37, 0xeb, 0x41, 0xfd, 0x83, 0xf9, 0xf0, 0xa6, 0x85, 0x15, 0x34,
|
||||
0x75, 0x71, 0x5a, 0x84, 0xa8, 0x3c, 0xd2, 0xef, 0x5a, 0x4e, 0xd3, 0xde,
|
||||
0x97, 0x8a, 0xdd, 0xff, 0xbb, 0xcf, 0x0a, 0xaa, 0x86, 0x92, 0xbe, 0xb8,
|
||||
0x50, 0xe4, 0xcd, 0x6f, 0x80, 0x33, 0x30, 0x76, 0x13, 0x8f, 0xca, 0x7b,
|
||||
0xdc, 0xec, 0x5a, 0xca, 0x63, 0xc7, 0x03, 0x25, 0xef, 0xa8, 0x8a, 0x83,
|
||||
0x58, 0x76, 0x20, 0xfa, 0x16, 0x77, 0xd7, 0x79, 0x92, 0x63, 0x01, 0x48,
|
||||
0x1a, 0xd8, 0x7b, 0x67, 0xf1, 0x52, 0x55, 0x49, 0x4e, 0xd6, 0x6e, 0x4a,
|
||||
0x5c, 0xd7, 0x7a, 0x37, 0x36, 0x0c, 0xde, 0xdd, 0x8f, 0x44, 0xe8, 0xc2,
|
||||
0xa7, 0x2c, 0x2b, 0xb5, 0xaf, 0x64, 0x4b, 0x61, 0x07, 0x02, 0x03, 0x01,
|
||||
0x00, 0x01, 0x02, 0x81, 0x80, 0x74, 0x88, 0x64, 0x3f, 0x69, 0x45, 0x3a,
|
||||
0x6d, 0xc7, 0x7f, 0xb9, 0xa3, 0xc0, 0x6e, 0xec, 0xdc, 0xd4, 0x5a, 0xb5,
|
||||
0x32, 0x85, 0x5f, 0x19, 0xd4, 0xf8, 0xd4, 0x3f, 0x3c, 0xfa, 0xc2, 0xf6,
|
||||
0x5f, 0xee, 0xe6, 0xba, 0x87, 0x74, 0x2e, 0xc7, 0x0c, 0xd4, 0x42, 0xb8,
|
||||
0x66, 0x85, 0x9c, 0x7b, 0x24, 0x61, 0xaa, 0x16, 0x11, 0xf6, 0xb5, 0xb6,
|
||||
0xa4, 0x0a, 0xc9, 0x55, 0x2e, 0x81, 0xa5, 0x47, 0x61, 0xcb, 0x25, 0x8f,
|
||||
0xc2, 0x15, 0x7b, 0x0e, 0x7c, 0x36, 0x9f, 0x3a, 0xda, 0x58, 0x86, 0x1c,
|
||||
0x5b, 0x83, 0x79, 0xe6, 0x2b, 0xcc, 0xe6, 0xfa, 0x2c, 0x61, 0xf2, 0x78,
|
||||
0x80, 0x1b, 0xe2, 0xf3, 0x9d, 0x39, 0x2b, 0x65, 0x57, 0x91, 0x3d, 0x71,
|
||||
0x99, 0x73, 0xa5, 0xc2, 0x79, 0x20, 0x8c, 0x07, 0x4f, 0xe5, 0xb4, 0x60,
|
||||
0x1f, 0x99, 0xa2, 0xb1, 0x4f, 0x0c, 0xef, 0xbc, 0x59, 0x53, 0x00, 0x7d,
|
||||
0xb1, 0x02, 0x41, 0x00, 0xfc, 0x7e, 0x23, 0x65, 0x70, 0xf8, 0xce, 0xd3,
|
||||
0x40, 0x41, 0x80, 0x6a, 0x1d, 0x01, 0xd6, 0x01, 0xff, 0xb6, 0x1b, 0x3d,
|
||||
0x3d, 0x59, 0x09, 0x33, 0x79, 0xc0, 0x4f, 0xde, 0x96, 0x27, 0x4b, 0x18,
|
||||
0xc6, 0xd9, 0x78, 0xf1, 0xf4, 0x35, 0x46, 0xe9, 0x7c, 0x42, 0x7a, 0x5d,
|
||||
0x9f, 0xef, 0x54, 0xb8, 0xf7, 0x9f, 0xc4, 0x33, 0x6c, 0xf3, 0x8c, 0x32,
|
||||
0x46, 0x87, 0x67, 0x30, 0x7b, 0xa7, 0xac, 0xe3, 0x02, 0x41, 0x00, 0xfc,
|
||||
0x2c, 0xdf, 0x0c, 0x0d, 0x88, 0xf5, 0xb1, 0x92, 0xa8, 0x93, 0x47, 0x63,
|
||||
0x55, 0xf5, 0xca, 0x58, 0x43, 0xba, 0x1c, 0xe5, 0x9e, 0xb6, 0x95, 0x05,
|
||||
0xcd, 0xb5, 0x82, 0xdf, 0xeb, 0x04, 0x53, 0x9d, 0xbd, 0xc2, 0x38, 0x16,
|
||||
0xb3, 0x62, 0xdd, 0xa1, 0x46, 0xdb, 0x6d, 0x97, 0x93, 0x9f, 0x8a, 0xc3,
|
||||
0x9b, 0x64, 0x7e, 0x42, 0xe3, 0x32, 0x57, 0x19, 0x1b, 0xd5, 0x6e, 0x85,
|
||||
0xfa, 0xb8, 0x8d, 0x02, 0x41, 0x00, 0xbc, 0x3d, 0xde, 0x6d, 0xd6, 0x97,
|
||||
0xe8, 0xba, 0x9e, 0x81, 0x37, 0x17, 0xe5, 0xa0, 0x64, 0xc9, 0x00, 0xb7,
|
||||
0xe7, 0xfe, 0xf4, 0x29, 0xd9, 0x2e, 0x43, 0x6b, 0x19, 0x20, 0xbd, 0x99,
|
||||
0x75, 0xe7, 0x76, 0xf8, 0xd3, 0xae, 0xaf, 0x7e, 0xb8, 0xeb, 0x81, 0xf4,
|
||||
0x9d, 0xfe, 0x07, 0x2b, 0x0b, 0x63, 0x0b, 0x5a, 0x55, 0x90, 0x71, 0x7d,
|
||||
0xf1, 0xdb, 0xd9, 0xb1, 0x41, 0x41, 0x68, 0x2f, 0x4e, 0x39, 0x02, 0x40,
|
||||
0x5a, 0x34, 0x66, 0xd8, 0xf5, 0xe2, 0x7f, 0x18, 0xb5, 0x00, 0x6e, 0x26,
|
||||
0x84, 0x27, 0x14, 0x93, 0xfb, 0xfc, 0xc6, 0x0f, 0x5e, 0x27, 0xe6, 0xe1,
|
||||
0xe9, 0xc0, 0x8a, 0xe4, 0x34, 0xda, 0xe9, 0xa2, 0x4b, 0x73, 0xbc, 0x8c,
|
||||
0xb9, 0xba, 0x13, 0x6c, 0x7a, 0x2b, 0x51, 0x84, 0xa3, 0x4a, 0xe0, 0x30,
|
||||
0x10, 0x06, 0x7e, 0xed, 0x17, 0x5a, 0x14, 0x00, 0xc9, 0xef, 0x85, 0xea,
|
||||
0x52, 0x2c, 0xbc, 0x65, 0x02, 0x40, 0x51, 0xe3, 0xf2, 0x83, 0x19, 0x9b,
|
||||
0xc4, 0x1e, 0x2f, 0x50, 0x3d, 0xdf, 0x5a, 0xa2, 0x18, 0xca, 0x5f, 0x2e,
|
||||
0x49, 0xaf, 0x6f, 0xcc, 0xfa, 0x65, 0x77, 0x94, 0xb5, 0xa1, 0x0a, 0xa9,
|
||||
0xd1, 0x8a, 0x39, 0x37, 0xf4, 0x0b, 0xa0, 0xd7, 0x82, 0x27, 0x5e, 0xae,
|
||||
0x17, 0x17, 0xa1, 0x1e, 0x54, 0x34, 0xbf, 0x6e, 0xc4, 0x8e, 0x99, 0x5d,
|
||||
0x08, 0xf1, 0x2d, 0x86, 0x9d, 0xa5, 0x20, 0x1b, 0xe5, 0xdf,
|
||||
};
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/*
|
||||
* kExampleECKeyDER is a sample EC private key encoded as an ECPrivateKey
|
||||
* structure.
|
||||
*/
|
||||
static const unsigned char kExampleECKeyDER[] = {
|
||||
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x07, 0x0f, 0x08, 0x72, 0x7a,
|
||||
0xd4, 0xa0, 0x4a, 0x9c, 0xdd, 0x59, 0xc9, 0x4d, 0x89, 0x68, 0x77, 0x08,
|
||||
0xb5, 0x6f, 0xc9, 0x5d, 0x30, 0x77, 0x0e, 0xe8, 0xd1, 0xc9, 0xce, 0x0a,
|
||||
0x8b, 0xb4, 0x6a, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
|
||||
0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xe6, 0x2b, 0x69,
|
||||
0xe2, 0xbf, 0x65, 0x9f, 0x97, 0xbe, 0x2f, 0x1e, 0x0d, 0x94, 0x8a, 0x4c,
|
||||
0xd5, 0x97, 0x6b, 0xb7, 0xa9, 0x1e, 0x0d, 0x46, 0xfb, 0xdd, 0xa9, 0xa9,
|
||||
0x1e, 0x9d, 0xdc, 0xba, 0x5a, 0x01, 0xe7, 0xd6, 0x97, 0xa8, 0x0a, 0x18,
|
||||
0xf9, 0xc3, 0xc4, 0xa3, 0x1e, 0x56, 0xe2, 0x7c, 0x83, 0x48, 0xdb, 0x16,
|
||||
0x1a, 0x1c, 0xf5, 0x1d, 0x7e, 0xf1, 0x94, 0x2d, 0x4b, 0xcf, 0x72, 0x22,
|
||||
0xc1,
|
||||
};
|
||||
|
||||
/*
|
||||
* kExampleBadECKeyDER is a sample EC private key encoded as an ECPrivateKey
|
||||
* structure. The private key is equal to the order and will fail to import
|
||||
*/
|
||||
static const unsigned char kExampleBadECKeyDER[] = {
|
||||
0x30, 0x66, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48,
|
||||
0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03,
|
||||
0x01, 0x07, 0x04, 0x4C, 0x30, 0x4A, 0x02, 0x01, 0x01, 0x04, 0x20, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84, 0xF3,
|
||||
0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51, 0xA1, 0x23, 0x03, 0x21, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84,
|
||||
0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51
|
||||
};
|
||||
#endif
|
||||
|
||||
static EVP_PKEY *load_example_rsa_key(void)
|
||||
{
|
||||
EVP_PKEY *ret = NULL;
|
||||
const unsigned char *derp = kExampleRSAKeyDER;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
RSA *rsa = NULL;
|
||||
|
||||
if (!d2i_RSAPrivateKey(&rsa, &derp, sizeof(kExampleRSAKeyDER))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pkey = EVP_PKEY_new();
|
||||
if (pkey == NULL || !EVP_PKEY_set1_RSA(pkey, rsa)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = pkey;
|
||||
pkey = NULL;
|
||||
|
||||
out:
|
||||
if (pkey) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
if (rsa) {
|
||||
RSA_free(rsa);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_EVP_DigestSignInit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
unsigned char *sig = NULL;
|
||||
size_t sig_len = 0;
|
||||
EVP_MD_CTX md_ctx, md_ctx_verify;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_MD_CTX_init(&md_ctx_verify);
|
||||
|
||||
pkey = load_example_rsa_key();
|
||||
if (pkey == NULL ||
|
||||
!EVP_DigestSignInit(&md_ctx, NULL, EVP_sha256(), NULL, pkey) ||
|
||||
!EVP_DigestSignUpdate(&md_ctx, kMsg, sizeof(kMsg))) {
|
||||
goto out;
|
||||
}
|
||||
/* Determine the size of the signature. */
|
||||
if (!EVP_DigestSignFinal(&md_ctx, NULL, &sig_len)) {
|
||||
goto out;
|
||||
}
|
||||
/* Sanity check for testing. */
|
||||
if (sig_len != (size_t)EVP_PKEY_size(pkey)) {
|
||||
fprintf(stderr, "sig_len mismatch\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sig = OPENSSL_malloc(sig_len);
|
||||
if (sig == NULL || !EVP_DigestSignFinal(&md_ctx, sig, &sig_len)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Ensure that the signature round-trips. */
|
||||
if (!EVP_DigestVerifyInit(&md_ctx_verify, NULL, EVP_sha256(), NULL, pkey)
|
||||
|| !EVP_DigestVerifyUpdate(&md_ctx_verify, kMsg, sizeof(kMsg))
|
||||
|| !EVP_DigestVerifyFinal(&md_ctx_verify, sig, sig_len)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
out:
|
||||
if (!ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
EVP_MD_CTX_cleanup(&md_ctx);
|
||||
EVP_MD_CTX_cleanup(&md_ctx_verify);
|
||||
if (pkey) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
if (sig) {
|
||||
OPENSSL_free(sig);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_EVP_DigestVerifyInit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_MD_CTX md_ctx;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
|
||||
pkey = load_example_rsa_key();
|
||||
if (pkey == NULL ||
|
||||
!EVP_DigestVerifyInit(&md_ctx, NULL, EVP_sha256(), NULL, pkey) ||
|
||||
!EVP_DigestVerifyUpdate(&md_ctx, kMsg, sizeof(kMsg)) ||
|
||||
!EVP_DigestVerifyFinal(&md_ctx, kSignature, sizeof(kSignature))) {
|
||||
goto out;
|
||||
}
|
||||
ret = 1;
|
||||
|
||||
out:
|
||||
if (!ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
EVP_MD_CTX_cleanup(&md_ctx);
|
||||
if (pkey) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_d2i_AutoPrivateKey(const unsigned char *input,
|
||||
size_t input_len, int expected_id)
|
||||
{
|
||||
int ret = 0;
|
||||
const unsigned char *p;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
|
||||
p = input;
|
||||
pkey = d2i_AutoPrivateKey(NULL, &p, input_len);
|
||||
if (pkey == NULL || p != input + input_len) {
|
||||
fprintf(stderr, "d2i_AutoPrivateKey failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_id(pkey) != expected_id) {
|
||||
fprintf(stderr, "Did not decode expected type\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
done:
|
||||
if (!ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
if (pkey != NULL) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/* Tests loading a bad key in PKCS8 format */
|
||||
static int test_EVP_PKCS82PKEY(void)
|
||||
{
|
||||
int ret = 0;
|
||||
const unsigned char *derp = kExampleBadECKeyDER;
|
||||
PKCS8_PRIV_KEY_INFO *p8inf = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
|
||||
p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &derp, sizeof(kExampleBadECKeyDER));
|
||||
|
||||
if (!p8inf || derp != kExampleBadECKeyDER + sizeof(kExampleBadECKeyDER)) {
|
||||
fprintf(stderr, "Failed to parse key\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
pkey = EVP_PKCS82PKEY(p8inf);
|
||||
if (pkey) {
|
||||
fprintf(stderr, "Imported invalid EC key\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
done:
|
||||
if (p8inf != NULL) {
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
}
|
||||
|
||||
if (pkey != NULL) {
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CRYPTO_malloc_debug_init();
|
||||
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
|
||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
/* Load up the software EVP_CIPHER and EVP_MD definitions */
|
||||
OpenSSL_add_all_ciphers();
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
if (!test_EVP_DigestSignInit()) {
|
||||
fprintf(stderr, "EVP_DigestSignInit failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!test_EVP_DigestVerifyInit()) {
|
||||
fprintf(stderr, "EVP_DigestVerifyInit failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!test_d2i_AutoPrivateKey(kExampleRSAKeyDER, sizeof(kExampleRSAKeyDER),
|
||||
EVP_PKEY_RSA)) {
|
||||
fprintf(stderr, "d2i_AutoPrivateKey(kExampleRSAKeyDER) failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!test_d2i_AutoPrivateKey
|
||||
(kExampleRSAKeyPKCS8, sizeof(kExampleRSAKeyPKCS8), EVP_PKEY_RSA)) {
|
||||
fprintf(stderr, "d2i_AutoPrivateKey(kExampleRSAKeyPKCS8) failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
if (!test_d2i_AutoPrivateKey(kExampleECKeyDER, sizeof(kExampleECKeyDER),
|
||||
EVP_PKEY_EC)) {
|
||||
fprintf(stderr, "d2i_AutoPrivateKey(kExampleECKeyDER) failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!test_EVP_PKCS82PKEY()) {
|
||||
fprintf(stderr, "test_EVP_PKCS82PKEY failed\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
EVP_cleanup();
|
||||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_remove_thread_state(NULL);
|
||||
ERR_free_strings();
|
||||
CRYPTO_mem_leaks_fp(stderr);
|
||||
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
@@ -500,6 +500,8 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
|
||||
EX_CLASS_ITEM *item;
|
||||
void *ptr;
|
||||
CRYPTO_EX_DATA_FUNCS **storage = NULL;
|
||||
if (ex_data == NULL)
|
||||
return;
|
||||
if ((item = def_get_class(class_index)) == NULL)
|
||||
return;
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
|
||||
|
@@ -852,7 +852,11 @@ void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block)
|
||||
{
|
||||
gcm_init_4bit(ctx->Htable, ctx->H.u);
|
||||
ctx->gmult = gcm_gmult_4bit;
|
||||
# if defined(GHASH)
|
||||
ctx->ghash = gcm_ghash_4bit;
|
||||
# else
|
||||
ctx->ghash = NULL;
|
||||
# endif
|
||||
}
|
||||
# elif defined(GHASH_ASM_SPARC)
|
||||
if (OPENSSL_sparcv9cap_P[0] & SPARCV9_VIS3) {
|
||||
@@ -872,7 +876,11 @@ void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block)
|
||||
} else {
|
||||
gcm_init_4bit(ctx->Htable, ctx->H.u);
|
||||
ctx->gmult = gcm_gmult_4bit;
|
||||
# if defined(GHASH)
|
||||
ctx->ghash = gcm_ghash_4bit;
|
||||
# else
|
||||
ctx->ghash = NULL;
|
||||
# endif
|
||||
}
|
||||
# else
|
||||
gcm_init_4bit(ctx->Htable, ctx->H.u);
|
||||
|
@@ -312,15 +312,18 @@ void OBJ_NAME_do_all_sorted(int type,
|
||||
d.type = type;
|
||||
d.names =
|
||||
OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh) * sizeof *d.names);
|
||||
d.n = 0;
|
||||
OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
|
||||
/* Really should return an error if !d.names...but its a void function! */
|
||||
if(d.names) {
|
||||
d.n = 0;
|
||||
OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
|
||||
|
||||
qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
|
||||
qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
|
||||
|
||||
for (n = 0; n < d.n; ++n)
|
||||
fn(d.names[n], arg);
|
||||
for (n = 0; n < d.n; ++n)
|
||||
fn(d.names[n], arg);
|
||||
|
||||
OPENSSL_free((void *)d.names);
|
||||
OPENSSL_free((void *)d.names);
|
||||
}
|
||||
}
|
||||
|
||||
static int free_type;
|
||||
|
@@ -121,9 +121,9 @@ open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
|
||||
print OUT <<'EOF';
|
||||
/* crypto/objects/obj_mac.h */
|
||||
|
||||
/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
|
||||
* following command:
|
||||
* perl objects.pl objects.txt obj_mac.num obj_mac.h
|
||||
/*
|
||||
* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following
|
||||
* command: perl objects.pl objects.txt obj_mac.num obj_mac.h
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
@@ -132,21 +132,21 @@ print OUT <<'EOF';
|
||||
* 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:
|
||||
@@ -161,10 +161,10 @@ print OUT <<'EOF';
|
||||
* 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
|
||||
* 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
|
||||
@@ -176,28 +176,36 @@ print OUT <<'EOF';
|
||||
* 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.]
|
||||
*/
|
||||
|
||||
#define SN_undef "UNDEF"
|
||||
#define LN_undef "undefined"
|
||||
#define NID_undef 0
|
||||
#define OBJ_undef 0L
|
||||
|
||||
#define SN_undef "UNDEF"
|
||||
#define LN_undef "undefined"
|
||||
#define NID_undef 0
|
||||
#define OBJ_undef 0L
|
||||
EOF
|
||||
|
||||
sub expand
|
||||
{
|
||||
my $string = shift;
|
||||
|
||||
1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
foreach (sort { $a <=> $b } keys %ordern)
|
||||
{
|
||||
$Cname=$ordern{$_};
|
||||
print OUT "#define SN_",$Cname,"\t\t\"",$sn{$Cname},"\"\n" if $sn{$Cname} ne "";
|
||||
print OUT "#define LN_",$Cname,"\t\t\"",$ln{$Cname},"\"\n" if $ln{$Cname} ne "";
|
||||
print OUT "#define NID_",$Cname,"\t\t",$nid{$Cname},"\n" if $nid{$Cname} ne "";
|
||||
print OUT "#define OBJ_",$Cname,"\t\t",$obj{$Cname},"\n" if $obj{$Cname} ne "";
|
||||
print OUT "\n";
|
||||
print OUT expand("#define SN_$Cname\t\t\"$sn{$Cname}\"\n") if $sn{$Cname} ne "";
|
||||
print OUT expand("#define LN_$Cname\t\t\"$ln{$Cname}\"\n") if $ln{$Cname} ne "";
|
||||
print OUT expand("#define NID_$Cname\t\t$nid{$Cname}\n") if $nid{$Cname} ne "";
|
||||
print OUT expand("#define OBJ_$Cname\t\t$obj{$Cname}\n") if $obj{$Cname} ne "";
|
||||
}
|
||||
|
||||
close OUT;
|
||||
|
@@ -63,30 +63,36 @@ $pname =~ s|^.[^/]/||;
|
||||
print <<EOF;
|
||||
/* AUTOGENERATED BY $pname, DO NOT EDIT */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
typedef struct {
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
|
||||
static const nid_triple sigoid_srt[] =
|
||||
{
|
||||
static const nid_triple sigoid_srt[] = {
|
||||
EOF
|
||||
|
||||
foreach (@srt1)
|
||||
{
|
||||
my $xr = $_;
|
||||
my ($p1, $p2) = @{$xref_tbl{$_}};
|
||||
print "\t{NID_$xr, NID_$p1, NID_$p2},\n";
|
||||
}
|
||||
my $o1 = " {NID_$xr, NID_$p1,";
|
||||
my $o2 = "NID_$p2},";
|
||||
if (length("$o1 $o2") < 78)
|
||||
{
|
||||
print "$o1 $o2\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$o1\n $o2\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "\t};";
|
||||
print "};";
|
||||
print <<EOF;
|
||||
|
||||
|
||||
static const nid_triple * const sigoid_srt_xref[] =
|
||||
{
|
||||
static const nid_triple *const sigoid_srt_xref[] = {
|
||||
EOF
|
||||
|
||||
foreach (@srt2)
|
||||
@@ -95,10 +101,10 @@ foreach (@srt2)
|
||||
# If digest or signature algorithm is "undef" then the algorithm
|
||||
# needs special handling and is excluded from the cross reference table.
|
||||
next if $p1 eq "undef" || $p2 eq "undef";
|
||||
print "\t\&sigoid_srt\[$x\],\n";
|
||||
print " \&sigoid_srt\[$x\],\n";
|
||||
}
|
||||
|
||||
print "\t};\n\n";
|
||||
print "};\n";
|
||||
|
||||
sub check_oid
|
||||
{
|
||||
@@ -108,4 +114,3 @@ sub check_oid
|
||||
die "Not Found \"$chk\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,11 +30,11 @@ extern "C" {
|
||||
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
|
||||
* major minor fix final patch/beta)
|
||||
*/
|
||||
# define OPENSSL_VERSION_NUMBER 0x1000200fL
|
||||
# define OPENSSL_VERSION_NUMBER 0x1000201fL
|
||||
# ifdef OPENSSL_FIPS
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2-fips 22 Jan 2015"
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2a-fips 19 Mar 2015"
|
||||
# else
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2 22 Jan 2015"
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2a 19 Mar 2015"
|
||||
# endif
|
||||
# define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
|
||||
|
||||
|
@@ -1249,6 +1249,7 @@ $code.=<<___;
|
||||
fxor %f8, %f4, %f4
|
||||
fxor %f10, %f6, %f6
|
||||
|
||||
subcc $len, 2, $len
|
||||
stda %f0, [$out]0xe2 ! ASI_BLK_INIT, T4-specific
|
||||
add $out, 8, $out
|
||||
stda %f2, [$out]0xe2 ! ASI_BLK_INIT, T4-specific
|
||||
|
@@ -261,6 +261,25 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
|
||||
PKCS7_RECIP_INFO *ri = NULL;
|
||||
ASN1_OCTET_STRING *os = NULL;
|
||||
|
||||
if (p7 == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_INVALID_NULL_POINTER);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
* The content field in the PKCS7 ContentInfo is optional, but that really
|
||||
* only applies to inner content (precisely, detached signatures).
|
||||
*
|
||||
* When reading content, missing outer content is therefore treated as an
|
||||
* error.
|
||||
*
|
||||
* When creating content, PKCS7_content_new() must be called before
|
||||
* calling this method, so a NULL p7->d is always an error.
|
||||
*/
|
||||
if (p7->d.ptr == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_NO_CONTENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i = OBJ_obj2nid(p7->type);
|
||||
p7->state = PKCS7_S_HEADER;
|
||||
|
||||
@@ -411,6 +430,16 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
|
||||
unsigned char *ek = NULL, *tkey = NULL;
|
||||
int eklen = 0, tkeylen = 0;
|
||||
|
||||
if (p7 == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p7->d.ptr == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i = OBJ_obj2nid(p7->type);
|
||||
p7->state = PKCS7_S_HEADER;
|
||||
|
||||
@@ -707,6 +736,16 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL;
|
||||
ASN1_OCTET_STRING *os = NULL;
|
||||
|
||||
if (p7 == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (p7->d.ptr == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVP_MD_CTX_init(&ctx_tmp);
|
||||
i = OBJ_obj2nid(p7->type);
|
||||
p7->state = PKCS7_S_HEADER;
|
||||
@@ -746,6 +785,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
|
||||
/* If detached data then the content is excluded */
|
||||
if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) {
|
||||
M_ASN1_OCTET_STRING_free(os);
|
||||
os = NULL;
|
||||
p7->d.sign->contents->d.data = NULL;
|
||||
}
|
||||
break;
|
||||
@@ -755,6 +795,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
|
||||
/* If detached data then the content is excluded */
|
||||
if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) {
|
||||
M_ASN1_OCTET_STRING_free(os);
|
||||
os = NULL;
|
||||
p7->d.digest->contents->d.data = NULL;
|
||||
}
|
||||
break;
|
||||
@@ -820,22 +861,30 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
|
||||
M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
|
||||
}
|
||||
|
||||
if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF)) {
|
||||
char *cont;
|
||||
long contlen;
|
||||
btmp = BIO_find_type(bio, BIO_TYPE_MEM);
|
||||
if (btmp == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
|
||||
goto err;
|
||||
}
|
||||
contlen = BIO_get_mem_data(btmp, &cont);
|
||||
if (!PKCS7_is_detached(p7)) {
|
||||
/*
|
||||
* Mark the BIO read only then we can use its copy of the data
|
||||
* instead of making an extra copy.
|
||||
* NOTE(emilia): I think we only reach os == NULL here because detached
|
||||
* digested data support is broken.
|
||||
*/
|
||||
BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
|
||||
BIO_set_mem_eof_return(btmp, 0);
|
||||
ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
|
||||
if (os == NULL)
|
||||
goto err;
|
||||
if (!(os->flags & ASN1_STRING_FLAG_NDEF)) {
|
||||
char *cont;
|
||||
long contlen;
|
||||
btmp = BIO_find_type(bio, BIO_TYPE_MEM);
|
||||
if (btmp == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
|
||||
goto err;
|
||||
}
|
||||
contlen = BIO_get_mem_data(btmp, &cont);
|
||||
/*
|
||||
* Mark the BIO read only then we can use its copy of the data
|
||||
* instead of making an extra copy.
|
||||
*/
|
||||
BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
|
||||
BIO_set_mem_eof_return(btmp, 0);
|
||||
ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
err:
|
||||
@@ -910,6 +959,16 @@ int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio,
|
||||
STACK_OF(X509) *cert;
|
||||
X509 *x509;
|
||||
|
||||
if (p7 == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_INVALID_NULL_POINTER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (p7->d.ptr == NULL) {
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_NO_CONTENT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PKCS7_type_is_signed(p7)) {
|
||||
cert = p7->d.sign->cert;
|
||||
} else if (PKCS7_type_is_signedAndEnveloped(p7)) {
|
||||
|
@@ -70,6 +70,7 @@ long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
|
||||
nid = OBJ_obj2nid(p7->type);
|
||||
|
||||
switch (cmd) {
|
||||
/* NOTE(emilia): does not support detached digested data. */
|
||||
case PKCS7_OP_SET_DETACHED_SIGNATURE:
|
||||
if (nid == NID_pkcs7_signed) {
|
||||
ret = p7->detached = (int)larg;
|
||||
@@ -444,6 +445,8 @@ int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md)
|
||||
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
|
||||
{
|
||||
if (p7 == NULL || p7->d.ptr == NULL)
|
||||
return NULL;
|
||||
if (PKCS7_type_is_signed(p7)) {
|
||||
return (p7->d.sign->signer_info);
|
||||
} else if (PKCS7_type_is_signedAndEnveloped(p7)) {
|
||||
|
@@ -113,6 +113,7 @@ int RAND_egd_bytes(const char *path, int bytes)
|
||||
#else
|
||||
# include <openssl/opensslconf.h>
|
||||
# include OPENSSL_UNISTD
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# ifndef NO_SYS_UN_H
|
||||
|
@@ -149,6 +149,9 @@ int RAND_poll(void)
|
||||
if (DosQuerySysState) {
|
||||
char *buffer = OPENSSL_malloc(256 * 1024);
|
||||
|
||||
if(!buffer)
|
||||
return 0;
|
||||
|
||||
if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
|
||||
/*
|
||||
* First 4 bytes in buffer is a pointer to the thread count there
|
||||
|
@@ -698,9 +698,10 @@ static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
|
||||
RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE);
|
||||
return -1;
|
||||
}
|
||||
if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey))
|
||||
if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) {
|
||||
/* Carry on */
|
||||
return 2;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -261,19 +261,8 @@ int int_rsa_verify(int dtype, const unsigned char *m,
|
||||
OBJ_nid2ln(dtype));
|
||||
#endif
|
||||
if (sigtype != dtype) {
|
||||
if (((dtype == NID_md5) &&
|
||||
(sigtype == NID_md5WithRSAEncryption)) ||
|
||||
((dtype == NID_md2) &&
|
||||
(sigtype == NID_md2WithRSAEncryption))) {
|
||||
/* ok, we will let it through */
|
||||
#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
|
||||
fprintf(stderr,
|
||||
"signature has problems, re-make with post SSLeay045\n");
|
||||
#endif
|
||||
} else {
|
||||
RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_ALGORITHM_MISMATCH);
|
||||
goto err;
|
||||
}
|
||||
RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_ALGORITHM_MISMATCH);
|
||||
goto err;
|
||||
}
|
||||
if (rm) {
|
||||
const EVP_MD *md;
|
||||
|
@@ -450,7 +450,7 @@ sub sha1msg2 { sha1op38(0xca,@_); }
|
||||
&sub ("esp",32);
|
||||
|
||||
&movdqu ($ABCD,&QWP(0,$ctx));
|
||||
&movd ($E,&QWP(16,$ctx));
|
||||
&movd ($E,&DWP(16,$ctx));
|
||||
&and ("esp",-32);
|
||||
&movdqa ($BSWAP,&QWP(0x50,$tmp1)); # byte-n-word swap
|
||||
|
||||
|
@@ -312,7 +312,7 @@ void sk_zero(_STACK *st)
|
||||
return;
|
||||
if (st->num <= 0)
|
||||
return;
|
||||
memset((char *)st->data, 0, sizeof(st->data) * st->num);
|
||||
memset((char *)st->data, 0, sizeof(*st->data) * st->num);
|
||||
st->num = 0;
|
||||
}
|
||||
|
||||
|
@@ -117,6 +117,10 @@ void CRYPTO_thread_setup(void)
|
||||
int i;
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
|
||||
if(!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
lock_cs[i] = CreateMutex(NULL, FALSE, NULL);
|
||||
}
|
||||
@@ -168,6 +172,10 @@ void CRYPTO_thread_setup(void)
|
||||
# else
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(rwlock_t));
|
||||
# endif
|
||||
if(!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
lock_count[i] = 0;
|
||||
@@ -251,6 +259,12 @@ void CRYPTO_thread_setup(void)
|
||||
int i;
|
||||
char filename[20];
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
|
||||
if(!lock_cs) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(filename, "/tmp/mttest.XXXXXX");
|
||||
mktemp(filename);
|
||||
|
||||
@@ -261,7 +275,6 @@ void CRYPTO_thread_setup(void)
|
||||
arena = usinit(filename);
|
||||
unlink(filename);
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
lock_cs[i] = usnewsema(arena, 1);
|
||||
}
|
||||
@@ -315,6 +328,14 @@ void CRYPTO_thread_setup(void)
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
|
||||
lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
|
||||
if(!lock_cs || !lock_count) {
|
||||
/* Nothing we can do about this...void function! */
|
||||
if(lock_cs)
|
||||
OPENSSL_free(lock_cs);
|
||||
if(lock_count)
|
||||
OPENSSL_free(lock_count);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
lock_count[i] = 0;
|
||||
pthread_mutex_init(&(lock_cs[i]), NULL);
|
||||
|
@@ -185,43 +185,37 @@
|
||||
|
||||
/*
|
||||
* There are 5 types of terminal interface supported, TERMIO, TERMIOS, VMS,
|
||||
* MSDOS and SGTTY
|
||||
* MSDOS and SGTTY.
|
||||
*
|
||||
* If someone defines one of the macros TERMIO, TERMIOS or SGTTY, it will
|
||||
* remain respected. Otherwise, we default to TERMIOS except for a few
|
||||
* systems that require something different.
|
||||
*
|
||||
* Note: we do not use SGTTY unless it's defined by the configuration. We
|
||||
* may eventually opt to remove it's use entirely.
|
||||
*/
|
||||
|
||||
#if defined(__sgi) && !defined(TERMIOS)
|
||||
# define TERMIOS
|
||||
# undef TERMIO
|
||||
# undef SGTTY
|
||||
#endif
|
||||
#if !defined(TERMIOS) && !defined(TERMIO) && !defined(SGTTY)
|
||||
|
||||
#if defined(linux) && !defined(TERMIO)
|
||||
# undef TERMIOS
|
||||
# define TERMIO
|
||||
# undef SGTTY
|
||||
#endif
|
||||
# if defined(_LIBC)
|
||||
# undef TERMIOS
|
||||
# define TERMIO
|
||||
# undef SGTTY
|
||||
/*
|
||||
* We know that VMS, MSDOS, VXWORKS, NETWARE use entirely other mechanisms.
|
||||
* MAC_OS_GUSI_SOURCE should probably go away, but that needs to be confirmed.
|
||||
*/
|
||||
# elif !defined(OPENSSL_SYS_VMS) \
|
||||
&& !defined(OPENSSL_SYS_MSDOS) \
|
||||
&& !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) \
|
||||
&& !defined(MAC_OS_GUSI_SOURCE) \
|
||||
&& !defined(OPENSSL_SYS_VXWORKS) \
|
||||
&& !defined(OPENSSL_SYS_NETWARE)
|
||||
# define TERMIOS
|
||||
# undef TERMIO
|
||||
# undef SGTTY
|
||||
# endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# undef TERMIOS
|
||||
# define TERMIO
|
||||
# undef SGTTY
|
||||
#endif
|
||||
|
||||
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(MAC_OS_GUSI_SOURCE)
|
||||
# undef TERMIOS
|
||||
# undef TERMIO
|
||||
# define SGTTY
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_SYS_VXWORKS)
|
||||
# undef TERMIOS
|
||||
# undef TERMIO
|
||||
# undef SGTTY
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_SYS_NETWARE)
|
||||
# undef TERMIOS
|
||||
# undef TERMIO
|
||||
# undef SGTTY
|
||||
#endif
|
||||
|
||||
#ifdef TERMIOS
|
||||
|
@@ -92,6 +92,8 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
|
||||
goto err;
|
||||
|
||||
pktmp = X509_get_pubkey(x);
|
||||
if (pktmp == NULL)
|
||||
goto err;
|
||||
i = X509_REQ_set_pubkey(ret, pktmp);
|
||||
EVP_PKEY_free(pktmp);
|
||||
if (!i)
|
||||
|
@@ -230,8 +230,12 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
goto merr;
|
||||
if (!sk_POLICYQUALINFO_push(pol->qualifiers, qual))
|
||||
goto merr;
|
||||
qual->pqualid = OBJ_nid2obj(NID_id_qt_cps);
|
||||
qual->d.cpsuri = M_ASN1_IA5STRING_new();
|
||||
if(!(qual->pqualid = OBJ_nid2obj(NID_id_qt_cps))) {
|
||||
X509V3err(X509V3_F_POLICY_SECTION, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if(!(qual->d.cpsuri = M_ASN1_IA5STRING_new()))
|
||||
goto merr;
|
||||
if (!ASN1_STRING_set(qual->d.cpsuri, cnf->value,
|
||||
strlen(cnf->value)))
|
||||
goto merr;
|
||||
@@ -290,14 +294,18 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
|
||||
POLICYQUALINFO *qual;
|
||||
if (!(qual = POLICYQUALINFO_new()))
|
||||
goto merr;
|
||||
qual->pqualid = OBJ_nid2obj(NID_id_qt_unotice);
|
||||
if(!(qual->pqualid = OBJ_nid2obj(NID_id_qt_unotice))) {
|
||||
X509V3err(X509V3_F_NOTICE_SECTION, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if (!(not = USERNOTICE_new()))
|
||||
goto merr;
|
||||
qual->d.usernotice = not;
|
||||
for (i = 0; i < sk_CONF_VALUE_num(unot); i++) {
|
||||
cnf = sk_CONF_VALUE_value(unot, i);
|
||||
if (!strcmp(cnf->name, "explicitText")) {
|
||||
not->exptext = M_ASN1_VISIBLESTRING_new();
|
||||
if(!(not->exptext = M_ASN1_VISIBLESTRING_new()))
|
||||
goto merr;
|
||||
if (!ASN1_STRING_set(not->exptext, cnf->value,
|
||||
strlen(cnf->value)))
|
||||
goto merr;
|
||||
|
@@ -901,8 +901,13 @@ static int do_check_string(ASN1_STRING *a, int cmp_type, equal_fn equal,
|
||||
int astrlen;
|
||||
unsigned char *astr;
|
||||
astrlen = ASN1_STRING_to_UTF8(&astr, a);
|
||||
if (astrlen < 0)
|
||||
if (astrlen < 0) {
|
||||
/*
|
||||
* -1 could be an internal malloc failure or a decoding error from
|
||||
* malformed input; we can't distinguish.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
rv = equal(astr, astrlen, (unsigned char *)b, blen, flags);
|
||||
if (rv > 0 && peername)
|
||||
*peername = BUF_strndup((char *)astr, astrlen);
|
||||
|
@@ -109,8 +109,8 @@ The following is a list of all permitted cipher strings and their meanings.
|
||||
|
||||
=item B<DEFAULT>
|
||||
|
||||
the default cipher list. This is determined at compile time and, as of OpenSSL
|
||||
1.0.0, is normally B<ALL:!aNULL:!eNULL>. This must be the first cipher string
|
||||
the default cipher list. This is determined at compile time and
|
||||
is normally B<ALL:!EXPORT:!aNULL:!eNULL:!SSLv2>. This must be the firstcipher string
|
||||
specified.
|
||||
|
||||
=item B<COMPLEMENTOFDEFAULT>
|
||||
|
@@ -89,8 +89,7 @@ section containing configuration module specific information. E.g.
|
||||
|
||||
... engine stuff here ...
|
||||
|
||||
Currently there are two configuration modules. One for ASN1 objects another
|
||||
for ENGINE configuration.
|
||||
The features of each configuration module are described below.
|
||||
|
||||
=head2 ASN1 OBJECT CONFIGURATION MODULE
|
||||
|
||||
@@ -191,6 +190,25 @@ For example:
|
||||
# Supply all default algorithms
|
||||
default_algorithms = ALL
|
||||
|
||||
=head2 EVP CONFIGURATION MODULE
|
||||
|
||||
This modules has the name B<alg_section> which points to a section containing
|
||||
algorithm commands.
|
||||
|
||||
Currently the only algorithm command supported is B<fips_mode> whose
|
||||
value should be a boolean string such as B<on> or B<off>. If the value is
|
||||
B<on> this attempt to enter FIPS mode. If the call fails or the library is
|
||||
not FIPS capable then an error occurs.
|
||||
|
||||
For example:
|
||||
|
||||
alg_section = evp_settings
|
||||
|
||||
[evp_settings]
|
||||
|
||||
fips_mode = on
|
||||
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
If a configuration file attempts to expand a variable that doesn't exist
|
||||
|
@@ -40,6 +40,7 @@ B<openssl> B<ocsp>
|
||||
[B<-no_cert_verify>]
|
||||
[B<-no_chain>]
|
||||
[B<-no_cert_checks>]
|
||||
[B<-no_explicit>]
|
||||
[B<-port num>]
|
||||
[B<-index file>]
|
||||
[B<-CA file>]
|
||||
@@ -189,6 +190,10 @@ testing purposes.
|
||||
do not use certificates in the response as additional untrusted CA
|
||||
certificates.
|
||||
|
||||
=item B<-no_explicit>
|
||||
|
||||
do not explicitly trust the root CA if it is set to be trusted for OCSP signing.
|
||||
|
||||
=item B<-no_cert_checks>
|
||||
|
||||
don't perform any additional checks on the OCSP response signers certificate.
|
||||
@@ -301,8 +306,9 @@ CA certificate in the request. If there is a match and the OCSPSigning
|
||||
extended key usage is present in the OCSP responder certificate then the
|
||||
OCSP verify succeeds.
|
||||
|
||||
Otherwise the root CA of the OCSP responders CA is checked to see if it
|
||||
is trusted for OCSP signing. If it is the OCSP verify succeeds.
|
||||
Otherwise, if B<-no_explicit> is B<not> set the root CA of the OCSP responders
|
||||
CA is checked to see if it is trusted for OCSP signing. If it is the OCSP
|
||||
verify succeeds.
|
||||
|
||||
If none of these checks is successful then the OCSP verify fails.
|
||||
|
||||
|
129
doc/crypto/ASN1_TIME_set.pod
Normal file
129
doc/crypto/ASN1_TIME_set.pod
Normal file
@@ -0,0 +1,129 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
ASN1_TIME_set, ASN1_TIME_adj, ASN1_TIME_check, ASN1_TIME_set_string,
|
||||
ASN1_TIME_print, ASN1_TIME_diff - ASN.1 Time functions.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
|
||||
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
|
||||
int offset_day, long offset_sec);
|
||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
|
||||
int ASN1_TIME_check(const ASN1_TIME *t);
|
||||
int ASN1_TIME_print(BIO *b, const ASN1_TIME *s);
|
||||
|
||||
int ASN1_TIME_diff(int *pday, int *psec,
|
||||
const ASN1_TIME *from, const ASN1_TIME *to);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The function ASN1_TIME_set() sets the ASN1_TIME structure B<s> to the
|
||||
time represented by the time_t value B<t>. If B<s> is NULL a new ASN1_TIME
|
||||
structure is allocated and returned.
|
||||
|
||||
ASN1_TIME_adj() sets the ASN1_TIME structure B<s> to the time represented
|
||||
by the time B<offset_day> and B<offset_sec> after the time_t value B<t>.
|
||||
The values of B<offset_day> or B<offset_sec> can be negative to set a
|
||||
time before B<t>. The B<offset_sec> value can also exceed the number of
|
||||
seconds in a day. If B<s> is NULL a new ASN1_TIME structure is allocated
|
||||
and returned.
|
||||
|
||||
ASN1_TIME_set_string() sets ASN1_TIME structure B<s> to the time
|
||||
represented by string B<str> which must be in appropriate ASN.1 time
|
||||
format (for example YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ).
|
||||
|
||||
ASN1_TIME_check() checks the syntax of ASN1_TIME structure B<s>.
|
||||
|
||||
ASN1_TIME_print() prints out the time B<s> to BIO B<b> in human readable
|
||||
format. It will be of the format MMM DD HH:MM:SS YYYY [GMT], for example
|
||||
"Feb 3 00:55:52 2015 GMT" it does not include a newline. If the time
|
||||
structure has invalid format it prints out "Bad time value" and returns
|
||||
an error.
|
||||
|
||||
ASN1_TIME_diff() sets B<*pday> and B<*psec> to the time difference between
|
||||
B<from> and B<to>. If B<to> represents a time later than B<from> then
|
||||
one or both (depending on the time difference) of B<*pday> and B<*psec>
|
||||
will be positive. If B<to> represents a time earlier than B<from> then
|
||||
one or both of B<*pday> and B<*psec> will be negative. If B<to> and B<from>
|
||||
represent the same time then B<*pday> and B<*psec> will both be zero.
|
||||
If both B<*pday> and B<*psec> are non-zero they will always have the same
|
||||
sign. The value of B<*psec> will always be less than the number of seconds
|
||||
in a day. If B<from> or B<to> is NULL the current time is used.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
The ASN1_TIME structure corresponds to the ASN.1 structure B<Time>
|
||||
defined in RFC5280 et al. The time setting functions obey the rules outlined
|
||||
in RFC5280: if the date can be represented by UTCTime it is used, else
|
||||
GeneralizedTime is used.
|
||||
|
||||
The ASN1_TIME structure is represented as an ASN1_STRING internally and can
|
||||
be freed up using ASN1_STRING_free().
|
||||
|
||||
The ASN1_TIME structure can represent years from 0000 to 9999 but no attempt
|
||||
is made to correct ancient calendar changes (for example from Julian to
|
||||
Gregorian calendars).
|
||||
|
||||
Some applications add offset times directly to a time_t value and pass the
|
||||
results to ASN1_TIME_set() (or equivalent). This can cause problems as the
|
||||
time_t value can overflow on some systems resulting in unexpected results.
|
||||
New applications should use ASN1_TIME_adj() instead and pass the offset value
|
||||
in the B<offset_sec> and B<offset_day> parameters instead of directly
|
||||
manipulating a time_t value.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
ASN1_TIME_print() currently does not print out the time zone: it either prints
|
||||
out "GMT" or nothing. But all certificates complying with RFC5280 et al use GMT
|
||||
anyway.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Set a time structure to one hour after the current time and print it out:
|
||||
|
||||
#include <time.h>
|
||||
#include <openssl/asn1.h>
|
||||
ASN1_TIME *tm;
|
||||
time_t t;
|
||||
BIO *b;
|
||||
t = time(NULL);
|
||||
tm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);
|
||||
b = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
ASN1_TIME_print(b, tm);
|
||||
ASN1_STRING_free(tm);
|
||||
BIO_free(b);
|
||||
|
||||
Determine if one time is later or sooner than the current time:
|
||||
|
||||
int day, sec;
|
||||
|
||||
if (!ASN1_TIME_diff(&day, &sec, NULL, to))
|
||||
/* Invalid time format */
|
||||
|
||||
if (day > 0 || sec > 0)
|
||||
printf("Later\n");
|
||||
else if (day < 0 || sec < 0)
|
||||
printf("Sooner\n");
|
||||
else
|
||||
printf("Same\n");
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
ASN1_TIME_set() and ASN1_TIME_adj() return a pointer to an ASN1_TIME structure
|
||||
or NULL if an error occurred.
|
||||
|
||||
ASN1_TIME_set_string() returns 1 if the time value is successfully set and
|
||||
0 otherwise.
|
||||
|
||||
ASN1_TIME_check() returns 1 if the structure is syntactically correct and 0
|
||||
otherwise.
|
||||
|
||||
ASN1_TIME_print() returns 1 if the time is successfully printed out and 0 if
|
||||
an error occurred (I/O error or invalid time format).
|
||||
|
||||
ASN1_TIME_diff() returns 1 for sucess and 0 for failure. It can fail if the
|
||||
pass ASN1_TIME structure has invalid syntax for example.
|
||||
|
||||
=cut
|
@@ -2,7 +2,7 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType - get and set CMS content types
|
||||
CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
|
||||
int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
|
||||
const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
|
||||
ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -26,11 +27,15 @@ undefined.
|
||||
ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
|
||||
content type.
|
||||
|
||||
CMS_get0_content() returns a pointer to the B<ASN1_OCTET_STRING> pointer
|
||||
containing the embedded content.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
As the B<0> implies CMS_get0_type() and CMS_get0_eContentType() return internal
|
||||
pointers which should B<not> be freed up. CMS_set1_eContentType() copies the
|
||||
supplied OID and it B<should> be freed up after use.
|
||||
As the B<0> implies CMS_get0_type(), CMS_get0_eContentType() and
|
||||
CMS_get0_content() return internal pointers which should B<not> be freed up.
|
||||
CMS_set1_eContentType() copies the supplied OID and it B<should> be freed up
|
||||
after use.
|
||||
|
||||
The B<ASN1_OBJECT> values returned can be converted to an integer B<NID> value
|
||||
using OBJ_obj2nid(). For the currently supported content types the following
|
||||
@@ -43,6 +48,15 @@ values are returned:
|
||||
NID_pkcs7_encrypted
|
||||
NID_pkcs7_enveloped
|
||||
|
||||
The return value of CMS_get0_content() is a pointer to the B<ASN1_OCTET_STRING>
|
||||
content pointer. That means that for example:
|
||||
|
||||
ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);
|
||||
|
||||
B<*pconf> could be NULL if there is no embedded content. Applications can
|
||||
access, modify or create the embedded content in a B<CMS_ContentInfo> structure
|
||||
using this function. Applications usually will not need to modify the
|
||||
embedded content as it is normally set by higher level functions.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
|
@@ -9,9 +9,9 @@
|
||||
#include <openssl/conf.h>
|
||||
|
||||
int CONF_modules_load_file(const char *filename, const char *appname,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -22,7 +22,7 @@ NULL the standard OpenSSL application name B<openssl_conf> is used.
|
||||
The behaviour can be cutomized using B<flags>.
|
||||
|
||||
CONF_modules_load() is idential to CONF_modules_load_file() except it
|
||||
read configuration information from B<cnf>.
|
||||
reads configuration information from B<cnf>.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
@@ -30,7 +30,7 @@ The following B<flags> are currently recognized:
|
||||
|
||||
B<CONF_MFLAGS_IGNORE_ERRORS> if set errors returned by individual
|
||||
configuration modules are ignored. If not set the first module error is
|
||||
considered fatal and no further modules are loads.
|
||||
considered fatal and no further modules are loaded.
|
||||
|
||||
Normally any modules errors will add error information to the error queue. If
|
||||
B<CONF_MFLAGS_SILENT> is set no error information is added.
|
||||
@@ -42,7 +42,84 @@ B<CONF_MFLAGS_IGNORE_MISSING_FILE> if set will make CONF_load_modules_file()
|
||||
ignore missing configuration files. Normally a missing configuration file
|
||||
return an error.
|
||||
|
||||
=head1 RETURN VALUE
|
||||
B<CONF_MFLAGS_DEFAULT_SECTION> if set and B<appname> is not NULL will use the
|
||||
default section pointed to by B<openssl_conf> if B<appname> does not exist.
|
||||
|
||||
Applications should call these functions after loading builtin modules using
|
||||
OPENSSL_load_builtin_modules(), any ENGINEs for example using
|
||||
ENGINE_load_builtin_engines(), any algorithms for example
|
||||
OPENSSL_add_all_algorithms() and (if the application uses libssl)
|
||||
SSL_library_init().
|
||||
|
||||
By using CONF_modules_load_file() with appropriate flags an application can
|
||||
customise application configuration to best suit its needs. In some cases the
|
||||
use of a configuration file is optional and its absence is not an error: in
|
||||
this case B<CONF_MFLAGS_IGNORE_MISSING_FILE> would be set.
|
||||
|
||||
Errors during configuration may also be handled differently by different
|
||||
applications. For example in some cases an error may simply print out a warning
|
||||
message and the application continue. In other cases an application might
|
||||
consider a configuration file error as fatal and exit immediately.
|
||||
|
||||
Applications can use the CONF_modules_load() function if they wish to load a
|
||||
configuration file themselves and have finer control over how errors are
|
||||
treated.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Load a configuration file and print out any errors and exit (missing file
|
||||
considered fatal):
|
||||
|
||||
if (CONF_modules_load_file(NULL, NULL, 0) <= 0) {
|
||||
fprintf(stderr, "FATAL: error loading configuration file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Load default configuration file using the section indicated by "myapp",
|
||||
tolerate missing files, but exit on other errors:
|
||||
|
||||
if (CONF_modules_load_file(NULL, "myapp",
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
|
||||
fprintf(stderr, "FATAL: error loading configuration file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Load custom configuration file and section, only print warnings on error,
|
||||
missing configuration file ignored:
|
||||
|
||||
if (CONF_modules_load_file("/something/app.cnf", "myapp",
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
|
||||
fprintf(stderr, "WARNING: error loading configuration file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
Load and parse configuration file manually, custom error handling:
|
||||
|
||||
FILE *fp;
|
||||
CONF *cnf = NULL;
|
||||
long eline;
|
||||
fp = fopen("/somepath/app.cnf", "r");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "Error opening configuration file\n");
|
||||
/* Other missing configuration file behaviour */
|
||||
} else {
|
||||
cnf = NCONF_new(NULL);
|
||||
if (NCONF_load_fp(cnf, fp, &eline) == 0) {
|
||||
fprintf(stderr, "Error on line %ld of configuration file\n", eline);
|
||||
ERR_print_errors_fp(stderr);
|
||||
/* Other malformed configuration file behaviour */
|
||||
} else if (CONF_modules_load(cnf, "appname", 0) <= 0) {
|
||||
fprintf(stderr, "Error configuring application\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
/* Other configuration error behaviour */
|
||||
}
|
||||
fclose(fp);
|
||||
NCONF_free(cnf);
|
||||
}
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
These functions return 1 for success and a zero or negative value for
|
||||
failure. If module errors are not ignored the return code will reflect the
|
||||
|
@@ -24,8 +24,6 @@ EC_KEY_new, EC_KEY_get_flags, EC_KEY_set_flags, EC_KEY_clear_flags, EC_KEY_new_b
|
||||
int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
|
||||
const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
|
||||
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
|
||||
unsigned int EC_KEY_get_enc_flags(const EC_KEY *key);
|
||||
void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
|
||||
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
|
||||
void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
|
||||
void *EC_KEY_get_key_method_data(EC_KEY *key,
|
||||
@@ -69,16 +67,6 @@ on the key to confirm that it is valid.
|
||||
|
||||
The functions EC_KEY_get0_group, EC_KEY_set_group, EC_KEY_get0_private_key, EC_KEY_set_private_key, EC_KEY_get0_public_key, and EC_KEY_set_public_key get and set the EC_GROUP object, the private key and the EC_POINT public key for the B<key> respectively.
|
||||
|
||||
The functions EC_KEY_get_enc_flags and EC_KEY_set_enc_flags get and set the value of the encoding flags for the B<key>. There are two encoding
|
||||
flags currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags define the behaviour of how the B<key> is
|
||||
converted into ASN1 in a call to i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for the curve are not encoded
|
||||
along with the private key. If EC_PKEY_NO_PUBKEY is set then the public key is not encoded along with the private key.
|
||||
|
||||
When reading a private key encoded with EC_PKEY_NO_PUBKEY,
|
||||
d2i_ECPrivateKey generates the missing public key
|
||||
automatically. Private keys encoded with EC_PKEY_NO_PARAMETERS cannot
|
||||
be loaded using d2i_ECPrivateKey.
|
||||
|
||||
The functions EC_KEY_get_conv_form and EC_KEY_set_conv_form get and set the point_conversion_form for the B<key>. For a description
|
||||
of point_conversion_forms please refer to L<EC_POINT_new(3)|EC_POINT_new(3)>.
|
||||
|
||||
@@ -106,15 +94,15 @@ EC_KEY_get0_group returns the EC_GROUP associated with the EC_KEY.
|
||||
|
||||
EC_KEY_get0_private_key returns the private key associated with the EC_KEY.
|
||||
|
||||
EC_KEY_get_enc_flags returns the value of the current encoding flags for the EC_KEY.
|
||||
|
||||
EC_KEY_get_conv_form return the point_conversion_form for the EC_KEY.
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>,
|
||||
L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>,
|
||||
L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)>
|
||||
L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>,
|
||||
L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, L<EC_POINT_new(3)|EC_POINT_new(3)>,
|
||||
L<EC_POINT_add(3)|EC_POINT_add(3)>,
|
||||
L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>,
|
||||
L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)>
|
||||
|
||||
=cut
|
||||
|
@@ -81,8 +81,13 @@ on the curve there will only ever be two possible values for y. Therefore a poin
|
||||
and EC_POINT_set_compressed_coordinates_GF2m functions where B<x> is the x co-ordinate and B<y_bit> is a value 0 or 1 to identify which of
|
||||
the two possible values for y should be used.
|
||||
|
||||
In addition EC_POINTs can be converted to and from various external representations. Supported representations are octet strings, BIGNUMs and hexadecimal. The format of the external representation is described by the point_conversion_form. See L<EC_GROUP_copy(3)|EC_GROUP_copy(3)> for
|
||||
a description of point_conversion_form. Octet strings are stored in a buffer along with an associated buffer length. A point held in a BIGNUM is calculated by converting the point to an octet string and then converting that octet string into a BIGNUM integer. Points in hexadecimal format are stored in a NULL terminated character string where each character is one of the printable values 0-9 or A-F (or a-f).
|
||||
In addition EC_POINTs can be converted to and from various external
|
||||
representations. Supported representations are octet strings, BIGNUMs and
|
||||
hexadecimal. Octet strings are stored in a buffer along with an associated
|
||||
buffer length. A point held in a BIGNUM is calculated by converting the point to
|
||||
an octet string and then converting that octet string into a BIGNUM integer.
|
||||
Points in hexadecimal format are stored in a NULL terminated character string
|
||||
where each character is one of the printable values 0-9 or A-F (or a-f).
|
||||
|
||||
The functions EC_POINT_point2oct, EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex and EC_POINT_hex2point convert
|
||||
from and to EC_POINTs for the formats: octet string, BIGNUM and hexadecimal respectively.
|
||||
|
@@ -15,31 +15,24 @@ OPENSSL_config, OPENSSL_no_config - simple OpenSSL configuration functions
|
||||
|
||||
OPENSSL_config() configures OpenSSL using the standard B<openssl.cnf>
|
||||
configuration file name using B<config_name>. If B<config_name> is NULL then
|
||||
the default name B<openssl_conf> will be used. Any errors are ignored. Further
|
||||
calls to OPENSSL_config() will have no effect. The configuration file format
|
||||
is documented in the L<conf(5)|conf(5)> manual page.
|
||||
the file specified in the environment variable B<OPENSSL_CONF> will be used,
|
||||
and if that is not set then a system default location is used.
|
||||
Errors are silently ignored.
|
||||
Multiple calls have no effect.
|
||||
|
||||
OPENSSL_no_config() disables configuration. If called before OPENSSL_config()
|
||||
no configuration takes place.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
It is B<strongly> recommended that B<all> new applications call OPENSSL_config()
|
||||
or the more sophisticated functions such as CONF_modules_load() during
|
||||
initialization (that is before starting any threads). By doing this
|
||||
an application does not need to keep track of all configuration options
|
||||
and some new functionality can be supported automatically.
|
||||
|
||||
It is also possible to automatically call OPENSSL_config() when an application
|
||||
calls OPENSSL_add_all_algorithms() by compiling an application with the
|
||||
preprocessor symbol B<OPENSSL_LOAD_CONF> #define'd. In this way configuration
|
||||
can be added without source changes.
|
||||
|
||||
The environment variable B<OPENSSL_CONF> can be set to specify the location
|
||||
of the configuration file.
|
||||
|
||||
Currently ASN1 OBJECTs and ENGINE configuration can be performed future
|
||||
versions of OpenSSL will add new configuration options.
|
||||
The OPENSSL_config() function is designed to be a very simple "call it and
|
||||
forget it" function.
|
||||
It is however B<much> better than nothing. Applications which need finer
|
||||
control over their configuration functionality should use the configuration
|
||||
functions such as CONF_modules_load() directly. This function is deprecated
|
||||
and its use should be avoided.
|
||||
Applications should instead call CONF_modules_load() during
|
||||
initialization (that is before starting any threads).
|
||||
|
||||
There are several reasons why calling the OpenSSL configuration routines is
|
||||
advisable. For example new ENGINE functionality was added to OpenSSL 0.9.7.
|
||||
@@ -55,17 +48,6 @@ configuration file.
|
||||
Applications should free up configuration at application closedown by calling
|
||||
CONF_modules_free().
|
||||
|
||||
=head1 RESTRICTIONS
|
||||
|
||||
The OPENSSL_config() function is designed to be a very simple "call it and
|
||||
forget it" function. As a result its behaviour is somewhat limited. It ignores
|
||||
all errors silently and it can only load from the standard configuration file
|
||||
location for example.
|
||||
|
||||
It is however B<much> better than nothing. Applications which need finer
|
||||
control over their configuration functionality should use the configuration
|
||||
functions such as CONF_load_modules() directly.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
Neither OPENSSL_config() nor OPENSSL_no_config() return a value.
|
||||
|
@@ -109,9 +109,12 @@ but would not match a peer certificate with a DNS name of
|
||||
=head1 RETURN VALUES
|
||||
|
||||
The functions return 1 for a successful match, 0 for a failed match
|
||||
and -1 for an internal error: typically a memory allocation failure.
|
||||
and -1 for an internal error: typically a memory allocation failure
|
||||
or an ASN.1 decoding error.
|
||||
|
||||
X509_check_ip_asc() can also return -2 if the IP address string is malformed.
|
||||
All functions can also return -2 if the input is malformed. For example,
|
||||
X509_check_host() returns -2 if the provided B<name> contains embedded
|
||||
NULs.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
|
29
doc/crypto/d2i_CMS_ContentInfo.pod
Normal file
29
doc/crypto/d2i_CMS_ContentInfo.pod
Normal file
@@ -0,0 +1,29 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
d2i_CMS_ContentInfo, i2d_CMS_ContentInfo - CMS ContentInfo functions
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/cms.h>
|
||||
|
||||
CMS_ContentInfo *d2i_CMS_ContentInfo(CMS_ContentInfo **a, unsigned char **pp, long length);
|
||||
int i2d_CMS_ContentInfo(CMS_ContentInfo *a, unsigned char **pp);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
These functions decode and encode an CMS ContentInfo structure.
|
||||
|
||||
Otherwise they behave in a similar way to d2i_X509() and i2d_X509()
|
||||
described in the L<d2i_X509(3)|d2i_X509(3)> manual page.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<d2i_X509(3)|d2i_X509(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
These functions were first added to OpenSSL 0.9.8
|
||||
|
||||
=cut
|
@@ -2,7 +2,7 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
d2i_ECPKParameters, i2d_ECPKParameters, d2i_ECPKParameters_bio, i2d_ECPKParameters_bio, d2i_ECPKParameters_fp, i2d_ECPKParameters_fp(fp,x), ECPKParameters_print, ECPKParameters_print_fp - Functions for decoding and encoding ASN1 representations of elliptic curve entities
|
||||
d2i_ECPKParameters, i2d_ECPKParameters, d2i_ECPKParameters_bio, i2d_ECPKParameters_bio, d2i_ECPKParameters_fp, i2d_ECPKParameters_fp, ECPKParameters_print, ECPKParameters_print_fp - Functions for decoding and encoding ASN1 representations of elliptic curve entities
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
67
doc/crypto/d2i_ECPrivateKey.pod
Normal file
67
doc/crypto/d2i_ECPrivateKey.pod
Normal file
@@ -0,0 +1,67 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
i2d_ECPrivateKey, d2i_ECPrivate_key - Encode and decode functions for saving and
|
||||
reading EC_KEY structures
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/ec.h>
|
||||
|
||||
EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
|
||||
int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
|
||||
|
||||
unsigned int EC_KEY_get_enc_flags(const EC_KEY *key);
|
||||
void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The ECPrivateKey encode and decode routines encode and parse an
|
||||
B<EC_KEY> structure into a binary format (ASN.1 DER) and back again.
|
||||
|
||||
These functions are similar to the d2i_X509() functions, and you should refer to
|
||||
that page for a detailed description (see L<d2i_X509(3)|d2i_X509(3)>).
|
||||
|
||||
The format of the external representation of the public key written by
|
||||
i2d_ECPrivateKey (such as whether it is stored in a compressed form or not) is
|
||||
described by the point_conversion_form. See L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>
|
||||
for a description of point_conversion_form.
|
||||
|
||||
When reading a private key encoded without an associated public key (e.g. if
|
||||
EC_PKEY_NO_PUBKEY has been used - see below), then d2i_ECPrivateKey generates
|
||||
the missing public key automatically. Private keys encoded without parameters
|
||||
(e.g. if EC_PKEY_NO_PARAMETERS has been used - see below) cannot be loaded using
|
||||
d2i_ECPrivateKey.
|
||||
|
||||
The functions EC_KEY_get_enc_flags and EC_KEY_set_enc_flags get and set the
|
||||
value of the encoding flags for the B<key>. There are two encoding flags
|
||||
currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags
|
||||
define the behaviour of how the B<key> is converted into ASN1 in a call to
|
||||
i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for
|
||||
the curve are not encoded along with the private key. If EC_PKEY_NO_PUBKEY is
|
||||
set then the public key is not encoded along with the private key.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
d2i_ECPrivateKey() returns a valid B<EC_KEY> structure or B<NULL> if an error
|
||||
occurs. The error code that can be obtained by
|
||||
L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
|
||||
i2d_ECPrivateKey() returns the number of bytes successfully encoded or a
|
||||
negative value if an error occurs. The error code can be obtained by
|
||||
L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
|
||||
EC_KEY_get_enc_flags returns the value of the current encoding flags for the
|
||||
EC_KEY.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>,
|
||||
L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, L<EC_POINT_new(3)|EC_POINT_new(3)>,
|
||||
L<EC_POINT_add(3)|EC_POINT_add(3)>,
|
||||
L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>,
|
||||
L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)>,
|
||||
L<d2i_ECPrivateKey(3)|d2i_ECPrivateKey(3)>
|
||||
|
||||
=cut
|
@@ -30,8 +30,11 @@ successful a pointer to the B<X509> structure is returned. If an error
|
||||
occurred then B<NULL> is returned. If B<px> is not B<NULL> then the
|
||||
returned structure is written to B<*px>. If B<*px> is not B<NULL>
|
||||
then it is assumed that B<*px> contains a valid B<X509>
|
||||
structure and an attempt is made to reuse it. If the call is
|
||||
successful B<*in> is incremented to the byte following the
|
||||
structure and an attempt is made to reuse it. This "reuse" capability is present
|
||||
for historical compatibility but its use is B<strongly discouraged> (see BUGS
|
||||
below, and the discussion in the RETURN VALUES section).
|
||||
|
||||
If the call is successful B<*in> is incremented to the byte following the
|
||||
parsed data.
|
||||
|
||||
i2d_X509() encodes the structure pointed to by B<x> into DER format.
|
||||
@@ -233,7 +236,10 @@ i2d_re_X509_tbs().
|
||||
|
||||
d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B<X509> structure
|
||||
or B<NULL> if an error occurs. The error code that can be obtained by
|
||||
L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
L<ERR_get_error(3)|ERR_get_error(3)>. If the "reuse" capability has been used
|
||||
with a valid X509 structure being passed in via B<px> then the object is not
|
||||
freed in the event of error but may be in a potentially invalid or inconsistent
|
||||
state.
|
||||
|
||||
i2d_X509() returns the number of bytes successfully encoded or a negative
|
||||
value if an error occurs. The error code can be obtained by
|
||||
|
@@ -2,29 +2,58 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SHA1, SHA1_Init, SHA1_Update, SHA1_Final - Secure Hash Algorithm
|
||||
SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update,
|
||||
SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384,
|
||||
SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update,
|
||||
SHA512_Final - Secure Hash Algorithm
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
unsigned char *SHA1(const unsigned char *d, unsigned long n,
|
||||
unsigned char *md);
|
||||
|
||||
int SHA1_Init(SHA_CTX *c);
|
||||
int SHA1_Update(SHA_CTX *c, const void *data,
|
||||
unsigned long len);
|
||||
int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
|
||||
int SHA1_Final(unsigned char *md, SHA_CTX *c);
|
||||
unsigned char *SHA1(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
|
||||
int SHA224_Init(SHA256_CTX *c);
|
||||
int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
|
||||
int SHA224_Final(unsigned char *md, SHA256_CTX *c);
|
||||
unsigned char *SHA224(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
|
||||
int SHA256_Init(SHA256_CTX *c);
|
||||
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
|
||||
int SHA256_Final(unsigned char *md, SHA256_CTX *c);
|
||||
unsigned char *SHA256(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
|
||||
int SHA384_Init(SHA512_CTX *c);
|
||||
int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
|
||||
int SHA384_Final(unsigned char *md, SHA512_CTX *c);
|
||||
unsigned char *SHA384(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
|
||||
int SHA512_Init(SHA512_CTX *c);
|
||||
int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
|
||||
int SHA512_Final(unsigned char *md, SHA512_CTX *c);
|
||||
unsigned char *SHA512(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Applications should use the higher level functions
|
||||
L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the hash
|
||||
functions directly.
|
||||
|
||||
SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
|
||||
160 bit output.
|
||||
|
||||
SHA1() computes the SHA-1 message digest of the B<n>
|
||||
bytes at B<d> and places it in B<md> (which must have space for
|
||||
SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
|
||||
is placed in a static array.
|
||||
is placed in a static array. Note: setting B<md> to NULL is B<not thread safe>.
|
||||
|
||||
The following functions may be used if the message is not completely
|
||||
stored in memory:
|
||||
@@ -37,24 +66,29 @@ be hashed (B<len> bytes at B<data>).
|
||||
SHA1_Final() places the message digest in B<md>, which must have space
|
||||
for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>.
|
||||
|
||||
Applications should use the higher level functions
|
||||
L<EVP_DigestInit(3)|EVP_DigestInit(3)>
|
||||
etc. instead of calling the hash functions directly.
|
||||
The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the
|
||||
same way as for the SHA1 functions. Note that SHA224 and SHA256 use a
|
||||
B<SHA256_CTX> object instead of B<SHA_CTX>. SHA384 and SHA512 use B<SHA512_CTX>.
|
||||
The buffer B<md> must have space for the output from the SHA variant being used
|
||||
(defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and
|
||||
SHA512_DIGEST_LENGTH). Also note that, as for the SHA1() function above, the
|
||||
SHA224(), SHA256(), SHA384() and SHA512() functions are not thread safe if
|
||||
B<md> is NULL.
|
||||
|
||||
The predecessor of SHA-1, SHA, is also implemented, but it should be
|
||||
used only when backward compatibility is required.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
SHA1() returns a pointer to the hash value.
|
||||
SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to the hash
|
||||
value.
|
||||
|
||||
SHA1_Init(), SHA1_Update() and SHA1_Final() return 1 for success, 0 otherwise.
|
||||
SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224, SHA256,
|
||||
SHA384 and SHA512 functions return 1 for success, 0 otherwise.
|
||||
|
||||
=head1 CONFORMING TO
|
||||
|
||||
SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash
|
||||
Standard),
|
||||
SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash
|
||||
US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash
|
||||
Standard),
|
||||
ANSI X9.30
|
||||
|
||||
|
@@ -36,7 +36,7 @@ least one of these flags must be set.
|
||||
recognise options intended for use in SSL/TLS clients or servers. One or
|
||||
both of these flags must be set.
|
||||
|
||||
=item SSL_CONF_CERTIFICATE
|
||||
=item SSL_CONF_FLAG_CERTIFICATE
|
||||
|
||||
recognise certificate and private key options.
|
||||
|
||||
|
@@ -195,6 +195,11 @@ context. This option is only supported if certificate operations
|
||||
are permitted. Note: if no B<-key> option is set then a private key is
|
||||
not loaded: it does not currently use the B<Certificate> file.
|
||||
|
||||
=item B<ServerInfoFile>
|
||||
|
||||
Attempts to use the file B<value> in the "serverinfo" extension using the
|
||||
function SSL_CTX_use_serverinfo_file.
|
||||
|
||||
=item B<DHParameters>
|
||||
|
||||
Attempts to use the file B<value> as the set of temporary DH parameters for
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user