Compare commits
384 Commits
OpenSSL_0_
...
OpenSSL_0_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
36216218ca | ||
![]() |
115eaf4886 | ||
![]() |
53ce5647d4 | ||
![]() |
4d2efa29f6 | ||
![]() |
cd332a0750 | ||
![]() |
2ed80d14d7 | ||
![]() |
d286606301 | ||
![]() |
3f4d81e88b | ||
![]() |
dc5dfe431c | ||
![]() |
c6a876473c | ||
![]() |
5a7fc89394 | ||
![]() |
116fd3732a | ||
![]() |
1bb01b1b5f | ||
![]() |
699d78ce98 | ||
![]() |
43d613ec18 | ||
![]() |
96e1015eec | ||
![]() |
cf4b01a766 | ||
![]() |
45d129511f | ||
![]() |
0976adac8f | ||
![]() |
db5b0d9309 | ||
![]() |
aeeedc8acc | ||
![]() |
c903866420 | ||
![]() |
9b208659aa | ||
![]() |
f54fab0fef | ||
![]() |
b30aaafbe5 | ||
![]() |
fee8d86d7a | ||
![]() |
bf3e53a7fa | ||
![]() |
44a8fced97 | ||
![]() |
4ff07f4c71 | ||
![]() |
1c5f396d36 | ||
![]() |
9fcaaef34f | ||
![]() |
b9a73f5481 | ||
![]() |
bff5319d90 | ||
![]() |
fc4bd2f287 | ||
![]() |
4c836c96c4 | ||
![]() |
6e14e7fc19 | ||
![]() |
fc15c44049 | ||
![]() |
445598b35e | ||
![]() |
338a5e7e54 | ||
![]() |
6a431cd293 | ||
![]() |
1b7024fb69 | ||
![]() |
5021f6314e | ||
![]() |
21d24dd38a | ||
![]() |
681d11b6fd | ||
![]() |
8c387e62b2 | ||
![]() |
a117329c5a | ||
![]() |
f39dbff498 | ||
![]() |
f6fefb0cb6 | ||
![]() |
febfaa53f4 | ||
![]() |
cfed221c2d | ||
![]() |
c2014ae252 | ||
![]() |
c3d317b4de | ||
![]() |
a214feb26b | ||
![]() |
7a3a82dbbd | ||
![]() |
02fef91630 | ||
![]() |
0b8cd5acd6 | ||
![]() |
97f4e235a1 | ||
![]() |
cfd2aeeb7c | ||
![]() |
a0fdc4c6d6 | ||
![]() |
b5def0243e | ||
![]() |
357f6d8add | ||
![]() |
19a71e8c16 | ||
![]() |
7faa66433f | ||
![]() |
1a0498769f | ||
![]() |
a4dde82423 | ||
![]() |
eba0aa995d | ||
![]() |
c9e6fffa53 | ||
![]() |
85dcce7c63 | ||
![]() |
2ed29615cb | ||
![]() |
d7080d624b | ||
![]() |
5d7c8a48db | ||
![]() |
00e86a74bd | ||
![]() |
9e6857a358 | ||
![]() |
715258486c | ||
![]() |
2daec41e25 | ||
![]() |
8519635923 | ||
![]() |
d0bdfdd830 | ||
![]() |
4b98488eb0 | ||
![]() |
0e2458e187 | ||
![]() |
326de18955 | ||
![]() |
1fcfd61ee7 | ||
![]() |
121f386ec7 | ||
![]() |
9fb10cfe6b | ||
![]() |
a20a6366c8 | ||
![]() |
54985b5061 | ||
![]() |
b09db677d5 | ||
![]() |
cdc596567d | ||
![]() |
70d923fb03 | ||
![]() |
def1490717 | ||
![]() |
7697d9b587 | ||
![]() |
0345354fe0 | ||
![]() |
90aef4431b | ||
![]() |
602689074a | ||
![]() |
810d2c7f6e | ||
![]() |
0a9b8dd1b4 | ||
![]() |
bfce4e5d6e | ||
![]() |
4a1190beca | ||
![]() |
047ec5d196 | ||
![]() |
bb59889305 | ||
![]() |
141a5482fd | ||
![]() |
de2422affb | ||
![]() |
897169fdf0 | ||
![]() |
410a49a4fa | ||
![]() |
82ba68c42d | ||
![]() |
4b258e73ae | ||
![]() |
6ac2f67882 | ||
![]() |
bea1d1cbd8 | ||
![]() |
61e6e80fe5 | ||
![]() |
2ce540743e | ||
![]() |
8e928aab02 | ||
![]() |
105e52bf23 | ||
![]() |
492a5010a4 | ||
![]() |
53b0b0a330 | ||
![]() |
677c117419 | ||
![]() |
bb50d30f35 | ||
![]() |
8323996d99 | ||
![]() |
ee14e33c35 | ||
![]() |
1bcb94a721 | ||
![]() |
9658c634a2 | ||
![]() |
7ee8b27267 | ||
![]() |
e4ea6f0c76 | ||
![]() |
a2c00fb210 | ||
![]() |
d06ae0fff7 | ||
![]() |
afa2ea204e | ||
![]() |
0b6394c738 | ||
![]() |
70ddf8ecca | ||
![]() |
9febee0272 | ||
![]() |
a721216f0f | ||
![]() |
47f689ac09 | ||
![]() |
f51f374199 | ||
![]() |
3c1128f43f | ||
![]() |
8185c9457e | ||
![]() |
c61f0cbffb | ||
![]() |
d90605dd00 | ||
![]() |
e56334998c | ||
![]() |
9ad5c5e4f9 | ||
![]() |
4bc24cf01d | ||
![]() |
79f57768ff | ||
![]() |
d79eb9299a | ||
![]() |
fff69a7d8c | ||
![]() |
a375025e4d | ||
![]() |
d471adf351 | ||
![]() |
2fb8642eea | ||
![]() |
c44d95c1a7 | ||
![]() |
0da40f0ffc | ||
![]() |
7f722c95f8 | ||
![]() |
4268216005 | ||
![]() |
17540b77e0 | ||
![]() |
b70e4d3e90 | ||
![]() |
d9519a4032 | ||
![]() |
5ac9786807 | ||
![]() |
0b05204c4e | ||
![]() |
a4bfeff254 | ||
![]() |
43433b3852 | ||
![]() |
020a4782bd | ||
![]() |
cadbbd51c8 | ||
![]() |
ff7b021040 | ||
![]() |
e7e4d506d6 | ||
![]() |
9204e7ef0d | ||
![]() |
257df40f00 | ||
![]() |
a44c9b9c33 | ||
![]() |
1cbd7456aa | ||
![]() |
e1e39a2451 | ||
![]() |
01de6e21cc | ||
![]() |
05689a132c | ||
![]() |
1643edc63c | ||
![]() |
1546fb780b | ||
![]() |
b7d222c519 | ||
![]() |
a93cc7c573 | ||
![]() |
8988407a0b | ||
![]() |
b2afc0a9dc | ||
![]() |
a8655eb21a | ||
![]() |
f751dc4759 | ||
![]() |
fbe621d08f | ||
![]() |
2e9fd4301f | ||
![]() |
1638ce7212 | ||
![]() |
7ecd974f5f | ||
![]() |
db731da802 | ||
![]() |
5864fd2061 | ||
![]() |
ff58eaa4b6 | ||
![]() |
76c61a5d1a | ||
![]() |
4ea7019165 | ||
![]() |
59b1129e0a | ||
![]() |
fb092ef4fc | ||
![]() |
6351adecb4 | ||
![]() |
8964efc413 | ||
![]() |
430b637bd5 | ||
![]() |
ca3b81c858 | ||
![]() |
031cbecf86 | ||
![]() |
1213e6c3c2 | ||
![]() |
32619893b4 | ||
![]() |
40e0de0395 | ||
![]() |
5f9345a2f0 | ||
![]() |
33ccde59a1 | ||
![]() |
1909df070f | ||
![]() |
c23a745820 | ||
![]() |
924b117422 | ||
![]() |
24b2806097 | ||
![]() |
99f5093347 | ||
![]() |
be88529753 | ||
![]() |
b3a959a337 | ||
![]() |
2928cb4c82 | ||
![]() |
a33e6702a0 | ||
![]() |
35a65e814b | ||
![]() |
7ad132b133 | ||
![]() |
2708813166 | ||
![]() |
affe98998a | ||
![]() |
66e8211c0b | ||
![]() |
dd2dee60f3 | ||
![]() |
6495179af6 | ||
![]() |
61b8c79d15 | ||
![]() |
42aa3ec4f2 | ||
![]() |
bb152dae8f | ||
![]() |
c42ab44087 | ||
![]() |
42e10c3fd6 | ||
![]() |
c571a3e984 | ||
![]() |
e55988bb60 | ||
![]() |
34b5ba3b60 | ||
![]() |
629ac4b4ca | ||
![]() |
75f0bc4f44 | ||
![]() |
71a2440ee5 | ||
![]() |
04e40739f7 | ||
![]() |
48bcdad0d5 | ||
![]() |
f7d2402cab | ||
![]() |
808f55351a | ||
![]() |
c06271bc35 | ||
![]() |
92e5882aca | ||
![]() |
afa0580cd5 | ||
![]() |
4baee3031c | ||
![]() |
db7a72b224 | ||
![]() |
b71e69ad8e | ||
![]() |
f856173c43 | ||
![]() |
d742f9ebbd | ||
![]() |
36dd4cba3d | ||
![]() |
3978429ad5 | ||
![]() |
885945d6e1 | ||
![]() |
e22e770147 | ||
![]() |
e0c0203341 | ||
![]() |
e1eec61e26 | ||
![]() |
296fa128c9 | ||
![]() |
6dde222aae | ||
![]() |
391ac37018 | ||
![]() |
8d038a08fb | ||
![]() |
747c6ffda4 | ||
![]() |
d4cddc54f0 | ||
![]() |
eb7112c18e | ||
![]() |
fef9e07930 | ||
![]() |
8ab27e6ef7 | ||
![]() |
6415055590 | ||
![]() |
556e27b14f | ||
![]() |
af0c009d70 | ||
![]() |
0b1cf4a139 | ||
![]() |
a9101cdcaa | ||
![]() |
e351e2a7cf | ||
![]() |
215276243d | ||
![]() |
ddb7832852 | ||
![]() |
2fad41d155 | ||
![]() |
b9c3d9168f | ||
![]() |
4f2fc3c2dd | ||
![]() |
48819f4d54 | ||
![]() |
b0cbdd3eba | ||
![]() |
5016107550 | ||
![]() |
25d5d15fd5 | ||
![]() |
725713f74a | ||
![]() |
73eb0972cf | ||
![]() |
6720779c7e | ||
![]() |
b2a2c6af2a | ||
![]() |
272993bac4 | ||
![]() |
58532ae047 | ||
![]() |
4e7f6d380d | ||
![]() |
f0be325f88 | ||
![]() |
b66af23aa9 | ||
![]() |
29d0c13e97 | ||
![]() |
8a4e81a269 | ||
![]() |
843fc7b681 | ||
![]() |
6dcb6bf1c1 | ||
![]() |
1061c3cb3c | ||
![]() |
0d0f15d8d1 | ||
![]() |
a72ce94213 | ||
![]() |
f71d59c70e | ||
![]() |
3309f8313c | ||
![]() |
6cc5f194a7 | ||
![]() |
096327a99a | ||
![]() |
cc10bcf25e | ||
![]() |
875ac0ec00 | ||
![]() |
bf240f063a | ||
![]() |
dd016b0570 | ||
![]() |
244788464a | ||
![]() |
a95808334e | ||
![]() |
b3cebd5acf | ||
![]() |
7b775145e4 | ||
![]() |
7183aa6b9d | ||
![]() |
eebefe35e7 | ||
![]() |
1db0bbdc76 | ||
![]() |
e643112dd8 | ||
![]() |
21c4b25959 | ||
![]() |
41cf2c3aef | ||
![]() |
0e3a930fb4 | ||
![]() |
0c214e0153 | ||
![]() |
6c61cfbe03 | ||
![]() |
2ee77d36a0 | ||
![]() |
24f441e0bb | ||
![]() |
740da44f20 | ||
![]() |
72033fde7b | ||
![]() |
9adf3fcf9a | ||
![]() |
65f7456652 | ||
![]() |
8794569a08 | ||
![]() |
f8731bc2fd | ||
![]() |
195d6bf760 | ||
![]() |
dacd94b9c8 | ||
![]() |
8070cb5f87 | ||
![]() |
f7d514f449 | ||
![]() |
6d50bce79f | ||
![]() |
3cf0a38b3e | ||
![]() |
91a1d08a4c | ||
![]() |
85e776885b | ||
![]() |
fc4015329f | ||
![]() |
6ec9ff83f3 | ||
![]() |
db45308477 | ||
![]() |
1c7c69a8a5 | ||
![]() |
24ad061037 | ||
![]() |
92f96fa721 | ||
![]() |
0d1e362363 | ||
![]() |
a0bf2c86ab | ||
![]() |
6a662a45f3 | ||
![]() |
24d0524f31 | ||
![]() |
c081817c95 | ||
![]() |
46a1f2487e | ||
![]() |
ac02a4b68a | ||
![]() |
4ba063d3c5 | ||
![]() |
e0e0818e4b | ||
![]() |
82a5049f6a | ||
![]() |
d027b75b73 | ||
![]() |
87421d3fc5 | ||
![]() |
87d14a3625 | ||
![]() |
cc0931e36b | ||
![]() |
22152d6885 | ||
![]() |
102bcbce8d | ||
![]() |
8655de423d | ||
![]() |
c4b2eb24b3 | ||
![]() |
03e3fbb702 | ||
![]() |
bc7ee385f5 | ||
![]() |
1e368ab08f | ||
![]() |
2c77c5c8db | ||
![]() |
1eb38c563f | ||
![]() |
fa657871ed | ||
![]() |
09dac71a45 | ||
![]() |
be70b3adce | ||
![]() |
6d12b1f82b | ||
![]() |
7116a41129 | ||
![]() |
7143acab25 | ||
![]() |
11d4086d8e | ||
![]() |
32cd1da62e | ||
![]() |
d430f56de6 | ||
![]() |
957ebe98fb | ||
![]() |
9d09fc8485 | ||
![]() |
8ea4531718 | ||
![]() |
881611678e | ||
![]() |
a3dc628d86 | ||
![]() |
3c159fc1a5 | ||
![]() |
6056afd223 | ||
![]() |
54db796991 | ||
![]() |
119e912a83 | ||
![]() |
f4a4a0fdc7 | ||
![]() |
9ad765173f | ||
![]() |
c8e3c1a9b5 | ||
![]() |
ae378b769a | ||
![]() |
4de4e35459 | ||
![]() |
5537a83e56 | ||
![]() |
c850d322a6 | ||
![]() |
b8be571868 | ||
![]() |
acd43bf38c | ||
![]() |
5eaf173647 | ||
![]() |
7890b562bc | ||
![]() |
7258d33794 | ||
![]() |
263979a2a3 | ||
![]() |
2c6d83354d | ||
![]() |
a188fc01fe | ||
![]() |
1948f9e042 | ||
![]() |
f7ffc3a6c9 | ||
![]() |
4d6af5c5d2 | ||
![]() |
efed63d783 | ||
![]() |
7e351bb560 | ||
![]() |
0067580321 |
77
.gitignore
vendored
Normal file
77
.gitignore
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# Object files
|
||||
*.o
|
||||
|
||||
# editor artefacts
|
||||
*.swp
|
||||
.#*
|
||||
#*#
|
||||
*~
|
||||
|
||||
# Top level excludes
|
||||
/Makefile.bak
|
||||
/Makefile
|
||||
/*.a
|
||||
/include
|
||||
/*.pc
|
||||
/rehash.time
|
||||
|
||||
# Most *.c files under test/ are symlinks
|
||||
/test/*.c
|
||||
# Apart from these
|
||||
!/test/asn1test.c
|
||||
!/test/methtest.c
|
||||
!/test/dummytest.c
|
||||
!/test/igetest.c
|
||||
!/test/r160test.c
|
||||
!/test/fips_algvs.c
|
||||
|
||||
/test/*.ss
|
||||
/test/*.srl
|
||||
/test/.rnd
|
||||
/test/test*.pem
|
||||
/test/newkey.pem
|
||||
|
||||
# Certificate symbolic links
|
||||
*.0
|
||||
|
||||
# Links under apps
|
||||
/apps/CA.pl
|
||||
/apps/md4.c
|
||||
|
||||
|
||||
# Auto generated headers
|
||||
/crypto/buildinf.h
|
||||
/crypto/opensslconf.h
|
||||
|
||||
# Auto generated assembly language source files
|
||||
*.s
|
||||
!/crypto/bn/asm/pa-risc2.s
|
||||
!/crypto/bn/asm/pa-risc2W.s
|
||||
|
||||
# Executables
|
||||
/apps/openssl
|
||||
/test/sha256t
|
||||
/test/sha512t
|
||||
/test/*test
|
||||
/test/fips_aesavs
|
||||
/test/fips_desmovs
|
||||
/test/fips_dhvs
|
||||
/test/fips_drbgvs
|
||||
/test/fips_dssvs
|
||||
/test/fips_ecdhvs
|
||||
/test/fips_ecdsavs
|
||||
/test/fips_rngvs
|
||||
/test/fips_test_suite
|
||||
*.so*
|
||||
*.dylib*
|
||||
*.dll*
|
||||
# Exceptions
|
||||
!/test/bctest
|
||||
!/crypto/des/times/486-50.sol
|
||||
|
||||
# Misc auto generated files
|
||||
/tools/c_rehash
|
||||
/test/evptests.txt
|
||||
lib
|
||||
Makefile.save
|
||||
*.bak
|
30
ACKNOWLEDGMENTS
Normal file
30
ACKNOWLEDGMENTS
Normal file
@@ -0,0 +1,30 @@
|
||||
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.
|
319
CHANGES
319
CHANGES
@@ -2,6 +2,325 @@
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
Changes between 0.9.8zb and 0.9.8zc [15 Oct 2014]
|
||||
|
||||
*) Session Ticket Memory Leak.
|
||||
|
||||
When an OpenSSL SSL/TLS/DTLS server receives a session ticket the
|
||||
integrity of that ticket is first verified. In the event of a session
|
||||
ticket integrity check failing, OpenSSL will fail to free memory
|
||||
causing a memory leak. By sending a large number of invalid session
|
||||
tickets an attacker could exploit this issue in a Denial Of Service
|
||||
attack.
|
||||
(CVE-2014-3567)
|
||||
[Steve Henson]
|
||||
|
||||
*) Build option no-ssl3 is incomplete.
|
||||
|
||||
When OpenSSL is configured with "no-ssl3" as a build option, servers
|
||||
could accept and complete a SSL 3.0 handshake, and clients could be
|
||||
configured to send them.
|
||||
(CVE-2014-3568)
|
||||
[Akamai and the OpenSSL team]
|
||||
|
||||
*) Add support for TLS_FALLBACK_SCSV.
|
||||
Client applications doing fallback retries should call
|
||||
SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV).
|
||||
(CVE-2014-3566)
|
||||
[Adam Langley, Bodo Moeller]
|
||||
|
||||
*) Add additional DigestInfo checks.
|
||||
|
||||
Reencode DigestInto in DER and check against the original when
|
||||
verifying RSA signature: this will reject any improperly encoded
|
||||
DigestInfo structures.
|
||||
|
||||
Note: this is a precautionary measure and no attacks are currently known.
|
||||
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8za and 0.9.8zb [6 Aug 2014]
|
||||
|
||||
*) OpenSSL DTLS clients enabling anonymous (EC)DH ciphersuites are subject
|
||||
to a denial of service attack. A malicious server can crash the client
|
||||
with a null pointer dereference (read) by specifying an anonymous (EC)DH
|
||||
ciphersuite and sending carefully crafted handshake messages.
|
||||
|
||||
Thanks to Felix Gr<47>bert (Google) for discovering and researching this
|
||||
issue.
|
||||
(CVE-2014-3510)
|
||||
[Emilia K<>sper]
|
||||
|
||||
*) By sending carefully crafted DTLS packets an attacker could cause openssl
|
||||
to leak memory. This can be exploited through a Denial of Service attack.
|
||||
Thanks to Adam Langley for discovering and researching this issue.
|
||||
(CVE-2014-3507)
|
||||
[Adam Langley]
|
||||
|
||||
*) An attacker can force openssl to consume large amounts of memory whilst
|
||||
processing DTLS handshake messages. This can be exploited through a
|
||||
Denial of Service attack.
|
||||
Thanks to Adam Langley for discovering and researching this issue.
|
||||
(CVE-2014-3506)
|
||||
[Adam Langley]
|
||||
|
||||
*) An attacker can force an error condition which causes openssl to crash
|
||||
whilst processing DTLS packets due to memory being freed twice. This
|
||||
can be exploited through a Denial of Service attack.
|
||||
Thanks to Adam Langley and Wan-Teh Chang for discovering and researching
|
||||
this issue.
|
||||
(CVE-2014-3505)
|
||||
[Adam Langley]
|
||||
|
||||
*) A flaw in OBJ_obj2txt may cause pretty printing functions such as
|
||||
X509_name_oneline, X509_name_print_ex et al. to leak some information
|
||||
from the stack. Applications may be affected if they echo pretty printing
|
||||
output to the attacker.
|
||||
|
||||
Thanks to Ivan Fratric (Google) for discovering this issue.
|
||||
(CVE-2014-3508)
|
||||
[Emilia K<>sper, and Steve Henson]
|
||||
|
||||
*) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.)
|
||||
for corner cases. (Certain input points at infinity could lead to
|
||||
bogus results, with non-infinity inputs mapped to infinity too.)
|
||||
[Bodo Moeller]
|
||||
|
||||
Changes between 0.9.8y and 0.9.8za [5 Jun 2014]
|
||||
|
||||
*) Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted
|
||||
handshake can force the use of weak keying material in OpenSSL
|
||||
SSL/TLS clients and servers.
|
||||
|
||||
Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for discovering and
|
||||
researching this issue. (CVE-2014-0224)
|
||||
[KIKUCHI Masashi, Steve Henson]
|
||||
|
||||
*) Fix DTLS recursion flaw. By sending an invalid DTLS handshake to an
|
||||
OpenSSL DTLS client the code can be made to recurse eventually crashing
|
||||
in a DoS attack.
|
||||
|
||||
Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
|
||||
(CVE-2014-0221)
|
||||
[Imre Rad, Steve Henson]
|
||||
|
||||
*) Fix DTLS invalid fragment vulnerability. A buffer overrun attack can
|
||||
be triggered by sending invalid DTLS fragments to an OpenSSL DTLS
|
||||
client or server. This is potentially exploitable to run arbitrary
|
||||
code on a vulnerable client or server.
|
||||
|
||||
Thanks to J<>ri Aedla for reporting this issue. (CVE-2014-0195)
|
||||
[J<>ri Aedla, Steve Henson]
|
||||
|
||||
*) Fix bug in TLS code where clients enable anonymous ECDH ciphersuites
|
||||
are subject to a denial of service attack.
|
||||
|
||||
Thanks to Felix Gr<47>bert and Ivan Fratric at Google for discovering
|
||||
this issue. (CVE-2014-3470)
|
||||
[Felix Gr<47>bert, Ivan Fratric, Steve Henson]
|
||||
|
||||
*) Fix for the attack described in the paper "Recovering OpenSSL
|
||||
ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
|
||||
by Yuval Yarom and Naomi Benger. Details can be obtained from:
|
||||
http://eprint.iacr.org/2014/140
|
||||
|
||||
Thanks to Yuval Yarom and Naomi Benger for discovering this
|
||||
flaw and to Yuval Yarom for supplying a fix (CVE-2014-0076)
|
||||
[Yuval Yarom and Naomi Benger]
|
||||
|
||||
Thanks to mancha for backporting the fix to the 0.9.8 branch.
|
||||
|
||||
*) Fix handling of warning-level alerts in SSL23 client mode so they
|
||||
don't cause client-side termination (eg. on SNI unrecognized_name
|
||||
warnings). Add client and server support for six additional alerts
|
||||
per RFC 6066 and RFC 4279.
|
||||
[mancha]
|
||||
|
||||
*) Add option SSL_OP_SAFARI_ECDHE_ECDSA_BUG (part of SSL_OP_ALL) which
|
||||
avoids preferring ECDHE-ECDSA ciphers when the client appears to be
|
||||
Safari on OS X. Safari on OS X 10.8..10.8.3 advertises support for
|
||||
several ECDHE-ECDSA ciphers, but fails to negotiate them. The bug
|
||||
is fixed in OS X 10.8.4, but Apple have ruled out both hot fixing
|
||||
10.8..10.8.3 and forcing users to upgrade to 10.8.4 or newer.
|
||||
[Rob Stradling, Adam Langley]
|
||||
|
||||
Changes between 0.9.8x and 0.9.8y [5 Feb 2013]
|
||||
|
||||
*) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
|
||||
|
||||
This addresses the flaw in CBC record processing discovered by
|
||||
Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
|
||||
at: http://www.isg.rhul.ac.uk/tls/
|
||||
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
(www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and
|
||||
Emilia K<>sper for the initial patch.
|
||||
(CVE-2013-0169)
|
||||
[Emilia K<>sper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
|
||||
|
||||
*) Return an error when checking OCSP signatures when key is NULL.
|
||||
This fixes a DoS attack. (CVE-2013-0166)
|
||||
[Steve Henson]
|
||||
|
||||
*) Call OCSP Stapling callback after ciphersuite has been chosen, so
|
||||
the right response is stapled. Also change SSL_get_certificate()
|
||||
so it returns the certificate actually sent.
|
||||
See http://rt.openssl.org/Ticket/Display.html?id=2836.
|
||||
(This is a backport)
|
||||
[Rob Stradling <rob.stradling@comodo.com>]
|
||||
|
||||
*) Fix possible deadlock when decoding public keys.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8w and 0.9.8x [10 May 2012]
|
||||
|
||||
*) Sanity check record length before skipping explicit IV in DTLS
|
||||
to fix DoS attack.
|
||||
|
||||
Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic
|
||||
fuzzing as a service testing platform.
|
||||
(CVE-2012-2333)
|
||||
[Steve Henson]
|
||||
|
||||
*) Initialise tkeylen properly when encrypting CMS messages.
|
||||
Thanks to Solar Designer of Openwall for reporting this issue.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8v and 0.9.8w [23 Apr 2012]
|
||||
|
||||
*) The fix for CVE-2012-2110 did not take into account that the
|
||||
'len' argument to BUF_MEM_grow and BUF_MEM_grow_clean is an
|
||||
int in OpenSSL 0.9.8, making it still vulnerable. Fix by
|
||||
rejecting negative len parameter. (CVE-2012-2131)
|
||||
[Tomas Hoger <thoger@redhat.com>]
|
||||
|
||||
Changes between 0.9.8u and 0.9.8v [19 Apr 2012]
|
||||
|
||||
*) Check for potentially exploitable overflows in asn1_d2i_read_bio
|
||||
BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
|
||||
in CRYPTO_realloc_clean.
|
||||
|
||||
Thanks to Tavis Ormandy, Google Security Team, for discovering this
|
||||
issue and to Adam Langley <agl@chromium.org> for fixing it.
|
||||
(CVE-2012-2110)
|
||||
[Adam Langley (Google), Tavis Ormandy, Google Security Team]
|
||||
|
||||
Changes between 0.9.8t and 0.9.8u [12 Mar 2012]
|
||||
|
||||
*) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
|
||||
in CMS and PKCS7 code. When RSA decryption fails use a random key for
|
||||
content decryption and always return the same error. Note: this attack
|
||||
needs on average 2^20 messages so it only affects automated senders. The
|
||||
old behaviour can be reenabled in the CMS code by setting the
|
||||
CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where
|
||||
an MMA defence is not necessary.
|
||||
Thanks to Ivan Nestlerode <inestlerode@us.ibm.com> for discovering
|
||||
this issue. (CVE-2012-0884)
|
||||
[Steve Henson]
|
||||
|
||||
*) Fix CVE-2011-4619: make sure we really are receiving a
|
||||
client hello before rejecting multiple SGC restarts. Thanks to
|
||||
Ivan Nestlerode <inestlerode@us.ibm.com> for discovering this bug.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8s and 0.9.8t [18 Jan 2012]
|
||||
|
||||
*) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
|
||||
Thanks to Antonio Martin, Enterprise Secure Access Research and
|
||||
Development, Cisco Systems, Inc. for discovering this bug and
|
||||
preparing a fix. (CVE-2012-0050)
|
||||
[Antonio Martin]
|
||||
|
||||
Changes between 0.9.8r and 0.9.8s [4 Jan 2012]
|
||||
|
||||
*) Nadhem Alfardan and Kenny Paterson have discovered an extension
|
||||
of the Vaudenay padding oracle attack on CBC mode encryption
|
||||
which enables an efficient plaintext recovery attack against
|
||||
the OpenSSL implementation of DTLS. Their attack exploits timing
|
||||
differences arising during decryption processing. A research
|
||||
paper describing this attack can be found at:
|
||||
http://www.isg.rhul.ac.uk/~kp/dtls.pdf
|
||||
Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
|
||||
Security Group at Royal Holloway, University of London
|
||||
(www.isg.rhul.ac.uk) for discovering this flaw and to Robin Seggelmann
|
||||
<seggelmann@fh-muenster.de> and Michael Tuexen <tuexen@fh-muenster.de>
|
||||
for preparing the fix. (CVE-2011-4108)
|
||||
[Robin Seggelmann, Michael Tuexen]
|
||||
|
||||
*) Stop policy check failure freeing same buffer twice. (CVE-2011-4109)
|
||||
[Ben Laurie, Kasper <ekasper@google.com>]
|
||||
|
||||
*) Clear bytes used for block padding of SSL 3.0 records.
|
||||
(CVE-2011-4576)
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Only allow one SGC handshake restart for SSL/TLS. Thanks to George
|
||||
Kadianakis <desnacked@gmail.com> for discovering this issue and
|
||||
Adam Langley for preparing the fix. (CVE-2011-4619)
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Prevent malformed RFC3779 data triggering an assertion failure.
|
||||
Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
|
||||
and Rob Austein <sra@hactrn.net> for fixing it. (CVE-2011-4577)
|
||||
[Rob Austein <sra@hactrn.net>]
|
||||
|
||||
*) Fix ssl_ciph.c set-up race.
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Fix spurious failures in ecdsatest.c.
|
||||
[Emilia K<>sper (Google)]
|
||||
|
||||
*) Fix the BIO_f_buffer() implementation (which was mixing different
|
||||
interpretations of the '..._len' fields).
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than
|
||||
BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concurrent
|
||||
threads won't reuse the same blinding coefficients.
|
||||
|
||||
This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING
|
||||
lock to call BN_BLINDING_invert_ex, and avoids one use of
|
||||
BN_BLINDING_update for each BN_BLINDING structure (previously,
|
||||
the last update always remained unused).
|
||||
[Emilia K<>sper (Google)]
|
||||
|
||||
*) Fix SSL memory handling for (EC)DH ciphersuites, in particular
|
||||
for multi-threaded use of ECDH.
|
||||
[Adam Langley (Google)]
|
||||
|
||||
*) Fix x509_name_ex_d2i memory leak on bad inputs.
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Add protection against ECDSA timing attacks as mentioned in the paper
|
||||
by Billy Bob Brumley and Nicola Tuveri, see:
|
||||
|
||||
http://eprint.iacr.org/2011/232.pdf
|
||||
|
||||
[Billy Bob Brumley and Nicola Tuveri]
|
||||
|
||||
Changes between 0.9.8q and 0.9.8r [8 Feb 2011]
|
||||
|
||||
*) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
|
||||
[Neel Mehta, Adam Langley, Bodo Moeller (Google)]
|
||||
|
||||
*) Fix bug in string printing code: if *any* escaping is enabled we must
|
||||
escape the escape character (backslash) or the resulting string is
|
||||
ambiguous.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.8p and 0.9.8q [2 Dec 2010]
|
||||
|
||||
*) Disable code workaround for ancient and obsolete Netscape browsers
|
||||
and servers: an attacker can use it in a ciphersuite downgrade attack.
|
||||
Thanks to Martin Rex for discovering this bug. CVE-2010-4180
|
||||
[Steve Henson]
|
||||
|
||||
*) Fixed J-PAKE implementation error, originally discovered by
|
||||
Sebastien Martini, further info and confirmation from Stefan
|
||||
Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4252
|
||||
[Ben Laurie]
|
||||
|
||||
Changes between 0.9.8o and 0.9.8p [16 Nov 2010]
|
||||
|
||||
*) Fix extension code to avoid race conditions which can result in a buffer
|
||||
|
18
Configure
18
Configure
@@ -162,20 +162,21 @@ my %table=(
|
||||
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
|
||||
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
|
||||
"debug-ben-debug", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -O2 -pipe::(unknown)::::::",
|
||||
"debug-ben-debug-64", "gcc:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-ben-debug-noopt", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -pipe::(unknown)::::::",
|
||||
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
|
||||
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||
"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||
"debug-bodo", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
|
||||
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
|
||||
"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
|
||||
"debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
|
||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||
@@ -371,6 +372,9 @@ my %table=(
|
||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
|
||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
|
||||
|
||||
# Android: Linux but without -DTERMIO and pointers to headers and libs.
|
||||
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### *BSD [do see comment about ${BSDthreads} above!]
|
||||
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
@@ -425,8 +429,8 @@ my %table=(
|
||||
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
|
||||
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
|
||||
# at build time. $OBJECT_MODE is respected at ./config stage!
|
||||
"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
|
||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
|
||||
"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
|
||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
|
||||
|
||||
#
|
||||
# Cray T90 and similar (SDSC)
|
||||
|
83
FAQ
83
FAQ
@@ -10,6 +10,7 @@ OpenSSL - Frequently Asked Questions
|
||||
* Why aren't tools like 'autoconf' and 'libtool' used?
|
||||
* What is an 'engine' version?
|
||||
* How do I check the authenticity of the OpenSSL distribution?
|
||||
* How does the versioning scheme work?
|
||||
|
||||
[LEGAL] Legal questions
|
||||
|
||||
@@ -52,6 +53,9 @@ OpenSSL - Frequently Asked Questions
|
||||
* Why does the OpenSSL test suite fail in sha512t on x86 CPU?
|
||||
* Why does compiler fail to compile sha512.c?
|
||||
* Test suite still fails, what to do?
|
||||
* I think I've found a bug, what should I do?
|
||||
* I'm SURE I've found a bug, how do I report it?
|
||||
* I've found a security issue, how do I report it?
|
||||
|
||||
[PROG] Questions about programming with OpenSSL
|
||||
|
||||
@@ -79,11 +83,11 @@ OpenSSL - Frequently Asked Questions
|
||||
* Which is the current version of OpenSSL?
|
||||
|
||||
The current version is available from <URL: http://www.openssl.org>.
|
||||
OpenSSL 1.0.0b was released on Nov 16th, 2010.
|
||||
OpenSSL 1.0.1d was released on Feb 5th, 2013.
|
||||
|
||||
In addition to the current stable release, you can also access daily
|
||||
snapshots of the OpenSSL development version at <URL:
|
||||
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
|
||||
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous Git access.
|
||||
|
||||
|
||||
* Where is the documentation?
|
||||
@@ -105,12 +109,9 @@ In addition, you can read the most current versions at
|
||||
<URL: http://www.openssl.org/docs/>. Note that the online documents refer
|
||||
to the very latest development versions of OpenSSL and may include features
|
||||
not present in released versions. If in doubt refer to the documentation
|
||||
that came with the version of OpenSSL you are using.
|
||||
|
||||
For information on parts of libcrypto that are not yet documented, you
|
||||
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
|
||||
predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>. Much
|
||||
of this still applies to OpenSSL.
|
||||
that came with the version of OpenSSL you are using. The pod format
|
||||
documentation is included in each OpenSSL distribution under the docs
|
||||
directory.
|
||||
|
||||
There is some documentation about certificate extensions and PKCS#12
|
||||
in doc/openssl.txt
|
||||
@@ -131,7 +132,7 @@ OpenSSL. Information on the OpenSSL mailing lists is available from
|
||||
* Where can I get a compiled version of OpenSSL?
|
||||
|
||||
You can finder pointers to binary distributions in
|
||||
http://www.openssl.org/related/binaries.html .
|
||||
<URL: http://www.openssl.org/related/binaries.html> .
|
||||
|
||||
Some applications that use OpenSSL are distributed in binary form.
|
||||
When using such an application, you don't need to install OpenSSL
|
||||
@@ -170,6 +171,19 @@ just do:
|
||||
|
||||
pgp TARBALL.asc
|
||||
|
||||
* How does the versioning scheme work?
|
||||
|
||||
After the release of OpenSSL 1.0.0 the versioning scheme changed. Letter
|
||||
releases (e.g. 1.0.1a) can only contain bug and security fixes and no
|
||||
new features. Minor releases change the last number (e.g. 1.0.2) and
|
||||
can contain new features that retain binary compatibility. Changes to
|
||||
the middle number are considered major releases and neither source nor
|
||||
binary compatibility is guaranteed.
|
||||
|
||||
Therefore the answer to the common question "when will feature X be
|
||||
backported to OpenSSL 1.0.0/0.9.8?" is "never" but it could appear
|
||||
in the next minor release.
|
||||
|
||||
[LEGAL] =======================================================================
|
||||
|
||||
* Do I need patent licenses to use OpenSSL?
|
||||
@@ -281,7 +295,7 @@ current directory in this case, but this has changed with 0.9.6a.)
|
||||
Check out the CA.pl(1) manual page. This provides a simple wrapper round
|
||||
the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
|
||||
out the manual pages for the individual utilities and the certificate
|
||||
extensions documentation (currently in doc/openssl.txt).
|
||||
extensions documentation (in ca(1), req(1), x509v3_config(5) )
|
||||
|
||||
|
||||
* Why can't I create certificate requests?
|
||||
@@ -463,7 +477,7 @@ administrators.
|
||||
Other projects do have other policies so you can for example extract the CA
|
||||
bundle used by Mozilla and/or modssl as described in this article:
|
||||
|
||||
http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html
|
||||
<URL: http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html>
|
||||
|
||||
|
||||
[BUILD] =======================================================================
|
||||
@@ -505,7 +519,7 @@ when you run the test suite (using "make test"). The message returned is
|
||||
"bc: 1 not implemented".
|
||||
|
||||
The best way to deal with this is to find another implementation of bc
|
||||
and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
|
||||
and compile/install it. GNU bc (see <URL: http://www.gnu.org/software/software.html>
|
||||
for download instructions) can be safely used, for example.
|
||||
|
||||
|
||||
@@ -516,7 +530,7 @@ that the OpenSSL bntest throws at it. This gets triggered when you run the
|
||||
test suite (using "make test"). The message returned is "bc: stack empty".
|
||||
|
||||
The best way to deal with this is to find another implementation of bc
|
||||
and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
|
||||
and compile/install it. GNU bc (see <URL: http://www.gnu.org/software/software.html>
|
||||
for download instructions) can be safely used, for example.
|
||||
|
||||
|
||||
@@ -709,6 +723,49 @@ never make sense, and tend to emerge when you least expect them. In order
|
||||
to identify one, drop optimization level, e.g. by editing CFLAG line in
|
||||
top-level Makefile, recompile and re-run the test.
|
||||
|
||||
* I think I've found a bug, what should I do?
|
||||
|
||||
If you are a new user then it is quite likely you haven't found a bug and
|
||||
something is happening you aren't familiar with. Check this FAQ, the associated
|
||||
documentation and the mailing lists for similar queries. If you are still
|
||||
unsure whether it is a bug or not submit a query to the openssl-users mailing
|
||||
list.
|
||||
|
||||
|
||||
* I'm SURE I've found a bug, how do I report it?
|
||||
|
||||
Bug reports with no security implications should be sent to the request
|
||||
tracker. This can be done by mailing the report to <rt@openssl.org> (or its
|
||||
alias <openssl-bugs@openssl.org>), please note that messages sent to the
|
||||
request tracker also appear in the public openssl-dev mailing list.
|
||||
|
||||
The report should be in plain text. Any patches should be sent as
|
||||
plain text attachments because some mailers corrupt patches sent inline.
|
||||
If your issue affects multiple versions of OpenSSL check any patches apply
|
||||
cleanly and, if possible include patches to each affected version.
|
||||
|
||||
The report should be given a meaningful subject line briefly summarising the
|
||||
issue. Just "bug in OpenSSL" or "bug in OpenSSL 0.9.8n" is not very helpful.
|
||||
|
||||
By sending reports to the request tracker the bug can then be given a priority
|
||||
and assigned to the appropriate maintainer. The history of discussions can be
|
||||
accessed and if the issue has been addressed or a reason why not. If patches
|
||||
are only sent to openssl-dev they can be mislaid if a team member has to
|
||||
wade through months of old messages to review the discussion.
|
||||
|
||||
See also <URL: http://www.openssl.org/support/rt.html>
|
||||
|
||||
|
||||
* I've found a security issue, how do I report it?
|
||||
|
||||
If you think your bug has security implications then please send it to
|
||||
openssl-security@openssl.org if you don't get a prompt reply at least
|
||||
acknowledging receipt then resend or mail it directly to one of the
|
||||
more active team members (e.g. Steve).
|
||||
|
||||
Note that bugs only present in the openssl utility are not in general
|
||||
considered to be security issues.
|
||||
|
||||
[PROG] ========================================================================
|
||||
|
||||
* Is OpenSSL thread-safe?
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* Borland C
|
||||
* GNU C (Cygwin or MinGW)
|
||||
|
||||
If you are compiling from a tarball or a CVS snapshot then the Win32 files
|
||||
If you are compiling from a tarball or a Git snapshot then the Win32 files
|
||||
may well be not up to date. This may mean that some "tweaking" is required to
|
||||
get it all to work. See the trouble shooting section later on for if (when?)
|
||||
it goes wrong.
|
||||
@@ -264,7 +264,7 @@ To install OpenSSL to the specified location do:
|
||||
|
||||
then ms\do_XXX should not give a warning any more. However the numbers that
|
||||
get assigned by this technique may not match those that eventually get
|
||||
assigned in the CVS tree: so anything linked against this version of the
|
||||
assigned in the Git tree: so anything linked against this version of the
|
||||
library may need to be recompiled.
|
||||
|
||||
If you get errors about unresolved symbols there are several possible
|
||||
|
2
LICENSE
2
LICENSE
@@ -12,7 +12,7 @@
|
||||
---------------
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1998-2011 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
|
||||
|
@@ -69,7 +69,7 @@ ARD=ar $(ARFLAGS) d
|
||||
RANLIB= ranlib
|
||||
PERL= perl
|
||||
TAR= tar
|
||||
TARFLAGS= --no-recursion
|
||||
TARFLAGS= --no-recursion --record-size=10240
|
||||
MAKEDEPPROG=makedepend
|
||||
LIBDIR=lib
|
||||
|
||||
|
176
NEWS
176
NEWS
@@ -5,11 +5,88 @@
|
||||
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 0.9.8o and OpenSSL 0.9.8p:
|
||||
Major changes between OpenSSL 0.9.8zb and OpenSSL 0.9.8zc [15 Oct 2014]:
|
||||
|
||||
o Fix for CVE-2014-3513
|
||||
o Fix for CVE-2014-3567
|
||||
o Mitigation for CVE-2014-3566 (SSL protocol vulnerability)
|
||||
o Fix for CVE-2014-3568
|
||||
|
||||
Major changes between OpenSSL 0.9.8za and OpenSSL 0.9.8zb [6 Aug 2014]:
|
||||
|
||||
o Fix for CVE-2014-3510
|
||||
o Fix for CVE-2014-3507
|
||||
o Fix for CVE-2014-3506
|
||||
o Fix for CVE-2014-3505
|
||||
o Fix for CVE-2014-3508
|
||||
|
||||
Known issues in OpenSSL 0.9.8za:
|
||||
|
||||
o Compilation failure of s3_pkt.c on some platforms due to missing
|
||||
<limits.h> include. Fixed in 0.9.8zb-dev.
|
||||
o FIPS capable link failure with missing symbol BN_consttime_swap.
|
||||
Fixed in 0.9.8zb-dev. Workaround is to compile with no-ec: the EC
|
||||
algorithms are not FIPS approved in OpenSSL 0.9.8 anyway.
|
||||
|
||||
Major changes between OpenSSL 0.9.8y and OpenSSL 0.9.8za [5 Jun 2014]:
|
||||
|
||||
o Fix for CVE-2014-0224
|
||||
o Fix for CVE-2014-0221
|
||||
o Fix for CVE-2014-0195
|
||||
o Fix for CVE-2014-3470
|
||||
o Fix for CVE-2014-0076
|
||||
o Fix for CVE-2010-5298
|
||||
o Fix to TLS alert handling.
|
||||
|
||||
Major changes between OpenSSL 0.9.8x and OpenSSL 0.9.8y [5 Feb 2013]:
|
||||
|
||||
o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
|
||||
o Fix OCSP bad key DoS attack CVE-2013-0166
|
||||
|
||||
Major changes between OpenSSL 0.9.8w and OpenSSL 0.9.8x [10 May 2012]:
|
||||
|
||||
o Fix DTLS record length checking bug CVE-2012-2333
|
||||
|
||||
Major changes between OpenSSL 0.9.8v and OpenSSL 0.9.8w [23 Apr 2012]:
|
||||
|
||||
o Fix for CVE-2012-2131 (corrected fix for 0.9.8 and CVE-2012-2110)
|
||||
|
||||
Major changes between OpenSSL 0.9.8u and OpenSSL 0.9.8v [19 Apr 2012]:
|
||||
|
||||
o Fix for ASN1 overflow bug CVE-2012-2110
|
||||
|
||||
Major changes between OpenSSL 0.9.8t and OpenSSL 0.9.8u [12 Mar 2012]:
|
||||
|
||||
o Fix for CMS/PKCS#7 MMA CVE-2012-0884
|
||||
o Corrected fix for CVE-2011-4619
|
||||
o Various DTLS fixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.8s and OpenSSL 0.9.8t [18 Jan 2012]:
|
||||
|
||||
o Fix for DTLS DoS issue CVE-2012-0050
|
||||
|
||||
Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s [4 Jan 2012]:
|
||||
|
||||
o Fix for DTLS plaintext recovery attack CVE-2011-4108
|
||||
o Fix policy check double free error CVE-2011-4109
|
||||
o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
|
||||
o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
|
||||
o Check for malformed RFC3779 data CVE-2011-4577
|
||||
|
||||
Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r [8 Feb 2011]:
|
||||
|
||||
o Fix for security issue CVE-2011-0014
|
||||
|
||||
Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q [2 Dec 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-4180
|
||||
o Fix for CVE-2010-4252
|
||||
|
||||
Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p [16 Nov 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-3864.
|
||||
|
||||
Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o:
|
||||
Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o [1 Jun 2010]:
|
||||
|
||||
o Fix for security issue CVE-2010-0742.
|
||||
o Various DTLS fixes.
|
||||
@@ -17,12 +94,12 @@
|
||||
o Fix for no-rc4 compilation.
|
||||
o Chil ENGINE unload workaround.
|
||||
|
||||
Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n:
|
||||
Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]:
|
||||
|
||||
o CFB cipher definition fixes.
|
||||
o Fix security issues CVE-2010-0740 and CVE-2010-0433.
|
||||
|
||||
Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m:
|
||||
Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010]:
|
||||
|
||||
o Cipher definition fixes.
|
||||
o Workaround for slow RAND_poll() on some WIN32 versions.
|
||||
@@ -34,33 +111,33 @@
|
||||
o Ticket and SNI coexistence fixes.
|
||||
o Many fixes to DTLS handling.
|
||||
|
||||
Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l:
|
||||
Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]:
|
||||
|
||||
o Temporary work around for CVE-2009-3555: disable renegotiation.
|
||||
|
||||
Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k:
|
||||
Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]:
|
||||
|
||||
o Fix various build issues.
|
||||
o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789)
|
||||
|
||||
Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j:
|
||||
Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009]:
|
||||
|
||||
o Fix security issue (CVE-2008-5077)
|
||||
o Merge FIPS 140-2 branch code.
|
||||
|
||||
Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h:
|
||||
Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]:
|
||||
|
||||
o CryptoAPI ENGINE support.
|
||||
o Various precautionary measures.
|
||||
o Fix for bugs affecting certificate request creation.
|
||||
o Support for local machine keyset attribute in PKCS#12 files.
|
||||
|
||||
Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g:
|
||||
Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007]:
|
||||
|
||||
o Backport of CMS functionality to 0.9.8.
|
||||
o Fixes for bugs introduced with 0.9.8f.
|
||||
|
||||
Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f:
|
||||
Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]:
|
||||
|
||||
o Add gcc 4.2 support.
|
||||
o Add support for AES and SSE2 assembly lanugauge optimization
|
||||
@@ -71,23 +148,23 @@
|
||||
o RFC4507bis support.
|
||||
o TLS Extensions support.
|
||||
|
||||
Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e:
|
||||
Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]:
|
||||
|
||||
o Various ciphersuite selection fixes.
|
||||
o RFC3779 support.
|
||||
|
||||
Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d:
|
||||
Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]:
|
||||
|
||||
o Introduce limits to prevent malicious key DoS (CVE-2006-2940)
|
||||
o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
|
||||
o Changes to ciphersuite selection algorithm
|
||||
|
||||
Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c:
|
||||
Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]:
|
||||
|
||||
o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
|
||||
o New cipher Camellia
|
||||
|
||||
Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b:
|
||||
Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]:
|
||||
|
||||
o Cipher string fixes.
|
||||
o Fixes for VC++ 2005.
|
||||
@@ -97,12 +174,12 @@
|
||||
o Built in dynamic engine compilation support on Win32.
|
||||
o Fixes auto dynamic engine loading in Win32.
|
||||
|
||||
Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a:
|
||||
Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]:
|
||||
|
||||
o Fix potential SSL 2.0 rollback, CVE-2005-2969
|
||||
o Extended Windows CE support
|
||||
|
||||
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8:
|
||||
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]:
|
||||
|
||||
o Major work on the BIGNUM library for higher efficiency and to
|
||||
make operations more streamlined and less contradictory. This
|
||||
@@ -176,31 +253,36 @@
|
||||
o Added initial support for Win64.
|
||||
o Added alternate pkg-config files.
|
||||
|
||||
Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l:
|
||||
Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]:
|
||||
|
||||
o FIPS 1.1.1 module linking.
|
||||
o Various ciphersuite selection fixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]:
|
||||
|
||||
o Introduce limits to prevent malicious key DoS (CVE-2006-2940)
|
||||
o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
|
||||
|
||||
Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k:
|
||||
Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006]:
|
||||
|
||||
o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
|
||||
|
||||
Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j:
|
||||
Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]:
|
||||
|
||||
o Visual C++ 2005 fixes.
|
||||
o Update Windows build system for FIPS.
|
||||
|
||||
Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i:
|
||||
Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]:
|
||||
|
||||
o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build.
|
||||
|
||||
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h:
|
||||
Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]:
|
||||
|
||||
o Fix SSL 2.0 Rollback, CVE-2005-2969
|
||||
o Allow use of fixed-length exponent on DSA signing
|
||||
o Default fixed-window RSA, DSA, DH private-key operations
|
||||
|
||||
Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g:
|
||||
Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]:
|
||||
|
||||
o More compilation issues fixed.
|
||||
o Adaptation to more modern Kerberos API.
|
||||
@@ -209,7 +291,7 @@
|
||||
o More constification.
|
||||
o Added processing of proxy certificates (RFC 3820).
|
||||
|
||||
Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f:
|
||||
Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]:
|
||||
|
||||
o Several compilation issues fixed.
|
||||
o Many memory allocation failure checks added.
|
||||
@@ -217,12 +299,12 @@
|
||||
o Mandatory basic checks on certificates.
|
||||
o Performance improvements.
|
||||
|
||||
Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e:
|
||||
Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]:
|
||||
|
||||
o Fix race condition in CRL checking code.
|
||||
o Fixes to PKCS#7 (S/MIME) code.
|
||||
|
||||
Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d:
|
||||
Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]:
|
||||
|
||||
o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug
|
||||
o Security: Fix null-pointer assignment in do_change_cipher_spec()
|
||||
@@ -230,14 +312,14 @@
|
||||
o Multiple X509 verification fixes
|
||||
o Speed up HMAC and other operations
|
||||
|
||||
Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c:
|
||||
Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]:
|
||||
|
||||
o Security: fix various ASN1 parsing bugs.
|
||||
o New -ignore_err option to OCSP utility.
|
||||
o Various interop and bug fixes in S/MIME code.
|
||||
o SSL/TLS protocol fix for unrequested client certificates.
|
||||
|
||||
Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b:
|
||||
Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]:
|
||||
|
||||
o Security: counter the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack
|
||||
@@ -248,7 +330,7 @@
|
||||
o ASN.1: treat domainComponent correctly.
|
||||
o Documentation: fixes and additions.
|
||||
|
||||
Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a:
|
||||
Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]:
|
||||
|
||||
o Security: Important security related bugfixes.
|
||||
o Enhanced compatibility with MIT Kerberos.
|
||||
@@ -259,7 +341,7 @@
|
||||
o SSL/TLS: now handles manual certificate chain building.
|
||||
o SSL/TLS: certain session ID malfunctions corrected.
|
||||
|
||||
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
|
||||
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]:
|
||||
|
||||
o New library section OCSP.
|
||||
o Complete rewrite of ASN1 code.
|
||||
@@ -305,23 +387,23 @@
|
||||
o SSL/TLS: add callback to retrieve SSL/TLS messages.
|
||||
o SSL/TLS: support AES cipher suites (RFC3268).
|
||||
|
||||
Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k:
|
||||
Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]:
|
||||
|
||||
o Security: fix various ASN1 parsing bugs.
|
||||
o SSL/TLS protocol fix for unrequested client certificates.
|
||||
|
||||
Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j:
|
||||
Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]:
|
||||
|
||||
o Security: counter the Klima-Pokorny-Rosa extension of
|
||||
Bleichbacher's attack
|
||||
o Security: make RSA blinding default.
|
||||
o Build: shared library support fixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i:
|
||||
Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]:
|
||||
|
||||
o Important security related bugfixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h:
|
||||
Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]:
|
||||
|
||||
o New configuration targets for Tandem OSS and A/UX.
|
||||
o New OIDs for Microsoft attributes.
|
||||
@@ -335,25 +417,25 @@
|
||||
o Fixes for smaller building problems.
|
||||
o Updates of manuals, FAQ and other instructive documents.
|
||||
|
||||
Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g:
|
||||
Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]:
|
||||
|
||||
o Important building fixes on Unix.
|
||||
|
||||
Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f:
|
||||
Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]:
|
||||
|
||||
o Various important bugfixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e:
|
||||
Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]:
|
||||
|
||||
o Important security related bugfixes.
|
||||
o Various SSL/TLS library bugfixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d:
|
||||
Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]:
|
||||
|
||||
o Various SSL/TLS library bugfixes.
|
||||
o Fix DH parameter generation for 'non-standard' generators.
|
||||
|
||||
Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c:
|
||||
Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]:
|
||||
|
||||
o Various SSL/TLS library bugfixes.
|
||||
o BIGNUM library fixes.
|
||||
@@ -366,7 +448,7 @@
|
||||
Broadcom and Cryptographic Appliance's keyserver
|
||||
[in 0.9.6c-engine release].
|
||||
|
||||
Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b:
|
||||
Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001]:
|
||||
|
||||
o Security fix: PRNG improvements.
|
||||
o Security fix: RSA OAEP check.
|
||||
@@ -383,7 +465,7 @@
|
||||
o Increase default size for BIO buffering filter.
|
||||
o Compatibility fixes in some scripts.
|
||||
|
||||
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a:
|
||||
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]:
|
||||
|
||||
o Security fix: change behavior of OpenSSL to avoid using
|
||||
environment variables when running as root.
|
||||
@@ -408,7 +490,7 @@
|
||||
o New function BN_rand_range().
|
||||
o Add "-rand" option to openssl s_client and s_server.
|
||||
|
||||
Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
|
||||
Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000]:
|
||||
|
||||
o Some documentation for BIO and SSL libraries.
|
||||
o Enhanced chain verification using key identifiers.
|
||||
@@ -423,7 +505,7 @@
|
||||
[1] The support for external crypto devices is currently a separate
|
||||
distribution. See the file README.ENGINE.
|
||||
|
||||
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
|
||||
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000]:
|
||||
|
||||
o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
|
||||
o Shared library support for HPUX and Solaris-gcc
|
||||
@@ -432,7 +514,7 @@
|
||||
o New 'rand' application
|
||||
o New way to check for existence of algorithms from scripts
|
||||
|
||||
Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5:
|
||||
Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000]:
|
||||
|
||||
o S/MIME support in new 'smime' command
|
||||
o Documentation for the OpenSSL command line application
|
||||
@@ -468,7 +550,7 @@
|
||||
o Enhanced support for Alpha Linux
|
||||
o Experimental MacOS support
|
||||
|
||||
Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4:
|
||||
Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]:
|
||||
|
||||
o Transparent support for PKCS#8 format private keys: these are used
|
||||
by several software packages and are more secure than the standard
|
||||
@@ -479,7 +561,7 @@
|
||||
o New pipe-like BIO that allows using the SSL library when actual I/O
|
||||
must be handled by the application (BIO pair)
|
||||
|
||||
Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3:
|
||||
Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999]:
|
||||
o Lots of enhancements and cleanups to the Configuration mechanism
|
||||
o RSA OEAP related fixes
|
||||
o Added `openssl ca -revoke' option for revoking a certificate
|
||||
@@ -493,7 +575,7 @@
|
||||
o Sparc assembler bignum implementation, optimized hash functions
|
||||
o Option to disable selected ciphers
|
||||
|
||||
Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b:
|
||||
Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]:
|
||||
o Fixed a security hole related to session resumption
|
||||
o Fixed RSA encryption routines for the p < q case
|
||||
o "ALL" in cipher lists now means "everything except NULL ciphers"
|
||||
@@ -515,7 +597,7 @@
|
||||
o Lots of memory leak fixes.
|
||||
o Lots of bug fixes.
|
||||
|
||||
Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c:
|
||||
Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]:
|
||||
o Integration of the popular NO_RSA/NO_DSA patches
|
||||
o Initial support for compression inside the SSL record layer
|
||||
o Added BIO proxy and filtering functionality
|
||||
|
6
README
6
README
@@ -1,7 +1,7 @@
|
||||
|
||||
OpenSSL 0.9.8p 16 Nov 2010
|
||||
OpenSSL 0.9.8zc 15 Oct 2014
|
||||
|
||||
Copyright (c) 1998-2009 The OpenSSL Project
|
||||
Copyright (c) 1998-2011 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
All rights reserved.
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
reason as to why that feature isn't implemented.
|
||||
|
||||
Patches should be as up to date as possible, preferably relative to the
|
||||
current CVS or the last snapshot. They should follow the coding style of
|
||||
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
|
||||
|
143
STATUS
143
STATUS
@@ -1,143 +0,0 @@
|
||||
|
||||
OpenSSL STATUS Last modified at
|
||||
______________ $Date: 2010/11/16 14:37:27 $
|
||||
|
||||
DEVELOPMENT STATE
|
||||
|
||||
o OpenSSL 1.1.0: Under development...
|
||||
o OpenSSL 1.0.0b: Released on November 16th, 2010
|
||||
o OpenSSL 1.0.0a: Released on June 1st, 2010
|
||||
o OpenSSL 1.0.0: Released on March 29th, 2010
|
||||
o OpenSSL 0.9.8p: Released on November 16th, 2010
|
||||
o OpenSSL 0.9.8o: Released on June 1st, 2010
|
||||
o OpenSSL 0.9.8n: Released on March 24th, 2010
|
||||
o OpenSSL 0.9.8m: Released on February 25th, 2010
|
||||
o OpenSSL 0.9.8l: Released on November 5th, 2009
|
||||
o OpenSSL 0.9.8k: Released on March 25th, 2009
|
||||
o OpenSSL 0.9.8j: Released on January 7th, 2009
|
||||
o OpenSSL 0.9.8i: Released on September 15th, 2008
|
||||
o OpenSSL 0.9.8h: Released on May 28th, 2008
|
||||
o OpenSSL 0.9.8g: Released on October 19th, 2007
|
||||
o OpenSSL 0.9.8f: Released on October 11th, 2007
|
||||
o OpenSSL 0.9.8e: Released on February 23rd, 2007
|
||||
o OpenSSL 0.9.8d: Released on September 28th, 2006
|
||||
o OpenSSL 0.9.8c: Released on September 5th, 2006
|
||||
o OpenSSL 0.9.8b: Released on May 4th, 2006
|
||||
o OpenSSL 0.9.8a: Released on October 11th, 2005
|
||||
o OpenSSL 0.9.8: Released on July 5th, 2005
|
||||
o OpenSSL 0.9.7m: Released on February 23rd, 2007
|
||||
o OpenSSL 0.9.7l: Released on September 28th, 2006
|
||||
o OpenSSL 0.9.7k: Released on September 5th, 2006
|
||||
o OpenSSL 0.9.7j: Released on May 4th, 2006
|
||||
o OpenSSL 0.9.7i: Released on October 14th, 2005
|
||||
o OpenSSL 0.9.7h: Released on October 11th, 2005
|
||||
o OpenSSL 0.9.7g: Released on April 11th, 2005
|
||||
o OpenSSL 0.9.7f: Released on March 22nd, 2005
|
||||
o OpenSSL 0.9.7e: Released on October 25th, 2004
|
||||
o OpenSSL 0.9.7d: Released on March 17th, 2004
|
||||
o OpenSSL 0.9.7c: Released on September 30th, 2003
|
||||
o OpenSSL 0.9.7b: Released on April 10th, 2003
|
||||
o OpenSSL 0.9.7a: Released on February 19th, 2003
|
||||
o OpenSSL 0.9.7: Released on December 31st, 2002
|
||||
o OpenSSL 0.9.6m: Released on March 17th, 2004
|
||||
o OpenSSL 0.9.6l: Released on November 4th, 2003
|
||||
o OpenSSL 0.9.6k: Released on September 30th, 2003
|
||||
o OpenSSL 0.9.6j: Released on April 10th, 2003
|
||||
o OpenSSL 0.9.6i: Released on February 19th, 2003
|
||||
o OpenSSL 0.9.6h: Released on December 5th, 2002
|
||||
o OpenSSL 0.9.6g: Released on August 9th, 2002
|
||||
o OpenSSL 0.9.6f: Released on August 8th, 2002
|
||||
o OpenSSL 0.9.6e: Released on July 30th, 2002
|
||||
o OpenSSL 0.9.6d: Released on May 9th, 2002
|
||||
o OpenSSL 0.9.6c: Released on December 21st, 2001
|
||||
o OpenSSL 0.9.6b: Released on July 9th, 2001
|
||||
o OpenSSL 0.9.6a: Released on April 5th, 2001
|
||||
o OpenSSL 0.9.6: Released on September 24th, 2000
|
||||
o OpenSSL 0.9.5a: Released on April 1st, 2000
|
||||
o OpenSSL 0.9.5: Released on February 28th, 2000
|
||||
o OpenSSL 0.9.4: Released on August 09th, 1999
|
||||
o OpenSSL 0.9.3a: Released on May 29th, 1999
|
||||
o OpenSSL 0.9.3: Released on May 25th, 1999
|
||||
o OpenSSL 0.9.2b: Released on March 22th, 1999
|
||||
o OpenSSL 0.9.1c: Released on December 23th, 1998
|
||||
|
||||
[See also http://www.openssl.org/support/rt.html]
|
||||
|
||||
RELEASE SHOWSTOPPERS
|
||||
|
||||
o The Makefiles fail with some SysV makes.
|
||||
o
|
||||
|
||||
AVAILABLE PATCHES
|
||||
|
||||
o
|
||||
|
||||
IN PROGRESS
|
||||
|
||||
o Steve is currently working on (in no particular order):
|
||||
ASN1 code redesign, butchery, replacement.
|
||||
OCSP
|
||||
EVP cipher enhancement.
|
||||
Enhanced certificate chain verification.
|
||||
Private key, certificate and CRL API and implementation.
|
||||
Developing and bugfixing PKCS#7 (S/MIME code).
|
||||
Various X509 issues: character sets, certificate request extensions.
|
||||
o Richard is currently working on:
|
||||
Constification
|
||||
Attribute Certificate support
|
||||
Certificate Pair support
|
||||
Storage Engines (primarly an LDAP storage engine)
|
||||
Certificate chain validation with full RFC 3280 compatibility
|
||||
|
||||
NEEDS PATCH
|
||||
|
||||
o 0.9.8-dev: COMPLEMENTOFALL and COMPLEMENTOFDEFAULT do not
|
||||
handle ECCdraft cipher suites correctly.
|
||||
|
||||
o apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
|
||||
|
||||
o "OpenSSL STATUS" is never up-to-date.
|
||||
|
||||
OPEN ISSUES
|
||||
|
||||
o The Makefile hierarchy and build mechanism is still not a round thing:
|
||||
|
||||
1. The config vs. Configure scripts
|
||||
It's the same nasty situation as for Apache with APACI vs.
|
||||
src/Configure. It confuses.
|
||||
Suggestion: Merge Configure and config into a single configure
|
||||
script with a Autoconf style interface ;-) and remove
|
||||
Configure and config. Or even let us use GNU Autoconf
|
||||
itself. Then we can avoid a lot of those platform checks
|
||||
which are currently in Configure.
|
||||
|
||||
o Support for Shared Libraries has to be added at least
|
||||
for the major Unix platforms. The details we can rip from the stuff
|
||||
Ralf has done for the Apache src/Configure script. Ben wants the
|
||||
solution to be really simple.
|
||||
|
||||
Status: Ralf will look how we can easily incorporate the
|
||||
compiler PIC and linker DSO flags from Apache
|
||||
into the OpenSSL Configure script.
|
||||
|
||||
Ulf: +1 for using GNU autoconf and libtool (but not automake,
|
||||
which apparently is not flexible enough to generate
|
||||
libcrypto)
|
||||
|
||||
WISHES
|
||||
|
||||
o Add variants of DH_generate_parameters() and BN_generate_prime() [etc?]
|
||||
where the callback function can request that the function be aborted.
|
||||
[Gregory Stark <ghstark@pobox.com>, <rayyang2000@yahoo.com>]
|
||||
|
||||
o SRP in TLS.
|
||||
[wished by:
|
||||
Dj <derek@yo.net>, Tom Wu <tom@arcot.com>,
|
||||
Tom Holroyd <tomh@po.crl.go.jp>]
|
||||
|
||||
See http://search.ietf.org/internet-drafts/draft-ietf-tls-srp-00.txt
|
||||
as well as http://www-cs-students.stanford.edu/~tjw/srp/.
|
||||
|
||||
Tom Holroyd tells us there is a SRP patch for OpenSSH at
|
||||
http://members.tripod.com/professor_tom/archives/, that could
|
||||
be useful.
|
106
TABLE
106
TABLE
@@ -733,7 +733,7 @@ $arflags =
|
||||
$cc = cc
|
||||
$cflags = -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
|
||||
$unistd =
|
||||
$thread_cflag = -qthreaded
|
||||
$thread_cflag = -qthreaded -D_THREAD_SAFE
|
||||
$sys_id = AIX
|
||||
$lflags =
|
||||
$bn_ops = BN_LLONG RC4_CHAR
|
||||
@@ -814,7 +814,7 @@ $arflags =
|
||||
$cc = cc
|
||||
$cflags = -q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
|
||||
$unistd =
|
||||
$thread_cflag = -qthreaded
|
||||
$thread_cflag = -qthreaded -D_THREAD_SAFE
|
||||
$sys_id = AIX
|
||||
$lflags =
|
||||
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR
|
||||
@@ -864,6 +864,33 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags = -X64
|
||||
|
||||
*** android
|
||||
$cc = gcc
|
||||
$cflags = -mandroid -I$(ANDROID_DEV)/include -B$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
$lflags = -ldl
|
||||
$bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR
|
||||
$cpuid_obj =
|
||||
$bn_obj =
|
||||
$des_obj =
|
||||
$aes_obj =
|
||||
$bf_obj =
|
||||
$md5_obj =
|
||||
$sha1_obj =
|
||||
$cast_obj =
|
||||
$rc4_obj =
|
||||
$rmd160_obj =
|
||||
$rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= linux-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
|
||||
*** aux3-gcc
|
||||
$cc = gcc
|
||||
$cflags = -O2 -DTERMIO
|
||||
@@ -1242,6 +1269,33 @@ $shared_extension =
|
||||
$ranlib =
|
||||
$arflags =
|
||||
|
||||
*** debug-ben-debug-64
|
||||
$cc = gcc
|
||||
$cflags = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe
|
||||
$unistd =
|
||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
|
||||
$sys_id =
|
||||
$lflags =
|
||||
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL
|
||||
$cpuid_obj = x86_64cpuid.o
|
||||
$bn_obj = x86_64-gcc.o x86_64-mont.o
|
||||
$des_obj =
|
||||
$aes_obj = aes-x86_64.o
|
||||
$bf_obj =
|
||||
$md5_obj = md5-x86_64.o
|
||||
$sha1_obj = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
|
||||
$cast_obj =
|
||||
$rc4_obj = rc4-x86_64.o
|
||||
$rmd160_obj =
|
||||
$rc5_obj =
|
||||
$dso_scheme = elf
|
||||
$shared_target= dlfcn
|
||||
$shared_cflag = bsd-gcc-shared
|
||||
$shared_ldflag = -fPIC
|
||||
$shared_extension =
|
||||
$ranlib = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$arflags =
|
||||
|
||||
*** debug-ben-debug-noopt
|
||||
$cc = gcc
|
||||
$cflags = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -pipe
|
||||
@@ -1352,29 +1406,29 @@ $arflags =
|
||||
|
||||
*** debug-bodo
|
||||
$cc = gcc
|
||||
$cflags = -DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$cflags = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
$lflags =
|
||||
$bn_ops = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
|
||||
$cpuid_obj = x86cpuid-elf.o
|
||||
$bn_obj = bn86-elf.o co86-elf.o MAYBE-MO86-elf.o
|
||||
$des_obj = dx86-elf.o yx86-elf.o
|
||||
$aes_obj = ax86-elf.o
|
||||
$bf_obj = bx86-elf.o
|
||||
$md5_obj = mx86-elf.o
|
||||
$sha1_obj = sx86-elf.o s512sse2-elf.o
|
||||
$cast_obj = cx86-elf.o
|
||||
$rc4_obj = rx86-elf.o rc4_skey.o
|
||||
$rmd160_obj = rm86-elf.o
|
||||
$rc5_obj = r586-elf.o
|
||||
$dso_scheme =
|
||||
$shared_target=
|
||||
$shared_cflag =
|
||||
$shared_ldflag =
|
||||
$shared_extension =
|
||||
$ranlib =
|
||||
$lflags = -ldl
|
||||
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL
|
||||
$cpuid_obj = x86_64cpuid.o
|
||||
$bn_obj = x86_64-gcc.o x86_64-mont.o
|
||||
$des_obj =
|
||||
$aes_obj = aes-x86_64.o
|
||||
$bf_obj =
|
||||
$md5_obj = md5-x86_64.o
|
||||
$sha1_obj = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
|
||||
$cast_obj =
|
||||
$rc4_obj = rc4-x86_64.o
|
||||
$rmd160_obj =
|
||||
$rc5_obj =
|
||||
$dso_scheme = elf
|
||||
$shared_target= dlfcn
|
||||
$shared_cflag = linux-shared
|
||||
$shared_ldflag = -fPIC
|
||||
$shared_extension = -m64
|
||||
$ranlib = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$arflags =
|
||||
|
||||
*** debug-darwin-i386-cc
|
||||
@@ -1460,7 +1514,7 @@ $arflags =
|
||||
|
||||
*** debug-levitte-linux-elf
|
||||
$cc = gcc
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$cflags = -DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
@@ -1487,7 +1541,7 @@ $arflags =
|
||||
|
||||
*** debug-levitte-linux-elf-extreme
|
||||
$cc = gcc
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
@@ -1514,7 +1568,7 @@ $arflags =
|
||||
|
||||
*** debug-levitte-linux-noasm
|
||||
$cc = gcc
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$cflags = -DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
@@ -1541,7 +1595,7 @@ $arflags =
|
||||
|
||||
*** debug-levitte-linux-noasm-extreme
|
||||
$cc = gcc
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
|
13
apps/apps.c
13
apps/apps.c
@@ -362,6 +362,8 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
|
||||
{
|
||||
arg->count=20;
|
||||
arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
|
||||
if (arg->data == NULL)
|
||||
return 0;
|
||||
}
|
||||
for (i=0; i<arg->count; i++)
|
||||
arg->data[i]=NULL;
|
||||
@@ -558,12 +560,12 @@ int password_callback(char *buf, int bufsiz, int verify,
|
||||
|
||||
if (ok >= 0)
|
||||
ok = UI_add_input_string(ui,prompt,ui_flags,buf,
|
||||
PW_MIN_LENGTH,BUFSIZ-1);
|
||||
PW_MIN_LENGTH,bufsiz-1);
|
||||
if (ok >= 0 && verify)
|
||||
{
|
||||
buff = (char *)OPENSSL_malloc(bufsiz);
|
||||
ok = UI_add_verify_string(ui,prompt,ui_flags,buff,
|
||||
PW_MIN_LENGTH,BUFSIZ-1, buf);
|
||||
PW_MIN_LENGTH,bufsiz-1, buf);
|
||||
}
|
||||
if (ok >= 0)
|
||||
do
|
||||
@@ -1429,6 +1431,8 @@ char *make_config_name()
|
||||
|
||||
len=strlen(t)+strlen(OPENSSL_CONF)+2;
|
||||
p=OPENSSL_malloc(len);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
BUF_strlcpy(p,t,len);
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
BUF_strlcat(p,"/",len);
|
||||
@@ -2052,7 +2056,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn)
|
||||
X509_NAME *n = NULL;
|
||||
int nid;
|
||||
|
||||
if (!buf || !ne_types || !ne_values)
|
||||
if (!buf || !ne_types || !ne_values || !mval)
|
||||
{
|
||||
BIO_printf(bio_err, "malloc error\n");
|
||||
goto error;
|
||||
@@ -2156,6 +2160,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn)
|
||||
OPENSSL_free(ne_values);
|
||||
OPENSSL_free(ne_types);
|
||||
OPENSSL_free(buf);
|
||||
OPENSSL_free(mval);
|
||||
return n;
|
||||
|
||||
error:
|
||||
@@ -2164,6 +2169,8 @@ error:
|
||||
OPENSSL_free(ne_values);
|
||||
if (ne_types)
|
||||
OPENSSL_free(ne_types);
|
||||
if (mval)
|
||||
OPENSSL_free(mval);
|
||||
if (buf)
|
||||
OPENSSL_free(buf);
|
||||
return NULL;
|
||||
|
@@ -408,6 +408,7 @@ static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
|
||||
|
||||
atyp = ASN1_generate_nconf(genstr, cnf);
|
||||
NCONF_free(cnf);
|
||||
cnf = NULL;
|
||||
|
||||
if (!atyp)
|
||||
return -1;
|
||||
|
@@ -1582,12 +1582,14 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
{
|
||||
ok=0;
|
||||
BIO_printf(bio_err,"Signature verification problems....\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
ok=0;
|
||||
BIO_printf(bio_err,"Signature did not match the certificate request\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
@@ -2751,6 +2753,9 @@ char *make_revocation_str(int rev_type, char *rev_arg)
|
||||
|
||||
revtm = X509_gmtime_adj(NULL, 0);
|
||||
|
||||
if (!revtm)
|
||||
return NULL;
|
||||
|
||||
i = revtm->length + 1;
|
||||
|
||||
if (reason) i += strlen(reason) + 1;
|
||||
|
@@ -226,6 +226,8 @@ int MAIN(int argc, char **argv)
|
||||
else if (!strcmp(*args,"-camellia256"))
|
||||
cipher = EVP_camellia_256_cbc();
|
||||
#endif
|
||||
else if (!strcmp (*args, "-debug_decrypt"))
|
||||
flags |= CMS_DEBUG_DECRYPT;
|
||||
else if (!strcmp (*args, "-text"))
|
||||
flags |= CMS_TEXT;
|
||||
else if (!strcmp (*args, "-nointern"))
|
||||
@@ -611,7 +613,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf (bio_err, "-certsout file certificate output file\n");
|
||||
BIO_printf (bio_err, "-signer file signer certificate file\n");
|
||||
BIO_printf (bio_err, "-recip file recipient certificate file for decryption\n");
|
||||
BIO_printf (bio_err, "-skeyid use subject key identifier\n");
|
||||
BIO_printf (bio_err, "-keyid use subject key identifier\n");
|
||||
BIO_printf (bio_err, "-in file input file\n");
|
||||
BIO_printf (bio_err, "-inform arg input format SMIME (default), PEM or DER\n");
|
||||
BIO_printf (bio_err, "-inkey file input private key (if not signer or recipient)\n");
|
||||
@@ -1013,6 +1015,8 @@ int MAIN(int argc, char **argv)
|
||||
ret = 4;
|
||||
if (operation == SMIME_DECRYPT)
|
||||
{
|
||||
if (flags & CMS_DEBUG_DECRYPT)
|
||||
CMS_decrypt(cms, NULL, NULL, NULL, NULL, flags);
|
||||
|
||||
if (secret_key)
|
||||
{
|
||||
|
@@ -142,7 +142,13 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
if(!certflst) certflst = sk_new_null();
|
||||
sk_push(certflst,*(++argv));
|
||||
if (!certflst)
|
||||
goto end;
|
||||
if (!sk_push(certflst,*(++argv)))
|
||||
{
|
||||
sk_free(certflst);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -332,7 +332,6 @@ bad:
|
||||
BIO_printf(bio_err,"This is going to take a long time\n");
|
||||
if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
|
||||
{
|
||||
if(dh) DH_free(dh);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
24
apps/ocsp.c
24
apps/ocsp.c
@@ -98,6 +98,7 @@ int MAIN(int argc, char **argv)
|
||||
ENGINE *e = NULL;
|
||||
char **args;
|
||||
char *host = NULL, *port = NULL, *path = "/";
|
||||
char *thost = NULL, *tport = NULL, *tpath = NULL;
|
||||
char *reqin = NULL, *respin = NULL;
|
||||
char *reqout = NULL, *respout = NULL;
|
||||
char *signfile = NULL, *keyfile = NULL;
|
||||
@@ -173,6 +174,12 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else if (!strcmp(*args, "-url"))
|
||||
{
|
||||
if (thost)
|
||||
OPENSSL_free(thost);
|
||||
if (tport)
|
||||
OPENSSL_free(tport);
|
||||
if (tpath)
|
||||
OPENSSL_free(tpath);
|
||||
if (args[1])
|
||||
{
|
||||
args++;
|
||||
@@ -181,6 +188,9 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf(bio_err, "Error parsing URL\n");
|
||||
badarg = 1;
|
||||
}
|
||||
thost = host;
|
||||
tport = port;
|
||||
tpath = path;
|
||||
}
|
||||
else badarg = 1;
|
||||
}
|
||||
@@ -871,12 +881,12 @@ end:
|
||||
sk_X509_pop_free(sign_other, X509_free);
|
||||
sk_X509_pop_free(verify_other, X509_free);
|
||||
|
||||
if (use_ssl != -1)
|
||||
{
|
||||
OPENSSL_free(host);
|
||||
OPENSSL_free(port);
|
||||
OPENSSL_free(path);
|
||||
}
|
||||
if (thost)
|
||||
OPENSSL_free(thost);
|
||||
if (tport)
|
||||
OPENSSL_free(tport);
|
||||
if (tpath)
|
||||
OPENSSL_free(tpath);
|
||||
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
@@ -1334,7 +1344,7 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
|
||||
}
|
||||
resp = query_responder(err, cbio, path, req, req_timeout);
|
||||
if (!resp)
|
||||
BIO_printf(bio_err, "Error querying OCSP responsder\n");
|
||||
BIO_printf(bio_err, "Error querying OCSP responder\n");
|
||||
end:
|
||||
if (ctx)
|
||||
SSL_CTX_free(ctx);
|
||||
|
@@ -141,7 +141,7 @@ localityName = Locality Name (eg, city)
|
||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
||||
#organizationalUnitName_default =
|
||||
|
||||
commonName = Common Name (eg, YOUR name)
|
||||
commonName = Common Name (e.g. server FQDN or YOUR name)
|
||||
commonName_max = 64
|
||||
|
||||
emailAddress = Email Address
|
||||
|
@@ -141,7 +141,7 @@ localityName = Locality Name (eg, city)
|
||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
||||
#organizationalUnitName_default =
|
||||
|
||||
commonName = Common Name (eg, YOUR name)
|
||||
commonName = Common Name (e.g. server FQDN or YOUR name)
|
||||
commonName_max = 64
|
||||
|
||||
emailAddress = Email Address
|
||||
|
@@ -659,7 +659,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
|
||||
|
||||
if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
|
||||
if ((options & INFO) && p12->mac) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
|
||||
if(macver) {
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_push_info("verify MAC");
|
||||
|
15
apps/req.c
15
apps/req.c
@@ -1574,7 +1574,13 @@ start:
|
||||
#ifdef CHARSET_EBCDIC
|
||||
ebcdic2ascii(buf, buf, i);
|
||||
#endif
|
||||
if(!req_check_len(i, n_min, n_max)) goto start;
|
||||
if(!req_check_len(i, n_min, n_max))
|
||||
{
|
||||
if (batch || value)
|
||||
return 0;
|
||||
goto start;
|
||||
}
|
||||
|
||||
if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
|
||||
(unsigned char *) buf, -1,-1,mval)) goto err;
|
||||
ret=1;
|
||||
@@ -1633,7 +1639,12 @@ start:
|
||||
#ifdef CHARSET_EBCDIC
|
||||
ebcdic2ascii(buf, buf, i);
|
||||
#endif
|
||||
if(!req_check_len(i, n_min, n_max)) goto start;
|
||||
if(!req_check_len(i, n_min, n_max))
|
||||
{
|
||||
if (batch || value)
|
||||
return 0;
|
||||
goto start;
|
||||
}
|
||||
|
||||
if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
|
||||
(unsigned char *)buf, -1)) {
|
||||
|
18
apps/s_cb.c
18
apps/s_cb.c
@@ -518,6 +518,24 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
|
||||
case 100:
|
||||
str_details2 = " no_renegotiation";
|
||||
break;
|
||||
case 110:
|
||||
str_details2 = " unsupported_extension";
|
||||
break;
|
||||
case 111:
|
||||
str_details2 = " certificate_unobtainable";
|
||||
break;
|
||||
case 112:
|
||||
str_details2 = " unrecognized_name";
|
||||
break;
|
||||
case 113:
|
||||
str_details2 = " bad_certificate_status_response";
|
||||
break;
|
||||
case 114:
|
||||
str_details2 = " bad_certificate_hash_value";
|
||||
break;
|
||||
case 115:
|
||||
str_details2 = " unknown_psk_identity";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -226,6 +226,7 @@ static void sc_usage(void)
|
||||
BIO_printf(bio_err," -ssl3 - just use SSLv3\n");
|
||||
BIO_printf(bio_err," -tls1 - just use TLSv1\n");
|
||||
BIO_printf(bio_err," -dtls1 - just use DTLSv1\n");
|
||||
BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n");
|
||||
BIO_printf(bio_err," -mtu - set the link layer MTU\n");
|
||||
BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
|
||||
BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n");
|
||||
@@ -339,19 +340,14 @@ int MAIN(int argc, char **argv)
|
||||
char *sess_out = NULL;
|
||||
struct sockaddr peer;
|
||||
int peerlen = sizeof(peer);
|
||||
int fallback_scsv = 0;
|
||||
int enable_timeouts = 0 ;
|
||||
long socket_mtu = 0;
|
||||
#ifndef OPENSSL_NO_JPAKE
|
||||
char *jpake_secret = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
|
||||
meth=SSLv23_client_method();
|
||||
#elif !defined(OPENSSL_NO_SSL3)
|
||||
meth=SSLv3_client_method();
|
||||
#elif !defined(OPENSSL_NO_SSL2)
|
||||
meth=SSLv2_client_method();
|
||||
#endif
|
||||
|
||||
apps_startup();
|
||||
c_Pause=0;
|
||||
@@ -494,6 +490,10 @@ int MAIN(int argc, char **argv)
|
||||
socket_mtu = atol(*(++argv));
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(*argv,"-fallback_scsv") == 0)
|
||||
{
|
||||
fallback_scsv = 1;
|
||||
}
|
||||
else if (strcmp(*argv,"-bugs") == 0)
|
||||
bugs=1;
|
||||
else if (strcmp(*argv,"-keyform") == 0)
|
||||
@@ -784,6 +784,10 @@ bad:
|
||||
SSL_set_session(con, sess);
|
||||
SSL_SESSION_free(sess);
|
||||
}
|
||||
|
||||
if (fallback_scsv)
|
||||
SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV);
|
||||
|
||||
#ifndef OPENSSL_NO_TLSEXT
|
||||
if (servername != NULL)
|
||||
{
|
||||
|
@@ -583,7 +583,7 @@ static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
|
||||
|
||||
if (servername)
|
||||
{
|
||||
if (strcmp(servername,p->servername))
|
||||
if (strcasecmp(servername,p->servername))
|
||||
return p->extension_error;
|
||||
if (ctx2)
|
||||
{
|
||||
@@ -781,13 +781,7 @@ int MAIN(int argc, char *argv[])
|
||||
tlsextctx tlsextcbp = {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
|
||||
meth=SSLv23_server_method();
|
||||
#elif !defined(OPENSSL_NO_SSL3)
|
||||
meth=SSLv3_server_method();
|
||||
#elif !defined(OPENSSL_NO_SSL2)
|
||||
meth=SSLv2_server_method();
|
||||
#endif
|
||||
|
||||
local_argc=argc;
|
||||
local_argv=argv;
|
||||
@@ -1101,6 +1095,14 @@ bad:
|
||||
sv_usage();
|
||||
goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DTLS1
|
||||
if (www && socket_type == SOCK_DGRAM)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"Can't use -HTTP, -www or -WWW with DTLS\n");
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
SSL_load_error_strings();
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
@@ -1556,6 +1558,12 @@ end:
|
||||
if (dpass)
|
||||
OPENSSL_free(dpass);
|
||||
#ifndef OPENSSL_NO_TLSEXT
|
||||
if (tlscstatp.host)
|
||||
OPENSSL_free(tlscstatp.host);
|
||||
if (tlscstatp.port)
|
||||
OPENSSL_free(tlscstatp.port);
|
||||
if (tlscstatp.path)
|
||||
OPENSSL_free(tlscstatp.path);
|
||||
if (ctx2 != NULL) SSL_CTX_free(ctx2);
|
||||
if (s_cert2)
|
||||
X509_free(s_cert2);
|
||||
@@ -1922,8 +1930,10 @@ again:
|
||||
#ifdef CHARSET_EBCDIC
|
||||
ascii2ebcdic(buf,buf,i);
|
||||
#endif
|
||||
write(fileno(stdout),buf,
|
||||
(unsigned int)i);
|
||||
if (write(fileno(stdout),buf,
|
||||
(unsigned int)i) != i)
|
||||
goto err;
|
||||
|
||||
if (SSL_pending(con)) goto again;
|
||||
break;
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
|
@@ -521,8 +521,8 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
if (!cipher)
|
||||
{
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
cipher = EVP_rc2_40_cbc();
|
||||
#ifndef OPENSSL_NO_DES
|
||||
cipher = EVP_des_ede3_cbc();
|
||||
#else
|
||||
BIO_printf(bio_err, "No cipher selected\n");
|
||||
goto end;
|
||||
|
12
apps/speed.c
12
apps/speed.c
@@ -2767,7 +2767,11 @@ static int do_multi(int multi)
|
||||
fds=malloc(multi*sizeof *fds);
|
||||
for(n=0 ; n < multi ; ++n)
|
||||
{
|
||||
pipe(fd);
|
||||
if (pipe(fd) == -1)
|
||||
{
|
||||
fprintf(stderr, "pipe failure\n");
|
||||
exit(1);
|
||||
}
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if(fork())
|
||||
@@ -2779,7 +2783,11 @@ static int do_multi(int multi)
|
||||
{
|
||||
close(fd[0]);
|
||||
close(1);
|
||||
dup(fd[1]);
|
||||
if (dup(fd[1]) == -1)
|
||||
{
|
||||
fprintf(stderr, "dup failed\n");
|
||||
exit(1);
|
||||
}
|
||||
close(fd[1]);
|
||||
mr=1;
|
||||
usertime=0;
|
||||
|
@@ -969,7 +969,7 @@ bad:
|
||||
else
|
||||
{
|
||||
pk=load_key(bio_err,
|
||||
keyfile, FORMAT_PEM, 0,
|
||||
keyfile, keyformat, 0,
|
||||
passin, e, "request key");
|
||||
if (pk == NULL) goto end;
|
||||
}
|
||||
|
4
config
4
config
@@ -790,6 +790,10 @@ esac
|
||||
# options="$options -DATALLA"
|
||||
#fi
|
||||
|
||||
($CC -Wa,--help -c -o /dev/null -x assembler /dev/null 2>&1 | \
|
||||
grep \\--noexecstack) 2>&1 > /dev/null && \
|
||||
options="$options -Wa,--noexecstack"
|
||||
|
||||
# gcc < 2.8 does not support -march=ultrasparc
|
||||
if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
|
||||
then
|
||||
|
@@ -1,4 +1,3 @@
|
||||
/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
@@ -82,6 +81,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
size_t filespeclen = strlen(directory);
|
||||
char *filespec = NULL;
|
||||
|
||||
if (filespeclen == 0)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MUST be a VMS directory specification! Let's estimate if it is. */
|
||||
if (directory[filespeclen-1] != ']'
|
||||
&& directory[filespeclen-1] != '>'
|
||||
|
@@ -1,4 +1,3 @@
|
||||
/* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||
* All rights reserved.
|
||||
@@ -65,6 +64,16 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
errno = 0;
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
const char *extdir = directory;
|
||||
char *extdirbuf = NULL;
|
||||
size_t dirlen = strlen (directory);
|
||||
|
||||
if (dirlen == 0)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
|
||||
if (*ctx == NULL)
|
||||
{
|
||||
@@ -73,15 +82,35 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
}
|
||||
memset(*ctx, '\0', sizeof(LP_DIR_CTX));
|
||||
|
||||
if (directory[dirlen-1] != '*')
|
||||
{
|
||||
extdirbuf = (char *)malloc(dirlen + 3);
|
||||
if (extdirbuf == NULL)
|
||||
{
|
||||
free(*ctx);
|
||||
*ctx = NULL;
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
if (directory[dirlen-1] != '/' && directory[dirlen-1] != '\\')
|
||||
extdir = strcat(strcpy (extdirbuf,directory),"/*");
|
||||
else
|
||||
extdir = strcat(strcpy (extdirbuf,directory),"*");
|
||||
}
|
||||
|
||||
if (sizeof(TCHAR) != sizeof(char))
|
||||
{
|
||||
TCHAR *wdir = NULL;
|
||||
/* len_0 denotes string length *with* trailing 0 */
|
||||
size_t index = 0,len_0 = strlen(directory) + 1;
|
||||
size_t index = 0,len_0 = strlen(extdir) + 1;
|
||||
|
||||
wdir = (TCHAR *)malloc(len_0 * sizeof(TCHAR));
|
||||
wdir = (TCHAR *)calloc(len_0, sizeof(TCHAR));
|
||||
if (wdir == NULL)
|
||||
{
|
||||
if (extdirbuf != NULL)
|
||||
{
|
||||
free (extdirbuf);
|
||||
}
|
||||
free(*ctx);
|
||||
*ctx = NULL;
|
||||
errno = ENOMEM;
|
||||
@@ -89,17 +118,23 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
}
|
||||
|
||||
#ifdef LP_MULTIBYTE_AVAILABLE
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, len_0))
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, extdir, len_0, (WCHAR *)wdir, len_0))
|
||||
#endif
|
||||
for (index = 0; index < len_0; index++)
|
||||
wdir[index] = (TCHAR)directory[index];
|
||||
wdir[index] = (TCHAR)extdir[index];
|
||||
|
||||
(*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx);
|
||||
|
||||
free(wdir);
|
||||
}
|
||||
else
|
||||
(*ctx)->handle = FindFirstFile((TCHAR *)directory, &(*ctx)->ctx);
|
||||
{
|
||||
(*ctx)->handle = FindFirstFile((TCHAR *)extdir, &(*ctx)->ctx);
|
||||
}
|
||||
if (extdirbuf != NULL)
|
||||
{
|
||||
free (extdirbuf);
|
||||
}
|
||||
|
||||
if ((*ctx)->handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@@ -116,7 +151,6 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof(TCHAR) != sizeof(char))
|
||||
{
|
||||
TCHAR *wdir = (*ctx)->ctx.cFileName;
|
||||
|
@@ -30,6 +30,7 @@ AFLAGS=$(ASFLAGS)
|
||||
LIBS=
|
||||
|
||||
GENERAL=Makefile README crypto-lib.com install.com
|
||||
TEST=constant_time_test.c
|
||||
|
||||
LIB= $(TOP)/libcrypto.a
|
||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
|
||||
|
@@ -57,6 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
@@ -143,17 +144,11 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
BUF_MEM *b;
|
||||
unsigned char *p;
|
||||
int i;
|
||||
int ret=-1;
|
||||
ASN1_const_CTX c;
|
||||
int want=HEADER_SIZE;
|
||||
size_t want=HEADER_SIZE;
|
||||
int eos=0;
|
||||
#if defined(__GNUC__) && defined(__ia64)
|
||||
/* pathetic compiler bug in all known versions as of Nov. 2002 */
|
||||
long off=0;
|
||||
#else
|
||||
int off=0;
|
||||
#endif
|
||||
int len=0;
|
||||
size_t off=0;
|
||||
size_t len=0;
|
||||
|
||||
b=BUF_MEM_new();
|
||||
if (b == NULL)
|
||||
@@ -169,7 +164,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
{
|
||||
want-=(len-off);
|
||||
|
||||
if (!BUF_MEM_grow_clean(b,len+want))
|
||||
if (len + want < len || !BUF_MEM_grow_clean(b,len+want))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
@@ -181,7 +176,14 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
goto err;
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
if (len+i < len)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
|
||||
goto err;
|
||||
}
|
||||
len+=i;
|
||||
}
|
||||
}
|
||||
/* else data already loaded */
|
||||
|
||||
@@ -206,6 +208,11 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
{
|
||||
/* no data body so go round again */
|
||||
eos++;
|
||||
if (eos < 0)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_HEADER_TOO_LONG);
|
||||
goto err;
|
||||
}
|
||||
want=HEADER_SIZE;
|
||||
}
|
||||
else if (eos && (c.slen == 0) && (c.tag == V_ASN1_EOC))
|
||||
@@ -220,10 +227,16 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
else
|
||||
{
|
||||
/* suck in c.slen bytes of data */
|
||||
want=(int)c.slen;
|
||||
want=c.slen;
|
||||
if (want > (len-off))
|
||||
{
|
||||
want-=(len-off);
|
||||
if (want > INT_MAX /* BIO_read takes an int length */ ||
|
||||
len+want < len)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
|
||||
goto err;
|
||||
}
|
||||
if (!BUF_MEM_grow_clean(b,len+want))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
|
||||
@@ -238,11 +251,18 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
ASN1_R_NOT_ENOUGH_DATA);
|
||||
goto err;
|
||||
}
|
||||
/* This can't overflow because
|
||||
* |len+want| didn't overflow. */
|
||||
len+=i;
|
||||
want -= i;
|
||||
want-=i;
|
||||
}
|
||||
}
|
||||
off+=(int)c.slen;
|
||||
if (off + c.slen < off)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
|
||||
goto err;
|
||||
}
|
||||
off+=c.slen;
|
||||
if (eos <= 0)
|
||||
{
|
||||
break;
|
||||
@@ -252,9 +272,15 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
}
|
||||
}
|
||||
|
||||
if (off > INT_MAX)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
|
||||
goto err;
|
||||
}
|
||||
|
||||
*pb = b;
|
||||
return off;
|
||||
err:
|
||||
if (b != NULL) BUF_MEM_free(b);
|
||||
return(ret);
|
||||
return -1;
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
|
||||
int pad=0,ret,i,neg;
|
||||
unsigned char *p,*n,pb=0;
|
||||
|
||||
if ((a == NULL) || (a->data == NULL)) return(0);
|
||||
if (a == NULL) return(0);
|
||||
neg=a->type & V_ASN1_NEG;
|
||||
if (a->length == 0)
|
||||
ret=1;
|
||||
|
@@ -139,7 +139,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
|
||||
ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT);
|
||||
goto err;
|
||||
}
|
||||
if (!use_bn && l > (ULONG_MAX / 10L))
|
||||
if (!use_bn && l >= ((ULONG_MAX - 80) / 10L))
|
||||
{
|
||||
use_bn = 1;
|
||||
if (!bl)
|
||||
@@ -285,16 +285,28 @@ err:
|
||||
ASN1_OBJECT_free(ret);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
long len)
|
||||
{
|
||||
ASN1_OBJECT *ret=NULL;
|
||||
const unsigned char *p;
|
||||
int i;
|
||||
/* Sanity check OID encoding: can't have leading 0x80 in
|
||||
* subidentifiers, see: X.690 8.19.2
|
||||
int i, length;
|
||||
|
||||
/* Sanity check OID encoding.
|
||||
* Need at least one content octet.
|
||||
* MSB must be clear in the last octet.
|
||||
* can't have leading 0x80 in subidentifiers, see: X.690 8.19.2
|
||||
*/
|
||||
for (i = 0, p = *pp + 1; i < len - 1; i++, p++)
|
||||
if (len <= 0 || len > INT_MAX || pp == NULL || (p = *pp) == NULL ||
|
||||
p[len - 1] & 0x80)
|
||||
{
|
||||
ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING);
|
||||
return NULL;
|
||||
}
|
||||
/* Now 0 < len <= INT_MAX, so the cast is safe. */
|
||||
length = (int)len;
|
||||
for (i = 0; i < length; i++, p++)
|
||||
{
|
||||
if (*p == 0x80 && (!i || !(p[-1] & 0x80)))
|
||||
{
|
||||
@@ -313,20 +325,20 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
else ret=(*a);
|
||||
|
||||
p= *pp;
|
||||
if ((ret->data == NULL) || (ret->length < len))
|
||||
if ((ret->data == NULL) || (ret->length < length))
|
||||
{
|
||||
if (ret->data != NULL) OPENSSL_free(ret->data);
|
||||
ret->data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
|
||||
ret->data=(unsigned char *)OPENSSL_malloc(length);
|
||||
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
|
||||
if (ret->data == NULL)
|
||||
{ i=ERR_R_MALLOC_FAILURE; goto err; }
|
||||
}
|
||||
memcpy(ret->data,p,(int)len);
|
||||
ret->length=(int)len;
|
||||
memcpy(ret->data,p,length);
|
||||
ret->length=length;
|
||||
ret->sn=NULL;
|
||||
ret->ln=NULL;
|
||||
/* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
|
||||
p+=len;
|
||||
p+=length;
|
||||
|
||||
if (a != NULL) (*a)=ret;
|
||||
*pp=p;
|
||||
|
@@ -74,6 +74,11 @@
|
||||
|
||||
#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
|
||||
|
||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
|
||||
ASN1_STRFLGS_ESC_QUOTE | \
|
||||
ASN1_STRFLGS_ESC_CTRL | \
|
||||
ASN1_STRFLGS_ESC_MSB)
|
||||
|
||||
|
||||
/* Three IO functions for sending data to memory, a BIO and
|
||||
* and a FILE pointer.
|
||||
@@ -148,6 +153,13 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch
|
||||
if(!io_ch(arg, tmphex, 3)) return -1;
|
||||
return 3;
|
||||
}
|
||||
/* If we get this far and do any escaping at all must escape
|
||||
* the escape character itself: backslash.
|
||||
*/
|
||||
if (chtmp == '\\' && flags & ESC_FLAGS) {
|
||||
if(!io_ch(arg, "\\\\", 2)) return -1;
|
||||
return 2;
|
||||
}
|
||||
if(!io_ch(arg, &chtmp, 1)) return -1;
|
||||
return 1;
|
||||
}
|
||||
@@ -292,11 +304,6 @@ static const signed char tag2nbyte[] = {
|
||||
4, -1, 2 /* 28-30 */
|
||||
};
|
||||
|
||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
|
||||
ASN1_STRFLGS_ESC_QUOTE | \
|
||||
ASN1_STRFLGS_ESC_CTRL | \
|
||||
ASN1_STRFLGS_ESC_MSB)
|
||||
|
||||
/* This is the main function, print out an
|
||||
* ASN1_STRING taking note of various escape
|
||||
* and display options. Returns number of
|
||||
@@ -560,6 +567,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
|
||||
if(mbflag == -1) return -1;
|
||||
mbflag |= MBSTRING_FLAG;
|
||||
stmp.data = NULL;
|
||||
stmp.length = 0;
|
||||
ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
|
||||
if(ret < 0) return ret;
|
||||
*out = stmp.data;
|
||||
|
@@ -75,7 +75,7 @@ static int table_cmp(const void *a, const void *b);
|
||||
* certain software (e.g. Netscape) has problems with them.
|
||||
*/
|
||||
|
||||
static unsigned long global_mask = 0xFFFFFFFFL;
|
||||
static unsigned long global_mask = B_ASN1_UTF8STRING;
|
||||
|
||||
void ASN1_STRING_set_default_mask(unsigned long mask)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ unsigned long ASN1_STRING_get_default_mask(void)
|
||||
* default: the default value, Printable, T61, BMP.
|
||||
*/
|
||||
|
||||
int ASN1_STRING_set_default_mask_asc(char *p)
|
||||
int ASN1_STRING_set_default_mask_asc(const char *p)
|
||||
{
|
||||
unsigned long mask;
|
||||
char *end;
|
||||
|
@@ -138,6 +138,12 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
||||
unsigned char *buf_in=NULL;
|
||||
int ret= -1,i,inl;
|
||||
|
||||
if (!pkey)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
i=OBJ_obj2nid(a->algorithm);
|
||||
type=EVP_get_digestbyname(OBJ_nid2sn(i));
|
||||
|
@@ -1051,7 +1051,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
|
||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
|
||||
|
||||
void ASN1_STRING_set_default_mask(unsigned long mask);
|
||||
int ASN1_STRING_set_default_mask_asc(char *p);
|
||||
int ASN1_STRING_set_default_mask_asc(const char *p);
|
||||
unsigned long ASN1_STRING_get_default_mask(void);
|
||||
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
|
||||
int inform, unsigned long mask);
|
||||
|
@@ -131,6 +131,9 @@ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
|
||||
*pclass=xclass;
|
||||
if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err;
|
||||
|
||||
if (inf && !(ret & V_ASN1_CONSTRUCTED))
|
||||
goto err;
|
||||
|
||||
#if 0
|
||||
fprintf(stderr,"p=%d + *plength=%ld > omax=%ld + *pp=%d (%d > %d)\n",
|
||||
(int)p,*plength,omax,(int)*pp,(int)(p+ *plength),
|
||||
|
@@ -418,9 +418,9 @@ ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it)
|
||||
|
||||
if(strcmp(hdr->value, "application/x-pkcs7-signature") &&
|
||||
strcmp(hdr->value, "application/pkcs7-signature")) {
|
||||
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
|
||||
ASN1err(ASN1_F_SMIME_READ_ASN1,ASN1_R_SIG_INVALID_MIME_TYPE);
|
||||
ERR_add_error_data(2, "type: ", hdr->value);
|
||||
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
|
||||
sk_BIO_pop_free(parts, BIO_vfree);
|
||||
return NULL;
|
||||
}
|
||||
@@ -595,6 +595,8 @@ static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio)
|
||||
int len, state, save_state = 0;
|
||||
|
||||
headers = sk_MIME_HEADER_new(mime_hdr_cmp);
|
||||
if (!headers)
|
||||
return NULL;
|
||||
while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {
|
||||
/* If whitespace at line start then continuation line */
|
||||
if(mhdr && isspace((unsigned char)linebuf[0])) state = MIME_NAME;
|
||||
@@ -790,12 +792,17 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value)
|
||||
static int mime_hdr_cmp(const MIME_HEADER * const *a,
|
||||
const MIME_HEADER * const *b)
|
||||
{
|
||||
if (!(*a)->name || !(*b)->name)
|
||||
return !!(*a)->name - !!(*b)->name;
|
||||
|
||||
return(strcmp((*a)->name, (*b)->name));
|
||||
}
|
||||
|
||||
static int mime_param_cmp(const MIME_PARAM * const *a,
|
||||
const MIME_PARAM * const *b)
|
||||
{
|
||||
if (!(*a)->param_name || !(*b)->param_name)
|
||||
return !!(*a)->param_name - !!(*b)->param_name;
|
||||
return(strcmp((*a)->param_name, (*b)->param_name));
|
||||
}
|
||||
|
||||
|
@@ -134,15 +134,23 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING **oct)
|
||||
|
||||
if (!(octmp->length = i2d(obj, NULL))) {
|
||||
ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
|
||||
return NULL;
|
||||
goto err;
|
||||
}
|
||||
if (!(p = OPENSSL_malloc (octmp->length))) {
|
||||
ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
goto err;
|
||||
}
|
||||
octmp->data = p;
|
||||
i2d (obj, &p);
|
||||
return octmp;
|
||||
err:
|
||||
if (!oct || !*oct)
|
||||
{
|
||||
ASN1_STRING_free(octmp);
|
||||
if (oct)
|
||||
*oct = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -66,7 +66,11 @@ int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
|
||||
ASN1_STRING *os;
|
||||
|
||||
if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0);
|
||||
if (!M_ASN1_OCTET_STRING_set(os,data,len)) return(0);
|
||||
if (!M_ASN1_OCTET_STRING_set(os,data,len))
|
||||
{
|
||||
M_ASN1_OCTET_STRING_free(os);
|
||||
return 0;
|
||||
}
|
||||
ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
|
||||
return(1);
|
||||
}
|
||||
|
@@ -208,11 +208,6 @@ int DSA_print(BIO *bp, const DSA *x, int off)
|
||||
|
||||
if (x->p)
|
||||
buf_len = (size_t)BN_num_bytes(x->p);
|
||||
else
|
||||
{
|
||||
DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS);
|
||||
goto err;
|
||||
}
|
||||
if (x->q)
|
||||
if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
|
||||
buf_len = i;
|
||||
|
@@ -465,6 +465,8 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
|
||||
l=80-2-obase;
|
||||
|
||||
b=X509_NAME_oneline(name,NULL,0);
|
||||
if (!b)
|
||||
return 0;
|
||||
if (!*b)
|
||||
{
|
||||
OPENSSL_free(b);
|
||||
|
@@ -453,9 +453,14 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
|
||||
{
|
||||
derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
|
||||
* sizeof(*derlst));
|
||||
tmpdat = OPENSSL_malloc(skcontlen);
|
||||
if (!derlst || !tmpdat)
|
||||
if (!derlst)
|
||||
return 0;
|
||||
tmpdat = OPENSSL_malloc(skcontlen);
|
||||
if (!tmpdat)
|
||||
{
|
||||
OPENSSL_free(derlst);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If not sorting just output each item */
|
||||
|
@@ -196,7 +196,9 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
|
||||
*val = nm.a;
|
||||
*in = p;
|
||||
return ret;
|
||||
err:
|
||||
err:
|
||||
if (nm.x != NULL)
|
||||
X509_NAME_free(nm.x);
|
||||
ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -367,7 +367,19 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
|
||||
goto err;
|
||||
}
|
||||
|
||||
key->pkey = ret;
|
||||
/* Check to see if another thread set key->pkey first */
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
|
||||
if (key->pkey)
|
||||
{
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
|
||||
EVP_PKEY_free(ret);
|
||||
ret = key->pkey;
|
||||
}
|
||||
else
|
||||
{
|
||||
key->pkey = ret;
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
|
||||
}
|
||||
CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
|
||||
return(ret);
|
||||
err:
|
||||
|
@@ -209,7 +209,7 @@ start:
|
||||
/* add to buffer and return */
|
||||
if (i >= inl)
|
||||
{
|
||||
memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl);
|
||||
memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl);
|
||||
ctx->obuf_len+=inl;
|
||||
return(num+inl);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ start:
|
||||
{
|
||||
if (i > 0) /* lets fill it up if we can */
|
||||
{
|
||||
memcpy(&(ctx->obuf[ctx->obuf_len]),in,i);
|
||||
memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i);
|
||||
in+=i;
|
||||
inl-=i;
|
||||
num+=i;
|
||||
@@ -294,9 +294,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_C_GET_BUFF_NUM_LINES:
|
||||
ret=0;
|
||||
p1=ctx->ibuf;
|
||||
for (i=ctx->ibuf_off; i<ctx->ibuf_len; i++)
|
||||
for (i=0; i<ctx->ibuf_len; i++)
|
||||
{
|
||||
if (p1[i] == '\n') ret++;
|
||||
if (p1[ctx->ibuf_off + i] == '\n') ret++;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_WPENDING:
|
||||
@@ -399,17 +399,18 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
for (;;)
|
||||
{
|
||||
BIO_clear_retry_flags(b);
|
||||
if (ctx->obuf_len > ctx->obuf_off)
|
||||
if (ctx->obuf_len > 0)
|
||||
{
|
||||
r=BIO_write(b->next_bio,
|
||||
&(ctx->obuf[ctx->obuf_off]),
|
||||
ctx->obuf_len-ctx->obuf_off);
|
||||
ctx->obuf_len);
|
||||
#if 0
|
||||
fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_off,r);
|
||||
fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r);
|
||||
#endif
|
||||
BIO_copy_next_retry(b);
|
||||
if (r <= 0) return((long)r);
|
||||
ctx->obuf_off+=r;
|
||||
ctx->obuf_len-=r;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -145,6 +145,7 @@ extern "C" {
|
||||
/* #endif */
|
||||
|
||||
#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */
|
||||
#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47
|
||||
#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */
|
||||
#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for
|
||||
* MTU. want to use this
|
||||
@@ -321,6 +322,15 @@ DECLARE_STACK_OF(BIO)
|
||||
|
||||
typedef struct bio_f_buffer_ctx_struct
|
||||
{
|
||||
/* Buffers are setup like this:
|
||||
*
|
||||
* <---------------------- size ----------------------->
|
||||
* +---------------------------------------------------+
|
||||
* | consumed | remaining | free space |
|
||||
* +---------------------------------------------------+
|
||||
* <-- off --><------- len ------->
|
||||
*/
|
||||
|
||||
/* BIO *bio; */ /* this is now in the BIO struct */
|
||||
int ibuf_size; /* how big is the input buffer */
|
||||
int obuf_size; /* how big is the output buffer */
|
||||
|
@@ -132,8 +132,8 @@ int BIO_free(BIO *a)
|
||||
|
||||
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
|
||||
|
||||
if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
|
||||
a->method->destroy(a);
|
||||
if ((a->method != NULL) && (a->method->destroy != NULL))
|
||||
a->method->destroy(a);
|
||||
OPENSSL_free(a);
|
||||
return(1);
|
||||
}
|
||||
|
@@ -57,7 +57,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_NO_DGRAM
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -65,6 +64,7 @@
|
||||
#include "cryptlib.h"
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#ifndef OPENSSL_NO_DGRAM
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS)
|
||||
#include <sys/timeb.h>
|
||||
@@ -288,7 +288,6 @@ static int dgram_read(BIO *b, char *out, int outl)
|
||||
*/
|
||||
dgram_adjust_rcv_timeout(b);
|
||||
ret=recvfrom(b->num,out,outl,0,&peer,(void *)&peerlen);
|
||||
dgram_reset_rcv_timeout(b);
|
||||
|
||||
if ( ! data->connected && ret >= 0)
|
||||
BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &peer);
|
||||
@@ -302,6 +301,8 @@ static int dgram_read(BIO *b, char *out, int outl)
|
||||
data->_errno = get_last_socket_error();
|
||||
}
|
||||
}
|
||||
|
||||
dgram_reset_rcv_timeout(b);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
@@ -493,6 +494,9 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
ret = 0;
|
||||
#endif
|
||||
break;
|
||||
case BIO_CTRL_DGRAM_GET_FALLBACK_MTU:
|
||||
ret = 576 - 20 - 8;
|
||||
break;
|
||||
case BIO_CTRL_DGRAM_GET_MTU:
|
||||
return data->mtu;
|
||||
break;
|
||||
@@ -654,9 +658,13 @@ static int BIO_dgram_should_retry(int i)
|
||||
{
|
||||
err=get_last_socket_error();
|
||||
|
||||
#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
|
||||
if ((i == -1) && (err == 0))
|
||||
return(1);
|
||||
#if defined(OPENSSL_SYS_WINDOWS)
|
||||
/* If the socket return value (i) is -1
|
||||
* and err is unexpectedly 0 at this point,
|
||||
* the error code was overwritten by
|
||||
* another system call before this error
|
||||
* handling is called.
|
||||
*/
|
||||
#endif
|
||||
|
||||
return(BIO_dgram_non_fatal_error(err));
|
||||
@@ -719,7 +727,6 @@ int BIO_dgram_non_fatal_error(int err)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void get_current_time(struct timeval *t)
|
||||
{
|
||||
@@ -737,3 +744,5 @@ static void get_current_time(struct timeval *t)
|
||||
gettimeofday(t, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -539,8 +539,10 @@ $sbit=$num;
|
||||
&jle (&label("sqradd"));
|
||||
|
||||
&mov ($carry,"edx");
|
||||
&lea ("edx",&DWP(0,$sbit,"edx",2));
|
||||
&add ("edx","edx");
|
||||
&shr ($carry,31);
|
||||
&add ("edx",$sbit);
|
||||
&adc ($carry,0);
|
||||
&set_label("sqrlast");
|
||||
&mov ($word,$_n0);
|
||||
&mov ($inp,$_np);
|
||||
|
@@ -1039,7 +1039,7 @@ sub data {
|
||||
addze r11,r0
|
||||
#mul_add_c(a[3],b[2],c3,c1,c2);
|
||||
$LD r6,`3*$BNSZ`(r4)
|
||||
$LD r7,`2*$BNSZ`(r4)
|
||||
$LD r7,`2*$BNSZ`(r5)
|
||||
$UMULL r8,r6,r7
|
||||
$UMULH r9,r6,r7
|
||||
addc r12,r8,r12
|
||||
|
@@ -185,7 +185,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
asm (
|
||||
asm volatile (
|
||||
" subq %2,%2 \n"
|
||||
".align 16 \n"
|
||||
"1: movq (%4,%2,8),%0 \n"
|
||||
@@ -196,7 +196,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
|
||||
" sbbq %0,%0 \n"
|
||||
: "=&a"(ret),"+c"(n),"=&r"(i)
|
||||
: "r"(rp),"r"(ap),"r"(bp)
|
||||
: "cc"
|
||||
: "cc", "memory"
|
||||
);
|
||||
|
||||
return ret&1;
|
||||
@@ -208,7 +208,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
asm (
|
||||
asm volatile (
|
||||
" subq %2,%2 \n"
|
||||
".align 16 \n"
|
||||
"1: movq (%4,%2,8),%0 \n"
|
||||
@@ -219,7 +219,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
|
||||
" sbbq %0,%0 \n"
|
||||
: "=&a"(ret),"+c"(n),"=&r"(i)
|
||||
: "r"(rp),"r"(ap),"r"(bp)
|
||||
: "cc"
|
||||
: "cc", "memory"
|
||||
);
|
||||
|
||||
return ret&1;
|
||||
|
@@ -511,6 +511,8 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret,
|
||||
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||
const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
|
||||
|
||||
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||
|
||||
/* Deprecated versions */
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
|
||||
@@ -740,11 +742,20 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
|
||||
|
||||
#define bn_fix_top(a) bn_check_top(a)
|
||||
|
||||
#define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2)
|
||||
#define bn_wcheck_size(bn, words) \
|
||||
do { \
|
||||
const BIGNUM *_bnum2 = (bn); \
|
||||
assert(words <= (_bnum2)->dmax && words >= (_bnum2)->top); \
|
||||
} while(0)
|
||||
|
||||
#else /* !BN_DEBUG */
|
||||
|
||||
#define bn_pollute(a)
|
||||
#define bn_check_top(a)
|
||||
#define bn_fix_top(a) bn_correct_top(a)
|
||||
#define bn_check_size(bn, bits)
|
||||
#define bn_wcheck_size(bn, words)
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -123,7 +123,7 @@ struct bn_blinding_st
|
||||
BIGNUM *mod; /* just a reference */
|
||||
unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
|
||||
* used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
|
||||
unsigned int counter;
|
||||
int counter;
|
||||
unsigned long flags;
|
||||
BN_MONT_CTX *m_ctx;
|
||||
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
@@ -157,7 +157,10 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGN
|
||||
if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
|
||||
BN_set_flags(ret->mod, BN_FLG_CONSTTIME);
|
||||
|
||||
ret->counter = BN_BLINDING_COUNTER;
|
||||
/* Set the counter to the special value -1
|
||||
* to indicate that this is never-used fresh blinding
|
||||
* that does not need updating before first use. */
|
||||
ret->counter = -1;
|
||||
return(ret);
|
||||
err:
|
||||
if (ret != NULL) BN_BLINDING_free(ret);
|
||||
@@ -186,7 +189,10 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (--(b->counter) == 0 && b->e != NULL &&
|
||||
if (b->counter == -1)
|
||||
b->counter = 0;
|
||||
|
||||
if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL &&
|
||||
!(b->flags & BN_BLINDING_NO_RECREATE))
|
||||
{
|
||||
/* re-create blinding parameters */
|
||||
@@ -201,8 +207,8 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
|
||||
|
||||
ret=1;
|
||||
err:
|
||||
if (b->counter == 0)
|
||||
b->counter = BN_BLINDING_COUNTER;
|
||||
if (b->counter == BN_BLINDING_COUNTER)
|
||||
b->counter = 0;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -223,6 +229,12 @@ int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (b->counter == -1)
|
||||
/* Fresh blinding, doesn't need updating. */
|
||||
b->counter = 0;
|
||||
else if (!BN_BLINDING_update(b,ctx))
|
||||
return(0);
|
||||
|
||||
if (r != NULL)
|
||||
{
|
||||
if (!BN_copy(r, b->Ai)) ret=0;
|
||||
@@ -243,22 +255,19 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct
|
||||
int ret;
|
||||
|
||||
bn_check_top(n);
|
||||
if ((b->A == NULL) || (b->Ai == NULL))
|
||||
{
|
||||
BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (r != NULL)
|
||||
ret = BN_mod_mul(n, n, r, b->mod, ctx);
|
||||
else
|
||||
ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
if (!BN_BLINDING_update(b,ctx))
|
||||
if (b->Ai == NULL)
|
||||
{
|
||||
BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
|
||||
return(0);
|
||||
}
|
||||
ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
|
||||
}
|
||||
|
||||
bn_check_top(n);
|
||||
return(ret);
|
||||
}
|
||||
|
@@ -767,7 +767,14 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG 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;
|
||||
}
|
||||
if (a == 0)
|
||||
|
@@ -607,6 +607,7 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
{
|
||||
while (!BN_is_odd(u))
|
||||
{
|
||||
if (BN_is_zero(u)) goto err;
|
||||
if (!BN_rshift1(u, u)) goto err;
|
||||
if (BN_is_odd(b))
|
||||
{
|
||||
@@ -1094,3 +1095,54 @@ int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constant-time conditional swap of a and b.
|
||||
* a and b are swapped if condition is not 0. The code assumes that at most one bit of condition is set.
|
||||
* nwords is the number of words to swap. The code assumes that at least nwords are allocated in both a and b,
|
||||
* and that no more than nwords are used by either a or b.
|
||||
* a and b cannot be the same number
|
||||
*/
|
||||
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
|
||||
{
|
||||
BN_ULONG t;
|
||||
int i;
|
||||
|
||||
bn_wcheck_size(a, nwords);
|
||||
bn_wcheck_size(b, nwords);
|
||||
|
||||
assert(a != b);
|
||||
assert((condition & (condition - 1)) == 0);
|
||||
assert(sizeof(BN_ULONG) >= sizeof(int));
|
||||
|
||||
condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1;
|
||||
|
||||
t = (a->top^b->top) & condition;
|
||||
a->top ^= t;
|
||||
b->top ^= t;
|
||||
|
||||
#define BN_CONSTTIME_SWAP(ind) \
|
||||
do { \
|
||||
t = (a->d[ind] ^ b->d[ind]) & condition; \
|
||||
a->d[ind] ^= t; \
|
||||
b->d[ind] ^= t; \
|
||||
} while (0)
|
||||
|
||||
|
||||
switch (nwords) {
|
||||
default:
|
||||
for (i = 10; i < nwords; i++)
|
||||
BN_CONSTTIME_SWAP(i);
|
||||
/* Fallthrough */
|
||||
case 10: BN_CONSTTIME_SWAP(9); /* Fallthrough */
|
||||
case 9: BN_CONSTTIME_SWAP(8); /* Fallthrough */
|
||||
case 8: BN_CONSTTIME_SWAP(7); /* Fallthrough */
|
||||
case 7: BN_CONSTTIME_SWAP(6); /* Fallthrough */
|
||||
case 6: BN_CONSTTIME_SWAP(5); /* Fallthrough */
|
||||
case 5: BN_CONSTTIME_SWAP(4); /* Fallthrough */
|
||||
case 4: BN_CONSTTIME_SWAP(3); /* Fallthrough */
|
||||
case 3: BN_CONSTTIME_SWAP(2); /* Fallthrough */
|
||||
case 2: BN_CONSTTIME_SWAP(1); /* Fallthrough */
|
||||
case 1: BN_CONSTTIME_SWAP(0);
|
||||
}
|
||||
#undef BN_CONSTTIME_SWAP
|
||||
}
|
||||
|
@@ -320,6 +320,15 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
|
||||
BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE);
|
||||
return(NULL);
|
||||
}
|
||||
#ifdef PURIFY
|
||||
/* Valgrind complains in BN_consttime_swap because we process the whole
|
||||
* array even if it's not initialised yet. This doesn't matter in that
|
||||
* function - what's important is constant time operation (we're not
|
||||
* actually going to use the data)
|
||||
*/
|
||||
memset(a, 0, sizeof(BN_ULONG)*words);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
B=b->d;
|
||||
/* Check if the previous number needs to be copied */
|
||||
|
@@ -701,32 +701,38 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
|
||||
const BIGNUM *mod, BN_CTX *ctx)
|
||||
{
|
||||
int got_write_lock = 0;
|
||||
BN_MONT_CTX *ret;
|
||||
|
||||
CRYPTO_r_lock(lock);
|
||||
if (!*pmont)
|
||||
{
|
||||
CRYPTO_r_unlock(lock);
|
||||
CRYPTO_w_lock(lock);
|
||||
got_write_lock = 1;
|
||||
|
||||
if (!*pmont)
|
||||
{
|
||||
ret = BN_MONT_CTX_new();
|
||||
if (ret && !BN_MONT_CTX_set(ret, mod, ctx))
|
||||
BN_MONT_CTX_free(ret);
|
||||
else
|
||||
*pmont = ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = *pmont;
|
||||
|
||||
if (got_write_lock)
|
||||
CRYPTO_w_unlock(lock);
|
||||
CRYPTO_r_unlock(lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* We don't want to serialise globally while doing our lazy-init math in
|
||||
* BN_MONT_CTX_set. That punishes threads that are doing independent
|
||||
* things. Instead, punish the case where more than one thread tries to
|
||||
* lazy-init the same 'pmont', by having each do the lazy-init math work
|
||||
* independently and only use the one from the thread that wins the race
|
||||
* (the losers throw away the work they've done). */
|
||||
ret = BN_MONT_CTX_new();
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if (!BN_MONT_CTX_set(ret, mod, ctx))
|
||||
{
|
||||
BN_MONT_CTX_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The locked compare-and-set, after the local work is done. */
|
||||
CRYPTO_w_lock(lock);
|
||||
if (*pmont)
|
||||
{
|
||||
BN_MONT_CTX_free(ret);
|
||||
ret = *pmont;
|
||||
}
|
||||
else
|
||||
CRYPTO_r_unlock(lock);
|
||||
|
||||
*pmont = ret;
|
||||
CRYPTO_w_unlock(lock);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -77,6 +77,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
|
||||
if (al <= 0)
|
||||
{
|
||||
r->top=0;
|
||||
r->neg = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
|
||||
a->neg=!(a->neg);
|
||||
return(i);
|
||||
}
|
||||
/* Only expand (and risk failing) if it's possibly necessary */
|
||||
if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) &&
|
||||
(bn_wexpand(a,a->top+1) == NULL))
|
||||
return(0);
|
||||
i=0;
|
||||
for (;;)
|
||||
for (i=0;w!=0 && i<a->top;i++)
|
||||
{
|
||||
if (i >= a->top)
|
||||
l=w;
|
||||
else
|
||||
l=(a->d[i]+w)&BN_MASK2;
|
||||
a->d[i]=l;
|
||||
if (w > l)
|
||||
w=1;
|
||||
else
|
||||
break;
|
||||
i++;
|
||||
a->d[i] = l = (a->d[i]+w)&BN_MASK2;
|
||||
w = (w>l)?1:0;
|
||||
}
|
||||
if (i >= a->top)
|
||||
if (w && i==a->top)
|
||||
{
|
||||
if (bn_wexpand(a,a->top+1) == NULL) return 0;
|
||||
a->top++;
|
||||
a->d[i]=w;
|
||||
}
|
||||
bn_check_top(a);
|
||||
return(1);
|
||||
}
|
||||
|
@@ -71,6 +71,43 @@
|
||||
|
||||
static const char rnd_seed[] = "string to make the random number generator think it has entropy";
|
||||
|
||||
/* test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success. */
|
||||
static int test_exp_mod_zero() {
|
||||
BIGNUM a, p, m;
|
||||
BIGNUM r;
|
||||
BN_CTX *ctx = BN_CTX_new();
|
||||
int ret = 1;
|
||||
|
||||
BN_init(&m);
|
||||
BN_one(&m);
|
||||
|
||||
BN_init(&a);
|
||||
BN_one(&a);
|
||||
|
||||
BN_init(&p);
|
||||
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");
|
||||
}
|
||||
|
||||
BN_free(&r);
|
||||
BN_free(&a);
|
||||
BN_free(&p);
|
||||
BN_free(&m);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BN_CTX *ctx;
|
||||
@@ -190,7 +227,13 @@ int main(int argc, char *argv[])
|
||||
ERR_remove_state(0);
|
||||
CRYPTO_mem_leaks(out);
|
||||
BIO_free(out);
|
||||
printf(" done\n");
|
||||
printf("\n");
|
||||
|
||||
if (test_exp_mod_zero() != 0)
|
||||
goto err;
|
||||
|
||||
printf("done\n");
|
||||
|
||||
EXIT(0);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
|
@@ -60,6 +60,11 @@
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
|
||||
/* LIMIT_BEFORE_EXPANSION is the maximum n such that (n+3)/3*4 < 2**31. That
|
||||
* function is applied in several functions in this file and this limit ensures
|
||||
* that the result fits in an int. */
|
||||
#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
|
||||
|
||||
BUF_MEM *BUF_MEM_new(void)
|
||||
{
|
||||
BUF_MEM *ret;
|
||||
@@ -94,6 +99,11 @@ int BUF_MEM_grow(BUF_MEM *str, int len)
|
||||
char *ret;
|
||||
unsigned int n;
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (str->length >= len)
|
||||
{
|
||||
str->length=len;
|
||||
@@ -105,6 +115,12 @@ int BUF_MEM_grow(BUF_MEM *str, int len)
|
||||
str->length=len;
|
||||
return(len);
|
||||
}
|
||||
/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
|
||||
if (len > LIMIT_BEFORE_EXPANSION)
|
||||
{
|
||||
BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
n=(len+3)/3*4;
|
||||
if (str->data == NULL)
|
||||
ret=OPENSSL_malloc(n);
|
||||
@@ -130,6 +146,11 @@ int BUF_MEM_grow_clean(BUF_MEM *str, int len)
|
||||
char *ret;
|
||||
unsigned int n;
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (str->length >= len)
|
||||
{
|
||||
memset(&str->data[len],0,str->length-len);
|
||||
@@ -142,6 +163,12 @@ int BUF_MEM_grow_clean(BUF_MEM *str, int len)
|
||||
str->length=len;
|
||||
return(len);
|
||||
}
|
||||
/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
|
||||
if (len > LIMIT_BEFORE_EXPANSION)
|
||||
{
|
||||
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
n=(len+3)/3*4;
|
||||
if (str->data == NULL)
|
||||
ret=OPENSSL_malloc(n);
|
||||
|
@@ -110,6 +110,7 @@ DECLARE_ASN1_FUNCTIONS_const(CMS_ReceiptRequest)
|
||||
#define CMS_PARTIAL 0x4000
|
||||
#define CMS_REUSE_DIGEST 0x8000
|
||||
#define CMS_USE_KEYID 0x10000
|
||||
#define CMS_DEBUG_DECRYPT 0x20000
|
||||
|
||||
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
|
||||
|
||||
|
@@ -58,7 +58,9 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/cms.h>
|
||||
#include <openssl/bio.h>
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
#include <openssl/comp.h>
|
||||
#endif
|
||||
#include "cms_lcl.h"
|
||||
|
||||
DECLARE_ASN1_ITEM(CMS_CompressedData)
|
||||
|
@@ -73,6 +73,8 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
|
||||
const EVP_CIPHER *ciph;
|
||||
X509_ALGOR *calg = ec->contentEncryptionAlgorithm;
|
||||
unsigned char iv[EVP_MAX_IV_LENGTH], *piv = NULL;
|
||||
unsigned char *tkey = NULL;
|
||||
size_t tkeylen;
|
||||
|
||||
int ok = 0;
|
||||
|
||||
@@ -137,32 +139,57 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
|
||||
CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
if (enc && !ec->key)
|
||||
tkeylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
/* Generate random session key */
|
||||
if (!enc || !ec->key)
|
||||
{
|
||||
/* Generate random key */
|
||||
if (!ec->keylen)
|
||||
ec->keylen = EVP_CIPHER_CTX_key_length(ctx);
|
||||
ec->key = OPENSSL_malloc(ec->keylen);
|
||||
if (!ec->key)
|
||||
tkey = OPENSSL_malloc(tkeylen);
|
||||
if (!tkey)
|
||||
{
|
||||
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
|
||||
ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
if (EVP_CIPHER_CTX_rand_key(ctx, ec->key) <= 0)
|
||||
if (EVP_CIPHER_CTX_rand_key(ctx, tkey) <= 0)
|
||||
goto err;
|
||||
keep_key = 1;
|
||||
}
|
||||
else if (ec->keylen != (unsigned int)EVP_CIPHER_CTX_key_length(ctx))
|
||||
|
||||
if (!ec->key)
|
||||
{
|
||||
ec->key = tkey;
|
||||
ec->keylen = tkeylen;
|
||||
tkey = NULL;
|
||||
if (enc)
|
||||
keep_key = 1;
|
||||
else
|
||||
ERR_clear_error();
|
||||
|
||||
}
|
||||
|
||||
if (ec->keylen != tkeylen)
|
||||
{
|
||||
/* If necessary set key length */
|
||||
if (EVP_CIPHER_CTX_set_key_length(ctx, ec->keylen) <= 0)
|
||||
{
|
||||
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
|
||||
CMS_R_INVALID_KEY_LENGTH);
|
||||
goto err;
|
||||
/* Only reveal failure if debugging so we don't
|
||||
* leak information which may be useful in MMA.
|
||||
*/
|
||||
if (enc || ec->debug)
|
||||
{
|
||||
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
|
||||
CMS_R_INVALID_KEY_LENGTH);
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use random key */
|
||||
OPENSSL_cleanse(ec->key, ec->keylen);
|
||||
OPENSSL_free(ec->key);
|
||||
ec->key = tkey;
|
||||
ec->keylen = tkeylen;
|
||||
tkey = NULL;
|
||||
ERR_clear_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +225,11 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
|
||||
OPENSSL_free(ec->key);
|
||||
ec->key = NULL;
|
||||
}
|
||||
if (tkey)
|
||||
{
|
||||
OPENSSL_cleanse(tkey, tkeylen);
|
||||
OPENSSL_free(tkey);
|
||||
}
|
||||
if (ok)
|
||||
return b;
|
||||
BIO_free(b);
|
||||
|
@@ -185,6 +185,8 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
|
||||
if (flags & CMS_USE_KEYID)
|
||||
{
|
||||
ktri->version = 2;
|
||||
if (env->version < 2)
|
||||
env->version = 2;
|
||||
type = CMS_RECIPINFO_KEYIDENTIFIER;
|
||||
}
|
||||
else
|
||||
@@ -352,6 +354,8 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms,
|
||||
unsigned char *ek = NULL;
|
||||
int eklen;
|
||||
int ret = 0;
|
||||
CMS_EncryptedContentInfo *ec;
|
||||
ec = cms->d.envelopedData->encryptedContentInfo;
|
||||
|
||||
if (ktri->pkey == NULL)
|
||||
{
|
||||
@@ -382,8 +386,14 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms,
|
||||
|
||||
ret = 1;
|
||||
|
||||
cms->d.envelopedData->encryptedContentInfo->key = ek;
|
||||
cms->d.envelopedData->encryptedContentInfo->keylen = eklen;
|
||||
if (ec->key)
|
||||
{
|
||||
OPENSSL_cleanse(ec->key, ec->keylen);
|
||||
OPENSSL_free(ec->key);
|
||||
}
|
||||
|
||||
ec->key = ek;
|
||||
ec->keylen = eklen;
|
||||
|
||||
err:
|
||||
if (!ret && ek)
|
||||
|
@@ -112,7 +112,7 @@ static int cms_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
|
||||
cmsbio = tmpbio;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -175,6 +175,8 @@ struct CMS_EncryptedContentInfo_st
|
||||
const EVP_CIPHER *cipher;
|
||||
unsigned char *key;
|
||||
size_t keylen;
|
||||
/* Set to 1 if we are debugging decrypt and don't fake keys for MMA */
|
||||
int debug;
|
||||
};
|
||||
|
||||
struct CMS_RecipientInfo_st
|
||||
|
@@ -475,8 +475,6 @@ int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert)
|
||||
STACK_OF(CMS_CertificateChoices) **pcerts;
|
||||
int i;
|
||||
pcerts = cms_get0_certificate_choices(cms);
|
||||
if (!pcerts)
|
||||
return 0;
|
||||
if (!pcerts)
|
||||
return 0;
|
||||
for (i = 0; i < sk_CMS_CertificateChoices_num(*pcerts); i++)
|
||||
|
@@ -157,8 +157,8 @@ static void cms_sd_set_version(CMS_SignedData *sd)
|
||||
if (sd->version < 3)
|
||||
sd->version = 3;
|
||||
}
|
||||
else
|
||||
sd->version = 1;
|
||||
else if (si->version < 1)
|
||||
si->version = 1;
|
||||
}
|
||||
|
||||
if (sd->version < 1)
|
||||
|
@@ -622,12 +622,16 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
|
||||
STACK_OF(CMS_RecipientInfo) *ris;
|
||||
CMS_RecipientInfo *ri;
|
||||
int i, r;
|
||||
int debug = 0, ri_match = 0;
|
||||
ris = CMS_get0_RecipientInfos(cms);
|
||||
if (ris)
|
||||
debug = cms->d.envelopedData->encryptedContentInfo->debug;
|
||||
for (i = 0; i < sk_CMS_RecipientInfo_num(ris); i++)
|
||||
{
|
||||
ri = sk_CMS_RecipientInfo_value(ris, i);
|
||||
if (CMS_RecipientInfo_type(ri) != CMS_RECIPINFO_TRANS)
|
||||
continue;
|
||||
ri_match = 1;
|
||||
/* If we have a cert try matching RecipientInfo
|
||||
* otherwise try them all.
|
||||
*/
|
||||
@@ -636,17 +640,38 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
|
||||
CMS_RecipientInfo_set0_pkey(ri, pk);
|
||||
r = CMS_RecipientInfo_decrypt(cms, ri);
|
||||
CMS_RecipientInfo_set0_pkey(ri, NULL);
|
||||
if (r > 0)
|
||||
return 1;
|
||||
if (cert)
|
||||
{
|
||||
/* If not debugging clear any error and
|
||||
* return success to avoid leaking of
|
||||
* information useful to MMA
|
||||
*/
|
||||
if (!debug)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return 1;
|
||||
}
|
||||
if (r > 0)
|
||||
return 1;
|
||||
CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY,
|
||||
CMS_R_DECRYPT_ERROR);
|
||||
return 0;
|
||||
}
|
||||
ERR_clear_error();
|
||||
/* If no cert and not debugging don't leave loop
|
||||
* after first successful decrypt. Always attempt
|
||||
* to decrypt all recipients to avoid leaking timing
|
||||
* of a successful decrypt.
|
||||
*/
|
||||
else if (r > 0 && debug)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* If no cert and not debugging always return success */
|
||||
if (ri_match && !cert && !debug)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY, CMS_R_NO_MATCHING_RECIPIENT);
|
||||
return 0;
|
||||
@@ -705,9 +730,14 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert,
|
||||
}
|
||||
if (!dcont && !check_content(cms))
|
||||
return 0;
|
||||
if (flags & CMS_DEBUG_DECRYPT)
|
||||
cms->d.envelopedData->encryptedContentInfo->debug = 1;
|
||||
else
|
||||
cms->d.envelopedData->encryptedContentInfo->debug = 0;
|
||||
if (!pk && !cert && !dcont && !out)
|
||||
return 1;
|
||||
if (pk && !CMS_decrypt_set1_pkey(cms, pk, cert))
|
||||
return 0;
|
||||
|
||||
cont = CMS_dataInit(cms, dcont);
|
||||
if (!cont)
|
||||
return 0;
|
||||
|
@@ -46,7 +46,7 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
|
||||
{
|
||||
int i;
|
||||
|
||||
if (olen < (ilen-1))
|
||||
if (ilen == 0 || olen < (ilen-1))
|
||||
{
|
||||
/* ZZZZZZZZZZZZZZZZZZZZZZ */
|
||||
return(-1);
|
||||
@@ -59,4 +59,3 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
|
||||
}
|
||||
return(ilen-1);
|
||||
}
|
||||
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/conf_api.h>
|
||||
@@ -293,7 +294,7 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
|
||||
v->value=(char *)sk;
|
||||
|
||||
vv=(CONF_VALUE *)lh_insert(conf->data,v);
|
||||
assert(vv == NULL);
|
||||
OPENSSL_assert(vv == NULL);
|
||||
ok=1;
|
||||
err:
|
||||
if (!ok)
|
||||
|
@@ -324,7 +324,7 @@ again:
|
||||
p=eat_ws(conf, end);
|
||||
if (*p != ']')
|
||||
{
|
||||
if (*p != '\0')
|
||||
if (*p != '\0' && ss != p)
|
||||
{
|
||||
ss=p;
|
||||
goto again;
|
||||
|
216
crypto/constant_time_locl.h
Normal file
216
crypto/constant_time_locl.h
Normal file
@@ -0,0 +1,216 @@
|
||||
/* crypto/constant_time_locl.h */
|
||||
/*
|
||||
* Utilities for constant-time cryptography.
|
||||
*
|
||||
* Author: Emilia Kasper (emilia@openssl.org)
|
||||
* Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley
|
||||
* (Google).
|
||||
* ====================================================================
|
||||
* Copyright (c) 2014 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONSTANT_TIME_LOCL_H
|
||||
#define HEADER_CONSTANT_TIME_LOCL_H
|
||||
|
||||
#include "e_os.h" /* For 'inline' */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The boolean methods return a bitmask of all ones (0xff...f) for true
|
||||
* and 0 for false. This is useful for choosing a value based on the result
|
||||
* of a conditional in constant time. For example,
|
||||
*
|
||||
* if (a < b) {
|
||||
* c = a;
|
||||
* } else {
|
||||
* c = b;
|
||||
* }
|
||||
*
|
||||
* can be written as
|
||||
*
|
||||
* unsigned int lt = constant_time_lt(a, b);
|
||||
* c = constant_time_select(lt, a, b);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Returns the given value with the MSB copied to all the other
|
||||
* bits. Uses the fact that arithmetic shift shifts-in the sign bit.
|
||||
* However, this is not ensured by the C standard so you may need to
|
||||
* replace this with something else on odd CPUs.
|
||||
*/
|
||||
static inline unsigned int constant_time_msb(unsigned int a);
|
||||
|
||||
/*
|
||||
* Returns 0xff..f if a < b and 0 otherwise.
|
||||
*/
|
||||
static inline unsigned int constant_time_lt(unsigned int a, unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b);
|
||||
|
||||
/*
|
||||
* Returns 0xff..f if a >= b and 0 otherwise.
|
||||
*/
|
||||
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b);
|
||||
|
||||
/*
|
||||
* Returns 0xff..f if a == 0 and 0 otherwise.
|
||||
*/
|
||||
static inline unsigned int constant_time_is_zero(unsigned int a);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static inline unsigned char constant_time_is_zero_8(unsigned int a);
|
||||
|
||||
|
||||
/*
|
||||
* Returns 0xff..f if a == b and 0 otherwise.
|
||||
*/
|
||||
static inline unsigned int constant_time_eq(unsigned int a, unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b);
|
||||
/* Signed integers. */
|
||||
static inline unsigned int constant_time_eq_int(int a, int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static inline unsigned char constant_time_eq_int_8(int a, int b);
|
||||
|
||||
|
||||
/*
|
||||
* Returns (mask & a) | (~mask & b).
|
||||
*
|
||||
* When |mask| is all 1s or all 0s (as returned by the methods above),
|
||||
* the select methods return either |a| (if |mask| is nonzero) or |b|
|
||||
* (if |mask| is zero).
|
||||
*/
|
||||
static inline unsigned int constant_time_select(unsigned int mask,
|
||||
unsigned int a, unsigned int b);
|
||||
/* Convenience method for unsigned chars. */
|
||||
static inline unsigned char constant_time_select_8(unsigned char mask,
|
||||
unsigned char a, unsigned char b);
|
||||
/* Convenience method for signed integers. */
|
||||
static inline int constant_time_select_int(unsigned int mask, int a, int b);
|
||||
|
||||
static inline unsigned int constant_time_msb(unsigned int a)
|
||||
{
|
||||
return (unsigned int)((int)(a) >> (sizeof(int) * 8 - 1));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_lt(unsigned int a, unsigned int b)
|
||||
{
|
||||
unsigned int lt;
|
||||
/* Case 1: msb(a) == msb(b). a < b iff the MSB of a - b is set.*/
|
||||
lt = ~(a ^ b) & (a - b);
|
||||
/* Case 2: msb(a) != msb(b). a < b iff the MSB of b is set. */
|
||||
lt |= ~a & b;
|
||||
return constant_time_msb(lt);
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b)
|
||||
{
|
||||
return (unsigned char)(constant_time_lt(a, b));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b)
|
||||
{
|
||||
unsigned int ge;
|
||||
/* Case 1: msb(a) == msb(b). a >= b iff the MSB of a - b is not set.*/
|
||||
ge = ~((a ^ b) | (a - b));
|
||||
/* Case 2: msb(a) != msb(b). a >= b iff the MSB of a is set. */
|
||||
ge |= a & ~b;
|
||||
return constant_time_msb(ge);
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b)
|
||||
{
|
||||
return (unsigned char)(constant_time_ge(a, b));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_is_zero(unsigned int a)
|
||||
{
|
||||
return constant_time_msb(~a & (a - 1));
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_is_zero_8(unsigned int a)
|
||||
{
|
||||
return (unsigned char)(constant_time_is_zero(a));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_eq(unsigned int a, unsigned int b)
|
||||
{
|
||||
return constant_time_is_zero(a ^ b);
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b)
|
||||
{
|
||||
return (unsigned char)(constant_time_eq(a, b));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_eq_int(int a, int b)
|
||||
{
|
||||
return constant_time_eq((unsigned)(a), (unsigned)(b));
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_eq_int_8(int a, int b)
|
||||
{
|
||||
return constant_time_eq_8((unsigned)(a), (unsigned)(b));
|
||||
}
|
||||
|
||||
static inline unsigned int constant_time_select(unsigned int mask,
|
||||
unsigned int a, unsigned int b)
|
||||
{
|
||||
return (mask & a) | (~mask & b);
|
||||
}
|
||||
|
||||
static inline unsigned char constant_time_select_8(unsigned char mask,
|
||||
unsigned char a, unsigned char b)
|
||||
{
|
||||
return (unsigned char)(constant_time_select(mask, a, b));
|
||||
}
|
||||
|
||||
inline int constant_time_select_int(unsigned int mask, int a, int b)
|
||||
{
|
||||
return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b)));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CONSTANT_TIME_LOCL_H */
|
330
crypto/constant_time_test.c
Normal file
330
crypto/constant_time_test.c
Normal file
@@ -0,0 +1,330 @@
|
||||
/* crypto/constant_time_test.c */
|
||||
/*
|
||||
* Utilities for constant-time cryptography.
|
||||
*
|
||||
* Author: Emilia Kasper (emilia@openssl.org)
|
||||
* Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley
|
||||
* (Google).
|
||||
* ====================================================================
|
||||
* Copyright (c) 2014 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include "../crypto/constant_time_locl.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const unsigned int CONSTTIME_TRUE = (unsigned)(~0);
|
||||
static const unsigned int CONSTTIME_FALSE = 0;
|
||||
static const unsigned char CONSTTIME_TRUE_8 = 0xff;
|
||||
static const unsigned char CONSTTIME_FALSE_8 = 0;
|
||||
|
||||
static int test_binary_op(unsigned int (*op)(unsigned int a, unsigned int b),
|
||||
const char* op_name, unsigned int a, unsigned int b, int is_true)
|
||||
{
|
||||
unsigned c = op(a, b);
|
||||
if (is_true && c != CONSTTIME_TRUE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for %s(%du, %du): expected %du "
|
||||
"(TRUE), got %du\n", op_name, a, b, CONSTTIME_TRUE, c);
|
||||
return 1;
|
||||
}
|
||||
else if (!is_true && c != CONSTTIME_FALSE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for %s(%du, %du): expected %du "
|
||||
"(FALSE), got %du\n", op_name, a, b, CONSTTIME_FALSE,
|
||||
c);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_binary_op_8(unsigned char (*op)(unsigned int a, unsigned int b),
|
||||
const char* op_name, unsigned int a, unsigned int b, int is_true)
|
||||
{
|
||||
unsigned char c = op(a, b);
|
||||
if (is_true && c != CONSTTIME_TRUE_8)
|
||||
{
|
||||
fprintf(stderr, "Test failed for %s(%du, %du): expected %u "
|
||||
"(TRUE), got %u\n", op_name, a, b, CONSTTIME_TRUE_8, c);
|
||||
return 1;
|
||||
}
|
||||
else if (!is_true && c != CONSTTIME_FALSE_8)
|
||||
{
|
||||
fprintf(stderr, "Test failed for %s(%du, %du): expected %u "
|
||||
"(FALSE), got %u\n", op_name, a, b, CONSTTIME_FALSE_8,
|
||||
c);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_is_zero(unsigned int a)
|
||||
{
|
||||
unsigned int c = constant_time_is_zero(a);
|
||||
if (a == 0 && c != CONSTTIME_TRUE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
|
||||
"expected %du (TRUE), got %du\n", a, CONSTTIME_TRUE, c);
|
||||
return 1;
|
||||
}
|
||||
else if (a != 0 && c != CONSTTIME_FALSE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
|
||||
"expected %du (FALSE), got %du\n", a, CONSTTIME_FALSE,
|
||||
c);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_is_zero_8(unsigned int a)
|
||||
{
|
||||
unsigned char c = constant_time_is_zero_8(a);
|
||||
if (a == 0 && c != CONSTTIME_TRUE_8)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
|
||||
"expected %u (TRUE), got %u\n", a, CONSTTIME_TRUE_8, c);
|
||||
return 1;
|
||||
}
|
||||
else if (a != 0 && c != CONSTTIME_FALSE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
|
||||
"expected %u (FALSE), got %u\n", a, CONSTTIME_FALSE_8,
|
||||
c);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_select(unsigned int a, unsigned int b)
|
||||
{
|
||||
unsigned int selected = constant_time_select(CONSTTIME_TRUE, a, b);
|
||||
if (selected != a)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%du, %du,"
|
||||
"%du): expected %du(first value), got %du\n",
|
||||
CONSTTIME_TRUE, a, b, a, selected);
|
||||
return 1;
|
||||
}
|
||||
selected = constant_time_select(CONSTTIME_FALSE, a, b);
|
||||
if (selected != b)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%du, %du,"
|
||||
"%du): expected %du(second value), got %du\n",
|
||||
CONSTTIME_FALSE, a, b, b, selected);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_select_8(unsigned char a, unsigned char b)
|
||||
{
|
||||
unsigned char selected = constant_time_select_8(CONSTTIME_TRUE_8, a, b);
|
||||
if (selected != a)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%u, %u,"
|
||||
"%u): expected %u(first value), got %u\n",
|
||||
CONSTTIME_TRUE, a, b, a, selected);
|
||||
return 1;
|
||||
}
|
||||
selected = constant_time_select_8(CONSTTIME_FALSE_8, a, b);
|
||||
if (selected != b)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%u, %u,"
|
||||
"%u): expected %u(second value), got %u\n",
|
||||
CONSTTIME_FALSE, a, b, b, selected);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_select_int(int a, int b)
|
||||
{
|
||||
int selected = constant_time_select_int(CONSTTIME_TRUE, a, b);
|
||||
if (selected != a)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%du, %d,"
|
||||
"%d): expected %d(first value), got %d\n",
|
||||
CONSTTIME_TRUE, a, b, a, selected);
|
||||
return 1;
|
||||
}
|
||||
selected = constant_time_select_int(CONSTTIME_FALSE, a, b);
|
||||
if (selected != b)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_select(%du, %d,"
|
||||
"%d): expected %d(second value), got %d\n",
|
||||
CONSTTIME_FALSE, a, b, b, selected);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_eq_int(int a, int b)
|
||||
{
|
||||
unsigned int equal = constant_time_eq_int(a, b);
|
||||
if (a == b && equal != CONSTTIME_TRUE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
|
||||
"expected %du(TRUE), got %du\n",
|
||||
a, b, CONSTTIME_TRUE, equal);
|
||||
return 1;
|
||||
}
|
||||
else if (a != b && equal != CONSTTIME_FALSE)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
|
||||
"expected %du(FALSE), got %du\n",
|
||||
a, b, CONSTTIME_FALSE, equal);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_eq_int_8(int a, int b)
|
||||
{
|
||||
unsigned char equal = constant_time_eq_int_8(a, b);
|
||||
if (a == b && equal != CONSTTIME_TRUE_8)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
|
||||
"expected %u(TRUE), got %u\n",
|
||||
a, b, CONSTTIME_TRUE_8, equal);
|
||||
return 1;
|
||||
}
|
||||
else if (a != b && equal != CONSTTIME_FALSE_8)
|
||||
{
|
||||
fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
|
||||
"expected %u(FALSE), got %u\n",
|
||||
a, b, CONSTTIME_FALSE_8, equal);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int test_values[] = {0, 1, 1024, 12345, 32000, UINT_MAX/2-1,
|
||||
UINT_MAX/2, UINT_MAX/2+1, UINT_MAX-1,
|
||||
UINT_MAX};
|
||||
|
||||
static unsigned char test_values_8[] = {0, 1, 2, 20, 32, 127, 128, 129, 255};
|
||||
|
||||
static int signed_test_values[] = {0, 1, -1, 1024, -1024, 12345, -12345,
|
||||
32000, -32000, INT_MAX, INT_MIN, INT_MAX-1,
|
||||
INT_MIN+1};
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned int a, b, i, j;
|
||||
int c, d;
|
||||
unsigned char e, f;
|
||||
int num_failed = 0, num_all = 0;
|
||||
fprintf(stdout, "Testing constant time operations...\n");
|
||||
|
||||
for (i = 0; i < sizeof(test_values)/sizeof(int); ++i)
|
||||
{
|
||||
a = test_values[i];
|
||||
num_failed += test_is_zero(a);
|
||||
num_failed += test_is_zero_8(a);
|
||||
num_all += 2;
|
||||
for (j = 0; j < sizeof(test_values)/sizeof(int); ++j)
|
||||
{
|
||||
b = test_values[j];
|
||||
num_failed += test_binary_op(&constant_time_lt,
|
||||
"constant_time_lt", a, b, a < b);
|
||||
num_failed += test_binary_op_8(&constant_time_lt_8,
|
||||
"constant_time_lt_8", a, b, a < b);
|
||||
num_failed += test_binary_op(&constant_time_lt,
|
||||
"constant_time_lt_8", b, a, b < a);
|
||||
num_failed += test_binary_op_8(&constant_time_lt_8,
|
||||
"constant_time_lt_8", b, a, b < a);
|
||||
num_failed += test_binary_op(&constant_time_ge,
|
||||
"constant_time_ge", a, b, a >= b);
|
||||
num_failed += test_binary_op_8(&constant_time_ge_8,
|
||||
"constant_time_ge_8", a, b, a >= b);
|
||||
num_failed += test_binary_op(&constant_time_ge,
|
||||
"constant_time_ge", b, a, b >= a);
|
||||
num_failed += test_binary_op_8(&constant_time_ge_8,
|
||||
"constant_time_ge_8", b, a, b >= a);
|
||||
num_failed += test_binary_op(&constant_time_eq,
|
||||
"constant_time_eq", a, b, a == b);
|
||||
num_failed += test_binary_op_8(&constant_time_eq_8,
|
||||
"constant_time_eq_8", a, b, a == b);
|
||||
num_failed += test_binary_op(&constant_time_eq,
|
||||
"constant_time_eq", b, a, b == a);
|
||||
num_failed += test_binary_op_8(&constant_time_eq_8,
|
||||
"constant_time_eq_8", b, a, b == a);
|
||||
num_failed += test_select(a, b);
|
||||
num_all += 13;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(signed_test_values)/sizeof(int); ++i)
|
||||
{
|
||||
c = signed_test_values[i];
|
||||
for (j = 0; j < sizeof(signed_test_values)/sizeof(int); ++j)
|
||||
{
|
||||
d = signed_test_values[j];
|
||||
num_failed += test_select_int(c, d);
|
||||
num_failed += test_eq_int(c, d);
|
||||
num_failed += test_eq_int_8(c, d);
|
||||
num_all += 3;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(test_values_8); ++i)
|
||||
{
|
||||
e = test_values_8[i];
|
||||
for (j = 0; j < sizeof(test_values_8); ++j)
|
||||
{
|
||||
f = test_values_8[j];
|
||||
num_failed += test_select_8(e, f);
|
||||
num_all += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!num_failed)
|
||||
{
|
||||
fprintf(stdout, "ok (ran %d tests)\n", num_all);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "%d of %d tests failed!\n", num_failed, num_all);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
@@ -396,7 +396,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
ERR_remove_state(0);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
@@ -543,3 +542,19 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
|
||||
}
|
||||
|
||||
void *OPENSSL_stderr(void) { return stderr; }
|
||||
|
||||
#ifndef OPENSSL_FIPS
|
||||
|
||||
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
const unsigned char *a = in_a;
|
||||
const unsigned char *b = in_b;
|
||||
unsigned char x = 0;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
x |= a[i] ^ b[i];
|
||||
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
@@ -588,15 +588,22 @@ int OPENSSL_isservice(void);
|
||||
|
||||
#endif /* def OPENSSL_FIPS */
|
||||
|
||||
#define OPENSSL_HAVE_INIT 1
|
||||
void OPENSSL_init(void);
|
||||
|
||||
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
|
||||
* takes an amount of time dependent on |len|, but independent of the contents
|
||||
* of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
|
||||
* defined order as the return value when a != b is undefined, other than to be
|
||||
* non-zero. */
|
||||
int CRYPTO_memcmp(const void *a, const void *b, size_t len);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CRYPTO_strings(void);
|
||||
|
||||
#define OPENSSL_HAVE_INIT 1
|
||||
void OPENSSL_init(void);
|
||||
|
||||
/* Error codes for the CRYPTO functions. */
|
||||
|
||||
/* Function codes. */
|
||||
|
@@ -321,7 +321,15 @@ void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
|
||||
/* functions to set/get method specific data */
|
||||
void *EC_KEY_get_key_method_data(EC_KEY *,
|
||||
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
|
||||
void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
|
||||
/** Sets the key method data of an EC_KEY object, if none has yet been set.
|
||||
* \param key EC_KEY object
|
||||
* \param data opaque data to install.
|
||||
* \param dup_func a function that duplicates |data|.
|
||||
* \param free_func a function that frees |data|.
|
||||
* \param clear_free_func a function that wipes and frees |data|.
|
||||
* \return the previously set data pointer, or NULL if |data| was inserted.
|
||||
*/
|
||||
void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
|
||||
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
|
||||
/* wrapper functions for the underlying EC_GROUP object */
|
||||
void EC_KEY_set_asn1_flag(EC_KEY *, int);
|
||||
|
@@ -208,9 +208,12 @@ static int gf2m_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y, BIG
|
||||
|
||||
/* Computes scalar*point and stores the result in r.
|
||||
* point can not equal r.
|
||||
* Uses algorithm 2P of
|
||||
* Uses a modified algorithm 2P of
|
||||
* Lopex, J. and Dahab, R. "Fast multiplication on elliptic curves over
|
||||
* GF(2^m) without precomputation".
|
||||
*
|
||||
* To protect against side-channel attack the function uses constant time
|
||||
* swap avoiding conditional branches.
|
||||
*/
|
||||
static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
|
||||
const EC_POINT *point, BN_CTX *ctx)
|
||||
@@ -244,6 +247,11 @@ static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r,
|
||||
x2 = &r->X;
|
||||
z2 = &r->Y;
|
||||
|
||||
bn_wexpand(x1, group->field.top);
|
||||
bn_wexpand(z1, group->field.top);
|
||||
bn_wexpand(x2, group->field.top);
|
||||
bn_wexpand(z2, group->field.top);
|
||||
|
||||
if (!BN_GF2m_mod_arr(x1, &point->X, group->poly)) goto err; /* x1 = x */
|
||||
if (!BN_one(z1)) goto err; /* z1 = 1 */
|
||||
if (!group->meth->field_sqr(group, z2, x1, ctx)) goto err; /* z2 = x1^2 = x^2 */
|
||||
@@ -266,16 +274,12 @@ static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r,
|
||||
{
|
||||
for (; j >= 0; j--)
|
||||
{
|
||||
if (scalar->d[i] & mask)
|
||||
{
|
||||
if (!gf2m_Madd(group, &point->X, x1, z1, x2, z2, ctx)) goto err;
|
||||
if (!gf2m_Mdouble(group, x2, z2, ctx)) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gf2m_Madd(group, &point->X, x2, z2, x1, z1, ctx)) goto err;
|
||||
if (!gf2m_Mdouble(group, x1, z1, ctx)) goto err;
|
||||
}
|
||||
BN_consttime_swap(scalar->d[i] & mask, x1, x2, group->field.top);
|
||||
BN_consttime_swap(scalar->d[i] & mask, z1, z2, group->field.top);
|
||||
if (!gf2m_Madd(group, &point->X, x2, z2, x1, z1, ctx)) goto err;
|
||||
if (!gf2m_Mdouble(group, x1, z1, ctx)) goto err;
|
||||
BN_consttime_swap(scalar->d[i] & mask, x1, x2, group->field.top);
|
||||
BN_consttime_swap(scalar->d[i] & mask, z1, z2, group->field.top);
|
||||
mask >>= 1;
|
||||
}
|
||||
j = BN_BITS2 - 1;
|
||||
|
@@ -821,7 +821,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_
|
||||
field_sqr = group->meth->field_sqr;
|
||||
|
||||
/* only support affine coordinates */
|
||||
if (!point->Z_is_one) goto err;
|
||||
if (!point->Z_is_one) return -1;
|
||||
|
||||
if (ctx == NULL)
|
||||
{
|
||||
@@ -871,6 +871,9 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT
|
||||
{
|
||||
return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
|
||||
}
|
||||
|
||||
if (EC_POINT_is_at_infinity(group, b))
|
||||
return 1;
|
||||
|
||||
if (a->Z_is_one && b->Z_is_one)
|
||||
{
|
||||
|
@@ -64,7 +64,6 @@
|
||||
#include <string.h>
|
||||
#include "ec_lcl.h"
|
||||
#include <openssl/err.h>
|
||||
#include <string.h>
|
||||
|
||||
EC_KEY *EC_KEY_new(void)
|
||||
{
|
||||
@@ -304,7 +303,13 @@ int EC_KEY_check_key(const EC_KEY *eckey)
|
||||
ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key))
|
||||
{
|
||||
ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((ctx = BN_CTX_new()) == NULL)
|
||||
goto err;
|
||||
if ((point = EC_POINT_new(eckey->group)) == NULL)
|
||||
@@ -429,18 +434,27 @@ void EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform)
|
||||
void *EC_KEY_get_key_method_data(EC_KEY *key,
|
||||
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *))
|
||||
{
|
||||
return EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
|
||||
void *ret;
|
||||
|
||||
CRYPTO_r_lock(CRYPTO_LOCK_EC);
|
||||
ret = EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
|
||||
CRYPTO_r_unlock(CRYPTO_LOCK_EC);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
|
||||
void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
|
||||
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *))
|
||||
{
|
||||
EC_EXTRA_DATA *ex_data;
|
||||
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_EC);
|
||||
ex_data = EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
|
||||
if (ex_data == NULL)
|
||||
EC_EX_DATA_set_data(&key->method_data, data, dup_func, free_func, clear_free_func);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_EC);
|
||||
|
||||
return ex_data;
|
||||
}
|
||||
|
||||
void EC_KEY_set_asn1_flag(EC_KEY *key, int flag)
|
||||
|
@@ -480,10 +480,10 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
|
||||
if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=
|
||||
EC_METHOD_get_field_type(EC_GROUP_method_of(b)))
|
||||
return 1;
|
||||
/* compare the curve name (if present) */
|
||||
/* compare the curve name (if present in both) */
|
||||
if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) &&
|
||||
EC_GROUP_get_curve_name(a) == EC_GROUP_get_curve_name(b))
|
||||
return 0;
|
||||
EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b))
|
||||
return 1;
|
||||
|
||||
if (!ctx)
|
||||
ctx_new = ctx = BN_CTX_new();
|
||||
@@ -1010,7 +1010,7 @@ int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *
|
||||
|
||||
int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx)
|
||||
{
|
||||
if (group->meth->dbl == 0)
|
||||
if (group->meth->invert == 0)
|
||||
{
|
||||
ECerr(EC_F_EC_POINT_INVERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
return 0;
|
||||
@@ -1061,12 +1061,12 @@ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN
|
||||
if (group->meth->point_cmp == 0)
|
||||
{
|
||||
ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
if ((group->meth != a->meth) || (a->meth != b->meth))
|
||||
{
|
||||
ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
return group->meth->point_cmp(group, a, b, ctx);
|
||||
}
|
||||
|
@@ -1406,6 +1406,9 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *
|
||||
{
|
||||
return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
|
||||
}
|
||||
|
||||
if (EC_POINT_is_at_infinity(group, b))
|
||||
return 1;
|
||||
|
||||
if (a->Z_is_one && b->Z_is_one)
|
||||
{
|
||||
@@ -1537,9 +1540,8 @@ int ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ct
|
||||
int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx)
|
||||
{
|
||||
BN_CTX *new_ctx = NULL;
|
||||
BIGNUM *tmp0, *tmp1;
|
||||
size_t pow2 = 0;
|
||||
BIGNUM **heap = NULL;
|
||||
BIGNUM *tmp, *tmp_Z;
|
||||
BIGNUM **prod_Z = NULL;
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
|
||||
@@ -1554,124 +1556,104 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT
|
||||
}
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
tmp0 = BN_CTX_get(ctx);
|
||||
tmp1 = BN_CTX_get(ctx);
|
||||
if (tmp0 == NULL || tmp1 == NULL) goto err;
|
||||
tmp = BN_CTX_get(ctx);
|
||||
tmp_Z = BN_CTX_get(ctx);
|
||||
if (tmp == NULL || tmp_Z == NULL) goto err;
|
||||
|
||||
/* Before converting the individual points, compute inverses of all Z values.
|
||||
* Modular inversion is rather slow, but luckily we can do with a single
|
||||
* explicit inversion, plus about 3 multiplications per input value.
|
||||
*/
|
||||
|
||||
pow2 = 1;
|
||||
while (num > pow2)
|
||||
pow2 <<= 1;
|
||||
/* Now pow2 is the smallest power of 2 satifsying pow2 >= num.
|
||||
* We need twice that. */
|
||||
pow2 <<= 1;
|
||||
|
||||
heap = OPENSSL_malloc(pow2 * sizeof heap[0]);
|
||||
if (heap == NULL) goto err;
|
||||
|
||||
/* The array is used as a binary tree, exactly as in heapsort:
|
||||
*
|
||||
* heap[1]
|
||||
* heap[2] heap[3]
|
||||
* heap[4] heap[5] heap[6] heap[7]
|
||||
* heap[8]heap[9] heap[10]heap[11] heap[12]heap[13] heap[14] heap[15]
|
||||
*
|
||||
* We put the Z's in the last line;
|
||||
* then we set each other node to the product of its two child-nodes (where
|
||||
* empty or 0 entries are treated as ones);
|
||||
* then we invert heap[1];
|
||||
* then we invert each other node by replacing it by the product of its
|
||||
* parent (after inversion) and its sibling (before inversion).
|
||||
*/
|
||||
heap[0] = NULL;
|
||||
for (i = pow2/2 - 1; i > 0; i--)
|
||||
heap[i] = NULL;
|
||||
prod_Z = OPENSSL_malloc(num * sizeof prod_Z[0]);
|
||||
if (prod_Z == NULL) goto err;
|
||||
for (i = 0; i < num; i++)
|
||||
heap[pow2/2 + i] = &points[i]->Z;
|
||||
for (i = pow2/2 + num; i < pow2; i++)
|
||||
heap[i] = NULL;
|
||||
|
||||
/* set each node to the product of its children */
|
||||
for (i = pow2/2 - 1; i > 0; i--)
|
||||
{
|
||||
heap[i] = BN_new();
|
||||
if (heap[i] == NULL) goto err;
|
||||
|
||||
if (heap[2*i] != NULL)
|
||||
{
|
||||
if ((heap[2*i + 1] == NULL) || BN_is_zero(heap[2*i + 1]))
|
||||
{
|
||||
if (!BN_copy(heap[i], heap[2*i])) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BN_is_zero(heap[2*i]))
|
||||
{
|
||||
if (!BN_copy(heap[i], heap[2*i + 1])) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!group->meth->field_mul(group, heap[i],
|
||||
heap[2*i], heap[2*i + 1], ctx)) goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
prod_Z[i] = BN_new();
|
||||
if (prod_Z[i] == NULL) goto err;
|
||||
}
|
||||
|
||||
/* invert heap[1] */
|
||||
if (!BN_is_zero(heap[1]))
|
||||
{
|
||||
if (!BN_mod_inverse(heap[1], heap[1], &group->field, ctx))
|
||||
{
|
||||
ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (group->meth->field_encode != 0)
|
||||
{
|
||||
/* in the Montgomery case, we just turned R*H (representing H)
|
||||
* into 1/(R*H), but we need R*(1/H) (representing 1/H);
|
||||
* i.e. we have need to multiply by the Montgomery factor twice */
|
||||
if (!group->meth->field_encode(group, heap[1], heap[1], ctx)) goto err;
|
||||
if (!group->meth->field_encode(group, heap[1], heap[1], ctx)) goto err;
|
||||
}
|
||||
/* Set each prod_Z[i] to the product of points[0]->Z .. points[i]->Z,
|
||||
* skipping any zero-valued inputs (pretend that they're 1). */
|
||||
|
||||
/* set other heap[i]'s to their inverses */
|
||||
for (i = 2; i < pow2/2 + num; i += 2)
|
||||
if (!BN_is_zero(&points[0]->Z))
|
||||
{
|
||||
/* i is even */
|
||||
if ((heap[i + 1] != NULL) && !BN_is_zero(heap[i + 1]))
|
||||
if (!BN_copy(prod_Z[0], &points[0]->Z)) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (group->meth->field_set_to_one != 0)
|
||||
{
|
||||
if (!group->meth->field_mul(group, tmp0, heap[i/2], heap[i + 1], ctx)) goto err;
|
||||
if (!group->meth->field_mul(group, tmp1, heap[i/2], heap[i], ctx)) goto err;
|
||||
if (!BN_copy(heap[i], tmp0)) goto err;
|
||||
if (!BN_copy(heap[i + 1], tmp1)) goto err;
|
||||
if (!group->meth->field_set_to_one(group, prod_Z[0], ctx)) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BN_copy(heap[i], heap[i/2])) goto err;
|
||||
if (!BN_one(prod_Z[0])) goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* we have replaced all non-zero Z's by their inverses, now fix up all the points */
|
||||
for (i = 1; i < num; i++)
|
||||
{
|
||||
if (!BN_is_zero(&points[i]->Z))
|
||||
{
|
||||
if (!group->meth->field_mul(group, prod_Z[i], prod_Z[i - 1], &points[i]->Z, ctx)) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BN_copy(prod_Z[i], prod_Z[i - 1])) goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now use a single explicit inversion to replace every
|
||||
* non-zero points[i]->Z by its inverse. */
|
||||
|
||||
if (!BN_mod_inverse(tmp, prod_Z[num - 1], &group->field, ctx))
|
||||
{
|
||||
ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (group->meth->field_encode != 0)
|
||||
{
|
||||
/* In the Montgomery case, we just turned R*H (representing H)
|
||||
* into 1/(R*H), but we need R*(1/H) (representing 1/H);
|
||||
* i.e. we need to multiply by the Montgomery factor twice. */
|
||||
if (!group->meth->field_encode(group, tmp, tmp, ctx)) goto err;
|
||||
if (!group->meth->field_encode(group, tmp, tmp, ctx)) goto err;
|
||||
}
|
||||
|
||||
for (i = num - 1; i > 0; --i)
|
||||
{
|
||||
/* Loop invariant: tmp is the product of the inverses of
|
||||
* points[0]->Z .. points[i]->Z (zero-valued inputs skipped). */
|
||||
if (!BN_is_zero(&points[i]->Z))
|
||||
{
|
||||
/* Set tmp_Z to the inverse of points[i]->Z (as product
|
||||
* of Z inverses 0 .. i, Z values 0 .. i - 1). */
|
||||
if (!group->meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx)) goto err;
|
||||
/* Update tmp to satisfy the loop invariant for i - 1. */
|
||||
if (!group->meth->field_mul(group, tmp, tmp, &points[i]->Z, ctx)) goto err;
|
||||
/* Replace points[i]->Z by its inverse. */
|
||||
if (!BN_copy(&points[i]->Z, tmp_Z)) goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!BN_is_zero(&points[0]->Z))
|
||||
{
|
||||
/* Replace points[0]->Z by its inverse. */
|
||||
if (!BN_copy(&points[0]->Z, tmp)) goto err;
|
||||
}
|
||||
|
||||
/* Finally, fix up the X and Y coordinates for all points. */
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
EC_POINT *p = points[i];
|
||||
|
||||
|
||||
if (!BN_is_zero(&p->Z))
|
||||
{
|
||||
/* turn (X, Y, 1/Z) into (X/Z^2, Y/Z^3, 1) */
|
||||
|
||||
if (!group->meth->field_sqr(group, tmp1, &p->Z, ctx)) goto err;
|
||||
if (!group->meth->field_mul(group, &p->X, &p->X, tmp1, ctx)) goto err;
|
||||
if (!group->meth->field_sqr(group, tmp, &p->Z, ctx)) goto err;
|
||||
if (!group->meth->field_mul(group, &p->X, &p->X, tmp, ctx)) goto err;
|
||||
|
||||
if (!group->meth->field_mul(group, tmp, tmp, &p->Z, ctx)) goto err;
|
||||
if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp, ctx)) goto err;
|
||||
|
||||
if (!group->meth->field_mul(group, tmp1, tmp1, &p->Z, ctx)) goto err;
|
||||
if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp1, ctx)) goto err;
|
||||
|
||||
if (group->meth->field_set_to_one != 0)
|
||||
{
|
||||
if (!group->meth->field_set_to_one(group, &p->Z, ctx)) goto err;
|
||||
@@ -1685,20 +1667,19 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
if (new_ctx != NULL)
|
||||
BN_CTX_free(new_ctx);
|
||||
if (heap != NULL)
|
||||
if (prod_Z != NULL)
|
||||
{
|
||||
/* heap[pow2/2] .. heap[pow2-1] have not been allocated locally! */
|
||||
for (i = pow2/2 - 1; i > 0; i--)
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (heap[i] != NULL)
|
||||
BN_clear_free(heap[i]);
|
||||
if (prod_Z[i] == NULL) break;
|
||||
BN_clear_free(prod_Z[i]);
|
||||
}
|
||||
OPENSSL_free(heap);
|
||||
OPENSSL_free(prod_Z);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@@ -205,8 +205,15 @@ ECDH_DATA *ecdh_check(EC_KEY *key)
|
||||
ecdh_data = (ECDH_DATA *)ecdh_data_new();
|
||||
if (ecdh_data == NULL)
|
||||
return NULL;
|
||||
EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
|
||||
ecdh_data_dup, ecdh_data_free, ecdh_data_free);
|
||||
data = EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
|
||||
ecdh_data_dup, ecdh_data_free, ecdh_data_free);
|
||||
if (data != NULL)
|
||||
{
|
||||
/* Another thread raced us to install the key_method
|
||||
* data and won. */
|
||||
ecdh_data_free(ecdh_data);
|
||||
ecdh_data = (ECDH_DATA *)data;
|
||||
}
|
||||
}
|
||||
else
|
||||
ecdh_data = (ECDH_DATA *)data;
|
||||
|
@@ -168,10 +168,9 @@ int fbytes(unsigned char *buf, int num)
|
||||
return 0;
|
||||
}
|
||||
fbytes_counter ++;
|
||||
ret = BN_bn2bin(tmp, buf);
|
||||
if (ret == 0 || ret != num)
|
||||
if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
|
||||
ret = 0;
|
||||
else
|
||||
else
|
||||
ret = 1;
|
||||
if (tmp)
|
||||
BN_free(tmp);
|
||||
@@ -287,9 +286,13 @@ int test_builtin(BIO *out)
|
||||
size_t crv_len = 0, n = 0;
|
||||
EC_KEY *eckey = NULL, *wrong_eckey = NULL;
|
||||
EC_GROUP *group;
|
||||
ECDSA_SIG *ecdsa_sig = NULL;
|
||||
unsigned char digest[20], wrong_digest[20];
|
||||
unsigned char *signature = NULL;
|
||||
unsigned int sig_len;
|
||||
unsigned char *signature = NULL;
|
||||
const unsigned char *sig_ptr;
|
||||
unsigned char *sig_ptr2;
|
||||
unsigned char *raw_buf = NULL;
|
||||
unsigned int sig_len, degree, r_len, s_len, bn_len, buf_len;
|
||||
int nid, ret = 0;
|
||||
|
||||
/* fill digest values with some random data */
|
||||
@@ -339,7 +342,8 @@ int test_builtin(BIO *out)
|
||||
if (EC_KEY_set_group(eckey, group) == 0)
|
||||
goto builtin_err;
|
||||
EC_GROUP_free(group);
|
||||
if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160)
|
||||
degree = EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
|
||||
if (degree < 160)
|
||||
/* drop the curve */
|
||||
{
|
||||
EC_KEY_free(eckey);
|
||||
@@ -415,26 +419,89 @@ int test_builtin(BIO *out)
|
||||
}
|
||||
BIO_printf(out, ".");
|
||||
(void)BIO_flush(out);
|
||||
/* modify a single byte of the signature */
|
||||
offset = signature[10] % sig_len;
|
||||
dirt = signature[11];
|
||||
signature[offset] ^= dirt ? dirt : 1;
|
||||
/* wrong length */
|
||||
if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
|
||||
eckey) == 1)
|
||||
{
|
||||
BIO_printf(out, " failed\n");
|
||||
goto builtin_err;
|
||||
}
|
||||
BIO_printf(out, ".");
|
||||
(void)BIO_flush(out);
|
||||
|
||||
/* Modify a single byte of the signature: to ensure we don't
|
||||
* garble the ASN1 structure, we read the raw signature and
|
||||
* modify a byte in one of the bignums directly. */
|
||||
sig_ptr = signature;
|
||||
if ((ecdsa_sig = d2i_ECDSA_SIG(NULL, &sig_ptr, sig_len)) == NULL)
|
||||
{
|
||||
BIO_printf(out, " failed\n");
|
||||
goto builtin_err;
|
||||
}
|
||||
|
||||
/* Store the two BIGNUMs in raw_buf. */
|
||||
r_len = BN_num_bytes(ecdsa_sig->r);
|
||||
s_len = BN_num_bytes(ecdsa_sig->s);
|
||||
bn_len = (degree + 7) / 8;
|
||||
if ((r_len > bn_len) || (s_len > bn_len))
|
||||
{
|
||||
BIO_printf(out, " failed\n");
|
||||
goto builtin_err;
|
||||
}
|
||||
buf_len = 2 * bn_len;
|
||||
if ((raw_buf = OPENSSL_malloc(buf_len)) == NULL)
|
||||
goto builtin_err;
|
||||
/* Pad the bignums with leading zeroes. */
|
||||
memset(raw_buf, 0, buf_len);
|
||||
BN_bn2bin(ecdsa_sig->r, raw_buf + bn_len - r_len);
|
||||
BN_bn2bin(ecdsa_sig->s, raw_buf + buf_len - s_len);
|
||||
|
||||
/* Modify a single byte in the buffer. */
|
||||
offset = raw_buf[10] % buf_len;
|
||||
dirt = raw_buf[11] ? raw_buf[11] : 1;
|
||||
raw_buf[offset] ^= dirt;
|
||||
/* Now read the BIGNUMs back in from raw_buf. */
|
||||
if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
|
||||
(BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
|
||||
goto builtin_err;
|
||||
|
||||
sig_ptr2 = signature;
|
||||
sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
|
||||
if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)
|
||||
{
|
||||
BIO_printf(out, " failed\n");
|
||||
goto builtin_err;
|
||||
}
|
||||
/* Sanity check: undo the modification and verify signature. */
|
||||
raw_buf[offset] ^= dirt;
|
||||
if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
|
||||
(BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
|
||||
goto builtin_err;
|
||||
|
||||
sig_ptr2 = signature;
|
||||
sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
|
||||
if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
|
||||
{
|
||||
BIO_printf(out, " failed\n");
|
||||
goto builtin_err;
|
||||
}
|
||||
BIO_printf(out, ".");
|
||||
(void)BIO_flush(out);
|
||||
|
||||
BIO_printf(out, " ok\n");
|
||||
/* cleanup */
|
||||
/* clean bogus errors */
|
||||
ERR_clear_error();
|
||||
OPENSSL_free(signature);
|
||||
signature = NULL;
|
||||
EC_KEY_free(eckey);
|
||||
eckey = NULL;
|
||||
EC_KEY_free(wrong_eckey);
|
||||
wrong_eckey = NULL;
|
||||
ECDSA_SIG_free(ecdsa_sig);
|
||||
ecdsa_sig = NULL;
|
||||
OPENSSL_free(raw_buf);
|
||||
raw_buf = NULL;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
@@ -443,8 +510,12 @@ builtin_err:
|
||||
EC_KEY_free(eckey);
|
||||
if (wrong_eckey)
|
||||
EC_KEY_free(wrong_eckey);
|
||||
if (ecdsa_sig)
|
||||
ECDSA_SIG_free(ecdsa_sig);
|
||||
if (signature)
|
||||
OPENSSL_free(signature);
|
||||
if (raw_buf)
|
||||
OPENSSL_free(raw_buf);
|
||||
if (curves)
|
||||
OPENSSL_free(curves);
|
||||
|
||||
|
@@ -188,8 +188,15 @@ ECDSA_DATA *ecdsa_check(EC_KEY *key)
|
||||
ecdsa_data = (ECDSA_DATA *)ecdsa_data_new();
|
||||
if (ecdsa_data == NULL)
|
||||
return NULL;
|
||||
EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
|
||||
ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
|
||||
data = EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
|
||||
ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
|
||||
if (data != NULL)
|
||||
{
|
||||
/* Another thread raced us to install the key_method
|
||||
* data and won. */
|
||||
ecdsa_data_free(ecdsa_data);
|
||||
ecdsa_data = (ECDSA_DATA *)data;
|
||||
}
|
||||
}
|
||||
else
|
||||
ecdsa_data = (ECDSA_DATA *)data;
|
||||
|
@@ -144,6 +144,14 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
|
||||
}
|
||||
while (BN_is_zero(k));
|
||||
|
||||
/* We do not want timing information to leak the length of k,
|
||||
* so we compute G*k using an equivalent scalar of fixed
|
||||
* bit-length. */
|
||||
|
||||
if (!BN_add(k, k, order)) goto err;
|
||||
if (BN_num_bits(k) <= BN_num_bits(order))
|
||||
if (!BN_add(k, k, order)) goto err;
|
||||
|
||||
/* compute r the x-coordinate of generator * k */
|
||||
if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx))
|
||||
{
|
||||
|
@@ -102,14 +102,14 @@ void ENGINE_load_builtin_engines(void)
|
||||
#if !defined(OPENSSL_NO_GMP) && !defined(OPENSSL_NO_HW_GMP)
|
||||
ENGINE_load_gmp();
|
||||
#endif
|
||||
#if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
|
||||
ENGINE_load_capi();
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_HW
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
|
||||
ENGINE_load_cryptodev();
|
||||
#endif
|
||||
#if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
|
||||
ENGINE_load_capi();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -335,15 +335,15 @@ void ENGINE_load_gmp(void);
|
||||
void ENGINE_load_nuron(void);
|
||||
void ENGINE_load_sureware(void);
|
||||
void ENGINE_load_ubsec(void);
|
||||
#endif
|
||||
void ENGINE_load_cryptodev(void);
|
||||
void ENGINE_load_padlock(void);
|
||||
void ENGINE_load_builtin_engines(void);
|
||||
#ifdef OPENSSL_SYS_WIN32
|
||||
#ifndef OPENSSL_NO_CAPIENG
|
||||
void ENGINE_load_capi(void);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
void ENGINE_load_cryptodev(void);
|
||||
void ENGINE_load_padlock(void);
|
||||
void ENGINE_load_builtin_engines(void);
|
||||
|
||||
/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
|
||||
* "registry" handling. */
|
||||
|
@@ -104,7 +104,9 @@
|
||||
#ifndef OPENSSL_NO_JPAKE
|
||||
#include <openssl/jpake.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
#include <openssl/comp.h>
|
||||
#endif
|
||||
|
||||
void ERR_load_crypto_strings(void)
|
||||
{
|
||||
|
@@ -69,8 +69,14 @@ R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060
|
||||
R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070
|
||||
R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071
|
||||
R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080
|
||||
R SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086
|
||||
R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090
|
||||
R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100
|
||||
R SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110
|
||||
R SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111
|
||||
R SSL_R_TLSV1_UNRECOGNIZED_NAME 1112
|
||||
R SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
|
||||
R SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
|
||||
|
||||
R RSAREF_R_CONTENT_ENCODING 0x0400
|
||||
R RSAREF_R_DATA 0x0401
|
||||
|
@@ -385,7 +385,8 @@ evp_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
|
||||
evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
|
||||
evp_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
|
||||
evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
|
||||
evp_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_enc.c evp_locl.h
|
||||
evp_enc.o: ../../include/openssl/x509_vfy.h ../constant_time_locl.h
|
||||
evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
|
||||
evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
|
||||
evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
|
@@ -226,6 +226,7 @@ static int b64_read(BIO *b, char *out, int outl)
|
||||
else if (ctx->start)
|
||||
{
|
||||
q=p=(unsigned char *)ctx->tmp;
|
||||
num = 0;
|
||||
for (j=0; j<i; j++)
|
||||
{
|
||||
if (*(q++) != '\n') continue;
|
||||
@@ -264,7 +265,7 @@ static int b64_read(BIO *b, char *out, int outl)
|
||||
}
|
||||
|
||||
/* we fell off the end without starting */
|
||||
if (j == i)
|
||||
if ((j == i) && (num == 0))
|
||||
{
|
||||
/* Is this is one long chunk?, if so, keep on
|
||||
* reading until a new line. */
|
||||
|
@@ -324,6 +324,7 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
|
||||
v=EVP_DecodeBlock(out,d,n);
|
||||
n=0;
|
||||
if (v < 0) { rv=0; goto end; }
|
||||
if (eof > v) { rv=-1; goto end; }
|
||||
ret+=(v-eof);
|
||||
}
|
||||
else
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#include "../constant_time_locl.h"
|
||||
#include "evp_locl.h"
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
@@ -301,11 +302,11 @@ int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||
{
|
||||
int i,n;
|
||||
unsigned int b;
|
||||
unsigned int i, b;
|
||||
unsigned char pad, padding_good;
|
||||
|
||||
*outl=0;
|
||||
b=ctx->cipher->block_size;
|
||||
b=(unsigned int)(ctx->cipher->block_size);
|
||||
if (ctx->flags & EVP_CIPH_NO_PADDING)
|
||||
{
|
||||
if(ctx->buf_len)
|
||||
@@ -324,28 +325,34 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||
return(0);
|
||||
}
|
||||
OPENSSL_assert(b <= sizeof ctx->final);
|
||||
n=ctx->final[b-1];
|
||||
if (n == 0 || n > (int)b)
|
||||
pad=ctx->final[b-1];
|
||||
|
||||
padding_good = (unsigned char)(~constant_time_is_zero_8(pad));
|
||||
padding_good &= constant_time_ge_8(b, pad);
|
||||
|
||||
for (i = 1; i < b; ++i)
|
||||
{
|
||||
EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
|
||||
return(0);
|
||||
unsigned char is_pad_index = constant_time_lt_8(i, pad);
|
||||
unsigned char pad_byte_good = constant_time_eq_8(ctx->final[b-i-1], pad);
|
||||
padding_good &= constant_time_select_8(is_pad_index, pad_byte_good, 0xff);
|
||||
}
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if (ctx->final[--b] != n)
|
||||
{
|
||||
EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
n=ctx->cipher->block_size-n;
|
||||
for (i=0; i<n; i++)
|
||||
out[i]=ctx->final[i];
|
||||
*outl=n;
|
||||
|
||||
/*
|
||||
* At least 1 byte is always padding, so we always write b - 1
|
||||
* bytes to avoid a timing leak. The caller is required to have |b|
|
||||
* bytes space in |out| by the API contract.
|
||||
*/
|
||||
for (i = 0; i < b - 1; ++i)
|
||||
out[i] = ctx->final[i] & padding_good;
|
||||
/* Safe cast: for a good padding, EVP_MAX_IV_LENGTH >= b >= pad */
|
||||
*outl = padding_good & ((unsigned char)(b - pad));
|
||||
return padding_good & 1;
|
||||
}
|
||||
else
|
||||
*outl=0;
|
||||
return(1);
|
||||
{
|
||||
*outl = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user