Compare commits
210 Commits
OpenSSL_0_
...
OpenSSL_0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcf8f4d453 | ||
|
|
13617646da | ||
|
|
7a3565009e | ||
|
|
9f3864fde3 | ||
|
|
db186beee4 | ||
|
|
1f1a32541f | ||
|
|
0465313e70 | ||
|
|
8d2563f136 | ||
|
|
21996c6d8e | ||
|
|
fcc5349156 | ||
|
|
1a07628209 | ||
|
|
814af7e175 | ||
|
|
bf683ec609 | ||
|
|
e851895f04 | ||
|
|
a2049ba394 | ||
|
|
a8239afc86 | ||
|
|
bb38cd49e4 | ||
|
|
1cbdbcd587 | ||
|
|
7e201e9f73 | ||
|
|
2f98abbcb6 | ||
|
|
270fa8aeda | ||
|
|
9fc866c5eb | ||
|
|
4329db3726 | ||
|
|
6f7ac8e1b0 | ||
|
|
b0e88fb11b | ||
|
|
04c71cd725 | ||
|
|
a1457874c6 | ||
|
|
d64b16ab25 | ||
|
|
18be6c4116 | ||
|
|
f30b793779 | ||
|
|
dad1535f7a | ||
|
|
f60e6604b8 | ||
|
|
94ea9c84c5 | ||
|
|
0d3f2ccb62 | ||
|
|
5c72869563 | ||
|
|
14676ffcd6 | ||
|
|
e5a08ce44d | ||
|
|
712419b73a | ||
|
|
b9b6e14b4a | ||
|
|
7627efc92f | ||
|
|
442d42300b | ||
|
|
cd7f458e28 | ||
|
|
75e1c74724 | ||
|
|
ea01493df0 | ||
|
|
5db2b5e573 | ||
|
|
323edf1908 | ||
|
|
005ef84c5d | ||
|
|
f92570f00a | ||
|
|
9314e366c8 | ||
|
|
ba9cf37d59 | ||
|
|
b22c7a1cfb | ||
|
|
99efc0f50f | ||
|
|
d979d09ccc | ||
|
|
2581aacd52 | ||
|
|
c17810b087 | ||
|
|
e0b2073fd4 | ||
|
|
123e5dfc3a | ||
|
|
533a0c4ce7 | ||
|
|
0edad88a31 | ||
|
|
4ccfe5f49b | ||
|
|
e189872486 | ||
|
|
fdaea9ed2e | ||
|
|
5daec7ea0e | ||
|
|
e9224c7177 | ||
|
|
e90e719739 | ||
|
|
7ba666fa0e | ||
|
|
86a62cf15c | ||
|
|
b11405723d | ||
|
|
4c3a2b4f8a | ||
|
|
93f3decc4f | ||
|
|
bbf8198feb | ||
|
|
1c799131ae | ||
|
|
b1d4b48d39 | ||
|
|
bed4559052 | ||
|
|
3dda0dd2a2 | ||
|
|
7f87c1c0fc | ||
|
|
fa63a98ad8 | ||
|
|
1fc73fef48 | ||
|
|
aaf7b47abe | ||
|
|
af0b30e77c | ||
|
|
90543bd07a | ||
|
|
9494e3cc40 | ||
|
|
a272f7eb08 | ||
|
|
43ecece595 | ||
|
|
b3dd9f3bb5 | ||
|
|
4ba8cabf62 | ||
|
|
bb9104f0ee | ||
|
|
f68bb3c51f | ||
|
|
6d4ac67ac1 | ||
|
|
ae0b7667a9 | ||
|
|
b84d5b72f1 | ||
|
|
8cbccedf7c | ||
|
|
fabf7d3a67 | ||
|
|
1c24347062 | ||
|
|
54307ce955 | ||
|
|
9ef888130d | ||
|
|
2589b74fd8 | ||
|
|
4387f47832 | ||
|
|
d9090acdfb | ||
|
|
38d6e4bb50 | ||
|
|
ced621e3c2 | ||
|
|
72951df799 | ||
|
|
85940ea8ea | ||
|
|
a9b41af71c | ||
|
|
439ae4d398 | ||
|
|
a0ed612fef | ||
|
|
4fbe40c54f | ||
|
|
afdec73ca5 | ||
|
|
578ca7e4cd | ||
|
|
7e8c30b589 | ||
|
|
2b32b28191 | ||
|
|
532215f2db | ||
|
|
2e70cb6506 | ||
|
|
1794904a4a | ||
|
|
5319be4438 | ||
|
|
fd28279a62 | ||
|
|
f7a3e73ef6 | ||
|
|
6b27ae1d94 | ||
|
|
ff3345cb72 | ||
|
|
a6ee8fe26a | ||
|
|
716b2079dc | ||
|
|
e7b6228fd3 | ||
|
|
e758ce69a3 | ||
|
|
2053c43de2 | ||
|
|
38b085902f | ||
|
|
27498a3330 | ||
|
|
1c3e4a3660 | ||
|
|
49cd4b7316 | ||
|
|
4707991520 | ||
|
|
a067cba35b | ||
|
|
7a1f92fdc3 | ||
|
|
2905015c6e | ||
|
|
610abd4c52 | ||
|
|
e7a285694e | ||
|
|
6ab285bf4c | ||
|
|
ddc6ea162f | ||
|
|
1d3159bcca | ||
|
|
f60ceb54eb | ||
|
|
b8804bf15d | ||
|
|
0f995b2f40 | ||
|
|
d03ad453a5 | ||
|
|
848f735ae4 | ||
|
|
3f71579dfc | ||
|
|
a678430602 | ||
|
|
f217439ee2 | ||
|
|
e9b553dac1 | ||
|
|
9d8f3cfb7f | ||
|
|
d5c79928ef | ||
|
|
db3758923b | ||
|
|
37529750e2 | ||
|
|
5e4a75e79f | ||
|
|
c9ea7400b4 | ||
|
|
43d601641f | ||
|
|
9fa15b6ff8 | ||
|
|
55f78baf32 | ||
|
|
9c44ebc1e2 | ||
|
|
6c359479d7 | ||
|
|
75e3026a14 | ||
|
|
4579924b7e | ||
|
|
2047bda6fb | ||
|
|
406c6f6962 | ||
|
|
0a3af9a403 | ||
|
|
3a08cf3bfb | ||
|
|
df29cc8f77 | ||
|
|
ec7164133d | ||
|
|
8826087a97 | ||
|
|
8aa09a245c | ||
|
|
ba8ad07490 | ||
|
|
17582ccf21 | ||
|
|
a5fd84de41 | ||
|
|
31be2daa06 | ||
|
|
dc199cfaa2 | ||
|
|
de868e0b94 | ||
|
|
b81ef84227 | ||
|
|
15994b034a | ||
|
|
922fa76e26 | ||
|
|
19aa370573 | ||
|
|
d020e701bb | ||
|
|
91203a9482 | ||
|
|
364ff369d1 | ||
|
|
134fea9d0f | ||
|
|
8a09b3866a | ||
|
|
137445140b | ||
|
|
6a8afe2201 | ||
|
|
a153c46d7f | ||
|
|
1e3a9b650f | ||
|
|
8faad520ae | ||
|
|
229dc0ee31 | ||
|
|
fcc764639d | ||
|
|
8f89ae928b | ||
|
|
821385ad00 | ||
|
|
25ff76d565 | ||
|
|
9801fb61d0 | ||
|
|
20199ca809 | ||
|
|
711f1a3c26 | ||
|
|
a1d85309ee | ||
|
|
450cee5c3a | ||
|
|
a2dbcf3644 | ||
|
|
4663355496 | ||
|
|
9dc610495c | ||
|
|
055076cd4f | ||
|
|
527497a722 | ||
|
|
32d21c1ef6 | ||
|
|
629b58b7fb | ||
|
|
7fa2a81d34 | ||
|
|
7f66ab4783 | ||
|
|
95189389b0 | ||
|
|
b4b82ab465 | ||
|
|
89618e7a0d | ||
|
|
b87e2576b5 |
41
CHANGES
41
CHANGES
@@ -4,6 +4,30 @@
|
||||
|
||||
Changes between 0.9.6h and 0.9.7 [XX xxx 2002]
|
||||
|
||||
*) The hw_ncipher.c engine requires dynamic locks. Unfortunately, it
|
||||
seems that in spite of existing for more than a year, many application
|
||||
author have done nothing to provide the necessary callbacks, which
|
||||
means that this particular engine will not work properly anywhere.
|
||||
This is a very unfortunate situation which forces us, in the name
|
||||
of usability, to give the hw_ncipher.c a static lock, which is part
|
||||
of libcrypto.
|
||||
NOTE: This is for the 0.9.7 series ONLY. This hack will never
|
||||
appear in 0.9.8 or later. We EXPECT application authors to have
|
||||
dealt properly with this when 0.9.8 is released (unless we actually
|
||||
make such changes in the libcrypto locking code that changes will
|
||||
have to be made anyway).
|
||||
[Richard Levitte]
|
||||
|
||||
*) In asn1_d2i_read_bio() repeatedly call BIO_read() until all content
|
||||
octets have been read, EOF or an error occurs. Without this change
|
||||
some truncated ASN1 structures will not produce an error.
|
||||
[Steve Henson]
|
||||
|
||||
*) Disable Heimdal support, since it hasn't been fully implemented.
|
||||
Still give the possibility to force the use of Heimdal, but with
|
||||
warnings and a request that patches get sent to openssl-dev.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Add the VC-CE target, introduce the WINCE sysname, and add
|
||||
INSTALL.WCE and appropriate conditionals to make it build.
|
||||
[Steven Reddie <smr@essemer.com.au> via Richard Levitte]
|
||||
@@ -1778,7 +1802,22 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*) Clean old EAY MD5 hack from e_os.h.
|
||||
[Richard Levitte]
|
||||
|
||||
Changes between 0.9.6g and 0.9.6h [xx XXX xxxx]
|
||||
Changes between 0.9.6g and 0.9.6h [5 Dec 2002]
|
||||
|
||||
*) New function OPENSSL_cleanse(), which is used to cleanse a section of
|
||||
memory from it's contents. This is done with a counter that will
|
||||
place alternating values in each byte. This can be used to solve
|
||||
two issues: 1) the removal of calls to memset() by highly optimizing
|
||||
compilers, and 2) cleansing with other values than 0, since those can
|
||||
be read through on certain media, for example a swap space on disk.
|
||||
[Geoff Thorpe]
|
||||
|
||||
*) Bugfix: client side session caching did not work with external caching,
|
||||
because the session->cipher setting was not restored when reloading
|
||||
from the external cache. This problem was masked, when
|
||||
SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG (part of SSL_OP_ALL) was set.
|
||||
(Found by Steve Haslam <steve@araqnid.ddts.net>.)
|
||||
[Lutz Jaenicke]
|
||||
|
||||
*) Fix client_certificate (ssl/s2_clnt.c): The permissible total
|
||||
length of the REQUEST-CERTIFICATE message is 18 .. 34, not 17 .. 33.
|
||||
|
||||
56
Configure
56
Configure
@@ -161,25 +161,25 @@ my %table=(
|
||||
# surrounds it with #APP #NO_APP comment pair which (at least Solaris
|
||||
# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
|
||||
# error message.
|
||||
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### Solaris x86 with Sun C setups
|
||||
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### SPARC Solaris with GNU C setups
|
||||
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
|
||||
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
|
||||
# but keep the assembler modules.
|
||||
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
####
|
||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### SPARC Solaris with Sun C setups
|
||||
# DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
|
||||
@@ -203,9 +203,8 @@ my %table=(
|
||||
# it's a real mess with -mcpu=ultrasparc option under Linux, but
|
||||
# -Wa,-Av8plus should do the trick no matter what.
|
||||
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
# !!!Folowing can't be even tested yet!!!
|
||||
# We have to wait till 64-bit glibc for SPARC is operational!!!
|
||||
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
|
||||
# GCC 3.1 is a requirement
|
||||
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
# Sunos configs, assuming sparc for the gcc one.
|
||||
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:::",
|
||||
@@ -392,6 +391,7 @@ my %table=(
|
||||
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
@@ -527,7 +527,7 @@ my %table=(
|
||||
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
|
||||
|
||||
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
|
||||
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown):::::::",
|
||||
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
|
||||
"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::::::",
|
||||
# K&R C is no longer supported; you need gcc on old Ultrix installations
|
||||
##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
|
||||
@@ -973,6 +973,17 @@ else
|
||||
my ($lresolv, $lpath, $lext);
|
||||
if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
|
||||
{
|
||||
die "Sorry, Heimdal is currently not supported\n";
|
||||
}
|
||||
##### HACK to force use of Heimdal.
|
||||
##### WARNING: Since we don't really have adequate support for Heimdal,
|
||||
##### using this will break the build. You'll have to make
|
||||
##### changes to the source, and if you do, please send
|
||||
##### patches to openssl-dev@openssl.org
|
||||
if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
|
||||
{
|
||||
warn "Heimdal isn't really supported. Your build WILL break\n";
|
||||
warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
|
||||
$withargs{"krb5-dir"} = "/usr/heimdal"
|
||||
if $withargs{"krb5-dir"} eq "";
|
||||
$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
|
||||
@@ -1072,6 +1083,11 @@ if ($no_asm)
|
||||
$sha1_obj=$md5_obj=$rmd160_obj="";
|
||||
}
|
||||
|
||||
if (!$no_shared)
|
||||
{
|
||||
$cast_obj=""; # CAST assembler is not PIC
|
||||
}
|
||||
|
||||
if ($threads)
|
||||
{
|
||||
$cflags=$thread_cflags;
|
||||
@@ -1087,20 +1103,16 @@ if ($zlib)
|
||||
|
||||
# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
|
||||
my $shared_mark = "";
|
||||
if ($shared_target ne "")
|
||||
if ($shared_target eq "")
|
||||
{
|
||||
$no_shared = 1;
|
||||
}
|
||||
if (!$no_shared)
|
||||
{
|
||||
if ($shared_cflag ne "")
|
||||
{
|
||||
$cflags = "$shared_cflag $cflags";
|
||||
}
|
||||
if (!$no_shared)
|
||||
{
|
||||
#$shared_mark = "\$(SHARED_LIBS)";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$no_shared = 1;
|
||||
}
|
||||
|
||||
if ($sys_id ne "")
|
||||
|
||||
2
FAQ
2
FAQ
@@ -66,7 +66,7 @@ OpenSSL - Frequently Asked Questions
|
||||
* Which is the current version of OpenSSL?
|
||||
|
||||
The current version is available from <URL: http://www.openssl.org>.
|
||||
OpenSSL 0.9.6g was released on August 9, 2002.
|
||||
OpenSSL 0.9.6h was released on December 5, 2002.
|
||||
|
||||
In addition to the current stable release, you can also access daily
|
||||
snapshots of the OpenSSL development version at <URL:
|
||||
|
||||
6
INSTALL
6
INSTALL
@@ -140,8 +140,8 @@
|
||||
standard headers). If it is a problem with OpenSSL itself, please
|
||||
report the problem to <openssl-bugs@openssl.org> (note that your
|
||||
message will be recorded in the request tracker publicly readable
|
||||
via http://www.openssl.org/rt2.html and will be forwarded to a public
|
||||
mailing list). Include the output of "make report" in your message.
|
||||
via http://www.openssl.org/support/rt2.html and will be forwarded to a
|
||||
public mailing list). Include the output of "make report" in your message.
|
||||
Please check out the request tracker. Maybe the bug was already
|
||||
reported or has already been fixed.
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
in Makefile.ssl and run "make clean; make". Please send a bug
|
||||
report to <openssl-bugs@openssl.org>, including the output of
|
||||
"make report" in order to be added to the request tracker at
|
||||
http://www.openssl.org/rt2.html.
|
||||
http://www.openssl.org/support/rt2.html.
|
||||
|
||||
4. If everything tests ok, install OpenSSL with
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
latest versions of DJGPP, GCC, BINUTILS, BASH, etc. This package
|
||||
requires that PERL and BC also be installed.
|
||||
|
||||
All of these can be obtained from the usual DJGPP mirror sites, such as
|
||||
"ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp". You also need to have
|
||||
the WATT-32 networking package installed before you try to compile
|
||||
openssl. This can be obtained from "http://www.bgnett.no/~giva/". The
|
||||
Makefile assumes that the WATT-32 code is in directory "watt32" under
|
||||
/dev/env/DJDIR.
|
||||
All of these can be obtained from the usual DJGPP mirror sites, such
|
||||
as "ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp". You also need to
|
||||
have the WATT-32 networking package installed before you try to compile
|
||||
openssl. This can be obtained from "http://www.bgnett.no/~giva/".
|
||||
The Makefile assumes that the WATT-32 code is in the directory
|
||||
specified by the environment variable WATT_ROOT. If you have watt-32
|
||||
in directory "watt32" under your main DJGPP directory, specify
|
||||
WATT_ROOT="/dev/env/DJDIR/watt32".
|
||||
|
||||
To compile openssl, start your BASH shell. Then configure for DOS by
|
||||
running "./Configure" with appropriate arguments. The basic syntax for
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
You also need Perl for Win32. You will need ActiveState Perl, available
|
||||
from http://www.activestate.com/ActivePerl.
|
||||
|
||||
Windows CE support in OpenSSL relies on wcecompat. All Windows CE specific
|
||||
issues should be directed to www.essemer.com.au.
|
||||
|
||||
The C Runtime Library implementation for Windows CE that is included with
|
||||
Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
|
||||
incorrect. wcecompat plugs the holes and tries to bring the Windows CE
|
||||
|
||||
58
Makefile.org
58
Makefile.org
@@ -15,6 +15,11 @@ OPTIONS=
|
||||
CONFIGURE_ARGS=
|
||||
SHLIB_TARGET=
|
||||
|
||||
# HERE indicates where this Makefile lives. This can be used to indicate
|
||||
# where sub-Makefiles are expected to be. Currently has very limited usage,
|
||||
# and should probably not be bothered with at all.
|
||||
HERE=.
|
||||
|
||||
# INSTALL_PREFIX is for package builders so that they can configure
|
||||
# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
|
||||
# Normally it is left empty.
|
||||
@@ -274,10 +279,7 @@ do_gnu-shared:
|
||||
libs="$$libs -l$$i"; \
|
||||
done
|
||||
|
||||
DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
|
||||
my_ld=`${CC} -print-prog-name=ld 2>&1` && \
|
||||
[ -n "$$my_ld" ] && \
|
||||
$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
|
||||
DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
|
||||
|
||||
# For Darwin AKA Mac OS/X (dyld)
|
||||
do_darwin-shared:
|
||||
@@ -355,10 +357,13 @@ do_solaris-shared:
|
||||
else \
|
||||
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
|
||||
set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
MINUSZ='-z '; \
|
||||
(${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
|
||||
set -x; ${CC} ${SHARED_LDFLAGS} -G -dy -z text \
|
||||
-o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||
$${MINUSZ}allextract lib$$i.a $${MINUSZ}defaultextract \
|
||||
$$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||
libs="$$libs -l$$i"; \
|
||||
done; \
|
||||
fi
|
||||
@@ -597,7 +602,8 @@ rehash.time: certs
|
||||
@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
|
||||
export OPENSSL OPENSSL_DEBUG_MEMORY; \
|
||||
LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
|
||||
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
|
||||
$(PERL) tools/c_rehash certs)
|
||||
touch rehash.time
|
||||
@@ -608,7 +614,8 @@ tests: rehash
|
||||
@(cd test && echo "testing..." && \
|
||||
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
|
||||
@LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
|
||||
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
|
||||
apps/openssl version -a
|
||||
|
||||
@@ -729,7 +736,7 @@ install: all install_docs
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
||||
fi; \
|
||||
done;
|
||||
@if [ -n "$(SHARED_LIBS)" ]; then \
|
||||
@@ -741,15 +748,15 @@ install: all install_docs
|
||||
if [ "$(PLATFORM)" != "Cygwin" ]; then \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||
else \
|
||||
c=`echo $$i | sed 's/^lib\(.*\)/cyg\1-$(SHLIB_VERSION_NUMBER)/'`; \
|
||||
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
|
||||
cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
|
||||
fi ); \
|
||||
fi; \
|
||||
done; \
|
||||
@@ -767,25 +774,42 @@ install_docs:
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man5 \
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man7
|
||||
@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
|
||||
here="`pwd`"; \
|
||||
filecase=; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" ]; then \
|
||||
filecase=-i; \
|
||||
fi; \
|
||||
for i in doc/apps/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
|
||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||
echo "installing man$$sec/$$fn.$$sec"; \
|
||||
(cd `$(PERL) util/dirname.pl $$i`; \
|
||||
sh -c "$$pod2man \
|
||||
--section=$$sec --center=OpenSSL \
|
||||
--release=$(VERSION) `basename $$i`") \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
|
||||
$(PERL) util/extract-names.pl < $$i | \
|
||||
grep -v $$filecase "^$$fn\$$" | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$$sec $$n.$$sec; \
|
||||
done); \
|
||||
done; \
|
||||
for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
|
||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||
echo "installing man$$sec/$$fn.$$sec"; \
|
||||
(cd `$(PERL) util/dirname.pl $$i`; \
|
||||
sh -c "$$pod2man \
|
||||
--section=$$sec --center=OpenSSL \
|
||||
--release=$(VERSION) `basename $$i`") \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
|
||||
$(PERL) util/extract-names.pl < $$i | \
|
||||
grep -v $$filecase "^$$fn\$$" | \
|
||||
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
|
||||
while read n; do \
|
||||
$$here/util/point.sh $$fn.$$sec $$n.$$sec; \
|
||||
done); \
|
||||
done
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
7
NEWS
7
NEWS
@@ -17,11 +17,15 @@
|
||||
a separate distribution.
|
||||
o New elliptic curve library section.
|
||||
o New AES (Rijndael) library section.
|
||||
o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit
|
||||
o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit,
|
||||
Linux x86_64, Linux 64-bit on Sparc v9
|
||||
o Extended support for some platforms: VxWorks
|
||||
o Enhanced support for shared libraries.
|
||||
o Now only builds PIC code when shared library support is requested.
|
||||
o Support for pkg-config.
|
||||
o Lots of new manuals.
|
||||
o Makes symbolic links to or copies of manuals to cover all described
|
||||
functions.
|
||||
o Change DES API to clean up the namespace (some applications link also
|
||||
against libdes providing similar functions having the same name).
|
||||
Provide macros for backward compatibility (will be removed in the
|
||||
@@ -42,6 +46,7 @@
|
||||
o SSL/TLS: allow optional cipher choice according to server's preference.
|
||||
o SSL/TLS: allow server to explicitly set new session ids.
|
||||
o SSL/TLS: support Kerberos cipher suites (RFC2712).
|
||||
Only supports MIT Kerberos for now.
|
||||
o SSL/TLS: allow more precise control of renegotiations and sessions.
|
||||
o SSL/TLS: add callback to retrieve SSL/TLS messages.
|
||||
o SSL/TLS: support AES cipher suites (RFC3268).
|
||||
|
||||
16
PROBLEMS
16
PROBLEMS
@@ -46,3 +46,19 @@ scripts use the same name for output and input files, which means different
|
||||
will interfere with each other and lead to test failure.
|
||||
|
||||
The solution is simple for now: don't run parallell make when testing.
|
||||
|
||||
|
||||
* Bugs in gcc 3.0 triggered
|
||||
|
||||
According to a problem report, there are bugs in gcc 3.0 that are
|
||||
triggered by some of the code in OpenSSL, more specifically in
|
||||
PEM_get_EVP_CIPHER_INFO(). The triggering code is the following:
|
||||
|
||||
header+=11;
|
||||
if (*header != '4') return(0); header++;
|
||||
if (*header != ',') return(0); header++;
|
||||
|
||||
What happens is that gcc might optimize a little too agressively, and
|
||||
you end up with an extra incrementation when *header != '4'.
|
||||
|
||||
We recommend that you upgrade gcc to as high a 3.x version as you can.
|
||||
|
||||
2
README
2
README
@@ -1,5 +1,5 @@
|
||||
|
||||
OpenSSL 0.9.7-beta4 19 Nov 2002
|
||||
OpenSSL 0.9.7-beta6 17 Dec 2002
|
||||
|
||||
Copyright (c) 1998-2002 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
|
||||
26
STATUS
26
STATUS
@@ -1,14 +1,17 @@
|
||||
|
||||
OpenSSL STATUS Last modified at
|
||||
______________ $Date: 2002/11/19 09:34:38 $
|
||||
______________ $Date: 2002/12/17 14:24:51 $
|
||||
|
||||
DEVELOPMENT STATE
|
||||
|
||||
o OpenSSL 0.9.8: Under development...
|
||||
o OpenSSL 0.9.7-beta6: Released on December 17th, 2002
|
||||
o OpenSSL 0.9.7-beta5: Released on December 5th, 2002
|
||||
o OpenSSL 0.9.7-beta4: Released on November 19th, 2002
|
||||
o OpenSSL 0.9.7-beta3: Released on July 30th, 2002
|
||||
o OpenSSL 0.9.7-beta2: Released on June 16th, 2002
|
||||
o OpenSSL 0.9.7-beta1: Released on June 1st, 2002
|
||||
o OpenSSL 0.9.7-beta3: Released on July 30th, 2002
|
||||
o OpenSSL 0.9.7-beta2: Released on June 16th, 2002
|
||||
o OpenSSL 0.9.7-beta1: Released on June 1st, 2002
|
||||
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
|
||||
@@ -32,6 +35,18 @@
|
||||
o BN_mod_mul verification fails for mips3-sgi-irix
|
||||
unless configured with no-asm
|
||||
|
||||
o [2002-11-21]
|
||||
PR 343 mentions that scrubbing memory with 'memset(ptr, 0, n)' may
|
||||
be optimized away in modern compilers. This is definitely not good
|
||||
and needs to be fixed immediately. The formula to use is presented
|
||||
in:
|
||||
|
||||
http://online.securityfocus.com/archive/82/297918/2002-10-27/2002-11-02/0
|
||||
|
||||
The problem report that mentions this is:
|
||||
|
||||
https://www.aet.TU-Cottbus.DE/rt2/Ticket/Display.html?id=343
|
||||
|
||||
AVAILABLE PATCHES
|
||||
|
||||
o
|
||||
@@ -53,9 +68,8 @@
|
||||
UTIL (a new set of library functions to support some higher level
|
||||
functionality that is currently missing).
|
||||
Shared library support for VMS.
|
||||
Kerberos 5 authentication
|
||||
Kerberos 5 authentication (Heimdal)
|
||||
Constification
|
||||
OCSP
|
||||
|
||||
NEEDS PATCH
|
||||
|
||||
|
||||
70
TABLE
70
TABLE
@@ -1945,7 +1945,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -1995,7 +1995,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3375,6 +3375,56 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
|
||||
*** linux-x86_64
|
||||
$cc = gcc
|
||||
$cflags = -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id =
|
||||
$lflags = -ldl
|
||||
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL
|
||||
$bn_obj = asm/x86_64-gcc.o
|
||||
$des_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 = -m64
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
|
||||
*** linux64-sparcv9
|
||||
$cc = gcc
|
||||
$cflags = -m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
|
||||
$unistd =
|
||||
$thread_cflag = -D_REENTRANT
|
||||
$sys_id = ULTRASPARC
|
||||
$lflags = -ldl
|
||||
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
|
||||
$bn_obj =
|
||||
$des_obj =
|
||||
$bf_obj =
|
||||
$md5_obj = asm/md5-sparcv9.o
|
||||
$sha1_obj =
|
||||
$cast_obj =
|
||||
$rc4_obj =
|
||||
$rmd160_obj =
|
||||
$rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= linux-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag = -m64
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
|
||||
*** ncr-scde
|
||||
$cc = cc
|
||||
$cflags = -O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw
|
||||
@@ -3745,7 +3795,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3795,7 +3845,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3845,7 +3895,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3870,7 +3920,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3920,7 +3970,7 @@ $rc5_obj = asm/r586-sol.o
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag =
|
||||
$shared_ldflag = -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3970,7 +4020,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag = -m64
|
||||
$shared_ldflag = -m64 -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -3995,7 +4045,7 @@ $rc5_obj =
|
||||
$dso_scheme = dlfcn
|
||||
$shared_target= solaris-shared
|
||||
$shared_cflag = -fPIC
|
||||
$shared_ldflag = -m64
|
||||
$shared_ldflag = -m64 -shared
|
||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
|
||||
$ranlib =
|
||||
$arflags =
|
||||
@@ -4052,7 +4102,7 @@ $arflags =
|
||||
|
||||
*** ultrix-cc
|
||||
$cc = cc
|
||||
$cflags = -std1 -O -Olimit 1000 -DL_ENDIAN
|
||||
$cflags = -std1 -O -Olimit 2500 -DL_ENDIAN
|
||||
$unistd =
|
||||
$thread_cflag = (unknown)
|
||||
$sys_id =
|
||||
|
||||
@@ -99,17 +99,20 @@ install:
|
||||
@for i in $(EXE); \
|
||||
do \
|
||||
(echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
|
||||
done;
|
||||
@for i in $(SCRIPTS); \
|
||||
do \
|
||||
(echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
|
||||
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/misc/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/misc/$$i ); \
|
||||
done
|
||||
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR); \
|
||||
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
|
||||
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
|
||||
mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
@@ -148,7 +151,8 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
|
||||
fi
|
||||
-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; \
|
||||
LIBPATH="`pwd`"; LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; \
|
||||
if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
|
||||
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
|
||||
$(PERL) tools/c_rehash certs)
|
||||
|
||||
|
||||
@@ -615,7 +615,7 @@ int password_callback(char *buf, int bufsiz, int verify,
|
||||
|
||||
if (buff)
|
||||
{
|
||||
memset(buff,0,(unsigned int)bufsiz);
|
||||
OPENSSL_cleanse(buff,(unsigned int)bufsiz);
|
||||
OPENSSL_free(buff);
|
||||
}
|
||||
|
||||
@@ -625,13 +625,13 @@ int password_callback(char *buf, int bufsiz, int verify,
|
||||
{
|
||||
BIO_printf(bio_err, "User interface error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
memset(buf,0,(unsigned int)bufsiz);
|
||||
OPENSSL_cleanse(buf,(unsigned int)bufsiz);
|
||||
res = 0;
|
||||
}
|
||||
if (ok == -2)
|
||||
{
|
||||
BIO_printf(bio_err,"aborted!\n");
|
||||
memset(buf,0,(unsigned int)bufsiz);
|
||||
OPENSSL_cleanse(buf,(unsigned int)bufsiz);
|
||||
res = 0;
|
||||
}
|
||||
UI_free(ui);
|
||||
|
||||
@@ -332,6 +332,6 @@ end:
|
||||
if (osk != NULL) sk_free(osk);
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -706,7 +706,7 @@ bad:
|
||||
}
|
||||
pkey = load_key(bio_err, keyfile, keyform, 0, key, e,
|
||||
"CA private key");
|
||||
if (key) memset(key,0,strlen(key));
|
||||
if (key) OPENSSL_cleanse(key,strlen(key));
|
||||
if (pkey == NULL)
|
||||
{
|
||||
/* load_key() has already printed an appropriate message */
|
||||
@@ -1647,7 +1647,7 @@ err:
|
||||
NCONF_free(conf);
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static void lookup_fail(char *name, char *tag)
|
||||
|
||||
@@ -203,6 +203,6 @@ end:
|
||||
if (ssl != NULL) SSL_free(ssl);
|
||||
if (STDout != NULL) BIO_free_all(STDout);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ end:
|
||||
X509_STORE_free(store);
|
||||
}
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static X509_CRL *load_crl(char *infile, int format)
|
||||
|
||||
@@ -280,7 +280,7 @@ end:
|
||||
if (crl != NULL) X509_CRL_free(crl);
|
||||
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -356,7 +356,7 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf,0,BUFSIZE);
|
||||
OPENSSL_cleanse(buf,BUFSIZE);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (in != NULL) BIO_free(in);
|
||||
@@ -365,7 +365,7 @@ end:
|
||||
if(sigbuf) OPENSSL_free(sigbuf);
|
||||
if (bmd != NULL) BIO_free(bmd);
|
||||
apps_shutdown();
|
||||
EXIT(err);
|
||||
OPENSSL_EXIT(err);
|
||||
}
|
||||
|
||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
|
||||
@@ -333,6 +333,6 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -519,7 +519,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */
|
||||
|
||||
@@ -314,6 +314,6 @@ end:
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -372,7 +372,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dsa != NULL) DSA_free(dsa);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
|
||||
|
||||
@@ -481,9 +481,9 @@ bad:
|
||||
* bug picked up by
|
||||
* Larry J. Hughes Jr. <hughes@indiana.edu> */
|
||||
if (str == strbuf)
|
||||
memset(str,0,SIZE);
|
||||
OPENSSL_cleanse(str,SIZE);
|
||||
else
|
||||
memset(str,0,strlen(str));
|
||||
OPENSSL_cleanse(str,strlen(str));
|
||||
}
|
||||
if ((hiv != NULL) && !set_hex(hiv,iv,sizeof iv))
|
||||
{
|
||||
@@ -586,7 +586,7 @@ end:
|
||||
if (b64 != NULL) BIO_free(b64);
|
||||
if(pass) OPENSSL_free(pass);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
int set_hex(char *in, unsigned char *out, int size)
|
||||
|
||||
@@ -516,5 +516,5 @@ end:
|
||||
sk_pop_free(post_cmds, identity);
|
||||
if (bio_out != NULL) BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -122,5 +122,5 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK dh_cb(int p, int n, void *arg)
|
||||
|
||||
@@ -246,6 +246,6 @@ end:
|
||||
if (dsa != NULL) DSA_free(dsa);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -258,7 +258,7 @@ err:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
|
||||
|
||||
@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf (bio_err, "-in file input file\n");
|
||||
BIO_printf (bio_err, "-out file output file\n");
|
||||
BIO_printf (bio_err, "-toseq output NS Sequence file\n");
|
||||
EXIT(1);
|
||||
OPENSSL_EXIT(1);
|
||||
}
|
||||
|
||||
if (infile) {
|
||||
@@ -162,6 +162,6 @@ end:
|
||||
BIO_free_all(out);
|
||||
NETSCAPE_CERT_SEQUENCE_free(seq);
|
||||
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ end:
|
||||
SSL_CTX_free(ctx);
|
||||
}
|
||||
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
|
||||
@@ -358,7 +358,7 @@ end:
|
||||
BIO_free(bio_err);
|
||||
bio_err=NULL;
|
||||
}
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
#define LIST_STANDARD_COMMANDS "list-standard-commands"
|
||||
|
||||
@@ -292,7 +292,7 @@ err:
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -505,6 +505,6 @@ err:
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
fputs("Program not available.\n", stderr)
|
||||
EXIT(1);
|
||||
OPENSSL_EXIT(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -696,7 +696,7 @@ int MAIN(int argc, char **argv)
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
|
||||
|
||||
@@ -301,5 +301,5 @@ end:
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -213,5 +213,5 @@ err:
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ end:
|
||||
if (dsa_params != NULL) DSA_free(dsa_params);
|
||||
#endif
|
||||
apps_shutdown();
|
||||
EXIT(ex);
|
||||
OPENSSL_EXIT(ex);
|
||||
}
|
||||
|
||||
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
|
||||
|
||||
@@ -369,7 +369,7 @@ end:
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#else /* !OPENSSL_NO_RSA */
|
||||
|
||||
|
||||
@@ -908,16 +908,16 @@ end:
|
||||
if (con != NULL) SSL_free(con);
|
||||
if (con2 != NULL) SSL_free(con2);
|
||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||
if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
|
||||
if (mbuf != NULL) { memset(mbuf,0,BUFSIZZ); OPENSSL_free(mbuf); }
|
||||
if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||
if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); }
|
||||
if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); }
|
||||
if (bio_c_out != NULL)
|
||||
{
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -868,7 +868,7 @@ end:
|
||||
bio_s_out=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
|
||||
@@ -1184,7 +1184,7 @@ err:
|
||||
BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf,0,bufsize);
|
||||
OPENSSL_cleanse(buf,bufsize);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (ret >= 0)
|
||||
|
||||
@@ -642,7 +642,7 @@ end:
|
||||
tm_ctx=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
@@ -273,7 +273,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (x != NULL) SSL_SESSION_free(x);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static SSL_SESSION *load_sess_id(char *infile, int format)
|
||||
|
||||
@@ -1729,7 +1729,7 @@ end:
|
||||
DSA_free(dsa_key[i]);
|
||||
#endif
|
||||
apps_shutdown();
|
||||
EXIT(mret);
|
||||
OPENSSL_EXIT(mret);
|
||||
}
|
||||
|
||||
static void print_message(const char *s, long num, int length)
|
||||
|
||||
@@ -295,5 +295,5 @@ end:
|
||||
EVP_PKEY_free(pkey);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ end:
|
||||
sk_X509_pop_free(untrusted, X509_free);
|
||||
sk_X509_pop_free(trusted, X509_free);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
|
||||
|
||||
@@ -200,5 +200,5 @@ int MAIN(int argc, char **argv)
|
||||
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
|
||||
end:
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ end:
|
||||
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
||||
if (passin) OPENSSL_free(passin);
|
||||
apps_shutdown();
|
||||
EXIT(ret);
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
|
||||
|
||||
14
config
14
config
@@ -547,12 +547,13 @@ EOF
|
||||
ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
|
||||
i386-apple-darwin*) OUT="darwin-i386-cc" ;;
|
||||
sparc64-*-linux2)
|
||||
#Before we can uncomment following lines we have to wait at least
|
||||
#till 64-bit glibc for SPARC is operational:-(
|
||||
#echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||
#echo " invoke './Configure linux64-sparcv9' *manually*."
|
||||
#echo " Type return if you want to continue, Ctrl-C to abort."
|
||||
#read waste < /dev/tty
|
||||
echo "WARNING! If *know* that your GNU C supports 64-bit/V9 ABI"
|
||||
echo " and wish to build 64-bit library, then you have to"
|
||||
echo " invoke './Configure linux64-sparcv9' *manually*."
|
||||
if [ "$TEST" = "false" ]; then
|
||||
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||
fi
|
||||
OUT="linux-sparcv9" ;;
|
||||
sparc-*-linux2)
|
||||
KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`
|
||||
@@ -585,6 +586,7 @@ EOF
|
||||
arm*-*-linux2) OUT="linux-elf-arm" ;;
|
||||
s390-*-linux2) OUT="linux-s390" ;;
|
||||
s390x-*-linux?) OUT="linux-s390x" ;;
|
||||
x86_64-*-linux?) OUT="linux-x86_64" ;;
|
||||
*-*-linux2) OUT="linux-elf"
|
||||
if [ "$GCCVER" -gt 28 ]; then
|
||||
if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
|
||||
|
||||
@@ -36,8 +36,8 @@ GENERAL=Makefile README crypto-lib.com install.com
|
||||
|
||||
LIB= $(TOP)/libcrypto.a
|
||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
|
||||
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
|
||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
|
||||
LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
|
||||
LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
@@ -193,6 +193,10 @@ mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
mem.o: ../include/openssl/symhacks.h cryptlib.h mem.c
|
||||
mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
mem_clr.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
mem_clr.o: ../include/openssl/symhacks.h mem_clr.c
|
||||
mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
|
||||
@@ -149,7 +149,12 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
ASN1_CTX c;
|
||||
int 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;
|
||||
|
||||
b=BUF_MEM_new();
|
||||
@@ -226,13 +231,18 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
i=BIO_read(in,&(b->data[len]),want);
|
||||
if (i <= 0)
|
||||
while (want > 0)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,ASN1_R_NOT_ENOUGH_DATA);
|
||||
goto err;
|
||||
i=BIO_read(in,&(b->data[len]),want);
|
||||
if (i <= 0)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,
|
||||
ASN1_R_NOT_ENOUGH_DATA);
|
||||
goto err;
|
||||
}
|
||||
len+=i;
|
||||
want -= i;
|
||||
}
|
||||
len+=i;
|
||||
}
|
||||
off+=(int)c.slen;
|
||||
if (eos <= 0)
|
||||
|
||||
@@ -204,9 +204,9 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
err:
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
if (buf_in != NULL)
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
{ OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
if (buf_out != NULL)
|
||||
{ memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
|
||||
{ OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
|
||||
return(outl);
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
err:
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
if (buf_in != NULL)
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
{ OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
if (buf_out != NULL)
|
||||
{ memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
|
||||
{ OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
|
||||
return(outl);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
int ASN1_TYPE_get(ASN1_TYPE *a)
|
||||
{
|
||||
if (a->value.ptr != NULL)
|
||||
if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL))
|
||||
return(a->type);
|
||||
else
|
||||
return(0);
|
||||
|
||||
@@ -103,7 +103,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
||||
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||
|
||||
memset(buf_in,0,(unsigned int)inl);
|
||||
OPENSSL_cleanse(buf_in,(unsigned int)inl);
|
||||
OPENSSL_free(buf_in);
|
||||
|
||||
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
|
||||
@@ -153,7 +153,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
||||
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||
|
||||
memset(buf_in,0,(unsigned int)inl);
|
||||
OPENSSL_cleanse(buf_in,(unsigned int)inl);
|
||||
OPENSSL_free(buf_in);
|
||||
|
||||
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
|
||||
|
||||
@@ -187,7 +187,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
|
||||
i2d_NETSCAPE_PKEY(pkey,&zz);
|
||||
|
||||
/* Wipe the private key encoding */
|
||||
memset(pkey->private_key->data, 0, rsalen);
|
||||
OPENSSL_cleanse(pkey->private_key->data, rsalen);
|
||||
|
||||
if (cb == NULL)
|
||||
cb=EVP_read_pw_string;
|
||||
@@ -206,7 +206,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
|
||||
}
|
||||
|
||||
EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL);
|
||||
memset(buf,0,256);
|
||||
OPENSSL_cleanse(buf,256);
|
||||
|
||||
/* Encrypt private key in place */
|
||||
zz = enckey->enckey->digest->data;
|
||||
@@ -294,7 +294,7 @@ static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
|
||||
}
|
||||
|
||||
EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL);
|
||||
memset(buf,0,256);
|
||||
OPENSSL_cleanse(buf,256);
|
||||
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
EVP_DecryptInit_ex(&ctx,EVP_rc4(),NULL, key,NULL);
|
||||
|
||||
@@ -68,8 +68,8 @@ static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
if(operation == ASN1_OP_FREE_PRE) {
|
||||
PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval;
|
||||
if (key->pkey->value.octet_string)
|
||||
memset(key->pkey->value.octet_string->data,
|
||||
0, key->pkey->value.octet_string->length);
|
||||
OPENSSL_cleanse(key->pkey->value.octet_string->data,
|
||||
key->pkey->value.octet_string->length);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#ifdef OPENSSL_NO_BF
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -275,7 +277,7 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
ret=test();
|
||||
|
||||
exit(ret);
|
||||
EXIT(ret);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,8 @@ asm/ia64-cpp.o: asm/ia64.S
|
||||
$(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \
|
||||
rm -f /tmp/ia64.$$$$.s
|
||||
|
||||
asm/x86_64-gcc.o: asm/x86_64-gcc.c
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.title vax_bn_mul_add_word unsigned multiply & add, 32*32+32+32=>64
|
||||
.title vax_bn_mul_add_words unsigned multiply & add, 32*32+32+32=>64
|
||||
;
|
||||
; w.j.m. 15-jan-1999
|
||||
;
|
||||
@@ -59,7 +59,7 @@ w=16 ;(AP) w by value (input)
|
||||
movl r6,r0 ; return c
|
||||
ret
|
||||
|
||||
.title vax_bn_mul_word unsigned multiply & add, 32*32+32=>64
|
||||
.title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64
|
||||
;
|
||||
; w.j.m. 15-jan-1999
|
||||
;
|
||||
@@ -172,146 +172,148 @@ n=12 ;(AP) n by value (input)
|
||||
; }
|
||||
;
|
||||
; Using EDIV would be very easy, if it didn't do signed calculations.
|
||||
; Therefore, som extra things have to happen around it. The way to
|
||||
; handle that is to shift all operands right one step (basically dividing
|
||||
; them by 2) and handle the different cases depending on what the lowest
|
||||
; bit of each operand was.
|
||||
; Any time, any of the input numbers are signed, there are problems,
|
||||
; usually with integer overflow, at which point it returns useless
|
||||
; data (the quotient gets the value of l, and the remainder becomes 0).
|
||||
;
|
||||
; To start with, let's define the following:
|
||||
; If it was just for the dividend, it would be very easy, just divide
|
||||
; it by 2 (unsigned), do the division, multiply the resulting quotient
|
||||
; and remainder by 2, add the bit that was dropped when dividing by 2
|
||||
; to the remainder, and do some adjustment so the remainder doesn't
|
||||
; end up larger than the divisor. This method works as long as the
|
||||
; divisor is positive, so we'll keep that (with a small adjustment)
|
||||
; as the main method.
|
||||
; For some cases when the divisor is negative (from EDIV's point of
|
||||
; view, i.e. when the highest bit is set), dividing the dividend by
|
||||
; 2 isn't enough, it needs to be divided by 4. Furthermore, the
|
||||
; divisor needs to be divided by 2 (unsigned) as well, to avoid more
|
||||
; problems with the sign. In this case, a little extra fiddling with
|
||||
; the remainder is required.
|
||||
;
|
||||
; a' = l & 1
|
||||
; a2 = <h,l> >> 1 # UNSIGNED shift!
|
||||
; b' = d & 1
|
||||
; b2 = d >> 1 # UNSIGNED shift!
|
||||
; So, the simplest way to handle this is always to divide the dividend
|
||||
; by 4, and to divide the divisor by 2 if it's highest bit is set.
|
||||
; After EDIV has been used, the quotient gets multiplied by 4 if the
|
||||
; original divisor was positive, otherwise 2. The remainder, oddly
|
||||
; enough, is *always* multiplied by 4.
|
||||
;
|
||||
; Now, use EDIV to calculate a quotient and a remainder:
|
||||
; The routine ends with comparing the resulting remainder with the
|
||||
; original divisor and if the remainder is larger, subtract the
|
||||
; original divisor from it, and increase the quotient by 1. This is
|
||||
; done until the remainder is smaller than the divisor.
|
||||
;
|
||||
; q'' = a2/b2
|
||||
; r'' = a2 - q''*b2
|
||||
; The complete algorithm looks like this:
|
||||
;
|
||||
; If b' is 0, the quotient is already correct, we just need to adjust the
|
||||
; remainder:
|
||||
; d' = d
|
||||
; l' = l & 3
|
||||
; [h,l] = [h,l] >> 2
|
||||
; [q,r] = floor([h,l] / d) # This is the EDIV operation
|
||||
; if (q < 0) q = -q # I doubt this is necessary any more
|
||||
;
|
||||
; if (b' == 0)
|
||||
; r' = r >> 30
|
||||
; if (d' >= 0) q = q << 1
|
||||
; q = q << 1
|
||||
; r = (r << 2) + l'
|
||||
;
|
||||
; if (d' < 0)
|
||||
; {
|
||||
; r = 2*r'' + a'
|
||||
; q = q''
|
||||
; }
|
||||
;
|
||||
; If b' is 1, we need to do other adjustements. The first thought is the
|
||||
; following (note that r' will not always have the right value, but an
|
||||
; adjustement follows further down):
|
||||
;
|
||||
; if (b' == 1)
|
||||
; {
|
||||
; q' = q''
|
||||
; r' = a - q'*b
|
||||
;
|
||||
; However, one can note the folowing relationship:
|
||||
;
|
||||
; r'' = a2 - q''*b2
|
||||
; => 2*r'' = 2*a2 - 2*q''*b2
|
||||
; = { a = 2*a2 + a', b = 2*b2 + b' = 2*b2 + 1,
|
||||
; q' = q'' }
|
||||
; = a - a' - q'*(b - 1)
|
||||
; = a - q'*b - a' + q'
|
||||
; = r' - a' + q'
|
||||
; => r' = 2*r'' - q' + a'
|
||||
;
|
||||
; This enables us to use r'' instead of discarding and calculating another
|
||||
; modulo:
|
||||
;
|
||||
; if (b' == 1)
|
||||
; {
|
||||
; q' = q''
|
||||
; r' = (r'' << 1) - q' + a'
|
||||
;
|
||||
; Now, all we have to do is adjust r', because it might be < 0:
|
||||
;
|
||||
; while (r' < 0)
|
||||
; [r',r] = [r',r] - q
|
||||
; while ([r',r] < 0)
|
||||
; {
|
||||
; r' = r' + b
|
||||
; q' = q' - 1
|
||||
; [r',r] = [r',r] + d
|
||||
; q = q - 1
|
||||
; }
|
||||
; }
|
||||
;
|
||||
; return q'
|
||||
; while ([r',r] >= d)
|
||||
; {
|
||||
; [r',r] = [r',r] - d
|
||||
; q = q + 1
|
||||
; }
|
||||
;
|
||||
; return q
|
||||
|
||||
h=4 ;(AP) h by value (input)
|
||||
l=8 ;(AP) l by value (input)
|
||||
d=12 ;(AP) d by value (input)
|
||||
|
||||
;aprim=r5
|
||||
;a2=r6
|
||||
;a20=r6
|
||||
;a21=r7
|
||||
;bprim=r8
|
||||
;b2=r9
|
||||
;qprim=r10 ; initially used as q''
|
||||
;rprim=r11 ; initially used as r''
|
||||
;lprim=r5
|
||||
;rprim=r6
|
||||
;dprim=r7
|
||||
|
||||
|
||||
.psect code,nowrt
|
||||
|
||||
.entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
|
||||
.entry bn_div_words,^m<r2,r3,r4,r5,r6,r7>
|
||||
movl l(ap),r2
|
||||
movl h(ap),r3
|
||||
movl d(ap),r4
|
||||
|
||||
movl #0,r5
|
||||
movl #0,r8
|
||||
movl #0,r0
|
||||
; movl #0,r1
|
||||
bicl3 #^XFFFFFFFC,r2,r5 ; l' = l & 3
|
||||
bicl3 #^X00000003,r2,r2
|
||||
|
||||
rotl #-1,r2,r6 ; a20 = l >> 1 (almost)
|
||||
rotl #-1,r3,r7 ; a21 = h >> 1 (almost)
|
||||
rotl #-1,r4,r9 ; b2 = d >> 1 (almost)
|
||||
bicl3 #^XFFFFFFFC,r3,r6
|
||||
bicl3 #^X00000003,r3,r3
|
||||
|
||||
addl r6,r2
|
||||
rotl #-2,r2,r2 ; l = l >> 2
|
||||
rotl #-2,r3,r3 ; h = h >> 2
|
||||
|
||||
movl #0,r6
|
||||
movl r4,r7 ; d' = d
|
||||
|
||||
tstl r6
|
||||
bgeq 1$
|
||||
xorl2 #^X80000000,r6 ; fixup a20 so highest bit is 0
|
||||
incl r5 ; a' = 1
|
||||
1$:
|
||||
tstl r7
|
||||
bgeq 2$
|
||||
xorl2 #^X80000000,r6 ; fixup a20 so highest bit is 1,
|
||||
; since that's what was lowest in a21
|
||||
xorl2 #^X80000000,r7 ; fixup a21 so highest bit is 1
|
||||
2$:
|
||||
tstl r9
|
||||
tstl r4
|
||||
beql 666$ ; Uh-oh, the divisor is 0...
|
||||
bgtr 3$
|
||||
xorl2 #^X80000000,r9 ; fixup b2 so highest bit is 0
|
||||
incl r8 ; b' = 1
|
||||
3$:
|
||||
tstl r9
|
||||
bneq 4$ ; if b2 is 0, we know that b' is 1
|
||||
tstl r3
|
||||
bneq 666$ ; if higher half isn't 0, we overflow
|
||||
movl r2,r10 ; otherwise, we have our result
|
||||
brb 42$ ; This is a success, really.
|
||||
4$:
|
||||
ediv r9,r6,r10,r11
|
||||
bgtr 1$
|
||||
rotl #-1,r4,r4 ; If d is negative, shift it right.
|
||||
bicl2 #^X80000000,r4 ; Since d is then a large number, the
|
||||
; lowest bit is insignificant
|
||||
; (contradict that, and I'll fix the problem!)
|
||||
1$:
|
||||
ediv r4,r2,r2,r3 ; Do the actual division
|
||||
|
||||
tstl r2
|
||||
bgeq 3$
|
||||
mnegl r2,r2 ; if q < 0, negate it
|
||||
3$:
|
||||
tstl r7
|
||||
blss 4$
|
||||
ashl #1,r2,r2 ; q = q << 1
|
||||
4$:
|
||||
ashl #1,r2,r2 ; q = q << 1
|
||||
rotl #2,r3,r3 ; r = r << 2
|
||||
bicl3 #^XFFFFFFFC,r3,r6 ; r' gets the high bits from r
|
||||
bicl3 #^X00000003,r3,r3
|
||||
addl r5,r3 ; r = r + l'
|
||||
|
||||
tstl r7
|
||||
bgeq 5$
|
||||
bitl #1,r7
|
||||
beql 5$ ; if d < 0 && d & 1
|
||||
subl r2,r3 ; [r',r] = [r',r] - q
|
||||
sbwc #0,r6
|
||||
45$:
|
||||
bgeq 5$ ; while r < 0
|
||||
decl r2 ; q = q - 1
|
||||
addl r7,r3 ; [r',r] = [r',r] + d
|
||||
adwc #0,r6
|
||||
brb 45$
|
||||
|
||||
tstl r8
|
||||
bneq 5$ ; If b' != 0, go to the other part
|
||||
; addl3 r11,r11,r1
|
||||
; addl2 r5,r1
|
||||
brb 42$
|
||||
5$:
|
||||
ashl #1,r11,r11
|
||||
subl2 r10,r11
|
||||
addl2 r5,r11
|
||||
bgeq 7$
|
||||
tstl r6
|
||||
bneq 6$
|
||||
cmpl r3,r7
|
||||
blssu 42$ ; while [r',r] >= d'
|
||||
6$:
|
||||
decl r10
|
||||
addl2 r4,r11
|
||||
blss 6$
|
||||
7$:
|
||||
; movl r11,r1
|
||||
subl r7,r3 ; [r',r] = [r',r] - d
|
||||
sbwc #0,r6
|
||||
incl r2 ; q = q + 1
|
||||
brb 5$
|
||||
42$:
|
||||
movl r10,r0
|
||||
; movl r3,r1
|
||||
movl r2,r0
|
||||
ret
|
||||
666$:
|
||||
movl #^XFFFFFFFF,r0
|
||||
ret
|
||||
|
||||
.title vax_bn_add_words unsigned add of two arrays
|
||||
|
||||
575
crypto/bn/asm/x86_64-gcc.c
Normal file
575
crypto/bn/asm/x86_64-gcc.c
Normal file
@@ -0,0 +1,575 @@
|
||||
/*
|
||||
* x86_64 BIGNUM accelerator version 0.1, December 2002.
|
||||
*
|
||||
* Implemented by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
|
||||
* project.
|
||||
*
|
||||
* Rights for redistribution and usage in source and binary forms are
|
||||
* granted according to the OpenSSL license. Warranty of any kind is
|
||||
* disclaimed.
|
||||
*
|
||||
* Q. Version 0.1? It doesn't sound like Andy, he used to assign real
|
||||
* versions, like 1.0...
|
||||
* A. Well, that's because this code is basically a quick-n-dirty
|
||||
* proof-of-concept hack. As you can see it's implemented with
|
||||
* inline assembler, which means that you're bound to GCC and that
|
||||
* there must be a room for fine-tuning.
|
||||
*
|
||||
* Q. Why inline assembler?
|
||||
* A. x86_64 features own ABI I'm not familiar with. Which is why
|
||||
* I decided to let the compiler take care of subroutine
|
||||
* prologue/epilogue as well as register allocation.
|
||||
*
|
||||
* Q. How much faster does it get?
|
||||
* A. Unfortunately people sitting on x86_64 hardware are prohibited
|
||||
* to disclose the performance numbers, so they (SuSE labs to be
|
||||
* specific) wouldn't tell me. However! Very similar coding technique
|
||||
* (reaching out for 128-bit result from 64x64-bit multiplication)
|
||||
* results in >3 times performance improvement on MIPS and I see no
|
||||
* reason why gain on x86_64 would be so much different:-)
|
||||
*/
|
||||
|
||||
#define BN_ULONG unsigned long
|
||||
|
||||
/*
|
||||
* "m"(a), "+m"(r) is the way to favor DirectPath <20>-code;
|
||||
* "g"(0) let the compiler to decide where does it
|
||||
* want to keep the value of zero;
|
||||
*/
|
||||
#define mul_add(r,a,word,carry) do { \
|
||||
register BN_ULONG high,low; \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(low),"=d"(high) \
|
||||
: "a"(word),"m"(a) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(carry),"+d"(high)\
|
||||
: "a"(low),"g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+m"(r),"+d"(high) \
|
||||
: "r"(carry),"g"(0) \
|
||||
: "cc"); \
|
||||
carry=high; \
|
||||
} while (0)
|
||||
|
||||
#define mul(r,a,word,carry) do { \
|
||||
register BN_ULONG high,low; \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(low),"=d"(high) \
|
||||
: "a"(word),"g"(a) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(carry),"+d"(high)\
|
||||
: "a"(low),"g"(0) \
|
||||
: "cc"); \
|
||||
(r)=carry, carry=high; \
|
||||
} while (0)
|
||||
|
||||
#define sqr(r0,r1,a) \
|
||||
asm ("mulq %2" \
|
||||
: "=a"(r0),"=d"(r1) \
|
||||
: "a"(a) \
|
||||
: "cc");
|
||||
|
||||
BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG c1=0;
|
||||
|
||||
if (num <= 0) return(c1);
|
||||
|
||||
while (num&~3)
|
||||
{
|
||||
mul_add(rp[0],ap[0],w,c1);
|
||||
mul_add(rp[1],ap[1],w,c1);
|
||||
mul_add(rp[2],ap[2],w,c1);
|
||||
mul_add(rp[3],ap[3],w,c1);
|
||||
ap+=4; rp+=4; num-=4;
|
||||
}
|
||||
if (num)
|
||||
{
|
||||
mul_add(rp[0],ap[0],w,c1); if (--num==0) return c1;
|
||||
mul_add(rp[1],ap[1],w,c1); if (--num==0) return c1;
|
||||
mul_add(rp[2],ap[2],w,c1); return c1;
|
||||
}
|
||||
|
||||
return(c1);
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG c1=0;
|
||||
|
||||
if (num <= 0) return(c1);
|
||||
|
||||
while (num&~3)
|
||||
{
|
||||
mul(rp[0],ap[0],w,c1);
|
||||
mul(rp[1],ap[1],w,c1);
|
||||
mul(rp[2],ap[2],w,c1);
|
||||
mul(rp[3],ap[3],w,c1);
|
||||
ap+=4; rp+=4; num-=4;
|
||||
}
|
||||
if (num)
|
||||
{
|
||||
mul(rp[0],ap[0],w,c1); if (--num == 0) return c1;
|
||||
mul(rp[1],ap[1],w,c1); if (--num == 0) return c1;
|
||||
mul(rp[2],ap[2],w,c1);
|
||||
}
|
||||
return(c1);
|
||||
}
|
||||
|
||||
void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
|
||||
{
|
||||
if (n <= 0) return;
|
||||
|
||||
while (n&~3)
|
||||
{
|
||||
sqr(r[0],r[1],a[0]);
|
||||
sqr(r[2],r[3],a[1]);
|
||||
sqr(r[4],r[5],a[2]);
|
||||
sqr(r[6],r[7],a[3]);
|
||||
a+=4; r+=8; n-=4;
|
||||
}
|
||||
if (n)
|
||||
{
|
||||
sqr(r[0],r[1],a[0]); if (--n == 0) return;
|
||||
sqr(r[2],r[3],a[1]); if (--n == 0) return;
|
||||
sqr(r[4],r[5],a[2]);
|
||||
}
|
||||
}
|
||||
|
||||
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
|
||||
{ BN_ULONG ret,waste;
|
||||
|
||||
asm ("divq %3"
|
||||
: "=a"(ret),"=d"(waste)
|
||||
: "a"(l),"d"(h),"g"(d)
|
||||
: "cc");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
|
||||
{ BN_ULONG ret,i;
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
asm (
|
||||
" subq %2,%2 \n"
|
||||
".align 16 \n"
|
||||
"1: movq (%4,%2,8),%0 \n"
|
||||
" adcq (%5,%2,8),%0 \n"
|
||||
" movq %0,(%3,%2,8) \n"
|
||||
" leaq 1(%2),%2 \n"
|
||||
" loop 1b \n"
|
||||
" sbbq %0,%0 \n"
|
||||
: "+a"(ret),"+c"(n),"+r"(i)
|
||||
: "r"(rp),"r"(ap),"r"(bp)
|
||||
: "cc"
|
||||
);
|
||||
|
||||
return ret&1;
|
||||
}
|
||||
|
||||
#ifndef SIMICS
|
||||
BN_ULONG bn_sub_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
|
||||
{ BN_ULONG ret,i;
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
asm (
|
||||
" subq %2,%2 \n"
|
||||
".align 16 \n"
|
||||
"1: movq (%4,%2,8),%0 \n"
|
||||
" sbbq (%5,%2,8),%0 \n"
|
||||
" movq %0,(%3,%2,8) \n"
|
||||
" leaq 1(%2),%2 \n"
|
||||
" loop 1b \n"
|
||||
" sbbq %0,%0 \n"
|
||||
: "+a"(ret),"+c"(n),"+r"(i)
|
||||
: "r"(rp),"r"(ap),"r"(bp)
|
||||
: "cc"
|
||||
);
|
||||
|
||||
return ret&1;
|
||||
}
|
||||
#else
|
||||
/* Simics 1.4<7 has buggy sbbq:-( */
|
||||
#define BN_MASK2 0xffffffffffffffffL
|
||||
BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
BN_ULONG t1,t2;
|
||||
int c=0;
|
||||
|
||||
if (n <= 0) return((BN_ULONG)0);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
t1=a[0]; t2=b[0];
|
||||
r[0]=(t1-t2-c)&BN_MASK2;
|
||||
if (t1 != t2) c=(t1 < t2);
|
||||
if (--n <= 0) break;
|
||||
|
||||
t1=a[1]; t2=b[1];
|
||||
r[1]=(t1-t2-c)&BN_MASK2;
|
||||
if (t1 != t2) c=(t1 < t2);
|
||||
if (--n <= 0) break;
|
||||
|
||||
t1=a[2]; t2=b[2];
|
||||
r[2]=(t1-t2-c)&BN_MASK2;
|
||||
if (t1 != t2) c=(t1 < t2);
|
||||
if (--n <= 0) break;
|
||||
|
||||
t1=a[3]; t2=b[3];
|
||||
r[3]=(t1-t2-c)&BN_MASK2;
|
||||
if (t1 != t2) c=(t1 < t2);
|
||||
if (--n <= 0) break;
|
||||
|
||||
a+=4;
|
||||
b+=4;
|
||||
r+=4;
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */
|
||||
/* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */
|
||||
/* sqr_add_c(a,i,c0,c1,c2) -- c+=a[i]^2 for three word number c=(c2,c1,c0) */
|
||||
/* sqr_add_c2(a,i,c0,c1,c2) -- c+=2*a[i]*a[j] for three word number c=(c2,c1,c0) */
|
||||
|
||||
#if 0
|
||||
/* original macros are kept for reference purposes */
|
||||
#define mul_add_c(a,b,c0,c1,c2) { \
|
||||
BN_ULONG ta=(a),tb=(b); \
|
||||
t1 = ta * tb; \
|
||||
t2 = BN_UMULT_HIGH(ta,tb); \
|
||||
c0 += t1; t2 += (c0<t1)?1:0; \
|
||||
c1 += t2; c2 += (c1<t2)?1:0; \
|
||||
}
|
||||
|
||||
#define mul_add_c2(a,b,c0,c1,c2) { \
|
||||
BN_ULONG ta=(a),tb=(b),t0; \
|
||||
t1 = BN_UMULT_HIGH(ta,tb); \
|
||||
t0 = ta * tb; \
|
||||
t2 = t1+t1; c2 += (t2<t1)?1:0; \
|
||||
t1 = t0+t0; t2 += (t1<t0)?1:0; \
|
||||
c0 += t1; t2 += (c0<t1)?1:0; \
|
||||
c1 += t2; c2 += (c1<t2)?1:0; \
|
||||
}
|
||||
#else
|
||||
#define mul_add_c(a,b,c0,c1,c2) do { \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(t1),"=d"(t2) \
|
||||
: "a"(a),"m"(b) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c0),"+d"(t2) \
|
||||
: "a"(t1),"g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c1),"+r"(c2) \
|
||||
: "d"(t2),"g"(0) \
|
||||
: "cc"); \
|
||||
} while (0)
|
||||
|
||||
#define sqr_add_c(a,i,c0,c1,c2) do { \
|
||||
asm ("mulq %2" \
|
||||
: "=a"(t1),"=d"(t2) \
|
||||
: "a"(a[i]) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c0),"+d"(t2) \
|
||||
: "a"(t1),"g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c1),"+r"(c2) \
|
||||
: "d"(t2),"g"(0) \
|
||||
: "cc"); \
|
||||
} while (0)
|
||||
|
||||
#define mul_add_c2(a,b,c0,c1,c2) do { \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(t1),"=d"(t2) \
|
||||
: "a"(a),"m"(b) \
|
||||
: "cc"); \
|
||||
asm ("addq %0,%0; adcq %2,%1" \
|
||||
: "+d"(t2),"+r"(c2) \
|
||||
: "g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %0,%0; adcq %2,%1" \
|
||||
: "+a"(t1),"+d"(t2) \
|
||||
: "g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c0),"+d"(t2) \
|
||||
: "a"(t1),"g"(0) \
|
||||
: "cc"); \
|
||||
asm ("addq %2,%0; adcq %3,%1" \
|
||||
: "+r"(c1),"+r"(c2) \
|
||||
: "d"(t2),"g"(0) \
|
||||
: "cc"); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define sqr_add_c2(a,i,j,c0,c1,c2) \
|
||||
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
|
||||
|
||||
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
BN_ULONG bl,bh;
|
||||
BN_ULONG t1,t2;
|
||||
BN_ULONG c1,c2,c3;
|
||||
|
||||
c1=0;
|
||||
c2=0;
|
||||
c3=0;
|
||||
mul_add_c(a[0],b[0],c1,c2,c3);
|
||||
r[0]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[0],b[1],c2,c3,c1);
|
||||
mul_add_c(a[1],b[0],c2,c3,c1);
|
||||
r[1]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[2],b[0],c3,c1,c2);
|
||||
mul_add_c(a[1],b[1],c3,c1,c2);
|
||||
mul_add_c(a[0],b[2],c3,c1,c2);
|
||||
r[2]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[0],b[3],c1,c2,c3);
|
||||
mul_add_c(a[1],b[2],c1,c2,c3);
|
||||
mul_add_c(a[2],b[1],c1,c2,c3);
|
||||
mul_add_c(a[3],b[0],c1,c2,c3);
|
||||
r[3]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[4],b[0],c2,c3,c1);
|
||||
mul_add_c(a[3],b[1],c2,c3,c1);
|
||||
mul_add_c(a[2],b[2],c2,c3,c1);
|
||||
mul_add_c(a[1],b[3],c2,c3,c1);
|
||||
mul_add_c(a[0],b[4],c2,c3,c1);
|
||||
r[4]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[0],b[5],c3,c1,c2);
|
||||
mul_add_c(a[1],b[4],c3,c1,c2);
|
||||
mul_add_c(a[2],b[3],c3,c1,c2);
|
||||
mul_add_c(a[3],b[2],c3,c1,c2);
|
||||
mul_add_c(a[4],b[1],c3,c1,c2);
|
||||
mul_add_c(a[5],b[0],c3,c1,c2);
|
||||
r[5]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[6],b[0],c1,c2,c3);
|
||||
mul_add_c(a[5],b[1],c1,c2,c3);
|
||||
mul_add_c(a[4],b[2],c1,c2,c3);
|
||||
mul_add_c(a[3],b[3],c1,c2,c3);
|
||||
mul_add_c(a[2],b[4],c1,c2,c3);
|
||||
mul_add_c(a[1],b[5],c1,c2,c3);
|
||||
mul_add_c(a[0],b[6],c1,c2,c3);
|
||||
r[6]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[0],b[7],c2,c3,c1);
|
||||
mul_add_c(a[1],b[6],c2,c3,c1);
|
||||
mul_add_c(a[2],b[5],c2,c3,c1);
|
||||
mul_add_c(a[3],b[4],c2,c3,c1);
|
||||
mul_add_c(a[4],b[3],c2,c3,c1);
|
||||
mul_add_c(a[5],b[2],c2,c3,c1);
|
||||
mul_add_c(a[6],b[1],c2,c3,c1);
|
||||
mul_add_c(a[7],b[0],c2,c3,c1);
|
||||
r[7]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[7],b[1],c3,c1,c2);
|
||||
mul_add_c(a[6],b[2],c3,c1,c2);
|
||||
mul_add_c(a[5],b[3],c3,c1,c2);
|
||||
mul_add_c(a[4],b[4],c3,c1,c2);
|
||||
mul_add_c(a[3],b[5],c3,c1,c2);
|
||||
mul_add_c(a[2],b[6],c3,c1,c2);
|
||||
mul_add_c(a[1],b[7],c3,c1,c2);
|
||||
r[8]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[2],b[7],c1,c2,c3);
|
||||
mul_add_c(a[3],b[6],c1,c2,c3);
|
||||
mul_add_c(a[4],b[5],c1,c2,c3);
|
||||
mul_add_c(a[5],b[4],c1,c2,c3);
|
||||
mul_add_c(a[6],b[3],c1,c2,c3);
|
||||
mul_add_c(a[7],b[2],c1,c2,c3);
|
||||
r[9]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[7],b[3],c2,c3,c1);
|
||||
mul_add_c(a[6],b[4],c2,c3,c1);
|
||||
mul_add_c(a[5],b[5],c2,c3,c1);
|
||||
mul_add_c(a[4],b[6],c2,c3,c1);
|
||||
mul_add_c(a[3],b[7],c2,c3,c1);
|
||||
r[10]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[4],b[7],c3,c1,c2);
|
||||
mul_add_c(a[5],b[6],c3,c1,c2);
|
||||
mul_add_c(a[6],b[5],c3,c1,c2);
|
||||
mul_add_c(a[7],b[4],c3,c1,c2);
|
||||
r[11]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[7],b[5],c1,c2,c3);
|
||||
mul_add_c(a[6],b[6],c1,c2,c3);
|
||||
mul_add_c(a[5],b[7],c1,c2,c3);
|
||||
r[12]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[6],b[7],c2,c3,c1);
|
||||
mul_add_c(a[7],b[6],c2,c3,c1);
|
||||
r[13]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[7],b[7],c3,c1,c2);
|
||||
r[14]=c3;
|
||||
r[15]=c1;
|
||||
}
|
||||
|
||||
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
BN_ULONG bl,bh;
|
||||
BN_ULONG t1,t2;
|
||||
BN_ULONG c1,c2,c3;
|
||||
|
||||
c1=0;
|
||||
c2=0;
|
||||
c3=0;
|
||||
mul_add_c(a[0],b[0],c1,c2,c3);
|
||||
r[0]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[0],b[1],c2,c3,c1);
|
||||
mul_add_c(a[1],b[0],c2,c3,c1);
|
||||
r[1]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[2],b[0],c3,c1,c2);
|
||||
mul_add_c(a[1],b[1],c3,c1,c2);
|
||||
mul_add_c(a[0],b[2],c3,c1,c2);
|
||||
r[2]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[0],b[3],c1,c2,c3);
|
||||
mul_add_c(a[1],b[2],c1,c2,c3);
|
||||
mul_add_c(a[2],b[1],c1,c2,c3);
|
||||
mul_add_c(a[3],b[0],c1,c2,c3);
|
||||
r[3]=c1;
|
||||
c1=0;
|
||||
mul_add_c(a[3],b[1],c2,c3,c1);
|
||||
mul_add_c(a[2],b[2],c2,c3,c1);
|
||||
mul_add_c(a[1],b[3],c2,c3,c1);
|
||||
r[4]=c2;
|
||||
c2=0;
|
||||
mul_add_c(a[2],b[3],c3,c1,c2);
|
||||
mul_add_c(a[3],b[2],c3,c1,c2);
|
||||
r[5]=c3;
|
||||
c3=0;
|
||||
mul_add_c(a[3],b[3],c1,c2,c3);
|
||||
r[6]=c1;
|
||||
r[7]=c2;
|
||||
}
|
||||
|
||||
void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
BN_ULONG bl,bh;
|
||||
BN_ULONG t1,t2;
|
||||
BN_ULONG c1,c2,c3;
|
||||
|
||||
c1=0;
|
||||
c2=0;
|
||||
c3=0;
|
||||
sqr_add_c(a,0,c1,c2,c3);
|
||||
r[0]=c1;
|
||||
c1=0;
|
||||
sqr_add_c2(a,1,0,c2,c3,c1);
|
||||
r[1]=c2;
|
||||
c2=0;
|
||||
sqr_add_c(a,1,c3,c1,c2);
|
||||
sqr_add_c2(a,2,0,c3,c1,c2);
|
||||
r[2]=c3;
|
||||
c3=0;
|
||||
sqr_add_c2(a,3,0,c1,c2,c3);
|
||||
sqr_add_c2(a,2,1,c1,c2,c3);
|
||||
r[3]=c1;
|
||||
c1=0;
|
||||
sqr_add_c(a,2,c2,c3,c1);
|
||||
sqr_add_c2(a,3,1,c2,c3,c1);
|
||||
sqr_add_c2(a,4,0,c2,c3,c1);
|
||||
r[4]=c2;
|
||||
c2=0;
|
||||
sqr_add_c2(a,5,0,c3,c1,c2);
|
||||
sqr_add_c2(a,4,1,c3,c1,c2);
|
||||
sqr_add_c2(a,3,2,c3,c1,c2);
|
||||
r[5]=c3;
|
||||
c3=0;
|
||||
sqr_add_c(a,3,c1,c2,c3);
|
||||
sqr_add_c2(a,4,2,c1,c2,c3);
|
||||
sqr_add_c2(a,5,1,c1,c2,c3);
|
||||
sqr_add_c2(a,6,0,c1,c2,c3);
|
||||
r[6]=c1;
|
||||
c1=0;
|
||||
sqr_add_c2(a,7,0,c2,c3,c1);
|
||||
sqr_add_c2(a,6,1,c2,c3,c1);
|
||||
sqr_add_c2(a,5,2,c2,c3,c1);
|
||||
sqr_add_c2(a,4,3,c2,c3,c1);
|
||||
r[7]=c2;
|
||||
c2=0;
|
||||
sqr_add_c(a,4,c3,c1,c2);
|
||||
sqr_add_c2(a,5,3,c3,c1,c2);
|
||||
sqr_add_c2(a,6,2,c3,c1,c2);
|
||||
sqr_add_c2(a,7,1,c3,c1,c2);
|
||||
r[8]=c3;
|
||||
c3=0;
|
||||
sqr_add_c2(a,7,2,c1,c2,c3);
|
||||
sqr_add_c2(a,6,3,c1,c2,c3);
|
||||
sqr_add_c2(a,5,4,c1,c2,c3);
|
||||
r[9]=c1;
|
||||
c1=0;
|
||||
sqr_add_c(a,5,c2,c3,c1);
|
||||
sqr_add_c2(a,6,4,c2,c3,c1);
|
||||
sqr_add_c2(a,7,3,c2,c3,c1);
|
||||
r[10]=c2;
|
||||
c2=0;
|
||||
sqr_add_c2(a,7,4,c3,c1,c2);
|
||||
sqr_add_c2(a,6,5,c3,c1,c2);
|
||||
r[11]=c3;
|
||||
c3=0;
|
||||
sqr_add_c(a,6,c1,c2,c3);
|
||||
sqr_add_c2(a,7,5,c1,c2,c3);
|
||||
r[12]=c1;
|
||||
c1=0;
|
||||
sqr_add_c2(a,7,6,c2,c3,c1);
|
||||
r[13]=c2;
|
||||
c2=0;
|
||||
sqr_add_c(a,7,c3,c1,c2);
|
||||
r[14]=c3;
|
||||
r[15]=c1;
|
||||
}
|
||||
|
||||
void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
BN_ULONG bl,bh;
|
||||
BN_ULONG t1,t2;
|
||||
BN_ULONG c1,c2,c3;
|
||||
|
||||
c1=0;
|
||||
c2=0;
|
||||
c3=0;
|
||||
sqr_add_c(a,0,c1,c2,c3);
|
||||
r[0]=c1;
|
||||
c1=0;
|
||||
sqr_add_c2(a,1,0,c2,c3,c1);
|
||||
r[1]=c2;
|
||||
c2=0;
|
||||
sqr_add_c(a,1,c3,c1,c2);
|
||||
sqr_add_c2(a,2,0,c3,c1,c2);
|
||||
r[2]=c3;
|
||||
c3=0;
|
||||
sqr_add_c2(a,3,0,c1,c2,c3);
|
||||
sqr_add_c2(a,2,1,c1,c2,c3);
|
||||
r[3]=c1;
|
||||
c1=0;
|
||||
sqr_add_c(a,2,c2,c3,c1);
|
||||
sqr_add_c2(a,3,1,c2,c3,c1);
|
||||
r[4]=c2;
|
||||
c2=0;
|
||||
sqr_add_c2(a,3,2,c3,c1,c2);
|
||||
r[5]=c3;
|
||||
c3=0;
|
||||
sqr_add_c(a,3,c1,c2,c3);
|
||||
r[6]=c1;
|
||||
r[7]=c2;
|
||||
}
|
||||
@@ -150,6 +150,20 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
q; \
|
||||
})
|
||||
# define REMAINDER_IS_ALREADY_CALCULATED
|
||||
# elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG)
|
||||
/*
|
||||
* Same story here, but it's 128-bit by 64-bit division. Wow!
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
# define bn_div_words(n0,n1,d0) \
|
||||
({ asm volatile ( \
|
||||
"divq %4" \
|
||||
: "=a"(q), "=d"(rem) \
|
||||
: "a"(n1), "d"(n0), "g"(d0) \
|
||||
: "cc"); \
|
||||
q; \
|
||||
})
|
||||
# define REMAINDER_IS_ALREADY_CALCULATED
|
||||
# endif /* __<cpu> */
|
||||
# endif /* __GNUC__ */
|
||||
#endif /* OPENSSL_NO_ASM */
|
||||
@@ -296,7 +310,9 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
||||
rem=(n1-q*d0)&BN_MASK2;
|
||||
#endif
|
||||
|
||||
#ifdef BN_UMULT_HIGH
|
||||
#if defined(BN_UMULT_LOHI)
|
||||
BN_UMULT_LOHI(t2l,t2h,d1,q);
|
||||
#elif defined(BN_UMULT_HIGH)
|
||||
t2l = d1 * q;
|
||||
t2h = BN_UMULT_HIGH(d1,q);
|
||||
#else
|
||||
|
||||
@@ -230,6 +230,21 @@ struct bignum_ctx
|
||||
: "r"(a), "r"(b)); \
|
||||
ret; })
|
||||
# endif /* compiler */
|
||||
# elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG)
|
||||
# if defined(__GNUC__)
|
||||
# define BN_UMULT_HIGH(a,b) ({ \
|
||||
register BN_ULONG ret,discard; \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(discard),"=d"(ret) \
|
||||
: "a"(a), "g"(b) \
|
||||
: "cc"); \
|
||||
ret; })
|
||||
# define BN_UMULT_LOHI(low,high,a,b) \
|
||||
asm ("mulq %3" \
|
||||
: "=a"(low),"=d"(high) \
|
||||
: "a"(a),"g"(b) \
|
||||
: "cc");
|
||||
# endif
|
||||
# endif /* cpu */
|
||||
#endif /* OPENSSL_NO_ASM */
|
||||
|
||||
@@ -337,7 +352,7 @@ struct bignum_ctx
|
||||
|
||||
#define LBITS(a) ((a)&BN_MASK2l)
|
||||
#define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2l)
|
||||
#define L2HBITS(a) ((BN_ULONG)((a)&BN_MASK2l)<<BN_BITS4)
|
||||
#define L2HBITS(a) (((a)<<BN_BITS4)&BN_MASK2)
|
||||
|
||||
#define LLBITS(a) ((a)&BN_MASKl)
|
||||
#define LHBITS(a) (((a)>>BN_BITS2)&BN_MASKl)
|
||||
@@ -418,10 +433,13 @@ void bn_sqr_comba4(BN_ULONG *r,const BN_ULONG *a);
|
||||
int bn_cmp_words(const BN_ULONG *a,const BN_ULONG *b,int n);
|
||||
int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
|
||||
int cl, int dl);
|
||||
#if 0
|
||||
/* bn_mul.c rollback <appro> */
|
||||
void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
|
||||
int dna,int dnb,BN_ULONG *t);
|
||||
void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,
|
||||
int n,int tna,int tnb,BN_ULONG *t);
|
||||
#endif
|
||||
void bn_sqr_recursive(BN_ULONG *r,const BN_ULONG *a, int n2, BN_ULONG *t);
|
||||
void bn_mul_low_normal(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, int n);
|
||||
void bn_mul_low_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
|
||||
|
||||
@@ -263,12 +263,12 @@ void BN_clear_free(BIGNUM *a)
|
||||
if (a == NULL) return;
|
||||
if (a->d != NULL)
|
||||
{
|
||||
memset(a->d,0,a->dmax*sizeof(a->d[0]));
|
||||
OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
|
||||
if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
|
||||
OPENSSL_free(a->d);
|
||||
}
|
||||
i=BN_get_flags(a,BN_FLG_MALLOCED);
|
||||
memset(a,0,sizeof(BIGNUM));
|
||||
OPENSSL_cleanse(a,sizeof(BIGNUM));
|
||||
if (i)
|
||||
OPENSSL_free(a);
|
||||
}
|
||||
|
||||
@@ -56,325 +56,10 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef BN_DEBUG
|
||||
# undef NDEBUG /* avoid conflicting definitions */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
#if defined(OPENSSL_NO_ASM) || !(defined(__i386) || defined(__i386__)) || defined(__DJGPP__) /* Assembler implementation exists only for x86 */
|
||||
/* Here follows specialised variants of bn_add_words() and
|
||||
bn_sub_words(). They have the property performing operations on
|
||||
arrays of different sizes. The sizes of those arrays is expressed through
|
||||
cl, which is the common length ( basicall, min(len(a),len(b)) ), and dl,
|
||||
which is the delta between the two lengths, calculated as len(a)-len(b).
|
||||
All lengths are the number of BN_ULONGs... For the operations that require
|
||||
a result array as parameter, it must have the length cl+abs(dl).
|
||||
These functions should probably end up in bn_asm.c as soon as there are
|
||||
assembler counterparts for the systems that use assembler files. */
|
||||
|
||||
BN_ULONG bn_sub_part_words(BN_ULONG *r,
|
||||
const BN_ULONG *a, const BN_ULONG *b,
|
||||
int cl, int dl)
|
||||
{
|
||||
BN_ULONG c, t;
|
||||
|
||||
assert(cl >= 0);
|
||||
c = bn_sub_words(r, a, b, cl);
|
||||
|
||||
if (dl == 0)
|
||||
return c;
|
||||
|
||||
r += cl;
|
||||
a += cl;
|
||||
b += cl;
|
||||
|
||||
if (dl < 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_sub_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
|
||||
#endif
|
||||
for (;;)
|
||||
{
|
||||
t = b[0];
|
||||
r[0] = (0-t-c)&BN_MASK2;
|
||||
if (t != 0) c=1;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
t = b[1];
|
||||
r[1] = (0-t-c)&BN_MASK2;
|
||||
if (t != 0) c=1;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
t = b[2];
|
||||
r[2] = (0-t-c)&BN_MASK2;
|
||||
if (t != 0) c=1;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
t = b[3];
|
||||
r[3] = (0-t-c)&BN_MASK2;
|
||||
if (t != 0) c=1;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int save_dl = dl;
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
|
||||
#endif
|
||||
while(c)
|
||||
{
|
||||
t = a[0];
|
||||
r[0] = (t-c)&BN_MASK2;
|
||||
if (t != 0) c=0;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t = a[1];
|
||||
r[1] = (t-c)&BN_MASK2;
|
||||
if (t != 0) c=0;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t = a[2];
|
||||
r[2] = (t-c)&BN_MASK2;
|
||||
if (t != 0) c=0;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t = a[3];
|
||||
r[3] = (t-c)&BN_MASK2;
|
||||
if (t != 0) c=0;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
save_dl = dl;
|
||||
a += 4;
|
||||
r += 4;
|
||||
}
|
||||
if (dl > 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
|
||||
#endif
|
||||
if (save_dl > dl)
|
||||
{
|
||||
switch (save_dl - dl)
|
||||
{
|
||||
case 1:
|
||||
r[1] = a[1];
|
||||
if (--dl <= 0) break;
|
||||
case 2:
|
||||
r[2] = a[2];
|
||||
if (--dl <= 0) break;
|
||||
case 3:
|
||||
r[3] = a[3];
|
||||
if (--dl <= 0) break;
|
||||
}
|
||||
a += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
if (dl > 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, copy)\n", cl, dl);
|
||||
#endif
|
||||
for(;;)
|
||||
{
|
||||
r[0] = a[0];
|
||||
if (--dl <= 0) break;
|
||||
r[1] = a[1];
|
||||
if (--dl <= 0) break;
|
||||
r[2] = a[2];
|
||||
if (--dl <= 0) break;
|
||||
r[3] = a[3];
|
||||
if (--dl <= 0) break;
|
||||
|
||||
a += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
BN_ULONG bn_add_part_words(BN_ULONG *r,
|
||||
const BN_ULONG *a, const BN_ULONG *b,
|
||||
int cl, int dl)
|
||||
{
|
||||
BN_ULONG c, l, t;
|
||||
|
||||
assert(cl >= 0);
|
||||
c = bn_add_words(r, a, b, cl);
|
||||
|
||||
if (dl == 0)
|
||||
return c;
|
||||
|
||||
r += cl;
|
||||
a += cl;
|
||||
b += cl;
|
||||
|
||||
if (dl < 0)
|
||||
{
|
||||
int save_dl = dl;
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
|
||||
#endif
|
||||
while (c)
|
||||
{
|
||||
l=(c+b[0])&BN_MASK2;
|
||||
c=(l < c);
|
||||
r[0]=l;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
l=(c+b[1])&BN_MASK2;
|
||||
c=(l < c);
|
||||
r[1]=l;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
l=(c+b[2])&BN_MASK2;
|
||||
c=(l < c);
|
||||
r[2]=l;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
l=(c+b[3])&BN_MASK2;
|
||||
c=(l < c);
|
||||
r[3]=l;
|
||||
if (++dl >= 0) break;
|
||||
|
||||
save_dl = dl;
|
||||
b+=4;
|
||||
r+=4;
|
||||
}
|
||||
if (dl < 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c == 0)\n", cl, dl);
|
||||
#endif
|
||||
if (save_dl < dl)
|
||||
{
|
||||
switch (dl - save_dl)
|
||||
{
|
||||
case 1:
|
||||
r[1] = b[1];
|
||||
if (++dl >= 0) break;
|
||||
case 2:
|
||||
r[2] = b[2];
|
||||
if (++dl >= 0) break;
|
||||
case 3:
|
||||
r[3] = b[3];
|
||||
if (++dl >= 0) break;
|
||||
}
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
if (dl < 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, copy)\n", cl, dl);
|
||||
#endif
|
||||
for(;;)
|
||||
{
|
||||
r[0] = b[0];
|
||||
if (++dl >= 0) break;
|
||||
r[1] = b[1];
|
||||
if (++dl >= 0) break;
|
||||
r[2] = b[2];
|
||||
if (++dl >= 0) break;
|
||||
r[3] = b[3];
|
||||
if (++dl >= 0) break;
|
||||
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int save_dl = dl;
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0)\n", cl, dl);
|
||||
#endif
|
||||
while (c)
|
||||
{
|
||||
t=(a[0]+c)&BN_MASK2;
|
||||
c=(t < c);
|
||||
r[0]=t;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t=(a[1]+c)&BN_MASK2;
|
||||
c=(t < c);
|
||||
r[1]=t;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t=(a[2]+c)&BN_MASK2;
|
||||
c=(t < c);
|
||||
r[2]=t;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
t=(a[3]+c)&BN_MASK2;
|
||||
c=(t < c);
|
||||
r[3]=t;
|
||||
if (--dl <= 0) break;
|
||||
|
||||
save_dl = dl;
|
||||
a+=4;
|
||||
r+=4;
|
||||
}
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
|
||||
#endif
|
||||
if (dl > 0)
|
||||
{
|
||||
if (save_dl > dl)
|
||||
{
|
||||
switch (save_dl - dl)
|
||||
{
|
||||
case 1:
|
||||
r[1] = a[1];
|
||||
if (--dl <= 0) break;
|
||||
case 2:
|
||||
r[2] = a[2];
|
||||
if (--dl <= 0) break;
|
||||
case 3:
|
||||
r[3] = a[3];
|
||||
if (--dl <= 0) break;
|
||||
}
|
||||
a += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
if (dl > 0)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0, copy)\n", cl, dl);
|
||||
#endif
|
||||
for(;;)
|
||||
{
|
||||
r[0] = a[0];
|
||||
if (--dl <= 0) break;
|
||||
r[1] = a[1];
|
||||
if (--dl <= 0) break;
|
||||
r[2] = a[2];
|
||||
if (--dl <= 0) break;
|
||||
r[3] = a[3];
|
||||
if (--dl <= 0) break;
|
||||
|
||||
a += 4;
|
||||
r += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
#ifdef BN_RECURSION
|
||||
/* Karatsuba recursive multiplication algorithm
|
||||
* (cf. Knuth, The Art of Computer Programming, Vol. 2) */
|
||||
@@ -390,15 +75,14 @@ BN_ULONG bn_add_part_words(BN_ULONG *r,
|
||||
* a[1]*b[1]
|
||||
*/
|
||||
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
int dna, int dnb, BN_ULONG *t)
|
||||
BN_ULONG *t)
|
||||
{
|
||||
int n=n2/2,c1,c2;
|
||||
int tna=n+dna, tnb=n+dnb;
|
||||
unsigned int neg,zero;
|
||||
BN_ULONG ln,lo,*p;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_recursive %d * %d\n",n2,n2);
|
||||
printf(" bn_mul_recursive %d * %d\n",n2,n2);
|
||||
# endif
|
||||
# ifdef BN_MUL_COMBA
|
||||
# if 0
|
||||
@@ -408,40 +92,34 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
/* Only call bn_mul_comba 8 if n2 == 8 and the
|
||||
* two arrays are complete [steve]
|
||||
*/
|
||||
if (n2 == 8 && dna == 0 && dnb == 0)
|
||||
if (n2 == 8)
|
||||
{
|
||||
bn_mul_comba8(r,a,b);
|
||||
return;
|
||||
}
|
||||
# endif /* BN_MUL_COMBA */
|
||||
/* Else do normal multiply */
|
||||
if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
bn_mul_normal(r,a,n2+dna,b,n2+dnb);
|
||||
if ((dna + dnb) < 0)
|
||||
memset(&r[2*n2 + dna + dnb], 0,
|
||||
sizeof(BN_ULONG) * -(dna + dnb));
|
||||
/* This should not happen */
|
||||
bn_mul_normal(r,a,n2,b,n2);
|
||||
return;
|
||||
}
|
||||
/* r=(a[0]-a[1])*(b[1]-b[0]) */
|
||||
c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
|
||||
c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
|
||||
c1=bn_cmp_words(a,&(a[n]),n);
|
||||
c2=bn_cmp_words(&(b[n]),b,n);
|
||||
zero=neg=0;
|
||||
switch (c1*3+c2)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
|
||||
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
|
||||
bn_sub_words(t, &(a[n]),a, n); /* - */
|
||||
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
|
||||
break;
|
||||
case -3:
|
||||
zero=1;
|
||||
break;
|
||||
case -2:
|
||||
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
|
||||
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n); /* + */
|
||||
bn_sub_words(t, &(a[n]),a, n); /* - */
|
||||
bn_sub_words(&(t[n]),&(b[n]),b, n); /* + */
|
||||
neg=1;
|
||||
break;
|
||||
case -1:
|
||||
@@ -450,22 +128,21 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
zero=1;
|
||||
break;
|
||||
case 2:
|
||||
bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */
|
||||
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
|
||||
bn_sub_words(t, a, &(a[n]),n); /* + */
|
||||
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
|
||||
neg=1;
|
||||
break;
|
||||
case 3:
|
||||
zero=1;
|
||||
break;
|
||||
case 4:
|
||||
bn_sub_part_words(t, a, &(a[n]),tna,n-tna);
|
||||
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n);
|
||||
bn_sub_words(t, a, &(a[n]),n);
|
||||
bn_sub_words(&(t[n]),&(b[n]),b, n);
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef BN_MUL_COMBA
|
||||
if (n == 4 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba4 could take
|
||||
extra args to do this well */
|
||||
if (n == 4)
|
||||
{
|
||||
if (!zero)
|
||||
bn_mul_comba4(&(t[n2]),t,&(t[n]));
|
||||
@@ -475,9 +152,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
bn_mul_comba4(r,a,b);
|
||||
bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n]));
|
||||
}
|
||||
else if (n == 8 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba8 could
|
||||
take extra args to do this
|
||||
well */
|
||||
else if (n == 8)
|
||||
{
|
||||
if (!zero)
|
||||
bn_mul_comba8(&(t[n2]),t,&(t[n]));
|
||||
@@ -492,11 +167,11 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
{
|
||||
p= &(t[n2*2]);
|
||||
if (!zero)
|
||||
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
|
||||
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p);
|
||||
else
|
||||
memset(&(t[n2]),0,n2*sizeof(BN_ULONG));
|
||||
bn_mul_recursive(r,a,b,n,0,0,p);
|
||||
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,dna,dnb,p);
|
||||
bn_mul_recursive(r,a,b,n,p);
|
||||
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,p);
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
|
||||
@@ -545,39 +220,39 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
|
||||
/* n+tn is the word length
|
||||
* t needs to be n*4 is size, as does r */
|
||||
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||
int tna, int tnb, BN_ULONG *t)
|
||||
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int tn,
|
||||
int n, BN_ULONG *t)
|
||||
{
|
||||
int i,j,n2=n*2;
|
||||
unsigned int c1,c2,neg,zero;
|
||||
BN_ULONG ln,lo,*p;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_part_recursive (%d+%d) * (%d+%d)\n",
|
||||
tna, n, tnb, n);
|
||||
printf(" bn_mul_part_recursive %d * %d\n",tn+n,tn+n);
|
||||
# endif
|
||||
if (n < 8)
|
||||
{
|
||||
bn_mul_normal(r,a,n+tna,b,n+tnb);
|
||||
i=tn+n;
|
||||
bn_mul_normal(r,a,i,b,i);
|
||||
return;
|
||||
}
|
||||
|
||||
/* r=(a[0]-a[1])*(b[1]-b[0]) */
|
||||
c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
|
||||
c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
|
||||
c1=bn_cmp_words(a,&(a[n]),n);
|
||||
c2=bn_cmp_words(&(b[n]),b,n);
|
||||
zero=neg=0;
|
||||
switch (c1*3+c2)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
|
||||
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
|
||||
bn_sub_words(t, &(a[n]),a, n); /* - */
|
||||
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
|
||||
break;
|
||||
case -3:
|
||||
zero=1;
|
||||
/* break; */
|
||||
case -2:
|
||||
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
|
||||
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n); /* + */
|
||||
bn_sub_words(t, &(a[n]),a, n); /* - */
|
||||
bn_sub_words(&(t[n]),&(b[n]),b, n); /* + */
|
||||
neg=1;
|
||||
break;
|
||||
case -1:
|
||||
@@ -586,16 +261,16 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||
zero=1;
|
||||
/* break; */
|
||||
case 2:
|
||||
bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */
|
||||
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
|
||||
bn_sub_words(t, a, &(a[n]),n); /* + */
|
||||
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
|
||||
neg=1;
|
||||
break;
|
||||
case 3:
|
||||
zero=1;
|
||||
/* break; */
|
||||
case 4:
|
||||
bn_sub_part_words(t, a, &(a[n]),tna,n-tna);
|
||||
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n);
|
||||
bn_sub_words(t, a, &(a[n]),n);
|
||||
bn_sub_words(&(t[n]),&(b[n]),b, n);
|
||||
break;
|
||||
}
|
||||
/* The zero case isn't yet implemented here. The speedup
|
||||
@@ -614,59 +289,54 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||
{
|
||||
bn_mul_comba8(&(t[n2]),t,&(t[n]));
|
||||
bn_mul_comba8(r,a,b);
|
||||
bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
|
||||
memset(&(r[n2+tna+tnb]),0,sizeof(BN_ULONG)*(n2-tna-tnb));
|
||||
bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
|
||||
memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2));
|
||||
}
|
||||
else
|
||||
{
|
||||
p= &(t[n2*2]);
|
||||
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
|
||||
bn_mul_recursive(r,a,b,n,0,0,p);
|
||||
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p);
|
||||
bn_mul_recursive(r,a,b,n,p);
|
||||
i=n/2;
|
||||
/* If there is only a bottom half to the number,
|
||||
* just do it */
|
||||
if (tna > tnb)
|
||||
j = tna - i;
|
||||
else
|
||||
j = tnb - i;
|
||||
j=tn-i;
|
||||
if (j == 0)
|
||||
{
|
||||
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),
|
||||
i,tna-i,tnb-i,p);
|
||||
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),i,p);
|
||||
memset(&(r[n2+i*2]),0,sizeof(BN_ULONG)*(n2-i*2));
|
||||
}
|
||||
else if (j > 0) /* eg, n == 16, i == 8 and tn == 11 */
|
||||
{
|
||||
bn_mul_part_recursive(&(r[n2]),&(a[n]),&(b[n]),
|
||||
i,tna-i,tnb-i,p);
|
||||
memset(&(r[n2+tna+tnb]),0,
|
||||
sizeof(BN_ULONG)*(n2-tna-tnb));
|
||||
j,i,p);
|
||||
memset(&(r[n2+tn*2]),0,
|
||||
sizeof(BN_ULONG)*(n2-tn*2));
|
||||
}
|
||||
else /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
|
||||
{
|
||||
memset(&(r[n2]),0,sizeof(BN_ULONG)*n2);
|
||||
if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
|
||||
&& tnb < BN_MUL_RECURSIVE_SIZE_NORMAL)
|
||||
if (tn < BN_MUL_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
|
||||
bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i/=2;
|
||||
if (i < tna && i < tnb)
|
||||
if (i < tn)
|
||||
{
|
||||
bn_mul_part_recursive(&(r[n2]),
|
||||
&(a[n]),&(b[n]),
|
||||
i,tna-i,tnb-i,p);
|
||||
tn-i,i,p);
|
||||
break;
|
||||
}
|
||||
else if (i <= tna && i <= tnb)
|
||||
else if (i == tn)
|
||||
{
|
||||
bn_mul_recursive(&(r[n2]),
|
||||
&(a[n]),&(b[n]),
|
||||
i,tna-i,tnb-i,p);
|
||||
i,p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -727,10 +397,10 @@ void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
int n=n2/2;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_low_recursive %d * %d\n",n2,n2);
|
||||
printf(" bn_mul_low_recursive %d * %d\n",n2,n2);
|
||||
# endif
|
||||
|
||||
bn_mul_recursive(r,a,b,n,0,0,&(t[0]));
|
||||
bn_mul_recursive(r,a,b,n,&(t[0]));
|
||||
if (n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
bn_mul_low_recursive(&(t[0]),&(a[0]),&(b[n]),n,&(t[n2]));
|
||||
@@ -761,7 +431,7 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
|
||||
BN_ULONG ll,lc,*lp,*mp;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_high %d * %d\n",n2,n2);
|
||||
printf(" bn_mul_high %d * %d\n",n2,n2);
|
||||
# endif
|
||||
n=n2/2;
|
||||
|
||||
@@ -814,8 +484,8 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
|
||||
else
|
||||
# endif
|
||||
{
|
||||
bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,0,0,&(t[n2]));
|
||||
bn_mul_recursive(r,&(a[n]),&(b[n]),n,0,0,&(t[n2]));
|
||||
bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,&(t[n2]));
|
||||
bn_mul_recursive(r,&(a[n]),&(b[n]),n,&(t[n2]));
|
||||
}
|
||||
|
||||
/* s0 == low(al*bl)
|
||||
@@ -940,19 +610,19 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
|
||||
|
||||
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
int ret=0;
|
||||
int top,al,bl;
|
||||
BIGNUM *rr;
|
||||
int ret = 0;
|
||||
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
||||
int i;
|
||||
#endif
|
||||
#ifdef BN_RECURSION
|
||||
BIGNUM *t=NULL;
|
||||
int j=0,k;
|
||||
BIGNUM *t;
|
||||
int j,k;
|
||||
#endif
|
||||
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr,"BN_mul %d * %d\n",a->top,b->top);
|
||||
printf("BN_mul %d * %d\n",a->top,b->top);
|
||||
#endif
|
||||
|
||||
bn_check_top(a);
|
||||
@@ -1005,55 +675,21 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
#ifdef BN_RECURSION
|
||||
if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL))
|
||||
{
|
||||
if (i >= -1 && i <= 1)
|
||||
if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA) && bl<b->dmax)
|
||||
{
|
||||
int sav_j =0;
|
||||
/* Find out the power of two lower or equal
|
||||
to the longest of the two numbers */
|
||||
if (i >= 0)
|
||||
{
|
||||
j = BN_num_bits_word((BN_ULONG)al);
|
||||
}
|
||||
if (i == -1)
|
||||
{
|
||||
j = BN_num_bits_word((BN_ULONG)bl);
|
||||
}
|
||||
sav_j = j;
|
||||
j = 1<<(j-1);
|
||||
assert(j <= al || j <= bl);
|
||||
k = j+j;
|
||||
t = BN_CTX_get(ctx);
|
||||
if (al > j || bl > j)
|
||||
{
|
||||
bn_wexpand(t,k*4);
|
||||
bn_wexpand(rr,k*4);
|
||||
bn_mul_part_recursive(rr->d,a->d,b->d,
|
||||
j,al-j,bl-j,t->d);
|
||||
}
|
||||
else /* al <= j || bl <= j */
|
||||
{
|
||||
bn_wexpand(t,k*2);
|
||||
bn_wexpand(rr,k*2);
|
||||
bn_mul_recursive(rr->d,a->d,b->d,
|
||||
j,al-j,bl-j,t->d);
|
||||
}
|
||||
rr->top=top;
|
||||
goto end;
|
||||
}
|
||||
#if 0
|
||||
if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))
|
||||
{
|
||||
BIGNUM *tmp_bn = (BIGNUM *)b;
|
||||
if (bn_wexpand(tmp_bn,al) == NULL) goto err;
|
||||
tmp_bn->d[bl]=0;
|
||||
#if 0 /* tribute to const-ification, bl<b->dmax above covers for this */
|
||||
if (bn_wexpand(b,al) == NULL) goto err;
|
||||
#endif
|
||||
b->d[bl]=0;
|
||||
bl++;
|
||||
i--;
|
||||
}
|
||||
else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))
|
||||
else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA) && al<a->dmax)
|
||||
{
|
||||
BIGNUM *tmp_bn = (BIGNUM *)a;
|
||||
if (bn_wexpand(tmp_bn,bl) == NULL) goto err;
|
||||
tmp_bn->d[al]=0;
|
||||
#if 0 /* tribute to const-ification, al<a->dmax above covers for this */
|
||||
if (bn_wexpand(a,bl) == NULL) goto err;
|
||||
#endif
|
||||
a->d[al]=0;
|
||||
al++;
|
||||
i++;
|
||||
}
|
||||
@@ -1070,17 +706,26 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
if (bn_wexpand(t,k*2) == NULL) goto err;
|
||||
if (bn_wexpand(rr,k*2) == NULL) goto err;
|
||||
bn_mul_recursive(rr->d,a->d,b->d,al,t->d);
|
||||
rr->top=top;
|
||||
goto end;
|
||||
}
|
||||
#if 0 /* tribute to const-ification, rsa/dsa performance is not affected */
|
||||
else
|
||||
{
|
||||
if (bn_wexpand(t,k*4) == NULL) goto err;
|
||||
if (bn_wexpand(rr,k*4) == NULL) goto err;
|
||||
if (bn_wexpand(a,k) == NULL ) goto err;
|
||||
if (bn_wexpand(b,k) == NULL ) goto err;
|
||||
if (bn_wexpand(t,k*4) == NULL ) goto err;
|
||||
if (bn_wexpand(rr,k*4) == NULL ) goto err;
|
||||
for (i=a->top; i<k; i++)
|
||||
a->d[i]=0;
|
||||
for (i=b->top; i<k; i++)
|
||||
b->d[i]=0;
|
||||
bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d);
|
||||
}
|
||||
rr->top=top;
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* BN_RECURSION */
|
||||
if (bn_wexpand(rr,top) == NULL) goto err;
|
||||
@@ -1103,7 +748,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
|
||||
BN_ULONG *rr;
|
||||
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_normal %d * %d\n",na,nb);
|
||||
printf(" bn_mul_normal %d * %d\n",na,nb);
|
||||
#endif
|
||||
|
||||
if (na < nb)
|
||||
@@ -1116,13 +761,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
|
||||
|
||||
}
|
||||
rr= &(r[na]);
|
||||
if (nb <= 0)
|
||||
{
|
||||
(void)bn_mul_words(r,a,na,0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
rr[0]=bn_mul_words(r,a,na,b[0]);
|
||||
rr[0]=bn_mul_words(r,a,na,b[0]);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@@ -1143,7 +782,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
|
||||
void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
fprintf(stderr," bn_mul_low_normal %d * %d\n",n,n);
|
||||
printf(" bn_mul_low_normal %d * %d\n",n,n);
|
||||
#endif
|
||||
bn_mul_words(r,a,n,b[0]);
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
|
||||
err:
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf,0,bytes);
|
||||
OPENSSL_cleanse(buf,bytes);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
return(ret);
|
||||
|
||||
@@ -141,10 +141,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
ctx=BN_CTX_new();
|
||||
if (ctx == NULL) exit(1);
|
||||
if (ctx == NULL) EXIT(1);
|
||||
|
||||
out=BIO_new(BIO_s_file());
|
||||
if (out == NULL) exit(1);
|
||||
if (out == NULL) EXIT(1);
|
||||
if (outfile == NULL)
|
||||
{
|
||||
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
|
||||
if (!BIO_write_filename(out,outfile))
|
||||
{
|
||||
perror(outfile);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,14 +238,14 @@ int main(int argc, char *argv[])
|
||||
BIO_free(out);
|
||||
|
||||
/**/
|
||||
exit(0);
|
||||
EXIT(0);
|
||||
err:
|
||||
BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
|
||||
* the failure, see test_bn in test/Makefile.ssl*/
|
||||
BIO_flush(out);
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ int test_mul(BIO *bp)
|
||||
BN_CTX *ctx;
|
||||
|
||||
ctx = BN_CTX_new();
|
||||
if (ctx == NULL) exit(1);
|
||||
if (ctx == NULL) EXIT(1);
|
||||
|
||||
BN_init(&a);
|
||||
BN_init(&b);
|
||||
@@ -726,7 +726,7 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx)
|
||||
while ((l=ERR_get_error()))
|
||||
fprintf(stderr,"ERROR:%s\n",
|
||||
ERR_error_string(l,NULL));
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
if (bp != NULL)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rand.h>
|
||||
@@ -86,7 +89,7 @@ int main(int argc, char *argv[])
|
||||
ERR_load_BN_strings();
|
||||
|
||||
ctx=BN_CTX_new();
|
||||
if (ctx == NULL) exit(1);
|
||||
if (ctx == NULL) EXIT(1);
|
||||
r_mont=BN_new();
|
||||
r_recp=BN_new();
|
||||
r_simple=BN_new();
|
||||
@@ -99,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
out=BIO_new(BIO_s_file());
|
||||
|
||||
if (out == NULL) exit(1);
|
||||
if (out == NULL) EXIT(1);
|
||||
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||
|
||||
for (i=0; i<200; i++)
|
||||
@@ -124,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
printf("BN_mod_exp_mont() problems\n");
|
||||
ERR_print_errors(out);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
ret=BN_mod_exp_recp(r_recp,a,b,m,ctx);
|
||||
@@ -132,7 +135,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
printf("BN_mod_exp_recp() problems\n");
|
||||
ERR_print_errors(out);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
ret=BN_mod_exp_simple(r_simple,a,b,m,ctx);
|
||||
@@ -140,7 +143,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
printf("BN_mod_exp_simple() problems\n");
|
||||
ERR_print_errors(out);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
if (BN_cmp(r_simple, r_mont) == 0
|
||||
@@ -163,7 +166,7 @@ int main(int argc, char *argv[])
|
||||
printf("\nrecp ="); BN_print(out,r_recp);
|
||||
printf("\nmont ="); BN_print(out,r_mont);
|
||||
printf("\n");
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
}
|
||||
}
|
||||
BN_free(r_mont);
|
||||
@@ -177,11 +180,11 @@ int main(int argc, char *argv[])
|
||||
CRYPTO_mem_leaks(out);
|
||||
BIO_free(out);
|
||||
printf(" done\n");
|
||||
exit(0);
|
||||
EXIT(0);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(out);
|
||||
exit(1);
|
||||
EXIT(1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#ifdef OPENSSL_NO_CAST
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -224,7 +226,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
exit(err);
|
||||
EXIT(err);
|
||||
return(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -104,7 +104,8 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
|
||||
"dynlock",
|
||||
"engine",
|
||||
"ui",
|
||||
#if CRYPTO_NUM_LOCKS != 32
|
||||
"hwcrhk", /* This is a HACK which will disappear in 0.9.8 */
|
||||
#if CRYPTO_NUM_LOCKS != 33
|
||||
# error "Inconsistency between crypto.h and cryptlib.c"
|
||||
#endif
|
||||
};
|
||||
@@ -207,10 +208,18 @@ int CRYPTO_get_new_dynlockid(void)
|
||||
i=sk_CRYPTO_dynlock_find(dyn_locks,NULL);
|
||||
/* If there was none, push, thereby creating a new one */
|
||||
if (i == -1)
|
||||
i=sk_CRYPTO_dynlock_push(dyn_locks,pointer);
|
||||
/* Since sk_push() returns the number of items on the
|
||||
stack, not the location of the pushed item, we need
|
||||
to transform the returned number into a position,
|
||||
by decreasing it. */
|
||||
i=sk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1;
|
||||
else
|
||||
/* If we found a place with a NULL pointer, put our pointer
|
||||
in it. */
|
||||
sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
|
||||
|
||||
if (!i)
|
||||
if (i == -1)
|
||||
{
|
||||
dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
|
||||
OPENSSL_free(pointer);
|
||||
@@ -402,15 +411,17 @@ void CRYPTO_lock(int mode, int type, const char *file, int line)
|
||||
#endif
|
||||
if (type < 0)
|
||||
{
|
||||
struct CRYPTO_dynlock_value *pointer
|
||||
= CRYPTO_get_dynlock_value(type);
|
||||
|
||||
if (pointer && dynlock_lock_callback)
|
||||
if (dynlock_lock_callback != NULL)
|
||||
{
|
||||
dynlock_lock_callback(mode, pointer, file, line);
|
||||
}
|
||||
struct CRYPTO_dynlock_value *pointer
|
||||
= CRYPTO_get_dynlock_value(type);
|
||||
|
||||
CRYPTO_destroy_dynlockid(type);
|
||||
OPENSSL_assert(pointer != NULL);
|
||||
|
||||
dynlock_lock_callback(mode, pointer, file, line);
|
||||
|
||||
CRYPTO_destroy_dynlockid(type);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (locking_callback != NULL)
|
||||
|
||||
@@ -158,7 +158,7 @@ $!
|
||||
$ APPS_DES = "DES/DES,CBC3_ENC"
|
||||
$ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
|
||||
$
|
||||
$ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
|
||||
$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
|
||||
$ LIB_MD2 = "md2_dgst,md2_one"
|
||||
$ LIB_MD4 = "md4_dgst,md4_one"
|
||||
$ LIB_MD5 = "md5_dgst,md5_one"
|
||||
|
||||
@@ -63,9 +63,6 @@
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
#include <stdio.h>
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
#include <stdio_extras.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <openssl/stack.h>
|
||||
@@ -130,7 +127,8 @@ extern "C" {
|
||||
#define CRYPTO_LOCK_DYNLOCK 29
|
||||
#define CRYPTO_LOCK_ENGINE 30
|
||||
#define CRYPTO_LOCK_UI 31
|
||||
#define CRYPTO_NUM_LOCKS 32
|
||||
#define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */
|
||||
#define CRYPTO_NUM_LOCKS 33
|
||||
|
||||
#define CRYPTO_LOCK 1
|
||||
#define CRYPTO_UNLOCK 2
|
||||
@@ -390,6 +388,8 @@ void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
|
||||
int line);
|
||||
void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
|
||||
|
||||
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||
|
||||
void CRYPTO_set_mem_debug_options(long bits);
|
||||
long CRYPTO_get_mem_debug_options(void);
|
||||
|
||||
|
||||
@@ -67,19 +67,27 @@ des: des.o cbc3_enc.o lib
|
||||
|
||||
# elf
|
||||
asm/dx86-elf.o: asm/dx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
|
||||
$(CPP) -DELF \
|
||||
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC`\
|
||||
-x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
|
||||
|
||||
asm/yx86-elf.o: asm/yx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
|
||||
$(CPP) -DELF \
|
||||
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC`\
|
||||
-x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/dx86-sol.o: asm/dx86unix.cpp
|
||||
$(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
|
||||
$(CC) -E -DSOL \
|
||||
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC`\
|
||||
asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
|
||||
as -o asm/dx86-sol.o asm/dx86-sol.s
|
||||
rm -f asm/dx86-sol.s
|
||||
|
||||
asm/yx86-sol.o: asm/yx86unix.cpp
|
||||
$(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
|
||||
$(CC) -E -DSOL \
|
||||
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC`\
|
||||
asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
|
||||
as -o asm/yx86-sol.o asm/yx86-sol.s
|
||||
rm -f asm/yx86-sol.s
|
||||
|
||||
|
||||
@@ -26,11 +26,17 @@ sub fcrypt_body
|
||||
|
||||
&comment("");
|
||||
&comment("Load the 2 words");
|
||||
$ks="ebp";
|
||||
$trans="ebp";
|
||||
|
||||
&xor( $L, $L);
|
||||
&xor( $R, $R);
|
||||
&mov($ks,&wparam(1));
|
||||
|
||||
# PIC-ification:-)
|
||||
if ($cpp) { &picmeup("edx","DES_SPtrans"); }
|
||||
else { &lea("edx",&DWP("DES_SPtrans")); }
|
||||
&push("edx"); # becomes &swtmp(1)
|
||||
#
|
||||
&mov($trans,&wparam(1)); # reloaded with DES_SPtrans in D_ENCRYPT
|
||||
|
||||
&push(&DWC(25)); # add a variable
|
||||
|
||||
@@ -39,11 +45,11 @@ sub fcrypt_body
|
||||
{
|
||||
&comment("");
|
||||
&comment("Round $i");
|
||||
&D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
|
||||
|
||||
&comment("");
|
||||
&comment("Round ".sprintf("%d",$i+1));
|
||||
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx");
|
||||
}
|
||||
&mov("ebx", &swtmp(0));
|
||||
&mov("eax", $L);
|
||||
@@ -61,14 +67,14 @@ sub fcrypt_body
|
||||
&mov(&DWP(0,"edx","",0),"eax");
|
||||
&mov(&DWP(4,"edx","",0),$L);
|
||||
|
||||
&pop("ecx"); # remove variable
|
||||
&add("esp",8); # remove variables
|
||||
|
||||
&function_end($name);
|
||||
}
|
||||
|
||||
sub D_ENCRYPT
|
||||
{
|
||||
local($r,$L,$R,$S,$ks,$desSP,$u,$tmp1,$tmp2,$t)=@_;
|
||||
local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=@_;
|
||||
|
||||
&mov( $u, &wparam(2)); # 2
|
||||
&mov( $t, $R);
|
||||
@@ -85,9 +91,9 @@ sub D_ENCRYPT
|
||||
&shl( $tmp2, 16); # 1
|
||||
&xor( $u, $tmp1); # 2
|
||||
&xor( $t, $tmp2); # 2
|
||||
&mov( $tmp1, &DWP(&n2a($S*4),$ks,"",0)); # 2
|
||||
&mov( $tmp1, &DWP(&n2a($S*4),$trans,"",0)); # 2
|
||||
&xor( $u, $tmp1);
|
||||
&mov( $tmp2, &DWP(&n2a(($S+1)*4),$ks,"",0)); # 2
|
||||
&mov( $tmp2, &DWP(&n2a(($S+1)*4),$trans,"",0)); # 2
|
||||
&xor( $u, $R);
|
||||
&xor( $t, $R);
|
||||
&xor( $t, $tmp2);
|
||||
@@ -99,31 +105,28 @@ sub D_ENCRYPT
|
||||
&movb( &LB($tmp1), &LB($u) );
|
||||
&movb( &LB($tmp2), &HB($u) );
|
||||
&rotr( $t, 4 );
|
||||
&mov( $ks, &DWP(" $desSP",$tmp1,"",0));
|
||||
&mov( $trans, &swtmp(1));
|
||||
&xor( $L, &DWP(" ",$trans,$tmp1,0));
|
||||
&movb( &LB($tmp1), &LB($t) );
|
||||
&xor( $L, $ks);
|
||||
&mov( $ks, &DWP("0x200+$desSP",$tmp2,"",0));
|
||||
&xor( $L, $ks);
|
||||
&xor( $L, &DWP("0x200",$trans,$tmp2,0));
|
||||
&movb( &LB($tmp2), &HB($t) );
|
||||
&shr( $u, 16);
|
||||
&mov( $ks, &DWP("0x100+$desSP",$tmp1,"",0));
|
||||
&xor( $L, $ks);
|
||||
&xor( $L, &DWP("0x100",$trans,$tmp1,0));
|
||||
&movb( &LB($tmp1), &HB($u) );
|
||||
&shr( $t, 16);
|
||||
&mov( $ks, &DWP("0x300+$desSP",$tmp2,"",0));
|
||||
&xor( $L, $ks);
|
||||
&mov( $ks, &wparam(1));
|
||||
&xor( $L, &DWP("0x300",$trans,$tmp2,0));
|
||||
&movb( &LB($tmp2), &HB($t) );
|
||||
&and( $u, "0xff" );
|
||||
&and( $t, "0xff" );
|
||||
&mov( $tmp1, &DWP("0x600+$desSP",$tmp1,"",0));
|
||||
&mov( $tmp1, &DWP("0x600",$trans,$tmp1,0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x700+$desSP",$tmp2,"",0));
|
||||
&mov( $tmp1, &DWP("0x700",$trans,$tmp2,0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x400+$desSP",$u,"",0));
|
||||
&mov( $tmp1, &DWP("0x400",$trans,$u,0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x500+$desSP",$t,"",0));
|
||||
&mov( $tmp1, &DWP("0x500",$trans,$t,0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $trans, &wparam(1));
|
||||
}
|
||||
|
||||
sub n2a
|
||||
|
||||
@@ -40,7 +40,7 @@ sub DES_encrypt
|
||||
|
||||
&comment("");
|
||||
&comment("Load the 2 words");
|
||||
$ks="ebp";
|
||||
$trans="ebp";
|
||||
|
||||
if ($do_ip)
|
||||
{
|
||||
@@ -72,7 +72,11 @@ sub DES_encrypt
|
||||
&rotl($L,3);
|
||||
}
|
||||
|
||||
&mov( $ks, &wparam(1) );
|
||||
# PIC-ification:-)
|
||||
if ($cpp) { &picmeup($trans,"DES_SPtrans"); }
|
||||
else { &lea($trans,&DWP("DES_SPtrans")); }
|
||||
|
||||
&mov( "ecx", &wparam(1) );
|
||||
&cmp("ebx","0");
|
||||
&je(&label("start_decrypt"));
|
||||
|
||||
@@ -80,11 +84,11 @@ sub DES_encrypt
|
||||
{
|
||||
&comment("");
|
||||
&comment("Round $i");
|
||||
&D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
|
||||
|
||||
&comment("");
|
||||
&comment("Round ".sprintf("%d",$i+1));
|
||||
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx");
|
||||
}
|
||||
&jmp(&label("end"));
|
||||
|
||||
@@ -94,10 +98,10 @@ sub DES_encrypt
|
||||
{
|
||||
&comment("");
|
||||
&comment("Round $i");
|
||||
&D_ENCRYPT(15-$i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
|
||||
&comment("");
|
||||
&comment("Round ".sprintf("%d",$i-1));
|
||||
&D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
|
||||
&D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx");
|
||||
}
|
||||
|
||||
&set_label("end");
|
||||
@@ -134,43 +138,36 @@ sub DES_encrypt
|
||||
|
||||
sub D_ENCRYPT
|
||||
{
|
||||
local($r,$L,$R,$S,$ks,$desSP,$u,$tmp1,$tmp2,$t)=@_;
|
||||
local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=@_;
|
||||
|
||||
&mov( $u, &DWP(&n2a($S*4),$ks,"",0));
|
||||
&mov( $u, &DWP(&n2a($S*4),$tmp2,"",0));
|
||||
&xor( $tmp1, $tmp1);
|
||||
&mov( $t, &DWP(&n2a(($S+1)*4),$ks,"",0));
|
||||
&mov( $t, &DWP(&n2a(($S+1)*4),$tmp2,"",0));
|
||||
&xor( $u, $R);
|
||||
&xor( $tmp2, $tmp2);
|
||||
&xor( $t, $R);
|
||||
&and( $u, "0xfcfcfcfc" );
|
||||
&and( $t, "0xcfcfcfcf" );
|
||||
&movb( &LB($tmp1), &LB($u) );
|
||||
&movb( &LB($tmp2), &HB($u) );
|
||||
&rotr( $t, 4 );
|
||||
&mov( $ks, &DWP(" $desSP",$tmp1,"",0));
|
||||
&xor( $L, &DWP(" ",$trans,$tmp1,0));
|
||||
&movb( &LB($tmp1), &LB($t) );
|
||||
&xor( $L, $ks);
|
||||
&mov( $ks, &DWP("0x200+$desSP",$tmp2,"",0));
|
||||
&xor( $L, $ks); ######
|
||||
&xor( $L, &DWP("0x200",$trans,$tmp2,0));
|
||||
&movb( &LB($tmp2), &HB($t) );
|
||||
&shr( $u, 16);
|
||||
&mov( $ks, &DWP("0x100+$desSP",$tmp1,"",0));
|
||||
&xor( $L, $ks); ######
|
||||
&xor( $L, &DWP("0x100",$trans,$tmp1,0));
|
||||
&movb( &LB($tmp1), &HB($u) );
|
||||
&shr( $t, 16);
|
||||
&mov( $ks, &DWP("0x300+$desSP",$tmp2,"",0));
|
||||
&xor( $L, $ks);
|
||||
&mov( $ks, &wparam(1) );
|
||||
&xor( $L, &DWP("0x300",$trans,$tmp2,0));
|
||||
&movb( &LB($tmp2), &HB($t) );
|
||||
&and( $u, "0xff" );
|
||||
&and( $t, "0xff" );
|
||||
&mov( $tmp1, &DWP("0x600+$desSP",$tmp1,"",0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x700+$desSP",$tmp2,"",0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x400+$desSP",$u,"",0));
|
||||
&xor( $L, $tmp1);
|
||||
&mov( $tmp1, &DWP("0x500+$desSP",$t,"",0));
|
||||
&xor( $L, $tmp1);
|
||||
&xor( $L, &DWP("0x600",$trans,$tmp1,0));
|
||||
&xor( $L, &DWP("0x700",$trans,$tmp2,0));
|
||||
&mov( $tmp2, &wparam(1) );
|
||||
&xor( $L, &DWP("0x400",$trans,$u,0));
|
||||
&xor( $L, &DWP("0x500",$trans,$t,0));
|
||||
}
|
||||
|
||||
sub n2a
|
||||
|
||||
@@ -427,7 +427,7 @@ void doencryption(void)
|
||||
k2[i-8]=k;
|
||||
}
|
||||
DES_set_key_unchecked(&k2,&ks2);
|
||||
memset(k2,0,sizeof(k2));
|
||||
OPENSSL_cleanse(k2,sizeof(k2));
|
||||
}
|
||||
else if (longk || flag3)
|
||||
{
|
||||
@@ -435,7 +435,7 @@ void doencryption(void)
|
||||
{
|
||||
DES_string_to_2keys(key,&kk,&k2);
|
||||
DES_set_key_unchecked(&k2,&ks2);
|
||||
memset(k2,0,sizeof(k2));
|
||||
OPENSSL_cleanse(k2,sizeof(k2));
|
||||
}
|
||||
else
|
||||
DES_string_to_key(key,&kk);
|
||||
@@ -457,8 +457,8 @@ void doencryption(void)
|
||||
}
|
||||
|
||||
DES_set_key_unchecked(&kk,&ks);
|
||||
memset(key,0,sizeof(key));
|
||||
memset(kk,0,sizeof(kk));
|
||||
OPENSSL_cleanse(key,sizeof(key));
|
||||
OPENSSL_cleanse(kk,sizeof(kk));
|
||||
/* woops - A bug that does not showup under unix :-( */
|
||||
memset(iv,0,sizeof(iv));
|
||||
memset(iv2,0,sizeof(iv2));
|
||||
@@ -666,18 +666,18 @@ void doencryption(void)
|
||||
if (l) fclose(CKSUM_OUT);
|
||||
}
|
||||
problems:
|
||||
memset(buf,0,sizeof(buf));
|
||||
memset(obuf,0,sizeof(obuf));
|
||||
memset(&ks,0,sizeof(ks));
|
||||
memset(&ks2,0,sizeof(ks2));
|
||||
memset(iv,0,sizeof(iv));
|
||||
memset(iv2,0,sizeof(iv2));
|
||||
memset(kk,0,sizeof(kk));
|
||||
memset(k2,0,sizeof(k2));
|
||||
memset(uubuf,0,sizeof(uubuf));
|
||||
memset(b,0,sizeof(b));
|
||||
memset(bb,0,sizeof(bb));
|
||||
memset(cksum,0,sizeof(cksum));
|
||||
OPENSSL_cleanse(buf,sizeof(buf));
|
||||
OPENSSL_cleanse(obuf,sizeof(obuf));
|
||||
OPENSSL_cleanse(&ks,sizeof(ks));
|
||||
OPENSSL_cleanse(&ks2,sizeof(ks2));
|
||||
OPENSSL_cleanse(iv,sizeof(iv));
|
||||
OPENSSL_cleanse(iv2,sizeof(iv2));
|
||||
OPENSSL_cleanse(kk,sizeof(kk));
|
||||
OPENSSL_cleanse(k2,sizeof(k2));
|
||||
OPENSSL_cleanse(uubuf,sizeof(uubuf));
|
||||
OPENSSL_cleanse(b,sizeof(b));
|
||||
OPENSSL_cleanse(bb,sizeof(bb));
|
||||
OPENSSL_cleanse(cksum,sizeof(cksum));
|
||||
if (Exit) EXIT(Exit);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_H
|
||||
#define HEADER_DES_H
|
||||
#ifndef HEADER_NEW_DES_H
|
||||
#define HEADER_NEW_DES_H
|
||||
|
||||
#ifdef OPENSSL_NO_DES
|
||||
#error DES is disabled.
|
||||
|
||||
@@ -162,7 +162,18 @@
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)
|
||||
#define ROTATE(a,n) (_lrotr(a,n))
|
||||
#else
|
||||
#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(NO_ASM) && !defined(NO_INLINE_ASM)
|
||||
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
|
||||
# define ROTATE(a,n) ({ register unsigned int ret; \
|
||||
asm ("rorl %1,%0" \
|
||||
: "=r"(ret) \
|
||||
: "I"(n),"0"(a) \
|
||||
: "cc"); \
|
||||
ret; \
|
||||
})
|
||||
# endif
|
||||
#endif
|
||||
#ifndef ROTATE
|
||||
#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n))))
|
||||
#endif
|
||||
|
||||
|
||||
@@ -88,14 +88,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DES_OLD_H
|
||||
#define HEADER_DES_OLD_H
|
||||
#ifndef HEADER_DES_H
|
||||
#define HEADER_DES_H
|
||||
|
||||
#ifdef OPENSSL_NO_DES
|
||||
#error DES is disabled.
|
||||
#endif
|
||||
|
||||
#ifndef HEADER_DES_H
|
||||
#ifndef HEADER_NEW_DES_H
|
||||
#error You must include des.h, not des_old.h directly.
|
||||
#endif
|
||||
|
||||
|
||||
@@ -112,9 +112,6 @@
|
||||
#include <string.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/ui.h>
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
#include <stdio_extras.h> /* BUFSIZ */
|
||||
#endif
|
||||
|
||||
int DES_read_password(DES_cblock *key, const char *prompt, int verify)
|
||||
{
|
||||
@@ -123,8 +120,8 @@ int DES_read_password(DES_cblock *key, const char *prompt, int verify)
|
||||
|
||||
if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
|
||||
DES_string_to_key(buf,key);
|
||||
memset(buf,0,BUFSIZ);
|
||||
memset(buff,0,BUFSIZ);
|
||||
OPENSSL_cleanse(buf,BUFSIZ);
|
||||
OPENSSL_cleanse(buff,BUFSIZ);
|
||||
return(ok);
|
||||
}
|
||||
|
||||
@@ -136,7 +133,7 @@ int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
|
||||
|
||||
if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
|
||||
DES_string_to_2keys(buf,key1,key2);
|
||||
memset(buf,0,BUFSIZ);
|
||||
memset(buff,0,BUFSIZ);
|
||||
OPENSSL_cleanse(buf,BUFSIZ);
|
||||
OPENSSL_cleanse(buff,BUFSIZ);
|
||||
return(ok);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ int des_read_pw_string(char *buf, int length, const char *prompt,
|
||||
int ret;
|
||||
|
||||
ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
|
||||
memset(buff,0,BUFSIZ);
|
||||
OPENSSL_cleanse(buff,BUFSIZ);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ void DES_string_to_key(const char *str, DES_cblock *key)
|
||||
DES_set_key_unchecked(key,&ks);
|
||||
#endif
|
||||
DES_cbc_cksum((const unsigned char*)str,key,length,&ks,key);
|
||||
memset(&ks,0,sizeof(ks));
|
||||
OPENSSL_cleanse(&ks,sizeof(ks));
|
||||
DES_set_odd_parity(key);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2)
|
||||
DES_set_key_unchecked(key2,&ks);
|
||||
#endif
|
||||
DES_cbc_cksum((const unsigned char*)str,key2,length,&ks,key2);
|
||||
memset(&ks,0,sizeof(ks));
|
||||
OPENSSL_cleanse(&ks,sizeof(ks));
|
||||
DES_set_odd_parity(key1);
|
||||
DES_set_odd_parity(key2);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
#include "../bio/bss_file.c"
|
||||
#endif
|
||||
@@ -111,7 +114,7 @@ int main(int argc, char *argv[])
|
||||
RAND_seed(rnd_seed, sizeof rnd_seed);
|
||||
|
||||
out=BIO_new(BIO_s_file());
|
||||
if (out == NULL) exit(1);
|
||||
if (out == NULL) EXIT(1);
|
||||
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||
|
||||
a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out);
|
||||
@@ -195,7 +198,7 @@ err:
|
||||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_remove_state(0);
|
||||
CRYPTO_mem_leaks_fp(stderr);
|
||||
exit(ret);
|
||||
EXIT(ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,11 +224,13 @@ int DSA_size(const DSA *r)
|
||||
{
|
||||
int ret,i;
|
||||
ASN1_INTEGER bs;
|
||||
unsigned char buf[4];
|
||||
unsigned char buf[4]; /* 4 bytes looks really small.
|
||||
However, i2d_ASN1_INTEGER() will not look
|
||||
beyond the first byte, as long as the second
|
||||
parameter is NULL. */
|
||||
|
||||
i=BN_num_bits(r->q);
|
||||
bs.length=(i+7)/8;
|
||||
OPENSSL_assert(bs.length <= sizeof buf);
|
||||
bs.data=buf;
|
||||
bs.type=V_ASN1_INTEGER;
|
||||
/* If the top bit is set the asn1 encoding is 1 larger. */
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/bio.h>
|
||||
@@ -212,10 +215,16 @@ end:
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
}
|
||||
exit(!ret);
|
||||
EXIT(!ret);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int cb_exit(int ec)
|
||||
{
|
||||
EXIT(ec);
|
||||
return(0); /* To keep some compilers quiet */
|
||||
}
|
||||
|
||||
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
|
||||
{
|
||||
char c='*';
|
||||
@@ -231,7 +240,7 @@ static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
|
||||
if (!ok && (p == 0) && (num > 1))
|
||||
{
|
||||
BIO_printf((BIO *)arg,"error in dsatest\n");
|
||||
exit(1);
|
||||
cb_exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ void EC_GROUP_clear_free(EC_GROUP *group)
|
||||
|
||||
EC_GROUP_clear_free_extra_data(group);
|
||||
|
||||
memset(group, 0, sizeof *group);
|
||||
OPENSSL_cleanse(group, sizeof *group);
|
||||
OPENSSL_free(group);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ void EC_POINT_clear_free(EC_POINT *point)
|
||||
point->meth->point_clear_finish(point);
|
||||
else if (point->meth != NULL && point->meth->point_finish != 0)
|
||||
point->meth->point_finish(point);
|
||||
memset(point, 0, sizeof *point);
|
||||
OPENSSL_cleanse(point, sizeof *point);
|
||||
OPENSSL_free(point);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); retur
|
||||
fflush(stdout); \
|
||||
fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \
|
||||
ERR_print_errors_fp(stderr); \
|
||||
exit(1); \
|
||||
EXIT(1); \
|
||||
} while (0)
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -79,6 +79,21 @@
|
||||
/* #define TEST_ENG_OPENSSL_SHA_P_UPDATE */
|
||||
/* #define TEST_ENG_OPENSSL_SHA_P_FINAL */
|
||||
|
||||
/* Now check what of those algorithms are actually enabled */
|
||||
#ifdef OPENSSL_NO_RC4
|
||||
#undef TEST_ENG_OPENSSL_RC4
|
||||
#undef TEST_ENG_OPENSSL_RC4_OTHERS
|
||||
#undef TEST_ENG_OPENSSL_RC4_P_INIT
|
||||
#undef TEST_ENG_OPENSSL_RC4_P_CIPHER
|
||||
#endif
|
||||
#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) || defined(OPENSSL_NO_SHA1)
|
||||
#undef TEST_ENG_OPENSSL_SHA
|
||||
#undef TEST_ENG_OPENSSL_SHA_OTHERS
|
||||
#undef TEST_ENG_OPENSSL_SHA_P_INIT
|
||||
#undef TEST_ENG_OPENSSL_SHA_P_UPDATE
|
||||
#undef TEST_ENG_OPENSSL_SHA_P_FINAL
|
||||
#endif
|
||||
|
||||
#ifdef TEST_ENG_OPENSSL_RC4
|
||||
static int openssl_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
|
||||
const int **nids, int nid);
|
||||
|
||||
@@ -58,9 +58,6 @@
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include <stdio.h>
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
#include <stdlib_extras.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
@@ -717,7 +717,7 @@ static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len,
|
||||
|
||||
if (type == NID_sha1 || type == NID_md5)
|
||||
{
|
||||
memset(hashBuffer, 0, keyLength+1);
|
||||
OPENSSL_cleanse(hashBuffer, keyLength+1);
|
||||
OPENSSL_free(hashBuffer);
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,
|
||||
|
||||
if (type == NID_sha1 || type == NID_md5)
|
||||
{
|
||||
memset(hashBuffer, 0, keyLength+1);
|
||||
OPENSSL_cleanse(hashBuffer, keyLength+1);
|
||||
OPENSSL_free(hashBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,18 @@ ENGINE_load_cryptodev(void)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#if OpenBSD < 200112
|
||||
|
||||
void
|
||||
ENGINE_load_cryptodev(void)
|
||||
{
|
||||
/* This is a NOP unless we have release 3.0 (released december 2001) */
|
||||
return;
|
||||
}
|
||||
|
||||
#else /* OpenBSD 3.0 or above */
|
||||
|
||||
#include <crypto/cryptodev.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
@@ -1114,4 +1126,5 @@ ENGINE_load_cryptodev(void)
|
||||
ERR_clear_error();
|
||||
}
|
||||
|
||||
#endif /* OpenBSD 3.0 or above */
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
@@ -91,11 +91,19 @@ static int hwcrhk_init(ENGINE *e);
|
||||
static int hwcrhk_finish(ENGINE *e);
|
||||
static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
|
||||
|
||||
/* Functions to handle mutexes */
|
||||
/* Functions to handle mutexes if have dynamic locks */
|
||||
static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*);
|
||||
static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*);
|
||||
static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*);
|
||||
static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*);
|
||||
#if 1 /* This is a HACK which will disappear in 0.9.8 */
|
||||
/* Functions to handle mutexes if only have static locks */
|
||||
static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
|
||||
HWCryptoHook_CallerContext *c);
|
||||
static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m);
|
||||
static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m);
|
||||
static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m);
|
||||
#endif
|
||||
|
||||
/* BIGNUM stuff */
|
||||
static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
@@ -560,15 +568,31 @@ static int hwcrhk_init(ENGINE *e)
|
||||
|
||||
/* Check if the application decided to support dynamic locks,
|
||||
and if it does, use them. */
|
||||
if (disable_mutex_callbacks == 0 &&
|
||||
CRYPTO_get_dynlock_create_callback() != NULL &&
|
||||
CRYPTO_get_dynlock_lock_callback() != NULL &&
|
||||
CRYPTO_get_dynlock_destroy_callback() != NULL)
|
||||
if (disable_mutex_callbacks == 0)
|
||||
{
|
||||
hwcrhk_globals.mutex_init = hwcrhk_mutex_init;
|
||||
hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock;
|
||||
hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
|
||||
hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
|
||||
if (CRYPTO_get_dynlock_create_callback() != NULL &&
|
||||
CRYPTO_get_dynlock_lock_callback() != NULL &&
|
||||
CRYPTO_get_dynlock_destroy_callback() != NULL)
|
||||
{
|
||||
hwcrhk_globals.mutex_init = hwcrhk_mutex_init;
|
||||
hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock;
|
||||
hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
|
||||
hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
|
||||
}
|
||||
else if (CRYPTO_get_locking_callback() != NULL)
|
||||
{
|
||||
HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING);
|
||||
ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()");
|
||||
#if 1 /* This is a HACK which will disappear in 0.9.8 */
|
||||
hwcrhk_globals.maxmutexes = 1; /* Only have one lock */
|
||||
hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init;
|
||||
hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock;
|
||||
hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock;
|
||||
hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy;
|
||||
#else
|
||||
goto err;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Try and get a context - if not, we may have a DSO but no
|
||||
@@ -1022,7 +1046,7 @@ static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa)
|
||||
|
||||
/* Perform the operation */
|
||||
ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q,
|
||||
m_dmp1, m_dmq1, m_iqmp, &m_r, NULL);
|
||||
m_dmp1, m_dmq1, m_iqmp, &m_r, &rmsg);
|
||||
|
||||
/* Convert the response */
|
||||
r->top = m_r.size / sizeof(BN_ULONG);
|
||||
@@ -1173,6 +1197,26 @@ static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt)
|
||||
CRYPTO_destroy_dynlockid(mt->lockid);
|
||||
}
|
||||
|
||||
/* Mutex upcalls to use if the application does not support dynamic locks */
|
||||
|
||||
static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
|
||||
HWCryptoHook_CallerContext *c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m)
|
||||
{
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK);
|
||||
return 0;
|
||||
}
|
||||
static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m)
|
||||
{
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK);
|
||||
}
|
||||
static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m)
|
||||
{
|
||||
}
|
||||
|
||||
static int hwcrhk_get_pass(const char *prompt_info,
|
||||
int *len_io, char *buf,
|
||||
HWCryptoHook_PassphraseContext *ppctx,
|
||||
@@ -1320,7 +1364,7 @@ static void hwcrhk_log_message(void *logstr, const char *message)
|
||||
lstream=*(BIO **)logstr;
|
||||
if (lstream)
|
||||
{
|
||||
BIO_write(lstream, message, strlen(message));
|
||||
BIO_printf(lstream, "%s\n", message);
|
||||
}
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_BIO);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* hw_ncipher_err.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -86,6 +86,7 @@ static ERR_STRING_DATA HWCRHK_str_reasons[]=
|
||||
{HWCRHK_R_CHIL_ERROR ,"chil error"},
|
||||
{HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
|
||||
{HWCRHK_R_DSO_FAILURE ,"dso failure"},
|
||||
{HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"},
|
||||
{HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"},
|
||||
{HWCRHK_R_NOT_INITIALISED ,"not initialised"},
|
||||
{HWCRHK_R_NOT_LOADED ,"not loaded"},
|
||||
|
||||
@@ -84,6 +84,7 @@ static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
|
||||
#define HWCRHK_R_CHIL_ERROR 102
|
||||
#define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
|
||||
#define HWCRHK_R_DSO_FAILURE 104
|
||||
#define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114
|
||||
#define HWCRHK_R_MISSING_KEY_COMPONENTS 105
|
||||
#define HWCRHK_R_NOT_INITIALISED 106
|
||||
#define HWCRHK_R_NOT_LOADED 107
|
||||
|
||||
@@ -907,7 +907,7 @@ static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned c
|
||||
err:
|
||||
if (buf)
|
||||
{
|
||||
memset(buf,0,tlen);
|
||||
OPENSSL_cleanse(buf,tlen);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -81,7 +81,7 @@ int ENGINE_register_ciphers(ENGINE *e)
|
||||
int num_nids = e->ciphers(e, NULL, &nids, 0);
|
||||
if(num_nids > 0)
|
||||
return engine_table_register(&cipher_table,
|
||||
&engine_unregister_all_ciphers, e, nids,
|
||||
engine_unregister_all_ciphers, e, nids,
|
||||
num_nids, 0);
|
||||
}
|
||||
return 1;
|
||||
@@ -103,7 +103,7 @@ int ENGINE_set_default_ciphers(ENGINE *e)
|
||||
int num_nids = e->ciphers(e, NULL, &nids, 0);
|
||||
if(num_nids > 0)
|
||||
return engine_table_register(&cipher_table,
|
||||
&engine_unregister_all_ciphers, e, nids,
|
||||
engine_unregister_all_ciphers, e, nids,
|
||||
num_nids, 1);
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -78,7 +78,7 @@ int ENGINE_register_DH(ENGINE *e)
|
||||
{
|
||||
if(e->dh_meth)
|
||||
return engine_table_register(&dh_table,
|
||||
&engine_unregister_all_DH, e, &dummy_nid, 1, 0);
|
||||
engine_unregister_all_DH, e, &dummy_nid, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ int ENGINE_set_default_DH(ENGINE *e)
|
||||
{
|
||||
if(e->dh_meth)
|
||||
return engine_table_register(&dh_table,
|
||||
&engine_unregister_all_DH, e, &dummy_nid, 1, 1);
|
||||
engine_unregister_all_DH, e, &dummy_nid, 1, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ int ENGINE_register_digests(ENGINE *e)
|
||||
int num_nids = e->digests(e, NULL, &nids, 0);
|
||||
if(num_nids > 0)
|
||||
return engine_table_register(&digest_table,
|
||||
&engine_unregister_all_digests, e, nids,
|
||||
engine_unregister_all_digests, e, nids,
|
||||
num_nids, 0);
|
||||
}
|
||||
return 1;
|
||||
@@ -103,7 +103,7 @@ int ENGINE_set_default_digests(ENGINE *e)
|
||||
int num_nids = e->digests(e, NULL, &nids, 0);
|
||||
if(num_nids > 0)
|
||||
return engine_table_register(&digest_table,
|
||||
&engine_unregister_all_digests, e, nids,
|
||||
engine_unregister_all_digests, e, nids,
|
||||
num_nids, 1);
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -78,7 +78,7 @@ int ENGINE_register_DSA(ENGINE *e)
|
||||
{
|
||||
if(e->dsa_meth)
|
||||
return engine_table_register(&dsa_table,
|
||||
&engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
|
||||
engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ int ENGINE_set_default_DSA(ENGINE *e)
|
||||
{
|
||||
if(e->dsa_meth)
|
||||
return engine_table_register(&dsa_table,
|
||||
&engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
|
||||
engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ int ENGINE_register_RAND(ENGINE *e)
|
||||
{
|
||||
if(e->rand_meth)
|
||||
return engine_table_register(&rand_table,
|
||||
&engine_unregister_all_RAND, e, &dummy_nid, 1, 0);
|
||||
engine_unregister_all_RAND, e, &dummy_nid, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ int ENGINE_set_default_RAND(ENGINE *e)
|
||||
{
|
||||
if(e->rand_meth)
|
||||
return engine_table_register(&rand_table,
|
||||
&engine_unregister_all_RAND, e, &dummy_nid, 1, 1);
|
||||
engine_unregister_all_RAND, e, &dummy_nid, 1, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ int ENGINE_register_RSA(ENGINE *e)
|
||||
{
|
||||
if(e->rsa_meth)
|
||||
return engine_table_register(&rsa_table,
|
||||
&engine_unregister_all_RSA, e, &dummy_nid, 1, 0);
|
||||
engine_unregister_all_RSA, e, &dummy_nid, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ int ENGINE_set_default_RSA(ENGINE *e)
|
||||
{
|
||||
if(e->rsa_meth)
|
||||
return engine_table_register(&rsa_table,
|
||||
&engine_unregister_all_RSA, e, &dummy_nid, 1, 1);
|
||||
engine_unregister_all_RSA, e, &dummy_nid, 1, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user