mirror of
https://github.com/openssl/openssl.git
synced 2026-01-14 21:20:29 +00:00
Compare commits
240 Commits
feature/dt
...
OpenSSL_1_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91eaf079b7 | ||
|
|
b263c106de | ||
|
|
3ffb3406ce | ||
|
|
6ca3e0f250 | ||
|
|
59e92f2371 | ||
|
|
4e7a0fa104 | ||
|
|
e9fcdd2e69 | ||
|
|
610b66267e | ||
|
|
99d97842dd | ||
|
|
53c6cbf6e9 | ||
|
|
2a7dd548a6 | ||
|
|
9ebcbbba81 | ||
|
|
3f7452e45a | ||
|
|
267d4fb183 | ||
|
|
73a5150689 | ||
|
|
df8dca7ac8 | ||
|
|
daa67522e0 | ||
|
|
1bb02559e3 | ||
|
|
cafe1c7abe | ||
|
|
6fa4d63dbf | ||
|
|
28304b1239 | ||
|
|
b9ddc5fd0c | ||
|
|
439530bc57 | ||
|
|
b71079a375 | ||
|
|
929cc3fa6b | ||
|
|
992b3740a1 | ||
|
|
51d8e5ea86 | ||
|
|
f02ec65590 | ||
|
|
294f7a746e | ||
|
|
5ee32f27a6 | ||
|
|
dc691e859b | ||
|
|
d29279371c | ||
|
|
8f8e9f184b | ||
|
|
0d325d9cb9 | ||
|
|
2cf10e88b7 | ||
|
|
b754f9a3a5 | ||
|
|
22173a40b2 | ||
|
|
f1ec9c07fe | ||
|
|
3a3f9ed140 | ||
|
|
a1aa038608 | ||
|
|
2e6b83f608 | ||
|
|
848dc96190 | ||
|
|
389d4655b1 | ||
|
|
4af9f7fe79 | ||
|
|
f722f18e1a | ||
|
|
93558bf519 | ||
|
|
717f4026d5 | ||
|
|
e4815a0bd2 | ||
|
|
77cd04bd27 | ||
|
|
bfca0515b6 | ||
|
|
0d72c6c66f | ||
|
|
3f99bfed67 | ||
|
|
0f6c9d73cb | ||
|
|
a95a0219a8 | ||
|
|
dd365d3685 | ||
|
|
32ee80362c | ||
|
|
936503cb0b | ||
|
|
10f60797e7 | ||
|
|
5af2ad682e | ||
|
|
3ab5f981ed | ||
|
|
8c9365a690 | ||
|
|
3bceb47a27 | ||
|
|
dafa1c85b9 | ||
|
|
122580ef71 | ||
|
|
207a9cb352 | ||
|
|
b2d0859ce1 | ||
|
|
2aec6095d3 | ||
|
|
ea897a0aa8 | ||
|
|
87148d30c9 | ||
|
|
9df0b74d0f | ||
|
|
8b13f33dbf | ||
|
|
e8e9cf7e9d | ||
|
|
a3b94c9c2b | ||
|
|
8afb9742ae | ||
|
|
ec7b16ddbb | ||
|
|
a55b395937 | ||
|
|
233bcb95dd | ||
|
|
e7a5f50da0 | ||
|
|
3d040392ff | ||
|
|
c347c5a3b6 | ||
|
|
be118c3d57 | ||
|
|
e97afdad65 | ||
|
|
6a73da167f | ||
|
|
969f378e36 | ||
|
|
953ef2cbd0 | ||
|
|
5389388a2b | ||
|
|
1ee297e52f | ||
|
|
bf4e64227d | ||
|
|
91951307d6 | ||
|
|
5c0c82c3f6 | ||
|
|
8934b0949c | ||
|
|
d0929aff54 | ||
|
|
d8631ebaab | ||
|
|
7b7f21cd60 | ||
|
|
0de5e4f092 | ||
|
|
68f3b89910 | ||
|
|
e4e407fe82 | ||
|
|
15ef80b5b1 | ||
|
|
174ec019c3 | ||
|
|
941005df14 | ||
|
|
dc2a7e42a2 | ||
|
|
08a78f8c44 | ||
|
|
3f39423aac | ||
|
|
25a127bde9 | ||
|
|
6b02b586c3 | ||
|
|
9cb0c3a3ca | ||
|
|
61b1eb2c67 | ||
|
|
dd63da7032 | ||
|
|
a1b791225f | ||
|
|
8061fdc8d3 | ||
|
|
f1522af442 | ||
|
|
d17300093c | ||
|
|
cccaf5d60b | ||
|
|
a7511d72a3 | ||
|
|
35c2aca31f | ||
|
|
9e4a7023aa | ||
|
|
f53e42e518 | ||
|
|
a905d13bbb | ||
|
|
384fd75ad8 | ||
|
|
7cac055800 | ||
|
|
a12778be17 | ||
|
|
16c34d4f74 | ||
|
|
87cd6f9253 | ||
|
|
f8644220a0 | ||
|
|
acacbfa756 | ||
|
|
df7681e468 | ||
|
|
5fe5914d30 | ||
|
|
ac2c44c628 | ||
|
|
f3e189613f | ||
|
|
d3c9d6e99f | ||
|
|
63658103d4 | ||
|
|
6d32c2ae28 | ||
|
|
f6a7505e64 | ||
|
|
7409b0aae5 | ||
|
|
1645f3f4b9 | ||
|
|
a59ab1c4dd | ||
|
|
d8e94b0d8f | ||
|
|
2178c52a8b | ||
|
|
db610cb29c | ||
|
|
df6b5e29ff | ||
|
|
4b390b6c3f | ||
|
|
f757ce2a3d | ||
|
|
1fdeda4cc9 | ||
|
|
6915f39e68 | ||
|
|
e7498968e2 | ||
|
|
13af417ba4 | ||
|
|
098dc9be43 | ||
|
|
7b368cd6d9 | ||
|
|
bf0404fe4a | ||
|
|
64d1cc09f9 | ||
|
|
6bdd2637da | ||
|
|
cade326432 | ||
|
|
79844cbba5 | ||
|
|
87030f54b2 | ||
|
|
d6637ce17e | ||
|
|
e5cb5dbd3c | ||
|
|
435972c172 | ||
|
|
9c067c8991 | ||
|
|
0430efa62f | ||
|
|
3ed2d8a4b8 | ||
|
|
b90348c7c5 | ||
|
|
d575693883 | ||
|
|
f506d82477 | ||
|
|
3fd181a8b5 | ||
|
|
90edd7ad0f | ||
|
|
57106f55a5 | ||
|
|
05f754f6a6 | ||
|
|
322b739be5 | ||
|
|
6f99d9c22f | ||
|
|
11bb654c60 | ||
|
|
ebae51f490 | ||
|
|
f0d0e783df | ||
|
|
2172993088 | ||
|
|
5dab48340e | ||
|
|
b5edd178ca | ||
|
|
efd2379412 | ||
|
|
ea6e2d5436 | ||
|
|
2abbe94828 | ||
|
|
9b498c9f0f | ||
|
|
34b3563243 | ||
|
|
07ebdfab07 | ||
|
|
ae6e317e32 | ||
|
|
03a8bf079c | ||
|
|
1850451676 | ||
|
|
9496cf577e | ||
|
|
f735859536 | ||
|
|
9fd47a0370 | ||
|
|
8ff785f4eb | ||
|
|
799398ca42 | ||
|
|
e631d60280 | ||
|
|
1556abd043 | ||
|
|
ce7d2e152e | ||
|
|
44c9339ca8 | ||
|
|
4bc54bf8b4 | ||
|
|
469f593170 | ||
|
|
718951c2f2 | ||
|
|
0adfd49e47 | ||
|
|
d3fa9addd2 | ||
|
|
ea42bd4059 | ||
|
|
baee63371d | ||
|
|
a0c5ccc7c1 | ||
|
|
054ef95f56 | ||
|
|
656bce0357 | ||
|
|
f2befe3444 | ||
|
|
c3cfc9962b | ||
|
|
92ed7fa575 | ||
|
|
79e5eae6ab | ||
|
|
b7d2480c82 | ||
|
|
e9590d00fc | ||
|
|
f52d16ac1d | ||
|
|
578dc1cea3 | ||
|
|
90ed28b797 | ||
|
|
eba44ca0a6 | ||
|
|
96e6c6635e | ||
|
|
3bcd1b2496 | ||
|
|
b5d60c2b8d | ||
|
|
eed06638c7 | ||
|
|
3a10218546 | ||
|
|
5b613a15d0 | ||
|
|
14ee280a49 | ||
|
|
3c8be9c350 | ||
|
|
67d81419f5 | ||
|
|
fd2107e077 | ||
|
|
ad2aa727cd | ||
|
|
bbf0074887 | ||
|
|
5410190ccb | ||
|
|
062ed73f58 | ||
|
|
06314c029d | ||
|
|
b2d10958a3 | ||
|
|
b9b3644881 | ||
|
|
eac33e1cd3 | ||
|
|
b7fa463ff8 | ||
|
|
2aca84ffad | ||
|
|
35b3f7fa9a | ||
|
|
e5c4581828 | ||
|
|
14fd205b38 | ||
|
|
7f8d9b757f | ||
|
|
a35d8fb168 | ||
|
|
dcb36a995e | ||
|
|
abd30777cc |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,6 +16,8 @@
|
||||
|
||||
# *all* Makefiles
|
||||
Makefile
|
||||
# ... except in demos
|
||||
!/demos/*/Makefile
|
||||
|
||||
# Links under apps
|
||||
/apps/CA.pl
|
||||
@@ -72,6 +74,7 @@ Makefile
|
||||
/include/openssl/opensslconf.h
|
||||
/tools/c_rehash
|
||||
/tools/c_rehash.pl
|
||||
/util/shlib_wrap.sh
|
||||
/tags
|
||||
/TAGS
|
||||
/crypto.map
|
||||
|
||||
12
.travis.yml
12
.travis.yml
@@ -34,21 +34,24 @@ env:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="--strict-warnings no-deprecated" BUILDONLY="yes"
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: CONFIG_OPTS="--debug --coverage no-asm enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers" COVERALLS="yes"
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="no-shared enable-asan"
|
||||
env: CONFIG_OPTS="enable-asan"
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="no-shared enable-msan"
|
||||
env: CONFIG_OPTS="enable-msan"
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="no-asm enable-ubsan enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method -fno-sanitize=alignment"
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="no-shared no-asm enable-asan enable-rc5 enable-md2"
|
||||
env: CONFIG_OPTS="no-asm enable-asan enable-rc5 enable-md2"
|
||||
- os: linux
|
||||
compiler: clang-3.6
|
||||
env: CONFIG_OPTS="no-stdio"
|
||||
@@ -134,5 +137,4 @@ after_success:
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- openssl-commits@openssl.org
|
||||
|
||||
secure: "xeGNgWO7aoaDgRvcZubposqMsj36aU8c6F0oHfw+rUqltCQ14IgYCUwzocmR2O+Pa7B3Cx5VjMfBFHbQaajZsfod8vu7g+aGq/zkjwbhsr/SR4dljJjFJXLGZjIalm9KgP6KInmVDuINfCqP+MHIY5lZkNI7DMcyHDhVc5nSKvCXV7xTDNgmstvh8rB/z51WfHDqGqfBtiuK5FDNxmvYK8OFJ5W94Lu9LDlizcxwK3GAj7arOui7Z5w8bQ6p4seUE3IvJL1Zbj0pZHxvNb6Zeb2Pn8QF1qLlN8YmBktD4aiw0ce4wYRiL87uLgcOxZY7SVXtv2XYFIYWapU/FKjCqa6vK93V/H9eZWEIYNMKnN3wXm2beqVdnKek3OeGJ8v0y7MbSfuLfRtBqbTSNYnpU1Zuo4MQAvHvEPuwCAYkYQajOSRplMH5sULFKptuVqNtOMfjL8jHb8AEoL1acYIk43ydxeYrzzas4fqgCDJ52573/u0RNdF1lkQBLkuM365OB8VRqtpnoxcdEIY/qBc/8TzZ24fxyrs5qdHFcxGSgpN2EP6cJMqpvkemnCNSdhxUqfzm22N7a3O8+4LFSBGOnHto/PwdsvF/01yGYL0LoZTnoO1i6x7AMJPBh+eyDU0ZjGhj/msjmqeb9C8vRqQ+1WjHrIS1iqCD0Czib8tUPD4="
|
||||
|
||||
162
CHANGES
162
CHANGES
@@ -2,7 +2,157 @@
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
Changes between 1.0.2h and 1.1.0 [xx XXX xxxx]
|
||||
Changes between 1.1.0b and 1.1.0c [10 Nov 2016]
|
||||
|
||||
*) ChaCha20/Poly1305 heap-buffer-overflow
|
||||
|
||||
TLS connections using *-CHACHA20-POLY1305 ciphersuites are susceptible to
|
||||
a DoS attack by corrupting larger payloads. This can result in an OpenSSL
|
||||
crash. This issue is not considered to be exploitable beyond a DoS.
|
||||
|
||||
This issue was reported to OpenSSL by Robert Święcki (Google Security Team)
|
||||
(CVE-2016-7054)
|
||||
[Richard Levitte]
|
||||
|
||||
*) CMS Null dereference
|
||||
|
||||
Applications parsing invalid CMS structures can crash with a NULL pointer
|
||||
dereference. This is caused by a bug in the handling of the ASN.1 CHOICE
|
||||
type in OpenSSL 1.1.0 which can result in a NULL value being passed to the
|
||||
structure callback if an attempt is made to free certain invalid encodings.
|
||||
Only CHOICE structures using a callback which do not handle NULL value are
|
||||
affected.
|
||||
|
||||
This issue was reported to OpenSSL by Tyler Nighswander of ForAllSecure.
|
||||
(CVE-2016-7053)
|
||||
[Stephen Henson]
|
||||
|
||||
*) Montgomery multiplication may produce incorrect results
|
||||
|
||||
There is a carry propagating bug in the Broadwell-specific Montgomery
|
||||
multiplication procedure that handles input lengths divisible by, but
|
||||
longer than 256 bits. Analysis suggests that attacks against RSA, DSA
|
||||
and DH private keys are impossible. This is because the subroutine in
|
||||
question is not used in operations with the private key itself and an input
|
||||
of the attacker's direct choice. Otherwise the bug can manifest itself as
|
||||
transient authentication and key negotiation failures or reproducible
|
||||
erroneous outcome of public-key operations with specially crafted input.
|
||||
Among EC algorithms only Brainpool P-512 curves are affected and one
|
||||
presumably can attack ECDH key negotiation. Impact was not analyzed in
|
||||
detail, because pre-requisites for attack are considered unlikely. Namely
|
||||
multiple clients have to choose the curve in question and the server has to
|
||||
share the private key among them, neither of which is default behaviour.
|
||||
Even then only clients that chose the curve will be affected.
|
||||
|
||||
This issue was publicly reported as transient failures and was not
|
||||
initially recognized as a security issue. Thanks to Richard Morgan for
|
||||
providing reproducible case.
|
||||
(CVE-2016-7055)
|
||||
[Andy Polyakov]
|
||||
|
||||
*) OpenSSL now fails if it receives an unrecognised record type in TLS1.0
|
||||
or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to
|
||||
prevent issues where no progress is being made and the peer continually
|
||||
sends unrecognised record types, using up resources processing them.
|
||||
[Matt Caswell]
|
||||
|
||||
*) Removed automatic addition of RPATH in shared libraries and executables,
|
||||
as this was a remainder from OpenSSL 1.0.x and isn't needed any more.
|
||||
[Richard Levitte]
|
||||
|
||||
Changes between 1.1.0a and 1.1.0b [26 Sep 2016]
|
||||
|
||||
*) Fix Use After Free for large message sizes
|
||||
|
||||
The patch applied to address CVE-2016-6307 resulted in an issue where if a
|
||||
message larger than approx 16k is received then the underlying buffer to
|
||||
store the incoming message is reallocated and moved. Unfortunately a
|
||||
dangling pointer to the old location is left which results in an attempt to
|
||||
write to the previously freed location. This is likely to result in a
|
||||
crash, however it could potentially lead to execution of arbitrary code.
|
||||
|
||||
This issue only affects OpenSSL 1.1.0a.
|
||||
|
||||
This issue was reported to OpenSSL by Robert Święcki.
|
||||
(CVE-2016-6309)
|
||||
[Matt Caswell]
|
||||
|
||||
Changes between 1.1.0 and 1.1.0a [22 Sep 2016]
|
||||
|
||||
*) OCSP Status Request extension unbounded memory growth
|
||||
|
||||
A malicious client can send an excessively large OCSP Status Request
|
||||
extension. If that client continually requests renegotiation, sending a
|
||||
large OCSP Status Request extension each time, then there will be unbounded
|
||||
memory growth on the server. This will eventually lead to a Denial Of
|
||||
Service attack through memory exhaustion. Servers with a default
|
||||
configuration are vulnerable even if they do not support OCSP. Builds using
|
||||
the "no-ocsp" build time option are not affected.
|
||||
|
||||
This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.)
|
||||
(CVE-2016-6304)
|
||||
[Matt Caswell]
|
||||
|
||||
*) SSL_peek() hang on empty record
|
||||
|
||||
OpenSSL 1.1.0 SSL/TLS will hang during a call to SSL_peek() if the peer
|
||||
sends an empty record. This could be exploited by a malicious peer in a
|
||||
Denial Of Service attack.
|
||||
|
||||
This issue was reported to OpenSSL by Alex Gaynor.
|
||||
(CVE-2016-6305)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Excessive allocation of memory in tls_get_message_header() and
|
||||
dtls1_preprocess_fragment()
|
||||
|
||||
A (D)TLS message includes 3 bytes for its length in the header for the
|
||||
message. This would allow for messages up to 16Mb in length. Messages of
|
||||
this length are excessive and OpenSSL includes a check to ensure that a
|
||||
peer is sending reasonably sized messages in order to avoid too much memory
|
||||
being consumed to service a connection. A flaw in the logic of version
|
||||
1.1.0 means that memory for the message is allocated too early, prior to
|
||||
the excessive message length check. Due to way memory is allocated in
|
||||
OpenSSL this could mean an attacker could force up to 21Mb to be allocated
|
||||
to service a connection. This could lead to a Denial of Service through
|
||||
memory exhaustion. However, the excessive message length check still takes
|
||||
place, and this would cause the connection to immediately fail. Assuming
|
||||
that the application calls SSL_free() on the failed conneciton in a timely
|
||||
manner then the 21Mb of allocated memory will then be immediately freed
|
||||
again. Therefore the excessive memory allocation will be transitory in
|
||||
nature. This then means that there is only a security impact if:
|
||||
|
||||
1) The application does not call SSL_free() in a timely manner in the event
|
||||
that the connection fails
|
||||
or
|
||||
2) The application is working in a constrained environment where there is
|
||||
very little free memory
|
||||
or
|
||||
3) The attacker initiates multiple connection attempts such that there are
|
||||
multiple connections in a state where memory has been allocated for the
|
||||
connection; SSL_free() has not yet been called; and there is insufficient
|
||||
memory to service the multiple requests.
|
||||
|
||||
Except in the instance of (1) above any Denial Of Service is likely to be
|
||||
transitory because as soon as the connection fails the memory is
|
||||
subsequently freed again in the SSL_free() call. However there is an
|
||||
increased risk during this period of application crashes due to the lack of
|
||||
memory - which would then mean a more serious Denial of Service.
|
||||
|
||||
This issue was reported to OpenSSL by Shi Lei (Gear Team, Qihoo 360 Inc.)
|
||||
(CVE-2016-6307 and CVE-2016-6308)
|
||||
[Matt Caswell]
|
||||
|
||||
*) solaris-x86-cc, i.e. 32-bit configuration with vendor compiler,
|
||||
had to be removed. Primary reason is that vendor assembler can't
|
||||
assemble our modules with -KPIC flag. As result it, assembly
|
||||
support, was not even available as option. But its lack means
|
||||
lack of side-channel resistant code, which is incompatible with
|
||||
security by todays standards. Fortunately gcc is readily available
|
||||
prepackaged option, which we firmly point at...
|
||||
[Andy Polyakov]
|
||||
|
||||
Changes between 1.0.2h and 1.1.0 [25 Aug 2016]
|
||||
|
||||
*) Windows command-line tool supports UTF-8 opt-in option for arguments
|
||||
and console input. Setting OPENSSL_WIN32_UTF8 environment variable
|
||||
@@ -299,6 +449,12 @@
|
||||
template in Configurations, like unix-Makefile.tmpl or
|
||||
descrip.mms.tmpl.
|
||||
|
||||
With this change, the library names were also renamed on Windows
|
||||
and on VMS. They now have names that are closer to the standard
|
||||
on Unix, and include the major version number, and in certain
|
||||
cases, the architecture they are built for. See "Notes on shared
|
||||
libraries" in INSTALL.
|
||||
|
||||
We rely heavily on the perl module Text::Template.
|
||||
[Richard Levitte]
|
||||
|
||||
@@ -874,10 +1030,6 @@
|
||||
combination: call this in fips_test_suite.
|
||||
[Steve Henson]
|
||||
|
||||
*) Add support for Dual EC DRBG from SP800-90. Update DRBG algorithm test
|
||||
and POST to handle Dual EC cases.
|
||||
[Steve Henson]
|
||||
|
||||
*) Add support for canonical generation of DSA parameter 'g'. See
|
||||
FIPS 186-3 A.2.3.
|
||||
|
||||
|
||||
55
CONTRIBUTING
55
CONTRIBUTING
@@ -1,4 +1,4 @@
|
||||
HOW TO CONTRIBUTE TO PATCHES OpenSSL
|
||||
HOW TO CONTRIBUTE PATCHES TO OpenSSL
|
||||
------------------------------------
|
||||
|
||||
(Please visit https://www.openssl.org/community/getting-started.html for
|
||||
@@ -11,34 +11,12 @@ OpenSSL community you might want to discuss it on the openssl-dev mailing
|
||||
list first. Someone may be already working on the same thing or there
|
||||
may be a good reason as to why that feature isn't implemented.
|
||||
|
||||
The best way to submit a patch is to make a pull request on GitHub.
|
||||
(It is not necessary to send mail to rt@openssl.org to open a ticket!)
|
||||
If you think the patch could use feedback from the community, please
|
||||
start a thread on openssl-dev.
|
||||
To submit a patch, make a pull request on GitHub. If you think the patch
|
||||
could use feedback from the community, please start a thread on openssl-dev
|
||||
to discuss it.
|
||||
|
||||
You can also submit patches by sending it as mail to rt@openssl.org.
|
||||
Please include the word "PATCH" and an explanation of what the patch
|
||||
does in the subject line. If you do this, our preferred format is "git
|
||||
format-patch" output. For example to provide a patch file containing the
|
||||
last commit in your local git repository use the following command:
|
||||
|
||||
% git format-patch --stdout HEAD^ >mydiffs.patch
|
||||
|
||||
Another method of creating an acceptable patch file without using git is as
|
||||
follows:
|
||||
|
||||
% cd openssl-work
|
||||
...make your changes...
|
||||
% ./Configure dist; make clean
|
||||
% cd ..
|
||||
% diff -ur openssl-orig openssl-work >mydiffs.patch
|
||||
|
||||
Note that pull requests are generally easier for the team, and community, to
|
||||
work with. Pull requests benefit from all of the standard GitHub features,
|
||||
including code review tools, simpler integration, and CI build support.
|
||||
|
||||
No matter how a patch is submitted, the following items will help make
|
||||
the acceptance and review process faster:
|
||||
Having addressed the following items before the PR will help make the
|
||||
acceptance and review process faster:
|
||||
|
||||
1. Anything other than trivial contributions will require a contributor
|
||||
licensing agreement, giving us permission to use your code. See
|
||||
@@ -55,21 +33,22 @@ the acceptance and review process faster:
|
||||
in the file LICENSE in the source distribution or at
|
||||
https://www.openssl.org/source/license.html
|
||||
|
||||
3. Patches should be as current as possible. When using GitHub, please
|
||||
expect to have to rebase and update often. Note that we do not accept merge
|
||||
commits. You will be asked to remove them before a patch is considered
|
||||
acceptable.
|
||||
3. Patches should be as current as possible; expect to have to rebase
|
||||
often. We do not accept merge commits; You will be asked to remove
|
||||
them before a patch is considered acceptable.
|
||||
|
||||
4. Patches should follow our coding style (see
|
||||
https://www.openssl.org/policies/codingstyle.html) and compile without
|
||||
warnings. Where gcc or clang is available you should use the
|
||||
--strict-warnings Configure option. OpenSSL compiles on many varied
|
||||
platforms: try to ensure you only use portable features.
|
||||
Clean builds via Travis and AppVeyor are expected, and done whenever
|
||||
a PR is created or updated.
|
||||
|
||||
5. When at all possible, patches should include tests. These can either be
|
||||
added to an existing test, or completely new. Please see test/README
|
||||
for information on the test framework.
|
||||
5. When at all possible, patches should include tests. These can
|
||||
either be added to an existing test, or completely new. Please see
|
||||
test/README for information on the test framework.
|
||||
|
||||
6. New features or changed functionality must include documentation. Please
|
||||
look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of
|
||||
our style.
|
||||
6. New features or changed functionality must include
|
||||
documentation. Please look at the "pod" files in doc/apps, doc/crypto
|
||||
and doc/ssl for examples of our style.
|
||||
|
||||
@@ -80,10 +80,11 @@
|
||||
sub {
|
||||
unless ($disabled{zlib}) {
|
||||
if (defined($disabled{"zlib-dynamic"})) {
|
||||
return $withargs{zlib_lib};
|
||||
return $withargs{zlib_lib} // "ZLIB1";
|
||||
}
|
||||
}
|
||||
return (); },
|
||||
return ();
|
||||
},
|
||||
|
||||
ld => "link",
|
||||
lflags => "/nologo",
|
||||
|
||||
@@ -14,7 +14,10 @@ sub vc_win64a_info {
|
||||
asflags => "/c /Cp /Cx /Zi",
|
||||
asoutflag => "/Fo" };
|
||||
} else {
|
||||
die "NASM not found - please read INSTALL and NOTES.WIN for further details\n";
|
||||
$die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
|
||||
$vc_win64a_info = { as => "{unknown}",
|
||||
asflags => "",
|
||||
asoutflag => "" };
|
||||
}
|
||||
}
|
||||
return $vc_win64a_info;
|
||||
@@ -36,7 +39,11 @@ sub vc_win32_info {
|
||||
asoutflag => "/Fo",
|
||||
perlasm_scheme => "win32" };
|
||||
} else {
|
||||
die "NASM not found - please read INSTALL and NOTES.WIN for further details\n";
|
||||
$die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n");
|
||||
$vc_win32_info = { as => "{unknown}",
|
||||
asflags => "",
|
||||
asoutflag => "",
|
||||
perlasm_scheme => "win32" };
|
||||
}
|
||||
}
|
||||
return $vc_win32_info;
|
||||
@@ -46,18 +53,26 @@ my $vc_wince_info = {};
|
||||
sub vc_wince_info {
|
||||
unless (%$vc_wince_info) {
|
||||
# sanity check
|
||||
die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'}));
|
||||
die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'}));
|
||||
die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'}));
|
||||
$die->('%OSVERSION% is not defined') if (!defined($ENV{'OSVERSION'}));
|
||||
$die->('%PLATFORM% is not defined') if (!defined($ENV{'PLATFORM'}));
|
||||
$die->('%TARGETCPU% is not defined') if (!defined($ENV{'TARGETCPU'}));
|
||||
|
||||
#
|
||||
# Idea behind this is to mimic flags set by eVC++ IDE...
|
||||
#
|
||||
my $wcevers = $ENV{'OSVERSION'}; # WCENNN
|
||||
die '%OSVERSION% value is insane'
|
||||
if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
|
||||
my $wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN
|
||||
my $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
|
||||
my $wcevernum;
|
||||
my $wceverdotnum;
|
||||
if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) {
|
||||
$wcevernum = "$1$2";
|
||||
$wceverdotnum = "$1.$2";
|
||||
} else {
|
||||
$die->('%OSVERSION% value is insane');
|
||||
$wcevernum = "{unknown}";
|
||||
$wceverdotnum = "{unknown}";
|
||||
}
|
||||
my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN
|
||||
my $wcelflag = "/subsystem:windowsce,$wceverdotnum"; # ...,N.NN
|
||||
|
||||
my $wceplatf = $ENV{'PLATFORM'};
|
||||
|
||||
@@ -185,7 +200,7 @@ sub vms_info {
|
||||
threads("-pthread")),
|
||||
bn_ops => "BN_LLONG",
|
||||
shared_cflag => "-fPIC",
|
||||
shared_ldflag => "-shared",
|
||||
shared_ldflag => "-shared -static-libgcc",
|
||||
},
|
||||
"solaris64-x86_64-gcc" => {
|
||||
# -shared -static-libgcc might appear controversial, but modules
|
||||
@@ -210,19 +225,18 @@ sub vms_info {
|
||||
},
|
||||
|
||||
#### Solaris x86 with Sun C setups
|
||||
"solaris-x86-cc" => {
|
||||
inherit_from => [ "solaris-common" ],
|
||||
cc => "cc",
|
||||
cflags => add_before(picker(default => "-xarch=generic -xstrconst -Xa -DL_ENDIAN",
|
||||
debug => "-g",
|
||||
release => "-xO5 -xregs=frameptr -xdepend -xbuiltin"),
|
||||
threads("-D_REENTRANT")),
|
||||
lflags => add(threads("-mt")),
|
||||
ex_libs => add(threads("-lpthread")),
|
||||
bn_ops => "BN_LLONG RC4_CHAR",
|
||||
shared_cflag => "-KPIC",
|
||||
shared_ldflag => "-G -dy -z text",
|
||||
},
|
||||
# There used to be solaris-x86-cc target, but it was removed,
|
||||
# primarily because vendor assembler can't assemble our modules
|
||||
# with -KPIC flag. As result it, assembly support, was not even
|
||||
# available as option. But its lack means lack of side-channel
|
||||
# resistant code, which is incompatible with security by todays
|
||||
# standards. Fortunately gcc is readily available prepackaged
|
||||
# option, which we can firmly point at...
|
||||
#
|
||||
# On related note, solaris64-x86_64-cc target won't compile code
|
||||
# paths utilizing AVX and post-Haswell instruction extensions.
|
||||
# Consider switching to solaris64-x86_64-gcc even here...
|
||||
#
|
||||
"solaris64-x86_64-cc" => {
|
||||
inherit_from => [ "solaris-common", asm("x86_64_asm") ],
|
||||
cc => "cc",
|
||||
@@ -294,11 +308,11 @@ sub vms_info {
|
||||
},
|
||||
"solaris-sparcv9-cc" => {
|
||||
inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
|
||||
cflags => add_before("-xarch=v8plus -xtarget=ultra"),
|
||||
cflags => add_before("-xarch=v8plus"),
|
||||
},
|
||||
"solaris64-sparcv9-cc" => {
|
||||
inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
|
||||
cflags => add_before("-xarch=v9 -xtarget=ultra"),
|
||||
cflags => add_before("-xarch=v9"),
|
||||
lflags => add_before("-xarch=v9"),
|
||||
bn_ops => "BN_LLONG RC4_CHAR",
|
||||
shared_ldflag => "-xarch=v9 -G -dy -z text",
|
||||
@@ -617,7 +631,8 @@ sub vms_info {
|
||||
thread_scheme => "pthreads",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "linux-shared",
|
||||
shared_cflag => "-fPIC",
|
||||
shared_cflag => "-fPIC -DOPENSSL_USE_NODELETE",
|
||||
shared_ldflag => "-Wl,-znodelete",
|
||||
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
},
|
||||
"linux-generic64" => {
|
||||
@@ -633,14 +648,14 @@ sub vms_info {
|
||||
inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
|
||||
cflags => add("-m64 -DB_ENDIAN"),
|
||||
perlasm_scheme => "linux64",
|
||||
shared_ldflag => "-m64",
|
||||
shared_ldflag => add("-m64"),
|
||||
multilib => "64",
|
||||
},
|
||||
"linux-ppc64le" => {
|
||||
inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
|
||||
cflags => add("-m64 -DL_ENDIAN"),
|
||||
perlasm_scheme => "linux64le",
|
||||
shared_ldflag => "-m64",
|
||||
shared_ldflag => add("-m64"),
|
||||
},
|
||||
|
||||
"linux-armv4" => {
|
||||
@@ -696,7 +711,7 @@ sub vms_info {
|
||||
inherit_from => [ "linux-generic32", asm("mips32_asm") ],
|
||||
cflags => add("-mabi=32 -DBN_DIV3W"),
|
||||
perlasm_scheme => "o32",
|
||||
shared_ldflag => "-mabi=32",
|
||||
shared_ldflag => add("-mabi=32"),
|
||||
},
|
||||
# mips32 and mips64 below refer to contemporary MIPS Architecture
|
||||
# specifications, MIPS32 and MIPS64, rather than to kernel bitness.
|
||||
@@ -705,14 +720,14 @@ sub vms_info {
|
||||
cflags => add("-mabi=n32 -DBN_DIV3W"),
|
||||
bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
|
||||
perlasm_scheme => "n32",
|
||||
shared_ldflag => "-mabi=n32",
|
||||
shared_ldflag => add("-mabi=n32"),
|
||||
multilib => "32",
|
||||
},
|
||||
"linux64-mips64" => {
|
||||
inherit_from => [ "linux-generic64", asm("mips64_asm") ],
|
||||
cflags => add("-mabi=64 -DBN_DIV3W"),
|
||||
perlasm_scheme => "64",
|
||||
shared_ldflag => "-mabi=64",
|
||||
shared_ldflag => add("-mabi=64"),
|
||||
multilib => "64",
|
||||
},
|
||||
|
||||
@@ -721,7 +736,6 @@ sub vms_info {
|
||||
inherit_from => [ "linux-generic32", asm("x86_elf_asm") ],
|
||||
cflags => add(picker(default => "-DL_ENDIAN",
|
||||
release => "-fomit-frame-pointer")),
|
||||
ex_libs => add(picker(debug => "-lefence")),
|
||||
bn_ops => "BN_LLONG",
|
||||
},
|
||||
"linux-aout" => {
|
||||
@@ -740,7 +754,7 @@ sub vms_info {
|
||||
cflags => add("-m64 -DL_ENDIAN"),
|
||||
bn_ops => "SIXTY_FOUR_BIT_LONG",
|
||||
perlasm_scheme => "elf",
|
||||
shared_ldflag => "-m64",
|
||||
shared_ldflag => add("-m64"),
|
||||
multilib => "64",
|
||||
},
|
||||
"linux-x86_64-clang" => {
|
||||
@@ -766,7 +780,7 @@ sub vms_info {
|
||||
inherit_from => [ "linux-generic64", asm("s390x_asm") ],
|
||||
cflags => add("-m64 -DB_ENDIAN"),
|
||||
perlasm_scheme => "64",
|
||||
shared_ldflag => "-m64",
|
||||
shared_ldflag => add("-m64"),
|
||||
multilib => "64",
|
||||
},
|
||||
"linux32-s390x" => {
|
||||
@@ -790,7 +804,7 @@ sub vms_info {
|
||||
cflags => add("-m31 -Wa,-mzarch -DB_ENDIAN"),
|
||||
bn_asm_src => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
|
||||
perlasm_scheme => "31",
|
||||
shared_ldflag => "-m31",
|
||||
shared_ldflag => add("-m31"),
|
||||
multilib => "/highgprs",
|
||||
},
|
||||
|
||||
@@ -806,14 +820,14 @@ sub vms_info {
|
||||
# but -Wa,-Av8plus should do the trick no matter what.
|
||||
inherit_from => [ "linux-generic32", asm("sparcv9_asm") ],
|
||||
cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus -DB_ENDIAN -DBN_DIV2W"),
|
||||
shared_ldflag => "-m32",
|
||||
shared_ldflag => add("-m32"),
|
||||
},
|
||||
"linux64-sparcv9" => {
|
||||
# GCC 3.1 is a requirement
|
||||
inherit_from => [ "linux-generic64", asm("sparcv9_asm") ],
|
||||
cflags => add("-m64 -mcpu=ultrasparc -DB_ENDIAN"),
|
||||
bn_ops => "BN_LLONG RC4_CHAR",
|
||||
shared_ldflag => "-m64",
|
||||
shared_ldflag => add("-m64"),
|
||||
multilib => "64",
|
||||
},
|
||||
|
||||
@@ -842,7 +856,7 @@ sub vms_info {
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "linux-shared",
|
||||
shared_cflag => "--pic",
|
||||
shared_ldflag => "-z --sysv --shared",
|
||||
shared_ldflag => add("-z --sysv --shared"),
|
||||
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
ranlib => "true",
|
||||
},
|
||||
@@ -851,7 +865,7 @@ sub vms_info {
|
||||
#
|
||||
# It takes pair of prior-set environment variables to make it work:
|
||||
#
|
||||
# CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<
|
||||
# CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<arch>
|
||||
# CROSS_COMPILE=<prefix>
|
||||
#
|
||||
# As well as PATH adjusted to cover ${CROSS_COMPILE}gcc and company.
|
||||
@@ -860,7 +874,7 @@ sub vms_info {
|
||||
# ANDROID_NDK=/some/where/android-ndk-10d
|
||||
# CROSS_SYSROOT=$ANDROID_NDK/platforms/android-14/arch-arm
|
||||
# CROSS_COMPILE=arm-linux-adroideabi-
|
||||
# PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/
|
||||
# PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin
|
||||
#
|
||||
"android" => {
|
||||
inherit_from => [ "linux-generic32" ],
|
||||
@@ -1128,6 +1142,11 @@ sub vms_info {
|
||||
},
|
||||
|
||||
#### IBM's AIX.
|
||||
# Below targets assume AIX >=5. Caveat lector. If you are accustomed
|
||||
# to control compilation "bitness" by setting $OBJECT_MODE environment
|
||||
# variable, then you should know that in OpenSSL case it's considered
|
||||
# only in ./config. Once configured, build procedure remains "deaf" to
|
||||
# current value of $OBJECT_MODE.
|
||||
"aix-gcc" => {
|
||||
inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
|
||||
cc => "gcc",
|
||||
@@ -1141,7 +1160,7 @@ sub vms_info {
|
||||
perlasm_scheme => "aix32",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "aix-shared",
|
||||
shared_ldflag => "-shared -Wl,-G",
|
||||
shared_ldflag => "-shared -static-libgcc -Wl,-G",
|
||||
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
arflags => "-X32",
|
||||
},
|
||||
@@ -1158,13 +1177,10 @@ sub vms_info {
|
||||
perlasm_scheme => "aix64",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "aix-shared",
|
||||
shared_ldflag => "-maix64 -shared -Wl,-G",
|
||||
shared_ldflag => "-maix64 -shared -static-libgcc -Wl,-G",
|
||||
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
arflags => "-X64",
|
||||
},
|
||||
# Below targets assume AIX 5. Idea is to effectively disregard
|
||||
# $OBJECT_MODE at build time. $OBJECT_MODE is respected at
|
||||
# ./config stage!
|
||||
"aix-cc" => {
|
||||
inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
|
||||
cc => "cc",
|
||||
@@ -1175,6 +1191,7 @@ sub vms_info {
|
||||
sys_id => "AIX",
|
||||
bn_ops => "BN_LLONG RC4_CHAR",
|
||||
thread_scheme => "pthreads",
|
||||
ex_libs => threads("-lpthreads"),
|
||||
perlasm_scheme => "aix32",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "aix-shared",
|
||||
@@ -1192,6 +1209,7 @@ sub vms_info {
|
||||
sys_id => "AIX",
|
||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||
thread_scheme => "pthreads",
|
||||
ex_libs => threads("-lpthreads"),
|
||||
perlasm_scheme => "aix64",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "aix-shared",
|
||||
@@ -1240,9 +1258,11 @@ sub vms_info {
|
||||
cflags => "-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE",
|
||||
defines => add(sub { my @defs = ();
|
||||
unless ($disabled{"zlib-dynamic"}) {
|
||||
my $zlib =
|
||||
$withargs{zlib_lib} // "ZLIB1";
|
||||
push @defs,
|
||||
quotify("perl",
|
||||
'LIBZ="' . $withargs{zlib_lib} . '"');
|
||||
'LIBZ="' . $zlib . '"');
|
||||
}
|
||||
return [ @defs ];
|
||||
}),
|
||||
@@ -1259,6 +1279,7 @@ sub vms_info {
|
||||
},
|
||||
"VC-noCE-common" => {
|
||||
inherit_from => [ "VC-common" ],
|
||||
template => 1,
|
||||
cflags => add(picker(default => "-DUNICODE -D_UNICODE",
|
||||
debug =>
|
||||
sub {
|
||||
@@ -1295,6 +1316,7 @@ sub vms_info {
|
||||
},
|
||||
"VC-WIN64-common" => {
|
||||
inherit_from => [ "VC-noCE-common" ],
|
||||
template => 1,
|
||||
ex_libs => add(sub {
|
||||
my @ex_libs = ();
|
||||
push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
|
||||
@@ -1725,9 +1747,10 @@ sub vms_info {
|
||||
inherit_from => [ "BASE_VMS" ],
|
||||
template => 1,
|
||||
cc => "CC/DECC",
|
||||
cflags => picker(default => "/STANDARD=RELAXED/NOLIST/PREFIX=ALL",
|
||||
cflags => picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
|
||||
debug => "/NOOPTIMIZE/DEBUG",
|
||||
release => "/OPTIMIZE/NODEBUG"),
|
||||
defines => add("OPENSSL_USE_NODELETE"),
|
||||
lflags => picker(default => "/MAP",
|
||||
debug => "/DEBUG/TRACEBACK",
|
||||
release => "/NODEBUG/NOTRACEBACK"),
|
||||
@@ -1737,7 +1760,7 @@ sub vms_info {
|
||||
dso_scheme => "vms",
|
||||
thread_scheme => "pthreads",
|
||||
|
||||
apps_aux_src => "vms_decc_init.c",
|
||||
apps_aux_src => "vms_decc_init.c vms_term_sock.c",
|
||||
},
|
||||
|
||||
"vms-alpha" => {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
cc => "gcc",
|
||||
cflags => "-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror",
|
||||
thread_scheme => "(unknown)",
|
||||
ex_libs => add(" ","-lefence"),
|
||||
},
|
||||
"debug-erbridge" => {
|
||||
inherit_from => [ "x86_64_asm" ],
|
||||
@@ -50,19 +49,6 @@
|
||||
thread_scheme => "pthreads",
|
||||
dso_scheme => "dlfcn",
|
||||
},
|
||||
"debug-linux-elf-noefence" => {
|
||||
inherit_from => [ "x86_elf_asm" ],
|
||||
cc => "gcc",
|
||||
cflags => combine("-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DL_ENDIAN -g -Wall",
|
||||
threads("-D_REENTRANT")),
|
||||
ex_libs => add(" ","-ldl"),
|
||||
bn_ops => "BN_LLONG",
|
||||
thread_scheme => "pthreads",
|
||||
dso_scheme => "dlfcn",
|
||||
shared_target => "linux-shared",
|
||||
shared_cflag => "-fPIC",
|
||||
shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
},
|
||||
"debug-linux-ia32-aes" => {
|
||||
cc => "gcc",
|
||||
cflags => combine("-DL_ENDIAN -O3 -fomit-frame-pointer -Wall",
|
||||
|
||||
@@ -151,7 +151,7 @@ INSTALLTOP={- our $installtop =
|
||||
$installtop -}
|
||||
SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
|
||||
# This is the standard central area to store certificates, private keys...
|
||||
OPENSSLDIR={- catdir($config{openssldir}) ||
|
||||
OPENSSLDIR={- catdir($config{openssldir}) or
|
||||
$config{prefix} ? catdir($config{prefix},"COMMON")
|
||||
: "SYS\$COMMON:[OPENSSL-COMMON]" -}
|
||||
# The same, but for C
|
||||
@@ -223,7 +223,7 @@ NODEBUG=@
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) ! Figure out the architecture
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase")
|
||||
$(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
|
||||
$(NODEBUG) !
|
||||
$(NODEBUG) ! Set up logical names for the libraries, so LINK and
|
||||
$(NODEBUG) ! running programs can use them.
|
||||
@@ -264,8 +264,10 @@ test tests : build_generated, build_programs_nodep, build_engines_nodep, -
|
||||
DEFINE SRCTOP {- sourcedir() -}
|
||||
DEFINE BLDTOP {- builddir() -}
|
||||
DEFINE OPENSSL_ENGINES {- builddir("engines") -}
|
||||
DEFINE OPENSSL_DEBUG_MEMORY "on"
|
||||
IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
|
||||
$(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
|
||||
DEASSIGN OPENSSL_DEBUG_MEMORY
|
||||
DEASSIGN OPENSSL_ENGINES
|
||||
DEASSIGN BLDTOP
|
||||
DEASSIGN SRCTOP
|
||||
@@ -508,7 +510,7 @@ debug_logicals :
|
||||
|
||||
# Building targets ###################################################
|
||||
|
||||
configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), sourcefile("Configurations", "common.tmpl")) -} $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}) -}
|
||||
configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
|
||||
@ WRITE SYS$OUTPUT "Reconfiguring..."
|
||||
perl $(SRCDIR)Configure reconf
|
||||
@ WRITE SYS$OUTPUT "*************************************************"
|
||||
@@ -677,10 +679,11 @@ EOF
|
||||
# previous line's file spec as default, so if no directory spec
|
||||
# is present in the current line and the previous line has one that
|
||||
# doesn't apply, you're in for a surprise.
|
||||
my $write_opt =
|
||||
my $write_opt1 =
|
||||
join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
|
||||
"WRITE OPT_FILE \"$x" } @objs).
|
||||
"\"\n\t".
|
||||
"\"";
|
||||
my $write_opt2 =
|
||||
join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
|
||||
$x =~ s|(\.EXE)|$1/SHARE|;
|
||||
$x =~ s|(\.OLB)|$1/LIB|;
|
||||
@@ -690,7 +693,8 @@ EOF
|
||||
$lib.EXE : $deps
|
||||
OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
|
||||
TYPE $engine_opt /OUTPUT=OPT_FILE:
|
||||
$write_opt
|
||||
$write_opt1
|
||||
$write_opt2
|
||||
CLOSE OPT_FILE
|
||||
LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
|
||||
- PURGE $lib.EXE,$lib.OPT,$lib.MAP
|
||||
@@ -723,10 +727,11 @@ EOF
|
||||
# previous line's file spec as default, so if no directory spec
|
||||
# is present in the current line and the previous line has one that
|
||||
# doesn't apply, you're in for a surprise.
|
||||
my $write_opt =
|
||||
my $write_opt1 =
|
||||
join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
|
||||
"WRITE OPT_FILE \"$x" } @objs).
|
||||
"\"\n\t".
|
||||
"\"";
|
||||
my $write_opt2 =
|
||||
join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
|
||||
$x =~ s|(\.EXE)|$1/SHARE|;
|
||||
$x =~ s|(\.OLB)|$1/LIB|;
|
||||
@@ -735,7 +740,8 @@ EOF
|
||||
return <<"EOF";
|
||||
$bin.EXE : $deps
|
||||
OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
|
||||
$write_opt
|
||||
$write_opt1
|
||||
$write_opt2
|
||||
CLOSE OPT_FILE
|
||||
LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
|
||||
- PURGE $bin.EXE,$bin.OPT
|
||||
|
||||
@@ -153,6 +153,10 @@ LIBDIR={- #
|
||||
ENGINESDIR={- use File::Spec::Functions;
|
||||
catdir($prefix,$libdir,"engines-$sover") -}
|
||||
|
||||
# Convenience variable for those who want to set the rpath in shared
|
||||
# libraries and applications
|
||||
LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
|
||||
|
||||
MANDIR=$(INSTALLTOP)/share/man
|
||||
DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
|
||||
HTMLDIR=$(DOCDIR)/html
|
||||
@@ -173,20 +177,7 @@ LDFLAGS= {- $target{lflags} -}
|
||||
PLIB_LDFLAGS= {- $target{plib_lflags} -}
|
||||
EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
|
||||
LIB_CFLAGS={- $target{shared_cflag} || "" -}
|
||||
LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
|
||||
# Unlike other OSes (like Solaris, Linux, Tru64,
|
||||
# IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
|
||||
# and FreeBSD) "demand" RPATH set on .so objects.
|
||||
# Apparently application RPATH is not global and
|
||||
# does not apply to .so linked with other .so.
|
||||
# Problem manifests itself when libssl.so fails to
|
||||
# load libcrypto.so. One can argue that we should
|
||||
# engrave this into Makefile.shared rules or into
|
||||
# BSD-* config lines above. Meanwhile let's try to
|
||||
# be cautious and pass -rpath to linker only when
|
||||
# $prefix is not /usr.
|
||||
. ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
|
||||
? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
|
||||
LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
|
||||
DSO_CFLAGS={- $target{shared_cflag} || "" -}
|
||||
DSO_LDFLAGS=$(LIB_LDFLAGS)
|
||||
BIN_CFLAGS={- $target{bin_cflags} -}
|
||||
@@ -255,6 +246,7 @@ test: tests
|
||||
PERL="$(PERL)" \
|
||||
EXE_EXT={- $exeext -} \
|
||||
OPENSSL_ENGINES=../$(BLDDIR)/engines \
|
||||
OPENSSL_DEBUG_MEMORY=on \
|
||||
$(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
|
||||
@ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@echo "Tests are not supported with your chosen Configure options"
|
||||
@@ -301,14 +293,12 @@ distclean: clean
|
||||
$(RM) configdata.pm
|
||||
$(RM) Makefile
|
||||
|
||||
# This exists solely for those who still type 'make depend'
|
||||
#
|
||||
# We check if any depfile is newer than Makefile and decide to
|
||||
# concatenate only if that is true.
|
||||
depend:
|
||||
@: {- output_off() if $disabled{makedepend}; "" -}
|
||||
@if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \
|
||||
( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
|
||||
@if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
|
||||
( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
|
||||
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
|
||||
echo; \
|
||||
for f in $(DEPS); do \
|
||||
@@ -771,22 +761,18 @@ tar:
|
||||
cd $(SRCDIR); ls -l $(TARFILE).gz
|
||||
|
||||
dist:
|
||||
@$(MAKE) PREPARE_CMD='./Configure dist' tar
|
||||
@$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar
|
||||
|
||||
# Helper targets #####################################################
|
||||
|
||||
link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
|
||||
link-utils: $(BLDDIR)/util/opensslwrap.sh
|
||||
|
||||
$(BLDDIR)/util/opensslwrap.sh: configdata.pm
|
||||
@if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
|
||||
mkdir -p "$(BLDDIR)/util"; \
|
||||
ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
|
||||
fi
|
||||
$(BLDDIR)/util/shlib_wrap.sh: configdata.pm
|
||||
@if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
|
||||
mkdir -p "$(BLDDIR)/util"; \
|
||||
ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
|
||||
fi
|
||||
|
||||
FORCE:
|
||||
|
||||
# Building targets ###################################################
|
||||
@@ -797,6 +783,7 @@ libcrypto.pc:
|
||||
echo 'exec_prefix=$${prefix}'; \
|
||||
echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
|
||||
echo 'includedir=$${prefix}/include'; \
|
||||
echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
|
||||
echo ''; \
|
||||
echo 'Name: OpenSSL-libcrypto'; \
|
||||
echo 'Description: OpenSSL cryptography library'; \
|
||||
@@ -830,10 +817,10 @@ openssl.pc:
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: libssl libcrypto' ) > openssl.pc
|
||||
|
||||
configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
|
||||
configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
|
||||
@echo "Detected changed: $?"
|
||||
@echo "Reconfiguring..."
|
||||
$(SRCDIR)/Configure reconf
|
||||
$(PERL) $(SRCDIR)/Configure reconf
|
||||
@echo "**************************************************"
|
||||
@echo "*** ***"
|
||||
@echo "*** Please run the same make command again ***"
|
||||
@@ -944,30 +931,11 @@ EOF
|
||||
dso => '$(DSO_CFLAGS)',
|
||||
bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
|
||||
my $makedepprog = $config{makedepprog};
|
||||
my $recipe = "";
|
||||
if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
|
||||
$recipe .= <<"EOF";
|
||||
$obj$depext: $deps
|
||||
-\$(MAKEDEPEND) -f- -o"|$obj$objext" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
|
||||
>\$\@.tmp 2>/dev/null
|
||||
-\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp
|
||||
\@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\
|
||||
rm -f \$\@.tmp; \\
|
||||
else \\
|
||||
mv \$\@.tmp \$\@; \\
|
||||
fi
|
||||
EOF
|
||||
$deps = $obj.$depext;
|
||||
}
|
||||
if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) {
|
||||
$recipe .= <<"EOF";
|
||||
my $recipe = <<"EOF";
|
||||
$obj$objext: $deps
|
||||
\$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
|
||||
EOF
|
||||
}
|
||||
if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
|
||||
$recipe .= <<"EOF";
|
||||
$obj$objext: $deps
|
||||
\$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
|
||||
\@touch $obj$depext.tmp
|
||||
\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
|
||||
@@ -976,6 +944,22 @@ $obj$objext: $deps
|
||||
mv $obj$depext.tmp $obj$depext; \\
|
||||
fi
|
||||
EOF
|
||||
} else {
|
||||
$recipe .= <<"EOF";
|
||||
\$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
|
||||
EOF
|
||||
if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
|
||||
$recipe .= <<"EOF";
|
||||
-\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
|
||||
>$obj$depext.tmp 2>/dev/null
|
||||
-\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
|
||||
\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
|
||||
rm -f $obj$depext.tmp; \\
|
||||
else \\
|
||||
mv $obj$depext.tmp $obj$depext; \\
|
||||
fi
|
||||
EOF
|
||||
}
|
||||
}
|
||||
return $recipe;
|
||||
}
|
||||
@@ -1085,7 +1069,7 @@ $bin$exeext: $objs $deps
|
||||
APPNAME=$bin$exeext OBJECTS="$objs" \\
|
||||
LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
|
||||
CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
|
||||
LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\
|
||||
LDFLAGS='\$(LDFLAGS)' \\
|
||||
link_app.$shlib_target
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ tests: build_generated build_programs_nodep build_engines_nodep depend
|
||||
set SRCTOP=$(SRCDIR)
|
||||
set BLDTOP=$(BLDDIR)
|
||||
set PERL=$(PERL)
|
||||
set OPENSSL_DEBUG_MEMORY=on
|
||||
"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
|
||||
@rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
|
||||
@echo "Tests are not supported with your chosen Configure options"
|
||||
@@ -322,7 +323,7 @@ uninstall_html_docs:
|
||||
|
||||
# Building targets ###################################################
|
||||
|
||||
configdata.pm: "{- $config{build_file_template} -}" "$(SRCDIR)\Configurations\common.tmpl" "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_infos}}) -}
|
||||
configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
|
||||
@echo "Detected changed: $?"
|
||||
@echo "Reconfiguring..."
|
||||
"$(PERL)" "$(SRCDIR)\Configure" reconf
|
||||
|
||||
317
Configure
317
Configure
@@ -66,6 +66,22 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||
# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2
|
||||
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
|
||||
# -<xxx> +<xxx> compiler options are passed through
|
||||
# -static while -static is also a pass-through compiler option (and
|
||||
# as such is limited to environments where it's actually
|
||||
# meaningful), it triggers a number configuration options,
|
||||
# namely no-dso, no-pic, no-shared and no-threads. It is
|
||||
# argued that the only reason to produce statically linked
|
||||
# binaries (and in context it means executables linked with
|
||||
# -static flag, and not just executables linked with static
|
||||
# libcrypto.a) is to eliminate dependency on specific run-time,
|
||||
# a.k.a. libc version. The mentioned config options are meant
|
||||
# to achieve just that. Unfortunately on Linux it's impossible
|
||||
# to eliminate the dependency completely for openssl executable
|
||||
# because of getaddrinfo and gethostbyname calls, which can
|
||||
# invoke dynamically loadable library facility anyway to meet
|
||||
# the lookup requests. For this reason on Linux statically
|
||||
# linked openssl executable has rather debugging value than
|
||||
# production quality.
|
||||
#
|
||||
# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
|
||||
# provided to stack calls. Generates unique stack functions for
|
||||
@@ -184,6 +200,45 @@ my $local_config_envname = 'OPENSSL_LOCAL_CONFIG_DIR';
|
||||
$config{sourcedir} = abs2rel($srcdir);
|
||||
$config{builddir} = abs2rel($blddir);
|
||||
|
||||
# Collect reconfiguration information if needed
|
||||
my @argvcopy=@ARGV;
|
||||
|
||||
if (grep /^reconf(igure)?$/, @argvcopy) {
|
||||
if (-f "./configdata.pm") {
|
||||
my $file = "./configdata.pm";
|
||||
unless (my $return = do $file) {
|
||||
die "couldn't parse $file: $@" if $@;
|
||||
die "couldn't do $file: $!" unless defined $return;
|
||||
die "couldn't run $file" unless $return;
|
||||
}
|
||||
|
||||
@argvcopy = defined($configdata::config{perlargv}) ?
|
||||
@{$configdata::config{perlargv}} : ();
|
||||
die "Incorrect data to reconfigure, please do a normal configuration\n"
|
||||
if (grep(/^reconf/,@argvcopy));
|
||||
$ENV{CROSS_COMPILE} = $configdata::config{cross_compile_prefix}
|
||||
if defined($configdata::config{cross_compile_prefix});
|
||||
$ENV{CC} = $configdata::config{cc}
|
||||
if defined($configdata::config{cc});
|
||||
$ENV{BUILDFILE} = $configdata::config{build_file}
|
||||
if defined($configdata::config{build_file});
|
||||
$ENV{$local_config_envname} = $configdata::config{local_config_dir}
|
||||
if defined($configdata::config{local_config_dir});
|
||||
|
||||
print "Reconfiguring with: ", join(" ",@argvcopy), "\n";
|
||||
print " CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
|
||||
if $ENV{CROSS_COMPILE};
|
||||
print " CC = ",$ENV{CC},"\n" if $ENV{CC};
|
||||
print " BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE};
|
||||
print " $local_config_envname = ",$ENV{$local_config_envname},"\n"
|
||||
if $ENV{$local_config_envname};
|
||||
} else {
|
||||
die "Insufficient data to reconfigure, please do a normal configuration\n";
|
||||
}
|
||||
}
|
||||
|
||||
$config{perlargv} = [ @argvcopy ];
|
||||
|
||||
# Collect version numbers
|
||||
$config{version} = "unknown";
|
||||
$config{version_num} = "unknown";
|
||||
@@ -230,7 +285,7 @@ if (defined $ENV{$local_config_envname}) {
|
||||
}
|
||||
|
||||
|
||||
print "Configuring OpenSSL version $config{version} (0x$config{version_num})\n";
|
||||
print "Configuring OpenSSL version $config{version} ($config{version_num})\n";
|
||||
|
||||
$config{prefix}="";
|
||||
$config{openssldir}="";
|
||||
@@ -245,7 +300,7 @@ my $default_ranlib;
|
||||
$config{fips}=0;
|
||||
|
||||
# Top level directories to build
|
||||
$config{dirs} = [ "crypto", "ssl", "engines", "apps", "test", "tools", "fuzz" ];
|
||||
$config{dirs} = [ "crypto", "ssl", "engines", "apps", "test", "util", "tools", "fuzz" ];
|
||||
# crypto/ subdirectories to build
|
||||
$config{sdirs} = [
|
||||
"objects",
|
||||
@@ -483,62 +538,11 @@ my $target="";
|
||||
$config{options}="";
|
||||
$config{build_type} = "release";
|
||||
|
||||
my @argvcopy=@ARGV;
|
||||
|
||||
if (grep /^reconf(igure)?$/, @argvcopy) {
|
||||
if (-f "./configdata.pm") {
|
||||
my $file = "./configdata.pm";
|
||||
unless (my $return = do $file) {
|
||||
die "couldn't parse $file: $@" if $@;
|
||||
die "couldn't do $file: $!" unless defined $return;
|
||||
die "couldn't run $file" unless $return;
|
||||
}
|
||||
|
||||
@argvcopy = defined($configdata::config{perlargv}) ?
|
||||
@{$configdata::config{perlargv}} : ();
|
||||
die "Incorrect data to reconfigure, please do a normal configuration\n"
|
||||
if (grep(/^reconf/,@argvcopy));
|
||||
$ENV{CROSS_COMPILE} = $configdata::config{cross_compile_prefix}
|
||||
if defined($configdata::config{cross_compile_prefix});
|
||||
$ENV{CC} = $configdata::config{cc}
|
||||
if defined($configdata::config{cc});
|
||||
|
||||
print "Reconfiguring with: ", join(" ",@argvcopy), "\n";
|
||||
print " CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
|
||||
if $ENV{CROSS_COMPILE};
|
||||
print " CC = ",$ENV{CC},"\n" if $ENV{CC};
|
||||
} elsif (open IN, "<Makefile") {
|
||||
#
|
||||
# THIS SECTION IS TEMPORARY, it helps transitioning from Makefile
|
||||
# centered information gathering the reading configdata.pm
|
||||
#
|
||||
while (<IN>) {
|
||||
s|\R$||;
|
||||
if (/^CONFIGURE_ARGS=\s*(.*)\s*/) {
|
||||
# Older form, we split the string and hope for the best
|
||||
@argvcopy = split /\s+/, $_;
|
||||
die "Incorrect data to reconfigure, please do a normal configuration\n"
|
||||
if (grep(/^reconf/,@argvcopy));
|
||||
} elsif (/^CROSS_COMPILE=\s*(.*)/) {
|
||||
$ENV{CROSS_COMPILE}=$1;
|
||||
} elsif (/^CC=\s*(?:\$\(CROSS_COMPILE\))?(.*?)$/) {
|
||||
$ENV{CC}=$1;
|
||||
}
|
||||
}
|
||||
#
|
||||
# END OF TEMPORARY SECTION
|
||||
#
|
||||
} else {
|
||||
die "Insufficient data to reconfigure, please do a normal configuration\n";
|
||||
}
|
||||
}
|
||||
|
||||
$config{perlargv} = [ @argvcopy ];
|
||||
|
||||
my %unsupported_options = ();
|
||||
my %deprecated_options = ();
|
||||
foreach (@argvcopy)
|
||||
while (@argvcopy)
|
||||
{
|
||||
$_ = shift @argvcopy;
|
||||
# VMS is a case insensitive environment, and depending on settings
|
||||
# out of our control, we may receive options uppercased. Let's
|
||||
# downcase at least the part before any equal sign.
|
||||
@@ -725,9 +729,18 @@ foreach (@argvcopy)
|
||||
{
|
||||
$libs.=$_." ";
|
||||
}
|
||||
elsif (/^-rpath$/ or /^-R$/)
|
||||
# -rpath is the OSF1 rpath flag
|
||||
# -R is the old Solaris rpath flag
|
||||
{
|
||||
my $rpath = shift(@argvcopy) || "";
|
||||
$rpath .= " " if $rpath ne "";
|
||||
$libs.=$_." ".$rpath;
|
||||
}
|
||||
elsif (/^-static$/)
|
||||
{
|
||||
$libs.=$_." ";
|
||||
$disabled{"dso"} = "forced";
|
||||
$disabled{"pic"} = "forced";
|
||||
$disabled{"shared"} = "forced";
|
||||
$disabled{"threads"} = "forced";
|
||||
@@ -776,6 +789,13 @@ foreach (@argvcopy)
|
||||
}
|
||||
}
|
||||
|
||||
if ($libs =~ /(^|\s)-Wl,-rpath,/
|
||||
&& !$disabled{shared}
|
||||
&& !($disabled{asan} && $disabled{msan} && $disabled{ubsan})) {
|
||||
die "***** Cannot simultaneously use -rpath, shared libraries, and\n",
|
||||
"***** any of asan, msan or ubsan\n";
|
||||
}
|
||||
|
||||
if ($config{fips})
|
||||
{
|
||||
delete $disabled{"shared"} if ($disabled{"shared"} =~ /^default/);
|
||||
@@ -800,7 +820,9 @@ while (@tocheckfor) {
|
||||
@tocheckfor = (keys %new_tocheckfor);
|
||||
}
|
||||
|
||||
our $die = sub { die @_; };
|
||||
if ($target eq "TABLE") {
|
||||
local $die = sub { warn @_; };
|
||||
foreach (sort keys %table) {
|
||||
print_table_entry($_, "TABLE");
|
||||
}
|
||||
@@ -815,6 +837,7 @@ if ($target eq "LIST") {
|
||||
}
|
||||
|
||||
if ($target eq "HASH") {
|
||||
local $die = sub { warn @_; };
|
||||
print "%table = (\n";
|
||||
foreach (sort keys %table) {
|
||||
print_table_entry($_, "HASH");
|
||||
@@ -856,33 +879,35 @@ foreach (sort (keys %disabled))
|
||||
@{$config{dirs}} = grep !/^engines$/, @{$config{dirs}};
|
||||
@{$config{sdirs}} = grep !/^engine$/, @{$config{sdirs}};
|
||||
push @{$config{openssl_other_defines}}, "OPENSSL_NO_ENGINE";
|
||||
print " OPENSSL_NO_ENGINE (skip engines)";
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($ALGO, $algo);
|
||||
($ALGO = $algo = $_) =~ tr/[\-a-z]/[_A-Z]/;
|
||||
my ($WHAT, $what);
|
||||
|
||||
if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/ || /^async$/
|
||||
|| /^autoalginit/ || /^autoerrinit/)
|
||||
($WHAT = $what = $_) =~ tr/[\-a-z]/[_A-Z]/;
|
||||
|
||||
# Fix up C macro end names
|
||||
$WHAT = "RMD160" if $what eq "ripemd";
|
||||
|
||||
# fix-up crypto/directory name(s)
|
||||
$what = "ripemd" if $what eq "rmd160";
|
||||
$what = "whrlpool" if $what eq "whirlpool";
|
||||
|
||||
if ($what ne "async" && $what ne "err"
|
||||
&& grep { $_ eq $what } @{$config{sdirs}})
|
||||
{
|
||||
push @{$config{openssl_other_defines}}, "OPENSSL_NO_$ALGO";
|
||||
print " OPENSSL_NO_$ALGO";
|
||||
push @{$config{openssl_algorithm_defines}}, "OPENSSL_NO_$WHAT";
|
||||
@{$config{sdirs}} = grep { $_ ne $what} @{$config{sdirs}};
|
||||
|
||||
if (/^err$/) { push @user_defines, "OPENSSL_NO_ERR"; }
|
||||
print " OPENSSL_NO_$WHAT (skip dir)";
|
||||
}
|
||||
else
|
||||
{
|
||||
($ALGO,$algo) = ("RMD160","rmd160") if ($algo eq "ripemd");
|
||||
push @{$config{openssl_other_defines}}, "OPENSSL_NO_$WHAT";
|
||||
print " OPENSSL_NO_$WHAT";
|
||||
|
||||
push @{$config{openssl_algorithm_defines}}, "OPENSSL_NO_$ALGO";
|
||||
print " OPENSSL_NO_$ALGO";
|
||||
|
||||
# fix-up crypto/directory name(s)
|
||||
$algo="whrlpool" if $algo eq "whirlpool";
|
||||
$algo="ripemd" if $algo eq "rmd160";
|
||||
@{$config{sdirs}} = grep { $_ ne $algo} @{$config{sdirs}};
|
||||
|
||||
print " (skip dir)";
|
||||
if (/^err$/) { push @user_defines, "OPENSSL_NO_ERR"; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,6 +931,8 @@ my %target = resolve_config($target);
|
||||
|
||||
&usage if (!%target || $target{template});
|
||||
|
||||
my %conf_files = map { $_ => 1 } (@{$target{_conf_fname_int}});
|
||||
$config{conf_files} = [ sort keys %conf_files ];
|
||||
%target = ( %{$table{DEFAULTS}}, %target );
|
||||
|
||||
$target{exe_extension}="";
|
||||
@@ -938,8 +965,12 @@ $target{nm} = $ENV{'NM'} || $target{nm} || "nm";
|
||||
$target{rc} =
|
||||
$ENV{'RC'} || $ENV{'WINDRES'} || $target{rc} || "windres";
|
||||
|
||||
# Cache the C compiler command for reconfiguration
|
||||
# Allow overriding the build file name
|
||||
$target{build_file} = $ENV{BUILDFILE} || $target{build_file} || "Makefile";
|
||||
|
||||
# Cache information necessary for reconfiguration
|
||||
$config{cc} = $target{cc};
|
||||
$config{build_file} = $target{build_file};
|
||||
|
||||
# For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_
|
||||
# or release_ attributes.
|
||||
@@ -1126,6 +1157,9 @@ unless ($disabled{asm}) {
|
||||
push @{$config{defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
|
||||
push @{$config{defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
|
||||
}
|
||||
if ($target{rc4_asm_src} ne $table{DEFAULTS}->{rc4_asm_src}) {
|
||||
push @{$config{defines}}, "RC4_ASM";
|
||||
}
|
||||
if ($target{md5_asm_src}) {
|
||||
push @{$config{defines}}, "MD5_ASM";
|
||||
}
|
||||
@@ -1176,7 +1210,7 @@ if ($^O ne "VMS" && !$disabled{makedepend}) {
|
||||
# We know that GNU C version 3 and up as well as all clang
|
||||
# versions support dependency generation
|
||||
$config{makedepprog} = $ccpcc
|
||||
if (/clang/ || (/gcc/ && $compiler_major > 3));
|
||||
if (/clang/ || (/gcc/ && $compiler_major >= 3));
|
||||
$ecc = "clang" if /clang/;
|
||||
$ecc = "gcc" if /gcc/;
|
||||
last if ($config{makedepprog} || !$lines--);
|
||||
@@ -1292,31 +1326,6 @@ my %unified_info = ();
|
||||
|
||||
my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO});
|
||||
if ($builder eq "unified") {
|
||||
# Store the name of the template file we will build the build file from
|
||||
# in %config. This may be useful for the build file itself.
|
||||
my $build_file_template;
|
||||
|
||||
for my $filename (( $builder_platform."-".$target{build_file}.".tmpl",
|
||||
$target{build_file}.".tmpl" )) {
|
||||
if (defined $ENV{$local_config_envname}) {
|
||||
if ($^O eq 'VMS') {
|
||||
# VMS environment variables are logical names,
|
||||
# which can be used as is
|
||||
$build_file_template = $local_config_envname . ':' . $filename;
|
||||
} else {
|
||||
$build_file_template = catfile($ENV{$local_config_envname},
|
||||
$filename);
|
||||
}
|
||||
}
|
||||
|
||||
last if -f $build_file_template;
|
||||
|
||||
$build_file_template = catfile($srcdir, "Configurations", $filename);
|
||||
|
||||
last if -f $build_file_template;
|
||||
}
|
||||
$config{build_file_template} = $build_file_template;
|
||||
|
||||
use lib catdir(dirname(__FILE__),"util");
|
||||
use with_fallback qw(Text::Template);
|
||||
|
||||
@@ -1353,6 +1362,47 @@ if ($builder eq "unified") {
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Store the name of the template file we will build the build file from
|
||||
# in %config. This may be useful for the build file itself.
|
||||
my @build_file_template_names =
|
||||
( $builder_platform."-".$target{build_file}.".tmpl",
|
||||
$target{build_file}.".tmpl" );
|
||||
my @build_file_templates = ();
|
||||
|
||||
# First, look in the user provided directory, if given
|
||||
if (defined $ENV{$local_config_envname}) {
|
||||
@build_file_templates =
|
||||
map {
|
||||
if ($^O eq 'VMS') {
|
||||
# VMS environment variables are logical names,
|
||||
# which can be used as is
|
||||
$local_config_envname . ':' . $_;
|
||||
} else {
|
||||
catfile($ENV{$local_config_envname}, $_);
|
||||
}
|
||||
}
|
||||
@build_file_template_names;
|
||||
}
|
||||
# Then, look in our standard directory
|
||||
push @build_file_templates,
|
||||
( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir) }
|
||||
@build_file_template_names );
|
||||
|
||||
my $build_file_template;
|
||||
for $_ (@build_file_templates) {
|
||||
$build_file_template = $_;
|
||||
last if -f $build_file_template;
|
||||
|
||||
$build_file_template = undef;
|
||||
}
|
||||
if (!defined $build_file_template) {
|
||||
die "*** Couldn't find any of:\n", join("\n", @build_file_templates), "\n";
|
||||
}
|
||||
$config{build_file_templates}
|
||||
= [ $build_file_template,
|
||||
cleanfile($srcdir, catfile("Configurations", "common.tmpl"),
|
||||
$blddir) ];
|
||||
|
||||
my @build_infos = ( [ ".", "build.info" ] );
|
||||
foreach (@{$config{dirs}}) {
|
||||
push @build_infos, [ $_, "build.info" ]
|
||||
@@ -2028,8 +2078,7 @@ print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} ne $def_int;
|
||||
my %builders = (
|
||||
unified => sub {
|
||||
run_dofile(catfile($blddir, $target{build_file}),
|
||||
$config{build_file_template},
|
||||
catfile($srcdir, "Configurations", "common.tmpl"));
|
||||
@{$config{build_file_templates}});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -2207,7 +2256,8 @@ sub read_config {
|
||||
close(CONFFILE);
|
||||
my %targets = ();
|
||||
{
|
||||
local %table = %::table; # Protect %table from tampering
|
||||
# Protect certain tables from tampering
|
||||
local %table = %::table;
|
||||
|
||||
eval $content;
|
||||
warn $@ if $@;
|
||||
@@ -2222,7 +2272,9 @@ sub read_config {
|
||||
warn "Misconfigured target configuration for $_ (should be a hash table), ignoring...\n";
|
||||
}
|
||||
delete $targets{$_};
|
||||
}
|
||||
} else {
|
||||
$targets{$_}->{_conf_fname_int} = add([ $fname ]);
|
||||
}
|
||||
}
|
||||
|
||||
%table = (%table, %targets);
|
||||
@@ -2391,7 +2443,8 @@ sub run_dofile
|
||||
foreach (@templates) {
|
||||
die "Can't open $_, $!" unless -f $_;
|
||||
}
|
||||
my $cmd = "$config{perl} \"-I.\" \"-Mconfigdata\" \"$dofile\" -o\"Configure\" \"".join("\" \"",@templates)."\" > \"$out.new\"";
|
||||
my $perlcmd = (quotify("maybeshell", $config{perl}))[0];
|
||||
my $cmd = "$perlcmd \"-I.\" \"-Mconfigdata\" \"$dofile\" -o\"Configure\" \"".join("\" \"",@templates)."\" > \"$out.new\"";
|
||||
#print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n";
|
||||
system($cmd);
|
||||
exit 1 if $? != 0;
|
||||
@@ -2438,41 +2491,53 @@ sub print_table_entry
|
||||
"unistd",
|
||||
"ld",
|
||||
"lflags",
|
||||
"loutflag",
|
||||
"plib_lflags",
|
||||
"ex_libs",
|
||||
"bn_ops",
|
||||
"cpuid_obj",
|
||||
"bn_obj",
|
||||
"ec_obj",
|
||||
"des_obj",
|
||||
"aes_obj",
|
||||
"bf_obj",
|
||||
"md5_obj",
|
||||
"sha1_obj",
|
||||
"cast_obj",
|
||||
"rc4_obj",
|
||||
"rmd160_obj",
|
||||
"rc5_obj",
|
||||
"wp_obj",
|
||||
"cmll_obj",
|
||||
"modes_obj",
|
||||
"padlock_obj",
|
||||
"apps_aux_src",
|
||||
"cpuid_asm_src",
|
||||
"uplink_aux_src",
|
||||
"bn_asm_src",
|
||||
"ec_asm_src",
|
||||
"des_asm_src",
|
||||
"aes_asm_src",
|
||||
"bf_asm_src",
|
||||
"md5_asm_src",
|
||||
"cast_asm_src",
|
||||
"sha1_asm_src",
|
||||
"rc4_asm_src",
|
||||
"rmd160_asm_src",
|
||||
"rc5_asm_src",
|
||||
"wp_asm_src",
|
||||
"cmll_asm_src",
|
||||
"modes_asm_src",
|
||||
"padlock_asm_src",
|
||||
"chacha_asm_src",
|
||||
"poly1035_asm_src",
|
||||
"thread_scheme",
|
||||
"perlasm_scheme",
|
||||
"dso_scheme",
|
||||
"shared_target",
|
||||
"shared_cflag",
|
||||
"shared_defines",
|
||||
"shared_ldflag",
|
||||
"shared_rcflag",
|
||||
"shared_extension",
|
||||
"shared_extension_simple",
|
||||
"shared_import_extension",
|
||||
"dso_extension",
|
||||
"obj_extension",
|
||||
"exe_extension",
|
||||
"ranlib",
|
||||
"ar",
|
||||
"arflags",
|
||||
"aroutflag",
|
||||
"rc",
|
||||
"rcflags",
|
||||
"rcoutflag",
|
||||
"mt",
|
||||
"mtflags",
|
||||
"mtinflag",
|
||||
"mtoutflag",
|
||||
"multilib",
|
||||
"build_scheme",
|
||||
);
|
||||
@@ -2551,6 +2616,14 @@ sub quotify {
|
||||
perl => sub { my $x = shift;
|
||||
$x =~ s/([\\\$\@"])/\\$1/g;
|
||||
return '"'.$x.'"'; },
|
||||
maybeshell => sub { my $x = shift;
|
||||
(my $y = $x) =~ s/([\\\"])/\\$1/g;
|
||||
if ($x ne $y || $x =~ m|\s|) {
|
||||
return '"'.$y.'"';
|
||||
} else {
|
||||
return $x;
|
||||
}
|
||||
},
|
||||
);
|
||||
my $for = shift;
|
||||
my $processor =
|
||||
|
||||
80
INSTALL
80
INSTALL
@@ -479,10 +479,9 @@
|
||||
no-<alg>
|
||||
Build without support for the specified algorithm, where
|
||||
<alg> is one of: bf, blake2, camellia, cast, chacha, cmac,
|
||||
des, dh, dsa, ecdh, ecdsa, idea, md4, md5, mdc2, ocb,
|
||||
ploy1305, rc2, rc4, rmd160, scrypt, seed or whirlpool. The
|
||||
"ripemd" algorithm is deprecated and if used is synonymous
|
||||
with rmd160.
|
||||
des, dh, dsa, ecdh, ecdsa, idea, md4, mdc2, ocb, poly1305,
|
||||
rc2, rc4, rmd160, scrypt, seed or whirlpool. The "ripemd"
|
||||
algorithm is deprecated and if used is synonymous with rmd160.
|
||||
|
||||
-Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx
|
||||
These system specific options will be passed through to the
|
||||
@@ -602,17 +601,14 @@
|
||||
("openssl"). The libraries will be built in the top-level directory,
|
||||
and the binary will be in the "apps" subdirectory.
|
||||
|
||||
If the build fails, look at the output. There may be reasons for
|
||||
the failure that aren't problems in OpenSSL itself (like missing
|
||||
standard headers). If you are having problems you can get help by
|
||||
sending an email to the openssl-users email list (see
|
||||
https://www.openssl.org/community/mailinglists.html for details). If it
|
||||
is a bug with OpenSSL itself, please report the problem to
|
||||
<rt@openssl.org> (note that your message will be recorded in the request
|
||||
tracker publicly readable at
|
||||
https://www.openssl.org/community/index.html#bugs and will be
|
||||
forwarded to a public mailing list). Please check out the request
|
||||
tracker. Maybe the bug was already reported or has already been
|
||||
If the build fails, look at the output. There may be reasons
|
||||
for the failure that aren't problems in OpenSSL itself (like
|
||||
missing standard headers). If you are having problems you can
|
||||
get help by sending an email to the openssl-users email list (see
|
||||
https://www.openssl.org/community/mailinglists.html for details). If
|
||||
it is a bug with OpenSSL itself, please open an issue on GitHub, at
|
||||
https://github.com/openssl/openssl/issues. Please review the existing
|
||||
ones first; maybe the bug was already reported or has already been
|
||||
fixed.
|
||||
|
||||
(If you encounter assembler error messages, try the "no-asm"
|
||||
@@ -770,6 +766,13 @@
|
||||
AR
|
||||
The name of the ar executable to use.
|
||||
|
||||
BUILDFILE
|
||||
Use a different build file name than the platform default
|
||||
("Makefile" on Unixly platforms, "makefile" on native Windows,
|
||||
"descrip.mms" on OpenVMS). This requires that there is a
|
||||
corresponding build file template. See Configurations/README
|
||||
for further information.
|
||||
|
||||
CC
|
||||
The compiler to use. Configure will attempt to pick a default
|
||||
compiler for your platform but this choice can be overridden
|
||||
@@ -786,13 +789,19 @@
|
||||
|
||||
OPENSSL_LOCAL_CONFIG_DIR
|
||||
OpenSSL comes with a database of information about how it
|
||||
should be built on different platforms. This information is
|
||||
held in ".conf" files in the Configurations directory. See the
|
||||
should be built on different platforms as well as build file
|
||||
templates for those platforms. The database is comprised of
|
||||
".conf" files in the Configurations directory. The build
|
||||
file templates reside there as well as ".tmpl" files. See the
|
||||
file Configurations/README for further information about the
|
||||
format of ".conf" files. As well as the standard ".conf" files
|
||||
it is possible to create your own ".conf" files and store them
|
||||
locally, outside the OpenSSL source tree. This environment
|
||||
variable can be set to the directory where these files are held.
|
||||
format of ".conf" files as well as information on the ".tmpl"
|
||||
files.
|
||||
In addition to the standard ".conf" and ".tmpl" files, it is
|
||||
possible to create your own ".conf" and ".tmpl" files and store
|
||||
them locally, outside the OpenSSL source tree. This environment
|
||||
variable can be set to the directory where these files are held
|
||||
and will have Configure to consider them in addition to the
|
||||
standard ones.
|
||||
|
||||
PERL
|
||||
The name of the Perl executable to use when building OpenSSL.
|
||||
@@ -887,8 +896,8 @@
|
||||
supported. If your platform does not provide pthreads or Windows threads then
|
||||
you should Configure with the "no-threads" option.
|
||||
|
||||
Note on shared libraries
|
||||
------------------------
|
||||
Notes on shared libraries
|
||||
-------------------------
|
||||
|
||||
For most systems the OpenSSL Configure script knows what is needed to
|
||||
build shared libraries for libcrypto and libssl. On these systems
|
||||
@@ -897,6 +906,31 @@
|
||||
where OpenSSL does not know how to build shared libraries the "no-shared"
|
||||
option will be forced and only static libraries will be created.
|
||||
|
||||
Shared libraries are named a little differently on different platforms.
|
||||
One way or another, they all have the major OpenSSL version number as
|
||||
part of the file name, i.e. for OpenSSL 1.1.x, 1.1 is somehow part of
|
||||
the name.
|
||||
|
||||
On most POSIXly platforms, shared libraries are named libcrypto.so.1.1
|
||||
and libssl.so.1.1.
|
||||
|
||||
on Cygwin, shared libraries are named cygcrypto-1.1.dll and cygssl-1.1.dll
|
||||
with import libraries libcrypto.dll.a and libssl.dll.a.
|
||||
|
||||
On Windows build with MSVC or using MingW, shared libraries are named
|
||||
libcrypto-1_1.dll and libssl-1_1.dll for 32-bit Windows, libcrypto-1_1-x64.dll
|
||||
and libssl-1_1-x64.dll for 64-bit x86_64 Windows, and libcrypto-1_1-ia64.dll
|
||||
and libssl-1_1-ia64.dll for IA64 Windows. With MSVC, the import libraries
|
||||
are named libcrypto.lib and libssl.lib, while with MingW, they are named
|
||||
libcrypto.dll.a and libssl.dll.a.
|
||||
|
||||
On VMS, shareable images (VMS speak for shared libraries) are named
|
||||
ossl$libcrypto0101_shr.exe and ossl$libssl0101_shr.exe. However, when
|
||||
OpenSSL is specifically built for 32-bit pointers, the shareable images
|
||||
are named ossl$libcrypto0101_shr32.exe and ossl$libssl0101_shr32.exe
|
||||
instead, and when built for 64-bit pointers, they are named
|
||||
ossl$libcrypto0101_shr64.exe and ossl$libssl0101_shr64.exe.
|
||||
|
||||
Note on random number generation
|
||||
--------------------------------
|
||||
|
||||
|
||||
@@ -150,8 +150,8 @@ LINK_SO_DSO= INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
|
||||
LINK_SO_SHLIB_VIA_O= \
|
||||
SHOBJECTS=$(DSTDIR)/lib$(LIBNAME).o; \
|
||||
ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
|
||||
( echo ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL lib$(LIBNAME).a $(LIBEXTRAS); \
|
||||
ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL $(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS) ); \
|
||||
( echo ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL lib$(LIBNAME).a $(LIBEXTRAS); \
|
||||
ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS) ); \
|
||||
$(LINK_SO) && ( echo rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
|
||||
|
||||
LINK_SO_SHLIB_UNPACKED= \
|
||||
@@ -176,7 +176,7 @@ DO_GNU_SO=\
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
$(DO_GNU_SO_COMMON)
|
||||
DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"
|
||||
DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS)"
|
||||
|
||||
#This is rather special. It's a special target with which one can link
|
||||
#applications without bothering with any features that have anything to
|
||||
@@ -220,7 +220,7 @@ link_shlib.bsd:
|
||||
fi; $(LINK_SO_SHLIB)
|
||||
link_app.bsd:
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBPATH)"; \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
|
||||
fi; $(LINK_APP)
|
||||
|
||||
# For Darwin AKA Mac OS/X (dyld)
|
||||
@@ -352,7 +352,7 @@ link_app.alpha-osf1:
|
||||
@if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_APP); \
|
||||
else \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -rpath $(LIBRPATH)"; \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
|
||||
fi; \
|
||||
$(LINK_APP)
|
||||
|
||||
@@ -385,7 +385,7 @@ link_app.solaris:
|
||||
@ if $(DETECT_GNU_LD); then \
|
||||
$(DO_GNU_APP); \
|
||||
else \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -R $(LIBRPATH)"; \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
|
||||
fi; \
|
||||
$(LINK_APP)
|
||||
|
||||
@@ -476,7 +476,7 @@ link_shlib.irix:
|
||||
fi; \
|
||||
$(LINK_SO_SHLIB)
|
||||
link_app.irix:
|
||||
@LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
|
||||
@LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
|
||||
$(LINK_APP)
|
||||
|
||||
# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
|
||||
@@ -497,8 +497,8 @@ link_dso.hpux:
|
||||
expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
|
||||
fi; \
|
||||
rm -f $$SHLIB$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_DSO) && chmod a=rx $$SHLIB$$SHLIB_SUFFIX
|
||||
rm -f $(DSTDIR)/$$SHLIB$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_DSO) && chmod a=rx $(DSTDIR)/$$SHLIB$$SHLIB_SUFFIX
|
||||
link_shlib.hpux:
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
|
||||
$(CALC_VERSIONS); \
|
||||
@@ -510,11 +510,11 @@ link_shlib.hpux:
|
||||
expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
|
||||
fi; \
|
||||
rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_SHLIB) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
rm -f $(DSTDIR)/$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
|
||||
$(LINK_SO_SHLIB) && chmod a=rx $(DSTDIR)/$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
link_app.hpux:
|
||||
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:"; \
|
||||
fi; \
|
||||
$(LINK_APP)
|
||||
|
||||
@@ -526,6 +526,7 @@ link_dso.aix:
|
||||
ALLSYMSFLAGS=''; \
|
||||
NOALLSYMSFLAGS=''; \
|
||||
SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
|
||||
rm -f $(DSTDIR)/$$SHLIB$$SHLIB_SOVER 2>&1 > /dev/null ; \
|
||||
$(LINK_SO_DSO);
|
||||
link_shlib.aix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
@@ -536,9 +537,10 @@ link_shlib.aix:
|
||||
ALLSYMSFLAGS='-bnogc'; \
|
||||
NOALLSYMSFLAGS=''; \
|
||||
SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
|
||||
rm -f $(DSTDIR)/$$SHLIB$$SHLIB_SOVER 2>&1 > /dev/null ; \
|
||||
$(LINK_SO_SHLIB_VIA_O)
|
||||
link_app.aix:
|
||||
LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
|
||||
LDFLAGS="$(CFLAGS) -Wl,-bsvr4 $(LDFLAGS)"; \
|
||||
$(LINK_APP)
|
||||
|
||||
|
||||
|
||||
21
NEWS
21
NEWS
@@ -5,7 +5,26 @@
|
||||
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.2h and OpenSSL 1.1.0 [in pre-release]
|
||||
Major changes between OpenSSL 1.1.0b and OpenSSL 1.1.0c [10 Nov 2016]
|
||||
|
||||
o ChaCha20/Poly1305 heap-buffer-overflow (CVE-2016-7054)
|
||||
o CMS Null dereference (CVE-2016-7053)
|
||||
o Montgomery multiplication may produce incorrect results (CVE-2016-7055)
|
||||
|
||||
Major changes between OpenSSL 1.1.0a and OpenSSL 1.1.0b [26 Sep 2016]
|
||||
|
||||
o Fix Use After Free for large message sizes (CVE-2016-6309)
|
||||
|
||||
Major changes between OpenSSL 1.1.0 and OpenSSL 1.1.0a [22 Sep 2016]
|
||||
|
||||
o OCSP Status Request extension unbounded memory growth (CVE-2016-6304)
|
||||
o SSL_peek() hang on empty record (CVE-2016-6305)
|
||||
o Excessive allocation of memory in tls_get_message_header()
|
||||
(CVE-2016-6307)
|
||||
o Excessive allocation of memory in dtls1_preprocess_fragment()
|
||||
(CVE-2016-6308)
|
||||
|
||||
Major changes between OpenSSL 1.0.2h and OpenSSL 1.1.0 [25 Aug 2016]
|
||||
|
||||
o Copyright text was shrunk to a boilerplate that points to the license
|
||||
o "shared" builds are now the default when possible
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
PREFIX: %ProgramFiles(86)%\OpenSSL
|
||||
OPENSSLDIR: %CommonProgramFiles(86)%\SSL
|
||||
|
||||
For VC-WIN32, the following defaults are use:
|
||||
For VC-WIN64, the following defaults are use:
|
||||
|
||||
PREFIX: %ProgramW6432%\OpenSSL
|
||||
OPENSSLDIR: %CommonProgramW6432%\SSL
|
||||
|
||||
35
README
35
README
@@ -1,5 +1,5 @@
|
||||
|
||||
OpenSSL 1.1.0-pre7-dev
|
||||
OpenSSL 1.1.0c 10 Nov 2016
|
||||
|
||||
Copyright (c) 1998-2016 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
@@ -59,13 +59,13 @@
|
||||
If you have any problems with OpenSSL then please take the following steps
|
||||
first:
|
||||
|
||||
- Download the current snapshot from ftp://ftp.openssl.org/snapshot/
|
||||
- Download the latest version from the repository
|
||||
to see if the problem has already been addressed
|
||||
- Remove ASM versions of libraries
|
||||
- Configure with no-asm
|
||||
- Remove compiler optimisation flags
|
||||
|
||||
If you wish to report a bug then please include the following information in
|
||||
any bug report:
|
||||
If you wish to report a bug then please include the following information
|
||||
and create an issue on GitHub:
|
||||
|
||||
- OpenSSL version: output of 'openssl version -a'
|
||||
- Any "Configure" options that you selected during compilation of the
|
||||
@@ -76,27 +76,10 @@
|
||||
- Problem Description (steps that will reproduce the problem, if known)
|
||||
- Stack Traceback (if the application dumps core)
|
||||
|
||||
Email the report to:
|
||||
|
||||
rt@openssl.org
|
||||
|
||||
In order to avoid spam, this is a moderated mailing list, and it might
|
||||
take a couple of days for the ticket to show up. (We also scan posts to make
|
||||
sure that security disclosures aren't publicly posted by mistake.) Mail
|
||||
to this address is recorded in the public RT (request tracker) database
|
||||
(see https://www.openssl.org/community/index.html#bugs for details) and
|
||||
also forwarded the public openssl-dev mailing list. Confidential mail
|
||||
may be sent to openssl-security@openssl.org (PGP key available from the
|
||||
key servers).
|
||||
|
||||
Please do NOT use this for general assistance or support queries.
|
||||
Just because something doesn't work the way you expect does not mean it
|
||||
is necessarily a bug in OpenSSL. Use the openssl-users email list for this type
|
||||
of query.
|
||||
|
||||
You can also make GitHub pull requests. See the CONTRIBUTING file for more
|
||||
details.
|
||||
|
||||
HOW TO CONTRIBUTE TO OpenSSL
|
||||
----------------------------
|
||||
|
||||
@@ -105,7 +88,7 @@
|
||||
LEGALITIES
|
||||
----------
|
||||
|
||||
A number of nations, in particular the U.S., restrict the use or export
|
||||
of cryptography. If you are potentially subject to such restrictions
|
||||
you should seek competent professional legal advice before attempting to
|
||||
develop or distribute cryptographic code.
|
||||
A number of nations restrict the use or export of cryptography. If you
|
||||
are potentially subject to such restrictions you should seek competent
|
||||
professional legal advice before attempting to develop or distribute
|
||||
cryptographic code.
|
||||
|
||||
60
apps/apps.c
60
apps/apps.c
@@ -692,7 +692,10 @@ EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
|
||||
BIO_printf(bio_err, "no engine specified\n");
|
||||
else {
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data);
|
||||
if (ENGINE_init(e)) {
|
||||
pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data);
|
||||
ENGINE_finish(e);
|
||||
}
|
||||
if (pkey == NULL) {
|
||||
BIO_printf(bio_err, "cannot load %s from engine\n", key_descrip);
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -1240,11 +1243,13 @@ static ENGINE *try_load_engine(const char *engine)
|
||||
}
|
||||
return e;
|
||||
}
|
||||
#endif
|
||||
|
||||
ENGINE *setup_engine(const char *engine, int debug)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (engine) {
|
||||
if (strcmp(engine, "auto") == 0) {
|
||||
BIO_printf(bio_err, "enabling auto ENGINE support\n");
|
||||
@@ -1269,13 +1274,19 @@ ENGINE *setup_engine(const char *engine, int debug)
|
||||
}
|
||||
|
||||
BIO_printf(bio_err, "engine \"%s\" set.\n", ENGINE_get_id(e));
|
||||
|
||||
/* Free our "structural" reference. */
|
||||
ENGINE_free(e);
|
||||
}
|
||||
#endif
|
||||
return e;
|
||||
}
|
||||
|
||||
void release_engine(ENGINE *e)
|
||||
{
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (e != NULL)
|
||||
/* Free our "structural" reference. */
|
||||
ENGINE_free(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned long index_serial_hash(const OPENSSL_CSTRING *a)
|
||||
{
|
||||
@@ -2300,6 +2311,36 @@ int app_isdir(const char *name)
|
||||
#endif
|
||||
|
||||
/* raw_read|write section */
|
||||
#if defined(__VMS)
|
||||
# include "vms_term_sock.h"
|
||||
static int stdin_sock = -1;
|
||||
|
||||
static void close_stdin_sock(void)
|
||||
{
|
||||
TerminalSocket (TERM_SOCK_DELETE, &stdin_sock);
|
||||
}
|
||||
|
||||
int fileno_stdin(void)
|
||||
{
|
||||
if (stdin_sock == -1) {
|
||||
TerminalSocket(TERM_SOCK_CREATE, &stdin_sock);
|
||||
atexit(close_stdin_sock);
|
||||
}
|
||||
|
||||
return stdin_sock;
|
||||
}
|
||||
#else
|
||||
int fileno_stdin(void)
|
||||
{
|
||||
return fileno(stdin);
|
||||
}
|
||||
#endif
|
||||
|
||||
int fileno_stdout(void)
|
||||
{
|
||||
return fileno(stdout);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(STD_INPUT_HANDLE)
|
||||
int raw_read_stdin(void *buf, int siz)
|
||||
{
|
||||
@@ -2309,10 +2350,17 @@ int raw_read_stdin(void *buf, int siz)
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
#elif defined(__VMS)
|
||||
#include <sys/socket.h>
|
||||
|
||||
int raw_read_stdin(void *buf, int siz)
|
||||
{
|
||||
return recv(fileno_stdin(), buf, siz, 0);
|
||||
}
|
||||
#else
|
||||
int raw_read_stdin(void *buf, int siz)
|
||||
{
|
||||
return read(fileno(stdin), buf, siz);
|
||||
return read(fileno_stdin(), buf, siz);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2328,7 +2376,7 @@ int raw_write_stdout(const void *buf, int siz)
|
||||
#else
|
||||
int raw_write_stdout(const void *buf, int siz)
|
||||
{
|
||||
return write(fileno(stdout), buf, siz);
|
||||
return write(fileno_stdout(), buf, siz);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -430,11 +430,9 @@ __owur int ctx_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
|
||||
|
||||
#endif
|
||||
|
||||
# ifdef OPENSSL_NO_ENGINE
|
||||
# define setup_engine(engine, debug) NULL
|
||||
# else
|
||||
ENGINE *setup_engine(const char *engine, int debug);
|
||||
# endif
|
||||
void release_engine(ENGINE *e);
|
||||
|
||||
# ifndef OPENSSL_NO_OCSP
|
||||
OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
|
||||
const char *host, const char *path,
|
||||
@@ -548,6 +546,8 @@ void store_setup_crl_download(X509_STORE *st);
|
||||
|
||||
int app_isdir(const char *);
|
||||
int app_access(const char *, int flag);
|
||||
int fileno_stdin(void);
|
||||
int fileno_stdout(void);
|
||||
int raw_read_stdin(void *, int);
|
||||
int raw_write_stdout(const void *, int);
|
||||
|
||||
|
||||
@@ -1236,6 +1236,7 @@ end_of_options:
|
||||
X509_CRL_free(crl);
|
||||
NCONF_free(conf);
|
||||
NCONF_free(extconf);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -1916,7 +1917,6 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
|
||||
sk = CONF_get_section(parms, "default");
|
||||
if (sk_CONF_VALUE_num(sk) == 0) {
|
||||
BIO_printf(bio_err, "no name/value pairs found in %s\n", infile);
|
||||
CONF_free(parms);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
26
apps/cms.c
26
apps/cms.c
@@ -72,7 +72,7 @@ typedef enum OPTION_choice {
|
||||
OPT_ASCIICRLF, OPT_NOINTERN, OPT_NOVERIFY, OPT_NOCERTS,
|
||||
OPT_NOATTR, OPT_NODETACH, OPT_NOSMIMECAP, OPT_BINARY, OPT_KEYID,
|
||||
OPT_NOSIGS, OPT_NO_CONTENT_VERIFY, OPT_NO_ATTR_VERIFY, OPT_INDEF,
|
||||
OPT_NOINDEF, OPT_NOOLDMIME, OPT_CRLFEOL, OPT_NOOUT, OPT_RR_PRINT,
|
||||
OPT_NOINDEF, OPT_CRLFEOL, OPT_NOOUT, OPT_RR_PRINT,
|
||||
OPT_RR_ALL, OPT_RR_FIRST, OPT_RCTFORM, OPT_CERTFILE, OPT_CAFILE,
|
||||
OPT_CAPATH, OPT_NOCAPATH, OPT_NOCAFILE,OPT_CONTENT, OPT_PRINT,
|
||||
OPT_SECRETKEY, OPT_SECRETKEYID, OPT_PWRI_PASSWORD, OPT_ECONTENT_TYPE,
|
||||
@@ -99,7 +99,7 @@ OPTIONS cms_options[] = {
|
||||
{"decrypt", OPT_DECRYPT, '-', "Decrypt encrypted message"},
|
||||
{"sign", OPT_SIGN, '-', "Sign message"},
|
||||
{"sign_receipt", OPT_SIGN_RECEIPT, '-', "Generate a signed receipt for the message"},
|
||||
{"resign", OPT_RESIGN, '-'},
|
||||
{"resign", OPT_RESIGN, '-', "Resign a signed message"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify signed message"},
|
||||
{"verify_retcode", OPT_VERIFY_RETCODE, '-'},
|
||||
{"verify_receipt", OPT_VERIFY_RECEIPT, '<'},
|
||||
@@ -122,22 +122,21 @@ OPTIONS cms_options[] = {
|
||||
"Don't include signers certificate when signing"},
|
||||
{"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"},
|
||||
{"nodetach", OPT_NODETACH, '-', "Use opaque signing"},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-'},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
{"binary", OPT_BINARY, '-', "Don't translate message to text"},
|
||||
{"keyid", OPT_KEYID, '-', "Use subject key identifier"},
|
||||
{"nosigs", OPT_NOSIGS, '-', "Don't verify message signature"},
|
||||
{"no_content_verify", OPT_NO_CONTENT_VERIFY, '-'},
|
||||
{"no_attr_verify", OPT_NO_ATTR_VERIFY, '-'},
|
||||
{"stream", OPT_INDEF, '-'},
|
||||
{"indef", OPT_INDEF, '-'},
|
||||
{"noindef", OPT_NOINDEF, '-'},
|
||||
{"nooldmime", OPT_NOOLDMIME, '-'},
|
||||
{"crlfeol", OPT_CRLFEOL, '-'},
|
||||
{"stream", OPT_INDEF, '-', "Enable CMS streaming"},
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream"},
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only" },
|
||||
{"noout", OPT_NOOUT, '-', "For the -cmsout operation do not output the parsed CMS structure"},
|
||||
{"receipt_request_print", OPT_RR_PRINT, '-'},
|
||||
{"receipt_request_print", OPT_RR_PRINT, '-', "Print CMS Receipt Request" },
|
||||
{"receipt_request_all", OPT_RR_ALL, '-'},
|
||||
{"receipt_request_first", OPT_RR_FIRST, '-'},
|
||||
{"rctform", OPT_RCTFORM, 'F'},
|
||||
{"rctform", OPT_RCTFORM, 'F', "Receipt file format"},
|
||||
{"certfile", OPT_CERTFILE, '<', "Other certificates file"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Trusted certificates file"},
|
||||
{"CApath", OPT_CAPATH, '/', "trusted certificates directory"},
|
||||
@@ -147,7 +146,8 @@ OPTIONS cms_options[] = {
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"content", OPT_CONTENT, '<',
|
||||
"Supply or override content for detached signature"},
|
||||
{"print", OPT_PRINT, '-', "For the -cmsout operation print out all fields of the CMS structure"},
|
||||
{"print", OPT_PRINT, '-',
|
||||
"For the -cmsout operation print out all fields of the CMS structure"},
|
||||
{"secretkey", OPT_SECRETKEY, 's'},
|
||||
{"secretkeyid", OPT_SECRETKEYID, 's'},
|
||||
{"pwri_password", OPT_PWRI_PASSWORD, 's'},
|
||||
@@ -346,9 +346,6 @@ int cms_main(int argc, char **argv)
|
||||
case OPT_NOINDEF:
|
||||
flags &= ~CMS_STREAM;
|
||||
break;
|
||||
case OPT_NOOLDMIME:
|
||||
flags |= CMS_NOOLDMIMETYPE;
|
||||
break;
|
||||
case OPT_CRLFEOL:
|
||||
mime_eol = "\r\n";
|
||||
flags |= CMS_CRLFEOL;
|
||||
@@ -1112,6 +1109,7 @@ int cms_main(int argc, char **argv)
|
||||
EVP_PKEY_free(key);
|
||||
CMS_ContentInfo_free(cms);
|
||||
CMS_ContentInfo_free(rcms);
|
||||
release_engine(e);
|
||||
BIO_free(rctin);
|
||||
BIO_free(in);
|
||||
BIO_free(indata);
|
||||
|
||||
@@ -41,7 +41,7 @@ OPTIONS crl_options[] = {
|
||||
{"fingerprint", OPT_FINGERPRINT, '-', "Print the crl fingerprint"},
|
||||
{"crlnumber", OPT_CRLNUMBER, '-', "Print CRL number"},
|
||||
{"badsig", OPT_BADSIG, '-', "Corrupt last byte of loaded CRL signature (for test)" },
|
||||
{"gendelta", OPT_GENDELTA, '<'},
|
||||
{"gendelta", OPT_GENDELTA, '<', "Other CRL to compare/diff to the Input one"},
|
||||
{"CApath", OPT_CAPATH, '/', "Verify CRL using certificates in dir"},
|
||||
{"CAfile", OPT_CAFILE, '<', "Verify CRL using certificates in file name"},
|
||||
{"no-CAfile", OPT_NOCAFILE, '-',
|
||||
|
||||
@@ -185,6 +185,10 @@ int dgst_main(int argc, char **argv)
|
||||
}
|
||||
argc = opt_num_rest();
|
||||
argv = opt_rest();
|
||||
if (keyfile != NULL && argc > 1) {
|
||||
BIO_printf(bio_err, "%s: Can only sign or verify one file.\n", prog);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (do_verify && !sigfile) {
|
||||
BIO_printf(bio_err,
|
||||
@@ -394,6 +398,7 @@ int dgst_main(int argc, char **argv)
|
||||
sk_OPENSSL_STRING_free(macopts);
|
||||
OPENSSL_free(sigbuf);
|
||||
BIO_free(bmd);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ int dhparam_main(int argc, char **argv)
|
||||
BIO *in = NULL, *out = NULL;
|
||||
DH *dh = NULL;
|
||||
char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL;
|
||||
ENGINE *e = NULL;
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
int dsaparam = 0;
|
||||
#endif
|
||||
@@ -104,7 +105,7 @@ int dhparam_main(int argc, char **argv)
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_CHECK:
|
||||
check = 1;
|
||||
@@ -356,6 +357,7 @@ int dhparam_main(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DH_free(dh);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -249,6 +249,7 @@ int dsa_main(int argc, char **argv)
|
||||
end:
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passin);
|
||||
OPENSSL_free(passout);
|
||||
return (ret);
|
||||
|
||||
@@ -66,6 +66,7 @@ OPTIONS dsaparam_options[] = {
|
||||
|
||||
int dsaparam_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
DSA *dsa = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
BN_GENCB *cb = NULL;
|
||||
@@ -105,7 +106,7 @@ int dsaparam_main(int argc, char **argv)
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_TIMEBOMB:
|
||||
# ifdef GENCB_TEST
|
||||
@@ -285,6 +286,7 @@ int dsaparam_main(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ int ec_main(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
EC_KEY_free(eckey);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passin);
|
||||
OPENSSL_free(passout);
|
||||
return (ret);
|
||||
|
||||
@@ -87,6 +87,7 @@ static OPT_PAIR encodings[] = {
|
||||
|
||||
int ecparam_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
BIGNUM *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
|
||||
BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
@@ -168,7 +169,7 @@ int ecparam_main(int argc, char **argv)
|
||||
need_rand = 1;
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -454,9 +455,10 @@ int ecparam_main(int argc, char **argv)
|
||||
BN_free(ec_order);
|
||||
BN_free(ec_cofactor);
|
||||
OPENSSL_free(buffer);
|
||||
EC_GROUP_free(group);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
EC_GROUP_free(group);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ int enc_main(int argc, char **argv)
|
||||
{
|
||||
static char buf[128];
|
||||
static const char magic[] = "Salted__";
|
||||
ENGINE *e = NULL;
|
||||
BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL, *rbio =
|
||||
NULL, *wbio = NULL;
|
||||
EVP_CIPHER_CTX *ctx = NULL;
|
||||
@@ -151,7 +152,7 @@ int enc_main(int argc, char **argv)
|
||||
passarg = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_D:
|
||||
enc = 0;
|
||||
@@ -552,6 +553,7 @@ int enc_main(int argc, char **argv)
|
||||
#ifdef ZLIB
|
||||
BIO_free(bzl);
|
||||
#endif
|
||||
release_engine(e);
|
||||
OPENSSL_free(pass);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ OPTIONS gendsa_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"out", OPT_OUT, '>', "Output the key to the specified file"},
|
||||
{"passout", OPT_PASSOUT, 's'},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
{"rand", OPT_RAND, 's',
|
||||
"Load the file(s) into the random number generator"},
|
||||
{"", OPT_CIPHER, '-', "Encrypt the output with any supported cipher"},
|
||||
@@ -46,6 +46,7 @@ OPTIONS gendsa_options[] = {
|
||||
|
||||
int gendsa_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
BIO *out = NULL, *in = NULL;
|
||||
DSA *dsa = NULL;
|
||||
const EVP_CIPHER *enc = NULL;
|
||||
@@ -74,7 +75,7 @@ int gendsa_main(int argc, char **argv)
|
||||
passoutarg = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_RAND:
|
||||
inrand = opt_arg();
|
||||
@@ -139,6 +140,7 @@ int gendsa_main(int argc, char **argv)
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passout);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -193,8 +193,8 @@ int genpkey_main(int argc, char **argv)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
release_engine(e);
|
||||
OPENSSL_free(pass);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ int genrsa_main(int argc, char **argv)
|
||||
BN_GENCB_free(cb);
|
||||
RSA_free(rsa);
|
||||
BIO_free_all(out);
|
||||
release_engine(eng);
|
||||
OPENSSL_free(passout);
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
|
||||
@@ -107,7 +107,8 @@ OPTIONS ocsp_options[] = {
|
||||
{"url", OPT_URL, 's', "Responder URL"},
|
||||
{"host", OPT_HOST, 's', "TCP/IP hostname:port to connect to"},
|
||||
{"port", OPT_PORT, 'p', "Port to run responder on"},
|
||||
{"ignore_err", OPT_IGNORE_ERR, '-'},
|
||||
{"ignore_err", OPT_IGNORE_ERR, '-',
|
||||
"Ignore Error response from OCSP responder, and retry "},
|
||||
{"noverify", OPT_NOVERIFY, '-', "Don't verify response at all"},
|
||||
{"nonce", OPT_NONCE, '-', "Add OCSP nonce to request"},
|
||||
{"no_nonce", OPT_NO_NONCE, '-', "Don't add OCSP nonce to request"},
|
||||
@@ -124,7 +125,8 @@ OPTIONS ocsp_options[] = {
|
||||
{"no_chain", OPT_NO_CHAIN, '-', "Don't chain verify response"},
|
||||
{"no_cert_checks", OPT_NO_CERT_CHECKS, '-',
|
||||
"Don't do additional checks on signing certificate"},
|
||||
{"no_explicit", OPT_NO_EXPLICIT, '-'},
|
||||
{"no_explicit", OPT_NO_EXPLICIT, '-',
|
||||
"Do not explicitly check the chain, just verify the root"},
|
||||
{"trust_other", OPT_TRUST_OTHER, '-',
|
||||
"Don't verify additional certificates"},
|
||||
{"no_intern", OPT_NO_INTERN, '-',
|
||||
|
||||
@@ -319,6 +319,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
|
||||
|| !EVP_DigestUpdate(md, magic, magic_len)
|
||||
|| !EVP_DigestUpdate(md, "$", 1)
|
||||
|| !EVP_DigestUpdate(md, salt_out, salt_len))
|
||||
goto err;
|
||||
|
||||
md2 = EVP_MD_CTX_new();
|
||||
if (md2 == NULL
|
||||
|
||||
@@ -574,6 +574,7 @@ int pkcs12_main(int argc, char **argv)
|
||||
PKCS12_free(p12);
|
||||
if (export_cert || inrand)
|
||||
app_RAND_write_file(NULL);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
sk_OPENSSL_STRING_free(canames);
|
||||
|
||||
@@ -33,7 +33,7 @@ OPTIONS pkcs7_options[] = {
|
||||
{"out", OPT_OUT, '>', "Output file"},
|
||||
{"noout", OPT_NOOUT, '-', "Don't output encoded data"},
|
||||
{"text", OPT_TEXT, '-', "Print full details of certificates"},
|
||||
{"print", OPT_PRINT, '-'},
|
||||
{"print", OPT_PRINT, '-', "Print out all fields of the PKCS7 structure"},
|
||||
{"print_certs", OPT_PRINT_CERTS, '-',
|
||||
"Print_certs print any certs or crl in the input"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
@@ -44,6 +44,7 @@ OPTIONS pkcs7_options[] = {
|
||||
|
||||
int pkcs7_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
PKCS7 *p7 = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM;
|
||||
@@ -90,7 +91,7 @@ int pkcs7_main(int argc, char **argv)
|
||||
print_certs = 1;
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -189,6 +190,7 @@ int pkcs7_main(int argc, char **argv)
|
||||
ret = 0;
|
||||
end:
|
||||
PKCS7_free(p7);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
return (ret);
|
||||
|
||||
@@ -38,7 +38,7 @@ OPTIONS pkcs8_options[] = {
|
||||
{"nocrypt", OPT_NOCRYPT, '-', "Use or expect unencrypted private key"},
|
||||
{"v2", OPT_V2, 's', "Use PKCS#5 v2.0 and cipher"},
|
||||
{"v1", OPT_V1, 's', "Use PKCS#5 v1.5 and cipher"},
|
||||
{"v2prf", OPT_V2PRF, 's'},
|
||||
{"v2prf", OPT_V2PRF, 's', "Set the PRF algorithm to use with PKCS#5 v2.0"},
|
||||
{"iter", OPT_ITER, 'p', "Specify the iteration count"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
|
||||
@@ -343,6 +343,7 @@ int pkcs8_main(int argc, char **argv)
|
||||
X509_SIG_free(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
EVP_PKEY_free(pkey);
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
OPENSSL_free(passin);
|
||||
|
||||
@@ -180,6 +180,7 @@ int pkey_main(int argc, char **argv)
|
||||
|
||||
end:
|
||||
EVP_PKEY_free(pkey);
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
OPENSSL_free(passin);
|
||||
|
||||
@@ -33,6 +33,7 @@ OPTIONS pkeyparam_options[] = {
|
||||
|
||||
int pkeyparam_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
int text = 0, noout = 0, ret = 1;
|
||||
@@ -58,7 +59,7 @@ int pkeyparam_main(int argc, char **argv)
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_TEXT:
|
||||
text = 1;
|
||||
@@ -95,6 +96,7 @@ int pkeyparam_main(int argc, char **argv)
|
||||
|
||||
end:
|
||||
EVP_PKEY_free(pkey);
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
|
||||
|
||||
@@ -323,6 +323,7 @@ int pkeyutl_main(int argc, char **argv)
|
||||
|
||||
end:
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
OPENSSL_free(buf_in);
|
||||
|
||||
@@ -39,6 +39,7 @@ OPTIONS rand_options[] = {
|
||||
|
||||
int rand_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
BIO *out = NULL;
|
||||
char *inrand = NULL, *outfile = NULL, *prog;
|
||||
OPTION_CHOICE o;
|
||||
@@ -60,7 +61,7 @@ int rand_main(int argc, char **argv)
|
||||
outfile = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
case OPT_RAND:
|
||||
inrand = opt_arg();
|
||||
@@ -125,6 +126,7 @@ int rand_main(int argc, char **argv)
|
||||
end:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -403,6 +403,7 @@ OPTIONS rehash_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: %s [options] [cert-directory...]\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Valid options are:\n"},
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"h", OPT_HELP, '-', "Display this summary"},
|
||||
{"compat", OPT_COMPAT, '-', "Create both new- and old-style hash links"},
|
||||
{"old", OPT_OLD, '-', "Use old-style hash to generate links"},
|
||||
{"n", OPT_N, '-', "Do not remove existing links"},
|
||||
|
||||
@@ -820,6 +820,7 @@ int req_main(int argc, char **argv)
|
||||
X509_REQ_free(req);
|
||||
X509_free(x509ss);
|
||||
ASN1_INTEGER_free(serial);
|
||||
release_engine(e);
|
||||
if (passin != nofree_passin)
|
||||
OPENSSL_free(passin);
|
||||
if (passout != nofree_passout)
|
||||
|
||||
@@ -294,6 +294,7 @@ int rsa_main(int argc, char **argv)
|
||||
} else
|
||||
ret = 0;
|
||||
end:
|
||||
release_engine(e);
|
||||
BIO_free_all(out);
|
||||
RSA_free(rsa);
|
||||
OPENSSL_free(passin);
|
||||
|
||||
@@ -267,6 +267,7 @@ int rsautl_main(int argc, char **argv)
|
||||
BIO_write(out, rsa_out, rsa_outlen);
|
||||
end:
|
||||
RSA_free(rsa);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
OPENSSL_free(rsa_in);
|
||||
|
||||
@@ -577,8 +577,8 @@ OPTIONS s_client_options[] = {
|
||||
{"cert", OPT_CERT, '<', "Certificate file to use, PEM format assumed"},
|
||||
{"certform", OPT_CERTFORM, 'F',
|
||||
"Certificate format (PEM or DER) PEM default"},
|
||||
{"key", OPT_KEY, '<', "Private key file to use, if not in -cert file"},
|
||||
{"keyform", OPT_KEYFORM, 'F', "Key format (PEM or DER) PEM default"},
|
||||
{"key", OPT_KEY, 's', "Private key file to use, if not in -cert file"},
|
||||
{"keyform", OPT_KEYFORM, 'E', "Key format (PEM, DER or engine) PEM default"},
|
||||
{"pass", OPT_PASS, 's', "Private key file pass phrase source"},
|
||||
{"CApath", OPT_CAPATH, '/', "PEM format directory of CA's"},
|
||||
{"CAfile", OPT_CAFILE, '<', "PEM format file of CA's"},
|
||||
@@ -812,7 +812,9 @@ int s_client_main(int argc, char **argv)
|
||||
int socket_family = AF_UNSPEC, socket_type = SOCK_STREAM;
|
||||
int starttls_proto = PROTO_OFF, crl_format = FORMAT_PEM, crl_download = 0;
|
||||
int write_tty, read_tty, write_ssl, read_ssl, tty_on, ssl_pending;
|
||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
|
||||
int at_eof = 0;
|
||||
#endif
|
||||
int read_buf_len = 0;
|
||||
int fallback_scsv = 0;
|
||||
long randamt = 0;
|
||||
@@ -854,7 +856,10 @@ int s_client_main(int argc, char **argv)
|
||||
enum { use_inet, use_unix, use_unknown } connect_type = use_unknown;
|
||||
int count4or6 = 0;
|
||||
int c_nbio = 0, c_msg = 0, c_ign_eof = 0, c_brief = 0;
|
||||
int c_tlsextdebug = 0, c_status_req = 0;
|
||||
int c_tlsextdebug = 0;
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
int c_status_req = 0;
|
||||
#endif
|
||||
BIO *bio_c_msg = NULL;
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
@@ -1065,7 +1070,9 @@ int s_client_main(int argc, char **argv)
|
||||
c_tlsextdebug = 1;
|
||||
break;
|
||||
case OPT_STATUS:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
c_status_req = 1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_WDEBUG:
|
||||
#ifdef WATT32
|
||||
@@ -1195,7 +1202,7 @@ int s_client_main(int argc, char **argv)
|
||||
fallback_scsv = 1;
|
||||
break;
|
||||
case OPT_KEYFORM:
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &key_format))
|
||||
if (!opt_format(opt_arg(), OPT_FMT_PDE, &key_format))
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_PASS:
|
||||
@@ -1819,7 +1826,10 @@ int s_client_main(int argc, char **argv)
|
||||
SSL_set_connect_state(con);
|
||||
|
||||
/* ok, lets connect */
|
||||
width = SSL_get_fd(con) + 1;
|
||||
if (fileno_stdin() > SSL_get_fd(con))
|
||||
width = fileno_stdin() + 1;
|
||||
else
|
||||
width = SSL_get_fd(con) + 1;
|
||||
|
||||
read_tty = 1;
|
||||
write_tty = 0;
|
||||
@@ -2148,9 +2158,11 @@ int s_client_main(int argc, char **argv)
|
||||
* set the flag so we exit.
|
||||
*/
|
||||
if (read_tty && !at_eof)
|
||||
openssl_fdset(fileno(stdin), &readfds);
|
||||
openssl_fdset(fileno_stdin(), &readfds);
|
||||
#if !defined(OPENSSL_SYS_VMS)
|
||||
if (write_tty)
|
||||
openssl_fdset(fileno(stdout), &writefds);
|
||||
openssl_fdset(fileno_stdout(), &writefds);
|
||||
#endif
|
||||
}
|
||||
if (read_ssl)
|
||||
openssl_fdset(SSL_get_fd(con), &readfds);
|
||||
@@ -2276,11 +2288,11 @@ int s_client_main(int argc, char **argv)
|
||||
goto shut;
|
||||
}
|
||||
}
|
||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
|
||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VMS)
|
||||
/* Assume Windows/DOS/BeOS can always write */
|
||||
else if (!ssl_pending && write_tty)
|
||||
#else
|
||||
else if (!ssl_pending && FD_ISSET(fileno(stdout), &writefds))
|
||||
else if (!ssl_pending && FD_ISSET(fileno_stdout(), &writefds))
|
||||
#endif
|
||||
{
|
||||
#ifdef CHARSET_EBCDIC
|
||||
@@ -2369,7 +2381,7 @@ int s_client_main(int argc, char **argv)
|
||||
#if defined(OPENSSL_SYS_MSDOS)
|
||||
else if (has_stdin_waiting())
|
||||
#else
|
||||
else if (FD_ISSET(fileno(stdin), &readfds))
|
||||
else if (FD_ISSET(fileno_stdin(), &readfds))
|
||||
#endif
|
||||
{
|
||||
if (crlf) {
|
||||
@@ -2392,9 +2404,10 @@ int s_client_main(int argc, char **argv)
|
||||
assert(lf_num == 0);
|
||||
} else
|
||||
i = raw_read_stdin(cbuf, BUFSIZZ);
|
||||
|
||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
|
||||
if (i == 0)
|
||||
at_eof = 1;
|
||||
#endif
|
||||
|
||||
if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q' && cmdletters))) {
|
||||
BIO_printf(bio_err, "DONE\n");
|
||||
@@ -2461,6 +2474,7 @@ int s_client_main(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
OPENSSL_free(srp_arg.srppassin);
|
||||
#endif
|
||||
OPENSSL_free(connectstr);
|
||||
OPENSSL_free(host);
|
||||
OPENSSL_free(port);
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
@@ -2471,6 +2485,7 @@ int s_client_main(int argc, char **argv)
|
||||
OPENSSL_clear_free(cbuf, BUFSIZZ);
|
||||
OPENSSL_clear_free(sbuf, BUFSIZZ);
|
||||
OPENSSL_clear_free(mbuf, BUFSIZZ);
|
||||
release_engine(e);
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out = NULL;
|
||||
BIO_free(bio_c_msg);
|
||||
|
||||
@@ -932,7 +932,10 @@ int s_server_main(int argc, char *argv[])
|
||||
const char *s_cert_file = TEST_CERT, *s_key_file = NULL, *s_chain_file = NULL;
|
||||
const char *s_cert_file2 = TEST_CERT2, *s_key_file2 = NULL;
|
||||
char *s_dcert_file = NULL, *s_dkey_file = NULL, *s_dchain_file = NULL;
|
||||
int s_tlsextstatus = 0, no_resume_ephemeral = 0;
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
int s_tlsextstatus = 0;
|
||||
#endif
|
||||
int no_resume_ephemeral = 0;
|
||||
unsigned int split_send_fragment = 0, max_pipelines = 0;
|
||||
const char *s_serverinfo_file = NULL;
|
||||
|
||||
@@ -1206,14 +1209,20 @@ int s_server_main(int argc, char *argv[])
|
||||
s_tlsextdebug = 1;
|
||||
break;
|
||||
case OPT_STATUS:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
s_tlsextstatus = 1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_STATUS_VERBOSE:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
s_tlsextstatus = tlscstatp.verbose = 1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_STATUS_TIMEOUT:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
s_tlsextstatus = 1;
|
||||
tlscstatp.timeout = atoi(opt_arg());
|
||||
#endif
|
||||
break;
|
||||
case OPT_STATUS_URL:
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
@@ -1954,6 +1963,7 @@ int s_server_main(int argc, char *argv[])
|
||||
ssl_excert_free(exc);
|
||||
sk_OPENSSL_STRING_free(ssl_args);
|
||||
SSL_CONF_CTX_free(cctx);
|
||||
release_engine(engine);
|
||||
BIO_free(bio_s_out);
|
||||
bio_s_out = NULL;
|
||||
BIO_free(bio_s_msg);
|
||||
@@ -2107,7 +2117,10 @@ static int sv_body(int s, int stype, unsigned char *context)
|
||||
SSL_set_tlsext_debug_arg(con, bio_s_out);
|
||||
}
|
||||
|
||||
width = s + 1;
|
||||
if (fileno_stdin() > s)
|
||||
width = fileno_stdin() + 1;
|
||||
else
|
||||
width = s + 1;
|
||||
for (;;) {
|
||||
int read_from_terminal;
|
||||
int read_from_sslcon;
|
||||
@@ -2119,7 +2132,7 @@ static int sv_body(int s, int stype, unsigned char *context)
|
||||
if (!read_from_sslcon) {
|
||||
FD_ZERO(&readfds);
|
||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
|
||||
openssl_fdset(fileno(stdin), &readfds);
|
||||
openssl_fdset(fileno_stdin(), &readfds);
|
||||
#endif
|
||||
openssl_fdset(s, &readfds);
|
||||
/*
|
||||
@@ -2159,7 +2172,7 @@ static int sv_body(int s, int stype, unsigned char *context)
|
||||
|
||||
if (i <= 0)
|
||||
continue;
|
||||
if (FD_ISSET(fileno(stdin), &readfds))
|
||||
if (FD_ISSET(fileno_stdin(), &readfds))
|
||||
read_from_terminal = 1;
|
||||
#endif
|
||||
if (FD_ISSET(s, &readfds))
|
||||
@@ -2186,6 +2199,7 @@ static int sv_body(int s, int stype, unsigned char *context)
|
||||
assert(lf_num == 0);
|
||||
} else
|
||||
i = raw_read_stdin(buf, bufsize);
|
||||
|
||||
if (!s_quiet && !s_brief) {
|
||||
if ((i <= 0) || (buf[0] == 'Q')) {
|
||||
BIO_printf(bio_s_out, "DONE\n");
|
||||
|
||||
22
apps/smime.c
22
apps/smime.c
@@ -37,7 +37,7 @@ typedef enum OPTION_choice {
|
||||
OPT_PK7OUT, OPT_TEXT, OPT_NOINTERN, OPT_NOVERIFY, OPT_NOCHAIN,
|
||||
OPT_NOCERTS, OPT_NOATTR, OPT_NODETACH, OPT_NOSMIMECAP,
|
||||
OPT_BINARY, OPT_NOSIGS, OPT_STREAM, OPT_INDEF, OPT_NOINDEF,
|
||||
OPT_NOOLDMIME, OPT_CRLFEOL, OPT_RAND, OPT_ENGINE, OPT_PASSIN,
|
||||
OPT_CRLFEOL, OPT_RAND, OPT_ENGINE, OPT_PASSIN,
|
||||
OPT_TO, OPT_FROM, OPT_SUBJECT, OPT_SIGNER, OPT_RECIP, OPT_MD,
|
||||
OPT_CIPHER, OPT_INKEY, OPT_KEYFORM, OPT_CERTFILE, OPT_CAFILE,
|
||||
OPT_V_ENUM,
|
||||
@@ -88,14 +88,14 @@ OPTIONS smime_options[] = {
|
||||
"Do not load the default certificates file"},
|
||||
{"no-CApath", OPT_NOCAPATH, '-',
|
||||
"Do not load certificates from the default certificates directory"},
|
||||
{"resign", OPT_RESIGN, '-'},
|
||||
{"nochain", OPT_NOCHAIN, '-'},
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-'},
|
||||
{"stream", OPT_STREAM, '-'},
|
||||
{"indef", OPT_INDEF, '-'},
|
||||
{"noindef", OPT_NOINDEF, '-'},
|
||||
{"nooldmime", OPT_NOOLDMIME, '-'},
|
||||
{"crlfeol", OPT_CRLFEOL, '-'},
|
||||
{"resign", OPT_RESIGN, '-', "Resign a signed message"},
|
||||
{"nochain", OPT_NOCHAIN, '-',
|
||||
"set PKCS7_NOCHAIN so certificates contained in the message are not used as untrusted CAs" },
|
||||
{"nosmimecap", OPT_NOSMIMECAP, '-', "Omit the SMIMECapabilities attribute"},
|
||||
{"stream", OPT_STREAM, '-', "Enable CMS streaming" },
|
||||
{"indef", OPT_INDEF, '-', "Same as -stream" },
|
||||
{"noindef", OPT_NOINDEF, '-', "Disable CMS streaming"},
|
||||
{"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only"},
|
||||
{"rand", OPT_RAND, 's',
|
||||
"Load the file(s) into the random number generator"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
@@ -220,9 +220,6 @@ int smime_main(int argc, char **argv)
|
||||
case OPT_NOINDEF:
|
||||
indef = 0;
|
||||
break;
|
||||
case OPT_NOOLDMIME:
|
||||
flags |= PKCS7_NOOLDMIMETYPE;
|
||||
break;
|
||||
case OPT_CRLFEOL:
|
||||
flags |= PKCS7_CRLFEOL;
|
||||
mime_eol = "\r\n";
|
||||
@@ -617,6 +614,7 @@ int smime_main(int argc, char **argv)
|
||||
X509_free(signer);
|
||||
EVP_PKEY_free(key);
|
||||
PKCS7_free(p7);
|
||||
release_engine(e);
|
||||
BIO_free(in);
|
||||
BIO_free(indata);
|
||||
BIO_free_all(out);
|
||||
|
||||
@@ -1219,13 +1219,12 @@ static int run_benchmark(int async_jobs,
|
||||
|
||||
int speed_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
loopargs_t *loopargs = NULL;
|
||||
int async_init = 0;
|
||||
int loopargs_len = 0;
|
||||
char *prog;
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
const char *engine_id = NULL;
|
||||
#endif
|
||||
const EVP_CIPHER *evp_cipher = NULL;
|
||||
double d = 0.0;
|
||||
OPTION_CHOICE o;
|
||||
@@ -1399,9 +1398,7 @@ int speed_main(int argc, char **argv)
|
||||
* initialised by each child process, not by the parent.
|
||||
* So store the name here and run setup_engine() later on.
|
||||
*/
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
engine_id = opt_arg();
|
||||
#endif
|
||||
break;
|
||||
case OPT_MULTI:
|
||||
#ifndef NO_FORK
|
||||
@@ -1566,7 +1563,7 @@ int speed_main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Initialize the engine after the fork */
|
||||
(void)setup_engine(engine_id, 0);
|
||||
e = setup_engine(engine_id, 0);
|
||||
|
||||
/* No parameters; turn on everything. */
|
||||
if ((argc == 0) && !doit[D_EVP]) {
|
||||
@@ -2819,6 +2816,7 @@ int speed_main(int argc, char **argv)
|
||||
ASYNC_cleanup_thread();
|
||||
}
|
||||
OPENSSL_free(loopargs);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ OPTIONS spkac_options[] = {
|
||||
{"noout", OPT_NOOUT, '-', "Don't print SPKAC"},
|
||||
{"pubkey", OPT_PUBKEY, '-', "Output public key"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify SPKAC signature"},
|
||||
{"spksect", OPT_SPKSECT, 's'},
|
||||
{"spksect", OPT_SPKSECT, 's',
|
||||
"Specify the name of an SPKAC-dedicated section of configuration"},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
|
||||
#endif
|
||||
@@ -186,6 +187,7 @@ int spkac_main(int argc, char **argv)
|
||||
NETSCAPE_SPKI_free(spki);
|
||||
BIO_free_all(out);
|
||||
EVP_PKEY_free(pkey);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passin);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -209,6 +209,7 @@ OPTIONS srp_options[] = {
|
||||
|
||||
int srp_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
CA_DB *db = NULL;
|
||||
CONF *conf = NULL;
|
||||
int gNindex = -1, maxgN = -1, ret = 1, errors = 0, verbose = 0, i;
|
||||
@@ -269,7 +270,7 @@ int srp_main(int argc, char **argv)
|
||||
passoutarg = opt_arg();
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
(void)setup_engine(opt_arg(), 0);
|
||||
e = setup_engine(opt_arg(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -602,6 +603,7 @@ int srp_main(int argc, char **argv)
|
||||
app_RAND_write_file(randfile);
|
||||
NCONF_free(conf);
|
||||
free_index(db);
|
||||
release_engine(e);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -107,7 +107,7 @@ OPTIONS ts_options[] = {
|
||||
{"queryfile", OPT_QUERYFILE, '<', "File containing a TS query"},
|
||||
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
|
||||
{"inkey", OPT_INKEY, '<', "File with private key for reply"},
|
||||
{"signer", OPT_SIGNER, 's'},
|
||||
{"signer", OPT_SIGNER, 's', "Signer certificate file"},
|
||||
{"chain", OPT_CHAIN, '<', "File with signer CA chain"},
|
||||
{"verify", OPT_VERIFY, '-', "Verify a TS response"},
|
||||
{"CApath", OPT_CAPATH, '/', "Path to trusted CA files"},
|
||||
|
||||
@@ -60,6 +60,7 @@ OPTIONS verify_options[] = {
|
||||
|
||||
int verify_main(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
STACK_OF(X509) *untrusted = NULL, *trusted = NULL;
|
||||
STACK_OF(X509_CRL) *crls = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
@@ -140,7 +141,7 @@ int verify_main(int argc, char **argv)
|
||||
crl_download = 1;
|
||||
break;
|
||||
case OPT_ENGINE:
|
||||
if (setup_engine(opt_arg(), 0) == NULL) {
|
||||
if ((e = setup_engine(opt_arg(), 0)) == NULL) {
|
||||
/* Failure message already displayed */
|
||||
goto end;
|
||||
}
|
||||
@@ -191,6 +192,7 @@ int verify_main(int argc, char **argv)
|
||||
sk_X509_pop_free(untrusted, X509_free);
|
||||
sk_X509_pop_free(trusted, X509_free);
|
||||
sk_X509_CRL_pop_free(crls, X509_CRL_free);
|
||||
release_engine(e);
|
||||
return (ret < 0 ? 2 : ret);
|
||||
}
|
||||
|
||||
|
||||
590
apps/vms_term_sock.c
Normal file
590
apps/vms_term_sock.c
Normal file
@@ -0,0 +1,590 @@
|
||||
/*
|
||||
* Copyright 2016 VMS Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifdef __VMS
|
||||
# define OPENSSL_SYS_VMS
|
||||
# pragma message disable DOLLARID
|
||||
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
|
||||
/*
|
||||
* On VMS, you need to define this to get the declaration of fileno(). The
|
||||
* value 2 is to make sure no function defined in POSIX-2 is left undefined.
|
||||
*/
|
||||
# define _POSIX_C_SOURCE 2
|
||||
# endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
# undef _POSIX_C_SOURCE
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <inet.h>
|
||||
# include <unistd.h>
|
||||
# include <string.h>
|
||||
# include <errno.h>
|
||||
# include <starlet.h>
|
||||
# include <iodef.h>
|
||||
# ifdef __alpha
|
||||
# include <iosbdef.h>
|
||||
# else
|
||||
typedef struct _iosb { /* Copied from IOSBDEF.H for Alpha */
|
||||
# pragma __nomember_alignment
|
||||
__union {
|
||||
__struct {
|
||||
unsigned short int iosb$w_status; /* Final I/O status */
|
||||
__union {
|
||||
__struct { /* 16-bit byte count variant */
|
||||
unsigned short int iosb$w_bcnt; /* 16-bit byte count */
|
||||
__union {
|
||||
unsigned int iosb$l_dev_depend; /* 32-bit device dependent info */
|
||||
unsigned int iosb$l_pid; /* 32-bit pid */
|
||||
} iosb$r_l;
|
||||
} iosb$r_bcnt_16;
|
||||
__struct { /* 32-bit byte count variant */
|
||||
unsigned int iosb$l_bcnt; /* 32-bit byte count (unaligned) */
|
||||
unsigned short int iosb$w_dev_depend_high; /* 16-bit device dependent info */
|
||||
} iosb$r_bcnt_32;
|
||||
} iosb$r_devdepend;
|
||||
} iosb$r_io_64;
|
||||
__struct {
|
||||
__union {
|
||||
unsigned int iosb$l_getxxi_status; /* Final GETxxI status */
|
||||
unsigned int iosb$l_reg_status; /* Final $Registry status */
|
||||
} iosb$r_l_status;
|
||||
unsigned int iosb$l_reserved; /* Reserved field */
|
||||
} iosb$r_get_64;
|
||||
} iosb$r_io_get;
|
||||
} IOSB;
|
||||
|
||||
# if !defined(__VAXC)
|
||||
# define iosb$w_status iosb$r_io_get.iosb$r_io_64.iosb$w_status
|
||||
# define iosb$w_bcnt iosb$r_io_get.iosb$r_io_64.iosb$r_devdepend.iosb$r_bcnt_16.iosb$w_bcnt
|
||||
# define iosb$r_l iosb$r_io_get.iosb$r_io_64.iosb$r_devdepend.iosb$r_bcnt_16.iosb$r_l
|
||||
# define iosb$l_dev_depend iosb$r_l.iosb$l_dev_depend
|
||||
# define iosb$l_pid iosb$r_l.iosb$l_pid
|
||||
# define iosb$l_bcnt iosb$r_io_get.iosb$r_io_64.iosb$r_devdepend.iosb$r_bcnt_32.iosb$l_bcnt
|
||||
# define iosb$w_dev_depend_high iosb$r_io_get.iosb$r_io_64.iosb$r_devdepend.iosb$r_bcnt_32.iosb$w_dev_depend_high
|
||||
# define iosb$l_getxxi_status iosb$r_io_get.iosb$r_get_64.iosb$r_l_status.iosb$l_getxxi_status
|
||||
# define iosb$l_reg_status iosb$r_io_get.iosb$r_get_64.iosb$r_l_status.iosb$l_reg_status
|
||||
# endif /* #if !defined(__VAXC) */
|
||||
|
||||
# endif /* End of IOSBDEF */
|
||||
|
||||
# include <efndef.h>
|
||||
# include <stdlib.h>
|
||||
# include <ssdef.h>
|
||||
# include <time.h>
|
||||
# include <stdarg.h>
|
||||
# include <descrip.h>
|
||||
|
||||
# include "vms_term_sock.h"
|
||||
|
||||
# ifdef __alpha
|
||||
static struct _iosb TerminalDeviceIosb;
|
||||
# else
|
||||
IOSB TerminalDeviceIosb;
|
||||
# endif
|
||||
|
||||
static char TerminalDeviceBuff[255 + 2];
|
||||
static int TerminalSocketPair[2] = {0, 0};
|
||||
static unsigned short TerminalDeviceChan = 0;
|
||||
|
||||
static int CreateSocketPair (int, int, int, int *);
|
||||
static void SocketPairTimeoutAst (int);
|
||||
static int TerminalDeviceAst (int);
|
||||
static void LogMessage (char *, ...);
|
||||
|
||||
/*
|
||||
** Socket Pair Timeout Value (must be 0-59 seconds)
|
||||
*/
|
||||
# define SOCKET_PAIR_TIMEOUT_VALUE 20
|
||||
|
||||
/*
|
||||
** Socket Pair Timeout Block which is passed to timeout AST
|
||||
*/
|
||||
typedef struct _SocketPairTimeoutBlock {
|
||||
unsigned short SockChan1;
|
||||
unsigned short SockChan2;
|
||||
} SPTB;
|
||||
|
||||
# ifdef TERM_SOCK_TEST
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int main (int argc, char *argv[], char *envp[])
|
||||
{
|
||||
char TermBuff[80];
|
||||
int TermSock,
|
||||
status,
|
||||
len;
|
||||
|
||||
LogMessage ("Enter 'q' or 'Q' to quit ...");
|
||||
while (strcasecmp (TermBuff, "Q")) {
|
||||
/*
|
||||
** Create the terminal socket
|
||||
*/
|
||||
status = TerminalSocket (TERM_SOCK_CREATE, &TermSock);
|
||||
if (status != TERM_SOCK_SUCCESS)
|
||||
exit (1);
|
||||
|
||||
/*
|
||||
** Process the terminal input
|
||||
*/
|
||||
LogMessage ("Waiting on terminal I/O ...\n");
|
||||
len = recv (TermSock, TermBuff, sizeof (TermBuff), 0) ;
|
||||
TermBuff[len] = '\0';
|
||||
LogMessage ("Received terminal I/O [%s]", TermBuff);
|
||||
|
||||
/*
|
||||
** Delete the terminal socket
|
||||
*/
|
||||
status = TerminalSocket (TERM_SOCK_DELETE, &TermSock);
|
||||
if (status != TERM_SOCK_SUCCESS)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
# endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int TerminalSocket (int FunctionCode, int *ReturnSocket)
|
||||
{
|
||||
int status;
|
||||
$DESCRIPTOR (TerminalDeviceDesc, "SYS$COMMAND");
|
||||
|
||||
/*
|
||||
** Process the requested function code
|
||||
*/
|
||||
switch (FunctionCode) {
|
||||
case TERM_SOCK_CREATE:
|
||||
/*
|
||||
** Create a socket pair
|
||||
*/
|
||||
status = CreateSocketPair (AF_INET, SOCK_STREAM, 0, TerminalSocketPair);
|
||||
if (status == -1) {
|
||||
LogMessage ("TerminalSocket: CreateSocketPair () - %08X", status);
|
||||
if (TerminalSocketPair[0])
|
||||
close (TerminalSocketPair[0]);
|
||||
if (TerminalSocketPair[1])
|
||||
close (TerminalSocketPair[1]);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Assign a channel to the terminal device
|
||||
*/
|
||||
status = sys$assign (&TerminalDeviceDesc,
|
||||
&TerminalDeviceChan,
|
||||
0, 0, 0);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("TerminalSocket: SYS$ASSIGN () - %08X", status);
|
||||
close (TerminalSocketPair[0]);
|
||||
close (TerminalSocketPair[1]);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Queue an async IO to the terminal device
|
||||
*/
|
||||
status = sys$qio (EFN$C_ENF,
|
||||
TerminalDeviceChan,
|
||||
IO$_READVBLK,
|
||||
&TerminalDeviceIosb,
|
||||
TerminalDeviceAst,
|
||||
0,
|
||||
TerminalDeviceBuff,
|
||||
sizeof (TerminalDeviceBuff) - 2,
|
||||
0, 0, 0, 0);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("TerminalSocket: SYS$QIO () - %08X", status);
|
||||
close (TerminalSocketPair[0]);
|
||||
close (TerminalSocketPair[1]);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the input side of the socket pair
|
||||
*/
|
||||
*ReturnSocket = TerminalSocketPair[1];
|
||||
break;
|
||||
|
||||
case TERM_SOCK_DELETE:
|
||||
/*
|
||||
** Cancel any pending IO on the terminal channel
|
||||
*/
|
||||
status = sys$cancel (TerminalDeviceChan);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("TerminalSocket: SYS$CANCEL () - %08X", status);
|
||||
close (TerminalSocketPair[0]);
|
||||
close (TerminalSocketPair[1]);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Deassign the terminal channel
|
||||
*/
|
||||
status = sys$dassgn (TerminalDeviceChan);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("TerminalSocket: SYS$DASSGN () - %08X", status);
|
||||
close (TerminalSocketPair[0]);
|
||||
close (TerminalSocketPair[1]);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
** Close the terminal socket pair
|
||||
*/
|
||||
close (TerminalSocketPair[0]);
|
||||
close (TerminalSocketPair[1]);
|
||||
|
||||
/*
|
||||
** Return the initialized socket
|
||||
*/
|
||||
*ReturnSocket = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
** Invalid function code
|
||||
*/
|
||||
LogMessage ("TerminalSocket: Invalid Function Code - %d", FunctionCode);
|
||||
return (TERM_SOCK_FAILURE);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return success
|
||||
*/
|
||||
return (TERM_SOCK_SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int CreateSocketPair (int SocketFamily,
|
||||
int SocketType,
|
||||
int SocketProtocol,
|
||||
int *SocketPair)
|
||||
{
|
||||
struct dsc$descriptor AscTimeDesc = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL};
|
||||
static const char* LocalHostAddr = {"127.0.0.1"};
|
||||
unsigned short TcpAcceptChan = 0,
|
||||
TcpDeviceChan = 0;
|
||||
unsigned long BinTimeBuff[2];
|
||||
struct sockaddr_in sin;
|
||||
char AscTimeBuff[32];
|
||||
short LocalHostPort;
|
||||
int status;
|
||||
unsigned int slen;
|
||||
|
||||
# ifdef __alpha
|
||||
struct _iosb iosb;
|
||||
# else
|
||||
IOSB iosb;
|
||||
# endif
|
||||
|
||||
int SockDesc1 = 0,
|
||||
SockDesc2 = 0;
|
||||
SPTB sptb;
|
||||
$DESCRIPTOR (TcpDeviceDesc, "TCPIP$DEVICE");
|
||||
|
||||
/*
|
||||
** Create a socket
|
||||
*/
|
||||
SockDesc1 = socket (SocketFamily, SocketType, 0);
|
||||
if (SockDesc1 < 0) {
|
||||
LogMessage ("CreateSocketPair: socket () - %d", errno);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Initialize the socket information
|
||||
*/
|
||||
slen = sizeof (sin);
|
||||
memset ((char *) &sin, 0, slen);
|
||||
sin.sin_family = SocketFamily;
|
||||
sin.sin_addr.s_addr = inet_addr (LocalHostAddr);
|
||||
sin.sin_port = 0;
|
||||
|
||||
/*
|
||||
** Bind the socket to the local IP
|
||||
*/
|
||||
status = bind (SockDesc1, (struct sockaddr *) &sin, slen);
|
||||
if (status < 0) {
|
||||
LogMessage ("CreateSocketPair: bind () - %d", errno);
|
||||
close (SockDesc1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Get the socket name so we can save the port number
|
||||
*/
|
||||
status = getsockname (SockDesc1, (struct sockaddr *) &sin, &slen);
|
||||
if (status < 0) {
|
||||
LogMessage ("CreateSocketPair: getsockname () - %d", errno);
|
||||
close (SockDesc1);
|
||||
return (-1);
|
||||
} else
|
||||
LocalHostPort = sin.sin_port;
|
||||
|
||||
/*
|
||||
** Setup a listen for the socket
|
||||
*/
|
||||
listen (SockDesc1, 5);
|
||||
|
||||
/*
|
||||
** Get the binary (64-bit) time of the specified timeout value
|
||||
*/
|
||||
sprintf (AscTimeBuff, "0 0:0:%02d.00", SOCKET_PAIR_TIMEOUT_VALUE);
|
||||
AscTimeDesc.dsc$w_length = strlen (AscTimeBuff);
|
||||
AscTimeDesc.dsc$a_pointer = AscTimeBuff;
|
||||
status = sys$bintim (&AscTimeDesc, BinTimeBuff);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("CreateSocketPair: SYS$BINTIM () - %08X", status);
|
||||
close (SockDesc1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Assign another channel to the TCP/IP device for the accept.
|
||||
** This is the channel that ends up being connected to.
|
||||
*/
|
||||
status = sys$assign (&TcpDeviceDesc, &TcpDeviceChan, 0, 0, 0);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("CreateSocketPair: SYS$ASSIGN () - %08X", status);
|
||||
close (SockDesc1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Get the channel of the first socket for the accept
|
||||
*/
|
||||
TcpAcceptChan = decc$get_sdc (SockDesc1);
|
||||
|
||||
/*
|
||||
** Perform the accept using $QIO so we can do this asynchronously
|
||||
*/
|
||||
status = sys$qio (EFN$C_ENF,
|
||||
TcpAcceptChan,
|
||||
IO$_ACCESS | IO$M_ACCEPT,
|
||||
&iosb,
|
||||
0, 0, 0, 0, 0,
|
||||
&TcpDeviceChan,
|
||||
0, 0);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("CreateSocketPair: SYS$QIO () - %08X", status);
|
||||
close (SockDesc1);
|
||||
sys$dassgn (TcpDeviceChan);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Create the second socket to do the connect
|
||||
*/
|
||||
SockDesc2 = socket (SocketFamily, SocketType, 0);
|
||||
if (SockDesc2 < 0) {
|
||||
LogMessage ("CreateSocketPair: socket () - %d", errno);
|
||||
sys$cancel (TcpAcceptChan);
|
||||
close (SockDesc1);
|
||||
sys$dassgn (TcpDeviceChan);
|
||||
return (-1) ;
|
||||
}
|
||||
|
||||
/*
|
||||
** Setup the Socket Pair Timeout Block
|
||||
*/
|
||||
sptb.SockChan1 = TcpAcceptChan;
|
||||
sptb.SockChan2 = decc$get_sdc (SockDesc2);
|
||||
|
||||
/*
|
||||
** Before we block on the connect, set a timer that can cancel I/O on our
|
||||
** two sockets if it never connects.
|
||||
*/
|
||||
status = sys$setimr (EFN$C_ENF,
|
||||
BinTimeBuff,
|
||||
SocketPairTimeoutAst,
|
||||
&sptb,
|
||||
0);
|
||||
if (! (status & 1)) {
|
||||
LogMessage ("CreateSocketPair: SYS$SETIMR () - %08X", status);
|
||||
sys$cancel (TcpAcceptChan);
|
||||
close (SockDesc1);
|
||||
close (SockDesc2);
|
||||
sys$dassgn (TcpDeviceChan);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Now issue the connect
|
||||
*/
|
||||
memset ((char *) &sin, 0, sizeof (sin)) ;
|
||||
sin.sin_family = SocketFamily;
|
||||
sin.sin_addr.s_addr = inet_addr (LocalHostAddr) ;
|
||||
sin.sin_port = LocalHostPort ;
|
||||
|
||||
status = connect (SockDesc2, (struct sockaddr *) &sin, sizeof (sin));
|
||||
if (status < 0 ) {
|
||||
LogMessage ("CreateSocketPair: connect () - %d", errno);
|
||||
sys$cantim (&sptb, 0);
|
||||
sys$cancel (TcpAcceptChan);
|
||||
close (SockDesc1);
|
||||
close (SockDesc2);
|
||||
sys$dassgn (TcpDeviceChan);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Wait for the asynch $QIO to finish. Note that if the I/O was aborted
|
||||
** (SS$_ABORT), then we probably canceled it from the AST routine - so log
|
||||
** a timeout.
|
||||
*/
|
||||
status = sys$synch (EFN$C_ENF, &iosb);
|
||||
if (! (iosb.iosb$w_status & 1)) {
|
||||
if (iosb.iosb$w_status == SS$_ABORT)
|
||||
LogMessage ("CreateSocketPair: SYS$QIO(iosb) timeout");
|
||||
else {
|
||||
LogMessage ("CreateSocketPair: SYS$QIO(iosb) - %d",
|
||||
iosb.iosb$w_status);
|
||||
sys$cantim (&sptb, 0);
|
||||
}
|
||||
close (SockDesc1);
|
||||
close (SockDesc2);
|
||||
sys$dassgn (TcpDeviceChan);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Here we're successfully connected, so cancel the timer, convert the
|
||||
** I/O channel to a socket fd, close the listener socket and return the
|
||||
** connected pair.
|
||||
*/
|
||||
sys$cantim (&sptb, 0);
|
||||
|
||||
close (SockDesc1) ;
|
||||
SocketPair[0] = SockDesc2 ;
|
||||
SocketPair[1] = socket_fd (TcpDeviceChan);
|
||||
|
||||
return (0) ;
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void SocketPairTimeoutAst (int astparm)
|
||||
{
|
||||
SPTB *sptb = (SPTB *) astparm;
|
||||
|
||||
sys$cancel (sptb->SockChan2); /* Cancel the connect() */
|
||||
sys$cancel (sptb->SockChan1); /* Cancel the accept() */
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int TerminalDeviceAst (int astparm)
|
||||
{
|
||||
int status;
|
||||
|
||||
/*
|
||||
** Terminate the terminal buffer
|
||||
*/
|
||||
TerminalDeviceBuff[TerminalDeviceIosb.iosb$w_bcnt] = '\0';
|
||||
strcat (TerminalDeviceBuff, "\n");
|
||||
|
||||
/*
|
||||
** Send the data read from the terminal device throught the socket pair
|
||||
*/
|
||||
send (TerminalSocketPair[0], TerminalDeviceBuff,
|
||||
TerminalDeviceIosb.iosb$w_bcnt + 1, 0);
|
||||
|
||||
/*
|
||||
** Queue another async IO to the terminal device
|
||||
*/
|
||||
status = sys$qio (EFN$C_ENF,
|
||||
TerminalDeviceChan,
|
||||
IO$_READVBLK,
|
||||
&TerminalDeviceIosb,
|
||||
TerminalDeviceAst,
|
||||
0,
|
||||
TerminalDeviceBuff,
|
||||
sizeof (TerminalDeviceBuff) - 1,
|
||||
0, 0, 0, 0);
|
||||
|
||||
/*
|
||||
** Return status
|
||||
*/
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void LogMessage (char *msg, ...)
|
||||
{
|
||||
char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static unsigned int pid = 0;
|
||||
va_list args;
|
||||
time_t CurTime;
|
||||
struct tm *LocTime;
|
||||
char MsgBuff[256];
|
||||
|
||||
/*
|
||||
** Get the process pid
|
||||
*/
|
||||
if (pid == 0)
|
||||
pid = getpid ();
|
||||
|
||||
/*
|
||||
** Convert the current time into local time
|
||||
*/
|
||||
CurTime = time (NULL);
|
||||
LocTime = localtime (&CurTime);
|
||||
|
||||
/*
|
||||
** Format the message buffer
|
||||
*/
|
||||
sprintf (MsgBuff, "%02d-%s-%04d %02d:%02d:%02d [%08X] %s\n",
|
||||
LocTime->tm_mday, Month[LocTime->tm_mon],
|
||||
(LocTime->tm_year + 1900), LocTime->tm_hour, LocTime->tm_min,
|
||||
LocTime->tm_sec, pid, msg);
|
||||
|
||||
/*
|
||||
** Get any variable arguments and add them to the print of the message
|
||||
** buffer
|
||||
*/
|
||||
va_start (args, msg);
|
||||
vfprintf (stderr, MsgBuff, args);
|
||||
va_end (args);
|
||||
|
||||
/*
|
||||
** Flush standard error output
|
||||
*/
|
||||
fsync (fileno (stderr));
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
#endif
|
||||
30
apps/vms_term_sock.h
Normal file
30
apps/vms_term_sock.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2016 VMS Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef TERM_SOCK_H
|
||||
# define TERM_SOCK_H
|
||||
|
||||
/*
|
||||
** Terminal Socket Function Codes
|
||||
*/
|
||||
# define TERM_SOCK_CREATE 1
|
||||
# define TERM_SOCK_DELETE 2
|
||||
|
||||
/*
|
||||
** Terminal Socket Status Codes
|
||||
*/
|
||||
# define TERM_SOCK_FAILURE 0
|
||||
# define TERM_SOCK_SUCCESS 1
|
||||
|
||||
/*
|
||||
** Terminal Socket Prototype
|
||||
*/
|
||||
int TerminalSocket (int FunctionCode, int *ReturnSocket);
|
||||
|
||||
#endif
|
||||
17
apps/x509.c
17
apps/x509.c
@@ -92,7 +92,7 @@ OPTIONS x509_options[] = {
|
||||
{"ocsp_uri", OPT_OCSP_URI, '-', "Print OCSP Responder URL(s)"},
|
||||
{"trustout", OPT_TRUSTOUT, '-', "Output a trusted certificate"},
|
||||
{"clrtrust", OPT_CLRTRUST, '-', "Clear all trusted purposes"},
|
||||
{"clrext", OPT_CLREXT, '-', "Clear all rejected purposes"},
|
||||
{"clrext", OPT_CLREXT, '-', "Clear all certificate extensions"},
|
||||
{"addtrust", OPT_ADDTRUST, 's', "Trust certificate for a given purpose"},
|
||||
{"addreject", OPT_ADDREJECT, 's',
|
||||
"Reject certificate for a given purpose"},
|
||||
@@ -125,9 +125,10 @@ OPTIONS x509_options[] = {
|
||||
{"CAform", OPT_CAFORM, 'F', "CA format - default PEM"},
|
||||
{"CAkeyform", OPT_CAKEYFORM, 'F', "CA key format - default PEM"},
|
||||
{"sigopt", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
|
||||
{"force_pubkey", OPT_FORCE_PUBKEY, '<'},
|
||||
{"next_serial", OPT_NEXT_SERIAL, '-'},
|
||||
{"clrreject", OPT_CLRREJECT, '-'},
|
||||
{"force_pubkey", OPT_FORCE_PUBKEY, '<', "Force the Key to put inside certificate"},
|
||||
{"next_serial", OPT_NEXT_SERIAL, '-', "Increment current certificate serial number"},
|
||||
{"clrreject", OPT_CLRREJECT, '-',
|
||||
"Clears all the prohibited or rejected uses of the certificate"},
|
||||
{"badsig", OPT_BADSIG, '-', "Corrupt last byte of certificate signature (for test)"},
|
||||
{"", OPT_MD, '-', "Any supported digest"},
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
@@ -626,10 +627,9 @@ int x509_main(int argc, char **argv)
|
||||
i2a_ASN1_INTEGER(out, X509_get_serialNumber(x));
|
||||
BIO_printf(out, "\n");
|
||||
} else if (next_serial == i) {
|
||||
BIGNUM *bnser;
|
||||
ASN1_INTEGER *ser;
|
||||
ser = X509_get_serialNumber(x);
|
||||
bnser = ASN1_INTEGER_to_BN(ser, NULL);
|
||||
ASN1_INTEGER *ser = X509_get_serialNumber(x);
|
||||
BIGNUM *bnser = ASN1_INTEGER_to_BN(ser, NULL);
|
||||
|
||||
if (!bnser)
|
||||
goto end;
|
||||
if (!BN_add_word(bnser, 1))
|
||||
@@ -893,6 +893,7 @@ int x509_main(int argc, char **argv)
|
||||
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
||||
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
||||
ASN1_OBJECT_free(objtmp);
|
||||
release_engine(e);
|
||||
OPENSSL_free(passin);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -40,12 +40,7 @@ build_script:
|
||||
test_script:
|
||||
- cd _build
|
||||
- nmake test
|
||||
- cd ..
|
||||
|
||||
# Fake deploy script to test installation
|
||||
deploy_script:
|
||||
- mkdir _install
|
||||
- cd _build
|
||||
- mkdir ..\_install
|
||||
- nmake install install_docs DESTDIR=..\_install
|
||||
- cd ..
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
# Haswell 4.44/0.63 0.63 0.73 0.63 0.70
|
||||
# Skylake 2.62/0.63 0.63 0.63 0.63
|
||||
# Silvermont 5.75/3.54 3.56 4.12 3.87(*) 4.11
|
||||
# Goldmont 3.82/1.26 1.26 1.29 1.29 1.50
|
||||
# Bulldozer 5.77/0.70 0.72 0.90 0.70 0.95
|
||||
#
|
||||
# (*) Atom Silvermont ECB result is suboptimal because of penalties
|
||||
|
||||
@@ -3011,7 +3011,7 @@ _aesp8_xts_enc5x:
|
||||
vxor $twk0,$twk0,v31
|
||||
|
||||
vcipher $out0,$out0,v26
|
||||
lvsr $inpperm,r0,$taillen # $in5 is no more
|
||||
lvsr $inpperm,0,$taillen # $in5 is no more
|
||||
vcipher $out1,$out1,v26
|
||||
vcipher $out2,$out2,v26
|
||||
vcipher $out3,$out3,v26
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
# Nehalem(**) 7.63 6.88 +11%
|
||||
# Atom 17.1 16.4 +4%
|
||||
# Silvermont - 12.9
|
||||
# Goldmont - 8.85
|
||||
#
|
||||
# (*) Comparison is not completely fair, because "this" is ECB,
|
||||
# i.e. no extra processing such as counter values calculation
|
||||
@@ -87,6 +88,7 @@
|
||||
# Nehalem 7.80
|
||||
# Atom 17.9
|
||||
# Silvermont 14.0
|
||||
# Goldmont 10.2
|
||||
#
|
||||
# November 2011.
|
||||
#
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
# Nehalem 29.6/40.3/14.6 10.0/11.8
|
||||
# Atom 57.3/74.2/32.1 60.9/77.2(***)
|
||||
# Silvermont 52.7/64.0/19.5 48.8/60.8(***)
|
||||
# Goldmont 38.9/49.0/17.8 10.6/12.6
|
||||
#
|
||||
# (*) "Hyper-threading" in the context refers rather to cache shared
|
||||
# among multiple cores, than to specifically Intel HTT. As vast
|
||||
|
||||
@@ -25,7 +25,7 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
|
||||
{
|
||||
if (a->value.ptr != NULL) {
|
||||
ASN1_TYPE **tmp_a = &a;
|
||||
asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL);
|
||||
asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0);
|
||||
}
|
||||
a->type = type;
|
||||
if (type == V_ASN1_BOOLEAN)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <limits.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include "asn1_locl.h"
|
||||
|
||||
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
|
||||
long max);
|
||||
@@ -314,16 +315,23 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void ASN1_STRING_free(ASN1_STRING *a)
|
||||
void asn1_string_embed_free(ASN1_STRING *a, int embed)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
if (!(a->flags & ASN1_STRING_FLAG_NDEF))
|
||||
OPENSSL_free(a->data);
|
||||
if (!(a->flags & ASN1_STRING_FLAG_EMBED))
|
||||
if (embed == 0)
|
||||
OPENSSL_free(a);
|
||||
}
|
||||
|
||||
void ASN1_STRING_free(ASN1_STRING *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED);
|
||||
}
|
||||
|
||||
void ASN1_STRING_clear_free(ASN1_STRING *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
|
||||
@@ -45,6 +45,8 @@ DEFINE_STACK_OF(MIME_HEADER)
|
||||
/* Month values for printing out times */
|
||||
extern const char *_asn1_mon[12];
|
||||
|
||||
void asn1_string_embed_free(ASN1_STRING *a, int embed);
|
||||
|
||||
int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
|
||||
const ASN1_ITEM *it);
|
||||
@@ -63,7 +65,7 @@ int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
||||
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed);
|
||||
void asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
|
||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
|
||||
@@ -225,16 +225,14 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
/* If field not present, try the next one */
|
||||
if (ret == -1)
|
||||
continue;
|
||||
/*
|
||||
* Set the choice selector here to ensure that the value is
|
||||
* correctly freed upon error. It may be partially initialized
|
||||
* even if parsing failed.
|
||||
*/
|
||||
asn1_set_choice_selector(pval, i, it);
|
||||
/* If positive return, read OK, break loop */
|
||||
if (ret > 0)
|
||||
break;
|
||||
/* Otherwise must be an ASN1 parsing error */
|
||||
/*
|
||||
* Must be an ASN1 parsing error.
|
||||
* Free up any partial choice value
|
||||
*/
|
||||
asn1_template_free(pchptr, tt);
|
||||
errtt = tt;
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
@@ -252,6 +250,8 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
goto err;
|
||||
}
|
||||
|
||||
asn1_set_choice_selector(pval, i, it);
|
||||
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
|
||||
goto auxerr;
|
||||
*in = p;
|
||||
|
||||
@@ -52,11 +52,11 @@ static void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
if (it->templates)
|
||||
asn1_template_free(pval, it->templates);
|
||||
else
|
||||
asn1_primitive_free(pval, it);
|
||||
asn1_primitive_free(pval, it, embed);
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_MSTRING:
|
||||
asn1_primitive_free(pval, it);
|
||||
asn1_primitive_free(pval, it, embed);
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_CHOICE:
|
||||
@@ -147,7 +147,7 @@ void asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
}
|
||||
}
|
||||
|
||||
void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
|
||||
{
|
||||
int utype;
|
||||
|
||||
@@ -195,12 +195,12 @@ void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
break;
|
||||
|
||||
case V_ASN1_ANY:
|
||||
asn1_primitive_free(pval, NULL);
|
||||
asn1_primitive_free(pval, NULL, 0);
|
||||
OPENSSL_free(*pval);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASN1_STRING_free((ASN1_STRING *)*pval);
|
||||
asn1_string_embed_free((ASN1_STRING *)*pval, embed);
|
||||
break;
|
||||
}
|
||||
*pval = NULL;
|
||||
|
||||
@@ -604,6 +604,7 @@ static int addrinfo_wrap(int family, int socktype,
|
||||
|
||||
DEFINE_RUN_ONCE_STATIC(do_bio_lookup_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
bio_lookup_lock = CRYPTO_THREAD_lock_new();
|
||||
return bio_lookup_lock != NULL;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,11 @@ BIO *BIO_new_file(const char *filename, const char *mode)
|
||||
if (file == NULL) {
|
||||
SYSerr(SYS_F_FOPEN, get_last_sys_error());
|
||||
ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
|
||||
if (errno == ENOENT)
|
||||
if (errno == ENOENT
|
||||
# ifdef ENXIO
|
||||
|| errno == ENXIO
|
||||
# endif
|
||||
)
|
||||
BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
|
||||
else
|
||||
BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB);
|
||||
|
||||
@@ -203,7 +203,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
|
||||
BN_ULONG ret, waste;
|
||||
|
||||
asm("divq %4":"=a"(ret), "=d"(waste)
|
||||
: "a"(l), "d"(h), "g"(d)
|
||||
: "a"(l), "d"(h), "r"(d)
|
||||
: "cc");
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1157,18 +1157,17 @@ $code.=<<___;
|
||||
mulx 2*8($aptr),%r15,%r13 # ...
|
||||
adox -3*8($tptr),%r11
|
||||
adcx %r15,%r12
|
||||
adox $zero,%r12
|
||||
adox -2*8($tptr),%r12
|
||||
adcx $zero,%r13
|
||||
adox $zero,%r13
|
||||
|
||||
mov $bptr,8(%rsp) # off-load &b[i]
|
||||
.byte 0x67
|
||||
mov $mi,%r15
|
||||
imulq 24(%rsp),$mi # "t[0]"*n0
|
||||
xor %ebp,%ebp # xor $zero,$zero # cf=0, of=0
|
||||
|
||||
mulx 3*8($aptr),%rax,%r14
|
||||
mov $mi,%rdx
|
||||
adox -2*8($tptr),%r12
|
||||
adcx %rax,%r13
|
||||
adox -1*8($tptr),%r13
|
||||
adcx $zero,%r14
|
||||
|
||||
@@ -105,7 +105,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
({ asm volatile ( \
|
||||
"divl %4" \
|
||||
: "=a"(q), "=d"(rem) \
|
||||
: "a"(n1), "d"(n0), "g"(d0) \
|
||||
: "a"(n1), "d"(n0), "r"(d0) \
|
||||
: "cc"); \
|
||||
q; \
|
||||
})
|
||||
@@ -120,7 +120,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
({ asm volatile ( \
|
||||
"divq %4" \
|
||||
: "=a"(q), "=d"(rem) \
|
||||
: "a"(n1), "d"(n0), "g"(d0) \
|
||||
: "a"(n1), "d"(n0), "r"(d0) \
|
||||
: "cc"); \
|
||||
q; \
|
||||
})
|
||||
|
||||
@@ -428,8 +428,8 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
|
||||
# endif
|
||||
# elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
|
||||
# if defined(__GNUC__) && __GNUC__>=2
|
||||
# if __GNUC__>4 || (__GNUC__>=4 && __GNUC_MINOR__>=4)
|
||||
/* "h" constraint is no more since 4.4 */
|
||||
# if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16
|
||||
/* "h" constraint is not an option on R6 and was removed in 4.4 */
|
||||
# define BN_UMULT_HIGH(a,b) (((__uint128_t)(a)*(b))>>64)
|
||||
# define BN_UMULT_LOHI(low,high,a,b) ({ \
|
||||
__uint128_t ret=(__uint128_t)(a)*(b); \
|
||||
|
||||
@@ -1031,5 +1031,7 @@ void bn_correct_top(BIGNUM *a)
|
||||
}
|
||||
a->top = tmp_top;
|
||||
}
|
||||
if (a->top == 0)
|
||||
a->neg = 0;
|
||||
bn_pollute(a);
|
||||
}
|
||||
|
||||
@@ -23,12 +23,9 @@ char *BN_bn2hex(const BIGNUM *a)
|
||||
char *buf;
|
||||
char *p;
|
||||
|
||||
if (a->neg && BN_is_zero(a)) {
|
||||
/* "-0" == 3 bytes including NULL terminator */
|
||||
buf = OPENSSL_malloc(3);
|
||||
} else {
|
||||
buf = OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
|
||||
}
|
||||
if (BN_is_zero(a))
|
||||
return OPENSSL_strdup("0");
|
||||
buf = OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
|
||||
if (buf == NULL) {
|
||||
BNerr(BN_F_BN_BN2HEX, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
@@ -186,10 +183,12 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
|
||||
}
|
||||
ret->top = h;
|
||||
bn_correct_top(ret);
|
||||
ret->neg = neg;
|
||||
|
||||
*bn = ret;
|
||||
bn_check_top(ret);
|
||||
/* Don't set the negative flag if it's zero. */
|
||||
if (ret->top != 0)
|
||||
ret->neg = neg;
|
||||
return (num);
|
||||
err:
|
||||
if (*bn == NULL)
|
||||
@@ -241,7 +240,7 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
if (j == BN_DEC_NUM)
|
||||
j = 0;
|
||||
l = 0;
|
||||
while (*a) {
|
||||
while (--i >= 0) {
|
||||
l *= 10;
|
||||
l += *a - '0';
|
||||
a++;
|
||||
@@ -253,11 +252,13 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
ret->neg = neg;
|
||||
|
||||
bn_correct_top(ret);
|
||||
*bn = ret;
|
||||
bn_check_top(ret);
|
||||
/* Don't set the negative flag if it's zero. */
|
||||
if (ret->top != 0)
|
||||
ret->neg = neg;
|
||||
return (num);
|
||||
err:
|
||||
if (*bn == NULL)
|
||||
@@ -268,6 +269,7 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
int BN_asc2bn(BIGNUM **bn, const char *a)
|
||||
{
|
||||
const char *p = a;
|
||||
|
||||
if (*p == '-')
|
||||
p++;
|
||||
|
||||
@@ -278,7 +280,8 @@ int BN_asc2bn(BIGNUM **bn, const char *a)
|
||||
if (!BN_dec2bn(bn, p))
|
||||
return 0;
|
||||
}
|
||||
if (*a == '-')
|
||||
/* Don't set the negative flag if it's zero. */
|
||||
if (*a == '-' && (*bn)->top != 0)
|
||||
(*bn)->neg = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,14 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
|
||||
int ret = 0, bit, bytes, mask;
|
||||
time_t tim;
|
||||
|
||||
if (bits < 0 || (bits == 1 && top > 0)) {
|
||||
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bits == 0) {
|
||||
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
|
||||
goto toosmall;
|
||||
BN_zero(rnd);
|
||||
return 1;
|
||||
}
|
||||
if (bits < 0 || (bits == 1 && top > 0))
|
||||
goto toosmall;
|
||||
|
||||
bytes = (bits + 7) / 8;
|
||||
bit = (bits - 1) % 8;
|
||||
@@ -88,6 +87,10 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
|
||||
OPENSSL_clear_free(buf, bytes);
|
||||
bn_check_top(rnd);
|
||||
return (ret);
|
||||
|
||||
toosmall:
|
||||
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
|
||||
@@ -250,5 +253,6 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||
|
||||
err:
|
||||
OPENSSL_free(k_bytes);
|
||||
OPENSSL_cleanse(private_bytes, sizeof(private_bytes));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
|
||||
void BN_RECP_CTX_init(BN_RECP_CTX *recp)
|
||||
{
|
||||
memset(recp, 0, sizeof(*recp));
|
||||
bn_init(&(recp->N));
|
||||
bn_init(&(recp->Nr));
|
||||
recp->num_bits = 0;
|
||||
recp->flags = 0;
|
||||
}
|
||||
|
||||
BN_RECP_CTX *BN_RECP_CTX_new(void)
|
||||
@@ -25,7 +24,8 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
BN_RECP_CTX_init(ret);
|
||||
bn_init(&(ret->N));
|
||||
bn_init(&(ret->Nr));
|
||||
ret->flags = BN_FLG_MALLOCED;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ my ($a3,$b3,$c3,$d3)=map(($_&~3)+(($_+1)&3),($a2,$b2,$c2,$d2));
|
||||
|
||||
$code.=<<___;
|
||||
.machine "any"
|
||||
.text
|
||||
|
||||
.globl .ChaCha20_ctr32_int
|
||||
.align 5
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
# Sandy Bridge 10.5/+47% 3.20
|
||||
# Haswell 8.15/+50% 2.83
|
||||
# Silvermont 17.4/+36% 8.35
|
||||
# Goldmont 13.4/+40% 4.36
|
||||
# Sledgehammer 10.2/+54%
|
||||
# Bulldozer 13.4/+50% 4.38(*)
|
||||
#
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
# Ivy Bridge 6.71/+46% 5.40/6.49 2.41
|
||||
# Haswell 5.92/+43% 5.20/6.45 2.42 1.23
|
||||
# Silvermont 12.0/+33% 7.75/7.40 7.03(iii)
|
||||
# Goldmont 10.6/+17% 5.10/- 3.28
|
||||
# Sledgehammer 7.28/+52% -/14.2(ii) -
|
||||
# Bulldozer 9.66/+28% 9.85/11.1 3.06(iv)
|
||||
# VIA Nano 10.5/+46% 6.72/8.60 6.05
|
||||
|
||||
@@ -100,6 +100,9 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
|
||||
p = BN_CTX_get(ctx);
|
||||
test = BN_CTX_get(ctx);
|
||||
|
||||
if (test == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_lshift(test, BN_value_one(), bits - 1))
|
||||
goto err;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname);
|
||||
static char *dl_name_converter(DSO *dso, const char *filename);
|
||||
static char *dl_merger(DSO *dso, const char *filespec1,
|
||||
const char *filespec2);
|
||||
static int dl_pathbyaddr(void *addr, char *path, int sz);
|
||||
static void *dl_globallookup(const char *name);
|
||||
|
||||
static DSO_METHOD dso_meth_dl = {
|
||||
@@ -34,6 +35,7 @@ static DSO_METHOD dso_meth_dl = {
|
||||
dl_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
dl_pathbyaddr,
|
||||
dl_globallookup
|
||||
};
|
||||
|
||||
@@ -235,6 +237,38 @@ static char *dl_name_converter(DSO *dso, const char *filename)
|
||||
return (translated);
|
||||
}
|
||||
|
||||
static int dl_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
struct shl_descriptor inf;
|
||||
int i, len;
|
||||
|
||||
if (addr == NULL) {
|
||||
union {
|
||||
int (*f) (void *, char *, int);
|
||||
void *p;
|
||||
} t = {
|
||||
dl_pathbyaddr
|
||||
};
|
||||
addr = t.p;
|
||||
}
|
||||
|
||||
for (i = -1; shl_get_r(i, &inf) == 0; i++) {
|
||||
if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) ||
|
||||
((size_t)addr >= inf.dstart && (size_t)addr < inf.dend)) {
|
||||
len = (int)strlen(inf.filename);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
memcpy(path, inf.filename, len);
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void *dl_globallookup(const char *name)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
@@ -44,6 +44,7 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname);
|
||||
static char *dlfcn_name_converter(DSO *dso, const char *filename);
|
||||
static char *dlfcn_merger(DSO *dso, const char *filespec1,
|
||||
const char *filespec2);
|
||||
static int dlfcn_pathbyaddr(void *addr, char *path, int sz);
|
||||
static void *dlfcn_globallookup(const char *name);
|
||||
|
||||
static DSO_METHOD dso_meth_dlfcn = {
|
||||
@@ -56,6 +57,7 @@ static DSO_METHOD dso_meth_dlfcn = {
|
||||
dlfcn_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
dlfcn_pathbyaddr,
|
||||
dlfcn_globallookup
|
||||
};
|
||||
|
||||
@@ -306,6 +308,38 @@ static int dladdr(void *address, Dl_info *dl)
|
||||
}
|
||||
# endif /* __sgi */
|
||||
|
||||
static int dlfcn_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
# ifdef HAVE_DLINFO
|
||||
Dl_info dli;
|
||||
int len;
|
||||
|
||||
if (addr == NULL) {
|
||||
union {
|
||||
int (*f) (void *, char *, int);
|
||||
void *p;
|
||||
} t = {
|
||||
dlfcn_pathbyaddr
|
||||
};
|
||||
addr = t.p;
|
||||
}
|
||||
|
||||
if (dladdr(addr, &dli)) {
|
||||
len = (int)strlen(dli.dli_fname);
|
||||
if (sz <= 0)
|
||||
return len + 1;
|
||||
if (len >= sz)
|
||||
len = sz - 1;
|
||||
memcpy(path, dli.dli_fname, len);
|
||||
path[len++] = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
ERR_add_error_data(2, "dlfcn_pathbyaddr(): ", dlerror());
|
||||
# endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void *dlfcn_globallookup(const char *name)
|
||||
{
|
||||
void *ret = NULL, *handle = dlopen(NULL, RTLD_LAZY);
|
||||
|
||||
@@ -38,6 +38,7 @@ static ERR_STRING_DATA DSO_str_functs[] = {
|
||||
{ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"},
|
||||
{ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"},
|
||||
{ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"},
|
||||
{ERR_FUNC(DSO_F_DSO_PATHBYADDR), "DSO_pathbyaddr"},
|
||||
{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"},
|
||||
{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"},
|
||||
{ERR_FUNC(DSO_F_VMS_BIND_SYM), "vms_bind_sym"},
|
||||
@@ -50,6 +51,7 @@ static ERR_STRING_DATA DSO_str_functs[] = {
|
||||
{ERR_FUNC(DSO_F_WIN32_LOAD), "win32_load"},
|
||||
{ERR_FUNC(DSO_F_WIN32_MERGER), "win32_merger"},
|
||||
{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "win32_name_converter"},
|
||||
{ERR_FUNC(DSO_F_WIN32_PATHBYADDR), "win32_pathbyaddr"},
|
||||
{ERR_FUNC(DSO_F_WIN32_SPLITTER), "win32_splitter"},
|
||||
{ERR_FUNC(DSO_F_WIN32_UNLOAD), "win32_unload"},
|
||||
{0, NULL}
|
||||
|
||||
@@ -73,9 +73,11 @@ int DSO_free(DSO *dso)
|
||||
return 1;
|
||||
REF_ASSERT_ISNT(i < 0);
|
||||
|
||||
if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) {
|
||||
DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED);
|
||||
return 0;
|
||||
if ((dso->flags & DSO_FLAG_NO_UNLOAD_ON_FREE) == 0) {
|
||||
if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) {
|
||||
DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) {
|
||||
@@ -304,6 +306,33 @@ char *DSO_convert_filename(DSO *dso, const char *filename)
|
||||
return (result);
|
||||
}
|
||||
|
||||
int DSO_pathbyaddr(void *addr, char *path, int sz)
|
||||
{
|
||||
DSO_METHOD *meth = default_DSO_meth;
|
||||
if (meth == NULL)
|
||||
meth = DSO_METHOD_openssl();
|
||||
if (meth->pathbyaddr == NULL) {
|
||||
DSOerr(DSO_F_DSO_PATHBYADDR, DSO_R_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
return (*meth->pathbyaddr) (addr, path, sz);
|
||||
}
|
||||
|
||||
DSO *DSO_dsobyaddr(void *addr, int flags)
|
||||
{
|
||||
DSO *ret = NULL;
|
||||
char *filename = NULL;
|
||||
int len = DSO_pathbyaddr(addr, NULL, 0);
|
||||
|
||||
filename = OPENSSL_malloc(len);
|
||||
if (filename != NULL
|
||||
&& DSO_pathbyaddr(addr, filename, len) == len)
|
||||
ret = DSO_load(NULL, filename, NULL, flags);
|
||||
|
||||
OPENSSL_free(filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *DSO_global_lookup(const char *name)
|
||||
{
|
||||
DSO_METHOD *meth = default_DSO_meth;
|
||||
|
||||
@@ -99,6 +99,8 @@ struct dso_meth_st {
|
||||
/* [De]Initialisation handlers. */
|
||||
int (*init) (DSO *dso);
|
||||
int (*finish) (DSO *dso);
|
||||
/* Return pathname of the module containing location */
|
||||
int (*pathbyaddr) (void *addr, char *path, int sz);
|
||||
/* Perform global symbol lookup, i.e. among *all* modules */
|
||||
void *(*globallookup) (const char *symname);
|
||||
};
|
||||
|
||||
@@ -50,7 +50,9 @@ static DSO_METHOD dso_meth_vms = {
|
||||
vms_name_converter,
|
||||
vms_merger,
|
||||
NULL, /* init */
|
||||
NULL /* finish */
|
||||
NULL, /* finish */
|
||||
NULL, /* pathbyaddr */
|
||||
NULL /* globallookup */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -77,6 +77,7 @@ static DSO_METHOD dso_meth_win32 = {
|
||||
win32_merger,
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
NULL, /* pathbyaddr */
|
||||
win32_globallookup
|
||||
};
|
||||
|
||||
|
||||
@@ -171,6 +171,8 @@ static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec);
|
||||
const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec),
|
||||
*pb = EC_KEY_get0_public_key(b->pkey.ec);
|
||||
if (group == NULL || pa == NULL || pb == NULL)
|
||||
return -2;
|
||||
r = EC_POINT_cmp(group, pa, pb, NULL);
|
||||
if (r == 0)
|
||||
return 1;
|
||||
@@ -311,6 +313,8 @@ static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec),
|
||||
*group_b = EC_KEY_get0_group(b->pkey.ec);
|
||||
if (group_a == NULL || group_b == NULL)
|
||||
return -2;
|
||||
if (EC_GROUP_cmp(group_a, group_b, NULL))
|
||||
return 0;
|
||||
else
|
||||
@@ -341,7 +345,7 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, ec_print_t ktype)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ktype != EC_KEY_PRINT_PARAM) {
|
||||
if (ktype != EC_KEY_PRINT_PARAM && EC_KEY_get0_public_key(x) != NULL) {
|
||||
publen = EC_KEY_key2buf(x, EC_KEY_get_conv_form(x), &pub, NULL);
|
||||
if (publen == 0)
|
||||
goto err;
|
||||
|
||||
@@ -169,7 +169,7 @@ struct ec_method_st {
|
||||
/* custom ECDH operation */
|
||||
int (*ecdh_compute_key)(unsigned char **pout, size_t *poutlen,
|
||||
const EC_POINT *pub_key, const EC_KEY *ecdh);
|
||||
} /* EC_METHOD */ ;
|
||||
};
|
||||
|
||||
/*
|
||||
* Types and functions to manipulate pre-computed values.
|
||||
@@ -228,11 +228,16 @@ struct ec_group_st {
|
||||
/* data for ECDSA inverse */
|
||||
BN_MONT_CTX *mont_data;
|
||||
|
||||
/* precomputed values for speed. */
|
||||
/*
|
||||
* Precomputed values for speed. The PCT_xxx names match the
|
||||
* pre_comp.xxx union names; see the SETPRECOMP and HAVEPRECOMP
|
||||
* macros, below.
|
||||
*/
|
||||
enum {
|
||||
pct_none,
|
||||
pct_nistp224, pct_nistp256, pct_nistp521, pct_nistz256,
|
||||
pct_ec } pre_comp_type;
|
||||
PCT_none,
|
||||
PCT_nistp224, PCT_nistp256, PCT_nistp521, PCT_nistz256,
|
||||
PCT_ec
|
||||
} pre_comp_type;
|
||||
union {
|
||||
NISTP224_PRE_COMP *nistp224;
|
||||
NISTP256_PRE_COMP *nistp256;
|
||||
@@ -240,12 +245,12 @@ struct ec_group_st {
|
||||
NISTZ256_PRE_COMP *nistz256;
|
||||
EC_PRE_COMP *ec;
|
||||
} pre_comp;
|
||||
} /* EC_GROUP */ ;
|
||||
};
|
||||
|
||||
#define SETPRECOMP(g, type, pre) \
|
||||
g->pre_comp_type = pct_##type, g->pre_comp.type = pre
|
||||
g->pre_comp_type = PCT_##type, g->pre_comp.type = pre
|
||||
#define HAVEPRECOMP(g, type) \
|
||||
g->pre_comp_type == pct_##type && g->pre_comp.type != NULL
|
||||
g->pre_comp_type == PCT_##type && g->pre_comp.type != NULL
|
||||
|
||||
struct ec_key_st {
|
||||
const EC_KEY_METHOD *meth;
|
||||
@@ -260,7 +265,7 @@ struct ec_key_st {
|
||||
int flags;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
CRYPTO_RWLOCK *lock;
|
||||
} /* EC_KEY */ ;
|
||||
};
|
||||
|
||||
struct ec_point_st {
|
||||
const EC_METHOD *meth;
|
||||
@@ -274,7 +279,7 @@ struct ec_point_st {
|
||||
* Z) represents (X/Z^2, Y/Z^3) if Z != 0 */
|
||||
int Z_is_one; /* enable optimized point arithmetics for
|
||||
* special case */
|
||||
} /* EC_POINT */ ;
|
||||
};
|
||||
|
||||
NISTP224_PRE_COMP *EC_nistp224_pre_comp_dup(NISTP224_PRE_COMP *);
|
||||
NISTP256_PRE_COMP *EC_nistp256_pre_comp_dup(NISTP256_PRE_COMP *);
|
||||
@@ -574,7 +579,7 @@ struct ec_key_method_st {
|
||||
const unsigned char *sigbuf, int sig_len, EC_KEY *eckey);
|
||||
int (*verify_sig)(const unsigned char *dgst, int dgst_len,
|
||||
const ECDSA_SIG *sig, EC_KEY *eckey);
|
||||
} /* EC_KEY_METHOD */ ;
|
||||
};
|
||||
|
||||
#define EC_KEY_METHOD_DYNAMIC 1
|
||||
|
||||
|
||||
@@ -69,22 +69,22 @@ void EC_pre_comp_free(EC_GROUP *group)
|
||||
default:
|
||||
break;
|
||||
#ifdef ECP_NISTZ256_REFERENCE_IMPLEMENTATION
|
||||
case pct_nistz256:
|
||||
case PCT_nistz256:
|
||||
EC_nistz256_pre_comp_free(group->pre_comp.nistz256);
|
||||
break;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
case pct_nistp224:
|
||||
case PCT_nistp224:
|
||||
EC_nistp224_pre_comp_free(group->pre_comp.nistp224);
|
||||
break;
|
||||
case pct_nistp256:
|
||||
case PCT_nistp256:
|
||||
EC_nistp256_pre_comp_free(group->pre_comp.nistp256);
|
||||
break;
|
||||
case pct_nistp521:
|
||||
case PCT_nistp521:
|
||||
EC_nistp521_pre_comp_free(group->pre_comp.nistp521);
|
||||
break;
|
||||
#endif
|
||||
case pct_ec:
|
||||
case PCT_ec:
|
||||
EC_ec_pre_comp_free(group->pre_comp.ec);
|
||||
break;
|
||||
}
|
||||
@@ -147,22 +147,22 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src)
|
||||
dest->pre_comp.ec = NULL;
|
||||
break;
|
||||
#ifdef ECP_NISTZ256_REFERENCE_IMPLEMENTATION
|
||||
case pct_nistz256:
|
||||
case PCT_nistz256:
|
||||
dest->pre_comp.nistz256 = EC_nistz256_pre_comp_dup(src->pre_comp.nistz256);
|
||||
break;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
case pct_nistp224:
|
||||
case PCT_nistp224:
|
||||
dest->pre_comp.nistp224 = EC_nistp224_pre_comp_dup(src->pre_comp.nistp224);
|
||||
break;
|
||||
case pct_nistp256:
|
||||
case PCT_nistp256:
|
||||
dest->pre_comp.nistp256 = EC_nistp256_pre_comp_dup(src->pre_comp.nistp256);
|
||||
break;
|
||||
case pct_nistp521:
|
||||
case PCT_nistp521:
|
||||
dest->pre_comp.nistp521 = EC_nistp521_pre_comp_dup(src->pre_comp.nistp521);
|
||||
break;
|
||||
#endif
|
||||
case pct_ec:
|
||||
case PCT_ec:
|
||||
dest->pre_comp.ec = EC_ec_pre_comp_dup(src->pre_comp.ec);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -856,10 +856,10 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
|
||||
*cipher = cryptodev_aes_ctr();
|
||||
break;
|
||||
case NID_aes_192_ctr:
|
||||
*cipher = cryptodev_aes_ctr_192();
|
||||
*cipher = cryptodev_aes_192_ctr();
|
||||
break;
|
||||
case NID_aes_256_ctr:
|
||||
*cipher = cryptodev_aes_ctr_256();
|
||||
*cipher = cryptodev_aes_256_ctr();
|
||||
break;
|
||||
# endif
|
||||
default:
|
||||
|
||||
@@ -18,6 +18,7 @@ CRYPTO_ONCE engine_lock_init = CRYPTO_ONCE_STATIC_INIT;
|
||||
|
||||
DEFINE_RUN_ONCE(do_engine_lock_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
global_engine_lock = CRYPTO_THREAD_lock_new();
|
||||
return global_engine_lock != NULL;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,7 @@ static void ERR_STATE_free(ERR_STATE *s)
|
||||
|
||||
DEFINE_RUN_ONCE_STATIC(do_err_strings_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
err_string_lock = CRYPTO_THREAD_lock_new();
|
||||
return err_string_lock != NULL;
|
||||
}
|
||||
@@ -499,6 +500,9 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len)
|
||||
const char *ls, *fs, *rs;
|
||||
unsigned long l, f, r;
|
||||
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
l = ERR_GET_LIB(e);
|
||||
f = ERR_GET_FUNC(e);
|
||||
r = ERR_GET_REASON(e);
|
||||
|
||||
@@ -299,7 +299,7 @@ static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
memcpy(out, actx->tag, POLY1305_BLOCK_SIZE);
|
||||
} else {
|
||||
if (CRYPTO_memcmp(temp, in, POLY1305_BLOCK_SIZE)) {
|
||||
memset(out, 0, plen);
|
||||
memset(out - plen, 0, plen);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx,
|
||||
return 1;
|
||||
}
|
||||
|
||||
# if !defined(OPENSSL_NO_ASM) && ( \
|
||||
# if defined(RC4_ASM) && defined(MD5_ASM) && ( \
|
||||
defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(_M_AMD64) || defined(_M_X64) )
|
||||
# define STITCHED_CALL
|
||||
|
||||
@@ -398,6 +398,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
|
||||
return;
|
||||
REF_ASSERT_ISNT(i < 0);
|
||||
EVP_PKEY_free_it(x);
|
||||
CRYPTO_THREAD_lock_free(x->lock);
|
||||
sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
|
||||
OPENSSL_free(x);
|
||||
}
|
||||
@@ -413,7 +414,6 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
|
||||
ENGINE_finish(x->engine);
|
||||
x->engine = NULL;
|
||||
#endif
|
||||
CRYPTO_THREAD_lock_free(x->lock);
|
||||
}
|
||||
|
||||
static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,
|
||||
|
||||
@@ -38,6 +38,7 @@ static CRYPTO_ONCE ex_data_init = CRYPTO_ONCE_STATIC_INIT;
|
||||
|
||||
DEFINE_RUN_ONCE_STATIC(do_ex_data_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
ex_data_lock = CRYPTO_THREAD_lock_new();
|
||||
return ex_data_lock != NULL;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct ex_callback_st EX_CALLBACK;
|
||||
DEFINE_STACK_OF(EX_CALLBACK)
|
||||
|
||||
typedef struct app_mem_info_st APP_INFO;
|
||||
DEFINE_LHASH_OF(APP_INFO);
|
||||
|
||||
typedef struct mem_st MEM;
|
||||
DEFINE_LHASH_OF(MEM);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <internal/thread_once.h>
|
||||
#include <internal/dso.h>
|
||||
|
||||
static int stopped = 0;
|
||||
|
||||
@@ -79,6 +80,34 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base)
|
||||
return 0;
|
||||
OPENSSL_cpuid_setup();
|
||||
base_inited = 1;
|
||||
|
||||
#ifndef OPENSSL_USE_NODELETE
|
||||
# ifdef DSO_WIN32
|
||||
{
|
||||
HMODULE handle = NULL;
|
||||
BOOL ret;
|
||||
|
||||
/* We don't use the DSO route for WIN32 because there is a better way */
|
||||
ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
||||
| GET_MODULE_HANDLE_EX_FLAG_PIN,
|
||||
(void *)&base_inited, &handle);
|
||||
|
||||
return (ret == TRUE) ? 1 : 0;
|
||||
}
|
||||
# else
|
||||
/*
|
||||
* Deliberately leak a reference to ourselves. This will force the library
|
||||
* to remain loaded until the atexit() handler is run a process exit.
|
||||
*/
|
||||
{
|
||||
DSO *dso = NULL;
|
||||
|
||||
dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
|
||||
DSO_free(dso);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -103,8 +132,8 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
|
||||
"err_load_crypto_strings_int()\n");
|
||||
# endif
|
||||
ret = err_load_crypto_strings_int();
|
||||
#endif
|
||||
load_crypto_strings_inited = 1;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -575,6 +604,47 @@ int OPENSSL_atexit(void (*handler)(void))
|
||||
{
|
||||
OPENSSL_INIT_STOP *newhand;
|
||||
|
||||
#ifndef OPENSSL_USE_NODELETE
|
||||
{
|
||||
union {
|
||||
void *sym;
|
||||
void (*func)(void);
|
||||
} handlersym;
|
||||
|
||||
handlersym.func = handler;
|
||||
# ifdef DSO_WIN32
|
||||
{
|
||||
HMODULE handle = NULL;
|
||||
BOOL ret;
|
||||
|
||||
/*
|
||||
* We don't use the DSO route for WIN32 because there is a better
|
||||
* way
|
||||
*/
|
||||
ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
||||
| GET_MODULE_HANDLE_EX_FLAG_PIN,
|
||||
handlersym.sym, &handle);
|
||||
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
/*
|
||||
* Deliberately leak a reference to the handler. This will force the
|
||||
* library/code containing the handler to remain loaded until we run the
|
||||
* atexit handler. If -znodelete has been used then this is
|
||||
* unneccessary.
|
||||
*/
|
||||
{
|
||||
DSO *dso = NULL;
|
||||
|
||||
dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
|
||||
DSO_free(dso);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
newhand = OPENSSL_malloc(sizeof(*newhand));
|
||||
if (newhand == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -213,8 +213,8 @@ static int expand(OPENSSL_LHASH *lh)
|
||||
j = (int)lh->num_alloc_nodes * 2;
|
||||
n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
|
||||
if (n == NULL) {
|
||||
/* fputs("realloc error in lhash",stderr); */
|
||||
lh->error++;
|
||||
lh->num_nodes--;
|
||||
lh->p = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -143,8 +143,10 @@ $code=<<___;
|
||||
#include "arm_arch.h"
|
||||
|
||||
.text
|
||||
#if defined(__thumb2__)
|
||||
#if defined(__thumb2__) || defined(__clang__)
|
||||
.syntax unified
|
||||
#endif
|
||||
#if defined(__thumb2__)
|
||||
.thumb
|
||||
#else
|
||||
.code 32
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user