Compare commits
285 Commits
OpenSSL_1_
...
OpenSSL_1_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
902f3f50d0 | ||
![]() |
45e53cf881 | ||
![]() |
08d0ff54d0 | ||
![]() |
248808c840 | ||
![]() |
515f3be47a | ||
![]() |
25d14c6c29 | ||
![]() |
08ea966c01 | ||
![]() |
ef98503eee | ||
![]() |
708dc2f129 | ||
![]() |
bc38a7d2d3 | ||
![]() |
1b1d8ae49a | ||
![]() |
021fb42dd0 | ||
![]() |
9dfd2be8a1 | ||
![]() |
c175308407 | ||
![]() |
29305f4edc | ||
![]() |
7bcdf4ef78 | ||
![]() |
e9cf5f0366 | ||
![]() |
a3762a92d6 | ||
![]() |
5361af815d | ||
![]() |
578b956fe7 | ||
![]() |
259b664f95 | ||
![]() |
64333004a4 | ||
![]() |
04f2a0b50d | ||
![]() |
c436c990f6 | ||
![]() |
f78baa9d71 | ||
![]() |
5c57fbb8ca | ||
![]() |
6c88c71b4e | ||
![]() |
c575ceffdb | ||
![]() |
b393a4ad38 | ||
![]() |
43be582e9b | ||
![]() |
866b282d1b | ||
![]() |
24e6a0dba4 | ||
![]() |
6533a0b8d1 | ||
![]() |
b4b23d05d3 | ||
![]() |
10c639a8a5 | ||
![]() |
0fffd52242 | ||
![]() |
52464477be | ||
![]() |
64193c8218 | ||
![]() |
402fb1896b | ||
![]() |
a3baa17105 | ||
![]() |
093d20a8cb | ||
![]() |
5df0bde60e | ||
![]() |
a2bab12a33 | ||
![]() |
106dbca36c | ||
![]() |
a38a159bfc | ||
![]() |
e0fde613ac | ||
![]() |
2454accb6e | ||
![]() |
1e9446bf5c | ||
![]() |
e94f52e0c7 | ||
![]() |
83ab6e55a1 | ||
![]() |
7107798ae6 | ||
![]() |
2b0c11a620 | ||
![]() |
da7947e8c6 | ||
![]() |
22d192f106 | ||
![]() |
95605f3ae1 | ||
![]() |
f26a179abc | ||
![]() |
75374adf8a | ||
![]() |
c5b831f21d | ||
![]() |
878e2c5b13 | ||
![]() |
d81a160058 | ||
![]() |
3665fa2543 | ||
![]() |
2b80d00e3a | ||
![]() |
78a140ecb3 | ||
![]() |
f73c737c7a | ||
![]() |
930d87c1e1 | ||
![]() |
607e77300e | ||
![]() |
0555901cb4 | ||
![]() |
7934ce27cd | ||
![]() |
4d6fe78f65 | ||
![]() |
15debc128a | ||
![]() |
e254d12c43 | ||
![]() |
8788fb97a8 | ||
![]() |
6fa6a66285 | ||
![]() |
a2a29f702a | ||
![]() |
8259ccb44d | ||
![]() |
ad81ca9061 | ||
![]() |
d65a8d0b7e | ||
![]() |
75fdee0482 | ||
![]() |
a4530ce039 | ||
![]() |
cb19c0d15f | ||
![]() |
a3d74afcae | ||
![]() |
4d9c6fa01b | ||
![]() |
c52c3b5e11 | ||
![]() |
0ac6239955 | ||
![]() |
905943af3b | ||
![]() |
155a1623d0 | ||
![]() |
1c7de36f62 | ||
![]() |
6656ba7152 | ||
![]() |
17592f323a | ||
![]() |
6d97060ee0 | ||
![]() |
7eb5125125 | ||
![]() |
2a60fccdd9 | ||
![]() |
f6cadeeeed | ||
![]() |
dd045d17e7 | ||
![]() |
93a17f79b9 | ||
![]() |
ecadde4d4d | ||
![]() |
44e4f5b04b | ||
![]() |
474a53b3a3 | ||
![]() |
e780ed0336 | ||
![]() |
3cd33c42e3 | ||
![]() |
50053969e3 | ||
![]() |
01b5c1239b | ||
![]() |
f4d1926f95 | ||
![]() |
9501418ea2 | ||
![]() |
50b255a260 | ||
![]() |
5ff0cfa517 | ||
![]() |
02d013e621 | ||
![]() |
89cd4fb5e9 | ||
![]() |
c44844d928 | ||
![]() |
4e295148c3 | ||
![]() |
8e18babd1b | ||
![]() |
b12fd50626 | ||
![]() |
e40d6bf00a | ||
![]() |
8a27243c7b | ||
![]() |
bfe07df40c | ||
![]() |
33223e733a | ||
![]() |
9330fbd07f | ||
![]() |
00456fded4 | ||
![]() |
c394a48894 | ||
![]() |
d73cc256c8 | ||
![]() |
cc598f321f | ||
![]() |
fb4f46763f | ||
![]() |
babe434c99 | ||
![]() |
87bc193bc1 | ||
![]() |
15c62b0dfd | ||
![]() |
94f98a9019 | ||
![]() |
301a6dcd45 | ||
![]() |
ed02493567 | ||
![]() |
296f7bd1ac | ||
![]() |
a5b63f8073 | ||
![]() |
3a9328e3f7 | ||
![]() |
943c4ca62b | ||
![]() |
d88ef40a1e | ||
![]() |
9252d71557 | ||
![]() |
fb92839c93 | ||
![]() |
6d31885d4a | ||
![]() |
03bf712780 | ||
![]() |
56d9134675 | ||
![]() |
cb70eede8b | ||
![]() |
01d625e2c3 | ||
![]() |
bc2ab6ed2f | ||
![]() |
bef7693860 | ||
![]() |
c6a5fddf6c | ||
![]() |
817ddb9fb0 | ||
![]() |
f236ef27bd | ||
![]() |
48008008af | ||
![]() |
d40ec4ab8e | ||
![]() |
15a7164eb7 | ||
![]() |
822d265ced | ||
![]() |
903738ac63 | ||
![]() |
a89dda8cd0 | ||
![]() |
fdbe4a3fa6 | ||
![]() |
0c0f1361b2 | ||
![]() |
ca3658e000 | ||
![]() |
8f486d793b | ||
![]() |
706c85da79 | ||
![]() |
dfb23a5ac8 | ||
![]() |
b62a2f8a37 | ||
![]() |
a8bd9f90ed | ||
![]() |
43679fc35e | ||
![]() |
ec3a7c9b37 | ||
![]() |
72895f5112 | ||
![]() |
e90f1d9b74 | ||
![]() |
5a1e6b1342 | ||
![]() |
51a1cc4ffc | ||
![]() |
8d43c0053b | ||
![]() |
e272f8ef8f | ||
![]() |
c97c7f8d53 | ||
![]() |
a20d9422cf | ||
![]() |
bf9d61d1ab | ||
![]() |
6868346585 | ||
![]() |
985abd1fd8 | ||
![]() |
b00424792f | ||
![]() |
bb7b893d7c | ||
![]() |
cc1cdc5df5 | ||
![]() |
738b8e6bc2 | ||
![]() |
6481be7346 | ||
![]() |
cba8745395 | ||
![]() |
61dfe3a720 | ||
![]() |
184718baab | ||
![]() |
6b247c1817 | ||
![]() |
d62c64b947 | ||
![]() |
6f997dc365 | ||
![]() |
21b538d616 | ||
![]() |
92ea6fe597 | ||
![]() |
920f7cf897 | ||
![]() |
605a54ef1c | ||
![]() |
51ff683c12 | ||
![]() |
be250ee2d3 | ||
![]() |
f5afe9ce3f | ||
![]() |
f61216ba9d | ||
![]() |
c038e6b504 | ||
![]() |
0ea050e743 | ||
![]() |
d601b9b50c | ||
![]() |
b21b330bf1 | ||
![]() |
325bb1ac25 | ||
![]() |
2e3a21e152 | ||
![]() |
8748519f64 | ||
![]() |
6be18a2219 | ||
![]() |
197db2143c | ||
![]() |
cb71f17dc7 | ||
![]() |
37faf11796 | ||
![]() |
0711826ae9 | ||
![]() |
929f6d6f55 | ||
![]() |
beb841c5d1 | ||
![]() |
3be39dc1e3 | ||
![]() |
728bcd59d3 | ||
![]() |
5116aeeacb | ||
![]() |
2aa5a2c766 | ||
![]() |
eac2b837d6 | ||
![]() |
ce5ae63ab2 | ||
![]() |
4dcdde120b | ||
![]() |
7b8a999202 | ||
![]() |
2df619b06c | ||
![]() |
cef9dcbb45 | ||
![]() |
40d5689458 | ||
![]() |
39c76ceb2d | ||
![]() |
0a1682d8b5 | ||
![]() |
31472acf61 | ||
![]() |
28643a1615 | ||
![]() |
dc0c888811 | ||
![]() |
9a931208d7 | ||
![]() |
41fe7d2380 | ||
![]() |
cc42e4af2c | ||
![]() |
59793f5c1e | ||
![]() |
5f623eb616 | ||
![]() |
5425917406 | ||
![]() |
cae70cfd46 | ||
![]() |
df1565ed9c | ||
![]() |
cf633fa002 | ||
![]() |
732a6b5522 | ||
![]() |
43613c0a02 | ||
![]() |
254b259ef0 | ||
![]() |
9c989aaa74 | ||
![]() |
f21fb858d3 | ||
![]() |
c8491de393 | ||
![]() |
1d7df236dc | ||
![]() |
a7cb67f4f2 | ||
![]() |
6cc31d4212 | ||
![]() |
06f6c55107 | ||
![]() |
2d07f60a02 | ||
![]() |
2f2295a596 | ||
![]() |
8e0b56b996 | ||
![]() |
d72c446213 | ||
![]() |
b012b497ea | ||
![]() |
6786c70ec1 | ||
![]() |
40356e4914 | ||
![]() |
3d23b2c255 | ||
![]() |
8d2e7c0dec | ||
![]() |
56353962e7 | ||
![]() |
25efcb44ac | ||
![]() |
5859bc62f3 | ||
![]() |
056df45ed1 | ||
![]() |
e9da86627a | ||
![]() |
0b12fa75c9 | ||
![]() |
b3a62dc032 | ||
![]() |
512368c9ed | ||
![]() |
ada57746b6 | ||
![]() |
5d786e9e2d | ||
![]() |
9ea70e5b40 | ||
![]() |
5438e17de0 | ||
![]() |
49cc3f4038 | ||
![]() |
a5e26349f7 | ||
![]() |
b68fa4d19e | ||
![]() |
602af7d01d | ||
![]() |
d0c9a90640 | ||
![]() |
9e43fe9a2b | ||
![]() |
374fd385c2 | ||
![]() |
6b7d872e81 | ||
![]() |
f0348c842e | ||
![]() |
09368c044b | ||
![]() |
4102d1a503 | ||
![]() |
fd9631bbbd | ||
![]() |
405f43bc2a | ||
![]() |
033b558181 | ||
![]() |
9e56a32e39 | ||
![]() |
9f0b86c68b | ||
![]() |
5a3ce86e21 | ||
![]() |
8a1dbda755 | ||
![]() |
0ed08a7a98 | ||
![]() |
efb1a50f37 | ||
![]() |
ded7eee8c2 | ||
![]() |
fdd6d00952 | ||
![]() |
2a7059c56f | ||
![]() |
a7ef1e9072 |
22
.cvsignore
22
.cvsignore
@@ -1,22 +0,0 @@
|
||||
openssl.pc
|
||||
libcrypto.pc
|
||||
libssl.pc
|
||||
MINFO
|
||||
makefile.one
|
||||
tmp
|
||||
out
|
||||
outinc
|
||||
rehash.time
|
||||
testlog
|
||||
make.log
|
||||
maketest.log
|
||||
cctest
|
||||
cctest.c
|
||||
cctest.a
|
||||
*.flc
|
||||
semantic.cache
|
||||
Makefile
|
||||
*.dll*
|
||||
*.so*
|
||||
*.sl*
|
||||
*.dylib*
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@
|
||||
.#*
|
||||
#*#
|
||||
*~
|
||||
/.dir-locals.el
|
||||
|
||||
# Top level excludes
|
||||
/Makefile.bak
|
||||
|
10
.travis-create-release.sh
Normal file
10
.travis-create-release.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
|
||||
# $1 is expected to be $TRAVIS_OS_NAME
|
||||
|
||||
if [ "$1" == osx ]; then
|
||||
make -f Makefile.org \
|
||||
DISTTARVARS="NAME=_srcdist TAR_COMMAND='\$\$(TAR) \$\$(TARFLAGS) -s \"|^|\$\$(NAME)/|\" -T \$\$(TARFILE).list -cvf -' TARFLAGS='-n' TARFILE=_srcdist.tar" SHELL='sh -vx' dist
|
||||
else
|
||||
make -f Makefile.org DISTTARVARS='TARFILE=_srcdist.tar NAME=_srcdist' SHELL='sh -v' dist
|
||||
fi
|
60
.travis.yml
Normal file
60
.travis.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
language: c
|
||||
|
||||
addons:
|
||||
apt_packages:
|
||||
- binutils-mingw-w64
|
||||
- gcc-mingw-w64
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
- i686-w64-mingw32-gcc
|
||||
- x86_64-w64-mingw32-gcc
|
||||
|
||||
env:
|
||||
- CONFIG_OPTS=""
|
||||
- CONFIG_OPTS="shared"
|
||||
- CONFIG_OPTS="-d --strict-warnings"
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: i686-w64-mingw32-gcc
|
||||
- os: osx
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
- compiler: i686-w64-mingw32-gcc
|
||||
env: CONFIG_OPTS="-d --strict-warnings"
|
||||
- compiler: x86_64-w64-mingw32-gcc
|
||||
env: CONFIG_OPTS="-d --strict-warnings"
|
||||
|
||||
before_script:
|
||||
- sh .travis-create-release.sh $TRAVIS_OS_NAME
|
||||
- tar -xvzf _srcdist.tar.gz
|
||||
- cd _srcdist
|
||||
- if [ "$CC" == i686-w64-mingw32-gcc ]; then
|
||||
export CROSS_COMPILE=${CC%%gcc}; unset CC;
|
||||
./Configure mingw $CONFIG_OPTS;
|
||||
elif [ "$CC" == x86_64-w64-mingw32-gcc ]; then
|
||||
export CROSS_COMPILE=${CC%%gcc}; unset CC;
|
||||
./Configure mingw64 $CONFIG_OPTS;
|
||||
else
|
||||
if [ "$CC" == gcc ]; then
|
||||
export CONFIG_OPTS="$CONFIG_OPTS -Wno-error=shadow";
|
||||
fi;
|
||||
./config $CONFIG_OPTS;
|
||||
fi
|
||||
- cd ..
|
||||
|
||||
script:
|
||||
- cd _srcdist
|
||||
- make
|
||||
- if [ -z "$CROSS_COMPILE" ]; then make test; fi
|
||||
- cd ..
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- openssl-commits@openssl.org
|
@@ -1,30 +1,2 @@
|
||||
The OpenSSL project depends on volunteer efforts and financial support from
|
||||
the end user community. That support comes in the form of donations and paid
|
||||
sponsorships, software support contracts, paid consulting services
|
||||
and commissioned software development.
|
||||
|
||||
Since all these activities support the continued development and improvement
|
||||
of OpenSSL we consider all these clients and customers as sponsors of the
|
||||
OpenSSL project.
|
||||
|
||||
We would like to identify and thank the following such sponsors for their past
|
||||
or current significant support of the OpenSSL project:
|
||||
|
||||
Major support:
|
||||
|
||||
Qualys http://www.qualys.com/
|
||||
|
||||
Very significant support:
|
||||
|
||||
OpenGear: http://www.opengear.com/
|
||||
|
||||
Significant support:
|
||||
|
||||
PSW Group: http://www.psw.net/
|
||||
Acano Ltd. http://acano.com/
|
||||
|
||||
Please note that we ask permission to identify sponsors and that some sponsors
|
||||
we consider eligible for inclusion here have requested to remain anonymous.
|
||||
|
||||
Additional sponsorship or financial support is always welcome: for more
|
||||
information please contact the OpenSSL Software Foundation.
|
||||
Please https://www.openssl.org/community/thanks.html for the current
|
||||
acknowledgements.
|
||||
|
422
CHANGES
422
CHANGES
@@ -2,6 +2,244 @@
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
Changes between 1.0.2f and 1.0.2g [1 Mar 2016]
|
||||
|
||||
* Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
Builds that are not configured with "enable-weak-ssl-ciphers" will not
|
||||
provide any "EXPORT" or "LOW" strength ciphers.
|
||||
[Viktor Dukhovni]
|
||||
|
||||
* Disable SSLv2 default build, default negotiation and weak ciphers. SSLv2
|
||||
is by default disabled at build-time. Builds that are not configured with
|
||||
"enable-ssl2" will not support SSLv2. Even if "enable-ssl2" is used,
|
||||
users who want to negotiate SSLv2 via the version-flexible SSLv23_method()
|
||||
will need to explicitly call either of:
|
||||
|
||||
SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2);
|
||||
or
|
||||
SSL_clear_options(ssl, SSL_OP_NO_SSLv2);
|
||||
|
||||
as appropriate. Even if either of those is used, or the application
|
||||
explicitly uses the version-specific SSLv2_method() or its client and
|
||||
server variants, SSLv2 ciphers vulnerable to exhaustive search key
|
||||
recovery have been removed. Specifically, the SSLv2 40-bit EXPORT
|
||||
ciphers, and SSLv2 56-bit DES are no longer available.
|
||||
(CVE-2016-0800)
|
||||
[Viktor Dukhovni]
|
||||
|
||||
*) Fix a double-free in DSA code
|
||||
|
||||
A double free bug was discovered when OpenSSL parses malformed DSA private
|
||||
keys and could lead to a DoS attack or memory corruption for applications
|
||||
that receive DSA private keys from untrusted sources. This scenario is
|
||||
considered rare.
|
||||
|
||||
This issue was reported to OpenSSL by Adam Langley(Google/BoringSSL) using
|
||||
libFuzzer.
|
||||
(CVE-2016-0705)
|
||||
[Stephen Henson]
|
||||
|
||||
*) Disable SRP fake user seed to address a server memory leak.
|
||||
|
||||
Add a new method SRP_VBASE_get1_by_user that handles the seed properly.
|
||||
|
||||
SRP_VBASE_get_by_user had inconsistent memory management behaviour.
|
||||
In order to fix an unavoidable memory leak, SRP_VBASE_get_by_user
|
||||
was changed to ignore the "fake user" SRP seed, even if the seed
|
||||
is configured.
|
||||
|
||||
Users should use SRP_VBASE_get1_by_user instead. Note that in
|
||||
SRP_VBASE_get1_by_user, caller must free the returned value. Note
|
||||
also that even though configuring the SRP seed attempts to hide
|
||||
invalid usernames by continuing the handshake with fake
|
||||
credentials, this behaviour is not constant time and no strong
|
||||
guarantees are made that the handshake is indistinguishable from
|
||||
that of a valid user.
|
||||
(CVE-2016-0798)
|
||||
[Emilia Käsper]
|
||||
|
||||
*) Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption
|
||||
|
||||
In the BN_hex2bn function the number of hex digits is calculated using an
|
||||
int value |i|. Later |bn_expand| is called with a value of |i * 4|. For
|
||||
large values of |i| this can result in |bn_expand| not allocating any
|
||||
memory because |i * 4| is negative. This can leave the internal BIGNUM data
|
||||
field as NULL leading to a subsequent NULL ptr deref. For very large values
|
||||
of |i|, the calculation |i * 4| could be a positive value smaller than |i|.
|
||||
In this case memory is allocated to the internal BIGNUM data field, but it
|
||||
is insufficiently sized leading to heap corruption. A similar issue exists
|
||||
in BN_dec2bn. This could have security consequences if BN_hex2bn/BN_dec2bn
|
||||
is ever called by user applications with very large untrusted hex/dec data.
|
||||
This is anticipated to be a rare occurrence.
|
||||
|
||||
All OpenSSL internal usage of these functions use data that is not expected
|
||||
to be untrusted, e.g. config file data or application command line
|
||||
arguments. If user developed applications generate config file data based
|
||||
on untrusted data then it is possible that this could also lead to security
|
||||
consequences. This is also anticipated to be rare.
|
||||
|
||||
This issue was reported to OpenSSL by Guido Vranken.
|
||||
(CVE-2016-0797)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Fix memory issues in BIO_*printf functions
|
||||
|
||||
The internal |fmtstr| function used in processing a "%s" format string in
|
||||
the BIO_*printf functions could overflow while calculating the length of a
|
||||
string and cause an OOB read when printing very long strings.
|
||||
|
||||
Additionally the internal |doapr_outch| function can attempt to write to an
|
||||
OOB memory location (at an offset from the NULL pointer) in the event of a
|
||||
memory allocation failure. In 1.0.2 and below this could be caused where
|
||||
the size of a buffer to be allocated is greater than INT_MAX. E.g. this
|
||||
could be in processing a very long "%s" format string. Memory leaks can
|
||||
also occur.
|
||||
|
||||
The first issue may mask the second issue dependent on compiler behaviour.
|
||||
These problems could enable attacks where large amounts of untrusted data
|
||||
is passed to the BIO_*printf functions. If applications use these functions
|
||||
in this way then they could be vulnerable. OpenSSL itself uses these
|
||||
functions when printing out human-readable dumps of ASN.1 data. Therefore
|
||||
applications that print this data could be vulnerable if the data is from
|
||||
untrusted sources. OpenSSL command line applications could also be
|
||||
vulnerable where they print out ASN.1 data, or if untrusted data is passed
|
||||
as command line arguments.
|
||||
|
||||
Libssl is not considered directly vulnerable. Additionally certificates etc
|
||||
received via remote connections via libssl are also unlikely to be able to
|
||||
trigger these issues because of message size limits enforced within libssl.
|
||||
|
||||
This issue was reported to OpenSSL Guido Vranken.
|
||||
(CVE-2016-0799)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Side channel attack on modular exponentiation
|
||||
|
||||
A side-channel attack was found which makes use of cache-bank conflicts on
|
||||
the Intel Sandy-Bridge microarchitecture which could lead to the recovery
|
||||
of RSA keys. The ability to exploit this issue is limited as it relies on
|
||||
an attacker who has control of code in a thread running on the same
|
||||
hyper-threaded core as the victim thread which is performing decryptions.
|
||||
|
||||
This issue was reported to OpenSSL by Yuval Yarom, The University of
|
||||
Adelaide and NICTA, Daniel Genkin, Technion and Tel Aviv University, and
|
||||
Nadia Heninger, University of Pennsylvania with more information at
|
||||
http://cachebleed.info.
|
||||
(CVE-2016-0702)
|
||||
[Andy Polyakov]
|
||||
|
||||
*) Change the req app to generate a 2048-bit RSA/DSA key by default,
|
||||
if no keysize is specified with default_bits. This fixes an
|
||||
omission in an earlier change that changed all RSA/DSA key generation
|
||||
apps to use 2048 bits by default.
|
||||
[Emilia Käsper]
|
||||
|
||||
Changes between 1.0.2e and 1.0.2f [28 Jan 2016]
|
||||
|
||||
*) DH small subgroups
|
||||
|
||||
Historically OpenSSL only ever generated DH parameters based on "safe"
|
||||
primes. More recently (in version 1.0.2) support was provided for
|
||||
generating X9.42 style parameter files such as those required for RFC 5114
|
||||
support. The primes used in such files may not be "safe". Where an
|
||||
application is using DH configured with parameters based on primes that are
|
||||
not "safe" then an attacker could use this fact to find a peer's private
|
||||
DH exponent. This attack requires that the attacker complete multiple
|
||||
handshakes in which the peer uses the same private DH exponent. For example
|
||||
this could be used to discover a TLS server's private DH exponent if it's
|
||||
reusing the private DH exponent or it's using a static DH ciphersuite.
|
||||
|
||||
OpenSSL provides the option SSL_OP_SINGLE_DH_USE for ephemeral DH (DHE) in
|
||||
TLS. It is not on by default. If the option is not set then the server
|
||||
reuses the same private DH exponent for the life of the server process and
|
||||
would be vulnerable to this attack. It is believed that many popular
|
||||
applications do set this option and would therefore not be at risk.
|
||||
|
||||
The fix for this issue adds an additional check where a "q" parameter is
|
||||
available (as is the case in X9.42 based parameters). This detects the
|
||||
only known attack, and is the only possible defense for static DH
|
||||
ciphersuites. This could have some performance impact.
|
||||
|
||||
Additionally the SSL_OP_SINGLE_DH_USE option has been switched on by
|
||||
default and cannot be disabled. This could have some performance impact.
|
||||
|
||||
This issue was reported to OpenSSL by Antonio Sanso (Adobe).
|
||||
(CVE-2016-0701)
|
||||
[Matt Caswell]
|
||||
|
||||
*) SSLv2 doesn't block disabled ciphers
|
||||
|
||||
A malicious client can negotiate SSLv2 ciphers that have been disabled on
|
||||
the server and complete SSLv2 handshakes even if all SSLv2 ciphers have
|
||||
been disabled, provided that the SSLv2 protocol was not also disabled via
|
||||
SSL_OP_NO_SSLv2.
|
||||
|
||||
This issue was reported to OpenSSL on 26th December 2015 by Nimrod Aviram
|
||||
and Sebastian Schinzel.
|
||||
(CVE-2015-3197)
|
||||
[Viktor Dukhovni]
|
||||
|
||||
*) Reject DH handshakes with parameters shorter than 1024 bits.
|
||||
[Kurt Roeckx]
|
||||
|
||||
Changes between 1.0.2d and 1.0.2e [3 Dec 2015]
|
||||
|
||||
*) BN_mod_exp may produce incorrect results on x86_64
|
||||
|
||||
There is a carry propagating bug in the x86_64 Montgomery squaring
|
||||
procedure. No EC algorithms are affected. Analysis suggests that attacks
|
||||
against RSA and DSA as a result of this defect would be very difficult to
|
||||
perform and are not believed likely. Attacks against DH are considered just
|
||||
feasible (although very difficult) because most of the work necessary to
|
||||
deduce information about a private key may be performed offline. The amount
|
||||
of resources required for such an attack would be very significant and
|
||||
likely only accessible to a limited number of attackers. An attacker would
|
||||
additionally need online access to an unpatched system using the target
|
||||
private key in a scenario with persistent DH parameters and a private
|
||||
key that is shared between multiple clients. For example this can occur by
|
||||
default in OpenSSL DHE based SSL/TLS ciphersuites.
|
||||
|
||||
This issue was reported to OpenSSL by Hanno Böck.
|
||||
(CVE-2015-3193)
|
||||
[Andy Polyakov]
|
||||
|
||||
*) Certificate verify crash with missing PSS parameter
|
||||
|
||||
The signature verification routines will crash with a NULL pointer
|
||||
dereference if presented with an ASN.1 signature using the RSA PSS
|
||||
algorithm and absent mask generation function parameter. Since these
|
||||
routines are used to verify certificate signature algorithms this can be
|
||||
used to crash any certificate verification operation and exploited in a
|
||||
DoS attack. Any application which performs certificate verification is
|
||||
vulnerable including OpenSSL clients and servers which enable client
|
||||
authentication.
|
||||
|
||||
This issue was reported to OpenSSL by Loïc Jonas Etienne (Qnective AG).
|
||||
(CVE-2015-3194)
|
||||
[Stephen Henson]
|
||||
|
||||
*) X509_ATTRIBUTE memory leak
|
||||
|
||||
When presented with a malformed X509_ATTRIBUTE structure OpenSSL will leak
|
||||
memory. This structure is used by the PKCS#7 and CMS routines so any
|
||||
application which reads PKCS#7 or CMS data from untrusted sources is
|
||||
affected. SSL/TLS is not affected.
|
||||
|
||||
This issue was reported to OpenSSL by Adam Langley (Google/BoringSSL) using
|
||||
libFuzzer.
|
||||
(CVE-2015-3195)
|
||||
[Stephen Henson]
|
||||
|
||||
*) Rewrite EVP_DecodeUpdate (base64 decoding) to fix several bugs.
|
||||
This changes the decoding behaviour for some invalid messages,
|
||||
though the change is mostly in the more lenient direction, and
|
||||
legacy behaviour is preserved as much as possible.
|
||||
[Emilia Käsper]
|
||||
|
||||
*) In DSA_generate_parameters_ex, if the provided seed is too short,
|
||||
use a random seed, as already documented.
|
||||
[Rich Salz and Ismo Puustinen <ismo.puustinen@intel.com>]
|
||||
|
||||
Changes between 1.0.2c and 1.0.2d [9 Jul 2015]
|
||||
|
||||
*) Alternate chains certificate forgery
|
||||
@@ -15,8 +253,18 @@
|
||||
|
||||
This issue was reported to OpenSSL by Adam Langley/David Benjamin
|
||||
(Google/BoringSSL).
|
||||
(CVE-2015-1793)
|
||||
[Matt Caswell]
|
||||
|
||||
*) Race condition handling PSK identify hint
|
||||
|
||||
If PSK identity hints are received by a multi-threaded client then
|
||||
the values are wrongly updated in the parent SSL_CTX structure. This can
|
||||
result in a race condition potentially leading to a double free of the
|
||||
identify hint data.
|
||||
(CVE-2015-3196)
|
||||
[Stephen Henson]
|
||||
|
||||
Changes between 1.0.2b and 1.0.2c [12 Jun 2015]
|
||||
|
||||
*) Fix HMAC ABI incompatibility. The previous version introduced an ABI
|
||||
@@ -55,9 +303,9 @@
|
||||
callbacks.
|
||||
|
||||
This issue was reported to OpenSSL by Robert Swiecki (Google), and
|
||||
independently by Hanno B<EFBFBD>ck.
|
||||
independently by Hanno Böck.
|
||||
(CVE-2015-1789)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) PKCS7 crash with missing EnvelopedContent
|
||||
|
||||
@@ -71,7 +319,7 @@
|
||||
|
||||
This issue was reported to OpenSSL by Michal Zalewski (Google).
|
||||
(CVE-2015-1790)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) CMS verify infinite loop with unknown hash function
|
||||
|
||||
@@ -201,7 +449,7 @@
|
||||
|
||||
This issue was reported to OpenSSL by Michal Zalewski (Google).
|
||||
(CVE-2015-0289)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) DoS via reachable assert in SSLv2 servers fix
|
||||
|
||||
@@ -209,10 +457,10 @@
|
||||
servers that both support SSLv2 and enable export cipher suites by sending
|
||||
a specially crafted SSLv2 CLIENT-MASTER-KEY message.
|
||||
|
||||
This issue was discovered by Sean Burford (Google) and Emilia K<EFBFBD>sper
|
||||
This issue was discovered by Sean Burford (Google) and Emilia Käsper
|
||||
(OpenSSL development team).
|
||||
(CVE-2015-0293)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) Empty CKE with client auth and DHE fix
|
||||
|
||||
@@ -272,6 +520,10 @@
|
||||
|
||||
Changes between 1.0.1l and 1.0.2 [22 Jan 2015]
|
||||
|
||||
*) Change RSA and DH/DSA key generation apps to generate 2048-bit
|
||||
keys by default.
|
||||
[Kurt Roeckx]
|
||||
|
||||
*) Facilitate "universal" ARM builds targeting range of ARM ISAs, e.g.
|
||||
ARMv5 through ARMv8, as opposite to "locking" it to single one.
|
||||
So far those who have to target multiple plaforms would compromise
|
||||
@@ -717,12 +969,12 @@
|
||||
version does not match the session's version. Resuming with a different
|
||||
version, while not strictly forbidden by the RFC, is of questionable
|
||||
sanity and breaks all known clients.
|
||||
[David Benjamin, Emilia K<EFBFBD>sper]
|
||||
[David Benjamin, Emilia Käsper]
|
||||
|
||||
*) Tighten handling of the ChangeCipherSpec (CCS) message: reject
|
||||
early CCS messages during renegotiation. (Note that because
|
||||
renegotiation is encrypted, this early CCS was not exploitable.)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) Tighten client-side session ticket handling during renegotiation:
|
||||
ensure that the client only accepts a session ticket if the server sends
|
||||
@@ -733,7 +985,7 @@
|
||||
Similarly, ensure that the client requires a session ticket if one
|
||||
was advertised in the ServerHello. Previously, a TLS client would
|
||||
ignore a missing NewSessionTicket message.
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
Changes between 1.0.1i and 1.0.1j [15 Oct 2014]
|
||||
|
||||
@@ -813,10 +1065,10 @@
|
||||
with a null pointer dereference (read) by specifying an anonymous (EC)DH
|
||||
ciphersuite and sending carefully crafted handshake messages.
|
||||
|
||||
Thanks to Felix Gr<EFBFBD>bert (Google) for discovering and researching this
|
||||
Thanks to Felix Gröbert (Google) for discovering and researching this
|
||||
issue.
|
||||
(CVE-2014-3510)
|
||||
[Emilia K<EFBFBD>sper]
|
||||
[Emilia Käsper]
|
||||
|
||||
*) By sending carefully crafted DTLS packets an attacker could cause openssl
|
||||
to leak memory. This can be exploited through a Denial of Service attack.
|
||||
@@ -853,7 +1105,7 @@
|
||||
properly negotiated with the client. This can be exploited through a
|
||||
Denial of Service attack.
|
||||
|
||||
Thanks to Joonas Kuorilehto and Riku Hietam<EFBFBD>ki (Codenomicon) for
|
||||
Thanks to Joonas Kuorilehto and Riku Hietamäki (Codenomicon) for
|
||||
discovering and researching this issue.
|
||||
(CVE-2014-5139)
|
||||
[Steve Henson]
|
||||
@@ -865,7 +1117,7 @@
|
||||
|
||||
Thanks to Ivan Fratric (Google) for discovering this issue.
|
||||
(CVE-2014-3508)
|
||||
[Emilia K<EFBFBD>sper, and Steve Henson]
|
||||
[Emilia Käsper, and Steve Henson]
|
||||
|
||||
*) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.)
|
||||
for corner cases. (Certain input points at infinity could lead to
|
||||
@@ -895,22 +1147,22 @@
|
||||
client or server. This is potentially exploitable to run arbitrary
|
||||
code on a vulnerable client or server.
|
||||
|
||||
Thanks to J<EFBFBD>ri Aedla for reporting this issue. (CVE-2014-0195)
|
||||
[J<EFBFBD>ri Aedla, Steve Henson]
|
||||
Thanks to Jüri Aedla for reporting this issue. (CVE-2014-0195)
|
||||
[Jüri Aedla, Steve Henson]
|
||||
|
||||
*) Fix bug in TLS code where clients enable anonymous ECDH ciphersuites
|
||||
are subject to a denial of service attack.
|
||||
|
||||
Thanks to Felix Gr<EFBFBD>bert and Ivan Fratric at Google for discovering
|
||||
Thanks to Felix Gröbert and Ivan Fratric at Google for discovering
|
||||
this issue. (CVE-2014-3470)
|
||||
[Felix Gr<EFBFBD>bert, Ivan Fratric, Steve Henson]
|
||||
[Felix Gröbert, Ivan Fratric, Steve Henson]
|
||||
|
||||
*) Harmonize version and its documentation. -f flag is used to display
|
||||
compilation flags.
|
||||
[mancha <mancha1@zoho.com>]
|
||||
|
||||
*) Fix eckey_priv_encode so it immediately returns an error upon a failure
|
||||
in i2d_ECPrivateKey.
|
||||
in i2d_ECPrivateKey. Thanks to Ted Unangst for feedback on this issue.
|
||||
[mancha <mancha1@zoho.com>]
|
||||
|
||||
*) Fix some double frees. These are not thought to be exploitable.
|
||||
@@ -982,9 +1234,9 @@
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
(www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and
|
||||
Emilia K<EFBFBD>sper for the initial patch.
|
||||
Emilia Käsper for the initial patch.
|
||||
(CVE-2013-0169)
|
||||
[Emilia K<EFBFBD>sper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
|
||||
[Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
|
||||
|
||||
*) Fix flaw in AESNI handling of TLS 1.2 and 1.1 records for CBC mode
|
||||
ciphersuites which can be exploited in a denial of service attack.
|
||||
@@ -1159,7 +1411,7 @@
|
||||
EC_GROUP_new_by_curve_name() will automatically use these (while
|
||||
EC_GROUP_new_curve_GFp() currently prefers the more flexible
|
||||
implementations).
|
||||
[Emilia K<EFBFBD>sper, Adam Langley, Bodo Moeller (Google)]
|
||||
[Emilia Käsper, Adam Langley, Bodo Moeller (Google)]
|
||||
|
||||
*) Use type ossl_ssize_t instad of ssize_t which isn't available on
|
||||
all platforms. Move ssize_t definition from e_os.h to the public
|
||||
@@ -1435,7 +1687,7 @@
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Fix spurious failures in ecdsatest.c.
|
||||
[Emilia K<EFBFBD>sper (Google)]
|
||||
[Emilia Käsper (Google)]
|
||||
|
||||
*) Fix the BIO_f_buffer() implementation (which was mixing different
|
||||
interpretations of the '..._len' fields).
|
||||
@@ -1449,7 +1701,7 @@
|
||||
lock to call BN_BLINDING_invert_ex, and avoids one use of
|
||||
BN_BLINDING_update for each BN_BLINDING structure (previously,
|
||||
the last update always remained unused).
|
||||
[Emilia K<EFBFBD>sper (Google)]
|
||||
[Emilia Käsper (Google)]
|
||||
|
||||
*) In ssl3_clear, preserve s3->init_extra along with s3->rbuf.
|
||||
[Bob Buckholz (Google)]
|
||||
@@ -2258,7 +2510,7 @@
|
||||
|
||||
*) Add RFC 3161 compliant time stamp request creation, response generation
|
||||
and response verification functionality.
|
||||
[Zolt<EFBFBD>n Gl<EFBFBD>zik <zglozik@opentsa.org>, The OpenTSA Project]
|
||||
[Zoltán Glózik <zglozik@opentsa.org>, The OpenTSA Project]
|
||||
|
||||
*) Add initial support for TLS extensions, specifically for the server_name
|
||||
extension so far. The SSL_SESSION, SSL_CTX, and SSL data structures now
|
||||
@@ -3426,7 +3678,7 @@
|
||||
|
||||
*) BN_CTX_get() should return zero-valued bignums, providing the same
|
||||
initialised value as BN_new().
|
||||
[Geoff Thorpe, suggested by Ulf M<EFBFBD>ller]
|
||||
[Geoff Thorpe, suggested by Ulf Möller]
|
||||
|
||||
*) Support for inhibitAnyPolicy certificate extension.
|
||||
[Steve Henson]
|
||||
@@ -3445,7 +3697,7 @@
|
||||
some point, these tighter rules will become openssl's default to improve
|
||||
maintainability, though the assert()s and other overheads will remain only
|
||||
in debugging configurations. See bn.h for more details.
|
||||
[Geoff Thorpe, Nils Larsch, Ulf M<EFBFBD>ller]
|
||||
[Geoff Thorpe, Nils Larsch, Ulf Möller]
|
||||
|
||||
*) BN_CTX_init() has been deprecated, as BN_CTX is an opaque structure
|
||||
that can only be obtained through BN_CTX_new() (which implicitly
|
||||
@@ -3512,7 +3764,7 @@
|
||||
[Douglas Stebila (Sun Microsystems Laboratories)]
|
||||
|
||||
*) Add the possibility to load symbols globally with DSO.
|
||||
[G<EFBFBD>tz Babin-Ebell <babin-ebell@trustcenter.de> via Richard Levitte]
|
||||
[Götz Babin-Ebell <babin-ebell@trustcenter.de> via Richard Levitte]
|
||||
|
||||
*) Add the functions ERR_set_mark() and ERR_pop_to_mark() for better
|
||||
control of the error stack.
|
||||
@@ -4227,7 +4479,7 @@
|
||||
[Steve Henson]
|
||||
|
||||
*) Undo Cygwin change.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Added support for proxy certificates according to RFC 3820.
|
||||
Because they may be a security thread to unaware applications,
|
||||
@@ -4260,11 +4512,11 @@
|
||||
[Stephen Henson, reported by UK NISCC]
|
||||
|
||||
*) Use Windows randomness collection on Cygwin.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix hang in EGD/PRNGD query when communication socket is closed
|
||||
prematurely by EGD/PRNGD.
|
||||
[Darren Tucker <dtucker@zip.com.au> via Lutz J<EFBFBD>nicke, resolves #1014]
|
||||
[Darren Tucker <dtucker@zip.com.au> via Lutz Jänicke, resolves #1014]
|
||||
|
||||
*) Prompt for pass phrases when appropriate for PKCS12 input format.
|
||||
[Steve Henson]
|
||||
@@ -4726,7 +4978,7 @@
|
||||
pointers passed to them whenever necessary. Otherwise it is possible
|
||||
the caller may have overwritten (or deallocated) the original string
|
||||
data when a later ENGINE operation tries to use the stored values.
|
||||
[G<EFBFBD>tz Babin-Ebell <babinebell@trustcenter.de>]
|
||||
[Götz Babin-Ebell <babinebell@trustcenter.de>]
|
||||
|
||||
*) Improve diagnostics in file reading and command-line digests.
|
||||
[Ben Laurie aided and abetted by Solar Designer <solar@openwall.com>]
|
||||
@@ -6831,7 +7083,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) BN_sqr() bug fix.
|
||||
[Ulf M<EFBFBD>ller, reported by Jim Ellis <jim.ellis@cavium.com>]
|
||||
[Ulf Möller, reported by Jim Ellis <jim.ellis@cavium.com>]
|
||||
|
||||
*) Rabin-Miller test analyses assume uniformly distributed witnesses,
|
||||
so use BN_pseudo_rand_range() instead of using BN_pseudo_rand()
|
||||
@@ -6991,7 +7243,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Fix OAEP check.
|
||||
[Ulf M<EFBFBD>ller, Bodo M<EFBFBD>ller]
|
||||
[Ulf Möller, Bodo Möller]
|
||||
|
||||
*) The countermeasure against Bleichbacher's attack on PKCS #1 v1.5
|
||||
RSA encryption was accidentally removed in s3_srvr.c in OpenSSL 0.9.5
|
||||
@@ -7253,10 +7505,10 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Use better test patterns in bntest.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) rand_win.c fix for Borland C.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) BN_rshift bugfix for n == 0.
|
||||
[Bodo Moeller]
|
||||
@@ -7401,14 +7653,14 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) New BIO_shutdown_wr macro, which invokes the BIO_C_SHUTDOWN_WR
|
||||
BIO_ctrl (for BIO pairs).
|
||||
[Bodo M<EFBFBD>ller]
|
||||
[Bodo Möller]
|
||||
|
||||
*) Add DSO method for VMS.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Bug fix: Montgomery multiplication could produce results with the
|
||||
wrong sign.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add RPM specification openssl.spec and modify it to build three
|
||||
packages. The default package contains applications, application
|
||||
@@ -7426,7 +7678,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) Don't set the two most significant bits to one when generating a
|
||||
random number < q in the DSA library.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) New SSL API mode 'SSL_MODE_AUTO_RETRY'. This disables the default
|
||||
behaviour that SSL_read may result in SSL_ERROR_WANT_READ (even if
|
||||
@@ -7692,7 +7944,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*) Randomness polling function for Win9x, as described in:
|
||||
Peter Gutmann, Software Generation of Practically Strong
|
||||
Random Numbers.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix so PRNG is seeded in req if using an already existing
|
||||
DSA key.
|
||||
@@ -7912,7 +8164,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) Eliminate non-ANSI declarations in crypto.h and stack.h.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix for SSL server purpose checking. Server checking was
|
||||
rejecting certificates which had extended key usage present
|
||||
@@ -7944,7 +8196,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Bugfix for linux-elf makefile.one.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) RSA_get_default_method() will now cause a default
|
||||
RSA_METHOD to be chosen if one doesn't exist already.
|
||||
@@ -8033,7 +8285,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) des_quad_cksum() byte order bug fix.
|
||||
[Ulf M<EFBFBD>ller, using the problem description in krb4-0.9.7, where
|
||||
[Ulf Möller, using the problem description in krb4-0.9.7, where
|
||||
the solution is attributed to Derrick J Brashear <shadow@DEMENTIA.ORG>]
|
||||
|
||||
*) Fix so V_ASN1_APP_CHOOSE works again: however its use is strongly
|
||||
@@ -8134,7 +8386,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Rolf Haberrecker <rolf@suse.de>]
|
||||
|
||||
*) Assembler module support for Mingw32.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Shared library support for HPUX (in shlib/).
|
||||
[Lutz Jaenicke <Lutz.Jaenicke@aet.TU-Cottbus.DE> and Anonymous]
|
||||
@@ -8153,7 +8405,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) BN_mul bugfix: In bn_mul_part_recursion() only the a>a[n] && b>b[n]
|
||||
case was implemented. This caused BN_div_recp() to fail occasionally.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add an optional second argument to the set_label() in the perl
|
||||
assembly language builder. If this argument exists and is set
|
||||
@@ -8183,14 +8435,14 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) Fix potential buffer overrun problem in BIO_printf().
|
||||
[Ulf M<EFBFBD>ller, using public domain code by Patrick Powell; problem
|
||||
[Ulf Möller, using public domain code by Patrick Powell; problem
|
||||
pointed out by David Sacerdote <das33@cornell.edu>]
|
||||
|
||||
*) Support EGD <http://www.lothar.com/tech/crypto/>. New functions
|
||||
RAND_egd() and RAND_status(). In the command line application,
|
||||
the EGD socket can be specified like a seed file using RANDFILE
|
||||
or -rand.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Allow the string CERTIFICATE to be tolerated in PKCS#7 structures.
|
||||
Some CAs (e.g. Verisign) distribute certificates in this form.
|
||||
@@ -8223,7 +8475,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
#define OPENSSL_ALGORITHM_DEFINES
|
||||
#include <openssl/opensslconf.h>
|
||||
defines all pertinent NO_<algo> symbols, such as NO_IDEA, NO_RSA, etc.
|
||||
[Richard Levitte, Ulf and Bodo M<EFBFBD>ller]
|
||||
[Richard Levitte, Ulf and Bodo Möller]
|
||||
|
||||
*) Bugfix: Tolerate fragmentation and interleaving in the SSL 3/TLS
|
||||
record layer.
|
||||
@@ -8274,17 +8526,17 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) Bug fix for BN_div_recp() for numerators with an even number of
|
||||
bits.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) More tests in bntest.c, and changed test_bn output.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) ./config recognizes MacOS X now.
|
||||
[Andy Polyakov]
|
||||
|
||||
*) Bug fix for BN_div() when the first words of num and divsor are
|
||||
equal (it gave wrong results if (rem=(n1-q*d0)&BN_MASK2) < d0).
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add support for various broken PKCS#8 formats, and command line
|
||||
options to produce them.
|
||||
@@ -8292,11 +8544,11 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) New functions BN_CTX_start(), BN_CTX_get() and BT_CTX_end() to
|
||||
get temporary BIGNUMs from a BN_CTX.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Correct return values in BN_mod_exp_mont() and BN_mod_exp2_mont()
|
||||
for p == 0.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Change the SSLeay_add_all_*() functions to OpenSSL_add_all_*() and
|
||||
include a #define from the old name to the new. The original intent
|
||||
@@ -8320,7 +8572,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) Source code cleanups: use const where appropriate, eliminate casts,
|
||||
use void * instead of char * in lhash.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Bugfix: ssl3_send_server_key_exchange was not restartable
|
||||
(the state was not changed to SSL3_ST_SW_KEY_EXCH_B, and because of
|
||||
@@ -8365,13 +8617,13 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) New function BN_pseudo_rand().
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Clean up BN_mod_mul_montgomery(): replace the broken (and unreadable)
|
||||
bignum version of BN_from_montgomery() with the working code from
|
||||
SSLeay 0.9.0 (the word based version is faster anyway), and clean up
|
||||
the comments.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Avoid a race condition in s2_clnt.c (function get_server_hello) that
|
||||
made it impossible to use the same SSL_SESSION data structure in
|
||||
@@ -8381,25 +8633,25 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*) The return value of RAND_load_file() no longer counts bytes obtained
|
||||
by stat(). RAND_load_file(..., -1) is new and uses the complete file
|
||||
to seed the PRNG (previously an explicit byte count was required).
|
||||
[Ulf M<EFBFBD>ller, Bodo M<EFBFBD>ller]
|
||||
[Ulf Möller, Bodo Möller]
|
||||
|
||||
*) Clean up CRYPTO_EX_DATA functions, some of these didn't have prototypes
|
||||
used (char *) instead of (void *) and had casts all over the place.
|
||||
[Steve Henson]
|
||||
|
||||
*) Make BN_generate_prime() return NULL on error if ret!=NULL.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Retain source code compatibility for BN_prime_checks macro:
|
||||
BN_is_prime(..., BN_prime_checks, ...) now uses
|
||||
BN_prime_checks_for_size to determine the appropriate number of
|
||||
Rabin-Miller iterations.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Diffie-Hellman uses "safe" primes: DH_check() return code renamed to
|
||||
DH_CHECK_P_NOT_SAFE_PRIME.
|
||||
(Check if this is true? OpenPGP calls them "strong".)
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Merge the functionality of "dh" and "gendh" programs into a new program
|
||||
"dhparam". The old programs are retained for now but will handle DH keys
|
||||
@@ -8455,7 +8707,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*) Add missing #ifndefs that caused missing symbols when building libssl
|
||||
as a shared library without RSA. Use #ifndef NO_SSL2 instead of
|
||||
NO_RSA in ssl/s2*.c.
|
||||
[Kris Kennaway <kris@hub.freebsd.org>, modified by Ulf M<EFBFBD>ller]
|
||||
[Kris Kennaway <kris@hub.freebsd.org>, modified by Ulf Möller]
|
||||
|
||||
*) Precautions against using the PRNG uninitialized: RAND_bytes() now
|
||||
has a return value which indicates the quality of the random data
|
||||
@@ -8464,7 +8716,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
guaranteed to be unique but not unpredictable. RAND_add is like
|
||||
RAND_seed, but takes an extra argument for an entropy estimate
|
||||
(RAND_seed always assumes full entropy).
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Do more iterations of Rabin-Miller probable prime test (specifically,
|
||||
3 for 1024-bit primes, 6 for 512-bit primes, 12 for 256-bit primes
|
||||
@@ -8494,7 +8746,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) Honor the no-xxx Configure options when creating .DEF files.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add PKCS#10 attributes to field table: challengePassword,
|
||||
unstructuredName and unstructuredAddress. These are taken from
|
||||
@@ -9328,7 +9580,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) More DES library cleanups: remove references to srand/rand and
|
||||
delete an unused file.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add support for the the free Netwide assembler (NASM) under Win32,
|
||||
since not many people have MASM (ml) and it can be hard to obtain.
|
||||
@@ -9417,7 +9669,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
worked.
|
||||
|
||||
*) Fix problems with no-hmac etc.
|
||||
[Ulf M<EFBFBD>ller, pointed out by Brian Wellington <bwelling@tislabs.com>]
|
||||
[Ulf Möller, pointed out by Brian Wellington <bwelling@tislabs.com>]
|
||||
|
||||
*) New functions RSA_get_default_method(), RSA_set_method() and
|
||||
RSA_get_method(). These allows replacement of RSA_METHODs without having
|
||||
@@ -9534,7 +9786,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Ben Laurie]
|
||||
|
||||
*) DES library cleanups.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add support for PKCS#5 v2.0 PBE algorithms. This will permit PKCS#8 to be
|
||||
used with any cipher unlike PKCS#5 v1.5 which can at most handle 64 bit
|
||||
@@ -9577,7 +9829,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Christian Forster <fo@hawo.stw.uni-erlangen.de>]
|
||||
|
||||
*) config now generates no-xxx options for missing ciphers.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Support the EBCDIC character set (work in progress).
|
||||
File ebcdic.c not yet included because it has a different license.
|
||||
@@ -9690,7 +9942,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Move openssl.cnf out of lib/.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix various things to let OpenSSL even pass ``egcc -pipe -O2 -Wall
|
||||
-Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes
|
||||
@@ -9747,10 +9999,10 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Ben Laurie]
|
||||
|
||||
*) Support Borland C++ builder.
|
||||
[Janez Jere <jj@void.si>, modified by Ulf M<EFBFBD>ller]
|
||||
[Janez Jere <jj@void.si>, modified by Ulf Möller]
|
||||
|
||||
*) Support Mingw32.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) SHA-1 cleanups and performance enhancements.
|
||||
[Andy Polyakov <appro@fy.chalmers.se>]
|
||||
@@ -9759,7 +10011,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Andy Polyakov <appro@fy.chalmers.se>]
|
||||
|
||||
*) Accept any -xxx and +xxx compiler options in Configure.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Update HPUX configuration.
|
||||
[Anonymous]
|
||||
@@ -9792,7 +10044,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Bodo Moeller]
|
||||
|
||||
*) OAEP decoding bug fix.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Support INSTALL_PREFIX for package builders, as proposed by
|
||||
David Harris.
|
||||
@@ -9815,21 +10067,21 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Niels Poppe <niels@netbox.org>]
|
||||
|
||||
*) New Configure option no-<cipher> (rsa, idea, rc5, ...).
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Add the PKCS#12 API documentation to openssl.txt. Preliminary support for
|
||||
extension adding in x509 utility.
|
||||
[Steve Henson]
|
||||
|
||||
*) Remove NOPROTO sections and error code comments.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Partial rewrite of the DEF file generator to now parse the ANSI
|
||||
prototypes.
|
||||
[Steve Henson]
|
||||
|
||||
*) New Configure options --prefix=DIR and --openssldir=DIR.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Complete rewrite of the error code script(s). It is all now handled
|
||||
by one script at the top level which handles error code gathering,
|
||||
@@ -9858,7 +10110,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) Move the autogenerated header file parts to crypto/opensslconf.h.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix new 56-bit DES export ciphersuites: they were using 7 bytes instead of
|
||||
8 of keying material. Merlin has also confirmed interop with this fix
|
||||
@@ -9876,13 +10128,13 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Andy Polyakov <appro@fy.chalmers.se>]
|
||||
|
||||
*) Change functions to ANSI C.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Fix typos in error codes.
|
||||
[Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>, Ulf M<EFBFBD>ller]
|
||||
[Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>, Ulf Möller]
|
||||
|
||||
*) Remove defunct assembler files from Configure.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) SPARC v8 assembler BIGNUM implementation.
|
||||
[Andy Polyakov <appro@fy.chalmers.se>]
|
||||
@@ -9919,7 +10171,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) New Configure option "rsaref".
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Don't auto-generate pem.h.
|
||||
[Bodo Moeller]
|
||||
@@ -9967,7 +10219,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) New functions DSA_do_sign and DSA_do_verify to provide access to
|
||||
the raw DSA values prior to ASN.1 encoding.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Tweaks to Configure
|
||||
[Niels Poppe <niels@netbox.org>]
|
||||
@@ -9977,11 +10229,11 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) New variables $(RANLIB) and $(PERL) in the Makefiles.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) New config option to avoid instructions that are illegal on the 80386.
|
||||
The default code is faster, but requires at least a 486.
|
||||
[Ulf M<EFBFBD>ller]
|
||||
[Ulf Möller]
|
||||
|
||||
*) Got rid of old SSL2_CLIENT_VERSION (inconsistently used) and
|
||||
SSL2_SERVER_VERSION (not used at all) macros, which are now the
|
||||
@@ -10520,7 +10772,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
Hagino <itojun@kame.net>]
|
||||
|
||||
*) File was opened incorrectly in randfile.c.
|
||||
[Ulf M<EFBFBD>ller <ulf@fitug.de>]
|
||||
[Ulf Möller <ulf@fitug.de>]
|
||||
|
||||
*) Beginning of support for GeneralizedTime. d2i, i2d, check and print
|
||||
functions. Also ASN1_TIME suite which is a CHOICE of UTCTime or
|
||||
@@ -10530,7 +10782,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
[Steve Henson]
|
||||
|
||||
*) Correct Linux 1 recognition in config.
|
||||
[Ulf M<EFBFBD>ller <ulf@fitug.de>]
|
||||
[Ulf Möller <ulf@fitug.de>]
|
||||
|
||||
*) Remove pointless MD5 hash when using DSA keys in ca.
|
||||
[Anonymous <nobody@replay.com>]
|
||||
@@ -10677,7 +10929,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
|
||||
*) Fix the RSA header declarations that hid a bug I fixed in 0.9.0b but
|
||||
was already fixed by Eric for 0.9.1 it seems.
|
||||
[Ben Laurie - pointed out by Ulf M<EFBFBD>ller <ulf@fitug.de>]
|
||||
[Ben Laurie - pointed out by Ulf Möller <ulf@fitug.de>]
|
||||
|
||||
*) Autodetect FreeBSD3.
|
||||
[Ben Laurie]
|
||||
|
38
CONTRIBUTING
Normal file
38
CONTRIBUTING
Normal file
@@ -0,0 +1,38 @@
|
||||
HOW TO CONTRIBUTE TO OpenSSL
|
||||
----------------------------
|
||||
|
||||
Development is coordinated on the openssl-dev mailing list (see
|
||||
http://www.openssl.org for information on subscribing). If you
|
||||
would like to submit a patch, send it to rt@openssl.org with
|
||||
the string "[PATCH]" in the subject. Please be sure to include a
|
||||
textual explanation of what your patch does.
|
||||
|
||||
You can also make GitHub pull requests. If you do this, please also send
|
||||
mail to rt@openssl.org with a brief description and a link to the PR so
|
||||
that we can more easily keep track of it.
|
||||
|
||||
If you are unsure as to whether a feature will be useful for the general
|
||||
OpenSSL community please 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.
|
||||
|
||||
Patches should be as up to date as possible, preferably relative to the
|
||||
current Git or the last snapshot. They should follow our coding style
|
||||
(see https://www.openssl.org/policies/codingstyle.html) and compile without
|
||||
warnings using the --strict-warnings flag. OpenSSL compiles on many varied
|
||||
platforms: try to ensure you only use portable features.
|
||||
|
||||
Our preferred format for patch files 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
|
||||
# [your changes]
|
||||
# ./Configure dist; make clean
|
||||
# cd ..
|
||||
# diff -ur openssl-orig openssl-work > mydiffs.patch
|
52
Configure
52
Configure
@@ -58,6 +58,10 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
|
||||
# library and will be loaded in run-time by the OpenSSL library.
|
||||
# sctp include SCTP support
|
||||
# 386 generate 80386 code
|
||||
# enable-weak-ssl-ciphers
|
||||
# Enable EXPORT and LOW SSLv3 ciphers that are disabled by
|
||||
# default. Note, weak SSLv2 ciphers are unconditionally
|
||||
# disabled.
|
||||
# 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
|
||||
@@ -124,6 +128,9 @@ my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initiali
|
||||
# -Wextended-offsetof
|
||||
my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
|
||||
|
||||
# Warn that "make depend" should be run?
|
||||
my $warn_make_depend = 0;
|
||||
|
||||
my $strict_warnings = 0;
|
||||
|
||||
my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
|
||||
@@ -416,6 +423,7 @@ my %table=(
|
||||
"linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-x86_64", "gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
"linux-x86_64-clang", "clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
"debug-linux-x86_64-clang", "clang: -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
"linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
"linux-x32", "gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
|
||||
"linux64-s390x", "gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
@@ -777,11 +785,13 @@ my %disabled = ( # "what" => "comment" [or special keyword "experimental
|
||||
"md2" => "default",
|
||||
"rc5" => "default",
|
||||
"rfc3779" => "default",
|
||||
"sctp" => "default",
|
||||
"sctp" => "default",
|
||||
"shared" => "default",
|
||||
"ssl-trace" => "default",
|
||||
"ssl2" => "default",
|
||||
"store" => "experimental",
|
||||
"unit-test" => "default",
|
||||
"weak-ssl-ciphers" => "default",
|
||||
"zlib" => "default",
|
||||
"zlib-dynamic" => "default"
|
||||
);
|
||||
@@ -1512,7 +1522,7 @@ if ($target =~ /\-icc$/) # Intel C compiler
|
||||
# linker only when --prefix is not /usr.
|
||||
if ($target =~ /^BSD\-/)
|
||||
{
|
||||
$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
|
||||
$shared_ldflag.=" -Wl,-rpath,\$\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
|
||||
}
|
||||
|
||||
if ($sys_id ne "")
|
||||
@@ -1646,21 +1656,22 @@ if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
|
||||
$shlib_minor=$2;
|
||||
}
|
||||
|
||||
my $ecc = $cc;
|
||||
$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
|
||||
|
||||
if ($strict_warnings)
|
||||
{
|
||||
my $ecc = $cc;
|
||||
$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
|
||||
my $wopt;
|
||||
die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/);
|
||||
foreach $wopt (split /\s+/, $gcc_devteam_warn)
|
||||
{
|
||||
$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
|
||||
$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
|
||||
}
|
||||
if ($ecc eq "clang")
|
||||
{
|
||||
foreach $wopt (split /\s+/, $clang_devteam_warn)
|
||||
{
|
||||
$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
|
||||
$cflags .= " $wopt" unless ($cflags =~ /(^|\s)$wopt(\s|$)/)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1713,6 +1724,7 @@ while (<IN>)
|
||||
s/^AR=\s*ar/AR= $ar/;
|
||||
s/^RANLIB=.*/RANLIB= $ranlib/;
|
||||
s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
|
||||
s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $ecc eq "gcc" || $ecc eq "clang";
|
||||
}
|
||||
s/^CFLAG=.*$/CFLAG= $cflags/;
|
||||
s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
|
||||
@@ -2025,14 +2037,8 @@ EOF
|
||||
&dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
|
||||
}
|
||||
if ($depflags ne $default_depflags && !$make_depend) {
|
||||
print <<EOF;
|
||||
|
||||
Since you've disabled or enabled at least one algorithm, you need to do
|
||||
the following before building:
|
||||
|
||||
make depend
|
||||
EOF
|
||||
}
|
||||
$warn_make_depend++;
|
||||
}
|
||||
}
|
||||
|
||||
# create the ms/version32.rc file if needed
|
||||
@@ -2111,12 +2117,18 @@ EOF
|
||||
|
||||
print <<\EOF if ($no_shared_warn);
|
||||
|
||||
You gave the option 'shared'. Normally, that would give you shared libraries.
|
||||
Unfortunately, the OpenSSL configuration doesn't include shared library support
|
||||
for this platform yet, so it will pretend you gave the option 'no-shared'. If
|
||||
you can inform the developpers (openssl-dev\@openssl.org) how to support shared
|
||||
libraries on this platform, they will at least look at it and try their best
|
||||
(but please first make sure you have tried with a current version of OpenSSL).
|
||||
You gave the option 'shared', which is not supported on this platform, so
|
||||
we will pretend you gave the option 'no-shared'. If you know how to implement
|
||||
shared libraries, please let us know (but please first make sure you have
|
||||
tried with a current version of OpenSSL).
|
||||
EOF
|
||||
|
||||
print <<EOF if ($warn_make_depend);
|
||||
|
||||
*** Because of configuration changes, you MUST do the following before
|
||||
*** building:
|
||||
|
||||
make depend
|
||||
EOF
|
||||
|
||||
exit(0);
|
||||
|
8
INSTALL
8
INSTALL
@@ -164,10 +164,10 @@
|
||||
standard headers). If it is a problem with OpenSSL itself, please
|
||||
report the problem to <openssl-bugs@openssl.org> (note that your
|
||||
message will be recorded in the request tracker publicly readable
|
||||
via http://www.openssl.org/support/rt.html and will be forwarded to a
|
||||
public mailing list). Include the output of "make report" in your message.
|
||||
Please check out the request tracker. Maybe the bug was already
|
||||
reported or has already been fixed.
|
||||
at https://www.openssl.org/community/index.html#bugs and will be
|
||||
forwarded to a public mailing list). Include the output of "make
|
||||
report" in your message. Please check out the request tracker. Maybe
|
||||
the bug was already reported or has already been fixed.
|
||||
|
||||
[If you encounter assembler error messages, try the "no-asm"
|
||||
configuration option as an immediate fix.]
|
||||
|
2
LICENSE
2
LICENSE
@@ -12,7 +12,7 @@
|
||||
---------------
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
49
Makefile.org
49
Makefile.org
@@ -180,8 +180,7 @@ SHARED_LDFLAGS=
|
||||
GENERAL= Makefile
|
||||
BASENAME= openssl
|
||||
NAME= $(BASENAME)-$(VERSION)
|
||||
TARFILE= $(NAME).tar
|
||||
WTARFILE= $(NAME)-win.tar
|
||||
TARFILE= ../$(NAME).tar
|
||||
EXHEADER= e_os2.h
|
||||
HEADER= e_os.h
|
||||
|
||||
@@ -203,7 +202,9 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
|
||||
$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
|
||||
$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
|
||||
|
||||
BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
|
||||
# LC_ALL=C ensures that error [and other] messages are delivered in
|
||||
# same language for uniform treatment.
|
||||
BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
|
||||
CC='$(CC)' CFLAG='$(CFLAG)' \
|
||||
AS='$(CC)' ASFLAG='$(CFLAG) -c' \
|
||||
AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
|
||||
@@ -497,35 +498,35 @@ TABLE: Configure
|
||||
# would occur. Therefore the list of files is temporarily stored into a file
|
||||
# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
|
||||
# tar does not support the --files-from option.
|
||||
tar:
|
||||
TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
|
||||
--owner 0 --group 0 \
|
||||
--transform 's|^|$(NAME)/|' \
|
||||
-cvf -
|
||||
|
||||
$(TARFILE).list:
|
||||
find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
|
||||
\! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \
|
||||
\( \! -name '*test' -o -name bctest -o -name pod2mantest \) \
|
||||
\! -name '.#*' \! -name '*~' \! -type l \
|
||||
| sort > $(TARFILE).list
|
||||
|
||||
tar: $(TARFILE).list
|
||||
find . -type d -print | xargs chmod 755
|
||||
find . -type f -print | xargs chmod a+r
|
||||
find . -type f -perm -0100 -print | xargs chmod a+x
|
||||
find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
|
||||
$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
|
||||
tardy --user_number=0 --user_name=openssl \
|
||||
--group_number=0 --group_name=openssl \
|
||||
--prefix=openssl-$(VERSION) - |\
|
||||
gzip --best >../$(TARFILE).gz; \
|
||||
rm -f ../$(TARFILE).list; \
|
||||
ls -l ../$(TARFILE).gz
|
||||
$(TAR_COMMAND) | gzip --best > $(TARFILE).gz
|
||||
rm -f $(TARFILE).list
|
||||
ls -l $(TARFILE).gz
|
||||
|
||||
tar-snap:
|
||||
@$(TAR) $(TARFLAGS) -cvf - \
|
||||
`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
|
||||
tardy --user_number=0 --user_name=openssl \
|
||||
--group_number=0 --group_name=openssl \
|
||||
--prefix=openssl-$(VERSION) - > ../$(TARFILE);\
|
||||
ls -l ../$(TARFILE)
|
||||
tar-snap: $(TARFILE).list
|
||||
$(TAR_COMMAND) > $(TARFILE)
|
||||
rm -f $(TARFILE).list
|
||||
ls -l $(TARFILE)
|
||||
|
||||
dist:
|
||||
$(PERL) Configure dist
|
||||
@$(MAKE) dist_pem_h
|
||||
@$(MAKE) SDIRS='$(SDIRS)' clean
|
||||
@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
|
||||
|
||||
dist_pem_h:
|
||||
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
|
||||
@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
|
||||
|
||||
install: all install_docs install_sw
|
||||
|
||||
|
@@ -272,7 +272,7 @@ link_o.cygwin:
|
||||
SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-Bsymbolic"; \
|
||||
$(LINK_SO_O)
|
||||
#for mingw target if def-file is in use dll-name should match library-name
|
||||
link_a.cygwin:
|
||||
@@ -289,7 +289,7 @@ link_a.cygwin:
|
||||
SHLIB_SOVER=32; \
|
||||
extras="$(LIBNAME).def"; \
|
||||
$(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
|
||||
base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
|
||||
base=; [ $(LIBNAME) = "crypto" -a -n "$(FIPSCANLIB)" ] && base=-Wl,--image-base,0x63000000; \
|
||||
fi; \
|
||||
dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
|
||||
$(PERL) util/mkrc.pl $$dll_name | \
|
||||
@@ -297,7 +297,7 @@ link_a.cygwin:
|
||||
extras="$$extras rc.o"; \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
|
||||
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
|
||||
[ -f apps/$$dll_name ] && rm apps/$$dll_name; \
|
||||
[ -f test/$$dll_name ] && rm test/$$dll_name; \
|
||||
$(LINK_SO_A) || exit 1; \
|
||||
|
28
NEWS
28
NEWS
@@ -5,9 +5,37 @@
|
||||
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.2f and OpenSSL 1.0.2g [1 Mar 2016]
|
||||
|
||||
o Disable weak ciphers in SSLv3 and up in default builds of OpenSSL.
|
||||
o Disable SSLv2 default build, default negotiation and weak ciphers
|
||||
(CVE-2016-0800)
|
||||
o Fix a double-free in DSA code (CVE-2016-0705)
|
||||
o Disable SRP fake user seed to address a server memory leak
|
||||
(CVE-2016-0798)
|
||||
o Fix BN_hex2bn/BN_dec2bn NULL pointer deref/heap corruption
|
||||
(CVE-2016-0797)
|
||||
o Fix memory issues in BIO_*printf functions (CVE-2016-0799)
|
||||
o Fix side channel attack on modular exponentiation (CVE-2016-0702)
|
||||
|
||||
Major changes between OpenSSL 1.0.2e and OpenSSL 1.0.2f [28 Jan 2016]
|
||||
|
||||
o DH small subgroups (CVE-2016-0701)
|
||||
o SSLv2 doesn't block disabled ciphers (CVE-2015-3197)
|
||||
|
||||
Major changes between OpenSSL 1.0.2d and OpenSSL 1.0.2e [3 Dec 2015]
|
||||
|
||||
o BN_mod_exp may produce incorrect results on x86_64 (CVE-2015-3193)
|
||||
o Certificate verify crash with missing PSS parameter (CVE-2015-3194)
|
||||
o X509_ATTRIBUTE memory leak (CVE-2015-3195)
|
||||
o Rewrite EVP_DecodeUpdate (base64 decoding) to fix several bugs
|
||||
o In DSA_generate_parameters_ex, if the provided seed is too short,
|
||||
return an error
|
||||
|
||||
Major changes between OpenSSL 1.0.2c and OpenSSL 1.0.2d [9 Jul 2015]
|
||||
|
||||
o Alternate chains certificate forgery (CVE-2015-1793)
|
||||
o Race condition handling PSK identify hint (CVE-2015-3196)
|
||||
|
||||
Major changes between OpenSSL 1.0.2b and OpenSSL 1.0.2c [12 Jun 2015]
|
||||
|
||||
|
177
README
177
README
@@ -1,7 +1,7 @@
|
||||
|
||||
OpenSSL 1.0.2d 9 Jul 2015
|
||||
OpenSSL 1.0.2g 1 Mar 2016
|
||||
|
||||
Copyright (c) 1998-2011 The OpenSSL Project
|
||||
Copyright (c) 1998-2015 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
All rights reserved.
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
|
||||
The OpenSSL Project is a collaborative effort to develop a robust,
|
||||
commercial-grade, fully featured, and Open Source toolkit implementing the
|
||||
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
|
||||
protocols as well as a full-strength general purpose cryptography library.
|
||||
The project is managed by a worldwide community of volunteers that use the
|
||||
Internet to communicate, plan, and develop the OpenSSL toolkit and its
|
||||
related documentation.
|
||||
Secure Sockets Layer (SSLv3) and Transport Layer Security (TLS) protocols as
|
||||
well as a full-strength general purpose cryptograpic library. The project is
|
||||
managed by a worldwide community of volunteers that use the Internet to
|
||||
communicate, plan, and develop the OpenSSL toolkit and its related
|
||||
documentation.
|
||||
|
||||
OpenSSL is based on the excellent SSLeay library developed from Eric A. Young
|
||||
OpenSSL is descended from the SSLeay library developed by Eric A. Young
|
||||
and Tim J. Hudson. The OpenSSL toolkit is licensed under a dual-license (the
|
||||
OpenSSL license plus the SSLeay license) situation, which basically means
|
||||
that you are free to get and use it for commercial and non-commercial
|
||||
purposes as long as you fulfill the conditions of both licenses.
|
||||
OpenSSL license plus the SSLeay license), which means that you are free to
|
||||
get and use it for commercial and non-commercial purposes as long as you
|
||||
fulfill the conditions of both licenses.
|
||||
|
||||
OVERVIEW
|
||||
--------
|
||||
@@ -28,90 +28,39 @@
|
||||
The OpenSSL toolkit includes:
|
||||
|
||||
libssl.a:
|
||||
Implementation of SSLv2, SSLv3, TLSv1 and the required code to support
|
||||
both SSLv2, SSLv3 and TLSv1 in the one server and client.
|
||||
Provides the client and server-side implementations for SSLv3 and TLS.
|
||||
|
||||
libcrypto.a:
|
||||
General encryption and X.509 v1/v3 stuff needed by SSL/TLS but not
|
||||
actually logically part of it. It includes routines for the following:
|
||||
|
||||
Ciphers
|
||||
libdes - EAY's libdes DES encryption package which was floating
|
||||
around the net for a few years, and was then relicensed by
|
||||
him as part of SSLeay. It includes 15 'modes/variations'
|
||||
of DES (1, 2 and 3 key versions of ecb, cbc, cfb and ofb;
|
||||
pcbc and a more general form of cfb and ofb) including desx
|
||||
in cbc mode, a fast crypt(3), and routines to read
|
||||
passwords from the keyboard.
|
||||
RC4 encryption,
|
||||
RC2 encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
Blowfish encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
IDEA encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
|
||||
Digests
|
||||
MD5 and MD2 message digest algorithms, fast implementations,
|
||||
SHA (SHA-0) and SHA-1 message digest algorithms,
|
||||
MDC2 message digest. A DES based hash that is popular on smart cards.
|
||||
|
||||
Public Key
|
||||
RSA encryption/decryption/generation.
|
||||
There is no limit on the number of bits.
|
||||
DSA encryption/decryption/generation.
|
||||
There is no limit on the number of bits.
|
||||
Diffie-Hellman key-exchange/key generation.
|
||||
There is no limit on the number of bits.
|
||||
|
||||
X.509v3 certificates
|
||||
X509 encoding/decoding into/from binary ASN1 and a PEM
|
||||
based ASCII-binary encoding which supports encryption with a
|
||||
private key. Program to generate RSA and DSA certificate
|
||||
requests and to generate RSA and DSA certificates.
|
||||
|
||||
Systems
|
||||
The normal digital envelope routines and base64 encoding. Higher
|
||||
level access to ciphers and digests by name. New ciphers can be
|
||||
loaded at run time. The BIO io system which is a simple non-blocking
|
||||
IO abstraction. Current methods supported are file descriptors,
|
||||
sockets, socket accept, socket connect, memory buffer, buffering, SSL
|
||||
client/server, file pointer, encryption, digest, non-blocking testing
|
||||
and null.
|
||||
|
||||
Data structures
|
||||
A dynamically growing hashing system
|
||||
A simple stack.
|
||||
A Configuration loader that uses a format similar to MS .ini files.
|
||||
Provides general cryptographic and X.509 support needed by SSL/TLS but
|
||||
not logically part of it.
|
||||
|
||||
openssl:
|
||||
A command line tool that can be used for:
|
||||
Creation of RSA, DH and DSA key parameters
|
||||
Creation of key parameters
|
||||
Creation of X.509 certificates, CSRs and CRLs
|
||||
Calculation of Message Digests
|
||||
Encryption and Decryption with Ciphers
|
||||
SSL/TLS Client and Server Tests
|
||||
Calculation of message digests
|
||||
Encryption and decryption
|
||||
SSL/TLS client and server tests
|
||||
Handling of S/MIME signed or encrypted mail
|
||||
And more...
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
To install this package under a Unix derivative, read the INSTALL file. For
|
||||
a Win32 platform, read the INSTALL.W32 file. For OpenVMS systems, read
|
||||
INSTALL.VMS.
|
||||
|
||||
Read the documentation in the doc/ directory. It is quite rough, but it
|
||||
lists the functions; you will probably have to look at the code to work out
|
||||
how to use them. Look at the example programs.
|
||||
|
||||
PROBLEMS
|
||||
--------
|
||||
|
||||
For some platforms, there are some known problems that may affect the user
|
||||
or application author. We try to collect those in doc/PROBLEMS, with current
|
||||
thoughts on how they should be solved in a future of OpenSSL.
|
||||
See the appropriate file:
|
||||
INSTALL Linux, Unix, etc.
|
||||
INSTALL.DJGPP DOS platform with DJGPP
|
||||
INSTALL.NW Netware
|
||||
INSTALL.OS2 OS/2
|
||||
INSTALL.VMS VMS
|
||||
INSTALL.W32 Windows (32bit)
|
||||
INSTALL.W64 Windows (64bit)
|
||||
INSTALL.WCE Windows CE
|
||||
|
||||
SUPPORT
|
||||
-------
|
||||
|
||||
See the OpenSSL website www.openssl.org for details of how to obtain
|
||||
See the OpenSSL website www.openssl.org for details on how to obtain
|
||||
commercial technical support.
|
||||
|
||||
If you have any problems with OpenSSL then please take the following steps
|
||||
@@ -137,56 +86,34 @@
|
||||
|
||||
Email the report to:
|
||||
|
||||
openssl-bugs@openssl.org
|
||||
rt@openssl.org
|
||||
|
||||
Note that the request tracker should NOT be used 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.
|
||||
In order to avoid spam, this is a moderated mailing list, and it might
|
||||
take a day for the ticket to show up. (We also scan posts to make sure
|
||||
that security disclosures aren't publically 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).
|
||||
|
||||
Note that mail to openssl-bugs@openssl.org is recorded in the public
|
||||
request tracker database (see https://www.openssl.org/support/rt.html
|
||||
for details) and also forwarded to a public 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.
|
||||
|
||||
You can also make GitHub pull requests. If you do this, please also send
|
||||
mail to rt@openssl.org with a link to the PR so that we can more easily
|
||||
keep track of it.
|
||||
|
||||
HOW TO CONTRIBUTE TO OpenSSL
|
||||
----------------------------
|
||||
|
||||
Development is coordinated on the openssl-dev mailing list (see
|
||||
http://www.openssl.org for information on subscribing). If you
|
||||
would like to submit a patch, send it to openssl-bugs@openssl.org with
|
||||
the string "[PATCH]" in the subject. Please be sure to include a
|
||||
textual explanation of what your patch does.
|
||||
See CONTRIBUTING
|
||||
|
||||
If you are unsure as to whether a feature will be useful for the general
|
||||
OpenSSL community please 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.
|
||||
|
||||
Patches should be as up to date as possible, preferably relative to the
|
||||
current Git or the last snapshot. They should follow the coding style of
|
||||
OpenSSL and compile without warnings. Some of the core team developer targets
|
||||
can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL
|
||||
compiles on many varied platforms: try to ensure you only use portable
|
||||
features.
|
||||
|
||||
Note: For legal reasons, contributions from the US can be accepted only
|
||||
if a TSU notification and a copy of the patch are sent to crypt@bis.doc.gov
|
||||
(formerly BXA) with a copy to the ENC Encryption Request Coordinator;
|
||||
please take some time to look at
|
||||
http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic]
|
||||
and
|
||||
http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e))
|
||||
for the details. If "your encryption source code is too large to serve as
|
||||
an email attachment", they are glad to receive it by fax instead; hope you
|
||||
have a cheap long-distance plan.
|
||||
|
||||
Our preferred format for changes is "diff -u" output. You might
|
||||
generate it like this:
|
||||
|
||||
# cd openssl-work
|
||||
# [your changes]
|
||||
# ./Configure dist; make clean
|
||||
# cd ..
|
||||
# diff -ur openssl-orig openssl-work > mydiffs.patch
|
||||
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.
|
||||
|
@@ -1,8 +0,0 @@
|
||||
openssl
|
||||
Makefile.save
|
||||
der_chop
|
||||
der_chop.bak
|
||||
CA.pl
|
||||
*.flc
|
||||
semantic.cache
|
||||
*.dll
|
@@ -135,7 +135,7 @@ update: openssl-vms.cnf local_depend
|
||||
depend: local_depend
|
||||
@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
|
||||
local_depend:
|
||||
@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \
|
||||
@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
|
@@ -124,10 +124,7 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
|
||||
char buffer[200];
|
||||
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
BIO_printf(bio_e, "Loading 'screen' into random state -");
|
||||
BIO_flush(bio_e);
|
||||
RAND_screen();
|
||||
BIO_printf(bio_e, " done\n");
|
||||
#endif
|
||||
|
||||
if (file == NULL)
|
||||
|
17
apps/apps.c
17
apps/apps.c
@@ -119,9 +119,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYSNAME_WINCE) && !defined(NETWARE_CLIB)
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
@@ -1352,7 +1349,11 @@ int set_name_ex(unsigned long *flags, const char *arg)
|
||||
{"ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
return set_multi_opts(flags, arg, ex_tbl);
|
||||
if (set_multi_opts(flags, arg, ex_tbl) == 0)
|
||||
return 0;
|
||||
if ((*flags & XN_FLAG_SEP_MASK) == 0)
|
||||
*flags |= XN_FLAG_SEP_CPLUS_SPC;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int set_ext_copy(int *copy_type, const char *arg)
|
||||
@@ -2441,7 +2442,11 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in)
|
||||
else
|
||||
len = 1024;
|
||||
len = BIO_read(in, tbuf, len);
|
||||
if (len <= 0)
|
||||
if (len < 0) {
|
||||
BIO_free(mem);
|
||||
return -1;
|
||||
}
|
||||
if (len == 0)
|
||||
break;
|
||||
if (BIO_write(mem, tbuf, len) != len) {
|
||||
BIO_free(mem);
|
||||
@@ -2458,7 +2463,7 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value)
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)
|
||||
{
|
||||
int rv;
|
||||
char *stmp, *vtmp = NULL;
|
||||
|
@@ -321,7 +321,7 @@ int args_verify(char ***pargs, int *pargc,
|
||||
int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
|
||||
void policies_print(BIO *out, X509_STORE_CTX *ctx);
|
||||
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
|
||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value);
|
||||
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
|
||||
const char *algname, ENGINE *e, int do_param);
|
||||
int do_X509_sign(BIO *err, X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
||||
|
@@ -313,9 +313,9 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
typ = ASN1_TYPE_get(at);
|
||||
if ((typ == V_ASN1_OBJECT)
|
||||
|| (typ == V_ASN1_BOOLEAN)
|
||||
|| (typ == V_ASN1_NULL)) {
|
||||
BIO_printf(bio_err, "Can't parse %s type\n",
|
||||
typ == V_ASN1_NULL ? "NULL" : "OBJECT");
|
||||
BIO_printf(bio_err, "Can't parse %s type\n", ASN1_tag2str(typ));
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
14
apps/ca.c
14
apps/ca.c
@@ -99,25 +99,19 @@
|
||||
#undef PROG
|
||||
#define PROG ca_main
|
||||
|
||||
#define BASE_SECTION "ca"
|
||||
#define CONFIG_FILE "openssl.cnf"
|
||||
#define BASE_SECTION "ca"
|
||||
#define CONFIG_FILE "openssl.cnf"
|
||||
|
||||
#define ENV_DEFAULT_CA "default_ca"
|
||||
|
||||
#define STRING_MASK "string_mask"
|
||||
#define STRING_MASK "string_mask"
|
||||
#define UTF8_IN "utf8"
|
||||
|
||||
#define ENV_DIR "dir"
|
||||
#define ENV_CERTS "certs"
|
||||
#define ENV_CRL_DIR "crl_dir"
|
||||
#define ENV_CA_DB "CA_DB"
|
||||
#define ENV_NEW_CERTS_DIR "new_certs_dir"
|
||||
#define ENV_CERTIFICATE "certificate"
|
||||
#define ENV_SERIAL "serial"
|
||||
#define ENV_CRLNUMBER "crlnumber"
|
||||
#define ENV_CRL "crl"
|
||||
#define ENV_PRIVATE_KEY "private_key"
|
||||
#define ENV_RANDFILE "RANDFILE"
|
||||
#define ENV_DEFAULT_DAYS "default_days"
|
||||
#define ENV_DEFAULT_STARTDATE "default_startdate"
|
||||
#define ENV_DEFAULT_ENDDATE "default_enddate"
|
||||
@@ -2538,6 +2532,8 @@ static int do_updatedb(CA_DB *db)
|
||||
char **rrow, *a_tm_s;
|
||||
|
||||
a_tm = ASN1_UTCTIME_new();
|
||||
if (a_tm == NULL)
|
||||
return -1;
|
||||
|
||||
/* get actual time and make a string */
|
||||
a_tm = X509_gmtime_adj(a_tm, 0);
|
||||
|
@@ -416,14 +416,13 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (check) {
|
||||
if (group == NULL)
|
||||
BIO_printf(bio_err, "no elliptic curve parameters\n");
|
||||
BIO_printf(bio_err, "checking elliptic curve parameters: ");
|
||||
if (!EC_GROUP_check(group, NULL)) {
|
||||
BIO_printf(bio_err, "failed\n");
|
||||
ERR_print_errors(bio_err);
|
||||
} else
|
||||
BIO_printf(bio_err, "ok\n");
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(bio_err, "ok\n");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* apps/engine.c -*- mode: C; c-file-style: "eay" -*- */
|
||||
/* apps/engine.c */
|
||||
/*
|
||||
* Written by Richard Levitte <richard@levitte.org> for the OpenSSL project
|
||||
* 2000.
|
||||
@@ -99,8 +99,6 @@ static void identity(char *ptr)
|
||||
|
||||
static int append_buf(char **buf, const char *s, int *size, int step)
|
||||
{
|
||||
int l = strlen(s);
|
||||
|
||||
if (*buf == NULL) {
|
||||
*size = step;
|
||||
*buf = OPENSSL_malloc(*size);
|
||||
@@ -109,9 +107,6 @@ static int append_buf(char **buf, const char *s, int *size, int step)
|
||||
**buf = '\0';
|
||||
}
|
||||
|
||||
if (**buf != '\0')
|
||||
l += 2; /* ", " */
|
||||
|
||||
if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
|
||||
*size += step;
|
||||
*buf = OPENSSL_realloc(*buf, *size);
|
||||
|
@@ -1041,7 +1041,7 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req,
|
||||
bs = OCSP_BASICRESP_new();
|
||||
thisupd = X509_gmtime_adj(NULL, 0);
|
||||
if (ndays != -1)
|
||||
nextupd = X509_gmtime_adj(NULL, nmin * 60 + ndays * 3600 * 24);
|
||||
nextupd = X509_time_adj_ex(NULL, ndays, nmin * 60, NULL);
|
||||
|
||||
/* Examine each certificate id in the request */
|
||||
for (i = 0; i < id_count; i++) {
|
||||
@@ -1261,8 +1261,8 @@ static OCSP_RESPONSE *query_responder(BIO *err, BIO *cbio, const char *path,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (BIO_get_fd(cbio, &fd) <= 0) {
|
||||
BIO_puts(err, "Can't get connection fd\n");
|
||||
if (BIO_get_fd(cbio, &fd) < 0) {
|
||||
BIO_puts(bio_err, "Can't get connection fd\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@@ -79,7 +79,8 @@ const EVP_CIPHER *enc;
|
||||
# define CLCERTS 0x8
|
||||
# define CACERTS 0x10
|
||||
|
||||
int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain);
|
||||
static int get_cert_chain(X509 *cert, X509_STORE *store,
|
||||
STACK_OF(X509) **chain);
|
||||
int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen,
|
||||
int options, char *pempass);
|
||||
int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags,
|
||||
@@ -134,13 +135,6 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
apps_startup();
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
if (FIPS_mode())
|
||||
cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
else
|
||||
# endif
|
||||
cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
|
||||
|
||||
enc = EVP_des_ede3_cbc();
|
||||
if (bio_err == NULL)
|
||||
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
@@ -148,6 +142,13 @@ int MAIN(int argc, char **argv)
|
||||
if (!load_config(bio_err, NULL))
|
||||
goto end;
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
if (FIPS_mode())
|
||||
cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
|
||||
else
|
||||
# endif
|
||||
cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
|
||||
|
||||
args = argv + 1;
|
||||
|
||||
while (*args) {
|
||||
@@ -594,7 +595,7 @@ int MAIN(int argc, char **argv)
|
||||
vret = get_cert_chain(ucert, store, &chain2);
|
||||
X509_STORE_free(store);
|
||||
|
||||
if (!vret) {
|
||||
if (vret == X509_V_OK) {
|
||||
/* Exclude verified certificate */
|
||||
for (i = 1; i < sk_X509_num(chain2); i++)
|
||||
sk_X509_push(certs, sk_X509_value(chain2, i));
|
||||
@@ -602,7 +603,7 @@ int MAIN(int argc, char **argv)
|
||||
X509_free(sk_X509_value(chain2, 0));
|
||||
sk_X509_free(chain2);
|
||||
} else {
|
||||
if (vret >= 0)
|
||||
if (vret != X509_V_ERR_UNSPECIFIED)
|
||||
BIO_printf(bio_err, "Error %s getting chain.\n",
|
||||
X509_verify_cert_error_string(vret));
|
||||
else
|
||||
@@ -906,36 +907,25 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
|
||||
|
||||
/* Given a single certificate return a verified chain or NULL if error */
|
||||
|
||||
/* Hope this is OK .... */
|
||||
|
||||
int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain)
|
||||
static int get_cert_chain(X509 *cert, X509_STORE *store,
|
||||
STACK_OF(X509) **chain)
|
||||
{
|
||||
X509_STORE_CTX store_ctx;
|
||||
STACK_OF(X509) *chn;
|
||||
STACK_OF(X509) *chn = NULL;
|
||||
int i = 0;
|
||||
|
||||
/*
|
||||
* FIXME: Should really check the return status of X509_STORE_CTX_init
|
||||
* for an error, but how that fits into the return value of this function
|
||||
* is less obvious.
|
||||
*/
|
||||
X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
|
||||
if (X509_verify_cert(&store_ctx) <= 0) {
|
||||
i = X509_STORE_CTX_get_error(&store_ctx);
|
||||
if (i == 0)
|
||||
/*
|
||||
* avoid returning 0 if X509_verify_cert() did not set an
|
||||
* appropriate error value in the context
|
||||
*/
|
||||
i = -1;
|
||||
chn = NULL;
|
||||
goto err;
|
||||
} else
|
||||
if (!X509_STORE_CTX_init(&store_ctx, store, cert, NULL)) {
|
||||
*chain = NULL;
|
||||
return X509_V_ERR_UNSPECIFIED;
|
||||
}
|
||||
|
||||
if (X509_verify_cert(&store_ctx) > 0)
|
||||
chn = X509_STORE_CTX_get1_chain(&store_ctx);
|
||||
err:
|
||||
else if ((i = X509_STORE_CTX_get_error(&store_ctx)) == 0)
|
||||
i = X509_V_ERR_UNSPECIFIED;
|
||||
|
||||
X509_STORE_CTX_cleanup(&store_ctx);
|
||||
*chain = chn;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
120
apps/pkeyutl.c
120
apps/pkeyutl.c
@@ -73,11 +73,12 @@ static void usage(void);
|
||||
#define PROG pkeyutl_main
|
||||
|
||||
static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e);
|
||||
const char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e,
|
||||
int impl);
|
||||
|
||||
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
|
||||
const char *file);
|
||||
const char *file, ENGINE* e);
|
||||
|
||||
static int do_keyop(EVP_PKEY_CTX *ctx, int pkey_op,
|
||||
unsigned char *out, size_t *poutlen,
|
||||
@@ -97,10 +98,13 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
char *passargin = NULL;
|
||||
int keysize = -1;
|
||||
|
||||
int engine_impl = 0;
|
||||
unsigned char *buf_in = NULL, *buf_out = NULL, *sig = NULL;
|
||||
size_t buf_outlen;
|
||||
size_t buf_outlen = 0;
|
||||
int buf_inlen = 0, siglen = -1;
|
||||
const char *inkey = NULL;
|
||||
const char *peerkey = NULL;
|
||||
STACK_OF(OPENSSL_STRING) *pkeyopts = NULL;
|
||||
|
||||
int ret = 1, rv = -1;
|
||||
|
||||
@@ -134,21 +138,13 @@ int MAIN(int argc, char **argv)
|
||||
} else if (!strcmp(*argv, "-inkey")) {
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else {
|
||||
ctx = init_ctx(&keysize,
|
||||
*(++argv), keyform, key_type,
|
||||
passargin, pkey_op, e);
|
||||
if (!ctx) {
|
||||
BIO_puts(bio_err, "Error initializing context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
badarg = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
inkey = *++argv;
|
||||
} else if (!strcmp(*argv, "-peerkey")) {
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else if (!setup_peer(bio_err, ctx, peerform, *(++argv)))
|
||||
badarg = 1;
|
||||
else
|
||||
peerkey = *++argv;
|
||||
} else if (!strcmp(*argv, "-passin")) {
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
@@ -171,6 +167,8 @@ int MAIN(int argc, char **argv)
|
||||
badarg = 1;
|
||||
else
|
||||
e = setup_engine(bio_err, *(++argv), 0);
|
||||
} else if (!strcmp(*argv, "-engine_impl")) {
|
||||
engine_impl = 1;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(*argv, "-pubin"))
|
||||
@@ -187,23 +185,21 @@ int MAIN(int argc, char **argv)
|
||||
pkey_op = EVP_PKEY_OP_VERIFY;
|
||||
else if (!strcmp(*argv, "-verifyrecover"))
|
||||
pkey_op = EVP_PKEY_OP_VERIFYRECOVER;
|
||||
else if (!strcmp(*argv, "-rev"))
|
||||
rev = 1;
|
||||
else if (!strcmp(*argv, "-encrypt"))
|
||||
pkey_op = EVP_PKEY_OP_ENCRYPT;
|
||||
else if (!strcmp(*argv, "-decrypt"))
|
||||
pkey_op = EVP_PKEY_OP_DECRYPT;
|
||||
else if (!strcmp(*argv, "-derive"))
|
||||
pkey_op = EVP_PKEY_OP_DERIVE;
|
||||
else if (!strcmp(*argv, "-rev"))
|
||||
rev = 1;
|
||||
else if (strcmp(*argv, "-pkeyopt") == 0) {
|
||||
if (--argc < 1)
|
||||
badarg = 1;
|
||||
else if (!ctx) {
|
||||
BIO_puts(bio_err, "-pkeyopt command before -inkey\n");
|
||||
badarg = 1;
|
||||
} else if (pkey_ctrl_string(ctx, *(++argv)) <= 0) {
|
||||
BIO_puts(bio_err, "parameter setting error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
else if ((pkeyopts == NULL &&
|
||||
(pkeyopts = sk_OPENSSL_STRING_new_null()) == NULL) ||
|
||||
sk_OPENSSL_STRING_push(pkeyopts, *++argv) == 0) {
|
||||
BIO_puts(bio_err, "out of memory\n");
|
||||
goto end;
|
||||
}
|
||||
} else
|
||||
@@ -216,10 +212,37 @@ int MAIN(int argc, char **argv)
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!ctx) {
|
||||
if (inkey == NULL ||
|
||||
(peerkey != NULL && pkey_op != EVP_PKEY_OP_DERIVE)) {
|
||||
usage();
|
||||
goto end;
|
||||
}
|
||||
ctx = init_ctx(&keysize, inkey, keyform, key_type,
|
||||
passargin, pkey_op, e, engine_impl);
|
||||
if (!ctx) {
|
||||
BIO_puts(bio_err, "Error initializing context\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (peerkey != NULL && !setup_peer(bio_err, ctx, peerform, peerkey, e)) {
|
||||
BIO_puts(bio_err, "Error setting up peer key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (pkeyopts != NULL) {
|
||||
int num = sk_OPENSSL_STRING_num(pkeyopts);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num; ++i) {
|
||||
const char *opt = sk_OPENSSL_STRING_value(pkeyopts, i);
|
||||
|
||||
if (pkey_ctrl_string(ctx, opt) <= 0) {
|
||||
BIO_puts(bio_err, "parameter setting error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sigfile && (pkey_op != EVP_PKEY_OP_VERIFY)) {
|
||||
BIO_puts(bio_err, "Signature file specified for non verify\n");
|
||||
@@ -269,7 +292,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
siglen = bio_to_mem(&sig, keysize * 10, sigbio);
|
||||
BIO_free(sigbio);
|
||||
if (siglen <= 0) {
|
||||
if (siglen < 0) {
|
||||
BIO_printf(bio_err, "Error reading signature data\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -278,7 +301,7 @@ int MAIN(int argc, char **argv)
|
||||
if (in) {
|
||||
/* Read the input data */
|
||||
buf_inlen = bio_to_mem(&buf_in, keysize * 10, in);
|
||||
if (buf_inlen <= 0) {
|
||||
if (buf_inlen < 0) {
|
||||
BIO_printf(bio_err, "Error reading input Data\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -306,7 +329,7 @@ int MAIN(int argc, char **argv)
|
||||
} else {
|
||||
rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen,
|
||||
buf_in, (size_t)buf_inlen);
|
||||
if (rv > 0) {
|
||||
if (rv > 0 && buf_outlen != 0) {
|
||||
buf_out = OPENSSL_malloc(buf_outlen);
|
||||
if (!buf_out)
|
||||
rv = -1;
|
||||
@@ -336,12 +359,14 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (buf_in)
|
||||
if (buf_in != NULL)
|
||||
OPENSSL_free(buf_in);
|
||||
if (buf_out)
|
||||
if (buf_out != NULL)
|
||||
OPENSSL_free(buf_out);
|
||||
if (sig)
|
||||
if (sig != NULL)
|
||||
OPENSSL_free(sig);
|
||||
if (pkeyopts != NULL)
|
||||
sk_OPENSSL_STRING_free(pkeyopts);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -368,18 +393,21 @@ static void usage()
|
||||
BIO_printf(bio_err, "-hexdump hex dump output\n");
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
BIO_printf(bio_err,
|
||||
"-engine e use engine e, possibly a hardware device.\n");
|
||||
"-engine e use engine e, maybe a hardware device, for loading keys.\n");
|
||||
BIO_printf(bio_err, "-engine_impl also use engine given by -engine for crypto operations\n");
|
||||
#endif
|
||||
BIO_printf(bio_err, "-passin arg pass phrase source\n");
|
||||
|
||||
}
|
||||
|
||||
static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e)
|
||||
const char *keyfile, int keyform, int key_type,
|
||||
char *passargin, int pkey_op, ENGINE *e,
|
||||
int engine_impl)
|
||||
{
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
ENGINE *impl = NULL;
|
||||
char *passin = NULL;
|
||||
int rv = -1;
|
||||
X509 *x;
|
||||
@@ -418,9 +446,14 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
|
||||
if (!pkey)
|
||||
goto end;
|
||||
|
||||
ctx = EVP_PKEY_CTX_new(pkey, e);
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
if (engine_impl)
|
||||
impl = e;
|
||||
#endif
|
||||
|
||||
ctx = EVP_PKEY_CTX_new(pkey, impl);
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
|
||||
if (!ctx)
|
||||
@@ -467,16 +500,15 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize,
|
||||
}
|
||||
|
||||
static int setup_peer(BIO *err, EVP_PKEY_CTX *ctx, int peerform,
|
||||
const char *file)
|
||||
const char *file, ENGINE* e)
|
||||
{
|
||||
EVP_PKEY *peer = NULL;
|
||||
ENGINE* engine = NULL;
|
||||
int ret;
|
||||
if (!ctx) {
|
||||
BIO_puts(err, "-peerkey command before -inkey\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
peer = load_pubkey(bio_err, file, peerform, 0, NULL, NULL, "Peer Key");
|
||||
if (peerform == FORMAT_ENGINE)
|
||||
engine = e;
|
||||
peer = load_pubkey(bio_err, file, peerform, 0, NULL, engine, "Peer Key");
|
||||
|
||||
if (!peer) {
|
||||
BIO_printf(bio_err, "Error reading peer key %s\n", file);
|
||||
|
@@ -101,8 +101,8 @@
|
||||
#define STRING_MASK "string_mask"
|
||||
#define UTF8_IN "utf8"
|
||||
|
||||
#define DEFAULT_KEY_LENGTH 512
|
||||
#define MIN_KEY_LENGTH 384
|
||||
#define DEFAULT_KEY_LENGTH 2048
|
||||
#define MIN_KEY_LENGTH 512
|
||||
|
||||
#undef PROG
|
||||
#define PROG req_main
|
||||
|
@@ -250,7 +250,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (outfile) {
|
||||
if (!(out = BIO_new_file(outfile, "wb"))) {
|
||||
BIO_printf(bio_err, "Error Reading Output File\n");
|
||||
BIO_printf(bio_err, "Error Writing Output File\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
/* Read the input data */
|
||||
rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
|
||||
if (rsa_inlen <= 0) {
|
||||
if (rsa_inlen < 0) {
|
||||
BIO_printf(bio_err, "Error reading input Data\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -311,7 +311,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
}
|
||||
|
||||
if (rsa_outlen <= 0) {
|
||||
if (rsa_outlen < 0) {
|
||||
BIO_printf(bio_err, "RSA operation error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
|
@@ -981,6 +981,11 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
|
||||
extname = "next protocol";
|
||||
break;
|
||||
#endif
|
||||
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
|
||||
case TLSEXT_TYPE_application_layer_protocol_negotiation:
|
||||
extname = "application layer protocol negotiation";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TLSEXT_TYPE_padding:
|
||||
extname = "TLS padding";
|
||||
|
@@ -308,7 +308,7 @@ static void sc_usage(void)
|
||||
" -connect host:port - who to connect to (default is %s:%s)\n",
|
||||
SSL_HOST_NAME, PORT_STR);
|
||||
BIO_printf(bio_err,
|
||||
" -verify_host host - check peer certificate matches \"host\"\n");
|
||||
" -verify_hostname host - check peer certificate matches \"host\"\n");
|
||||
BIO_printf(bio_err,
|
||||
" -verify_email email - check peer certificate matches \"email\"\n");
|
||||
BIO_printf(bio_err,
|
||||
@@ -390,8 +390,6 @@ static void sc_usage(void)
|
||||
" -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
|
||||
BIO_printf(bio_err,
|
||||
" -bugs - Switch on all SSL implementation bug workarounds\n");
|
||||
BIO_printf(bio_err,
|
||||
" -serverpref - Use server's cipher preferences (only SSLv2)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
|
||||
BIO_printf(bio_err,
|
||||
@@ -424,6 +422,14 @@ static void sc_usage(void)
|
||||
" -no_ticket - disable use of RFC4507bis session tickets\n");
|
||||
BIO_printf(bio_err,
|
||||
" -serverinfo types - send empty ClientHello extensions (comma-separated numbers)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -curves arg - Elliptic curves to advertise (colon-separated list)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -sigalgs arg - Signature algorithms to support (colon-separated list)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -client_sigalgs arg - Signature algorithms to support for client\n");
|
||||
BIO_printf(bio_err,
|
||||
" certificate authentication (colon-separated list)\n");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
BIO_printf(bio_err,
|
||||
@@ -2065,6 +2071,9 @@ int MAIN(int argc, char **argv)
|
||||
sk_X509_pop_free(chain, X509_free);
|
||||
if (pass)
|
||||
OPENSSL_free(pass);
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
OPENSSL_free(srp_arg.srppassin);
|
||||
#endif
|
||||
if (vpm)
|
||||
X509_VERIFY_PARAM_free(vpm);
|
||||
ssl_excert_free(exc);
|
||||
|
@@ -429,6 +429,8 @@ typedef struct srpsrvparm_st {
|
||||
static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
|
||||
{
|
||||
srpsrvparm *p = (srpsrvparm *) arg;
|
||||
int ret = SSL3_AL_FATAL;
|
||||
|
||||
if (p->login == NULL && p->user == NULL) {
|
||||
p->login = SSL_get_srp_username(s);
|
||||
BIO_printf(bio_err, "SRP username = \"%s\"\n", p->login);
|
||||
@@ -437,21 +439,25 @@ static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
|
||||
|
||||
if (p->user == NULL) {
|
||||
BIO_printf(bio_err, "User %s doesn't exist\n", p->login);
|
||||
return SSL3_AL_FATAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (SSL_set_srp_server_param
|
||||
(s, p->user->N, p->user->g, p->user->s, p->user->v,
|
||||
p->user->info) < 0) {
|
||||
*ad = SSL_AD_INTERNAL_ERROR;
|
||||
return SSL3_AL_FATAL;
|
||||
goto err;
|
||||
}
|
||||
BIO_printf(bio_err,
|
||||
"SRP parameters set: username = \"%s\" info=\"%s\" \n",
|
||||
p->login, p->user->info);
|
||||
/* need to check whether there are memory leaks */
|
||||
ret = SSL_ERROR_NONE;
|
||||
|
||||
err:
|
||||
SRP_user_pwd_free(p->user);
|
||||
p->user = NULL;
|
||||
p->login = NULL;
|
||||
return SSL_ERROR_NONE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -498,7 +504,7 @@ static void sv_usage(void)
|
||||
BIO_printf(bio_err,
|
||||
" -accept arg - port to accept on (default is %d)\n", PORT);
|
||||
BIO_printf(bio_err,
|
||||
" -verify_host host - check peer certificate matches \"host\"\n");
|
||||
" -verify_hostname host - check peer certificate matches \"host\"\n");
|
||||
BIO_printf(bio_err,
|
||||
" -verify_email email - check peer certificate matches \"email\"\n");
|
||||
BIO_printf(bio_err,
|
||||
@@ -652,6 +658,12 @@ static void sv_usage(void)
|
||||
" -no_ticket - disable use of RFC4507bis session tickets\n");
|
||||
BIO_printf(bio_err,
|
||||
" -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -sigalgs arg - Signature algorithms to support (colon-separated list)\n");
|
||||
BIO_printf(bio_err,
|
||||
" -client_sigalgs arg - Signature algorithms to support for client \n");
|
||||
BIO_printf(bio_err,
|
||||
" certificate authentication (colon-separated list)\n");
|
||||
# ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
BIO_printf(bio_err,
|
||||
" -nextprotoneg arg - set the advertised protocols for the NPN extension (comma-separated list)\n");
|
||||
@@ -2446,9 +2458,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
while (SSL_get_error(con, k) == SSL_ERROR_WANT_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP renego during write\n");
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
@@ -2502,9 +2515,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
while (SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP renego during read\n");
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
@@ -2599,9 +2613,10 @@ static int init_ssl_connection(SSL *con)
|
||||
while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP during accept %s\n",
|
||||
srp_callback_parm.login);
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
@@ -2843,9 +2858,10 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
&& SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP during accept %s\n",
|
||||
srp_callback_parm.login);
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
@@ -2881,6 +2897,22 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
goto err;
|
||||
} else {
|
||||
BIO_printf(bio_s_out, "read R BLOCK\n");
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
if (BIO_should_io_special(io)
|
||||
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP renego during read\n");
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
else
|
||||
BIO_printf(bio_s_out, "LOOKUP not successful\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#if defined(OPENSSL_SYS_NETWARE)
|
||||
delay(1000);
|
||||
#elif !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
|
||||
@@ -3211,6 +3243,22 @@ static int rev_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
if (BIO_should_io_special(io)
|
||||
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP renego during accept\n");
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
else
|
||||
BIO_printf(bio_s_out, "LOOKUP not successful\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
BIO_printf(bio_err, "CONNECTION ESTABLISHED\n");
|
||||
print_ssl_summary(bio_err, con);
|
||||
@@ -3224,6 +3272,22 @@ static int rev_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
goto err;
|
||||
} else {
|
||||
BIO_printf(bio_s_out, "read R BLOCK\n");
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
if (BIO_should_io_special(io)
|
||||
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
|
||||
BIO_printf(bio_s_out, "LOOKUP renego during read\n");
|
||||
SRP_user_pwd_free(srp_callback_parm.user);
|
||||
srp_callback_parm.user =
|
||||
SRP_VBASE_get1_by_user(srp_callback_parm.vb,
|
||||
srp_callback_parm.login);
|
||||
if (srp_callback_parm.user)
|
||||
BIO_printf(bio_s_out, "LOOKUP done %s\n",
|
||||
srp_callback_parm.user->info);
|
||||
else
|
||||
BIO_printf(bio_s_out, "LOOKUP not successful\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#if defined(OPENSSL_SYS_NETWARE)
|
||||
delay(1000);
|
||||
#elif !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* apps/speed.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* apps/speed.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@@ -1226,12 +1226,7 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext,
|
||||
if (X509_gmtime_adj(X509_get_notBefore(x), 0) == NULL)
|
||||
goto err;
|
||||
|
||||
/* Lets just make it 12:00am GMT, Jan 1 1970 */
|
||||
/* memcpy(x->cert_info->validity->notBefore,"700101120000Z",13); */
|
||||
/* 28 days to be certified */
|
||||
|
||||
if (X509_gmtime_adj(X509_get_notAfter(x), (long)60 * 60 * 24 * days) ==
|
||||
NULL)
|
||||
if (X509_time_adj_ex(X509_get_notAfter(x), days, 0, NULL) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!X509_set_pubkey(x, pkey))
|
||||
|
60
appveyor.yml
Normal file
60
appveyor.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- VSVER: 9
|
||||
- VSVER: 10
|
||||
- VSVER: 11
|
||||
- VSVER: 12
|
||||
- VSVER: 14
|
||||
|
||||
configuration:
|
||||
- plain
|
||||
- shared
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- platform: x64
|
||||
VSVER: 9
|
||||
- platform: x64
|
||||
VSVER: 10
|
||||
- platform: x64
|
||||
VSVER: 11
|
||||
|
||||
before_build:
|
||||
- ps: >-
|
||||
If ($env:Platform -Match "x86") {
|
||||
$env:VCVARS_PLATFORM="x86"
|
||||
$env:TARGET="VC-WIN32"
|
||||
$env:DO="do_ms"
|
||||
} Else {
|
||||
$env:VCVARS_PLATFORM="amd64"
|
||||
$env:TARGET="VC-WIN64A"
|
||||
$env:DO="do_win64a"
|
||||
}
|
||||
- ps: >-
|
||||
If ($env:Configuration -Like "*shared*") {
|
||||
$env:MAK="ntdll.mak"
|
||||
} Else {
|
||||
$env:MAK="nt.mak"
|
||||
}
|
||||
- ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
|
||||
- call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
|
||||
- perl Configure %TARGET% no-asm
|
||||
- call ms\%DO%
|
||||
|
||||
build_script:
|
||||
- nmake /f ms\%MAK%
|
||||
|
||||
test_script:
|
||||
- nmake /f ms\%MAK% test
|
||||
|
||||
notifications:
|
||||
- provider: Email
|
||||
to:
|
||||
- openssl-commits@openssl.org
|
||||
on_build_success: false
|
||||
on_build_failure: true
|
||||
on_build_status_changed: true
|
3
config
3
config
@@ -852,7 +852,8 @@ case "$GUESSOS" in
|
||||
# *-dgux) OUT="dgux" ;;
|
||||
mips-sony-newsos4) OUT="newsos4-gcc" ;;
|
||||
*-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
|
||||
*-*-cygwin) OUT="Cygwin" ;;
|
||||
i[3456]86-*-cygwin) OUT="Cygwin" ;;
|
||||
*-*-cygwin) OUT="Cygwin-${MACHINE}" ;;
|
||||
t3e-cray-unicosmk) OUT="cray-t3e" ;;
|
||||
j90-cray-unicos) OUT="cray-j90" ;;
|
||||
nsr-tandem-nsk) OUT="tandem-c89" ;;
|
||||
|
@@ -1,8 +0,0 @@
|
||||
lib
|
||||
buildinf.h
|
||||
opensslconf.h
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
||||
*cpuid.s
|
||||
uplink-cof.s
|
@@ -1,8 +0,0 @@
|
||||
lib
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
||||
aes-*.s
|
||||
aesni-*.s
|
||||
bsaes-*.s
|
||||
vpaes-*.s
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_cbc.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_cbc.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_cfb.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_core.c */
|
||||
/**
|
||||
* rijndael-alg-fst.c
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_ctr.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_ctr.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_ecb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_ecb.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_ige.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_ige.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_misc.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_misc.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_ofb.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* crypto/aes/aes_core.c */
|
||||
/**
|
||||
* rijndael-alg-fst.c
|
||||
*
|
||||
|
@@ -45,7 +45,7 @@
|
||||
# the undertaken effort was that it appeared that in tight IA-32
|
||||
# register window little-endian flavor could achieve slightly higher
|
||||
# Instruction Level Parallelism, and it indeed resulted in up to 15%
|
||||
# better performance on most recent <EFBFBD>-archs...
|
||||
# better performance on most recent µ-archs...
|
||||
#
|
||||
# Third version adds AES_cbc_encrypt implementation, which resulted in
|
||||
# up to 40% performance imrovement of CBC benchmark results. 40% was
|
||||
@@ -224,7 +224,7 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } }
|
||||
$speed_limit=512; # chunks smaller than $speed_limit are
|
||||
# processed with compact routine in CBC mode
|
||||
$small_footprint=1; # $small_footprint=1 code is ~5% slower [on
|
||||
# recent <EFBFBD>-archs], but ~5 times smaller!
|
||||
# recent µ-archs], but ~5 times smaller!
|
||||
# I favor compact code to minimize cache
|
||||
# contention and in hope to "collect" 5% back
|
||||
# in real-life applications...
|
||||
@@ -565,7 +565,7 @@ sub enctransform()
|
||||
# Performance is not actually extraordinary in comparison to pure
|
||||
# x86 code. In particular encrypt performance is virtually the same.
|
||||
# Decrypt performance on the other hand is 15-20% better on newer
|
||||
# <EFBFBD>-archs [but we're thankful for *any* improvement here], and ~50%
|
||||
# µ-archs [but we're thankful for *any* improvement here], and ~50%
|
||||
# better on PIII:-) And additionally on the pros side this code
|
||||
# eliminates redundant references to stack and thus relieves/
|
||||
# minimizes the pressure on the memory bus.
|
||||
|
@@ -63,7 +63,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$avx = ($1>=10) + ($1>=11);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
|
@@ -94,7 +94,7 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
|
||||
$avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
`ml64 2>&1` =~ /Version ([0-9]+)\./ &&
|
||||
$1>=10);
|
||||
$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
|
||||
$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
|
||||
|
||||
$shaext=1; ### set to zero if compiling for 1.0.1
|
||||
|
||||
|
@@ -59,7 +59,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$avx = ($1>=10) + ($1>=12);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
@@ -139,11 +139,8 @@ $code.=<<___ if ($avx>1);
|
||||
je ${func}_avx2
|
||||
___
|
||||
$code.=<<___;
|
||||
and \$`1<<30`,%eax # mask "Intel CPU" bit
|
||||
and \$`1<<28|1<<9`,%r10d # mask AVX+SSSE3 bits
|
||||
or %eax,%r10d
|
||||
cmp \$`1<<28|1<<9|1<<30`,%r10d
|
||||
je ${func}_avx
|
||||
and \$`1<<28`,%r10d # check for AVX
|
||||
jnz ${func}_avx
|
||||
ud2
|
||||
___
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ $inout3="xmm5"; $in1="xmm5";
|
||||
$inout4="xmm6"; $in0="xmm6";
|
||||
$inout5="xmm7"; $ivec="xmm7";
|
||||
|
||||
# AESNI extenstion
|
||||
# AESNI extension
|
||||
sub aeskeygenassist
|
||||
{ my($dst,$src,$imm)=@_;
|
||||
if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/)
|
||||
|
@@ -337,24 +337,27 @@ Lenc_entry:
|
||||
addi $inp, $inp, 15 # 15 is not a typo
|
||||
?lvsr $outperm, 0, $out
|
||||
?lvsl $keyperm, 0, $key # prepare for unaligned access
|
||||
vnor $outmask, v7, v7 # 0xff..ff
|
||||
lvx $inptail, 0, $inp # redundant in aligned case
|
||||
?vperm $outmask, v7, $outmask, $outperm
|
||||
lvx $outhead, 0, $out
|
||||
?vperm v0, v0, $inptail, $inpperm
|
||||
|
||||
bl _vpaes_encrypt_core
|
||||
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
vsel v1, $outhead, v0, $outmask
|
||||
vmr $outhead, v0
|
||||
stvx v1, 0, $out
|
||||
addi $out, $out, 15 # 15 is not a typo
|
||||
########
|
||||
andi. r8, $out, 15
|
||||
li r9, 16
|
||||
beq Lenc_out_aligned
|
||||
|
||||
lvx v1, 0, $out # redundant in aligned case
|
||||
vsel v1, $outhead, v1, $outmask
|
||||
stvx v1, 0, $out
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
mtctr r9
|
||||
Lenc_out_unaligned:
|
||||
stvebx v0, 0, $out
|
||||
addi $out, $out, 1
|
||||
bdnz Lenc_out_unaligned
|
||||
b Lenc_done
|
||||
|
||||
.align 4
|
||||
Lenc_out_aligned:
|
||||
stvx v0, 0, $out
|
||||
Lenc_done:
|
||||
|
||||
li r10,`15+6*$SIZE_T`
|
||||
li r11,`31+6*$SIZE_T`
|
||||
@@ -566,24 +569,27 @@ Ldec_entry:
|
||||
addi $inp, $inp, 15 # 15 is not a typo
|
||||
?lvsr $outperm, 0, $out
|
||||
?lvsl $keyperm, 0, $key
|
||||
vnor $outmask, v7, v7 # 0xff..ff
|
||||
lvx $inptail, 0, $inp # redundant in aligned case
|
||||
?vperm $outmask, v7, $outmask, $outperm
|
||||
lvx $outhead, 0, $out
|
||||
?vperm v0, v0, $inptail, $inpperm
|
||||
|
||||
bl _vpaes_decrypt_core
|
||||
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
vsel v1, $outhead, v0, $outmask
|
||||
vmr $outhead, v0
|
||||
stvx v1, 0, $out
|
||||
addi $out, $out, 15 # 15 is not a typo
|
||||
########
|
||||
andi. r8, $out, 15
|
||||
li r9, 16
|
||||
beq Ldec_out_aligned
|
||||
|
||||
lvx v1, 0, $out # redundant in aligned case
|
||||
vsel v1, $outhead, v1, $outmask
|
||||
stvx v1, 0, $out
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
mtctr r9
|
||||
Ldec_out_unaligned:
|
||||
stvebx v0, 0, $out
|
||||
addi $out, $out, 1
|
||||
bdnz Ldec_out_unaligned
|
||||
b Ldec_done
|
||||
|
||||
.align 4
|
||||
Ldec_out_aligned:
|
||||
stvx v0, 0, $out
|
||||
Ldec_done:
|
||||
|
||||
li r10,`15+6*$SIZE_T`
|
||||
li r11,`31+6*$SIZE_T`
|
||||
@@ -658,11 +664,11 @@ Ldec_entry:
|
||||
$PUSH r0, `$FRAME+$SIZE_T*2+$LRSAVE`($sp)
|
||||
|
||||
and r30, r5, r9 # copy length&-16
|
||||
andi. r9, $out, 15 # is $out aligned?
|
||||
mr r5, r6 # copy pointer to key
|
||||
mr r31, r7 # copy pointer to iv
|
||||
blt Lcbc_abort
|
||||
cmpwi r8, 0 # test direction
|
||||
li r6, -1
|
||||
mcrf cr1, cr0 # put aside $out alignment flag
|
||||
mr r7, r12 # copy vrsave
|
||||
mtspr 256, r6 # preserve all AltiVec registers
|
||||
|
||||
@@ -672,6 +678,7 @@ Ldec_entry:
|
||||
lvx v25, r9, r31
|
||||
?vperm v24, v24, v25, $inpperm
|
||||
|
||||
cmpwi r8, 0 # test direction
|
||||
neg r8, $inp # prepare for unaligned access
|
||||
vxor v7, v7, v7
|
||||
?lvsl $keyperm, 0, $key
|
||||
@@ -681,13 +688,37 @@ Ldec_entry:
|
||||
lvx $inptail, 0, $inp
|
||||
?vperm $outmask, v7, $outmask, $outperm
|
||||
addi $inp, $inp, 15 # 15 is not a typo
|
||||
lvx $outhead, 0, $out
|
||||
|
||||
beq Lcbc_decrypt
|
||||
|
||||
bl _vpaes_encrypt_preheat
|
||||
li r0, 16
|
||||
|
||||
beq cr1, Lcbc_enc_loop # $out is aligned
|
||||
|
||||
vmr v0, $inptail
|
||||
lvx $inptail, 0, $inp
|
||||
addi $inp, $inp, 16
|
||||
?vperm v0, v0, $inptail, $inpperm
|
||||
vxor v0, v0, v24 # ^= iv
|
||||
|
||||
bl _vpaes_encrypt_core
|
||||
|
||||
andi. r8, $out, 15
|
||||
vmr v24, v0 # put aside iv
|
||||
sub r9, $out, r8
|
||||
vperm $outhead, v0, v0, $outperm # rotate right/left
|
||||
|
||||
Lcbc_enc_head:
|
||||
stvebx $outhead, r8, r9
|
||||
cmpwi r8, 15
|
||||
addi r8, r8, 1
|
||||
bne Lcbc_enc_head
|
||||
|
||||
sub. r30, r30, r0 # len -= 16
|
||||
addi $out, $out, 16
|
||||
beq Lcbc_unaligned_done
|
||||
|
||||
Lcbc_enc_loop:
|
||||
vmr v0, $inptail
|
||||
lvx $inptail, 0, $inp
|
||||
@@ -713,6 +744,32 @@ Lcbc_decrypt:
|
||||
bl _vpaes_decrypt_preheat
|
||||
li r0, 16
|
||||
|
||||
beq cr1, Lcbc_dec_loop # $out is aligned
|
||||
|
||||
vmr v0, $inptail
|
||||
lvx $inptail, 0, $inp
|
||||
addi $inp, $inp, 16
|
||||
?vperm v0, v0, $inptail, $inpperm
|
||||
vmr v25, v0 # put aside input
|
||||
|
||||
bl _vpaes_decrypt_core
|
||||
|
||||
andi. r8, $out, 15
|
||||
vxor v0, v0, v24 # ^= iv
|
||||
vmr v24, v25
|
||||
sub r9, $out, r8
|
||||
vperm $outhead, v0, v0, $outperm # rotate right/left
|
||||
|
||||
Lcbc_dec_head:
|
||||
stvebx $outhead, r8, r9
|
||||
cmpwi r8, 15
|
||||
addi r8, r8, 1
|
||||
bne Lcbc_dec_head
|
||||
|
||||
sub. r30, r30, r0 # len -= 16
|
||||
addi $out, $out, 16
|
||||
beq Lcbc_unaligned_done
|
||||
|
||||
Lcbc_dec_loop:
|
||||
vmr v0, $inptail
|
||||
lvx $inptail, 0, $inp
|
||||
@@ -733,23 +790,29 @@ Lcbc_dec_loop:
|
||||
bne Lcbc_dec_loop
|
||||
|
||||
Lcbc_done:
|
||||
addi $out, $out, -1
|
||||
lvx v1, 0, $out # redundant in aligned case
|
||||
vsel v1, $outhead, v1, $outmask
|
||||
stvx v1, 0, $out
|
||||
beq cr1, Lcbc_write_iv # $out is aligned
|
||||
|
||||
Lcbc_unaligned_done:
|
||||
andi. r8, $out, 15
|
||||
sub $out, $out, r8
|
||||
li r9, 0
|
||||
Lcbc_tail:
|
||||
stvebx $outhead, r9, $out
|
||||
addi r9, r9, 1
|
||||
cmpw r9, r8
|
||||
bne Lcbc_tail
|
||||
|
||||
Lcbc_write_iv:
|
||||
neg r8, r31 # write [potentially unaligned] iv
|
||||
li r10, 4
|
||||
?lvsl $outperm, 0, r8
|
||||
li r6, 15
|
||||
vnor $outmask, v7, v7 # 0xff..ff
|
||||
?vperm $outmask, v7, $outmask, $outperm
|
||||
lvx $outhead, 0, r31
|
||||
li r11, 8
|
||||
li r12, 12
|
||||
vperm v24, v24, v24, $outperm # rotate right/left
|
||||
vsel v0, $outhead, v24, $outmask
|
||||
lvx v1, r6, r31
|
||||
stvx v0, 0, r31
|
||||
vsel v1, v24, v1, $outmask
|
||||
stvx v1, r6, r31
|
||||
stvewx v24, 0, r31 # ivp is at least 32-bit aligned
|
||||
stvewx v24, r10, r31
|
||||
stvewx v24, r11, r31
|
||||
stvewx v24, r12, r31
|
||||
|
||||
mtspr 256, r7 # restore vrsave
|
||||
li r10,`15+6*$SIZE_T`
|
||||
@@ -872,18 +935,21 @@ _vpaes_schedule_core:
|
||||
|
||||
# encrypting, output zeroth round key after transform
|
||||
li r8, 0x30 # mov \$0x30,%r8d
|
||||
addi r10, r12, 0x80 # lea .Lk_sr(%rip),%r10
|
||||
li r9, 4
|
||||
li r10, 8
|
||||
li r11, 12
|
||||
|
||||
?lvsr $outperm, 0, $out # prepare for unaligned access
|
||||
vnor $outmask, v9, v9 # 0xff..ff
|
||||
lvx $outhead, 0, $out
|
||||
?vperm $outmask, v9, $outmask, $outperm
|
||||
|
||||
#stvx v0, 0, $out # vmovdqu %xmm0, (%rdx)
|
||||
vperm v1, v0, v0, $outperm # rotate right/left
|
||||
vsel v2, $outhead, v1, $outmask
|
||||
vmr $outhead, v1
|
||||
stvx v2, 0, $out
|
||||
vperm $outhead, v0, v0, $outperm # rotate right/left
|
||||
stvewx $outhead, 0, $out # some are superfluous
|
||||
stvewx $outhead, r9, $out
|
||||
stvewx $outhead, r10, $out
|
||||
addi r10, r12, 0x80 # lea .Lk_sr(%rip),%r10
|
||||
stvewx $outhead, r11, $out
|
||||
b Lschedule_go
|
||||
|
||||
Lschedule_am_decrypting:
|
||||
@@ -893,20 +959,24 @@ Lschedule_am_decrypting:
|
||||
addi r10, r12, 0x80 # lea .Lk_sr(%rip),%r10
|
||||
# decrypting, output zeroth round key after shiftrows
|
||||
lvx v1, r8, r10 # vmovdqa (%r8,%r10), %xmm1
|
||||
li r9, 4
|
||||
li r10, 8
|
||||
li r11, 12
|
||||
vperm v4, v3, v3, v1 # vpshufb %xmm1, %xmm3, %xmm3
|
||||
|
||||
neg r0, $out # prepare for unaligned access
|
||||
?lvsl $outperm, 0, r0
|
||||
addi $out, $out, 15 # 15 is not typo
|
||||
vnor $outmask, v9, v9 # 0xff..ff
|
||||
lvx $outhead, 0, $out
|
||||
?vperm $outmask, $outmask, v9, $outperm
|
||||
|
||||
#stvx v4, 0, $out # vmovdqu %xmm3, (%rdx)
|
||||
vperm v4, v4, v4, $outperm # rotate right/left
|
||||
vsel v2, $outhead, v4, $outmask
|
||||
vmr $outhead, v4
|
||||
stvx v2, 0, $out
|
||||
vperm $outhead, v4, v4, $outperm # rotate right/left
|
||||
stvewx $outhead, 0, $out # some are superfluous
|
||||
stvewx $outhead, r9, $out
|
||||
stvewx $outhead, r10, $out
|
||||
addi r10, r12, 0x80 # lea .Lk_sr(%rip),%r10
|
||||
stvewx $outhead, r11, $out
|
||||
addi $out, $out, 15 # 15 is not typo
|
||||
xori r8, r8, 0x30 # xor \$0x30, %r8
|
||||
|
||||
Lschedule_go:
|
||||
@@ -1038,14 +1108,15 @@ Lschedule_mangle_last:
|
||||
|
||||
#stvx v0, r0, $out # vmovdqu %xmm0, (%rdx) # save last key
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
li r10, 4
|
||||
vsel v2, $outhead, v0, $outmask
|
||||
vmr $outhead, v0
|
||||
li r11, 8
|
||||
stvx v2, 0, $out
|
||||
|
||||
addi $out, $out, 15 # 15 is not typo
|
||||
lvx v1, 0, $out # redundant in aligned case
|
||||
vsel v1, $outhead, v1, $outmask
|
||||
stvx v1, 0, $out
|
||||
li r12, 12
|
||||
stvewx v0, 0, $out # some (or all) are redundant
|
||||
stvewx v0, r10, $out
|
||||
stvewx v0, r11, $out
|
||||
stvewx v0, r12, $out
|
||||
b Lschedule_mangle_done
|
||||
|
||||
.align 4
|
||||
@@ -1057,15 +1128,18 @@ Lschedule_mangle_last_dec:
|
||||
bl _vpaes_schedule_transform # output transform
|
||||
|
||||
#stvx v0, r0, $out # vmovdqu %xmm0, (%rdx) # save last key
|
||||
addi r9, $out, -15 # -15 is not typo
|
||||
vperm v0, v0, v0, $outperm # rotate right/left
|
||||
li r10, 4
|
||||
vsel v2, $outhead, v0, $outmask
|
||||
vmr $outhead, v0
|
||||
li r11, 8
|
||||
stvx v2, 0, $out
|
||||
li r12, 12
|
||||
stvewx v0, 0, r9 # some (or all) are redundant
|
||||
stvewx v0, r10, r9
|
||||
stvewx v0, r11, r9
|
||||
stvewx v0, r12, r9
|
||||
|
||||
addi $out, $out, -15 # -15 is not typo
|
||||
lvx v1, 0, $out # redundant in aligned case
|
||||
vsel v1, $outhead, v1, $outmask
|
||||
stvx v1, 0, $out
|
||||
|
||||
Lschedule_mangle_done:
|
||||
mtlr r7
|
||||
|
@@ -1,4 +0,0 @@
|
||||
lib
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
@@ -62,6 +62,10 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
#ifndef ASN1_PARSE_MAXDEPTH
|
||||
#define ASN1_PARSE_MAXDEPTH 128
|
||||
#endif
|
||||
|
||||
static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
|
||||
int indent);
|
||||
static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
||||
@@ -128,6 +132,12 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
||||
#else
|
||||
dump_indent = 6; /* Because we know BIO_dump_indent() */
|
||||
#endif
|
||||
|
||||
if (depth > ASN1_PARSE_MAXDEPTH) {
|
||||
BIO_puts(bp, "BAD RECURSION DEPTH\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = *pp;
|
||||
tot = p + length;
|
||||
op = p - 1;
|
||||
|
@@ -72,6 +72,7 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
long length)
|
||||
{
|
||||
EVP_PKEY *ret;
|
||||
const unsigned char *p = *pp;
|
||||
|
||||
if ((a == NULL) || (*a == NULL)) {
|
||||
if ((ret = EVP_PKEY_new()) == NULL) {
|
||||
@@ -94,21 +95,23 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
|
||||
}
|
||||
|
||||
if (!ret->ameth->old_priv_decode ||
|
||||
!ret->ameth->old_priv_decode(ret, pp, length)) {
|
||||
!ret->ameth->old_priv_decode(ret, &p, length)) {
|
||||
if (ret->ameth->priv_decode) {
|
||||
PKCS8_PRIV_KEY_INFO *p8 = NULL;
|
||||
p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, pp, length);
|
||||
p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
|
||||
if (!p8)
|
||||
goto err;
|
||||
EVP_PKEY_free(ret);
|
||||
ret = EVP_PKCS82PKEY(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
|
||||
if (ret == NULL)
|
||||
goto err;
|
||||
} else {
|
||||
ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
*pp = p;
|
||||
if (a != NULL)
|
||||
(*a) = ret;
|
||||
return (ret);
|
||||
@@ -136,6 +139,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
* input is surrounded by an ASN1 SEQUENCE.
|
||||
*/
|
||||
inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
|
||||
p = *pp;
|
||||
/*
|
||||
* Since we only need to discern "traditional format" RSA and DSA keys we
|
||||
* can just count the elements.
|
||||
@@ -146,7 +150,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
keytype = EVP_PKEY_EC;
|
||||
else if (sk_ASN1_TYPE_num(inkey) == 3) { /* This seems to be PKCS8, not
|
||||
* traditional format */
|
||||
PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, pp, length);
|
||||
PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
|
||||
EVP_PKEY *ret;
|
||||
|
||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||
@@ -157,6 +161,9 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
|
||||
}
|
||||
ret = EVP_PKCS82PKEY(p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
*pp = p;
|
||||
if (a) {
|
||||
*a = ret;
|
||||
}
|
||||
|
@@ -180,6 +180,8 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
int otag;
|
||||
int ret = 0;
|
||||
ASN1_VALUE **pchptr, *ptmpval;
|
||||
int combine = aclass & ASN1_TFLG_COMBINE;
|
||||
aclass &= ~ASN1_TFLG_COMBINE;
|
||||
if (!pval)
|
||||
return 0;
|
||||
if (aux && aux->asn1_cb)
|
||||
@@ -350,9 +352,9 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
}
|
||||
|
||||
asn1_set_choice_selector(pval, i, it);
|
||||
*in = p;
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
|
||||
goto auxerr;
|
||||
*in = p;
|
||||
return 1;
|
||||
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
@@ -489,9 +491,9 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
/* Save encoding */
|
||||
if (!asn1_enc_save(pval, *in, p - *in, it))
|
||||
goto auxerr;
|
||||
*in = p;
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
|
||||
goto auxerr;
|
||||
*in = p;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
@@ -500,7 +502,8 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
auxerr:
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);
|
||||
err:
|
||||
ASN1_item_ex_free(pval, it);
|
||||
if (combine == 0)
|
||||
ASN1_item_ex_free(pval, it);
|
||||
if (errtt)
|
||||
ERR_add_error_data(4, "Field=", errtt->field_name,
|
||||
", Type=", it->sname);
|
||||
@@ -689,7 +692,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
} else {
|
||||
/* Nothing special */
|
||||
ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item),
|
||||
-1, 0, opt, ctx);
|
||||
-1, tt->flags & ASN1_TFLG_COMBINE, opt, ctx);
|
||||
if (!ret) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
@@ -714,7 +717,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
long plen;
|
||||
char cst, inf, free_cont = 0;
|
||||
const unsigned char *p;
|
||||
BUF_MEM buf;
|
||||
BUF_MEM buf = { 0, NULL, 0 };
|
||||
const unsigned char *cont = NULL;
|
||||
long len;
|
||||
if (!pval) {
|
||||
@@ -790,7 +793,6 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
} else {
|
||||
len = p - cont + plen;
|
||||
p += plen;
|
||||
buf.data = NULL;
|
||||
}
|
||||
} else if (cst) {
|
||||
if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
|
||||
@@ -799,9 +801,9 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE);
|
||||
return 0;
|
||||
}
|
||||
buf.length = 0;
|
||||
buf.max = 0;
|
||||
buf.data = NULL;
|
||||
|
||||
/* Free any returned 'buf' content */
|
||||
free_cont = 1;
|
||||
/*
|
||||
* Should really check the internal tags are correct but some things
|
||||
* may get this wrong. The relevant specs say that constructed string
|
||||
@@ -809,18 +811,16 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
* So instead just check for UNIVERSAL class and ignore the tag.
|
||||
*/
|
||||
if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
|
||||
free_cont = 1;
|
||||
goto err;
|
||||
}
|
||||
len = buf.length;
|
||||
/* Append a final null to string */
|
||||
if (!BUF_MEM_grow_clean(&buf, len + 1)) {
|
||||
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
goto err;
|
||||
}
|
||||
buf.data[len] = 0;
|
||||
cont = (const unsigned char *)buf.data;
|
||||
free_cont = 1;
|
||||
} else {
|
||||
cont = p;
|
||||
len = plen;
|
||||
@@ -828,6 +828,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
}
|
||||
|
||||
/* We now have content length and type: translate into a structure */
|
||||
/* asn1_ex_c2i may reuse allocated buffer, and so sets free_cont to 0 */
|
||||
if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
|
||||
goto err;
|
||||
|
||||
|
@@ -141,8 +141,9 @@ static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it)
|
||||
{
|
||||
BIGNUM *bn;
|
||||
if (!*pval)
|
||||
bn_new(pval, it);
|
||||
|
||||
if (*pval == NULL && !bn_new(pval, it))
|
||||
return 0;
|
||||
bn = (BIGNUM *)*pval;
|
||||
if (!BN_bin2bn(cont, len, bn)) {
|
||||
bn_free(pval, it);
|
||||
|
@@ -188,13 +188,16 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length)
|
||||
{
|
||||
X509_PUBKEY *xpk;
|
||||
EVP_PKEY *pktmp;
|
||||
xpk = d2i_X509_PUBKEY(NULL, pp, length);
|
||||
const unsigned char *q;
|
||||
q = *pp;
|
||||
xpk = d2i_X509_PUBKEY(NULL, &q, length);
|
||||
if (!xpk)
|
||||
return NULL;
|
||||
pktmp = X509_PUBKEY_get(xpk);
|
||||
X509_PUBKEY_free(xpk);
|
||||
if (!pktmp)
|
||||
return NULL;
|
||||
*pp = q;
|
||||
if (a) {
|
||||
EVP_PKEY_free(*a);
|
||||
*a = pktmp;
|
||||
|
@@ -180,16 +180,15 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
if (!a || *a == NULL) {
|
||||
freeret = 1;
|
||||
}
|
||||
ret = d2i_X509(a, pp, length);
|
||||
ret = d2i_X509(a, &q, length);
|
||||
/* If certificate unreadable then forget it */
|
||||
if (!ret)
|
||||
return NULL;
|
||||
/* update length */
|
||||
length -= *pp - q;
|
||||
if (!length)
|
||||
return ret;
|
||||
if (!d2i_X509_CERT_AUX(&ret->aux, pp, length))
|
||||
length -= q - *pp;
|
||||
if (length > 0 && !d2i_X509_CERT_AUX(&ret->aux, &q, length))
|
||||
goto err;
|
||||
*pp = q;
|
||||
return ret;
|
||||
err:
|
||||
if (freeret) {
|
||||
|
@@ -163,10 +163,13 @@ int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj)
|
||||
if (!(objtmp = OBJ_dup(obj)))
|
||||
return 0;
|
||||
if (!(aux = aux_get(x)))
|
||||
return 0;
|
||||
goto err;
|
||||
if (!aux->reject && !(aux->reject = sk_ASN1_OBJECT_new_null()))
|
||||
return 0;
|
||||
goto err;
|
||||
return sk_ASN1_OBJECT_push(aux->reject, objtmp);
|
||||
err:
|
||||
ASN1_OBJECT_free(objtmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void X509_trust_clear(X509 *x)
|
||||
|
@@ -1,5 +0,0 @@
|
||||
lib
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
||||
bf-*.s
|
@@ -1,4 +0,0 @@
|
||||
bx86unix.cpp
|
||||
bx86-elf.s
|
||||
*.flc
|
||||
semantic.cache
|
@@ -1,4 +0,0 @@
|
||||
lib
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
@@ -104,7 +104,6 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
if ((rows * dump_width) < len)
|
||||
rows++;
|
||||
for (i = 0; i < rows; i++) {
|
||||
buf[0] = '\0'; /* start with empty string */
|
||||
BUF_strlcpy(buf, str, sizeof buf);
|
||||
BIO_snprintf(tmp, sizeof tmp, "%04x - ", i * dump_width);
|
||||
BUF_strlcat(buf, tmp, sizeof buf);
|
||||
|
@@ -125,16 +125,16 @@
|
||||
# define LLONG long
|
||||
#endif
|
||||
|
||||
static void fmtstr(char **, char **, size_t *, size_t *,
|
||||
const char *, int, int, int);
|
||||
static void fmtint(char **, char **, size_t *, size_t *,
|
||||
LLONG, int, int, int, int);
|
||||
static void fmtfp(char **, char **, size_t *, size_t *,
|
||||
LDOUBLE, int, int, int);
|
||||
static void doapr_outch(char **, char **, size_t *, size_t *, int);
|
||||
static void _dopr(char **sbuffer, char **buffer,
|
||||
size_t *maxlen, size_t *retlen, int *truncated,
|
||||
const char *format, va_list args);
|
||||
static int fmtstr(char **, char **, size_t *, size_t *,
|
||||
const char *, int, int, int);
|
||||
static int fmtint(char **, char **, size_t *, size_t *,
|
||||
LLONG, int, int, int, int);
|
||||
static int fmtfp(char **, char **, size_t *, size_t *,
|
||||
LDOUBLE, int, int, int);
|
||||
static int doapr_outch(char **, char **, size_t *, size_t *, int);
|
||||
static int _dopr(char **sbuffer, char **buffer,
|
||||
size_t *maxlen, size_t *retlen, int *truncated,
|
||||
const char *format, va_list args);
|
||||
|
||||
/* format read states */
|
||||
#define DP_S_DEFAULT 0
|
||||
@@ -165,7 +165,7 @@ static void _dopr(char **sbuffer, char **buffer,
|
||||
#define char_to_int(p) (p - '0')
|
||||
#define OSSL_MAX(p,q) ((p >= q) ? p : q)
|
||||
|
||||
static void
|
||||
static int
|
||||
_dopr(char **sbuffer,
|
||||
char **buffer,
|
||||
size_t *maxlen,
|
||||
@@ -196,7 +196,8 @@ _dopr(char **sbuffer,
|
||||
if (ch == '%')
|
||||
state = DP_S_FLAGS;
|
||||
else
|
||||
doapr_outch(sbuffer, buffer, &currlen, maxlen, ch);
|
||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
||||
return 0;
|
||||
ch = *format++;
|
||||
break;
|
||||
case DP_S_FLAGS:
|
||||
@@ -302,8 +303,9 @@ _dopr(char **sbuffer,
|
||||
value = va_arg(args, int);
|
||||
break;
|
||||
}
|
||||
fmtint(sbuffer, buffer, &currlen, maxlen,
|
||||
value, 10, min, max, flags);
|
||||
if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min,
|
||||
max, flags))
|
||||
return 0;
|
||||
break;
|
||||
case 'X':
|
||||
flags |= DP_F_UP;
|
||||
@@ -326,17 +328,19 @@ _dopr(char **sbuffer,
|
||||
value = (LLONG) va_arg(args, unsigned int);
|
||||
break;
|
||||
}
|
||||
fmtint(sbuffer, buffer, &currlen, maxlen, value,
|
||||
ch == 'o' ? 8 : (ch == 'u' ? 10 : 16),
|
||||
min, max, flags);
|
||||
if (!fmtint(sbuffer, buffer, &currlen, maxlen, value,
|
||||
ch == 'o' ? 8 : (ch == 'u' ? 10 : 16),
|
||||
min, max, flags))
|
||||
return 0;
|
||||
break;
|
||||
case 'f':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg(args, LDOUBLE);
|
||||
else
|
||||
fvalue = va_arg(args, double);
|
||||
fmtfp(sbuffer, buffer, &currlen, maxlen,
|
||||
fvalue, min, max, flags);
|
||||
if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max,
|
||||
flags))
|
||||
return 0;
|
||||
break;
|
||||
case 'E':
|
||||
flags |= DP_F_UP;
|
||||
@@ -355,8 +359,9 @@ _dopr(char **sbuffer,
|
||||
fvalue = va_arg(args, double);
|
||||
break;
|
||||
case 'c':
|
||||
doapr_outch(sbuffer, buffer, &currlen, maxlen,
|
||||
va_arg(args, int));
|
||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen,
|
||||
va_arg(args, int)))
|
||||
return 0;
|
||||
break;
|
||||
case 's':
|
||||
strvalue = va_arg(args, char *);
|
||||
@@ -366,13 +371,15 @@ _dopr(char **sbuffer,
|
||||
else
|
||||
max = *maxlen;
|
||||
}
|
||||
fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue,
|
||||
flags, min, max);
|
||||
if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue,
|
||||
flags, min, max))
|
||||
return 0;
|
||||
break;
|
||||
case 'p':
|
||||
value = (long)va_arg(args, void *);
|
||||
fmtint(sbuffer, buffer, &currlen, maxlen,
|
||||
value, 16, min, max, flags | DP_F_NUM);
|
||||
if (!fmtint(sbuffer, buffer, &currlen, maxlen,
|
||||
value, 16, min, max, flags | DP_F_NUM))
|
||||
return 0;
|
||||
break;
|
||||
case 'n': /* XXX */
|
||||
if (cflags == DP_C_SHORT) {
|
||||
@@ -394,7 +401,8 @@ _dopr(char **sbuffer,
|
||||
}
|
||||
break;
|
||||
case '%':
|
||||
doapr_outch(sbuffer, buffer, &currlen, maxlen, ch);
|
||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
||||
return 0;
|
||||
break;
|
||||
case 'w':
|
||||
/* not supported yet, treat as next char */
|
||||
@@ -418,46 +426,56 @@ _dopr(char **sbuffer,
|
||||
*truncated = (currlen > *maxlen - 1);
|
||||
if (*truncated)
|
||||
currlen = *maxlen - 1;
|
||||
doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0');
|
||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
|
||||
return 0;
|
||||
*retlen = currlen - 1;
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
fmtstr(char **sbuffer,
|
||||
char **buffer,
|
||||
size_t *currlen,
|
||||
size_t *maxlen, const char *value, int flags, int min, int max)
|
||||
{
|
||||
int padlen, strln;
|
||||
int padlen;
|
||||
size_t strln;
|
||||
int cnt = 0;
|
||||
|
||||
if (value == 0)
|
||||
value = "<NULL>";
|
||||
for (strln = 0; value[strln]; ++strln) ;
|
||||
|
||||
strln = strlen(value);
|
||||
if (strln > INT_MAX)
|
||||
strln = INT_MAX;
|
||||
|
||||
padlen = min - strln;
|
||||
if (padlen < 0)
|
||||
if (min < 0 || padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen;
|
||||
|
||||
while ((padlen > 0) && (cnt < max)) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
--padlen;
|
||||
++cnt;
|
||||
}
|
||||
while (*value && (cnt < max)) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, *value++);
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
|
||||
return 0;
|
||||
++cnt;
|
||||
}
|
||||
while ((padlen < 0) && (cnt < max)) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
++padlen;
|
||||
++cnt;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
fmtint(char **sbuffer,
|
||||
char **buffer,
|
||||
size_t *currlen,
|
||||
@@ -517,37 +535,44 @@ fmtint(char **sbuffer,
|
||||
|
||||
/* spaces */
|
||||
while (spadlen > 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
--spadlen;
|
||||
}
|
||||
|
||||
/* sign */
|
||||
if (signvalue)
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue);
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
|
||||
return 0;
|
||||
|
||||
/* prefix */
|
||||
while (*prefix) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix);
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
|
||||
return 0;
|
||||
prefix++;
|
||||
}
|
||||
|
||||
/* zeros */
|
||||
if (zpadlen > 0) {
|
||||
while (zpadlen > 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, '0');
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
|
||||
return 0;
|
||||
--zpadlen;
|
||||
}
|
||||
}
|
||||
/* digits */
|
||||
while (place > 0)
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]);
|
||||
while (place > 0) {
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* left justified spaces */
|
||||
while (spadlen < 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
++spadlen;
|
||||
}
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static LDOUBLE abs_val(LDOUBLE value)
|
||||
@@ -578,7 +603,7 @@ static long roundv(LDOUBLE value)
|
||||
return intpart;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
fmtfp(char **sbuffer,
|
||||
char **buffer,
|
||||
size_t *currlen,
|
||||
@@ -657,47 +682,61 @@ fmtfp(char **sbuffer,
|
||||
|
||||
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
||||
if (signvalue) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue);
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
|
||||
return 0;
|
||||
--padlen;
|
||||
signvalue = 0;
|
||||
}
|
||||
while (padlen > 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, '0');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
|
||||
return 0;
|
||||
--padlen;
|
||||
}
|
||||
}
|
||||
while (padlen > 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
--padlen;
|
||||
}
|
||||
if (signvalue)
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue);
|
||||
if (signvalue && !doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
|
||||
return 0;
|
||||
|
||||
while (iplace > 0)
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace]);
|
||||
while (iplace > 0) {
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace]))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decimal point. This should probably use locale to find the correct
|
||||
* char to print out.
|
||||
*/
|
||||
if (max > 0 || (flags & DP_F_NUM)) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, '.');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '.'))
|
||||
return 0;
|
||||
|
||||
while (fplace > 0)
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
while (fplace > 0) {
|
||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen,
|
||||
fconvert[--fplace]))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
while (zpadlen > 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, '0');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
|
||||
return 0;
|
||||
--zpadlen;
|
||||
}
|
||||
|
||||
while (padlen < 0) {
|
||||
doapr_outch(sbuffer, buffer, currlen, maxlen, ' ');
|
||||
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||
return 0;
|
||||
++padlen;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
#define BUFFER_INC 1024
|
||||
|
||||
static int
|
||||
doapr_outch(char **sbuffer,
|
||||
char **buffer, size_t *currlen, size_t *maxlen, int c)
|
||||
{
|
||||
@@ -708,24 +747,25 @@ doapr_outch(char **sbuffer,
|
||||
assert(*currlen <= *maxlen);
|
||||
|
||||
if (buffer && *currlen == *maxlen) {
|
||||
*maxlen += 1024;
|
||||
if (*maxlen > INT_MAX - BUFFER_INC)
|
||||
return 0;
|
||||
|
||||
*maxlen += BUFFER_INC;
|
||||
if (*buffer == NULL) {
|
||||
*buffer = OPENSSL_malloc(*maxlen);
|
||||
if (!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
if (*buffer == NULL)
|
||||
return 0;
|
||||
if (*currlen > 0) {
|
||||
assert(*sbuffer != NULL);
|
||||
memcpy(*buffer, *sbuffer, *currlen);
|
||||
}
|
||||
*sbuffer = NULL;
|
||||
} else {
|
||||
*buffer = OPENSSL_realloc(*buffer, *maxlen);
|
||||
if (!*buffer) {
|
||||
/* Panic! Can't really do anything sensible. Just return */
|
||||
return;
|
||||
}
|
||||
char *tmpbuf;
|
||||
tmpbuf = OPENSSL_realloc(*buffer, *maxlen);
|
||||
if (tmpbuf == NULL)
|
||||
return 0;
|
||||
*buffer = tmpbuf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +776,7 @@ doapr_outch(char **sbuffer,
|
||||
(*buffer)[(*currlen)++] = (char)c;
|
||||
}
|
||||
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@@ -768,7 +808,11 @@ int BIO_vprintf(BIO *bio, const char *format, va_list args)
|
||||
|
||||
dynbuf = NULL;
|
||||
CRYPTO_push_info("doapr()");
|
||||
_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, args);
|
||||
if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format,
|
||||
args)) {
|
||||
OPENSSL_free(dynbuf);
|
||||
return -1;
|
||||
}
|
||||
if (dynbuf) {
|
||||
ret = BIO_write(bio, dynbuf, (int)retlen);
|
||||
OPENSSL_free(dynbuf);
|
||||
@@ -803,7 +847,8 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
size_t retlen;
|
||||
int truncated;
|
||||
|
||||
_dopr(&buf, NULL, &n, &retlen, &truncated, format, args);
|
||||
if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
|
||||
return -1;
|
||||
|
||||
if (truncated)
|
||||
/*
|
||||
|
@@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
|
||||
# define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
|
||||
# define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
|
||||
# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)
|
||||
# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
|
||||
|
||||
# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
|
||||
|
||||
/* BIO_s_accept_socket() */
|
||||
/* BIO_s_accept() */
|
||||
# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
|
||||
# define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
|
||||
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
|
||||
@@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
|
||||
# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
|
||||
|
||||
/* BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_do_connect(b) BIO_do_handshake(b)
|
||||
# define BIO_do_accept(b) BIO_do_handshake(b)
|
||||
# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
|
||||
@@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
|
||||
# define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
|
||||
|
||||
/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
|
||||
# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
|
||||
|
||||
/* BIO_s_file() */
|
||||
# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
|
||||
# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
|
||||
|
||||
/* BIO_s_fd() and BIO_s_file() */
|
||||
# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
|
||||
# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
|
||||
|
||||
@@ -685,7 +689,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
|
||||
long argl, long ret);
|
||||
|
||||
BIO_METHOD *BIO_s_mem(void);
|
||||
BIO *BIO_new_mem_buf(void *buf, int len);
|
||||
BIO *BIO_new_mem_buf(const void *buf, int len);
|
||||
BIO_METHOD *BIO_s_socket(void);
|
||||
BIO_METHOD *BIO_s_connect(void);
|
||||
BIO_METHOD *BIO_s_accept(void);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* crypto/bio/bss_bio.c -*- Mode: C; c-file-style: "eay" -*- */
|
||||
/* crypto/bio/bss_bio.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@@ -419,7 +419,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
{
|
||||
BIO *dbio;
|
||||
int *ip;
|
||||
const char **pptr;
|
||||
const char **pptr = NULL;
|
||||
long ret = 1;
|
||||
BIO_CONNECT *data;
|
||||
|
||||
@@ -442,19 +442,28 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_C_GET_CONNECT:
|
||||
if (ptr != NULL) {
|
||||
pptr = (const char **)ptr;
|
||||
if (num == 0) {
|
||||
*pptr = data->param_hostname;
|
||||
}
|
||||
|
||||
} else if (num == 1) {
|
||||
*pptr = data->param_port;
|
||||
} else if (num == 2) {
|
||||
*pptr = (char *)&(data->ip[0]);
|
||||
} else if (num == 3) {
|
||||
*((int *)ptr) = data->port;
|
||||
if (b->init) {
|
||||
if (pptr != NULL) {
|
||||
ret = 1;
|
||||
if (num == 0) {
|
||||
*pptr = data->param_hostname;
|
||||
} else if (num == 1) {
|
||||
*pptr = data->param_port;
|
||||
} else if (num == 2) {
|
||||
*pptr = (char *)&(data->ip[0]);
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
if ((!b->init) || (ptr == NULL))
|
||||
if (num == 3) {
|
||||
ret = data->port;
|
||||
}
|
||||
} else {
|
||||
if (pptr != NULL)
|
||||
*pptr = "not initialized";
|
||||
ret = 1;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case BIO_C_SET_CONNECT:
|
||||
|
@@ -519,10 +519,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
switch (cmd) {
|
||||
case BIO_CTRL_RESET:
|
||||
num = 0;
|
||||
case BIO_C_FILE_SEEK:
|
||||
ret = 0;
|
||||
break;
|
||||
case BIO_C_FILE_TELL:
|
||||
case BIO_CTRL_INFO:
|
||||
ret = 0;
|
||||
break;
|
||||
|
@@ -115,9 +115,8 @@ static BIO_METHOD methods_filep = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
BIO *BIO_new_file(const char *filename, const char *mode)
|
||||
static FILE *file_fopen(const char *filename, const char *mode)
|
||||
{
|
||||
BIO *ret;
|
||||
FILE *file = NULL;
|
||||
|
||||
# if defined(_WIN32) && defined(CP_UTF8)
|
||||
@@ -164,6 +163,14 @@ BIO *BIO_new_file(const char *filename, const char *mode)
|
||||
# else
|
||||
file = fopen(filename, mode);
|
||||
# endif
|
||||
return (file);
|
||||
}
|
||||
|
||||
BIO *BIO_new_file(const char *filename, const char *mode)
|
||||
{
|
||||
BIO *ret;
|
||||
FILE *file = file_fopen(filename, mode);
|
||||
|
||||
if (file == NULL) {
|
||||
SYSerr(SYS_F_FOPEN, get_last_sys_error());
|
||||
ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
|
||||
@@ -386,7 +393,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
else
|
||||
strcat(p, "t");
|
||||
# endif
|
||||
fp = fopen(ptr, p);
|
||||
fp = file_fopen(ptr, p);
|
||||
if (fp == NULL) {
|
||||
SYSerr(SYS_F_FOPEN, get_last_sys_error());
|
||||
ERR_add_error_data(5, "fopen('", ptr, "','", p, "')");
|
||||
|
@@ -91,7 +91,8 @@ BIO_METHOD *BIO_s_mem(void)
|
||||
return (&mem_method);
|
||||
}
|
||||
|
||||
BIO *BIO_new_mem_buf(void *buf, int len)
|
||||
|
||||
BIO *BIO_new_mem_buf(const void *buf, int len)
|
||||
{
|
||||
BIO *ret;
|
||||
BUF_MEM *b;
|
||||
@@ -105,7 +106,8 @@ BIO *BIO_new_mem_buf(void *buf, int len)
|
||||
if (!(ret = BIO_new(BIO_s_mem())))
|
||||
return NULL;
|
||||
b = (BUF_MEM *)ret->ptr;
|
||||
b->data = buf;
|
||||
/* Cast away const and trust in the MEM_RDONLY flag. */
|
||||
b->data = (void *)buf;
|
||||
b->length = sz;
|
||||
b->max = sz;
|
||||
ret->flags |= BIO_FLAGS_MEM_RDONLY;
|
||||
|
@@ -1,10 +0,0 @@
|
||||
lib
|
||||
Makefile.save
|
||||
*.flc
|
||||
semantic.cache
|
||||
co-*.s
|
||||
bn-*.s
|
||||
*-mont.s
|
||||
modexp512-x86_64.s
|
||||
*-gf2m.s
|
||||
x86_64-mont5.s
|
@@ -252,8 +252,8 @@ bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
|
||||
bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
|
||||
bn_exp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bn_exp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp.c bn_lcl.h
|
||||
bn_exp.o: rsaz_exp.h
|
||||
bn_exp.o: ../../include/openssl/symhacks.h ../constant_time_locl.h
|
||||
bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h rsaz_exp.h
|
||||
bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
|
@@ -1,6 +0,0 @@
|
||||
bn86unix.cpp
|
||||
co86unix.cpp
|
||||
bn86-elf.s
|
||||
co86-elf.s
|
||||
*.flc
|
||||
semantic.cache
|
@@ -27,7 +27,7 @@
|
||||
# referred below, which improves ECDH and ECDSA verify benchmarks
|
||||
# by 18-40%.
|
||||
#
|
||||
# C<EFBFBD>mara, D.; Gouv<EFBFBD>a, C. P. L.; L<EFBFBD>pez, J. & Dahab, R.: Fast Software
|
||||
# Câmara, D.; Gouvêa, C. P. L.; López, J. & Dahab, R.: Fast Software
|
||||
# Polynomial Multiplication on ARM Processors using the NEON Engine.
|
||||
#
|
||||
# http://conradoplg.cryptoland.net/files/2010/12/mocrysen13.pdf
|
||||
@@ -136,7 +136,7 @@ ___
|
||||
################
|
||||
# void bn_GF2m_mul_2x2(BN_ULONG *r,
|
||||
# BN_ULONG a1,BN_ULONG a0,
|
||||
# BN_ULONG b1,BN_ULONG b0); # r[3..0]=a1a0<EFBFBD>b1b0
|
||||
# BN_ULONG b1,BN_ULONG b0); # r[3..0]=a1a0·b1b0
|
||||
{
|
||||
$code.=<<___;
|
||||
.global bn_GF2m_mul_2x2
|
||||
@@ -159,7 +159,7 @@ $code.=<<___;
|
||||
mov $mask,#7<<2
|
||||
sub sp,sp,#32 @ allocate tab[8]
|
||||
|
||||
bl mul_1x1_ialu @ a1<EFBFBD>b1
|
||||
bl mul_1x1_ialu @ a1·b1
|
||||
str $lo,[$ret,#8]
|
||||
str $hi,[$ret,#12]
|
||||
|
||||
@@ -169,13 +169,13 @@ $code.=<<___;
|
||||
eor r2,r2,$a
|
||||
eor $b,$b,r3
|
||||
eor $a,$a,r2
|
||||
bl mul_1x1_ialu @ a0<EFBFBD>b0
|
||||
bl mul_1x1_ialu @ a0·b0
|
||||
str $lo,[$ret]
|
||||
str $hi,[$ret,#4]
|
||||
|
||||
eor $a,$a,r2
|
||||
eor $b,$b,r3
|
||||
bl mul_1x1_ialu @ (a1+a0)<EFBFBD>(b1+b0)
|
||||
bl mul_1x1_ialu @ (a1+a0)·(b1+b0)
|
||||
___
|
||||
@r=map("r$_",(6..9));
|
||||
$code.=<<___;
|
||||
|
@@ -422,7 +422,7 @@ bn_mul_add_words:
|
||||
|
||||
// This loop spins in 3*(n+10) ticks on Itanium and in 2*(n+10) on
|
||||
// Itanium 2. Yes, unlike previous versions it scales:-) Previous
|
||||
// version was peforming *all* additions in IALU and was starving
|
||||
// version was performing *all* additions in IALU and was starving
|
||||
// for those even on Itanium 2. In this version one addition is
|
||||
// moved to FPU and is folded with multiplication. This is at cost
|
||||
// of propogating the result from previous call to this subroutine
|
||||
@@ -568,7 +568,7 @@ bn_sqr_comba8:
|
||||
// I've estimated this routine to run in ~120 ticks, but in reality
|
||||
// (i.e. according to ar.itc) it takes ~160 ticks. Are those extra
|
||||
// cycles consumed for instructions fetch? Or did I misinterpret some
|
||||
// clause in Itanium <EFBFBD>-architecture manual? Comments are welcomed and
|
||||
// clause in Itanium µ-architecture manual? Comments are welcomed and
|
||||
// highly appreciated.
|
||||
//
|
||||
// On Itanium 2 it takes ~190 ticks. This is because of stalls on
|
||||
|
@@ -94,6 +94,8 @@ if ($flavour =~ /32/) {
|
||||
$POP= "ld";
|
||||
} else { die "nonsense $flavour"; }
|
||||
|
||||
$LITTLE_ENDIAN = ($flavour=~/le$/) ? 4 : 0;
|
||||
|
||||
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
|
||||
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
|
||||
@@ -294,12 +296,12 @@ $code.=<<___ if ($SIZE_T==8);
|
||||
|
||||
extrdi $t0,$a0,32,32 ; lwz $t0,4($ap)
|
||||
extrdi $t1,$a0,32,0 ; lwz $t1,0($ap)
|
||||
lwz $t2,12($ap) ; load a[1] as 32-bit word pair
|
||||
lwz $t3,8($ap)
|
||||
lwz $t4,4($np) ; load n[0] as 32-bit word pair
|
||||
lwz $t5,0($np)
|
||||
lwz $t6,12($np) ; load n[1] as 32-bit word pair
|
||||
lwz $t7,8($np)
|
||||
lwz $t2,`12^$LITTLE_ENDIAN`($ap) ; load a[1] as 32-bit word pair
|
||||
lwz $t3,`8^$LITTLE_ENDIAN`($ap)
|
||||
lwz $t4,`4^$LITTLE_ENDIAN`($np) ; load n[0] as 32-bit word pair
|
||||
lwz $t5,`0^$LITTLE_ENDIAN`($np)
|
||||
lwz $t6,`12^$LITTLE_ENDIAN`($np) ; load n[1] as 32-bit word pair
|
||||
lwz $t7,`8^$LITTLE_ENDIAN`($np)
|
||||
___
|
||||
$code.=<<___ if ($SIZE_T==4);
|
||||
lwz $a0,0($ap) ; pull ap[0,1] value
|
||||
@@ -463,14 +465,14 @@ $code.=<<___;
|
||||
L1st:
|
||||
___
|
||||
$code.=<<___ if ($SIZE_T==8);
|
||||
lwz $t0,4($ap) ; load a[j] as 32-bit word pair
|
||||
lwz $t1,0($ap)
|
||||
lwz $t2,12($ap) ; load a[j+1] as 32-bit word pair
|
||||
lwz $t3,8($ap)
|
||||
lwz $t4,4($np) ; load n[j] as 32-bit word pair
|
||||
lwz $t5,0($np)
|
||||
lwz $t6,12($np) ; load n[j+1] as 32-bit word pair
|
||||
lwz $t7,8($np)
|
||||
lwz $t0,`4^$LITTLE_ENDIAN`($ap) ; load a[j] as 32-bit word pair
|
||||
lwz $t1,`0^$LITTLE_ENDIAN`($ap)
|
||||
lwz $t2,`12^$LITTLE_ENDIAN`($ap) ; load a[j+1] as 32-bit word pair
|
||||
lwz $t3,`8^$LITTLE_ENDIAN`($ap)
|
||||
lwz $t4,`4^$LITTLE_ENDIAN`($np) ; load n[j] as 32-bit word pair
|
||||
lwz $t5,`0^$LITTLE_ENDIAN`($np)
|
||||
lwz $t6,`12^$LITTLE_ENDIAN`($np) ; load n[j+1] as 32-bit word pair
|
||||
lwz $t7,`8^$LITTLE_ENDIAN`($np)
|
||||
___
|
||||
$code.=<<___ if ($SIZE_T==4);
|
||||
lwz $t0,0($ap) ; load a[j..j+3] as 32-bit word pairs
|
||||
@@ -505,14 +507,14 @@ $code.=<<___;
|
||||
___
|
||||
} else {
|
||||
$code.=<<___;
|
||||
lwz $t1,`$FRAME+0`($sp)
|
||||
lwz $t0,`$FRAME+4`($sp)
|
||||
lwz $t3,`$FRAME+8`($sp)
|
||||
lwz $t2,`$FRAME+12`($sp)
|
||||
lwz $t5,`$FRAME+16`($sp)
|
||||
lwz $t4,`$FRAME+20`($sp)
|
||||
lwz $t7,`$FRAME+24`($sp)
|
||||
lwz $t6,`$FRAME+28`($sp)
|
||||
lwz $t1,`$FRAME+0^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t0,`$FRAME+4^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t3,`$FRAME+8^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t2,`$FRAME+12^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t5,`$FRAME+16^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+20^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t7,`$FRAME+24^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+28^$LITTLE_ENDIAN`($sp)
|
||||
___
|
||||
}
|
||||
$code.=<<___;
|
||||
@@ -651,8 +653,8 @@ $code.=<<___;
|
||||
|
||||
fmadd $T1a,$N1,$na,$T1a
|
||||
fmadd $T1b,$N1,$nb,$T1b
|
||||
lwz $t3,`$FRAME+32`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36`($sp) ; permuted $t0
|
||||
lwz $t3,`$FRAME+32^$LITTLE_ENDIAN`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36^$LITTLE_ENDIAN`($sp) ; permuted $t0
|
||||
addc $t4,$t4,$carry
|
||||
adde $t5,$t5,$c1
|
||||
srwi $carry,$t4,16
|
||||
@@ -673,8 +675,8 @@ $code.=<<___;
|
||||
|
||||
fmadd $T1a,$N0,$nc,$T1a
|
||||
fmadd $T1b,$N0,$nd,$T1b
|
||||
lwz $t7,`$FRAME+40`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44`($sp) ; permuted $t2
|
||||
lwz $t7,`$FRAME+40^$LITTLE_ENDIAN`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44^$LITTLE_ENDIAN`($sp) ; permuted $t2
|
||||
addc $t2,$t2,$carry
|
||||
adde $t3,$t3,$c1
|
||||
srwi $carry,$t2,16
|
||||
@@ -686,8 +688,8 @@ $code.=<<___;
|
||||
insrwi $carry,$t3,16,0
|
||||
fmadd $T3a,$N2,$nc,$T3a
|
||||
fmadd $T3b,$N2,$nd,$T3b
|
||||
lwz $t1,`$FRAME+48`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52`($sp) ; permuted $t4
|
||||
lwz $t1,`$FRAME+48^$LITTLE_ENDIAN`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52^$LITTLE_ENDIAN`($sp) ; permuted $t4
|
||||
addc $t6,$t6,$carry
|
||||
adde $t7,$t7,$c1
|
||||
srwi $carry,$t6,16
|
||||
@@ -699,8 +701,8 @@ $code.=<<___;
|
||||
|
||||
fctid $T0a,$T0a
|
||||
fctid $T0b,$T0b
|
||||
lwz $t5,`$FRAME+56`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60`($sp) ; permuted $t6
|
||||
lwz $t5,`$FRAME+56^$LITTLE_ENDIAN`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60^$LITTLE_ENDIAN`($sp) ; permuted $t6
|
||||
addc $t0,$t0,$carry
|
||||
adde $t1,$t1,$c1
|
||||
srwi $carry,$t0,16
|
||||
@@ -787,14 +789,14 @@ $code.=<<___;
|
||||
___
|
||||
} else {
|
||||
$code.=<<___;
|
||||
lwz $t1,`$FRAME+0`($sp)
|
||||
lwz $t0,`$FRAME+4`($sp)
|
||||
lwz $t3,`$FRAME+8`($sp)
|
||||
lwz $t2,`$FRAME+12`($sp)
|
||||
lwz $t5,`$FRAME+16`($sp)
|
||||
lwz $t4,`$FRAME+20`($sp)
|
||||
lwz $t7,`$FRAME+24`($sp)
|
||||
lwz $t6,`$FRAME+28`($sp)
|
||||
lwz $t1,`$FRAME+0^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t0,`$FRAME+4^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t3,`$FRAME+8^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t2,`$FRAME+12^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t5,`$FRAME+16^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+20^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t7,`$FRAME+24^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+28^$LITTLE_ENDIAN`($sp)
|
||||
stfd $dota,`$FRAME+64`($sp)
|
||||
stfd $dotb,`$FRAME+72`($sp)
|
||||
|
||||
@@ -823,14 +825,14 @@ $code.=<<___;
|
||||
stw $t0,12($tp) ; tp[j-1]
|
||||
stw $t4,8($tp)
|
||||
|
||||
lwz $t3,`$FRAME+32`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36`($sp) ; permuted $t0
|
||||
lwz $t7,`$FRAME+40`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44`($sp) ; permuted $t2
|
||||
lwz $t1,`$FRAME+48`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52`($sp) ; permuted $t4
|
||||
lwz $t5,`$FRAME+56`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60`($sp) ; permuted $t6
|
||||
lwz $t3,`$FRAME+32^$LITTLE_ENDIAN`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36^$LITTLE_ENDIAN`($sp) ; permuted $t0
|
||||
lwz $t7,`$FRAME+40^$LITTLE_ENDIAN`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44^$LITTLE_ENDIAN`($sp) ; permuted $t2
|
||||
lwz $t1,`$FRAME+48^$LITTLE_ENDIAN`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52^$LITTLE_ENDIAN`($sp) ; permuted $t4
|
||||
lwz $t5,`$FRAME+56^$LITTLE_ENDIAN`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60^$LITTLE_ENDIAN`($sp) ; permuted $t6
|
||||
|
||||
addc $t2,$t2,$carry
|
||||
adde $t3,$t3,$c1
|
||||
@@ -857,10 +859,10 @@ $code.=<<___;
|
||||
stw $t2,20($tp) ; tp[j]
|
||||
stwu $t0,16($tp)
|
||||
|
||||
lwz $t7,`$FRAME+64`($sp)
|
||||
lwz $t6,`$FRAME+68`($sp)
|
||||
lwz $t5,`$FRAME+72`($sp)
|
||||
lwz $t4,`$FRAME+76`($sp)
|
||||
lwz $t7,`$FRAME+64^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+68^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t5,`$FRAME+72^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+76^$LITTLE_ENDIAN`($sp)
|
||||
|
||||
addc $t6,$t6,$carry
|
||||
adde $t7,$t7,$c1
|
||||
@@ -1165,23 +1167,23 @@ ___
|
||||
$code.=<<___;
|
||||
fmadd $T1a,$N1,$na,$T1a
|
||||
fmadd $T1b,$N1,$nb,$T1b
|
||||
lwz $t1,`$FRAME+0`($sp)
|
||||
lwz $t0,`$FRAME+4`($sp)
|
||||
lwz $t1,`$FRAME+0^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t0,`$FRAME+4^$LITTLE_ENDIAN`($sp)
|
||||
fmadd $T2a,$N2,$na,$T2a
|
||||
fmadd $T2b,$N2,$nb,$T2b
|
||||
lwz $t3,`$FRAME+8`($sp)
|
||||
lwz $t2,`$FRAME+12`($sp)
|
||||
lwz $t3,`$FRAME+8^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t2,`$FRAME+12^$LITTLE_ENDIAN`($sp)
|
||||
fmadd $T3a,$N3,$na,$T3a
|
||||
fmadd $T3b,$N3,$nb,$T3b
|
||||
lwz $t5,`$FRAME+16`($sp)
|
||||
lwz $t4,`$FRAME+20`($sp)
|
||||
lwz $t5,`$FRAME+16^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+20^$LITTLE_ENDIAN`($sp)
|
||||
addc $t0,$t0,$carry
|
||||
adde $t1,$t1,$c1
|
||||
srwi $carry,$t0,16
|
||||
fmadd $T0a,$N0,$na,$T0a
|
||||
fmadd $T0b,$N0,$nb,$T0b
|
||||
lwz $t7,`$FRAME+24`($sp)
|
||||
lwz $t6,`$FRAME+28`($sp)
|
||||
lwz $t7,`$FRAME+24^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+28^$LITTLE_ENDIAN`($sp)
|
||||
srwi $c1,$t1,16
|
||||
insrwi $carry,$t1,16,0
|
||||
|
||||
@@ -1218,8 +1220,8 @@ $code.=<<___;
|
||||
fctid $T1a,$T1a
|
||||
addc $t0,$t0,$t2
|
||||
adde $t4,$t4,$t3
|
||||
lwz $t3,`$FRAME+32`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36`($sp) ; permuted $t0
|
||||
lwz $t3,`$FRAME+32^$LITTLE_ENDIAN`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36^$LITTLE_ENDIAN`($sp) ; permuted $t0
|
||||
fctid $T1b,$T1b
|
||||
addze $carry,$carry
|
||||
addze $c1,$c1
|
||||
@@ -1229,19 +1231,19 @@ $code.=<<___;
|
||||
addc $t2,$t2,$carry
|
||||
adde $t3,$t3,$c1
|
||||
srwi $carry,$t2,16
|
||||
lwz $t7,`$FRAME+40`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44`($sp) ; permuted $t2
|
||||
lwz $t7,`$FRAME+40^$LITTLE_ENDIAN`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44^$LITTLE_ENDIAN`($sp) ; permuted $t2
|
||||
fctid $T2b,$T2b
|
||||
srwi $c1,$t3,16
|
||||
insrwi $carry,$t3,16,0
|
||||
lwz $t1,`$FRAME+48`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52`($sp) ; permuted $t4
|
||||
lwz $t1,`$FRAME+48^$LITTLE_ENDIAN`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52^$LITTLE_ENDIAN`($sp) ; permuted $t4
|
||||
fctid $T3a,$T3a
|
||||
addc $t6,$t6,$carry
|
||||
adde $t7,$t7,$c1
|
||||
srwi $carry,$t6,16
|
||||
lwz $t5,`$FRAME+56`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60`($sp) ; permuted $t6
|
||||
lwz $t5,`$FRAME+56^$LITTLE_ENDIAN`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60^$LITTLE_ENDIAN`($sp) ; permuted $t6
|
||||
fctid $T3b,$T3b
|
||||
|
||||
insrwi $t2,$t6,16,0 ; 64..95 bits
|
||||
@@ -1354,14 +1356,14 @@ $code.=<<___;
|
||||
___
|
||||
} else {
|
||||
$code.=<<___;
|
||||
lwz $t1,`$FRAME+0`($sp)
|
||||
lwz $t0,`$FRAME+4`($sp)
|
||||
lwz $t3,`$FRAME+8`($sp)
|
||||
lwz $t2,`$FRAME+12`($sp)
|
||||
lwz $t5,`$FRAME+16`($sp)
|
||||
lwz $t4,`$FRAME+20`($sp)
|
||||
lwz $t7,`$FRAME+24`($sp)
|
||||
lwz $t6,`$FRAME+28`($sp)
|
||||
lwz $t1,`$FRAME+0^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t0,`$FRAME+4^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t3,`$FRAME+8^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t2,`$FRAME+12^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t5,`$FRAME+16^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+20^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t7,`$FRAME+24^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+28^$LITTLE_ENDIAN`($sp)
|
||||
stfd $dota,`$FRAME+64`($sp)
|
||||
stfd $dotb,`$FRAME+72`($sp)
|
||||
|
||||
@@ -1397,14 +1399,14 @@ $code.=<<___;
|
||||
stw $t0,4($tp) ; tp[j-1]
|
||||
stw $t4,0($tp)
|
||||
|
||||
lwz $t3,`$FRAME+32`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36`($sp) ; permuted $t0
|
||||
lwz $t7,`$FRAME+40`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44`($sp) ; permuted $t2
|
||||
lwz $t1,`$FRAME+48`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52`($sp) ; permuted $t4
|
||||
lwz $t5,`$FRAME+56`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60`($sp) ; permuted $t6
|
||||
lwz $t3,`$FRAME+32^$LITTLE_ENDIAN`($sp) ; permuted $t1
|
||||
lwz $t2,`$FRAME+36^$LITTLE_ENDIAN`($sp) ; permuted $t0
|
||||
lwz $t7,`$FRAME+40^$LITTLE_ENDIAN`($sp) ; permuted $t3
|
||||
lwz $t6,`$FRAME+44^$LITTLE_ENDIAN`($sp) ; permuted $t2
|
||||
lwz $t1,`$FRAME+48^$LITTLE_ENDIAN`($sp) ; permuted $t5
|
||||
lwz $t0,`$FRAME+52^$LITTLE_ENDIAN`($sp) ; permuted $t4
|
||||
lwz $t5,`$FRAME+56^$LITTLE_ENDIAN`($sp) ; permuted $t7
|
||||
lwz $t4,`$FRAME+60^$LITTLE_ENDIAN`($sp) ; permuted $t6
|
||||
|
||||
addc $t2,$t2,$carry
|
||||
adde $t3,$t3,$c1
|
||||
@@ -1433,12 +1435,12 @@ $code.=<<___;
|
||||
|
||||
addc $t2,$t2,$t6
|
||||
adde $t0,$t0,$t7
|
||||
lwz $t7,`$FRAME+64`($sp)
|
||||
lwz $t6,`$FRAME+68`($sp)
|
||||
lwz $t7,`$FRAME+64^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t6,`$FRAME+68^$LITTLE_ENDIAN`($sp)
|
||||
addze $carry,$carry
|
||||
addze $c1,$c1
|
||||
lwz $t5,`$FRAME+72`($sp)
|
||||
lwz $t4,`$FRAME+76`($sp)
|
||||
lwz $t5,`$FRAME+72^$LITTLE_ENDIAN`($sp)
|
||||
lwz $t4,`$FRAME+76^$LITTLE_ENDIAN`($sp)
|
||||
|
||||
addc $t6,$t6,$carry
|
||||
adde $t7,$t7,$c1
|
||||
|
@@ -443,7 +443,7 @@ $TEMP2 = $B2;
|
||||
$TEMP3 = $Y1;
|
||||
$TEMP4 = $Y2;
|
||||
$code.=<<___;
|
||||
#we need to fix indexes 32-39 to avoid overflow
|
||||
# we need to fix indices 32-39 to avoid overflow
|
||||
vmovdqu 32*8(%rsp), $ACC8 # 32*8-192($tp0),
|
||||
vmovdqu 32*9(%rsp), $ACC1 # 32*9-192($tp0)
|
||||
vmovdqu 32*10(%rsp), $ACC2 # 32*10-192($tp0)
|
||||
@@ -1592,68 +1592,128 @@ rsaz_1024_scatter5_avx2:
|
||||
.type rsaz_1024_gather5_avx2,\@abi-omnipotent
|
||||
.align 32
|
||||
rsaz_1024_gather5_avx2:
|
||||
vzeroupper
|
||||
mov %rsp,%r11
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x88(%rsp),%rax
|
||||
vzeroupper
|
||||
.LSEH_begin_rsaz_1024_gather5:
|
||||
# I can't trust assembler to use specific encoding:-(
|
||||
.byte 0x48,0x8d,0x60,0xe0 #lea -0x20(%rax),%rsp
|
||||
.byte 0xc5,0xf8,0x29,0x70,0xe0 #vmovaps %xmm6,-0x20(%rax)
|
||||
.byte 0xc5,0xf8,0x29,0x78,0xf0 #vmovaps %xmm7,-0x10(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x40,0x00 #vmovaps %xmm8,0(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x48,0x10 #vmovaps %xmm9,0x10(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x50,0x20 #vmovaps %xmm10,0x20(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x58,0x30 #vmovaps %xmm11,0x30(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x60,0x40 #vmovaps %xmm12,0x40(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x68,0x50 #vmovaps %xmm13,0x50(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x70,0x60 #vmovaps %xmm14,0x60(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x78,0x70 #vmovaps %xmm15,0x70(%rax)
|
||||
.byte 0x48,0x8d,0x60,0xe0 # lea -0x20(%rax),%rsp
|
||||
.byte 0xc5,0xf8,0x29,0x70,0xe0 # vmovaps %xmm6,-0x20(%rax)
|
||||
.byte 0xc5,0xf8,0x29,0x78,0xf0 # vmovaps %xmm7,-0x10(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x40,0x00 # vmovaps %xmm8,0(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x48,0x10 # vmovaps %xmm9,0x10(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x50,0x20 # vmovaps %xmm10,0x20(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x58,0x30 # vmovaps %xmm11,0x30(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x60,0x40 # vmovaps %xmm12,0x40(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x68,0x50 # vmovaps %xmm13,0x50(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x70,0x60 # vmovaps %xmm14,0x60(%rax)
|
||||
.byte 0xc5,0x78,0x29,0x78,0x70 # vmovaps %xmm15,0x70(%rax)
|
||||
___
|
||||
$code.=<<___;
|
||||
lea .Lgather_table(%rip),%r11
|
||||
mov $power,%eax
|
||||
and \$3,$power
|
||||
shr \$2,%eax # cache line number
|
||||
shl \$4,$power # offset within cache line
|
||||
lea -0x100(%rsp),%rsp
|
||||
and \$-32, %rsp
|
||||
lea .Linc(%rip), %r10
|
||||
lea -128(%rsp),%rax # control u-op density
|
||||
|
||||
vmovdqu -32(%r11),%ymm7 # .Lgather_permd
|
||||
vpbroadcastb 8(%r11,%rax), %xmm8
|
||||
vpbroadcastb 7(%r11,%rax), %xmm9
|
||||
vpbroadcastb 6(%r11,%rax), %xmm10
|
||||
vpbroadcastb 5(%r11,%rax), %xmm11
|
||||
vpbroadcastb 4(%r11,%rax), %xmm12
|
||||
vpbroadcastb 3(%r11,%rax), %xmm13
|
||||
vpbroadcastb 2(%r11,%rax), %xmm14
|
||||
vpbroadcastb 1(%r11,%rax), %xmm15
|
||||
vmovd $power, %xmm4
|
||||
vmovdqa (%r10),%ymm0
|
||||
vmovdqa 32(%r10),%ymm1
|
||||
vmovdqa 64(%r10),%ymm5
|
||||
vpbroadcastd %xmm4,%ymm4
|
||||
|
||||
lea 64($inp,$power),$inp
|
||||
mov \$64,%r11 # size optimization
|
||||
mov \$9,%eax
|
||||
jmp .Loop_gather_1024
|
||||
vpaddd %ymm5, %ymm0, %ymm2
|
||||
vpcmpeqd %ymm4, %ymm0, %ymm0
|
||||
vpaddd %ymm5, %ymm1, %ymm3
|
||||
vpcmpeqd %ymm4, %ymm1, %ymm1
|
||||
vmovdqa %ymm0, 32*0+128(%rax)
|
||||
vpaddd %ymm5, %ymm2, %ymm0
|
||||
vpcmpeqd %ymm4, %ymm2, %ymm2
|
||||
vmovdqa %ymm1, 32*1+128(%rax)
|
||||
vpaddd %ymm5, %ymm3, %ymm1
|
||||
vpcmpeqd %ymm4, %ymm3, %ymm3
|
||||
vmovdqa %ymm2, 32*2+128(%rax)
|
||||
vpaddd %ymm5, %ymm0, %ymm2
|
||||
vpcmpeqd %ymm4, %ymm0, %ymm0
|
||||
vmovdqa %ymm3, 32*3+128(%rax)
|
||||
vpaddd %ymm5, %ymm1, %ymm3
|
||||
vpcmpeqd %ymm4, %ymm1, %ymm1
|
||||
vmovdqa %ymm0, 32*4+128(%rax)
|
||||
vpaddd %ymm5, %ymm2, %ymm8
|
||||
vpcmpeqd %ymm4, %ymm2, %ymm2
|
||||
vmovdqa %ymm1, 32*5+128(%rax)
|
||||
vpaddd %ymm5, %ymm3, %ymm9
|
||||
vpcmpeqd %ymm4, %ymm3, %ymm3
|
||||
vmovdqa %ymm2, 32*6+128(%rax)
|
||||
vpaddd %ymm5, %ymm8, %ymm10
|
||||
vpcmpeqd %ymm4, %ymm8, %ymm8
|
||||
vmovdqa %ymm3, 32*7+128(%rax)
|
||||
vpaddd %ymm5, %ymm9, %ymm11
|
||||
vpcmpeqd %ymm4, %ymm9, %ymm9
|
||||
vpaddd %ymm5, %ymm10, %ymm12
|
||||
vpcmpeqd %ymm4, %ymm10, %ymm10
|
||||
vpaddd %ymm5, %ymm11, %ymm13
|
||||
vpcmpeqd %ymm4, %ymm11, %ymm11
|
||||
vpaddd %ymm5, %ymm12, %ymm14
|
||||
vpcmpeqd %ymm4, %ymm12, %ymm12
|
||||
vpaddd %ymm5, %ymm13, %ymm15
|
||||
vpcmpeqd %ymm4, %ymm13, %ymm13
|
||||
vpcmpeqd %ymm4, %ymm14, %ymm14
|
||||
vpcmpeqd %ymm4, %ymm15, %ymm15
|
||||
|
||||
vmovdqa -32(%r10),%ymm7 # .Lgather_permd
|
||||
lea 128($inp), $inp
|
||||
mov \$9,$power
|
||||
|
||||
.align 32
|
||||
.Loop_gather_1024:
|
||||
vpand -64($inp), %xmm8,%xmm0
|
||||
vpand ($inp), %xmm9,%xmm1
|
||||
vpand 64($inp), %xmm10,%xmm2
|
||||
vpand ($inp,%r11,2), %xmm11,%xmm3
|
||||
vpor %xmm0,%xmm1,%xmm1
|
||||
vpand 64($inp,%r11,2), %xmm12,%xmm4
|
||||
vpor %xmm2,%xmm3,%xmm3
|
||||
vpand ($inp,%r11,4), %xmm13,%xmm5
|
||||
vpor %xmm1,%xmm3,%xmm3
|
||||
vpand 64($inp,%r11,4), %xmm14,%xmm6
|
||||
vpor %xmm4,%xmm5,%xmm5
|
||||
vpand -128($inp,%r11,8), %xmm15,%xmm2
|
||||
lea ($inp,%r11,8),$inp
|
||||
vpor %xmm3,%xmm5,%xmm5
|
||||
vpor %xmm2,%xmm6,%xmm6
|
||||
vpor %xmm5,%xmm6,%xmm6
|
||||
vpermd %ymm6,%ymm7,%ymm6
|
||||
vmovdqu %ymm6,($out)
|
||||
vmovdqa 32*0-128($inp), %ymm0
|
||||
vmovdqa 32*1-128($inp), %ymm1
|
||||
vmovdqa 32*2-128($inp), %ymm2
|
||||
vmovdqa 32*3-128($inp), %ymm3
|
||||
vpand 32*0+128(%rax), %ymm0, %ymm0
|
||||
vpand 32*1+128(%rax), %ymm1, %ymm1
|
||||
vpand 32*2+128(%rax), %ymm2, %ymm2
|
||||
vpor %ymm0, %ymm1, %ymm4
|
||||
vpand 32*3+128(%rax), %ymm3, %ymm3
|
||||
vmovdqa 32*4-128($inp), %ymm0
|
||||
vmovdqa 32*5-128($inp), %ymm1
|
||||
vpor %ymm2, %ymm3, %ymm5
|
||||
vmovdqa 32*6-128($inp), %ymm2
|
||||
vmovdqa 32*7-128($inp), %ymm3
|
||||
vpand 32*4+128(%rax), %ymm0, %ymm0
|
||||
vpand 32*5+128(%rax), %ymm1, %ymm1
|
||||
vpand 32*6+128(%rax), %ymm2, %ymm2
|
||||
vpor %ymm0, %ymm4, %ymm4
|
||||
vpand 32*7+128(%rax), %ymm3, %ymm3
|
||||
vpand 32*8-128($inp), %ymm8, %ymm0
|
||||
vpor %ymm1, %ymm5, %ymm5
|
||||
vpand 32*9-128($inp), %ymm9, %ymm1
|
||||
vpor %ymm2, %ymm4, %ymm4
|
||||
vpand 32*10-128($inp),%ymm10, %ymm2
|
||||
vpor %ymm3, %ymm5, %ymm5
|
||||
vpand 32*11-128($inp),%ymm11, %ymm3
|
||||
vpor %ymm0, %ymm4, %ymm4
|
||||
vpand 32*12-128($inp),%ymm12, %ymm0
|
||||
vpor %ymm1, %ymm5, %ymm5
|
||||
vpand 32*13-128($inp),%ymm13, %ymm1
|
||||
vpor %ymm2, %ymm4, %ymm4
|
||||
vpand 32*14-128($inp),%ymm14, %ymm2
|
||||
vpor %ymm3, %ymm5, %ymm5
|
||||
vpand 32*15-128($inp),%ymm15, %ymm3
|
||||
lea 32*16($inp), $inp
|
||||
vpor %ymm0, %ymm4, %ymm4
|
||||
vpor %ymm1, %ymm5, %ymm5
|
||||
vpor %ymm2, %ymm4, %ymm4
|
||||
vpor %ymm3, %ymm5, %ymm5
|
||||
|
||||
vpor %ymm5, %ymm4, %ymm4
|
||||
vextracti128 \$1, %ymm4, %xmm5 # upper half is cleared
|
||||
vpor %xmm4, %xmm5, %xmm5
|
||||
vpermd %ymm5,%ymm7,%ymm5
|
||||
vmovdqu %ymm5,($out)
|
||||
lea 32($out),$out
|
||||
dec %eax
|
||||
dec $power
|
||||
jnz .Loop_gather_1024
|
||||
|
||||
vpxor %ymm0,%ymm0,%ymm0
|
||||
@@ -1661,20 +1721,20 @@ $code.=<<___;
|
||||
vzeroupper
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps (%rsp),%xmm6
|
||||
movaps 0x10(%rsp),%xmm7
|
||||
movaps 0x20(%rsp),%xmm8
|
||||
movaps 0x30(%rsp),%xmm9
|
||||
movaps 0x40(%rsp),%xmm10
|
||||
movaps 0x50(%rsp),%xmm11
|
||||
movaps 0x60(%rsp),%xmm12
|
||||
movaps 0x70(%rsp),%xmm13
|
||||
movaps 0x80(%rsp),%xmm14
|
||||
movaps 0x90(%rsp),%xmm15
|
||||
lea 0xa8(%rsp),%rsp
|
||||
movaps -0xa8(%r11),%xmm6
|
||||
movaps -0x98(%r11),%xmm7
|
||||
movaps -0x88(%r11),%xmm8
|
||||
movaps -0x78(%r11),%xmm9
|
||||
movaps -0x68(%r11),%xmm10
|
||||
movaps -0x58(%r11),%xmm11
|
||||
movaps -0x48(%r11),%xmm12
|
||||
movaps -0x38(%r11),%xmm13
|
||||
movaps -0x28(%r11),%xmm14
|
||||
movaps -0x18(%r11),%xmm15
|
||||
.LSEH_end_rsaz_1024_gather5:
|
||||
___
|
||||
$code.=<<___;
|
||||
lea (%r11),%rsp
|
||||
ret
|
||||
.size rsaz_1024_gather5_avx2,.-rsaz_1024_gather5_avx2
|
||||
___
|
||||
@@ -1708,8 +1768,10 @@ $code.=<<___;
|
||||
.long 0,2,4,6,7,7,7,7
|
||||
.Lgather_permd:
|
||||
.long 0,7,1,7,2,7,3,7
|
||||
.Lgather_table:
|
||||
.byte 0,0,0,0,0,0,0,0, 0xff,0,0,0,0,0,0,0
|
||||
.Linc:
|
||||
.long 0,0,0,0, 1,1,1,1
|
||||
.long 2,2,2,2, 3,3,3,3
|
||||
.long 4,4,4,4, 4,4,4,4
|
||||
.align 64
|
||||
___
|
||||
|
||||
@@ -1837,18 +1899,19 @@ rsaz_se_handler:
|
||||
.rva rsaz_se_handler
|
||||
.rva .Lmul_1024_body,.Lmul_1024_epilogue
|
||||
.LSEH_info_rsaz_1024_gather5:
|
||||
.byte 0x01,0x33,0x16,0x00
|
||||
.byte 0x36,0xf8,0x09,0x00 #vmovaps 0x90(rsp),xmm15
|
||||
.byte 0x31,0xe8,0x08,0x00 #vmovaps 0x80(rsp),xmm14
|
||||
.byte 0x2c,0xd8,0x07,0x00 #vmovaps 0x70(rsp),xmm13
|
||||
.byte 0x27,0xc8,0x06,0x00 #vmovaps 0x60(rsp),xmm12
|
||||
.byte 0x22,0xb8,0x05,0x00 #vmovaps 0x50(rsp),xmm11
|
||||
.byte 0x1d,0xa8,0x04,0x00 #vmovaps 0x40(rsp),xmm10
|
||||
.byte 0x18,0x98,0x03,0x00 #vmovaps 0x30(rsp),xmm9
|
||||
.byte 0x13,0x88,0x02,0x00 #vmovaps 0x20(rsp),xmm8
|
||||
.byte 0x0e,0x78,0x01,0x00 #vmovaps 0x10(rsp),xmm7
|
||||
.byte 0x09,0x68,0x00,0x00 #vmovaps 0x00(rsp),xmm6
|
||||
.byte 0x04,0x01,0x15,0x00 #sub rsp,0xa8
|
||||
.byte 0x01,0x36,0x17,0x0b
|
||||
.byte 0x36,0xf8,0x09,0x00 # vmovaps 0x90(rsp),xmm15
|
||||
.byte 0x31,0xe8,0x08,0x00 # vmovaps 0x80(rsp),xmm14
|
||||
.byte 0x2c,0xd8,0x07,0x00 # vmovaps 0x70(rsp),xmm13
|
||||
.byte 0x27,0xc8,0x06,0x00 # vmovaps 0x60(rsp),xmm12
|
||||
.byte 0x22,0xb8,0x05,0x00 # vmovaps 0x50(rsp),xmm11
|
||||
.byte 0x1d,0xa8,0x04,0x00 # vmovaps 0x40(rsp),xmm10
|
||||
.byte 0x18,0x98,0x03,0x00 # vmovaps 0x30(rsp),xmm9
|
||||
.byte 0x13,0x88,0x02,0x00 # vmovaps 0x20(rsp),xmm8
|
||||
.byte 0x0e,0x78,0x01,0x00 # vmovaps 0x10(rsp),xmm7
|
||||
.byte 0x09,0x68,0x00,0x00 # vmovaps 0x00(rsp),xmm6
|
||||
.byte 0x04,0x01,0x15,0x00 # sub rsp,0xa8
|
||||
.byte 0x00,0xb3,0x00,0x00 # set_frame r11
|
||||
___
|
||||
}
|
||||
|
||||
|
@@ -113,7 +113,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$addx = ($1>=12);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on LLVM) ([3-9])\.([0-9]+)/) {
|
||||
if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
|
||||
my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
@@ -915,9 +915,76 @@ rsaz_512_mul_gather4:
|
||||
push %r14
|
||||
push %r15
|
||||
|
||||
mov $pwr, $pwr
|
||||
subq \$128+24, %rsp
|
||||
subq \$`128+24+($win64?0xb0:0)`, %rsp
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps %xmm6,0xa0(%rsp)
|
||||
movaps %xmm7,0xb0(%rsp)
|
||||
movaps %xmm8,0xc0(%rsp)
|
||||
movaps %xmm9,0xd0(%rsp)
|
||||
movaps %xmm10,0xe0(%rsp)
|
||||
movaps %xmm11,0xf0(%rsp)
|
||||
movaps %xmm12,0x100(%rsp)
|
||||
movaps %xmm13,0x110(%rsp)
|
||||
movaps %xmm14,0x120(%rsp)
|
||||
movaps %xmm15,0x130(%rsp)
|
||||
___
|
||||
$code.=<<___;
|
||||
.Lmul_gather4_body:
|
||||
movd $pwr,%xmm8
|
||||
movdqa .Linc+16(%rip),%xmm1 # 00000002000000020000000200000002
|
||||
movdqa .Linc(%rip),%xmm0 # 00000001000000010000000000000000
|
||||
|
||||
pshufd \$0,%xmm8,%xmm8 # broadcast $power
|
||||
movdqa %xmm1,%xmm7
|
||||
movdqa %xmm1,%xmm2
|
||||
___
|
||||
########################################################################
|
||||
# calculate mask by comparing 0..15 to $power
|
||||
#
|
||||
for($i=0;$i<4;$i++) {
|
||||
$code.=<<___;
|
||||
paddd %xmm`$i`,%xmm`$i+1`
|
||||
pcmpeqd %xmm8,%xmm`$i`
|
||||
movdqa %xmm7,%xmm`$i+3`
|
||||
___
|
||||
}
|
||||
for(;$i<7;$i++) {
|
||||
$code.=<<___;
|
||||
paddd %xmm`$i`,%xmm`$i+1`
|
||||
pcmpeqd %xmm8,%xmm`$i`
|
||||
___
|
||||
}
|
||||
$code.=<<___;
|
||||
pcmpeqd %xmm8,%xmm7
|
||||
|
||||
movdqa 16*0($bp),%xmm8
|
||||
movdqa 16*1($bp),%xmm9
|
||||
movdqa 16*2($bp),%xmm10
|
||||
movdqa 16*3($bp),%xmm11
|
||||
pand %xmm0,%xmm8
|
||||
movdqa 16*4($bp),%xmm12
|
||||
pand %xmm1,%xmm9
|
||||
movdqa 16*5($bp),%xmm13
|
||||
pand %xmm2,%xmm10
|
||||
movdqa 16*6($bp),%xmm14
|
||||
pand %xmm3,%xmm11
|
||||
movdqa 16*7($bp),%xmm15
|
||||
leaq 128($bp), %rbp
|
||||
pand %xmm4,%xmm12
|
||||
pand %xmm5,%xmm13
|
||||
pand %xmm6,%xmm14
|
||||
pand %xmm7,%xmm15
|
||||
por %xmm10,%xmm8
|
||||
por %xmm11,%xmm9
|
||||
por %xmm12,%xmm8
|
||||
por %xmm13,%xmm9
|
||||
por %xmm14,%xmm8
|
||||
por %xmm15,%xmm9
|
||||
|
||||
por %xmm9,%xmm8
|
||||
pshufd \$0x4e,%xmm8,%xmm9
|
||||
por %xmm9,%xmm8
|
||||
___
|
||||
$code.=<<___ if ($addx);
|
||||
movl \$0x80100,%r11d
|
||||
@@ -926,45 +993,38 @@ $code.=<<___ if ($addx);
|
||||
je .Lmulx_gather
|
||||
___
|
||||
$code.=<<___;
|
||||
movl 64($bp,$pwr,4), %eax
|
||||
movq $out, %xmm0 # off-load arguments
|
||||
movl ($bp,$pwr,4), %ebx
|
||||
movq $mod, %xmm1
|
||||
movq $n0, 128(%rsp)
|
||||
movq %xmm8,%rbx
|
||||
|
||||
movq $n0, 128(%rsp) # off-load arguments
|
||||
movq $out, 128+8(%rsp)
|
||||
movq $mod, 128+16(%rsp)
|
||||
|
||||
shlq \$32, %rax
|
||||
or %rax, %rbx
|
||||
movq ($ap), %rax
|
||||
movq 8($ap), %rcx
|
||||
leaq 128($bp,$pwr,4), %rbp
|
||||
mulq %rbx # 0 iteration
|
||||
movq %rax, (%rsp)
|
||||
movq %rcx, %rax
|
||||
movq %rdx, %r8
|
||||
|
||||
mulq %rbx
|
||||
movd (%rbp), %xmm4
|
||||
addq %rax, %r8
|
||||
movq 16($ap), %rax
|
||||
movq %rdx, %r9
|
||||
adcq \$0, %r9
|
||||
|
||||
mulq %rbx
|
||||
movd 64(%rbp), %xmm5
|
||||
addq %rax, %r9
|
||||
movq 24($ap), %rax
|
||||
movq %rdx, %r10
|
||||
adcq \$0, %r10
|
||||
|
||||
mulq %rbx
|
||||
pslldq \$4, %xmm5
|
||||
addq %rax, %r10
|
||||
movq 32($ap), %rax
|
||||
movq %rdx, %r11
|
||||
adcq \$0, %r11
|
||||
|
||||
mulq %rbx
|
||||
por %xmm5, %xmm4
|
||||
addq %rax, %r11
|
||||
movq 40($ap), %rax
|
||||
movq %rdx, %r12
|
||||
@@ -977,14 +1037,12 @@ $code.=<<___;
|
||||
adcq \$0, %r13
|
||||
|
||||
mulq %rbx
|
||||
leaq 128(%rbp), %rbp
|
||||
addq %rax, %r13
|
||||
movq 56($ap), %rax
|
||||
movq %rdx, %r14
|
||||
adcq \$0, %r14
|
||||
|
||||
mulq %rbx
|
||||
movq %xmm4, %rbx
|
||||
addq %rax, %r14
|
||||
movq ($ap), %rax
|
||||
movq %rdx, %r15
|
||||
@@ -996,6 +1054,35 @@ $code.=<<___;
|
||||
|
||||
.align 32
|
||||
.Loop_mul_gather:
|
||||
movdqa 16*0(%rbp),%xmm8
|
||||
movdqa 16*1(%rbp),%xmm9
|
||||
movdqa 16*2(%rbp),%xmm10
|
||||
movdqa 16*3(%rbp),%xmm11
|
||||
pand %xmm0,%xmm8
|
||||
movdqa 16*4(%rbp),%xmm12
|
||||
pand %xmm1,%xmm9
|
||||
movdqa 16*5(%rbp),%xmm13
|
||||
pand %xmm2,%xmm10
|
||||
movdqa 16*6(%rbp),%xmm14
|
||||
pand %xmm3,%xmm11
|
||||
movdqa 16*7(%rbp),%xmm15
|
||||
leaq 128(%rbp), %rbp
|
||||
pand %xmm4,%xmm12
|
||||
pand %xmm5,%xmm13
|
||||
pand %xmm6,%xmm14
|
||||
pand %xmm7,%xmm15
|
||||
por %xmm10,%xmm8
|
||||
por %xmm11,%xmm9
|
||||
por %xmm12,%xmm8
|
||||
por %xmm13,%xmm9
|
||||
por %xmm14,%xmm8
|
||||
por %xmm15,%xmm9
|
||||
|
||||
por %xmm9,%xmm8
|
||||
pshufd \$0x4e,%xmm8,%xmm9
|
||||
por %xmm9,%xmm8
|
||||
movq %xmm8,%rbx
|
||||
|
||||
mulq %rbx
|
||||
addq %rax, %r8
|
||||
movq 8($ap), %rax
|
||||
@@ -1004,7 +1091,6 @@ $code.=<<___;
|
||||
adcq \$0, %r8
|
||||
|
||||
mulq %rbx
|
||||
movd (%rbp), %xmm4
|
||||
addq %rax, %r9
|
||||
movq 16($ap), %rax
|
||||
adcq \$0, %rdx
|
||||
@@ -1013,7 +1099,6 @@ $code.=<<___;
|
||||
adcq \$0, %r9
|
||||
|
||||
mulq %rbx
|
||||
movd 64(%rbp), %xmm5
|
||||
addq %rax, %r10
|
||||
movq 24($ap), %rax
|
||||
adcq \$0, %rdx
|
||||
@@ -1022,7 +1107,6 @@ $code.=<<___;
|
||||
adcq \$0, %r10
|
||||
|
||||
mulq %rbx
|
||||
pslldq \$4, %xmm5
|
||||
addq %rax, %r11
|
||||
movq 32($ap), %rax
|
||||
adcq \$0, %rdx
|
||||
@@ -1031,7 +1115,6 @@ $code.=<<___;
|
||||
adcq \$0, %r11
|
||||
|
||||
mulq %rbx
|
||||
por %xmm5, %xmm4
|
||||
addq %rax, %r12
|
||||
movq 40($ap), %rax
|
||||
adcq \$0, %rdx
|
||||
@@ -1056,7 +1139,6 @@ $code.=<<___;
|
||||
adcq \$0, %r14
|
||||
|
||||
mulq %rbx
|
||||
movq %xmm4, %rbx
|
||||
addq %rax, %r15
|
||||
movq ($ap), %rax
|
||||
adcq \$0, %rdx
|
||||
@@ -1064,7 +1146,6 @@ $code.=<<___;
|
||||
movq %rdx, %r15
|
||||
adcq \$0, %r15
|
||||
|
||||
leaq 128(%rbp), %rbp
|
||||
leaq 8(%rdi), %rdi
|
||||
|
||||
decl %ecx
|
||||
@@ -1079,8 +1160,8 @@ $code.=<<___;
|
||||
movq %r14, 48(%rdi)
|
||||
movq %r15, 56(%rdi)
|
||||
|
||||
movq %xmm0, $out
|
||||
movq %xmm1, %rbp
|
||||
movq 128+8(%rsp), $out
|
||||
movq 128+16(%rsp), %rbp
|
||||
|
||||
movq (%rsp), %r8
|
||||
movq 8(%rsp), %r9
|
||||
@@ -1098,45 +1179,37 @@ $code.=<<___ if ($addx);
|
||||
|
||||
.align 32
|
||||
.Lmulx_gather:
|
||||
mov 64($bp,$pwr,4), %eax
|
||||
movq $out, %xmm0 # off-load arguments
|
||||
lea 128($bp,$pwr,4), %rbp
|
||||
mov ($bp,$pwr,4), %edx
|
||||
movq $mod, %xmm1
|
||||
mov $n0, 128(%rsp)
|
||||
movq %xmm8,%rdx
|
||||
|
||||
mov $n0, 128(%rsp) # off-load arguments
|
||||
mov $out, 128+8(%rsp)
|
||||
mov $mod, 128+16(%rsp)
|
||||
|
||||
shl \$32, %rax
|
||||
or %rax, %rdx
|
||||
mulx ($ap), %rbx, %r8 # 0 iteration
|
||||
mov %rbx, (%rsp)
|
||||
xor %edi, %edi # cf=0, of=0
|
||||
|
||||
mulx 8($ap), %rax, %r9
|
||||
movd (%rbp), %xmm4
|
||||
|
||||
mulx 16($ap), %rbx, %r10
|
||||
movd 64(%rbp), %xmm5
|
||||
adcx %rax, %r8
|
||||
|
||||
mulx 24($ap), %rax, %r11
|
||||
pslldq \$4, %xmm5
|
||||
adcx %rbx, %r9
|
||||
|
||||
mulx 32($ap), %rbx, %r12
|
||||
por %xmm5, %xmm4
|
||||
adcx %rax, %r10
|
||||
|
||||
mulx 40($ap), %rax, %r13
|
||||
adcx %rbx, %r11
|
||||
|
||||
mulx 48($ap), %rbx, %r14
|
||||
lea 128(%rbp), %rbp
|
||||
adcx %rax, %r12
|
||||
|
||||
mulx 56($ap), %rax, %r15
|
||||
movq %xmm4, %rdx
|
||||
adcx %rbx, %r13
|
||||
adcx %rax, %r14
|
||||
.byte 0x67
|
||||
mov %r8, %rbx
|
||||
adcx %rdi, %r15 # %rdi is 0
|
||||
|
||||
@@ -1145,24 +1218,48 @@ $code.=<<___ if ($addx);
|
||||
|
||||
.align 32
|
||||
.Loop_mulx_gather:
|
||||
mulx ($ap), %rax, %r8
|
||||
movdqa 16*0(%rbp),%xmm8
|
||||
movdqa 16*1(%rbp),%xmm9
|
||||
movdqa 16*2(%rbp),%xmm10
|
||||
movdqa 16*3(%rbp),%xmm11
|
||||
pand %xmm0,%xmm8
|
||||
movdqa 16*4(%rbp),%xmm12
|
||||
pand %xmm1,%xmm9
|
||||
movdqa 16*5(%rbp),%xmm13
|
||||
pand %xmm2,%xmm10
|
||||
movdqa 16*6(%rbp),%xmm14
|
||||
pand %xmm3,%xmm11
|
||||
movdqa 16*7(%rbp),%xmm15
|
||||
leaq 128(%rbp), %rbp
|
||||
pand %xmm4,%xmm12
|
||||
pand %xmm5,%xmm13
|
||||
pand %xmm6,%xmm14
|
||||
pand %xmm7,%xmm15
|
||||
por %xmm10,%xmm8
|
||||
por %xmm11,%xmm9
|
||||
por %xmm12,%xmm8
|
||||
por %xmm13,%xmm9
|
||||
por %xmm14,%xmm8
|
||||
por %xmm15,%xmm9
|
||||
|
||||
por %xmm9,%xmm8
|
||||
pshufd \$0x4e,%xmm8,%xmm9
|
||||
por %xmm9,%xmm8
|
||||
movq %xmm8,%rdx
|
||||
|
||||
.byte 0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00 # mulx ($ap), %rax, %r8
|
||||
adcx %rax, %rbx
|
||||
adox %r9, %r8
|
||||
|
||||
mulx 8($ap), %rax, %r9
|
||||
.byte 0x66,0x0f,0x6e,0xa5,0x00,0x00,0x00,0x00 # movd (%rbp), %xmm4
|
||||
adcx %rax, %r8
|
||||
adox %r10, %r9
|
||||
|
||||
mulx 16($ap), %rax, %r10
|
||||
movd 64(%rbp), %xmm5
|
||||
lea 128(%rbp), %rbp
|
||||
adcx %rax, %r9
|
||||
adox %r11, %r10
|
||||
|
||||
.byte 0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00 # mulx 24($ap), %rax, %r11
|
||||
pslldq \$4, %xmm5
|
||||
por %xmm5, %xmm4
|
||||
adcx %rax, %r10
|
||||
adox %r12, %r11
|
||||
|
||||
@@ -1176,10 +1273,10 @@ $code.=<<___ if ($addx);
|
||||
|
||||
.byte 0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00 # mulx 48($ap), %rax, %r14
|
||||
adcx %rax, %r13
|
||||
.byte 0x67
|
||||
adox %r15, %r14
|
||||
|
||||
mulx 56($ap), %rax, %r15
|
||||
movq %xmm4, %rdx
|
||||
mov %rbx, 64(%rsp,%rcx,8)
|
||||
adcx %rax, %r14
|
||||
adox %rdi, %r15
|
||||
@@ -1198,10 +1295,10 @@ $code.=<<___ if ($addx);
|
||||
mov %r14, 64+48(%rsp)
|
||||
mov %r15, 64+56(%rsp)
|
||||
|
||||
movq %xmm0, $out
|
||||
movq %xmm1, %rbp
|
||||
mov 128(%rsp), %rdx # pull arguments
|
||||
mov 128+8(%rsp), $out
|
||||
mov 128+16(%rsp), %rbp
|
||||
|
||||
mov 128(%rsp), %rdx # pull $n0
|
||||
mov (%rsp), %r8
|
||||
mov 8(%rsp), %r9
|
||||
mov 16(%rsp), %r10
|
||||
@@ -1229,6 +1326,21 @@ $code.=<<___;
|
||||
call __rsaz_512_subtract
|
||||
|
||||
leaq 128+24+48(%rsp), %rax
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps 0xa0-0xc8(%rax),%xmm6
|
||||
movaps 0xb0-0xc8(%rax),%xmm7
|
||||
movaps 0xc0-0xc8(%rax),%xmm8
|
||||
movaps 0xd0-0xc8(%rax),%xmm9
|
||||
movaps 0xe0-0xc8(%rax),%xmm10
|
||||
movaps 0xf0-0xc8(%rax),%xmm11
|
||||
movaps 0x100-0xc8(%rax),%xmm12
|
||||
movaps 0x110-0xc8(%rax),%xmm13
|
||||
movaps 0x120-0xc8(%rax),%xmm14
|
||||
movaps 0x130-0xc8(%rax),%xmm15
|
||||
lea 0xb0(%rax),%rax
|
||||
___
|
||||
$code.=<<___;
|
||||
movq -48(%rax), %r15
|
||||
movq -40(%rax), %r14
|
||||
movq -32(%rax), %r13
|
||||
@@ -1258,7 +1370,7 @@ rsaz_512_mul_scatter4:
|
||||
mov $pwr, $pwr
|
||||
subq \$128+24, %rsp
|
||||
.Lmul_scatter4_body:
|
||||
leaq ($tbl,$pwr,4), $tbl
|
||||
leaq ($tbl,$pwr,8), $tbl
|
||||
movq $out, %xmm0 # off-load arguments
|
||||
movq $mod, %xmm1
|
||||
movq $tbl, %xmm2
|
||||
@@ -1329,30 +1441,14 @@ $code.=<<___;
|
||||
|
||||
call __rsaz_512_subtract
|
||||
|
||||
movl %r8d, 64*0($inp) # scatter
|
||||
shrq \$32, %r8
|
||||
movl %r9d, 64*2($inp)
|
||||
shrq \$32, %r9
|
||||
movl %r10d, 64*4($inp)
|
||||
shrq \$32, %r10
|
||||
movl %r11d, 64*6($inp)
|
||||
shrq \$32, %r11
|
||||
movl %r12d, 64*8($inp)
|
||||
shrq \$32, %r12
|
||||
movl %r13d, 64*10($inp)
|
||||
shrq \$32, %r13
|
||||
movl %r14d, 64*12($inp)
|
||||
shrq \$32, %r14
|
||||
movl %r15d, 64*14($inp)
|
||||
shrq \$32, %r15
|
||||
movl %r8d, 64*1($inp)
|
||||
movl %r9d, 64*3($inp)
|
||||
movl %r10d, 64*5($inp)
|
||||
movl %r11d, 64*7($inp)
|
||||
movl %r12d, 64*9($inp)
|
||||
movl %r13d, 64*11($inp)
|
||||
movl %r14d, 64*13($inp)
|
||||
movl %r15d, 64*15($inp)
|
||||
movq %r8, 128*0($inp) # scatter
|
||||
movq %r9, 128*1($inp)
|
||||
movq %r10, 128*2($inp)
|
||||
movq %r11, 128*3($inp)
|
||||
movq %r12, 128*4($inp)
|
||||
movq %r13, 128*5($inp)
|
||||
movq %r14, 128*6($inp)
|
||||
movq %r15, 128*7($inp)
|
||||
|
||||
leaq 128+24+48(%rsp), %rax
|
||||
movq -48(%rax), %r15
|
||||
@@ -1956,16 +2052,14 @@ $code.=<<___;
|
||||
.type rsaz_512_scatter4,\@abi-omnipotent
|
||||
.align 16
|
||||
rsaz_512_scatter4:
|
||||
leaq ($out,$power,4), $out
|
||||
leaq ($out,$power,8), $out
|
||||
movl \$8, %r9d
|
||||
jmp .Loop_scatter
|
||||
.align 16
|
||||
.Loop_scatter:
|
||||
movq ($inp), %rax
|
||||
leaq 8($inp), $inp
|
||||
movl %eax, ($out)
|
||||
shrq \$32, %rax
|
||||
movl %eax, 64($out)
|
||||
movq %rax, ($out)
|
||||
leaq 128($out), $out
|
||||
decl %r9d
|
||||
jnz .Loop_scatter
|
||||
@@ -1976,22 +2070,106 @@ rsaz_512_scatter4:
|
||||
.type rsaz_512_gather4,\@abi-omnipotent
|
||||
.align 16
|
||||
rsaz_512_gather4:
|
||||
leaq ($inp,$power,4), $inp
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
.LSEH_begin_rsaz_512_gather4:
|
||||
.byte 0x48,0x81,0xec,0xa8,0x00,0x00,0x00 # sub $0xa8,%rsp
|
||||
.byte 0x0f,0x29,0x34,0x24 # movaps %xmm6,(%rsp)
|
||||
.byte 0x0f,0x29,0x7c,0x24,0x10 # movaps %xmm7,0x10(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x44,0x24,0x20 # movaps %xmm8,0x20(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x4c,0x24,0x30 # movaps %xmm9,0x30(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x54,0x24,0x40 # movaps %xmm10,0x40(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x5c,0x24,0x50 # movaps %xmm11,0x50(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x64,0x24,0x60 # movaps %xmm12,0x60(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0x6c,0x24,0x70 # movaps %xmm13,0x70(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0xb4,0x24,0x80,0,0,0 # movaps %xmm14,0x80(%rsp)
|
||||
.byte 0x44,0x0f,0x29,0xbc,0x24,0x90,0,0,0 # movaps %xmm15,0x90(%rsp)
|
||||
___
|
||||
$code.=<<___;
|
||||
movd $power,%xmm8
|
||||
movdqa .Linc+16(%rip),%xmm1 # 00000002000000020000000200000002
|
||||
movdqa .Linc(%rip),%xmm0 # 00000001000000010000000000000000
|
||||
|
||||
pshufd \$0,%xmm8,%xmm8 # broadcast $power
|
||||
movdqa %xmm1,%xmm7
|
||||
movdqa %xmm1,%xmm2
|
||||
___
|
||||
########################################################################
|
||||
# calculate mask by comparing 0..15 to $power
|
||||
#
|
||||
for($i=0;$i<4;$i++) {
|
||||
$code.=<<___;
|
||||
paddd %xmm`$i`,%xmm`$i+1`
|
||||
pcmpeqd %xmm8,%xmm`$i`
|
||||
movdqa %xmm7,%xmm`$i+3`
|
||||
___
|
||||
}
|
||||
for(;$i<7;$i++) {
|
||||
$code.=<<___;
|
||||
paddd %xmm`$i`,%xmm`$i+1`
|
||||
pcmpeqd %xmm8,%xmm`$i`
|
||||
___
|
||||
}
|
||||
$code.=<<___;
|
||||
pcmpeqd %xmm8,%xmm7
|
||||
movl \$8, %r9d
|
||||
jmp .Loop_gather
|
||||
.align 16
|
||||
.Loop_gather:
|
||||
movl ($inp), %eax
|
||||
movl 64($inp), %r8d
|
||||
movdqa 16*0($inp),%xmm8
|
||||
movdqa 16*1($inp),%xmm9
|
||||
movdqa 16*2($inp),%xmm10
|
||||
movdqa 16*3($inp),%xmm11
|
||||
pand %xmm0,%xmm8
|
||||
movdqa 16*4($inp),%xmm12
|
||||
pand %xmm1,%xmm9
|
||||
movdqa 16*5($inp),%xmm13
|
||||
pand %xmm2,%xmm10
|
||||
movdqa 16*6($inp),%xmm14
|
||||
pand %xmm3,%xmm11
|
||||
movdqa 16*7($inp),%xmm15
|
||||
leaq 128($inp), $inp
|
||||
shlq \$32, %r8
|
||||
or %r8, %rax
|
||||
movq %rax, ($out)
|
||||
pand %xmm4,%xmm12
|
||||
pand %xmm5,%xmm13
|
||||
pand %xmm6,%xmm14
|
||||
pand %xmm7,%xmm15
|
||||
por %xmm10,%xmm8
|
||||
por %xmm11,%xmm9
|
||||
por %xmm12,%xmm8
|
||||
por %xmm13,%xmm9
|
||||
por %xmm14,%xmm8
|
||||
por %xmm15,%xmm9
|
||||
|
||||
por %xmm9,%xmm8
|
||||
pshufd \$0x4e,%xmm8,%xmm9
|
||||
por %xmm9,%xmm8
|
||||
movq %xmm8,($out)
|
||||
leaq 8($out), $out
|
||||
decl %r9d
|
||||
jnz .Loop_gather
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
movaps 0x00(%rsp),%xmm6
|
||||
movaps 0x10(%rsp),%xmm7
|
||||
movaps 0x20(%rsp),%xmm8
|
||||
movaps 0x30(%rsp),%xmm9
|
||||
movaps 0x40(%rsp),%xmm10
|
||||
movaps 0x50(%rsp),%xmm11
|
||||
movaps 0x60(%rsp),%xmm12
|
||||
movaps 0x70(%rsp),%xmm13
|
||||
movaps 0x80(%rsp),%xmm14
|
||||
movaps 0x90(%rsp),%xmm15
|
||||
add \$0xa8,%rsp
|
||||
___
|
||||
$code.=<<___;
|
||||
ret
|
||||
.LSEH_end_rsaz_512_gather4:
|
||||
.size rsaz_512_gather4,.-rsaz_512_gather4
|
||||
|
||||
.align 64
|
||||
.Linc:
|
||||
.long 0,0, 1,1
|
||||
.long 2,2, 2,2
|
||||
___
|
||||
}
|
||||
|
||||
@@ -2039,6 +2217,18 @@ se_handler:
|
||||
|
||||
lea 128+24+48(%rax),%rax
|
||||
|
||||
lea .Lmul_gather4_epilogue(%rip),%rbx
|
||||
cmp %r10,%rbx
|
||||
jne .Lse_not_in_mul_gather4
|
||||
|
||||
lea 0xb0(%rax),%rax
|
||||
|
||||
lea -48-0xa8(%rax),%rsi
|
||||
lea 512($context),%rdi
|
||||
mov \$20,%ecx
|
||||
.long 0xa548f3fc # cld; rep movsq
|
||||
|
||||
.Lse_not_in_mul_gather4:
|
||||
mov -8(%rax),%rbx
|
||||
mov -16(%rax),%rbp
|
||||
mov -24(%rax),%r12
|
||||
@@ -2090,7 +2280,7 @@ se_handler:
|
||||
pop %rdi
|
||||
pop %rsi
|
||||
ret
|
||||
.size sqr_handler,.-sqr_handler
|
||||
.size se_handler,.-se_handler
|
||||
|
||||
.section .pdata
|
||||
.align 4
|
||||
@@ -2114,6 +2304,10 @@ se_handler:
|
||||
.rva .LSEH_end_rsaz_512_mul_by_one
|
||||
.rva .LSEH_info_rsaz_512_mul_by_one
|
||||
|
||||
.rva .LSEH_begin_rsaz_512_gather4
|
||||
.rva .LSEH_end_rsaz_512_gather4
|
||||
.rva .LSEH_info_rsaz_512_gather4
|
||||
|
||||
.section .xdata
|
||||
.align 8
|
||||
.LSEH_info_rsaz_512_sqr:
|
||||
@@ -2136,6 +2330,19 @@ se_handler:
|
||||
.byte 9,0,0,0
|
||||
.rva se_handler
|
||||
.rva .Lmul_by_one_body,.Lmul_by_one_epilogue # HandlerData[]
|
||||
.LSEH_info_rsaz_512_gather4:
|
||||
.byte 0x01,0x46,0x16,0x00
|
||||
.byte 0x46,0xf8,0x09,0x00 # vmovaps 0x90(rsp),xmm15
|
||||
.byte 0x3d,0xe8,0x08,0x00 # vmovaps 0x80(rsp),xmm14
|
||||
.byte 0x34,0xd8,0x07,0x00 # vmovaps 0x70(rsp),xmm13
|
||||
.byte 0x2e,0xc8,0x06,0x00 # vmovaps 0x60(rsp),xmm12
|
||||
.byte 0x28,0xb8,0x05,0x00 # vmovaps 0x50(rsp),xmm11
|
||||
.byte 0x22,0xa8,0x04,0x00 # vmovaps 0x40(rsp),xmm10
|
||||
.byte 0x1c,0x98,0x03,0x00 # vmovaps 0x30(rsp),xmm9
|
||||
.byte 0x16,0x88,0x02,0x00 # vmovaps 0x20(rsp),xmm8
|
||||
.byte 0x10,0x78,0x01,0x00 # vmovaps 0x10(rsp),xmm7
|
||||
.byte 0x0b,0x68,0x00,0x00 # vmovaps 0x00(rsp),xmm6
|
||||
.byte 0x07,0x01,0x15,0x00 # sub rsp,0xa8
|
||||
___
|
||||
}
|
||||
|
||||
|
@@ -172,19 +172,19 @@ ___
|
||||
if ($SIZE_T==8) {
|
||||
my @r=map("%r$_",(6..9));
|
||||
$code.=<<___;
|
||||
bras $ra,_mul_1x1 # a1<EFBFBD>b1
|
||||
bras $ra,_mul_1x1 # a1·b1
|
||||
stmg $lo,$hi,16($rp)
|
||||
|
||||
lg $a,`$stdframe+128+4*$SIZE_T`($sp)
|
||||
lg $b,`$stdframe+128+6*$SIZE_T`($sp)
|
||||
bras $ra,_mul_1x1 # a0<EFBFBD>b0
|
||||
bras $ra,_mul_1x1 # a0·b0
|
||||
stmg $lo,$hi,0($rp)
|
||||
|
||||
lg $a,`$stdframe+128+3*$SIZE_T`($sp)
|
||||
lg $b,`$stdframe+128+5*$SIZE_T`($sp)
|
||||
xg $a,`$stdframe+128+4*$SIZE_T`($sp)
|
||||
xg $b,`$stdframe+128+6*$SIZE_T`($sp)
|
||||
bras $ra,_mul_1x1 # (a0+a1)<EFBFBD>(b0+b1)
|
||||
bras $ra,_mul_1x1 # (a0+a1)·(b0+b1)
|
||||
lmg @r[0],@r[3],0($rp)
|
||||
|
||||
xgr $lo,$hi
|
||||
|
@@ -18,71 +18,106 @@
|
||||
.align 4
|
||||
bn_mul_add_words:
|
||||
lghi zero,0 // zero = 0
|
||||
la %r1,0(%r2) // put rp aside
|
||||
lghi %r2,0 // i=0;
|
||||
la %r1,0(%r2) // put rp aside [to give way to]
|
||||
lghi %r2,0 // return value
|
||||
ltgfr %r4,%r4
|
||||
bler %r14 // if (len<=0) return 0;
|
||||
|
||||
stmg %r6,%r10,48(%r15)
|
||||
lghi %r10,3
|
||||
lghi %r8,0 // carry = 0
|
||||
nr %r10,%r4 // len%4
|
||||
stmg %r6,%r13,48(%r15)
|
||||
lghi %r2,3
|
||||
lghi %r12,0 // carry = 0
|
||||
slgr %r1,%r3 // rp-=ap
|
||||
nr %r2,%r4 // len%4
|
||||
sra %r4,2 // cnt=len/4
|
||||
jz .Loop1_madd // carry is incidentally cleared if branch taken
|
||||
algr zero,zero // clear carry
|
||||
|
||||
.Loop4_madd:
|
||||
lg %r7,0(%r2,%r3) // ap[i]
|
||||
lg %r7,0(%r3) // ap[0]
|
||||
lg %r9,8(%r3) // ap[1]
|
||||
mlgr %r6,%r5 // *=w
|
||||
alcgr %r7,%r8 // +=carry
|
||||
alcgr %r6,zero
|
||||
alg %r7,0(%r2,%r1) // +=rp[i]
|
||||
stg %r7,0(%r2,%r1) // rp[i]=
|
||||
brct %r4,.Loop4_madd
|
||||
j .Loop4_madd_tail
|
||||
|
||||
lg %r9,8(%r2,%r3)
|
||||
.Loop4_madd:
|
||||
mlgr %r8,%r5
|
||||
lg %r11,16(%r3) // ap[i+2]
|
||||
alcgr %r7,%r12 // +=carry
|
||||
alcgr %r6,zero
|
||||
alg %r7,0(%r3,%r1) // +=rp[i]
|
||||
stg %r7,0(%r3,%r1) // rp[i]=
|
||||
|
||||
mlgr %r10,%r5
|
||||
lg %r13,24(%r3)
|
||||
alcgr %r9,%r6
|
||||
alcgr %r8,zero
|
||||
alg %r9,8(%r2,%r1)
|
||||
stg %r9,8(%r2,%r1)
|
||||
alg %r9,8(%r3,%r1)
|
||||
stg %r9,8(%r3,%r1)
|
||||
|
||||
mlgr %r12,%r5
|
||||
lg %r7,32(%r3)
|
||||
alcgr %r11,%r8
|
||||
alcgr %r10,zero
|
||||
alg %r11,16(%r3,%r1)
|
||||
stg %r11,16(%r3,%r1)
|
||||
|
||||
lg %r7,16(%r2,%r3)
|
||||
mlgr %r6,%r5
|
||||
alcgr %r7,%r8
|
||||
alcgr %r6,zero
|
||||
alg %r7,16(%r2,%r1)
|
||||
stg %r7,16(%r2,%r1)
|
||||
lg %r9,40(%r3)
|
||||
alcgr %r13,%r10
|
||||
alcgr %r12,zero
|
||||
alg %r13,24(%r3,%r1)
|
||||
stg %r13,24(%r3,%r1)
|
||||
|
||||
lg %r9,24(%r2,%r3)
|
||||
mlgr %r8,%r5
|
||||
alcgr %r9,%r6
|
||||
alcgr %r8,zero
|
||||
alg %r9,24(%r2,%r1)
|
||||
stg %r9,24(%r2,%r1)
|
||||
|
||||
la %r2,32(%r2) // i+=4
|
||||
la %r3,32(%r3) // i+=4
|
||||
brct %r4,.Loop4_madd
|
||||
|
||||
la %r10,1(%r10) // see if len%4 is zero ...
|
||||
brct %r10,.Loop1_madd // without touching condition code:-)
|
||||
.Loop4_madd_tail:
|
||||
mlgr %r8,%r5
|
||||
lg %r11,16(%r3)
|
||||
alcgr %r7,%r12 // +=carry
|
||||
alcgr %r6,zero
|
||||
alg %r7,0(%r3,%r1) // +=rp[i]
|
||||
stg %r7,0(%r3,%r1) // rp[i]=
|
||||
|
||||
mlgr %r10,%r5
|
||||
lg %r13,24(%r3)
|
||||
alcgr %r9,%r6
|
||||
alcgr %r8,zero
|
||||
alg %r9,8(%r3,%r1)
|
||||
stg %r9,8(%r3,%r1)
|
||||
|
||||
mlgr %r12,%r5
|
||||
alcgr %r11,%r8
|
||||
alcgr %r10,zero
|
||||
alg %r11,16(%r3,%r1)
|
||||
stg %r11,16(%r3,%r1)
|
||||
|
||||
alcgr %r13,%r10
|
||||
alcgr %r12,zero
|
||||
alg %r13,24(%r3,%r1)
|
||||
stg %r13,24(%r3,%r1)
|
||||
|
||||
la %r3,32(%r3) // i+=4
|
||||
|
||||
la %r2,1(%r2) // see if len%4 is zero ...
|
||||
brct %r2,.Loop1_madd // without touching condition code:-)
|
||||
|
||||
.Lend_madd:
|
||||
alcgr %r8,zero // collect carry bit
|
||||
lgr %r2,%r8
|
||||
lmg %r6,%r10,48(%r15)
|
||||
lgr %r2,zero // return value
|
||||
alcgr %r2,%r12 // collect even carry bit
|
||||
lmg %r6,%r13,48(%r15)
|
||||
br %r14
|
||||
|
||||
.Loop1_madd:
|
||||
lg %r7,0(%r2,%r3) // ap[i]
|
||||
lg %r7,0(%r3) // ap[i]
|
||||
mlgr %r6,%r5 // *=w
|
||||
alcgr %r7,%r8 // +=carry
|
||||
alcgr %r7,%r12 // +=carry
|
||||
alcgr %r6,zero
|
||||
alg %r7,0(%r2,%r1) // +=rp[i]
|
||||
stg %r7,0(%r2,%r1) // rp[i]=
|
||||
alg %r7,0(%r3,%r1) // +=rp[i]
|
||||
stg %r7,0(%r3,%r1) // rp[i]=
|
||||
|
||||
lgr %r8,%r6
|
||||
la %r2,8(%r2) // i++
|
||||
brct %r10,.Loop1_madd
|
||||
lgr %r12,%r6
|
||||
la %r3,8(%r3) // i++
|
||||
brct %r2,.Loop1_madd
|
||||
|
||||
j .Lend_madd
|
||||
.size bn_mul_add_words,.-bn_mul_add_words
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# the time being... Except that it has three code paths: pure integer
|
||||
# code suitable for any x86 CPU, MMX code suitable for PIII and later
|
||||
# and PCLMULQDQ suitable for Westmere and later. Improvement varies
|
||||
# from one benchmark and <EFBFBD>-arch to another. Below are interval values
|
||||
# from one benchmark and µ-arch to another. Below are interval values
|
||||
# for 163- and 571-bit ECDH benchmarks relative to compiler-generated
|
||||
# code:
|
||||
#
|
||||
@@ -226,22 +226,22 @@ if ($sse2) {
|
||||
&push ("edi");
|
||||
&mov ($a,&wparam(1));
|
||||
&mov ($b,&wparam(3));
|
||||
&call ("_mul_1x1_mmx"); # a1<EFBFBD>b1
|
||||
&call ("_mul_1x1_mmx"); # a1·b1
|
||||
&movq ("mm7",$R);
|
||||
|
||||
&mov ($a,&wparam(2));
|
||||
&mov ($b,&wparam(4));
|
||||
&call ("_mul_1x1_mmx"); # a0<EFBFBD>b0
|
||||
&call ("_mul_1x1_mmx"); # a0·b0
|
||||
&movq ("mm6",$R);
|
||||
|
||||
&mov ($a,&wparam(1));
|
||||
&mov ($b,&wparam(3));
|
||||
&xor ($a,&wparam(2));
|
||||
&xor ($b,&wparam(4));
|
||||
&call ("_mul_1x1_mmx"); # (a0+a1)<EFBFBD>(b0+b1)
|
||||
&call ("_mul_1x1_mmx"); # (a0+a1)·(b0+b1)
|
||||
&pxor ($R,"mm7");
|
||||
&mov ($a,&wparam(0));
|
||||
&pxor ($R,"mm6"); # (a0+a1)<EFBFBD>(b0+b1)-a1<EFBFBD>b1-a0<EFBFBD>b0
|
||||
&pxor ($R,"mm6"); # (a0+a1)·(b0+b1)-a1·b1-a0·b0
|
||||
|
||||
&movq ($A,$R);
|
||||
&psllq ($R,32);
|
||||
@@ -266,13 +266,13 @@ if ($sse2) {
|
||||
|
||||
&mov ($a,&wparam(1));
|
||||
&mov ($b,&wparam(3));
|
||||
&call ("_mul_1x1_ialu"); # a1<EFBFBD>b1
|
||||
&call ("_mul_1x1_ialu"); # a1·b1
|
||||
&mov (&DWP(8,"esp"),$lo);
|
||||
&mov (&DWP(12,"esp"),$hi);
|
||||
|
||||
&mov ($a,&wparam(2));
|
||||
&mov ($b,&wparam(4));
|
||||
&call ("_mul_1x1_ialu"); # a0<EFBFBD>b0
|
||||
&call ("_mul_1x1_ialu"); # a0·b0
|
||||
&mov (&DWP(0,"esp"),$lo);
|
||||
&mov (&DWP(4,"esp"),$hi);
|
||||
|
||||
@@ -280,7 +280,7 @@ if ($sse2) {
|
||||
&mov ($b,&wparam(3));
|
||||
&xor ($a,&wparam(2));
|
||||
&xor ($b,&wparam(4));
|
||||
&call ("_mul_1x1_ialu"); # (a0+a1)<EFBFBD>(b0+b1)
|
||||
&call ("_mul_1x1_ialu"); # (a0+a1)·(b0+b1)
|
||||
|
||||
&mov ("ebp",&wparam(0));
|
||||
@r=("ebx","ecx","edi","esi");
|
||||
|
@@ -65,7 +65,7 @@
|
||||
# undef mul_add
|
||||
|
||||
/*-
|
||||
* "m"(a), "+m"(r) is the way to favor DirectPath <EFBFBD>-code;
|
||||
* "m"(a), "+m"(r) is the way to favor DirectPath µ-code;
|
||||
* "g"(0) let the compiler to decide where does it
|
||||
* want to keep the value of zero;
|
||||
*/
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# in bn_gf2m.c. It's kind of low-hanging mechanical port from C for
|
||||
# the time being... Except that it has two code paths: code suitable
|
||||
# for any x86_64 CPU and PCLMULQDQ one suitable for Westmere and
|
||||
# later. Improvement varies from one benchmark and <EFBFBD>-arch to another.
|
||||
# later. Improvement varies from one benchmark and µ-arch to another.
|
||||
# Vanilla code path is at most 20% faster than compiler-generated code
|
||||
# [not very impressive], while PCLMULQDQ - whole 85%-160% better on
|
||||
# 163- and 571-bit ECDH benchmarks on Intel CPUs. Keep in mind that
|
||||
@@ -184,13 +184,13 @@ ___
|
||||
$code.=<<___;
|
||||
movdqa %xmm0,%xmm4
|
||||
movdqa %xmm1,%xmm5
|
||||
pclmulqdq \$0,%xmm1,%xmm0 # a1<EFBFBD>b1
|
||||
pclmulqdq \$0,%xmm1,%xmm0 # a1·b1
|
||||
pxor %xmm2,%xmm4
|
||||
pxor %xmm3,%xmm5
|
||||
pclmulqdq \$0,%xmm3,%xmm2 # a0<EFBFBD>b0
|
||||
pclmulqdq \$0,%xmm5,%xmm4 # (a0+a1)<EFBFBD>(b0+b1)
|
||||
pclmulqdq \$0,%xmm3,%xmm2 # a0·b0
|
||||
pclmulqdq \$0,%xmm5,%xmm4 # (a0+a1)·(b0+b1)
|
||||
xorps %xmm0,%xmm4
|
||||
xorps %xmm2,%xmm4 # (a0+a1)<EFBFBD>(b0+b1)-a0<EFBFBD>b0-a1<EFBFBD>b1
|
||||
xorps %xmm2,%xmm4 # (a0+a1)·(b0+b1)-a0·b0-a1·b1
|
||||
movdqa %xmm4,%xmm5
|
||||
pslldq \$8,%xmm4
|
||||
psrldq \$8,%xmm5
|
||||
@@ -225,13 +225,13 @@ $code.=<<___;
|
||||
mov \$0xf,$mask
|
||||
mov $a1,$a
|
||||
mov $b1,$b
|
||||
call _mul_1x1 # a1<EFBFBD>b1
|
||||
call _mul_1x1 # a1·b1
|
||||
mov $lo,16(%rsp)
|
||||
mov $hi,24(%rsp)
|
||||
|
||||
mov 48(%rsp),$a
|
||||
mov 64(%rsp),$b
|
||||
call _mul_1x1 # a0<EFBFBD>b0
|
||||
call _mul_1x1 # a0·b0
|
||||
mov $lo,0(%rsp)
|
||||
mov $hi,8(%rsp)
|
||||
|
||||
@@ -239,7 +239,7 @@ $code.=<<___;
|
||||
mov 56(%rsp),$b
|
||||
xor 48(%rsp),$a
|
||||
xor 64(%rsp),$b
|
||||
call _mul_1x1 # (a0+a1)<EFBFBD>(b0+b1)
|
||||
call _mul_1x1 # (a0+a1)·(b0+b1)
|
||||
___
|
||||
@r=("%rbx","%rcx","%rdi","%rsi");
|
||||
$code.=<<___;
|
||||
|
@@ -68,6 +68,11 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$addx = ($1>=12);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
|
||||
my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
# int bn_mul_mont(
|
||||
$rp="%rdi"; # BN_ULONG *rp,
|
||||
$ap="%rsi"; # const BN_ULONG *ap,
|
||||
@@ -770,100 +775,126 @@ bn_sqr8x_mont:
|
||||
# 4096. this is done to allow memory disambiguation logic
|
||||
# do its job.
|
||||
#
|
||||
lea -64(%rsp,$num,4),%r11
|
||||
lea -64(%rsp,$num,2),%r11
|
||||
mov ($n0),$n0 # *n0
|
||||
sub $aptr,%r11
|
||||
and \$4095,%r11
|
||||
cmp %r11,%r10
|
||||
jb .Lsqr8x_sp_alt
|
||||
sub %r11,%rsp # align with $aptr
|
||||
lea -64(%rsp,$num,4),%rsp # alloca(frame+4*$num)
|
||||
lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num)
|
||||
jmp .Lsqr8x_sp_done
|
||||
|
||||
.align 32
|
||||
.Lsqr8x_sp_alt:
|
||||
lea 4096-64(,$num,4),%r10 # 4096-frame-4*$num
|
||||
lea -64(%rsp,$num,4),%rsp # alloca(frame+4*$num)
|
||||
lea 4096-64(,$num,2),%r10 # 4096-frame-2*$num
|
||||
lea -64(%rsp,$num,2),%rsp # alloca(frame+2*$num)
|
||||
sub %r10,%r11
|
||||
mov \$0,%r10
|
||||
cmovc %r10,%r11
|
||||
sub %r11,%rsp
|
||||
.Lsqr8x_sp_done:
|
||||
and \$-64,%rsp
|
||||
mov $num,%r10
|
||||
mov $num,%r10
|
||||
neg $num
|
||||
|
||||
lea 64(%rsp,$num,2),%r11 # copy of modulus
|
||||
mov $n0, 32(%rsp)
|
||||
mov %rax, 40(%rsp) # save original %rsp
|
||||
.Lsqr8x_body:
|
||||
|
||||
mov $num,$i
|
||||
movq %r11, %xmm2 # save pointer to modulus copy
|
||||
shr \$3+2,$i
|
||||
mov OPENSSL_ia32cap_P+8(%rip),%eax
|
||||
jmp .Lsqr8x_copy_n
|
||||
|
||||
.align 32
|
||||
.Lsqr8x_copy_n:
|
||||
movq 8*0($nptr),%xmm0
|
||||
movq 8*1($nptr),%xmm1
|
||||
movq 8*2($nptr),%xmm3
|
||||
movq 8*3($nptr),%xmm4
|
||||
lea 8*4($nptr),$nptr
|
||||
movdqa %xmm0,16*0(%r11)
|
||||
movdqa %xmm1,16*1(%r11)
|
||||
movdqa %xmm3,16*2(%r11)
|
||||
movdqa %xmm4,16*3(%r11)
|
||||
lea 16*4(%r11),%r11
|
||||
dec $i
|
||||
jnz .Lsqr8x_copy_n
|
||||
|
||||
movq $nptr, %xmm2 # save pointer to modulus
|
||||
pxor %xmm0,%xmm0
|
||||
movq $rptr,%xmm1 # save $rptr
|
||||
movq %r10, %xmm3 # -$num
|
||||
___
|
||||
$code.=<<___ if ($addx);
|
||||
mov OPENSSL_ia32cap_P+8(%rip),%eax
|
||||
and \$0x80100,%eax
|
||||
cmp \$0x80100,%eax
|
||||
jne .Lsqr8x_nox
|
||||
|
||||
call bn_sqrx8x_internal # see x86_64-mont5 module
|
||||
|
||||
pxor %xmm0,%xmm0
|
||||
lea 48(%rsp),%rax
|
||||
lea 64(%rsp,$num,2),%rdx
|
||||
shr \$3+2,$num
|
||||
mov 40(%rsp),%rsi # restore %rsp
|
||||
jmp .Lsqr8x_zero
|
||||
# %rax top-most carry
|
||||
# %rbp nptr
|
||||
# %rcx -8*num
|
||||
# %r8 end of tp[2*num]
|
||||
lea (%r8,%rcx),%rbx
|
||||
mov %rcx,$num
|
||||
mov %rcx,%rdx
|
||||
movq %xmm1,$rptr
|
||||
sar \$3+2,%rcx # %cf=0
|
||||
jmp .Lsqr8x_sub
|
||||
|
||||
.align 32
|
||||
.Lsqr8x_nox:
|
||||
___
|
||||
$code.=<<___;
|
||||
call bn_sqr8x_internal # see x86_64-mont5 module
|
||||
|
||||
pxor %xmm0,%xmm0
|
||||
lea 48(%rsp),%rax
|
||||
lea 64(%rsp,$num,2),%rdx
|
||||
shr \$3+2,$num
|
||||
mov 40(%rsp),%rsi # restore %rsp
|
||||
jmp .Lsqr8x_zero
|
||||
# %rax top-most carry
|
||||
# %rbp nptr
|
||||
# %r8 -8*num
|
||||
# %rdi end of tp[2*num]
|
||||
lea (%rdi,$num),%rbx
|
||||
mov $num,%rcx
|
||||
mov $num,%rdx
|
||||
movq %xmm1,$rptr
|
||||
sar \$3+2,%rcx # %cf=0
|
||||
jmp .Lsqr8x_sub
|
||||
|
||||
.align 32
|
||||
.Lsqr8x_zero:
|
||||
movdqa %xmm0,16*0(%rax) # wipe t
|
||||
movdqa %xmm0,16*1(%rax)
|
||||
movdqa %xmm0,16*2(%rax)
|
||||
movdqa %xmm0,16*3(%rax)
|
||||
lea 16*4(%rax),%rax
|
||||
movdqa %xmm0,16*0(%rdx) # wipe n
|
||||
movdqa %xmm0,16*1(%rdx)
|
||||
movdqa %xmm0,16*2(%rdx)
|
||||
movdqa %xmm0,16*3(%rdx)
|
||||
lea 16*4(%rdx),%rdx
|
||||
dec $num
|
||||
jnz .Lsqr8x_zero
|
||||
.Lsqr8x_sub:
|
||||
mov 8*0(%rbx),%r12
|
||||
mov 8*1(%rbx),%r13
|
||||
mov 8*2(%rbx),%r14
|
||||
mov 8*3(%rbx),%r15
|
||||
lea 8*4(%rbx),%rbx
|
||||
sbb 8*0(%rbp),%r12
|
||||
sbb 8*1(%rbp),%r13
|
||||
sbb 8*2(%rbp),%r14
|
||||
sbb 8*3(%rbp),%r15
|
||||
lea 8*4(%rbp),%rbp
|
||||
mov %r12,8*0($rptr)
|
||||
mov %r13,8*1($rptr)
|
||||
mov %r14,8*2($rptr)
|
||||
mov %r15,8*3($rptr)
|
||||
lea 8*4($rptr),$rptr
|
||||
inc %rcx # preserves %cf
|
||||
jnz .Lsqr8x_sub
|
||||
|
||||
sbb \$0,%rax # top-most carry
|
||||
lea (%rbx,$num),%rbx # rewind
|
||||
lea ($rptr,$num),$rptr # rewind
|
||||
|
||||
movq %rax,%xmm1
|
||||
pxor %xmm0,%xmm0
|
||||
pshufd \$0,%xmm1,%xmm1
|
||||
mov 40(%rsp),%rsi # restore %rsp
|
||||
jmp .Lsqr8x_cond_copy
|
||||
|
||||
.align 32
|
||||
.Lsqr8x_cond_copy:
|
||||
movdqa 16*0(%rbx),%xmm2
|
||||
movdqa 16*1(%rbx),%xmm3
|
||||
lea 16*2(%rbx),%rbx
|
||||
movdqu 16*0($rptr),%xmm4
|
||||
movdqu 16*1($rptr),%xmm5
|
||||
lea 16*2($rptr),$rptr
|
||||
movdqa %xmm0,-16*2(%rbx) # zero tp
|
||||
movdqa %xmm0,-16*1(%rbx)
|
||||
movdqa %xmm0,-16*2(%rbx,%rdx)
|
||||
movdqa %xmm0,-16*1(%rbx,%rdx)
|
||||
pcmpeqd %xmm1,%xmm0
|
||||
pand %xmm1,%xmm2
|
||||
pand %xmm1,%xmm3
|
||||
pand %xmm0,%xmm4
|
||||
pand %xmm0,%xmm5
|
||||
pxor %xmm0,%xmm0
|
||||
por %xmm2,%xmm4
|
||||
por %xmm3,%xmm5
|
||||
movdqu %xmm4,-16*2($rptr)
|
||||
movdqu %xmm5,-16*1($rptr)
|
||||
add \$32,$num
|
||||
jnz .Lsqr8x_cond_copy
|
||||
|
||||
mov \$1,%rax
|
||||
mov -48(%rsi),%r15
|
||||
@@ -1130,64 +1161,75 @@ $code.=<<___;
|
||||
adc $zero,%r15 # modulo-scheduled
|
||||
sub 0*8($tptr),$zero # pull top-most carry
|
||||
adc %r15,%r14
|
||||
mov -8($nptr),$mi
|
||||
sbb %r15,%r15 # top-most carry
|
||||
mov %r14,-1*8($tptr)
|
||||
|
||||
cmp 16(%rsp),$bptr
|
||||
jne .Lmulx4x_outer
|
||||
|
||||
sub %r14,$mi # compare top-most words
|
||||
sbb $mi,$mi
|
||||
or $mi,%r15
|
||||
|
||||
neg $num
|
||||
xor %rdx,%rdx
|
||||
mov 32(%rsp),$rptr # restore rp
|
||||
lea 64(%rsp),$tptr
|
||||
|
||||
pxor %xmm0,%xmm0
|
||||
mov 0*8($nptr,$num),%r8
|
||||
mov 1*8($nptr,$num),%r9
|
||||
neg %r8
|
||||
jmp .Lmulx4x_sub_entry
|
||||
sub $num,$nptr # rewind $nptr
|
||||
neg %r15
|
||||
mov $num,%rdx
|
||||
shr \$3+2,$num # %cf=0
|
||||
mov 32(%rsp),$rptr # restore rp
|
||||
jmp .Lmulx4x_sub
|
||||
|
||||
.align 32
|
||||
.Lmulx4x_sub:
|
||||
mov 0*8($nptr,$num),%r8
|
||||
mov 1*8($nptr,$num),%r9
|
||||
not %r8
|
||||
.Lmulx4x_sub_entry:
|
||||
mov 2*8($nptr,$num),%r10
|
||||
not %r9
|
||||
and %r15,%r8
|
||||
mov 3*8($nptr,$num),%r11
|
||||
not %r10
|
||||
and %r15,%r9
|
||||
not %r11
|
||||
and %r15,%r10
|
||||
and %r15,%r11
|
||||
|
||||
neg %rdx # mov %rdx,%cf
|
||||
adc 0*8($tptr),%r8
|
||||
adc 1*8($tptr),%r9
|
||||
movdqa %xmm0,($tptr)
|
||||
adc 2*8($tptr),%r10
|
||||
adc 3*8($tptr),%r11
|
||||
movdqa %xmm0,16($tptr)
|
||||
lea 4*8($tptr),$tptr
|
||||
sbb %rdx,%rdx # mov %cf,%rdx
|
||||
|
||||
mov %r8,0*8($rptr)
|
||||
mov %r9,1*8($rptr)
|
||||
mov %r10,2*8($rptr)
|
||||
mov %r11,3*8($rptr)
|
||||
lea 4*8($rptr),$rptr
|
||||
|
||||
add \$32,$num
|
||||
mov 8*0($tptr),%r11
|
||||
mov 8*1($tptr),%r12
|
||||
mov 8*2($tptr),%r13
|
||||
mov 8*3($tptr),%r14
|
||||
lea 8*4($tptr),$tptr
|
||||
sbb 8*0($nptr),%r11
|
||||
sbb 8*1($nptr),%r12
|
||||
sbb 8*2($nptr),%r13
|
||||
sbb 8*3($nptr),%r14
|
||||
lea 8*4($nptr),$nptr
|
||||
mov %r11,8*0($rptr)
|
||||
mov %r12,8*1($rptr)
|
||||
mov %r13,8*2($rptr)
|
||||
mov %r14,8*3($rptr)
|
||||
lea 8*4($rptr),$rptr
|
||||
dec $num # preserves %cf
|
||||
jnz .Lmulx4x_sub
|
||||
|
||||
sbb \$0,%r15 # top-most carry
|
||||
lea 64(%rsp),$tptr
|
||||
sub %rdx,$rptr # rewind
|
||||
|
||||
movq %r15,%xmm1
|
||||
pxor %xmm0,%xmm0
|
||||
pshufd \$0,%xmm1,%xmm1
|
||||
mov 40(%rsp),%rsi # restore %rsp
|
||||
jmp .Lmulx4x_cond_copy
|
||||
|
||||
.align 32
|
||||
.Lmulx4x_cond_copy:
|
||||
movdqa 16*0($tptr),%xmm2
|
||||
movdqa 16*1($tptr),%xmm3
|
||||
lea 16*2($tptr),$tptr
|
||||
movdqu 16*0($rptr),%xmm4
|
||||
movdqu 16*1($rptr),%xmm5
|
||||
lea 16*2($rptr),$rptr
|
||||
movdqa %xmm0,-16*2($tptr) # zero tp
|
||||
movdqa %xmm0,-16*1($tptr)
|
||||
pcmpeqd %xmm1,%xmm0
|
||||
pand %xmm1,%xmm2
|
||||
pand %xmm1,%xmm3
|
||||
pand %xmm0,%xmm4
|
||||
pand %xmm0,%xmm5
|
||||
pxor %xmm0,%xmm0
|
||||
por %xmm2,%xmm4
|
||||
por %xmm3,%xmm5
|
||||
movdqu %xmm4,-16*2($rptr)
|
||||
movdqu %xmm5,-16*1($rptr)
|
||||
sub \$32,%rdx
|
||||
jnz .Lmulx4x_cond_copy
|
||||
|
||||
mov %rdx,($tptr)
|
||||
|
||||
mov \$1,%rax
|
||||
mov -48(%rsi),%r15
|
||||
mov -40(%rsi),%r14
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -125,6 +125,7 @@
|
||||
#ifndef HEADER_BN_H
|
||||
# define HEADER_BN_H
|
||||
|
||||
# include <limits.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# include <stdio.h> /* FILE */
|
||||
@@ -721,8 +722,17 @@ const BIGNUM *BN_get0_nist_prime_521(void);
|
||||
|
||||
/* library internal functions */
|
||||
|
||||
# define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
|
||||
(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
|
||||
# define bn_expand(a,bits) \
|
||||
( \
|
||||
bits > (INT_MAX - BN_BITS2 + 1) ? \
|
||||
NULL \
|
||||
: \
|
||||
(((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \
|
||||
(a) \
|
||||
: \
|
||||
bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \
|
||||
)
|
||||
|
||||
# define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
|
||||
BIGNUM *bn_expand2(BIGNUM *a, int words);
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
|
@@ -110,6 +110,7 @@
|
||||
*/
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include "constant_time_locl.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -282,9 +283,14 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
}
|
||||
|
||||
bits = BN_num_bits(p);
|
||||
|
||||
if (bits == 0) {
|
||||
ret = BN_one(r);
|
||||
/* x**0 mod 1 is still zero. */
|
||||
if (BN_is_one(m)) {
|
||||
ret = 1;
|
||||
BN_zero(r);
|
||||
} else {
|
||||
ret = BN_one(r);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -418,7 +424,13 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
}
|
||||
bits = BN_num_bits(p);
|
||||
if (bits == 0) {
|
||||
ret = BN_one(rr);
|
||||
/* x**0 mod 1 is still zero. */
|
||||
if (BN_is_one(m)) {
|
||||
ret = 1;
|
||||
BN_zero(rr);
|
||||
} else {
|
||||
ret = BN_one(rr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -595,15 +607,17 @@ static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
|
||||
|
||||
static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top,
|
||||
unsigned char *buf, int idx,
|
||||
int width)
|
||||
int window)
|
||||
{
|
||||
size_t i, j;
|
||||
int i, j;
|
||||
int width = 1 << window;
|
||||
BN_ULONG *table = (BN_ULONG *)buf;
|
||||
|
||||
if (top > b->top)
|
||||
top = b->top; /* this works because 'buf' is explicitly
|
||||
* zeroed */
|
||||
for (i = 0, j = idx; i < top * sizeof b->d[0]; i++, j += width) {
|
||||
buf[j] = ((unsigned char *)b->d)[i];
|
||||
for (i = 0, j = idx; i < top; i++, j += width) {
|
||||
table[j] = b->d[i];
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -611,15 +625,51 @@ static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top,
|
||||
|
||||
static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
|
||||
unsigned char *buf, int idx,
|
||||
int width)
|
||||
int window)
|
||||
{
|
||||
size_t i, j;
|
||||
int i, j;
|
||||
int width = 1 << window;
|
||||
volatile BN_ULONG *table = (volatile BN_ULONG *)buf;
|
||||
|
||||
if (bn_wexpand(b, top) == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0, j = idx; i < top * sizeof b->d[0]; i++, j += width) {
|
||||
((unsigned char *)b->d)[i] = buf[j];
|
||||
if (window <= 3) {
|
||||
for (i = 0; i < top; i++, table += width) {
|
||||
BN_ULONG acc = 0;
|
||||
|
||||
for (j = 0; j < width; j++) {
|
||||
acc |= table[j] &
|
||||
((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1));
|
||||
}
|
||||
|
||||
b->d[i] = acc;
|
||||
}
|
||||
} else {
|
||||
int xstride = 1 << (window - 2);
|
||||
BN_ULONG y0, y1, y2, y3;
|
||||
|
||||
i = idx >> (window - 2); /* equivalent of idx / xstride */
|
||||
idx &= xstride - 1; /* equivalent of idx % xstride */
|
||||
|
||||
y0 = (BN_ULONG)0 - (constant_time_eq_int(i,0)&1);
|
||||
y1 = (BN_ULONG)0 - (constant_time_eq_int(i,1)&1);
|
||||
y2 = (BN_ULONG)0 - (constant_time_eq_int(i,2)&1);
|
||||
y3 = (BN_ULONG)0 - (constant_time_eq_int(i,3)&1);
|
||||
|
||||
for (i = 0; i < top; i++, table += width) {
|
||||
BN_ULONG acc = 0;
|
||||
|
||||
for (j = 0; j < xstride; j++) {
|
||||
acc |= ( (table[j + 0 * xstride] & y0) |
|
||||
(table[j + 1 * xstride] & y1) |
|
||||
(table[j + 2 * xstride] & y2) |
|
||||
(table[j + 3 * xstride] & y3) )
|
||||
& ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1));
|
||||
}
|
||||
|
||||
b->d[i] = acc;
|
||||
}
|
||||
}
|
||||
|
||||
b->top = top;
|
||||
@@ -639,7 +689,7 @@ static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
|
||||
* precomputation memory layout to limit data-dependency to a minimum to
|
||||
* protect secret exponents (cf. the hyper-threading timing attacks pointed
|
||||
* out by Colin Percival,
|
||||
* http://www.daemong-consideredperthreading-considered-harmful/)
|
||||
* http://www.daemonology.net/hyperthreading-considered-harmful/)
|
||||
*/
|
||||
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
@@ -662,15 +712,22 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
bn_check_top(p);
|
||||
bn_check_top(m);
|
||||
|
||||
top = m->top;
|
||||
|
||||
if (!(m->d[0] & 1)) {
|
||||
if (!BN_is_odd(m)) {
|
||||
BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
|
||||
return (0);
|
||||
}
|
||||
|
||||
top = m->top;
|
||||
|
||||
bits = BN_num_bits(p);
|
||||
if (bits == 0) {
|
||||
ret = BN_one(rr);
|
||||
/* x**0 mod 1 is still zero. */
|
||||
if (BN_is_one(m)) {
|
||||
ret = 1;
|
||||
BN_zero(rr);
|
||||
} else {
|
||||
ret = BN_one(rr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -731,8 +788,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
if (window >= 5) {
|
||||
window = 5; /* ~5% improvement for RSA2048 sign, and even
|
||||
* for RSA4096 */
|
||||
if ((top & 7) == 0)
|
||||
powerbufLen += 2 * top * sizeof(m->d[0]);
|
||||
/* reserve space for mont->N.d[] copy */
|
||||
powerbufLen += top * sizeof(mont->N.d[0]);
|
||||
}
|
||||
#endif
|
||||
(void)0;
|
||||
@@ -953,7 +1010,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
const BN_ULONG *not_used, const BN_ULONG *np,
|
||||
const BN_ULONG *n0, int num);
|
||||
|
||||
BN_ULONG *np = mont->N.d, *n0 = mont->n0, *np2;
|
||||
BN_ULONG *n0 = mont->n0, *np;
|
||||
|
||||
/*
|
||||
* BN_to_montgomery can contaminate words above .top [in
|
||||
@@ -964,11 +1021,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
for (i = tmp.top; i < top; i++)
|
||||
tmp.d[i] = 0;
|
||||
|
||||
if (top & 7)
|
||||
np2 = np;
|
||||
else
|
||||
for (np2 = am.d + top, i = 0; i < top; i++)
|
||||
np2[2 * i] = np[i];
|
||||
/*
|
||||
* copy mont->N.d[] to improve cache locality
|
||||
*/
|
||||
for (np = am.d + top, i = 0; i < top; i++)
|
||||
np[i] = mont->N.d[i];
|
||||
|
||||
bn_scatter5(tmp.d, top, powerbuf, 0);
|
||||
bn_scatter5(am.d, am.top, powerbuf, 1);
|
||||
@@ -978,7 +1035,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
# if 0
|
||||
for (i = 3; i < 32; i++) {
|
||||
/* Calculate a^i = a^(i-1) * a */
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1);
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
|
||||
bn_scatter5(tmp.d, top, powerbuf, i);
|
||||
}
|
||||
# else
|
||||
@@ -989,7 +1046,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
}
|
||||
for (i = 3; i < 8; i += 2) {
|
||||
int j;
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1);
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
|
||||
bn_scatter5(tmp.d, top, powerbuf, i);
|
||||
for (j = 2 * i; j < 32; j *= 2) {
|
||||
bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
|
||||
@@ -997,13 +1054,13 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
}
|
||||
}
|
||||
for (; i < 16; i += 2) {
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1);
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
|
||||
bn_scatter5(tmp.d, top, powerbuf, i);
|
||||
bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
|
||||
bn_scatter5(tmp.d, top, powerbuf, 2 * i);
|
||||
}
|
||||
for (; i < 32; i += 2) {
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np2, n0, top, i - 1);
|
||||
bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
|
||||
bn_scatter5(tmp.d, top, powerbuf, i);
|
||||
}
|
||||
# endif
|
||||
@@ -1032,11 +1089,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
while (bits >= 0) {
|
||||
wvalue = bn_get_bits5(p->d, bits - 4);
|
||||
bits -= 5;
|
||||
bn_power5(tmp.d, tmp.d, powerbuf, np2, n0, top, wvalue);
|
||||
bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top, wvalue);
|
||||
}
|
||||
}
|
||||
|
||||
ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np2, n0, top);
|
||||
ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np, n0, top);
|
||||
tmp.top = top;
|
||||
bn_correct_top(&tmp);
|
||||
if (ret) {
|
||||
@@ -1047,9 +1104,9 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, window))
|
||||
goto err;
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, window))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
@@ -1061,15 +1118,15 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
if (window > 1) {
|
||||
if (!BN_mod_mul_montgomery(&tmp, &am, &am, mont, ctx))
|
||||
goto err;
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF
|
||||
(&tmp, top, powerbuf, 2, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2,
|
||||
window))
|
||||
goto err;
|
||||
for (i = 3; i < numPowers; i++) {
|
||||
/* Calculate a^i = a^(i-1) * a */
|
||||
if (!BN_mod_mul_montgomery(&tmp, &am, &tmp, mont, ctx))
|
||||
goto err;
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF
|
||||
(&tmp, top, powerbuf, i, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i,
|
||||
window))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1077,8 +1134,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
bits--;
|
||||
for (wvalue = 0, i = bits % window; i >= 0; i--, bits--)
|
||||
wvalue = (wvalue << 1) + BN_is_bit_set(p, bits);
|
||||
if (!MOD_EXP_CTIME_COPY_FROM_PREBUF
|
||||
(&tmp, top, powerbuf, wvalue, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
|
||||
window))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
@@ -1098,8 +1155,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
/*
|
||||
* Fetch the appropriate pre-computed value from the pre-buf
|
||||
*/
|
||||
if (!MOD_EXP_CTIME_COPY_FROM_PREBUF
|
||||
(&am, top, powerbuf, wvalue, numPowers))
|
||||
if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue,
|
||||
window))
|
||||
goto err;
|
||||
|
||||
/* Multiply the result into the intermediate result */
|
||||
@@ -1181,8 +1238,9 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
|
||||
if (BN_is_one(m)) {
|
||||
ret = 1;
|
||||
BN_zero(rr);
|
||||
} else
|
||||
} else {
|
||||
ret = BN_one(rr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (a == 0) {
|
||||
@@ -1296,9 +1354,14 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
}
|
||||
|
||||
bits = BN_num_bits(p);
|
||||
|
||||
if (bits == 0) {
|
||||
ret = BN_one(r);
|
||||
if (bits == 0) {
|
||||
/* x**0 mod 1 is still zero. */
|
||||
if (BN_is_one(m)) {
|
||||
ret = 1;
|
||||
BN_zero(r);
|
||||
} else {
|
||||
ret = BN_one(r);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -583,6 +583,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
|
||||
* BN_div_no_branch will be called eventually.
|
||||
*/
|
||||
pB = &local_B;
|
||||
local_B.flags = 0;
|
||||
BN_with_flags(pB, B, BN_FLG_CONSTTIME);
|
||||
if (!BN_nnmod(B, pB, A, ctx))
|
||||
goto err;
|
||||
@@ -610,6 +611,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
|
||||
* BN_div_no_branch will be called eventually.
|
||||
*/
|
||||
pA = &local_A;
|
||||
local_A.flags = 0;
|
||||
BN_with_flags(pA, A, BN_FLG_CONSTTIME);
|
||||
|
||||
/* (D, M) := (A/B, A%B) ... */
|
||||
|
@@ -575,7 +575,7 @@ int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
|
||||
bn_check_top(a);
|
||||
BN_CTX_start(ctx);
|
||||
if ((s = BN_CTX_get(ctx)) == NULL)
|
||||
return 0;
|
||||
goto err;
|
||||
if (!bn_wexpand(s, 2 * a->top))
|
||||
goto err;
|
||||
|
||||
@@ -699,18 +699,21 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
int top = p->top;
|
||||
BN_ULONG *udp, *bdp, *vdp, *cdp;
|
||||
|
||||
bn_wexpand(u, top);
|
||||
if (!bn_wexpand(u, top))
|
||||
goto err;
|
||||
udp = u->d;
|
||||
for (i = u->top; i < top; i++)
|
||||
udp[i] = 0;
|
||||
u->top = top;
|
||||
bn_wexpand(b, top);
|
||||
if (!bn_wexpand(b, top))
|
||||
goto err;
|
||||
bdp = b->d;
|
||||
bdp[0] = 1;
|
||||
for (i = 1; i < top; i++)
|
||||
bdp[i] = 0;
|
||||
b->top = top;
|
||||
bn_wexpand(c, top);
|
||||
if (!bn_wexpand(c, top))
|
||||
goto err;
|
||||
cdp = c->d;
|
||||
for (i = 0; i < top; i++)
|
||||
cdp[i] = 0;
|
||||
|
@@ -361,9 +361,9 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont)
|
||||
if (mont == NULL)
|
||||
return;
|
||||
|
||||
BN_free(&(mont->RR));
|
||||
BN_free(&(mont->N));
|
||||
BN_free(&(mont->Ni));
|
||||
BN_clear_free(&(mont->RR));
|
||||
BN_clear_free(&(mont->N));
|
||||
BN_clear_free(&(mont->Ni));
|
||||
if (mont->flags & BN_FLG_MALLOCED)
|
||||
OPENSSL_free(mont);
|
||||
}
|
||||
@@ -373,6 +373,9 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
|
||||
int ret = 0;
|
||||
BIGNUM *Ri, *R;
|
||||
|
||||
if (BN_is_zero(mod))
|
||||
return 0;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
if ((Ri = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
@@ -58,6 +58,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include "bn_lcl.h"
|
||||
@@ -189,7 +190,11 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
|
||||
a++;
|
||||
}
|
||||
|
||||
for (i = 0; isxdigit((unsigned char)a[i]); i++) ;
|
||||
for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++)
|
||||
continue;
|
||||
|
||||
if (i > INT_MAX/4)
|
||||
goto err;
|
||||
|
||||
num = i + neg;
|
||||
if (bn == NULL)
|
||||
@@ -204,7 +209,7 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
|
||||
BN_zero(ret);
|
||||
}
|
||||
|
||||
/* i is the number of hex digests; */
|
||||
/* i is the number of hex digits */
|
||||
if (bn_expand(ret, i * 4) == NULL)
|
||||
goto err;
|
||||
|
||||
@@ -260,7 +265,11 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
a++;
|
||||
}
|
||||
|
||||
for (i = 0; isdigit((unsigned char)a[i]); i++) ;
|
||||
for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++)
|
||||
continue;
|
||||
|
||||
if (i > INT_MAX/4)
|
||||
goto err;
|
||||
|
||||
num = i + neg;
|
||||
if (bn == NULL)
|
||||
@@ -278,7 +287,7 @@ int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
BN_zero(ret);
|
||||
}
|
||||
|
||||
/* i is the number of digests, a bit of an over expand; */
|
||||
/* i is the number of digits, a bit of an over expand */
|
||||
if (bn_expand(ret, i * 4) == NULL)
|
||||
goto err;
|
||||
|
||||
|
@@ -65,6 +65,7 @@ void BN_RECP_CTX_init(BN_RECP_CTX *recp)
|
||||
BN_init(&(recp->N));
|
||||
BN_init(&(recp->Nr));
|
||||
recp->num_bits = 0;
|
||||
recp->shift = 0;
|
||||
recp->flags = 0;
|
||||
}
|
||||
|
||||
@@ -152,8 +153,10 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||
|
||||
if (BN_ucmp(m, &(recp->N)) < 0) {
|
||||
BN_zero(d);
|
||||
if (!BN_copy(r, m))
|
||||
if (!BN_copy(r, m)) {
|
||||
BN_CTX_end(ctx);
|
||||
return 0;
|
||||
}
|
||||
BN_CTX_end(ctx);
|
||||
return (1);
|
||||
}
|
||||
|
@@ -213,14 +213,14 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
|
||||
* exceeded.
|
||||
*/
|
||||
if (!BN_rand(Xp, nbits, 1, 0))
|
||||
return 0;
|
||||
goto err;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
t = BN_CTX_get(ctx);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (!BN_rand(Xq, nbits, 1, 0))
|
||||
return 0;
|
||||
goto err;
|
||||
/* Check that |Xp - Xq| > 2^(nbits - 100) */
|
||||
BN_sub(t, Xp, Xq);
|
||||
if (BN_num_bits(t) > (nbits - 100))
|
||||
@@ -234,6 +234,9 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -441,6 +441,14 @@ int test_div(BIO *bp, BN_CTX *ctx)
|
||||
BN_init(&d);
|
||||
BN_init(&e);
|
||||
|
||||
BN_one(&a);
|
||||
BN_zero(&b);
|
||||
|
||||
if (BN_div(&d, &c, &a, &b, ctx)) {
|
||||
fprintf(stderr, "Division by zero succeeded!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < num0 + num1; i++) {
|
||||
if (i < num1) {
|
||||
BN_bntest_rand(&a, 400, 0, 0);
|
||||
@@ -516,9 +524,9 @@ int test_div_word(BIO *bp)
|
||||
do {
|
||||
BN_bntest_rand(&a, 512, -1, 0);
|
||||
BN_bntest_rand(&b, BN_BITS2, -1, 0);
|
||||
s = b.d[0];
|
||||
} while (!s);
|
||||
} while (BN_is_zero(&b));
|
||||
|
||||
s = b.d[0];
|
||||
BN_copy(&b, &a);
|
||||
r = BN_div_word(&b, s);
|
||||
|
||||
@@ -781,6 +789,18 @@ int test_mont(BIO *bp, BN_CTX *ctx)
|
||||
if (mont == NULL)
|
||||
return 0;
|
||||
|
||||
BN_zero(&n);
|
||||
if (BN_MONT_CTX_set(mont, &n, ctx)) {
|
||||
fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_set_word(&n, 16);
|
||||
if (BN_MONT_CTX_set(mont, &n, ctx)) {
|
||||
fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_bntest_rand(&a, 100, 0, 0);
|
||||
BN_bntest_rand(&b, 100, 0, 0);
|
||||
for (i = 0; i < num2; i++) {
|
||||
@@ -887,6 +907,14 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx)
|
||||
d = BN_new();
|
||||
e = BN_new();
|
||||
|
||||
BN_one(a);
|
||||
BN_one(b);
|
||||
BN_zero(c);
|
||||
if (BN_mod_mul(e, a, b, c, ctx)) {
|
||||
fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
BN_bntest_rand(c, 1024, 0, 0);
|
||||
for (i = 0; i < num0; i++) {
|
||||
@@ -952,6 +980,14 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
|
||||
d = BN_new();
|
||||
e = BN_new();
|
||||
|
||||
BN_one(a);
|
||||
BN_one(b);
|
||||
BN_zero(c);
|
||||
if (BN_mod_exp(d, a, b, c, ctx)) {
|
||||
fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_bntest_rand(c, 30, 0, 1); /* must be odd for montgomery */
|
||||
for (i = 0; i < num2; i++) {
|
||||
BN_bntest_rand(a, 20 + i * 5, 0, 0);
|
||||
@@ -980,6 +1016,24 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Regression test for carry propagation bug in sqr8x_reduction */
|
||||
BN_hex2bn(&a, "050505050505");
|
||||
BN_hex2bn(&b, "02");
|
||||
BN_hex2bn(&c,
|
||||
"4141414141414141414141274141414141414141414141414141414141414141"
|
||||
"4141414141414141414141414141414141414141414141414141414141414141"
|
||||
"4141414141414141414141800000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000001");
|
||||
BN_mod_exp(d, a, b, c, ctx);
|
||||
BN_mul(e, a, a, ctx);
|
||||
if (BN_cmp(d, e)) {
|
||||
fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_free(a);
|
||||
BN_free(b);
|
||||
BN_free(c);
|
||||
@@ -999,6 +1053,22 @@ int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
|
||||
d = BN_new();
|
||||
e = BN_new();
|
||||
|
||||
BN_one(a);
|
||||
BN_one(b);
|
||||
BN_zero(c);
|
||||
if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) {
|
||||
fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus "
|
||||
"succeeded\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_set_word(c, 16);
|
||||
if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) {
|
||||
fprintf(stderr, "BN_mod_exp_mont_consttime with even modulus "
|
||||
"succeeded\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_bntest_rand(c, 30, 0, 1); /* must be odd for montgomery */
|
||||
for (i = 0; i < num2; i++) {
|
||||
BN_bntest_rand(a, 20 + i * 5, 0, 0);
|
||||
|
@@ -72,6 +72,25 @@
|
||||
static const char rnd_seed[] =
|
||||
"string to make the random number generator think it has entropy";
|
||||
|
||||
/*
|
||||
* Test that r == 0 in test_exp_mod_zero(). Returns one on success,
|
||||
* returns zero and prints debug output otherwise.
|
||||
*/
|
||||
static int a_is_zero_mod_one(const char *method, const BIGNUM *r,
|
||||
const BIGNUM *a) {
|
||||
if (!BN_is_zero(r)) {
|
||||
fprintf(stderr, "%s failed:\n", method);
|
||||
fprintf(stderr, "a ** 0 mod 1 = r (should be 0)\n");
|
||||
fprintf(stderr, "a = ");
|
||||
BN_print_fp(stderr, a);
|
||||
fprintf(stderr, "\nr = ");
|
||||
BN_print_fp(stderr, r);
|
||||
fprintf(stderr, "\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success.
|
||||
*/
|
||||
@@ -79,8 +98,9 @@ static int test_exp_mod_zero()
|
||||
{
|
||||
BIGNUM a, p, m;
|
||||
BIGNUM r;
|
||||
BN_ULONG one_word = 1;
|
||||
BN_CTX *ctx = BN_CTX_new();
|
||||
int ret = 1;
|
||||
int ret = 1, failed = 0;
|
||||
|
||||
BN_init(&m);
|
||||
BN_one(&m);
|
||||
@@ -92,21 +112,65 @@ static int test_exp_mod_zero()
|
||||
BN_zero(&p);
|
||||
|
||||
BN_init(&r);
|
||||
BN_mod_exp(&r, &a, &p, &m, ctx);
|
||||
BN_CTX_free(ctx);
|
||||
|
||||
if (BN_is_zero(&r))
|
||||
ret = 0;
|
||||
else {
|
||||
printf("1**0 mod 1 = ");
|
||||
BN_print_fp(stdout, &r);
|
||||
printf(", should be 0\n");
|
||||
if (!BN_rand(&a, 1024, 0, 0))
|
||||
goto err;
|
||||
|
||||
if (!BN_mod_exp(&r, &a, &p, &m, ctx))
|
||||
goto err;
|
||||
|
||||
if (!a_is_zero_mod_one("BN_mod_exp", &r, &a))
|
||||
failed = 1;
|
||||
|
||||
if (!BN_mod_exp_recp(&r, &a, &p, &m, ctx))
|
||||
goto err;
|
||||
|
||||
if (!a_is_zero_mod_one("BN_mod_exp_recp", &r, &a))
|
||||
failed = 1;
|
||||
|
||||
if (!BN_mod_exp_simple(&r, &a, &p, &m, ctx))
|
||||
goto err;
|
||||
|
||||
if (!a_is_zero_mod_one("BN_mod_exp_simple", &r, &a))
|
||||
failed = 1;
|
||||
|
||||
if (!BN_mod_exp_mont(&r, &a, &p, &m, ctx, NULL))
|
||||
goto err;
|
||||
|
||||
if (!a_is_zero_mod_one("BN_mod_exp_mont", &r, &a))
|
||||
failed = 1;
|
||||
|
||||
if (!BN_mod_exp_mont_consttime(&r, &a, &p, &m, ctx, NULL)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!a_is_zero_mod_one("BN_mod_exp_mont_consttime", &r, &a))
|
||||
failed = 1;
|
||||
|
||||
/*
|
||||
* A different codepath exists for single word multiplication
|
||||
* in non-constant-time only.
|
||||
*/
|
||||
if (!BN_mod_exp_mont_word(&r, one_word, &p, &m, ctx, NULL))
|
||||
goto err;
|
||||
|
||||
if (!BN_is_zero(&r)) {
|
||||
fprintf(stderr, "BN_mod_exp_mont_word failed:\n");
|
||||
fprintf(stderr, "1 ** 0 mod 1 = r (should be 0)\n");
|
||||
fprintf(stderr, "r = ");
|
||||
BN_print_fp(stderr, &r);
|
||||
fprintf(stderr, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = failed;
|
||||
|
||||
err:
|
||||
BN_free(&r);
|
||||
BN_free(&a);
|
||||
BN_free(&p);
|
||||
BN_free(&m);
|
||||
BN_CTX_free(ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -1,32 +1,44 @@
|
||||
/******************************************************************************
|
||||
* Copyright(c) 2012, Intel Corp.
|
||||
* Developers and authors:
|
||||
* Shay Gueron (1, 2), and Vlad Krasnov (1)
|
||||
* (1) Intel Corporation, Israel Development Center, Haifa, Israel
|
||||
* (2) University of Haifa, Israel
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2012, Intel Corporation *
|
||||
* *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions are *
|
||||
* met: *
|
||||
* *
|
||||
* * Redistributions of source code must retain the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer. *
|
||||
* *
|
||||
* * Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in the *
|
||||
* documentation and/or other materials provided with the *
|
||||
* distribution. *
|
||||
* *
|
||||
* * Neither the name of the Intel Corporation nor the names of its *
|
||||
* contributors may be used to endorse or promote products derived from *
|
||||
* this software without specific prior written permission. *
|
||||
* *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY *
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR *
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
******************************************************************************
|
||||
* LICENSE:
|
||||
* This submission to OpenSSL is to be made available under the OpenSSL
|
||||
* license, and only to the OpenSSL project, in order to allow integration
|
||||
* into the publicly distributed code.
|
||||
* The use of this code, or portions of this code, or concepts embedded in
|
||||
* this code, or modification of this code and/or algorithm(s) in it, or the
|
||||
* use of this code for any other purpose than stated above, requires special
|
||||
* licensing.
|
||||
******************************************************************************
|
||||
* DISCLAIMER:
|
||||
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS AND THE COPYRIGHT OWNERS
|
||||
* ``AS IS''. ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS OR THE COPYRIGHT
|
||||
* OWNERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
* Developers and authors: *
|
||||
* Shay Gueron (1, 2), and Vlad Krasnov (1) *
|
||||
* (1) Intel Corporation, Israel Development Center, Haifa, Israel *
|
||||
* (2) University of Haifa, Israel *
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef RSAZ_EXP_H
|
||||
# define RSAZ_EXP_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user