Compare commits
19 Commits
SSLeay_0_9
...
OpenSSL_0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
320a14cb5b | ||
|
|
f10a5c2a96 | ||
|
|
9ce5db45be | ||
|
|
457c8a3965 | ||
|
|
5f32680329 | ||
|
|
9acc2aa6d1 | ||
|
|
f1c236f849 | ||
|
|
f92e687e17 | ||
|
|
305f402e75 | ||
|
|
c537fb08cd | ||
|
|
13e91dd365 | ||
|
|
8c6c8d80b7 | ||
|
|
651d0aff98 | ||
|
|
31b8d86844 | ||
|
|
7dfb0b774e | ||
|
|
78414a6a89 | ||
|
|
eda1f21f1a | ||
|
|
b7896b3cb8 | ||
|
|
90718ac527 |
168
CHANGES
Normal file
168
CHANGES
Normal file
@@ -0,0 +1,168 @@
|
||||
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
|
||||
Changes between 0.9.01c and 0.9.1d
|
||||
|
||||
Changes between 0.9.01b and 0.9.1c
|
||||
|
||||
*) Added OPENSSL_VERSION_NUMBER to crypto/crypto.h and
|
||||
changed SSLeay to OpenSSL in version strings.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Some fixups to the top-level documents.
|
||||
[Paul Sutton]
|
||||
|
||||
*) Fixed the nasty bug where rsaref.h was not found under compile-time
|
||||
because the symlink to include/ was missing.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Incorporated the popular no-RSA/DSA-only patches
|
||||
which allow to compile a RSA-free SSLeay.
|
||||
[Andrew Cooke / Interrader Ldt., Ralf S. Engelschall]
|
||||
|
||||
*) Fixed nasty rehash problem under `make -f Makefile.ssl links'
|
||||
when "ssleay" is still not found.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Added more platforms to Configure: Cray T3E, HPUX 11,
|
||||
[Ralf S. Engelschall, Beckmann <beckman@acl.lanl.gov>]
|
||||
|
||||
*) Updated the README file.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Added various .cvsignore files in the CVS repository subdirs
|
||||
to make a "cvs update" really silent.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Recompiled the error-definition header files and added
|
||||
missing symbols to the Win32 linker tables.
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Cleaned up the top-level documents;
|
||||
o new files: CHANGES and LICENSE
|
||||
o merged VERSION, HISTORY* and README* files a CHANGES.SSLeay
|
||||
o merged COPYRIGHT into LICENSE
|
||||
o removed obsolete TODO file
|
||||
o renamed MICROSOFT to INSTALL.W32
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Removed dummy files from the 0.9.1b source tree:
|
||||
crypto/asn1/x crypto/bio/cd crypto/bio/fg crypto/bio/grep crypto/bio/vi
|
||||
crypto/bn/asm/......add.c crypto/bn/asm/a.out crypto/dsa/f crypto/md5/f
|
||||
crypto/pem/gmon.out crypto/perlasm/f crypto/pkcs7/build crypto/rsa/f
|
||||
crypto/sha/asm/f crypto/threads/f ms/zzz ssl/f ssl/f.mak test/f
|
||||
util/f.mak util/pl/f util/pl/f.mak crypto/bf/bf_locl.old apps/f
|
||||
[Ralf S. Engelschall]
|
||||
|
||||
*) Added various platform portability fixes.
|
||||
[Mark J. Cox]
|
||||
|
||||
*) The Genesis of the OpenSSL rpject:
|
||||
We start with the latest (unreleased) SSLeay version 0.9.1b which Eric A.
|
||||
Joung and Tim J. Hudson created while they were working for C2Net until
|
||||
summer 1998.
|
||||
[The OpenSSL Project]
|
||||
|
||||
Changes between 0.9.0b and 0.9.1b
|
||||
|
||||
*) Updated a few CA certificates under certs/
|
||||
[Eric A. Young]
|
||||
|
||||
*) Changed some BIGNUM api stuff.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Various platform ports: OpenBSD, Ultrix, IRIX 64bit, NetBSD,
|
||||
DGUX x86, Linux Alpha, etc.
|
||||
[Eric A. Young]
|
||||
|
||||
*) New COMP library [crypto/comp/] for SSL Record Layer Compression:
|
||||
RLE (dummy implemented) and ZLIB (really implemented when ZLIB is
|
||||
available).
|
||||
[Eric A. Young]
|
||||
|
||||
*) Add -strparse option to asn1pars program which parses nested
|
||||
binary structures
|
||||
[Dr Stephen Henson <shenson@bigfoot.com>]
|
||||
|
||||
*) Added "oid_file" to ssleay.cnf for "ca" and "req" programs.
|
||||
[Eric A. Young]
|
||||
|
||||
*) DSA fix for "ca" program.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added "-genkey" option to "dsaparam" program.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added RIPE MD160 (rmd160) message digest.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added -a (all) option to "ssleay version" command.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added PLATFORM define which is the id given to Configure.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added MemCheck_XXXX functions to crypto/mem.c for memory checking.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Extended the ASN.1 parser routines.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Extended BIO routines to support REUSEADDR, seek, tell, etc.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added a BN_CTX to the BN library.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Fixed the weak key values in DES library
|
||||
[Eric A. Young]
|
||||
|
||||
*) Changed API in EVP library for cipher aliases.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added support for RC2/64bit cipher.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Converted the lhash library to the crypto/mem.c functions.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added more recognized ASN.1 object ids.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added more RSA padding checks for SSL/TLS.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added BIO proxy/filter functionality.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added extra_certs to SSL_CTX which can be used
|
||||
send extra CA certificates to the client in the CA cert chain sending
|
||||
process. It can be configured with SSL_CTX_add_extra_chain_cert().
|
||||
[Eric A. Young]
|
||||
|
||||
*) Now Fortezza is denied in the authentication phase because
|
||||
this is key exchange mechanism is not supported by SSLeay at all.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Additional PKCS1 checks.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Support the string "TLSv1" for all TLS v1 ciphers.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Added function SSL_get_ex_data_X509_STORE_CTX_idx() which gives the
|
||||
ex_data index of the SSL context in the X509_STORE_CTX ex_data.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Fixed a few memory leaks.
|
||||
[Eric A. Young]
|
||||
|
||||
*) Fixed various code and comment typos.
|
||||
[Eric A. Young]
|
||||
|
||||
*) A minor bug in ssl/s3_clnt.c where there would always be 4 0
|
||||
bytes sent in the client random.
|
||||
[Edward Bishop <ebishop@spyglass.com>]
|
||||
|
||||
@@ -1,4 +1,529 @@
|
||||
SSLeay 0.6.5
|
||||
This file contains the changes for the SSLeay library up to version
|
||||
0.9.0b. For later changes, see the file "CHANGES".
|
||||
|
||||
SSLeay CHANGES
|
||||
______________
|
||||
|
||||
Changes between 0.8.x and 0.9.0b
|
||||
|
||||
10-Apr-1998
|
||||
|
||||
I said the next version would go out at easter, and so it shall.
|
||||
I expect a 0.9.1 will follow with portability fixes in the next few weeks.
|
||||
|
||||
This is a quick, meet the deadline. Look to ssl-users for comments on what
|
||||
is new etc.
|
||||
|
||||
eric (about to go bushwalking for the 4 day easter break :-)
|
||||
|
||||
16-Mar-98
|
||||
- Patch for Cray T90 from Wayne Schroeder <schroede@SDSC.EDU>
|
||||
- Lots and lots of changes
|
||||
|
||||
29-Jan-98
|
||||
- ASN1_BIT_STRING_set_bit()/ASN1_BIT_STRING_get_bit() from
|
||||
Goetz Babin-Ebell <babinebell@trustcenter.de>.
|
||||
- SSL_version() now returns SSL2_VERSION, SSL3_VERSION or
|
||||
TLS1_VERSION.
|
||||
|
||||
7-Jan-98
|
||||
- Finally reworked the cipher string to ciphers again, so it
|
||||
works correctly
|
||||
- All the app_data stuff is now ex_data with funcion calls to access.
|
||||
The index is supplied by a function and 'methods' can be setup
|
||||
for the types that are called on XXX_new/XXX_free. This lets
|
||||
applications get notified on creation and destruction. Some of
|
||||
the RSA methods could be implemented this way and I may do so.
|
||||
- Oh yes, SSL under perl5 is working at the basic level.
|
||||
|
||||
15-Dec-97
|
||||
- Warning - the gethostbyname cache is not fully thread safe,
|
||||
but it should work well enough.
|
||||
- Major internal reworking of the app_data stuff. More functions
|
||||
but if you were accessing ->app_data directly, things will
|
||||
stop working.
|
||||
- The perlv5 stuff is working. Currently on message digests,
|
||||
ciphers and the bignum library.
|
||||
|
||||
9-Dec-97
|
||||
- Modified re-negotiation so that server initated re-neg
|
||||
will cause a SSL_read() to return -1 should retry.
|
||||
The danger otherwise was that the server and the
|
||||
client could end up both trying to read when using non-blocking
|
||||
sockets.
|
||||
|
||||
4-Dec-97
|
||||
- Lots of small changes
|
||||
- Fix for binaray mode in Windows for the FILE BIO, thanks to
|
||||
Bob Denny <rdenny@dc3.com>
|
||||
|
||||
17-Nov-97
|
||||
- Quite a few internal cleanups, (removal of errno, and using macros
|
||||
defined in e_os.h).
|
||||
- A bug in ca.c, pointed out by yasuyuki-ito@d-cruise.co.jp, where
|
||||
the automactic naming out output files was being stuffed up.
|
||||
|
||||
29-Oct-97
|
||||
- The Cast5 cipher has been added. MD5 and SHA-1 are now in assember
|
||||
for x86.
|
||||
|
||||
21-Oct-97
|
||||
- Fixed a bug in the BIO_gethostbyname() cache.
|
||||
|
||||
15-Oct-97
|
||||
- cbc mode for blowfish/des/3des is now in assember. Blowfish asm
|
||||
has also been improved. At this point in time, on the pentium,
|
||||
md5 is %80 faster, the unoptimesed sha-1 is %79 faster,
|
||||
des-cbc is %28 faster, des-ede3-cbc is %9 faster and blowfish-cbc
|
||||
is %62 faster.
|
||||
|
||||
12-Oct-97
|
||||
- MEM_BUF_grow() has been fixed so that it always sets the buf->length
|
||||
to the value we are 'growing' to. Think of MEM_BUF_grow() as the
|
||||
way to set the length value correctly.
|
||||
|
||||
10-Oct-97
|
||||
- I now hash for certificate lookup on the raw DER encoded RDN (md5).
|
||||
This breaks things again :-(. This is efficent since I cache
|
||||
the DER encoding of the RDN.
|
||||
- The text DN now puts in the numeric OID instead of UNKNOWN.
|
||||
- req can now process arbitary OIDs in the config file.
|
||||
- I've been implementing md5 in x86 asm, much faster :-).
|
||||
- Started sha1 in x86 asm, needs more work.
|
||||
- Quite a few speedups in the BN stuff. RSA public operation
|
||||
has been made faster by caching the BN_MONT_CTX structure.
|
||||
The calulating of the Ai where A*Ai === 1 mod m was rather
|
||||
expensive. Basically a 40-50% speedup on public operations.
|
||||
The RSA speedup is now 15% on pentiums and %20 on pentium
|
||||
pro.
|
||||
|
||||
30-Sep-97
|
||||
- After doing some profiling, I added x86 adm for bn_add_words(),
|
||||
which just adds 2 arrays of longs together. A %10 speedup
|
||||
for 512 and 1024 bit RSA on the pentium pro.
|
||||
|
||||
29-Sep-97
|
||||
- Converted the x86 bignum assembler to us the perl scripts
|
||||
for generation.
|
||||
|
||||
23-Sep-97
|
||||
- If SSL_set_session() is passed a NULL session, it now clears the
|
||||
current session-id.
|
||||
|
||||
22-Sep-97
|
||||
- Added a '-ss_cert file' to apps/ca.c. This will sign selfsigned
|
||||
certificates.
|
||||
- Bug in crypto/evp/encode.c where by decoding of 65 base64
|
||||
encoded lines, one line at a time (via a memory BIO) would report
|
||||
EOF after the first line was decoded.
|
||||
- Fix in X509_find_by_issuer_and_serial() from
|
||||
Dr Stephen Henson <shenson@bigfoot.com>
|
||||
|
||||
19-Sep-97
|
||||
- NO_FP_API and NO_STDIO added.
|
||||
- Put in sh config command. It auto runs Configure with the correct
|
||||
parameters.
|
||||
|
||||
18-Sep-97
|
||||
- Fix x509.c so if a DSA cert has different parameters to its parent,
|
||||
they are left in place. Not tested yet.
|
||||
|
||||
16-Sep-97
|
||||
- ssl_create_cipher_list() had some bugs, fixes from
|
||||
Patrick Eisenacher <eisenach@stud.uni-frankfurt.de>
|
||||
- Fixed a bug in the Base64 BIO, where it would return 1 instead
|
||||
of -1 when end of input was encountered but should retry.
|
||||
Basically a Base64/Memory BIO interaction problem.
|
||||
- Added a HMAC set of functions in preporarion for TLS work.
|
||||
|
||||
15-Sep-97
|
||||
- Top level makefile tweak - Cameron Simpson <cs@zip.com.au>
|
||||
- Prime generation spead up %25 (512 bit prime, pentium pro linux)
|
||||
by using montgomery multiplication in the prime number test.
|
||||
|
||||
11-Sep-97
|
||||
- Ugly bug in ssl3_write_bytes(). Basically if application land
|
||||
does a SSL_write(ssl,buf,len) where len > 16k, the SSLv3 write code
|
||||
did not check the size and tried to copy the entire buffer.
|
||||
This would tend to cause memory overwrites since SSLv3 has
|
||||
a maximum packet size of 16k. If your program uses
|
||||
buffers <= 16k, you would probably never see this problem.
|
||||
- Fixed a new errors that were cause by malloc() not returning
|
||||
0 initialised memory..
|
||||
- SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using
|
||||
SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing
|
||||
since this flags stops SSLeay being able to handle client
|
||||
cert requests correctly.
|
||||
|
||||
08-Sep-97
|
||||
- SSL_SESS_CACHE_NO_INTERNAL_LOOKUP option added. When switched
|
||||
on, the SSL server routines will not use a SSL_SESSION that is
|
||||
held in it's cache. This in intended to be used with the session-id
|
||||
callbacks so that while the session-ids are still stored in the
|
||||
cache, the decision to use them and how to look them up can be
|
||||
done by the callbacks. The are the 'new', 'get' and 'remove'
|
||||
callbacks. This can be used to determine the session-id
|
||||
to use depending on information like which port/host the connection
|
||||
is coming from. Since the are also SSL_SESSION_set_app_data() and
|
||||
SSL_SESSION_get_app_data() functions, the application can hold
|
||||
information against the session-id as well.
|
||||
|
||||
03-Sep-97
|
||||
- Added lookup of CRLs to the by_dir method,
|
||||
X509_load_crl_file() also added. Basically it means you can
|
||||
lookup CRLs via the same system used to lookup certificates.
|
||||
- Changed things so that the X509_NAME structure can contain
|
||||
ASN.1 BIT_STRINGS which is required for the unique
|
||||
identifier OID.
|
||||
- Fixed some problems with the auto flushing of the session-id
|
||||
cache. It was not occuring on the server side.
|
||||
|
||||
02-Sep-97
|
||||
- Added SSL_CTX_sess_cache_size(SSL_CTX *ctx,unsigned long size)
|
||||
which is the maximum number of entries allowed in the
|
||||
session-id cache. This is enforced with a simple FIFO list.
|
||||
The default size is 20*1024 entries which is rather large :-).
|
||||
The Timeout code is still always operating.
|
||||
|
||||
01-Sep-97
|
||||
- Added an argument to all the 'generate private key/prime`
|
||||
callbacks. It is the last parameter so this should not
|
||||
break existing code but it is needed for C++.
|
||||
- Added the BIO_FLAGS_BASE64_NO_NL flag for the BIO_f_base64()
|
||||
BIO. This lets the BIO read and write base64 encoded data
|
||||
without inserting or looking for '\n' characters. The '-A'
|
||||
flag turns this on when using apps/enc.c.
|
||||
- RSA_NO_PADDING added to help BSAFE functionality. This is a
|
||||
very dangerous thing to use, since RSA private key
|
||||
operations without random padding bytes (as PKCS#1 adds) can
|
||||
be attacked such that the private key can be revealed.
|
||||
- ASN.1 bug and rc2-40-cbc and rc4-40 added by
|
||||
Dr Stephen Henson <shenson@bigfoot.com>
|
||||
|
||||
31-Aug-97 (stuff added while I was away)
|
||||
- Linux pthreads by Tim Hudson (tjh@cryptsoft.com).
|
||||
- RSA_flags() added allowing bypass of pub/priv match check
|
||||
in ssl/ssl_rsa.c - Tim Hudson.
|
||||
- A few minor bugs.
|
||||
|
||||
SSLeay 0.8.1 released.
|
||||
|
||||
19-Jul-97
|
||||
- Server side initated dynamic renegotiation is broken. I will fix
|
||||
it when I get back from holidays.
|
||||
|
||||
15-Jul-97
|
||||
- Quite a few small changes.
|
||||
- INVALID_SOCKET usage cleanups from Alex Kiernan <alex@hisoft.co.uk>
|
||||
|
||||
09-Jul-97
|
||||
- Added 2 new values to the SSL info callback.
|
||||
SSL_CB_START which is passed when the SSL protocol is started
|
||||
and SSL_CB_DONE when it has finished sucsessfully.
|
||||
|
||||
08-Jul-97
|
||||
- Fixed a few bugs problems in apps/req.c and crypto/asn1/x_pkey.c
|
||||
that related to DSA public/private keys.
|
||||
- Added all the relevent PEM and normal IO functions to support
|
||||
reading and writing RSAPublic keys.
|
||||
- Changed makefiles to use ${AR} instead of 'ar r'
|
||||
|
||||
07-Jul-97
|
||||
- Error in ERR_remove_state() that would leave a dangling reference
|
||||
to a free()ed location - thanks to Alex Kiernan <alex@hisoft.co.uk>
|
||||
- s_client now prints the X509_NAMEs passed from the server
|
||||
when requesting a client cert.
|
||||
- Added a ssl->type, which is one of SSL_ST_CONNECT or
|
||||
SSL_ST_ACCEPT. I had to add it so I could tell if I was
|
||||
a connect or an accept after the handshake had finished.
|
||||
- SSL_get_client_CA_list(SSL *s) now returns the CA names
|
||||
passed by the server if called by a client side SSL.
|
||||
|
||||
05-Jul-97
|
||||
- Bug in X509_NAME_get_text_by_OBJ(), looking starting at index
|
||||
0, not -1 :-( Fix from Tim Hudson (tjh@cryptsoft.com).
|
||||
|
||||
04-Jul-97
|
||||
- Fixed some things in X509_NAME_add_entry(), thanks to
|
||||
Matthew Donald <matthew@world.net>.
|
||||
- I had a look at the cipher section and though that it was a
|
||||
bit confused, so I've changed it.
|
||||
- I was not setting up the RC4-64-MD5 cipher correctly. It is
|
||||
a MS special that appears in exported MS Money.
|
||||
- Error in all my DH ciphers. Section 7.6.7.3 of the SSLv3
|
||||
spec. I was missing the two byte length header for the
|
||||
ClientDiffieHellmanPublic value. This is a packet sent from
|
||||
the client to the server. The SSL_OP_SSLEAY_080_CLIENT_DH_BUG
|
||||
option will enable SSLeay server side SSLv3 accept either
|
||||
the correct or my 080 packet format.
|
||||
- Fixed a few typos in crypto/pem.org.
|
||||
|
||||
02-Jul-97
|
||||
- Alias mapping for EVP_get_(digest|cipher)byname is now
|
||||
performed before a lookup for actual cipher. This means
|
||||
that an alias can be used to 're-direct' a cipher or a
|
||||
digest.
|
||||
- ASN1_read_bio() had a bug that only showed up when using a
|
||||
memory BIO. When EOF is reached in the memory BIO, it is
|
||||
reported as a -1 with BIO_should_retry() set to true.
|
||||
|
||||
01-Jul-97
|
||||
- Fixed an error in X509_verify_cert() caused by my
|
||||
miss-understanding how 'do { contine } while(0);' works.
|
||||
Thanks to Emil Sit <sit@mit.edu> for educating me :-)
|
||||
|
||||
30-Jun-97
|
||||
- Base64 decoding error. If the last data line did not end with
|
||||
a '=', sometimes extra data would be returned.
|
||||
- Another 'cut and paste' bug in x509.c related to setting up the
|
||||
STDout BIO.
|
||||
|
||||
27-Jun-97
|
||||
- apps/ciphers.c was not printing due to an editing error.
|
||||
- Alex Kiernan <alex@hisoft.co.uk> send in a nice fix for
|
||||
a library build error in util/mk1mf.pl
|
||||
|
||||
26-Jun-97
|
||||
- Still did not have the auto 'experimental' code removal
|
||||
script correct.
|
||||
- A few header tweaks for Watcom 11.0 under Win32 from
|
||||
Rolf Lindemann <Lindemann@maz-hh.de>
|
||||
- 0 length OCTET_STRING bug in asn1_parse
|
||||
- A minor fix with an non-existent function in the MS .def files.
|
||||
- A few changes to the PKCS7 stuff.
|
||||
|
||||
25-Jun-97
|
||||
SSLeay 0.8.0 finally it gets released.
|
||||
|
||||
24-Jun-97
|
||||
Added a SSL_OP_EPHEMERAL_RSA option which causes all SSLv3 RSA keys to
|
||||
use a temporary RSA key. This is experimental and needs some more work.
|
||||
Fixed a few Win16 build problems.
|
||||
|
||||
23-Jun-97
|
||||
SSLv3 bug. I was not doing the 'lookup' of the CERT structure
|
||||
correctly. I was taking the SSL->ctx->default_cert when I should
|
||||
have been using SSL->cert. The bug was in ssl/s3_srvr.c
|
||||
|
||||
20-Jun-97
|
||||
X509_ATTRIBUTES were being encoded wrongly by apps/reg.c and the
|
||||
rest of the library. Even though I had the code required to do
|
||||
it correctly, apps/req.c was doing the wrong thing. I have fixed
|
||||
and tested everything.
|
||||
|
||||
Missing a few #ifdef FIONBIO sections in crypto/bio/bss_acpt.c.
|
||||
|
||||
19-Jun-97
|
||||
Fixed a bug in the SSLv2 server side first packet handling. When
|
||||
using the non-blocking test BIO, the ssl->s2->first_packet flag
|
||||
was being reset when a would-block failure occurred when reading
|
||||
the first 5 bytes of the first packet. This caused the checking
|
||||
logic to run at the wrong time and cause an error.
|
||||
|
||||
Fixed a problem with specifying cipher. If RC4-MD5 were used,
|
||||
only the SSLv3 version would be picked up. Now this will pick
|
||||
up both SSLv2 and SSLv3 versions. This required changing the
|
||||
SSL_CIPHER->mask values so that they only mask the ciphers,
|
||||
digests, authentication, export type and key-exchange algorithms.
|
||||
|
||||
I found that when a SSLv23 session is established, a reused
|
||||
session, of type SSLv3 was attempting to write the SSLv2
|
||||
ciphers, which were invalid. The SSL_METHOD->put_cipher_by_char
|
||||
method has been modified so it will only write out cipher which
|
||||
that method knows about.
|
||||
|
||||
|
||||
Changes between 0.8.0 and 0.8.1
|
||||
|
||||
*) Mostly bug fixes.
|
||||
There is an Ephemeral DH cipher problem which is fixed.
|
||||
|
||||
SSLeay 0.8.0
|
||||
|
||||
This version of SSLeay has quite a lot of things different from the
|
||||
previous version.
|
||||
|
||||
Basically check all callback parameters, I will be producing documentation
|
||||
about how to use things in th future. Currently I'm just getting 080 out
|
||||
the door. Please not that there are several ways to do everything, and
|
||||
most of the applications in the apps directory are hybrids, some using old
|
||||
methods and some using new methods.
|
||||
|
||||
Have a look in demos/bio for some very simple programs and
|
||||
apps/s_client.c and apps/s_server.c for some more advanced versions.
|
||||
Notes are definitly needed but they are a week or so away.
|
||||
|
||||
Anyway, some quick nots from Tim Hudson (tjh@cryptsoft.com)
|
||||
---
|
||||
Quick porting notes for moving from SSLeay-0.6.x to SSLeay-0.8.x to
|
||||
get those people that want to move to using the new code base off to
|
||||
a quick start.
|
||||
|
||||
Note that Eric has tidied up a lot of the areas of the API that were
|
||||
less than desirable and renamed quite a few things (as he had to break
|
||||
the API in lots of places anyrate). There are a whole pile of additional
|
||||
functions for making dealing with (and creating) certificates a lot
|
||||
cleaner.
|
||||
|
||||
01-Jul-97
|
||||
Tim Hudson
|
||||
tjh@cryptsoft.com
|
||||
|
||||
---8<---
|
||||
|
||||
To maintain code that uses both SSLeay-0.6.x and SSLeay-0.8.x you could
|
||||
use something like the following (assuming you #include "crypto.h" which
|
||||
is something that you really should be doing).
|
||||
|
||||
#if SSLEAY_VERSION_NUMBER >= 0x0800
|
||||
#define SSLEAY8
|
||||
#endif
|
||||
|
||||
buffer.h -> splits into buffer.h and bio.h so you need to include bio.h
|
||||
too if you are working with BIO internal stuff (as distinct
|
||||
from simply using the interface in an opaque manner)
|
||||
|
||||
#include "bio.h" - required along with "buffer.h" if you write
|
||||
your own BIO routines as the buffer and bio
|
||||
stuff that was intermixed has been separated
|
||||
out
|
||||
|
||||
envelope.h -> evp.h (which should have been done ages ago)
|
||||
|
||||
Initialisation ... don't forget these or you end up with code that
|
||||
is missing the bits required to do useful things (like ciphers):
|
||||
|
||||
SSLeay_add_ssl_algorithms()
|
||||
(probably also want SSL_load_error_strings() too but you should have
|
||||
already had that call in place)
|
||||
|
||||
SSL_CTX_new() - requires an extra method parameter
|
||||
SSL_CTX_new(SSLv23_method())
|
||||
SSL_CTX_new(SSLv2_method())
|
||||
SSL_CTX_new(SSLv3_method())
|
||||
|
||||
OR to only have the server or the client code
|
||||
SSL_CTX_new(SSLv23_server_method())
|
||||
SSL_CTX_new(SSLv2_server_method())
|
||||
SSL_CTX_new(SSLv3_server_method())
|
||||
or
|
||||
SSL_CTX_new(SSLv23_client_method())
|
||||
SSL_CTX_new(SSLv2_client_method())
|
||||
SSL_CTX_new(SSLv3_client_method())
|
||||
|
||||
SSL_set_default_verify_paths() ... renamed to the more appropriate
|
||||
SSL_CTX_set_default_verify_paths()
|
||||
|
||||
If you want to use client certificates then you have to add in a bit
|
||||
of extra stuff in that a SSLv3 server sends a list of those CAs that
|
||||
it will accept certificates from ... so you have to provide a list to
|
||||
SSLeay otherwise certain browsers will not send client certs.
|
||||
|
||||
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(s_cert_file));
|
||||
|
||||
|
||||
X509_NAME_oneline(X) -> X509_NAME_oneline(X,NULL,0)
|
||||
or provide a buffer and size to copy the
|
||||
result into
|
||||
|
||||
X509_add_cert -> X509_STORE_add_cert (and you might want to read the
|
||||
notes on X509_NAME structure changes too)
|
||||
|
||||
|
||||
VERIFICATION CODE
|
||||
=================
|
||||
|
||||
The codes have all be renamed from VERIFY_ERR_* to X509_V_ERR_* to
|
||||
more accurately reflect things.
|
||||
|
||||
The verification callback args are now packaged differently so that
|
||||
extra fields for verification can be added easily in future without
|
||||
having to break things by adding extra parameters each release :-)
|
||||
|
||||
X509_cert_verify_error_string -> X509_verify_cert_error_string
|
||||
|
||||
|
||||
BIO INTERNALS
|
||||
=============
|
||||
|
||||
Eric has fixed things so that extra flags can be introduced in
|
||||
the BIO layer in future without having to play with all the BIO
|
||||
modules by adding in some macros.
|
||||
|
||||
The ugly stuff using
|
||||
b->flags ~= (BIO_FLAGS_RW|BIO_FLAGS_SHOULD_RETRY)
|
||||
becomes
|
||||
BIO_clear_retry_flags(b)
|
||||
|
||||
b->flags |= (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)
|
||||
becomes
|
||||
BIO_set_retry_read(b)
|
||||
|
||||
Also ... BIO_get_retry_flags(b), BIO_set_flags(b)
|
||||
|
||||
|
||||
|
||||
OTHER THINGS
|
||||
============
|
||||
|
||||
X509_NAME has been altered so that it isn't just a STACK ... the STACK
|
||||
is now in the "entries" field ... and there are a pile of nice functions
|
||||
for getting at the details in a much cleaner manner.
|
||||
|
||||
SSL_CTX has been altered ... "cert" is no longer a direct member of this
|
||||
structure ... things are now down under "cert_store" (see x509_vfy.h) and
|
||||
things are no longer in a CERTIFICATE_CTX but instead in a X509_STORE.
|
||||
If your code "knows" about this level of detail then it will need some
|
||||
surgery.
|
||||
|
||||
If you depending on the incorrect spelling of a number of the error codes
|
||||
then you will have to change your code as these have been fixed.
|
||||
|
||||
ENV_CIPHER "type" got renamed to "nid" and as that is what it actually
|
||||
has been all along so this makes things clearer.
|
||||
ify_cert_error_string(ctx->error));
|
||||
|
||||
SSL_R_NO_CIPHER_WE_TRUST -> SSL_R_NO_CIPHER_LIST
|
||||
and SSL_R_REUSE_CIPHER_LIST_NOT_ZERO
|
||||
|
||||
|
||||
|
||||
Changes between 0.7.x and 0.8.0
|
||||
|
||||
*) There have been lots of changes, mostly the addition of SSLv3.
|
||||
There have been many additions from people and amongst
|
||||
others, C2Net has assisted greatly.
|
||||
|
||||
Changes between 0.7.x and 0.7.x
|
||||
|
||||
*) Internal development version only
|
||||
|
||||
SSLeay 0.6.6 13-Jan-1997
|
||||
|
||||
The main additions are
|
||||
|
||||
- assember for x86 DES improvments.
|
||||
From 191,000 per second on a pentium 100, I now get 281,000. The inner
|
||||
loop and the IP/FP modifications are from
|
||||
Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. Many thanks for his
|
||||
contribution.
|
||||
- The 'DES macros' introduced in 0.6.5 now have 3 types.
|
||||
DES_PTR1, DES_PTR2 and 'normal'. As per before, des_opts reports which
|
||||
is best and there is a summery of mine in crypto/des/options.txt
|
||||
- A few bug fixes.
|
||||
- Added blowfish. It is not used by SSL but all the other stuff that
|
||||
deals with ciphers can use it in either ecb, cbc, cfb64 or ofb64 modes.
|
||||
There are 3 options for optimising Blowfish. BF_PTR, BF_PTR2 and 'normal'.
|
||||
BF_PTR2 is pentium/x86 specific. The correct option is setup in
|
||||
the 'Configure' script.
|
||||
- There is now a 'get client certificate' callback which can be
|
||||
'non-blocking'. If more details are required, let me know. It will
|
||||
documented more in SSLv3 when I finish it.
|
||||
- Bug fixes from 0.6.5 including the infamous 'ca' bug. The 'make test'
|
||||
now tests the ca program.
|
||||
- Lots of little things modified and tweaked.
|
||||
|
||||
SSLeay 0.6.5
|
||||
|
||||
After quite some time (3 months), the new release. I have been very busy
|
||||
for the last few months and so this is mostly bug fixes and improvments.
|
||||
@@ -57,7 +582,7 @@ The main changes in this release
|
||||
- 'ssleay ciphers' added, lists the default cipher list for SSLeay.
|
||||
- RC2 key setup is now compatable with Netscape.
|
||||
- Modifed server side of SSL implementation, big performance difference when
|
||||
using session-id reuse.
|
||||
using session-id reuse.
|
||||
|
||||
0.6.3
|
||||
|
||||
@@ -186,16 +711,16 @@ The wrappers are easy to write
|
||||
|
||||
function_fp(fp,x)
|
||||
FILE *fp;
|
||||
{
|
||||
BIO *b;
|
||||
int ret;
|
||||
{
|
||||
BIO *b;
|
||||
int ret;
|
||||
|
||||
if ((b=BIO_new(BIO_s_file())) == NULL) error.....
|
||||
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
||||
ret=function_bio(b,x);
|
||||
BIO_free(b);
|
||||
return(ret);
|
||||
}
|
||||
if ((b=BIO_new(BIO_s_file())) == NULL) error.....
|
||||
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
||||
ret=function_bio(b,x);
|
||||
BIO_free(b);
|
||||
return(ret);
|
||||
}
|
||||
Remember, there are no functions that take FILE * in SSLeay when
|
||||
compiled for Windows 3.1 DLL's.
|
||||
|
||||
@@ -236,8 +761,8 @@ The list of things to read and do
|
||||
|
||||
dgst -d
|
||||
s_client -state (this uses a callback placed in the SSL state loop and
|
||||
will be used else-where to help debug/monitor what
|
||||
is happening.)
|
||||
will be used else-where to help debug/monitor what
|
||||
is happening.)
|
||||
|
||||
doc/why.doc
|
||||
doc/bio.doc <- hmmm, needs lots of work.
|
||||
18
Configure
18
Configure
@@ -73,6 +73,7 @@ $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/b
|
||||
# A few of my development configs
|
||||
"purify", "purify gcc:-g -DPURIFY -Wall:-lsocket -lnsl::::",
|
||||
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:-lefence::::",
|
||||
"debug-rse","gcc:-DTERMIOS -DL_ENDIAN -DREF_CHECK -DCRYPTO_MDEBUG -g -ggdb3 -Wall:::::",
|
||||
"dist", "cc:-O -DNOPROTO::::",
|
||||
|
||||
# Basic configs that should work on any box
|
||||
@@ -122,6 +123,9 @@ $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/b
|
||||
"hpux-cc", "cc:-DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit +O4 -Wl,-a,archive::DES_PTR DES_UNROLL DES_RISC1:asm/pa-risc2.o::",
|
||||
"hpux-kr-cc", "cc:-DB_ENDIAN -DNOCONST -DNOPROTO -D_HPUX_SOURCE::DES_PTR DES_UNROLL:asm/pa-risc2.o::",
|
||||
"hpux-gcc", "gcc:-DB_ENDIAN -O3::BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
|
||||
# HPUX from www.globus.org
|
||||
"hpux11-32bit-cc","cc:+DA2.0 -DB_ENDIAN -D_HPUX_SOURCE -Aa -Ae +ESlit::DES_PTR DES_UNROLL DES_RISC1:::",
|
||||
"hpux11-64bit-cc","cc:+DA2.0W -g -D_HPUX_SOURCE -Aa -Ae +ESlit::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT :::",
|
||||
|
||||
# Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
|
||||
# the new compiler
|
||||
@@ -138,7 +142,9 @@ $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/b
|
||||
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
|
||||
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
|
||||
"NetBSD-x86", "gcc:-DTERMIOS -D_ANSI_SOURCE -O3 -fomit-frame-pointer -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:",
|
||||
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -D_ANSI_SOURCE -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
|
||||
#"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -D_ANSI_SOURCE -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
|
||||
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
|
||||
"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
|
||||
#"bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::RSA_LLONG $x86_gc_des $x86_gcc_opts:$x86_bsdi_asm",
|
||||
"nextstep", "cc:-O3 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:::",
|
||||
# NCR MP-RAS UNIX ver 02.03.01
|
||||
@@ -165,6 +171,16 @@ $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/b
|
||||
# (written by Wayne Schroeder <schroede@SDSC.EDU>)
|
||||
"cray-t90-cc", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::SIXTY_FOUR_BIT_LONG DES_INT:::",
|
||||
|
||||
#
|
||||
# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
|
||||
#
|
||||
# The BIT_FIELD_LIMITS define was written for the C90 (it seems). I added
|
||||
# another use. Basically, the problem is that the T3E uses some bit fields
|
||||
# for some st_addr stuff, and then sizeof and address-of fails
|
||||
# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
|
||||
# did not like it.
|
||||
"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::SIXTY_FOUR_BIT_LONG DES_INT:::",
|
||||
|
||||
# DGUX, 88100.
|
||||
"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::RC4_INDEX DES_UNROLL:::",
|
||||
"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer:-lnsl -lsocket:RC4_INDEX:RC4_INDEX DES_UNROLL:::",
|
||||
|
||||
316
HISTORY
316
HISTORY
@@ -1,316 +0,0 @@
|
||||
16-Mar-98
|
||||
- Patch for Cray T90 from Wayne Schroeder <schroede@SDSC.EDU>
|
||||
- Lots and lots of changes
|
||||
|
||||
29-Jan-98
|
||||
- ASN1_BIT_STRING_set_bit()/ASN1_BIT_STRING_get_bit() from
|
||||
Goetz Babin-Ebell <babinebell@trustcenter.de>.
|
||||
- SSL_version() now returns SSL2_VERSION, SSL3_VERSION or
|
||||
TLS1_VERSION.
|
||||
|
||||
7-Jan-98
|
||||
- Finally reworked the cipher string to ciphers again, so it
|
||||
works correctly
|
||||
- All the app_data stuff is now ex_data with funcion calls to access.
|
||||
The index is supplied by a function and 'methods' can be setup
|
||||
for the types that are called on XXX_new/XXX_free. This lets
|
||||
applications get notified on creation and destruction. Some of
|
||||
the RSA methods could be implemented this way and I may do so.
|
||||
- Oh yes, SSL under perl5 is working at the basic level.
|
||||
|
||||
15-Dec-97
|
||||
- Warning - the gethostbyname cache is not fully thread safe,
|
||||
but it should work well enough.
|
||||
- Major internal reworking of the app_data stuff. More functions
|
||||
but if you were accessing ->app_data directly, things will
|
||||
stop working.
|
||||
- The perlv5 stuff is working. Currently on message digests,
|
||||
ciphers and the bignum library.
|
||||
|
||||
9-Dec-97
|
||||
- Modified re-negotiation so that server initated re-neg
|
||||
will cause a SSL_read() to return -1 should retry.
|
||||
The danger otherwise was that the server and the
|
||||
client could end up both trying to read when using non-blocking
|
||||
sockets.
|
||||
|
||||
4-Dec-97
|
||||
- Lots of small changes
|
||||
- Fix for binaray mode in Windows for the FILE BIO, thanks to
|
||||
Bob Denny <rdenny@dc3.com>
|
||||
|
||||
17-Nov-97
|
||||
- Quite a few internal cleanups, (removal of errno, and using macros
|
||||
defined in e_os.h).
|
||||
- A bug in ca.c, pointed out by yasuyuki-ito@d-cruise.co.jp, where
|
||||
the automactic naming out output files was being stuffed up.
|
||||
|
||||
29-Oct-97
|
||||
- The Cast5 cipher has been added. MD5 and SHA-1 are now in assember
|
||||
for x86.
|
||||
|
||||
21-Oct-97
|
||||
- Fixed a bug in the BIO_gethostbyname() cache.
|
||||
|
||||
15-Oct-97
|
||||
- cbc mode for blowfish/des/3des is now in assember. Blowfish asm
|
||||
has also been improved. At this point in time, on the pentium,
|
||||
md5 is %80 faster, the unoptimesed sha-1 is %79 faster,
|
||||
des-cbc is %28 faster, des-ede3-cbc is %9 faster and blowfish-cbc
|
||||
is %62 faster.
|
||||
|
||||
12-Oct-97
|
||||
- MEM_BUF_grow() has been fixed so that it always sets the buf->length
|
||||
to the value we are 'growing' to. Think of MEM_BUF_grow() as the
|
||||
way to set the length value correctly.
|
||||
|
||||
10-Oct-97
|
||||
- I now hash for certificate lookup on the raw DER encoded RDN (md5).
|
||||
This breaks things again :-(. This is efficent since I cache
|
||||
the DER encoding of the RDN.
|
||||
- The text DN now puts in the numeric OID instead of UNKNOWN.
|
||||
- req can now process arbitary OIDs in the config file.
|
||||
- I've been implementing md5 in x86 asm, much faster :-).
|
||||
- Started sha1 in x86 asm, needs more work.
|
||||
- Quite a few speedups in the BN stuff. RSA public operation
|
||||
has been made faster by caching the BN_MONT_CTX structure.
|
||||
The calulating of the Ai where A*Ai === 1 mod m was rather
|
||||
expensive. Basically a 40-50% speedup on public operations.
|
||||
The RSA speedup is now 15% on pentiums and %20 on pentium
|
||||
pro.
|
||||
|
||||
30-Sep-97
|
||||
- After doing some profiling, I added x86 adm for bn_add_words(),
|
||||
which just adds 2 arrays of longs together. A %10 speedup
|
||||
for 512 and 1024 bit RSA on the pentium pro.
|
||||
|
||||
29-Sep-97
|
||||
- Converted the x86 bignum assembler to us the perl scripts
|
||||
for generation.
|
||||
|
||||
23-Sep-97
|
||||
- If SSL_set_session() is passed a NULL session, it now clears the
|
||||
current session-id.
|
||||
|
||||
22-Sep-97
|
||||
- Added a '-ss_cert file' to apps/ca.c. This will sign selfsigned
|
||||
certificates.
|
||||
- Bug in crypto/evp/encode.c where by decoding of 65 base64
|
||||
encoded lines, one line at a time (via a memory BIO) would report
|
||||
EOF after the first line was decoded.
|
||||
- Fix in X509_find_by_issuer_and_serial() from
|
||||
Dr Stephen Henson <shenson@bigfoot.com>
|
||||
|
||||
19-Sep-97
|
||||
- NO_FP_API and NO_STDIO added.
|
||||
- Put in sh config command. It auto runs Configure with the correct
|
||||
parameters.
|
||||
|
||||
18-Sep-97
|
||||
- Fix x509.c so if a DSA cert has different parameters to its parent,
|
||||
they are left in place. Not tested yet.
|
||||
|
||||
16-Sep-97
|
||||
- ssl_create_cipher_list() had some bugs, fixes from
|
||||
Patrick Eisenacher <eisenach@stud.uni-frankfurt.de>
|
||||
- Fixed a bug in the Base64 BIO, where it would return 1 instead
|
||||
of -1 when end of input was encountered but should retry.
|
||||
Basically a Base64/Memory BIO interaction problem.
|
||||
- Added a HMAC set of functions in preporarion for TLS work.
|
||||
|
||||
15-Sep-97
|
||||
- Top level makefile tweak - Cameron Simpson <cs@zip.com.au>
|
||||
- Prime generation spead up %25 (512 bit prime, pentium pro linux)
|
||||
by using montgomery multiplication in the prime number test.
|
||||
|
||||
11-Sep-97
|
||||
- Ugly bug in ssl3_write_bytes(). Basically if application land
|
||||
does a SSL_write(ssl,buf,len) where len > 16k, the SSLv3 write code
|
||||
did not check the size and tried to copy the entire buffer.
|
||||
This would tend to cause memory overwrites since SSLv3 has
|
||||
a maximum packet size of 16k. If your program uses
|
||||
buffers <= 16k, you would probably never see this problem.
|
||||
- Fixed a new errors that were cause by malloc() not returning
|
||||
0 initialised memory..
|
||||
- SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using
|
||||
SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing
|
||||
since this flags stops SSLeay being able to handle client
|
||||
cert requests correctly.
|
||||
|
||||
08-Sep-97
|
||||
- SSL_SESS_CACHE_NO_INTERNAL_LOOKUP option added. When switched
|
||||
on, the SSL server routines will not use a SSL_SESSION that is
|
||||
held in it's cache. This in intended to be used with the session-id
|
||||
callbacks so that while the session-ids are still stored in the
|
||||
cache, the decision to use them and how to look them up can be
|
||||
done by the callbacks. The are the 'new', 'get' and 'remove'
|
||||
callbacks. This can be used to determine the session-id
|
||||
to use depending on information like which port/host the connection
|
||||
is coming from. Since the are also SSL_SESSION_set_app_data() and
|
||||
SSL_SESSION_get_app_data() functions, the application can hold
|
||||
information against the session-id as well.
|
||||
|
||||
03-Sep-97
|
||||
- Added lookup of CRLs to the by_dir method,
|
||||
X509_load_crl_file() also added. Basically it means you can
|
||||
lookup CRLs via the same system used to lookup certificates.
|
||||
- Changed things so that the X509_NAME structure can contain
|
||||
ASN.1 BIT_STRINGS which is required for the unique
|
||||
identifier OID.
|
||||
- Fixed some problems with the auto flushing of the session-id
|
||||
cache. It was not occuring on the server side.
|
||||
|
||||
02-Sep-97
|
||||
- Added SSL_CTX_sess_cache_size(SSL_CTX *ctx,unsigned long size)
|
||||
which is the maximum number of entries allowed in the
|
||||
session-id cache. This is enforced with a simple FIFO list.
|
||||
The default size is 20*1024 entries which is rather large :-).
|
||||
The Timeout code is still always operating.
|
||||
|
||||
01-Sep-97
|
||||
- Added an argument to all the 'generate private key/prime`
|
||||
callbacks. It is the last parameter so this should not
|
||||
break existing code but it is needed for C++.
|
||||
- Added the BIO_FLAGS_BASE64_NO_NL flag for the BIO_f_base64()
|
||||
BIO. This lets the BIO read and write base64 encoded data
|
||||
without inserting or looking for '\n' characters. The '-A'
|
||||
flag turns this on when using apps/enc.c.
|
||||
- RSA_NO_PADDING added to help BSAFE functionality. This is a
|
||||
very dangerous thing to use, since RSA private key
|
||||
operations without random padding bytes (as PKCS#1 adds) can
|
||||
be attacked such that the private key can be revealed.
|
||||
- ASN.1 bug and rc2-40-cbc and rc4-40 added by
|
||||
Dr Stephen Henson <shenson@bigfoot.com>
|
||||
|
||||
31-Aug-97 (stuff added while I was away)
|
||||
- Linux pthreads by Tim Hudson (tjh@cryptsoft.com).
|
||||
- RSA_flags() added allowing bypass of pub/priv match check
|
||||
in ssl/ssl_rsa.c - Tim Hudson.
|
||||
- A few minor bugs.
|
||||
|
||||
SSLeay 0.8.1 released.
|
||||
|
||||
19-Jul-97
|
||||
- Server side initated dynamic renegotiation is broken. I will fix
|
||||
it when I get back from holidays.
|
||||
|
||||
15-Jul-97
|
||||
- Quite a few small changes.
|
||||
- INVALID_SOCKET usage cleanups from Alex Kiernan <alex@hisoft.co.uk>
|
||||
|
||||
09-Jul-97
|
||||
- Added 2 new values to the SSL info callback.
|
||||
SSL_CB_START which is passed when the SSL protocol is started
|
||||
and SSL_CB_DONE when it has finished sucsessfully.
|
||||
|
||||
08-Jul-97
|
||||
- Fixed a few bugs problems in apps/req.c and crypto/asn1/x_pkey.c
|
||||
that related to DSA public/private keys.
|
||||
- Added all the relevent PEM and normal IO functions to support
|
||||
reading and writing RSAPublic keys.
|
||||
- Changed makefiles to use ${AR} instead of 'ar r'
|
||||
|
||||
07-Jul-97
|
||||
- Error in ERR_remove_state() that would leave a dangling reference
|
||||
to a free()ed location - thanks to Alex Kiernan <alex@hisoft.co.uk>
|
||||
- s_client now prints the X509_NAMEs passed from the server
|
||||
when requesting a client cert.
|
||||
- Added a ssl->type, which is one of SSL_ST_CONNECT or
|
||||
SSL_ST_ACCEPT. I had to add it so I could tell if I was
|
||||
a connect or an accept after the handshake had finished.
|
||||
- SSL_get_client_CA_list(SSL *s) now returns the CA names
|
||||
passed by the server if called by a client side SSL.
|
||||
|
||||
05-Jul-97
|
||||
- Bug in X509_NAME_get_text_by_OBJ(), looking starting at index
|
||||
0, not -1 :-( Fix from Tim Hudson (tjh@cryptsoft.com).
|
||||
|
||||
04-Jul-97
|
||||
- Fixed some things in X509_NAME_add_entry(), thanks to
|
||||
Matthew Donald <matthew@world.net>.
|
||||
- I had a look at the cipher section and though that it was a
|
||||
bit confused, so I've changed it.
|
||||
- I was not setting up the RC4-64-MD5 cipher correctly. It is
|
||||
a MS special that appears in exported MS Money.
|
||||
- Error in all my DH ciphers. Section 7.6.7.3 of the SSLv3
|
||||
spec. I was missing the two byte length header for the
|
||||
ClientDiffieHellmanPublic value. This is a packet sent from
|
||||
the client to the server. The SSL_OP_SSLEAY_080_CLIENT_DH_BUG
|
||||
option will enable SSLeay server side SSLv3 accept either
|
||||
the correct or my 080 packet format.
|
||||
- Fixed a few typos in crypto/pem.org.
|
||||
|
||||
02-Jul-97
|
||||
- Alias mapping for EVP_get_(digest|cipher)byname is now
|
||||
performed before a lookup for actual cipher. This means
|
||||
that an alias can be used to 're-direct' a cipher or a
|
||||
digest.
|
||||
- ASN1_read_bio() had a bug that only showed up when using a
|
||||
memory BIO. When EOF is reached in the memory BIO, it is
|
||||
reported as a -1 with BIO_should_retry() set to true.
|
||||
|
||||
01-Jul-97
|
||||
- Fixed an error in X509_verify_cert() caused by my
|
||||
miss-understanding how 'do { contine } while(0);' works.
|
||||
Thanks to Emil Sit <sit@mit.edu> for educating me :-)
|
||||
|
||||
30-Jun-97
|
||||
- Base64 decoding error. If the last data line did not end with
|
||||
a '=', sometimes extra data would be returned.
|
||||
- Another 'cut and paste' bug in x509.c related to setting up the
|
||||
STDout BIO.
|
||||
|
||||
27-Jun-97
|
||||
- apps/ciphers.c was not printing due to an editing error.
|
||||
- Alex Kiernan <alex@hisoft.co.uk> send in a nice fix for
|
||||
a library build error in util/mk1mf.pl
|
||||
|
||||
26-Jun-97
|
||||
- Still did not have the auto 'experimental' code removal
|
||||
script correct.
|
||||
- A few header tweaks for Watcom 11.0 under Win32 from
|
||||
Rolf Lindemann <Lindemann@maz-hh.de>
|
||||
- 0 length OCTET_STRING bug in asn1_parse
|
||||
- A minor fix with an non-existent function in the MS .def files.
|
||||
- A few changes to the PKCS7 stuff.
|
||||
|
||||
25-Jun-97
|
||||
SSLeay 0.8.0 finally it gets released.
|
||||
|
||||
24-Jun-97
|
||||
Added a SSL_OP_EPHEMERAL_RSA option which causes all SSLv3 RSA keys to
|
||||
use a temporary RSA key. This is experimental and needs some more work.
|
||||
Fixed a few Win16 build problems.
|
||||
|
||||
23-Jun-97
|
||||
SSLv3 bug. I was not doing the 'lookup' of the CERT structure
|
||||
correctly. I was taking the SSL->ctx->default_cert when I should
|
||||
have been using SSL->cert. The bug was in ssl/s3_srvr.c
|
||||
|
||||
20-Jun-97
|
||||
X509_ATTRIBUTES were being encoded wrongly by apps/reg.c and the
|
||||
rest of the library. Even though I had the code required to do
|
||||
it correctly, apps/req.c was doing the wrong thing. I have fixed
|
||||
and tested everything.
|
||||
|
||||
Missing a few #ifdef FIONBIO sections in crypto/bio/bss_acpt.c.
|
||||
|
||||
19-Jun-97
|
||||
Fixed a bug in the SSLv2 server side first packet handling. When
|
||||
using the non-blocking test BIO, the ssl->s2->first_packet flag
|
||||
was being reset when a would-block failure occurred when reading
|
||||
the first 5 bytes of the first packet. This caused the checking
|
||||
logic to run at the wrong time and cause an error.
|
||||
|
||||
Fixed a problem with specifying cipher. If RC4-MD5 were used,
|
||||
only the SSLv3 version would be picked up. Now this will pick
|
||||
up both SSLv2 and SSLv3 versions. This required changing the
|
||||
SSL_CIPHER->mask values so that they only mask the ciphers,
|
||||
digests, authentication, export type and key-exchange algorithms.
|
||||
|
||||
I found that when a SSLv23 session is established, a reused
|
||||
session, of type SSLv3 was attempting to write the SSLv2
|
||||
ciphers, which were invalid. The SSL_METHOD->put_cipher_by_char
|
||||
method has been modified so it will only write out cipher which
|
||||
that method knows about.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
- A minor bug in ssl/s3_clnt.c where there would always be 4 0 bytes
|
||||
sent in the client random, thanks to
|
||||
Edward Bishop <ebishop@spyglass.com>
|
||||
- Changed some BIGNUM api stuff.
|
||||
|
||||
- I Deleted the HISTORY.090 I was working on and when I found out, it was
|
||||
permanently gone :-(
|
||||
@@ -1,3 +1,62 @@
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
__________________________________________________________________________
|
||||
|
||||
Original SSLeay License
|
||||
__________________________________________________________________________
|
||||
|
||||
Copyright (C) 1997 Eric Young (eay@cryptsoft.com)
|
||||
All rights reserved.
|
||||
|
||||
80
MINFO
80
MINFO
@@ -1,11 +1,11 @@
|
||||
RELATIVE_DIRECTORY=.
|
||||
AR=ar r
|
||||
BASENAME=SSLeay
|
||||
BASENAME=openssl
|
||||
BF_ENC=bf_enc.o
|
||||
BN_ASM=bn_asm.o
|
||||
CAST_ENC=c_enc.o
|
||||
CC=cl
|
||||
CFLAG=
|
||||
CC=cc
|
||||
CFLAG=-O -DNOPROTO
|
||||
DES_ENC=des_enc.o fcrypt_b.o
|
||||
DIRS=crypto ssl rsaref apps test tools
|
||||
EDIRS=times doc bugs util include certs ms shlib mt demos perl sf dep
|
||||
@@ -20,22 +20,21 @@ MAKEFILE=Makefile.ssl
|
||||
MAN1=1
|
||||
MAN3=3
|
||||
MD5_ASM_OBJ=
|
||||
MISC=COPYRIGHT Configure HISTORY.090 HISTORY.066 INSTALL Makefile.ssl Makefile README TODO HISTORY README.066 README.080 README.090 VERSION PROBLEMS MINFO makefile.one e_os.h MICROSOFT makevms.com config PATENTS
|
||||
NAME=SSLeay-0.9.1b
|
||||
NAME=openssl-0.9.1c
|
||||
ONEDIRS=out tmp
|
||||
PEX_LIBS=-L. -L.. -L../.. -L../../..
|
||||
PLATFORM=VC-WIN32
|
||||
PLATFORM=dist
|
||||
RC4_ENC=rc4_enc.o
|
||||
RC5_ENC=rc5_enc.o
|
||||
RMD160_ASM_OBJ=
|
||||
SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem asn1 x509 conf txt_db pkcs7 proxy comp
|
||||
SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem asn1 x509 conf txt_db pkcs7 comp
|
||||
SHA1_ASM_OBJ=
|
||||
SHELL=/bin/sh
|
||||
TARFILE=SSLeay-0.9.1b.tar
|
||||
TARFILE=openssl-0.9.1c.tar
|
||||
TOP=.
|
||||
VERSION=0.9.1b
|
||||
VERSION=0.9.1c
|
||||
WDIRS=windows
|
||||
WTARFILE=SSLeay-0.9.1b-win.tar
|
||||
WTARFILE=openssl-0.9.1c-win.tar
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=crypto
|
||||
ALL=Makefile README cryptlib.c mem.c cversion.c ex_data.c tmdiff.c cpt_err.c cryptlib.h date.h crypto.h cryptall.h tmdiff.h
|
||||
@@ -62,7 +61,7 @@ MAKEDEPEND=makedepend -f Makefile.ssl
|
||||
MAKEFILE=Makefile.ssl
|
||||
PEX_LIBS=
|
||||
RM=/bin/rm -f
|
||||
SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem x509 asn1 conf txt_db pkcs7 proxy comp
|
||||
SDIRS=md2 md5 sha mdc2 hmac ripemd des rc2 rc4 rc5 idea bf cast bn rsa dsa dh buffer bio stack lhash rand err objects evp pem x509 asn1 conf txt_db pkcs7 comp
|
||||
SRC=cryptlib.c mem.c cversion.c ex_data.c tmdiff.c cpt_err.c
|
||||
TOP=..
|
||||
RELATIVE_DIRECTORY=
|
||||
@@ -506,7 +505,7 @@ TEST=
|
||||
TOP=../..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=crypto/bio
|
||||
ALL=Makefile bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c bss_cs4a.c bio.h bss_file.c
|
||||
ALL=Makefile bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c bio.h bss_file.c
|
||||
APPS=
|
||||
AR=ar r
|
||||
CC=cc
|
||||
@@ -521,12 +520,12 @@ HEADER=bio.h bss_file.c
|
||||
INCLUDES=-I.. -I../../include
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
LIB=../../libcrypto.a
|
||||
LIBOBJ=bio_lib.o bio_cb.o bio_err.o bss_mem.o bss_null.o bss_fd.o bss_file.o bss_sock.o bss_conn.o bf_null.o bf_buff.o b_print.o b_dump.o b_sock.o bss_acpt.o bf_nbio.o bss_cs4a.o
|
||||
LIBSRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c bss_cs4a.c
|
||||
LIBOBJ=bio_lib.o bio_cb.o bio_err.o bss_mem.o bss_null.o bss_fd.o bss_file.o bss_sock.o bss_conn.o bf_null.o bf_buff.o b_print.o b_dump.o b_sock.o bss_acpt.o bf_nbio.o
|
||||
LIBSRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c
|
||||
MAKE=make -f Makefile.ssl
|
||||
MAKEDEPEND=makedepend -f Makefile.ssl
|
||||
MAKEFILE=Makefile.ssl
|
||||
SRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c bss_cs4a.c
|
||||
SRC=bio_lib.c bio_cb.c bio_err.c bss_mem.c bss_null.c bss_fd.c bss_file.c bss_sock.c bss_conn.c bf_null.c bf_buff.c b_print.c b_dump.c b_sock.c bss_acpt.c bf_nbio.c
|
||||
TEST=
|
||||
TOP=../..
|
||||
RELATIVE_DIRECTORY=
|
||||
@@ -821,31 +820,6 @@ SRC=pk7_lib.c pkcs7err.c pk7_doit.c
|
||||
TEST=
|
||||
TOP=../..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=crypto/proxy
|
||||
ALL=Makefile proxy.c pxy_txt.c bf_proxy.c pxy_conf.c pxy_err.c proxy.h
|
||||
APPS=
|
||||
AR=ar r
|
||||
CC=cc
|
||||
CFLAG=-g
|
||||
CFLAGS=-I.. -I../../include -g
|
||||
DIR=proxy
|
||||
ERR=proxy
|
||||
ERRC=pxy_err
|
||||
EXHEADER=proxy.h
|
||||
GENERAL=Makefile
|
||||
HEADER=proxy.h
|
||||
INCLUDES=-I.. -I../../include
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
LIB=../../libcrypto.a
|
||||
LIBOBJ=proxy.o pxy_txt.o bf_proxy.o pxy_conf.o pxy_err.o
|
||||
LIBSRC=proxy.c pxy_txt.c bf_proxy.c pxy_conf.c pxy_err.c
|
||||
MAKE=make -f Makefile.ssl
|
||||
MAKEDEPEND=makedepend -f Makefile.ssl
|
||||
MAKEFILE=Makefile.ssl
|
||||
SRC=proxy.c pxy_txt.c bf_proxy.c pxy_conf.c pxy_err.c
|
||||
TEST=
|
||||
TOP=../..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=crypto/comp
|
||||
ALL=Makefile comp_lib.c c_rle.c c_zlib.c comp.h
|
||||
APPS=
|
||||
@@ -872,7 +846,7 @@ TEST=
|
||||
TOP=../..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=ssl
|
||||
ALL=Makefile README s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c pxy_ssl.c ssl_err.c ssl.h ssl2.h ssl3.h ssl23.h tls1.h ssl_locl.h
|
||||
ALL=Makefile README s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c ssl.h ssl2.h ssl3.h ssl23.h tls1.h ssl_locl.h
|
||||
APPS=
|
||||
AR=ar r
|
||||
CC=cc
|
||||
@@ -887,17 +861,17 @@ HEADER=ssl.h ssl2.h ssl3.h ssl23.h tls1.h ssl_locl.h
|
||||
INCLUDES=-I../crypto -I../include
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
LIB=../libssl.a
|
||||
LIBOBJ=s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o ssl_ciph.o ssl_stat.o ssl_rsa.o ssl_asn1.o ssl_txt.o ssl_algs.o bio_ssl.o pxy_ssl.o ssl_err.o
|
||||
LIBSRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c pxy_ssl.c ssl_err.c
|
||||
LIBOBJ=s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o ssl_ciph.o ssl_stat.o ssl_rsa.o ssl_asn1.o ssl_txt.o ssl_algs.o bio_ssl.o ssl_err.o
|
||||
LIBSRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c
|
||||
MAKE=make -f Makefile.ssl
|
||||
MAKEDEPEND=makedepend -f Makefile.ssl
|
||||
MAKEFILE=Makefile.ssl
|
||||
SRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c pxy_ssl.c ssl_err.c
|
||||
SRC=s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c ssl_lib.c ssl_err2.c ssl_cert.c ssl_sess.c ssl_ciph.c ssl_stat.c ssl_rsa.c ssl_asn1.c ssl_txt.c ssl_algs.c bio_ssl.c ssl_err.c
|
||||
TEST=ssltest.c
|
||||
TOP=..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=rsaref
|
||||
ALL=Makefile rsaref.c rsar_err.c rsaref.h
|
||||
ALL=Makefile rsaref.c rsar_err.c rsaref.h
|
||||
APPS=
|
||||
AR=ar r
|
||||
CC=cc
|
||||
@@ -906,9 +880,9 @@ CFLAGS=-I../crypto -I../include -g
|
||||
DIR=rsaref
|
||||
ERR=rsaref
|
||||
ERRC=rsar_err
|
||||
EXHEADER=
|
||||
EXHEADER=rsaref.h
|
||||
GENERAL=Makefile
|
||||
HEADER= rsaref.h
|
||||
HEADER=rsaref.h
|
||||
INCLUDES=-I../crypto -I../include
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
LIB=../libRSAglue.a
|
||||
@@ -922,7 +896,7 @@ TEST=
|
||||
TOP=..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=apps
|
||||
ALL=Makefile verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c bf_perm.c version.c sess_id.c ciphers.c apps.h progs.h s_apps.h testdsa.h testrsa.h
|
||||
ALL=Makefile verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c apps.h progs.h s_apps.h testdsa.h testrsa.h
|
||||
A_OBJ=apps.o
|
||||
A_SRC=apps.c
|
||||
CC=cc
|
||||
@@ -935,8 +909,8 @@ EXE=ssleay
|
||||
EXHEADER=
|
||||
EX_LIBS=
|
||||
E_EXE=verify asn1pars req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers
|
||||
E_OBJ=verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o dsa.o dsaparam.o x509.o genrsa.o s_server.o s_client.o s_ speed.o s_time.o apps.o s_cb.o s_socket.o bf_perm.o version.o sess_id.o ciphers.o
|
||||
E_SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c bf_perm.c version.c sess_id.c ciphers.c
|
||||
E_OBJ=verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o dsa.o dsaparam.o x509.o genrsa.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o version.o sess_id.o ciphers.o
|
||||
E_SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c
|
||||
GENERAL=Makefile
|
||||
HEADER=apps.h progs.h s_apps.h testdsa.h testrsa.h
|
||||
INCLUDES=-I../include
|
||||
@@ -950,10 +924,10 @@ PEX_LIBS=
|
||||
PROGS=ssleay.c
|
||||
RM=/bin/rm -f
|
||||
SCRIPTS=CA.sh der_chop
|
||||
SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c bf_perm.c version.c sess_id.c ciphers.c
|
||||
SRC=verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c pkcs7.c crl2p7.c crl.c rsa.c dsa.c dsaparam.c x509.c genrsa.c s_server.c s_client.c speed.c s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c ciphers.c
|
||||
SSLEAY=ssleay
|
||||
S_OBJ=s_cb.o s_socket.o bf_perm.o
|
||||
S_SRC=s_cb.c s_socket.c bf_perm.c
|
||||
S_OBJ=s_cb.o s_socket.o
|
||||
S_SRC=s_cb.c s_socket.c
|
||||
TOP=..
|
||||
RELATIVE_DIRECTORY=
|
||||
RELATIVE_DIRECTORY=test
|
||||
|
||||
43
Makefile.ssl
43
Makefile.ssl
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile for all the SSL related library routines and utilities
|
||||
VERSION = 0.9.1b
|
||||
PLATFORM=debug
|
||||
VERSION = 0.9.1c
|
||||
PLATFORM=dist
|
||||
#
|
||||
# make install will install:
|
||||
# libraries into $INSTALLTOP/lib
|
||||
@@ -62,11 +62,11 @@ PLATFORM=debug
|
||||
# equal 4.
|
||||
# PKCS1_CHECK - pkcs1 tests.
|
||||
|
||||
CC= gcc
|
||||
CC= cc
|
||||
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
||||
CFLAG= -DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror
|
||||
CFLAG= -O -DNOPROTO
|
||||
PEX_LIBS= -L. -L.. -L../.. -L../../..
|
||||
EX_LIBS= -lefence
|
||||
EX_LIBS=
|
||||
AR=ar r
|
||||
|
||||
# Set BN_ASM to bn_asm.o if you want to use the C version
|
||||
@@ -173,16 +173,11 @@ SHELL=/bin/sh
|
||||
TOP= .
|
||||
ONEDIRS=out tmp
|
||||
EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep
|
||||
MISC= COPYRIGHT Configure HISTORY.090 HISTORY.066 INSTALL Makefile.ssl \
|
||||
Makefile \
|
||||
README TODO HISTORY README.066 README.080 README.090 \
|
||||
VERSION PROBLEMS MINFO makefile.one e_os.h \
|
||||
MICROSOFT makevms.com config PATENTS
|
||||
WDIRS= windows
|
||||
LIBS= libcrypto.a libssl.a
|
||||
|
||||
GENERAL= Makefile
|
||||
BASENAME= SSLeay
|
||||
BASENAME= openssl
|
||||
NAME= $(BASENAME)-$(VERSION)
|
||||
TARFILE= $(NAME).tar
|
||||
WTARFILE= $(NAME)-win.tar
|
||||
@@ -234,16 +229,15 @@ files: MINFO
|
||||
done;
|
||||
|
||||
links:
|
||||
/bin/rm -f Makefile;
|
||||
./util/point.sh Makefile.ssl Makefile;
|
||||
$(TOP)/util/mklink.sh include $(EXHEADER) ;
|
||||
/bin/rm -f Makefile
|
||||
./util/point.sh Makefile.ssl Makefile
|
||||
$(TOP)/util/mklink.sh include $(EXHEADER)
|
||||
@for i in $(DIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making links in $$i..."; \
|
||||
$(MAKE) SDIRS='${SDIRS}' links ); \
|
||||
done;
|
||||
# @(cd apps; sh ./mklinks)
|
||||
@( SSLEAY="`pwd`/apps/ssleay"; export SSLEAY; sh tools/c_rehash certs )
|
||||
@(SSLEAY="`pwd`/apps/ssleay"; export SSLEAY; sh tools/c_rehash certs)
|
||||
|
||||
dclean:
|
||||
/bin/rm -f *.bak
|
||||
@@ -292,16 +286,13 @@ errors:
|
||||
done;
|
||||
|
||||
tar:
|
||||
@(cd ..;\
|
||||
mv $(BASENAME) $(NAME); \
|
||||
export STUFF; \
|
||||
for i in $(MISC) $(DIRS) $(EDIRS) $(ONEDIRS) ;\
|
||||
do \
|
||||
STUFF="$$STUFF $(NAME)/$$i"; \
|
||||
done; \
|
||||
tar cf $(NAME)/$(TARFILE) $$STUFF; \
|
||||
mv $(NAME) $(BASENAME) )
|
||||
gzip -f $(TARFILE)
|
||||
@gtar --no-recursion -cvf - \
|
||||
`find * -depth -print | grep -v CVS | grep -v .cvsignore | sort` |\
|
||||
tardy --user_number=0 --user_name=rse \
|
||||
--group_number=0 --group_name=openssl \
|
||||
--prefix=openssl-$(VERSION) - |\
|
||||
gzip --best >../$(TARFILE).gz; \
|
||||
ls -l ../$(TARFILE).gz
|
||||
|
||||
dist:
|
||||
perl Configure dist
|
||||
|
||||
13
PATENTS
13
PATENTS
@@ -1,13 +0,0 @@
|
||||
RSA Data Security holds software patents on the RSA and RC5 algorithms.
|
||||
If there ciphers are used used inside the USA (and Japan?), you must contact
|
||||
RSA Data Security for licencing conditions. Their web page is
|
||||
http://www.rsa.com
|
||||
|
||||
RC4 is a trademark of RSA Data Security, so use of this label should perhaps
|
||||
only me used with RSA Data Security's permission.
|
||||
|
||||
The IDEA algorithm is patented by Ascom in Austria, France, Germany,
|
||||
Italy, Japan, Netherlands, Spain, Sweden, Switzerland, UK and the USA.
|
||||
They should be contacted if that algorithm is to be used, their web page is
|
||||
http://www.ascom.ch
|
||||
|
||||
254
README
254
README
@@ -1,173 +1,119 @@
|
||||
SSLeay 0.9.1a 06-Jul-1998
|
||||
Copyright (c) 1997, Eric Young
|
||||
All rights reserved.
|
||||
|
||||
This directory contains Eric Young's (eay@cryptsoft.com) implementation
|
||||
of SSL and supporting libraries.
|
||||
OpenSSL 0.9.1c 23-Dec-1998
|
||||
|
||||
The current version of this library is available from
|
||||
ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.x.x.tar.gz
|
||||
Copyright (c) 1998 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric Young
|
||||
All rights reserved.
|
||||
|
||||
There are patches to a number of internet applications which can be found in
|
||||
ftp://ftp.psy.uq.oz.au/pub/Crypto/SSLapps/
|
||||
The OpenSSL Project is a collaborative effort to develop a robust,
|
||||
commercial-grade, fully featured, and Open Source toolkit implementing the
|
||||
Transport Layer Security (TLS v1) and Secure Sockets Layer (SSL v2/v3)
|
||||
protocols with full-strength cryptography world-wide. The project is managed
|
||||
by a worldwide community of volunteers that use the Internet to communicate,
|
||||
plan, and develop the OpenSSL tookit and its related documentation.
|
||||
|
||||
A Web page containing the SSLeay FAQ written by Tim Hudson <tjh@cryptsoft.com>
|
||||
can be found at
|
||||
http://www.psy.uq.oz.au/~ftp/Crypto
|
||||
OpenSSL is based on the excellent SSLeay library developed from Eric A. Young
|
||||
and Tim J. Hudson. The OpenSSL toolkit is licensed under a BSD-style licence,
|
||||
which basically means that you are free to get and use it for commercial and
|
||||
non-commercial purposes.
|
||||
|
||||
Additional documentation is being slowly written by Eric Young, and is being
|
||||
added to http://www.cryptsoft.com/ssleay/doc. It will normally also be
|
||||
available on http://www.psy.uq.oz.au/~ftp/Crypto/ssleay
|
||||
The package includes:
|
||||
|
||||
This Library and programs are FREE for commercial and non-commercial
|
||||
usage. The only restriction is that I must be attributed with the
|
||||
development of this code. See the COPYRIGHT file for more details.
|
||||
Donations would still be accepted :-).
|
||||
libssl.a:
|
||||
Implementation of SSLv2, SSLv3, TLSv1 and the required code to support
|
||||
both SSLv2, SSLv3 and TLSv1 in the one server.
|
||||
|
||||
THIS LIBRARY IS NOT %100 COMPATABLE WITH SSLeay 0.6.6
|
||||
libcrypto.a:
|
||||
General encryption and X.509 stuff needed by TLS/SSL but not actually
|
||||
logically part of it. It includes routines for the following:
|
||||
|
||||
The package includes
|
||||
Ciphers
|
||||
libdes - EAY's libdes DES encryption package which has been floating
|
||||
around the net for a few years. It includes 15
|
||||
'modes/variations' of DES (1, 2 and 3 key versions of ecb,
|
||||
cbc, cfb and ofb; pcbc and a more general form of cfb and
|
||||
ofb) including desx in cbc mode, a fast crypt(3), and
|
||||
routines to read passwords from the keyboard.
|
||||
RC4 encryption,
|
||||
RC2 encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
Blowfish encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
IDEA encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
|
||||
libssl.a:
|
||||
My implementation of SSLv2, SSLv3 and the required code to support
|
||||
both SSLv2 and SSLv3 in the one server.
|
||||
Digests
|
||||
MD5 and MD2 message digest algorithms, fast implementations,
|
||||
SHA (SHA-0) and SHA-1 message digest algorithms,
|
||||
MDC2 message digest. A DES based hash that is polular on smart cards.
|
||||
|
||||
libcrypto.a:
|
||||
General encryption and X509 stuff needed by SSL but not
|
||||
actually logically part of it. It includes routines for the following:
|
||||
Public Key
|
||||
RSA encryption/decryption/generation.
|
||||
There is no limit on the number of bits.
|
||||
DSA encryption/decryption/generation.
|
||||
There is no limit on the number of bits.
|
||||
Diffie-Hellman key-exchange/key generation.
|
||||
There is no limit on the number of bits.
|
||||
|
||||
Ciphers
|
||||
libdes - My libdes DES encryption package which has been floating
|
||||
around the net for a few years. It includes 15
|
||||
'modes/variations' of DES (1, 2 and 3 key versions of ecb,
|
||||
cbc, cfb and ofb; pcbc and a more general form of cfb and ofb)
|
||||
including desx in cbc mode,
|
||||
a fast crypt(3), and routines to read passwords from the
|
||||
keyboard.
|
||||
RC4 encryption,
|
||||
RC2 encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
Blowfish encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
IDEA encryption - 4 different modes, ecb, cbc, cfb and ofb.
|
||||
X.509v3 certificates
|
||||
X509 encoding/decoding into/from binary ASN1 and a PEM
|
||||
based ascii-binary encoding which supports encryption with a
|
||||
private key. Program to generate RSA and DSA certificate
|
||||
requests and to generate RSA and DSA certificates.
|
||||
|
||||
Digests
|
||||
MD5 and MD2 message digest algorithms, fast implementations,
|
||||
SHA (SHA-0) and SHA-1 message digest algorithms,
|
||||
MDC2 message digest. A DES based hash that is polular on smart cards.
|
||||
Systems
|
||||
The normal digital envelope routines and base64 encoding. Higher
|
||||
level access to ciphers and digests by name. New ciphers can be
|
||||
loaded at run time. The BIO io system which is a simple non-blocking
|
||||
IO abstraction. Current methods supported are file descriptors,
|
||||
sockets, socket accept, socket connect, memory buffer, buffering, SSL
|
||||
client/server, file pointer, encryption, digest, non-blocking testing
|
||||
and null.
|
||||
|
||||
Public Key
|
||||
RSA encryption/decryption/generation. There is no limit
|
||||
on the number of bits.
|
||||
DSA encryption/decryption/generation. There is no limit on the
|
||||
number of bits.
|
||||
Diffie-Hellman key-exchange/key generation. There is no limit
|
||||
on the number of bits.
|
||||
Data structures
|
||||
A dynamically growing hashing system
|
||||
A simple stack.
|
||||
A Configuration loader that uses a format similar to MS .ini files.
|
||||
|
||||
X509v3 certificates
|
||||
X509 encoding/decoding into/from binary ASN1 and a PEM
|
||||
based ascii-binary encoding which supports encryption with
|
||||
a private key.
|
||||
Program to generate RSA and DSA certificate requests and to
|
||||
generate RSA and DSA certificates.
|
||||
|
||||
Systems
|
||||
The normal digital envelope routines and base64 encoding.
|
||||
Higher level access to ciphers and digests by name. New ciphers can be
|
||||
loaded at run time.
|
||||
The BIO io system which is a simple non-blocking IO abstraction.
|
||||
Current methods supported are file descriptors, sockets,
|
||||
socket accept, socket connect, memory buffer, buffering,
|
||||
SSL client/server, file pointer, encryption, digest,
|
||||
non-blocking testing and null.
|
||||
Data structures
|
||||
A dynamically growing hashing system
|
||||
A simple stack.
|
||||
A Configuration loader that uses a format similar to MS .ini files.
|
||||
|
||||
Programs in this package include
|
||||
enc - a general encryption program that can encrypt/decrypt using
|
||||
one of 17 different cipher/mode combinations. The
|
||||
input/output can also be converted to/from base64
|
||||
ascii encoding.
|
||||
dgst - a generate message digesting program that will generate
|
||||
message digests for any of md2, md5, sha (sha-0 or sha-1)
|
||||
or mdc2.
|
||||
asn1parse - parse and display the structure of an asn1 encoded
|
||||
binary file.
|
||||
rsa - Manipulate RSA private keys.
|
||||
dsa - Manipulate DSA private keys.
|
||||
dh - Manipulate Diffie-Hellman parameter files.
|
||||
dsaparam- Manipulate and generate DSA parameter files.
|
||||
crl - Manipulate certificate revocation lists.
|
||||
crt2pkcs7- Generate a pkcs7 object containing a crl and a certificate.
|
||||
x509 - Manipulate x509 certificates, self-sign certificates.
|
||||
req - Manipulate PKCS#10 certificate requests and also
|
||||
generate certificate requests.
|
||||
genrsa - Generates an arbitrary sized RSA private key.
|
||||
gendh - Generates a set of Diffie-Hellman parameters, the prime
|
||||
will be a strong prime.
|
||||
ca - Create certificates from PKCS#10 certificate requests.
|
||||
This program also maintains a database of certificates
|
||||
issued.
|
||||
verify - Check x509 certificate signatures.
|
||||
speed - Benchmark SSLeay's ciphers.
|
||||
s_server- A test SSL server.
|
||||
s_client- A test SSL client.
|
||||
s_time - Benchmark SSL performance of SSL server programs.
|
||||
errstr - Convert from SSLeay hex error codes to a readable form.
|
||||
|
||||
Documents avaliable are
|
||||
A Postscript and html reference manual
|
||||
(written by Tim Hudson tjh@cryptsoft.com).
|
||||
|
||||
A list of text protocol references I used.
|
||||
An initial version of the library manual.
|
||||
Programs in this package include:
|
||||
|
||||
enc - a general encryption program that can encrypt/decrypt using
|
||||
one of 17 different cipher/mode combinations. The
|
||||
input/output can also be converted to/from base64
|
||||
ascii encoding.
|
||||
dgst - a generate message digesting program that will generate
|
||||
message digests for any of md2, md5, sha (sha-0 or sha-1)
|
||||
or mdc2.
|
||||
asn1parse - parse and display the structure of an asn1 encoded
|
||||
binary file.
|
||||
rsa - Manipulate RSA private keys.
|
||||
dsa - Manipulate DSA private keys.
|
||||
dh - Manipulate Diffie-Hellman parameter files.
|
||||
dsaparam- Manipulate and generate DSA parameter files.
|
||||
crl - Manipulate certificate revocation lists.
|
||||
crt2pkcs7- Generate a pkcs7 object containing a crl and a certificate.
|
||||
x509 - Manipulate x509 certificates, self-sign certificates.
|
||||
req - Manipulate PKCS#10 certificate requests and also
|
||||
generate certificate requests.
|
||||
genrsa - Generates an arbitrary sized RSA private key.
|
||||
gendh - Generates a set of Diffie-Hellman parameters, the prime
|
||||
will be a strong prime.
|
||||
ca - Create certificates from PKCS#10 certificate requests.
|
||||
This program also maintains a database of certificates
|
||||
issued.
|
||||
verify - Check x509 certificate signatures.
|
||||
speed - Benchmark SSLeay's ciphers.
|
||||
s_server- A test SSL server.
|
||||
s_client- A test SSL client.
|
||||
s_time - Benchmark SSL performance of SSL server programs.
|
||||
errstr - Convert from SSLeay hex error codes to a readable form.
|
||||
|
||||
To install this package, read the INSTALL file.
|
||||
For the Microsoft word, read MICROSOFT
|
||||
This library has been compiled and tested on Solaris 2.[34] (sparc and x86),
|
||||
SunOS 4.1.3, DGUX, OSF1 Alpha, HPUX 9, AIX 3.5(?), IRIX 5.[23],
|
||||
LINUX, NeXT (intel), linux, Windows NT, Windows 3.1, MSDOS 6.22.
|
||||
For the Microsoft world, read INSTALL.W32 file.
|
||||
|
||||
Multithreading has been tested under Windows NT and Solaris 2.5.1
|
||||
For people in the USA, it is possible to compile SSLeay to use RSA Inc.'s
|
||||
public key library, RSAref. From my understanding, it is claimed by RSA Inc.
|
||||
to be illegal to use my public key routines inside the USA. Read
|
||||
doc/rsaref.doc on how to build with RSAref.
|
||||
|
||||
Due to time constraints, the current release has only be rigorously tested
|
||||
on Solaris 2.[45], Linux and Windows NT.
|
||||
|
||||
For people in the USA, it is possible to compile SSLeay to use RSA
|
||||
Inc.'s public key library, RSAref. From my understanding, it is
|
||||
claimed by RSA Inc. to be illegal to use my public key routines inside the USA.
|
||||
Read doc/rsaref.doc on how to build with RSAref.
|
||||
|
||||
Read the documentation in the doc directory. It is quite rough,
|
||||
but it lists the functions, you will probably have to look at
|
||||
the code to work out how to used them. I will be working on
|
||||
documentation. Look at the example programs.
|
||||
|
||||
There should be a SSL reference manual which is being put together by
|
||||
Tim Hudson (tjh@cryptsoft.com) in the same location as this
|
||||
distribution. This contains a lot more information that is very
|
||||
useful. For a description of X509 Certificates, their use, and
|
||||
certification, read rfc1421, rfc1422, rfc1423 and rfc1424. ssl/README
|
||||
also goes over the mechanism.
|
||||
|
||||
We have setup some mailing lists for use by people that are interested
|
||||
in helping develop this code and/or ask questions.
|
||||
ssl-bugs@mincom.oz.au
|
||||
ssl-users@mincom.oz.au
|
||||
ssl-bugs-request@mincom.oz.au
|
||||
ssl-users-request@mincom.oz.au
|
||||
|
||||
I have recently read about a new form of software, that which is in
|
||||
a permanent state of beta release. Linux and Netscape are 2 good
|
||||
examples of this, and I would also add SSLeay to this category.
|
||||
The Current stable release is 0.6.6. It has a few minor problems.
|
||||
0.8.0 is not call compatable so make sure you have the correct version
|
||||
of SSLeay to link with.
|
||||
|
||||
eric (Jun 1997)
|
||||
|
||||
Eric Young (eay@cryptsoft.com)
|
||||
86 Taunton St.
|
||||
Annerley 4103.
|
||||
Australia.
|
||||
Read the documentation in the doc directory. It is quite rough, but it lists
|
||||
the functions, you will probably have to look at the code to work out how to
|
||||
used them. I will be working on documentation. Look at the example programs.
|
||||
|
||||
|
||||
27
README.066
27
README.066
@@ -1,27 +0,0 @@
|
||||
|
||||
SSLeay 0.6.6 13-Jan-1997
|
||||
|
||||
The main additions are
|
||||
|
||||
- assember for x86 DES improvments.
|
||||
From 191,000 per second on a pentium 100, I now get 281,000. The inner
|
||||
loop and the IP/FP modifications are from
|
||||
Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. Many thanks for his
|
||||
contribution.
|
||||
- The 'DES macros' introduced in 0.6.5 now have 3 types.
|
||||
DES_PTR1, DES_PTR2 and 'normal'. As per before, des_opts reports which
|
||||
is best and there is a summery of mine in crypto/des/options.txt
|
||||
- A few bug fixes.
|
||||
- Added blowfish. It is not used by SSL but all the other stuff that
|
||||
deals with ciphers can use it in either ecb, cbc, cfb64 or ofb64 modes.
|
||||
There are 3 options for optimising Blowfish. BF_PTR, BF_PTR2 and 'normal'.
|
||||
BF_PTR2 is pentium/x86 specific. The correct option is setup in
|
||||
the 'Configure' script.
|
||||
- There is now a 'get client certificate' callback which can be
|
||||
'non-blocking'. If more details are required, let me know. It will
|
||||
documented more in SSLv3 when I finish it.
|
||||
- Bug fixes from 0.6.5 including the infamous 'ca' bug. The 'make test'
|
||||
now tests the ca program.
|
||||
- Lots of little things modified and tweaked.
|
||||
|
||||
eric
|
||||
147
README.080
147
README.080
@@ -1,147 +0,0 @@
|
||||
This version of SSLeay has quite a lot of things different from the
|
||||
previous version.
|
||||
|
||||
Basically check all callback parameters, I will be producing documentation
|
||||
about how to use things in th future. Currently I'm just getting 080 out
|
||||
the door. Please not that there are several ways to do everything, and
|
||||
most of the applications in the apps directory are hybrids, some using old
|
||||
methods and some using new methods.
|
||||
|
||||
Have a look in demos/bio for some very simple programs and
|
||||
apps/s_client.c and apps/s_server.c for some more advanced versions.
|
||||
Notes are definitly needed but they are a week or so away.
|
||||
|
||||
Anyway, some quick nots from Tim Hudson (tjh@cryptsoft.com)
|
||||
---
|
||||
Quick porting notes for moving from SSLeay-0.6.x to SSLeay-0.8.x to
|
||||
get those people that want to move to using the new code base off to
|
||||
a quick start.
|
||||
|
||||
Note that Eric has tidied up a lot of the areas of the API that were
|
||||
less than desirable and renamed quite a few things (as he had to break
|
||||
the API in lots of places anyrate). There are a whole pile of additional
|
||||
functions for making dealing with (and creating) certificates a lot
|
||||
cleaner.
|
||||
|
||||
01-Jul-97
|
||||
Tim Hudson
|
||||
tjh@cryptsoft.com
|
||||
|
||||
---8<---
|
||||
|
||||
To maintain code that uses both SSLeay-0.6.x and SSLeay-0.8.x you could
|
||||
use something like the following (assuming you #include "crypto.h" which
|
||||
is something that you really should be doing).
|
||||
|
||||
#if SSLEAY_VERSION_NUMBER >= 0x0800
|
||||
#define SSLEAY8
|
||||
#endif
|
||||
|
||||
buffer.h -> splits into buffer.h and bio.h so you need to include bio.h
|
||||
too if you are working with BIO internal stuff (as distinct
|
||||
from simply using the interface in an opaque manner)
|
||||
|
||||
#include "bio.h" - required along with "buffer.h" if you write
|
||||
your own BIO routines as the buffer and bio
|
||||
stuff that was intermixed has been separated
|
||||
out
|
||||
|
||||
envelope.h -> evp.h (which should have been done ages ago)
|
||||
|
||||
Initialisation ... don't forget these or you end up with code that
|
||||
is missing the bits required to do useful things (like ciphers):
|
||||
|
||||
SSLeay_add_ssl_algorithms()
|
||||
(probably also want SSL_load_error_strings() too but you should have
|
||||
already had that call in place)
|
||||
|
||||
SSL_CTX_new() - requires an extra method parameter
|
||||
SSL_CTX_new(SSLv23_method())
|
||||
SSL_CTX_new(SSLv2_method())
|
||||
SSL_CTX_new(SSLv3_method())
|
||||
|
||||
OR to only have the server or the client code
|
||||
SSL_CTX_new(SSLv23_server_method())
|
||||
SSL_CTX_new(SSLv2_server_method())
|
||||
SSL_CTX_new(SSLv3_server_method())
|
||||
or
|
||||
SSL_CTX_new(SSLv23_client_method())
|
||||
SSL_CTX_new(SSLv2_client_method())
|
||||
SSL_CTX_new(SSLv3_client_method())
|
||||
|
||||
SSL_set_default_verify_paths() ... renamed to the more appropriate
|
||||
SSL_CTX_set_default_verify_paths()
|
||||
|
||||
If you want to use client certificates then you have to add in a bit
|
||||
of extra stuff in that a SSLv3 server sends a list of those CAs that
|
||||
it will accept certificates from ... so you have to provide a list to
|
||||
SSLeay otherwise certain browsers will not send client certs.
|
||||
|
||||
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(s_cert_file));
|
||||
|
||||
|
||||
X509_NAME_oneline(X) -> X509_NAME_oneline(X,NULL,0)
|
||||
or provide a buffer and size to copy the
|
||||
result into
|
||||
|
||||
X509_add_cert -> X509_STORE_add_cert (and you might want to read the
|
||||
notes on X509_NAME structure changes too)
|
||||
|
||||
|
||||
VERIFICATION CODE
|
||||
=================
|
||||
|
||||
The codes have all be renamed from VERIFY_ERR_* to X509_V_ERR_* to
|
||||
more accurately reflect things.
|
||||
|
||||
The verification callback args are now packaged differently so that
|
||||
extra fields for verification can be added easily in future without
|
||||
having to break things by adding extra parameters each release :-)
|
||||
|
||||
X509_cert_verify_error_string -> X509_verify_cert_error_string
|
||||
|
||||
|
||||
BIO INTERNALS
|
||||
=============
|
||||
|
||||
Eric has fixed things so that extra flags can be introduced in
|
||||
the BIO layer in future without having to play with all the BIO
|
||||
modules by adding in some macros.
|
||||
|
||||
The ugly stuff using
|
||||
b->flags ~= (BIO_FLAGS_RW|BIO_FLAGS_SHOULD_RETRY)
|
||||
becomes
|
||||
BIO_clear_retry_flags(b)
|
||||
|
||||
b->flags |= (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)
|
||||
becomes
|
||||
BIO_set_retry_read(b)
|
||||
|
||||
Also ... BIO_get_retry_flags(b), BIO_set_flags(b)
|
||||
|
||||
|
||||
|
||||
OTHER THINGS
|
||||
============
|
||||
|
||||
X509_NAME has been altered so that it isn't just a STACK ... the STACK
|
||||
is now in the "entries" field ... and there are a pile of nice functions
|
||||
for getting at the details in a much cleaner manner.
|
||||
|
||||
SSL_CTX has been altered ... "cert" is no longer a direct member of this
|
||||
structure ... things are now down under "cert_store" (see x509_vfy.h) and
|
||||
things are no longer in a CERTIFICATE_CTX but instead in a X509_STORE.
|
||||
If your code "knows" about this level of detail then it will need some
|
||||
surgery.
|
||||
|
||||
If you depending on the incorrect spelling of a number of the error codes
|
||||
then you will have to change your code as these have been fixed.
|
||||
|
||||
ENV_CIPHER "type" got renamed to "nid" and as that is what it actually
|
||||
has been all along so this makes things clearer.
|
||||
ify_cert_error_string(ctx->error));
|
||||
|
||||
SSL_R_NO_CIPHER_WE_TRUST -> SSL_R_NO_CIPHER_LIST
|
||||
and SSL_R_REUSE_CIPHER_LIST_NOT_ZERO
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
10-Apr-1998
|
||||
I said the next version would go out at easter, and so it shall.
|
||||
I expect a 0.9.1 will follow with portability fixes in the next few weeks.
|
||||
|
||||
This is a quick, meet the deadline. Look to ssl-users for comments on what
|
||||
is new etc.
|
||||
|
||||
eric (about to go bushwalking for the 4 day easter break :-)
|
||||
21
README.PATENTS
Normal file
21
README.PATENTS
Normal file
@@ -0,0 +1,21 @@
|
||||
Various companies hold various patents for various algorithms in
|
||||
various locations around the world. YOU are responsible for ensuring
|
||||
that your use of any algorithms is legel by checking if there are any
|
||||
patents in your country. The file contains some of the patents that we
|
||||
know about or are rumoured to exist. This is not a definitive list.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
RSA Data Security holds software patents on the RSA and RC5 algorithms.
|
||||
If their ciphers are used used inside the USA (and Japan?), you must contact
|
||||
RSA Data Security for licencing conditions. Their web page is
|
||||
http://www.rsa.com
|
||||
|
||||
RC4 is a trademark of RSA Data Security, so use of this label should perhaps
|
||||
only be used with RSA Data Security's permission.
|
||||
|
||||
The IDEA algorithm is patented by Ascom in Austria, France, Germany,
|
||||
Italy, Japan, Netherlands, Spain, Sweden, Switzerland, UK and the USA.
|
||||
They should be contacted if that algorithm is to be used, their web page is
|
||||
http://www.ascom.ch
|
||||
|
||||
@@ -30,7 +30,7 @@ in any bug report:
|
||||
|
||||
For example:
|
||||
|
||||
SSLeay-0.5.1a
|
||||
OpenSSL-0.9.1c
|
||||
SunOS 5.3, SPARC, SunC 3.0
|
||||
SSLtelnet-0.7
|
||||
|
||||
@@ -38,13 +38,7 @@ For example:
|
||||
the following stack trackback
|
||||
...
|
||||
|
||||
Report the bug to the OpenSSL project at:
|
||||
|
||||
Report the bug to either
|
||||
ssleay@mincom.oz.au (Eric and Tim)
|
||||
or
|
||||
ssl-bugs@mincom.oz.au (mailing list of active developers)
|
||||
|
||||
|
||||
Tim Hudson
|
||||
tjh@mincom.oz.au
|
||||
openssl-bugs@openssl.org
|
||||
|
||||
28
TODO
28
TODO
@@ -1,28 +0,0 @@
|
||||
- The loading of the netscape RC4 encrypted key is a crock of pig pellets.
|
||||
It will be reworked along with a nice general mechanism for encrypting
|
||||
ASN.1 stuff. [ Jun 96 ] I've cleaned up private keys internally but
|
||||
still have not done PKCS#8 support.
|
||||
|
||||
- Winsock support in s_client/s_server for windows nt/3.1 is a crock.
|
||||
I will probably not get this fixed for a while, it is just there so
|
||||
I could test things.
|
||||
|
||||
- Be able to generate DSS certificates.
|
||||
|
||||
- Add CRL to the X509 verification stuff, this will probably be added with
|
||||
SSLv3.
|
||||
|
||||
+ X509 callback. I need to callback the application to retrieve certificates
|
||||
and CRL.
|
||||
|
||||
*<- designates the things I'm activly working on.
|
||||
+<- designates that which I have next in the queue.
|
||||
|
||||
====
|
||||
|
||||
X509v3 extensions
|
||||
verify certificate chains
|
||||
X509 cert lookup methods
|
||||
RSA/DSA/DH methods mostly for smart cards
|
||||
dsa cert generation
|
||||
|
||||
24
VERSION
24
VERSION
@@ -1,24 +0,0 @@
|
||||
SSLeay 0.8.1
|
||||
- Mostly bug fixes. There is an Ephemeral DH cipher problem which
|
||||
is fixed.
|
||||
|
||||
SSLeay 0.8.0
|
||||
- New release, for those that are wondering what happend to
|
||||
0.7.x, call it our internal development version :-)
|
||||
- There have been lots of changes, mostly the addition of SSLv3.
|
||||
- There have been many additions from people and amongst
|
||||
others, C2Net has assisted greatly.
|
||||
|
||||
SSLeay 0.6.6
|
||||
SSLeay 0.8.0 is not upward compatable with SSLeay 0.6.6, so
|
||||
if your application requires 0.6.6, use it. There have been
|
||||
lots of bug fixes to 0.8.x that have not been applied to 0.6.6
|
||||
so use 0.8.0+ in preference.
|
||||
|
||||
PORTING 0.6.6 to 0.8.0
|
||||
I'll be documenting this over the next few weeks but as
|
||||
pressures have been increasing for making SSLv3 support
|
||||
available I'm shipping it without this documentation as I
|
||||
basically have not had time to write it (too busy earning a
|
||||
living :-)
|
||||
|
||||
1
apps/.cvsignore
Normal file
1
apps/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
ssleay
|
||||
@@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
/* A nice addition from Dr Stephen Henson <shenson@bigfoot.com> to
|
||||
* add the -strparse option which parses nested binarary structures
|
||||
* add the -strparse option which parses nested binary structures
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
324
apps/bss_file.c
Normal file
324
apps/bss_file.c
Normal file
@@ -0,0 +1,324 @@
|
||||
/* crypto/bio/bss_file.c */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#define APPS_WIN16
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bio.h"
|
||||
#include "err.h"
|
||||
|
||||
#ifndef NOPROTO
|
||||
static int MS_CALLBACK file_write(BIO *h,char *buf,int num);
|
||||
static int MS_CALLBACK file_read(BIO *h,char *buf,int size);
|
||||
static int MS_CALLBACK file_puts(BIO *h,char *str);
|
||||
static int MS_CALLBACK file_gets(BIO *h,char *str,int size);
|
||||
static long MS_CALLBACK file_ctrl(BIO *h,int cmd,long arg1,char *arg2);
|
||||
static int MS_CALLBACK file_new(BIO *h);
|
||||
static int MS_CALLBACK file_free(BIO *data);
|
||||
#else
|
||||
static int MS_CALLBACK file_write();
|
||||
static int MS_CALLBACK file_read();
|
||||
static int MS_CALLBACK file_puts();
|
||||
static int MS_CALLBACK file_gets();
|
||||
static long MS_CALLBACK file_ctrl();
|
||||
static int MS_CALLBACK file_new();
|
||||
static int MS_CALLBACK file_free();
|
||||
#endif
|
||||
|
||||
static BIO_METHOD methods_filep=
|
||||
{
|
||||
BIO_TYPE_FILE,"FILE pointer",
|
||||
file_write,
|
||||
file_read,
|
||||
file_puts,
|
||||
file_gets,
|
||||
file_ctrl,
|
||||
file_new,
|
||||
file_free,
|
||||
};
|
||||
|
||||
BIO *BIO_new_file(filename,mode)
|
||||
char *filename;
|
||||
char *mode;
|
||||
{
|
||||
BIO *ret;
|
||||
FILE *file;
|
||||
|
||||
if ((file=fopen(filename,mode)) == NULL)
|
||||
{
|
||||
SYSerr(SYS_F_FOPEN,errno);
|
||||
BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
|
||||
return(NULL);
|
||||
}
|
||||
if ((ret=BIO_new_fp(file,BIO_CLOSE)) == NULL)
|
||||
{
|
||||
fclose(file);
|
||||
return(NULL);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
BIO *BIO_new_fp(stream,close_flag)
|
||||
FILE *stream;
|
||||
int close_flag;
|
||||
{
|
||||
BIO *ret;
|
||||
|
||||
if ((ret=BIO_new(BIO_s_file())) == NULL)
|
||||
return(NULL);
|
||||
BIO_set_fp(ret,stream,close_flag);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#if !defined(WIN16) || defined(APPS_WIN16)
|
||||
|
||||
BIO_METHOD *BIO_s_file()
|
||||
{
|
||||
return(&methods_filep);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BIO_METHOD *BIO_s_file_internal_w16()
|
||||
{
|
||||
return(&methods_filep);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int MS_CALLBACK file_new(bi)
|
||||
BIO *bi;
|
||||
{
|
||||
bi->init=0;
|
||||
bi->num=0;
|
||||
bi->ptr=NULL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK file_free(a)
|
||||
BIO *a;
|
||||
{
|
||||
if (a == NULL) return(0);
|
||||
if (a->shutdown)
|
||||
{
|
||||
if ((a->init) && (a->ptr != NULL))
|
||||
{
|
||||
fclose((FILE *)a->ptr);
|
||||
a->ptr=NULL;
|
||||
}
|
||||
a->init=0;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK file_read(b,out,outl)
|
||||
BIO *b;
|
||||
char *out;
|
||||
int outl;
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
if (b->init && (out != NULL))
|
||||
{
|
||||
ret=fread(out,1,(int)outl,(FILE *)b->ptr);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK file_write(b,in,inl)
|
||||
BIO *b;
|
||||
char *in;
|
||||
int inl;
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
if (b->init && (in != NULL))
|
||||
{
|
||||
if (fwrite(in,(int)inl,1,(FILE *)b->ptr))
|
||||
ret=inl;
|
||||
/* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */
|
||||
/* acording to Tim Hudson <tjh@cryptsoft.com>, the commented
|
||||
* out version above can cause 'inl' write calls under
|
||||
* some stupid stdio implementations (VMS) */
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static long MS_CALLBACK file_ctrl(b,cmd,num,ptr)
|
||||
BIO *b;
|
||||
int cmd;
|
||||
long num;
|
||||
char *ptr;
|
||||
{
|
||||
long ret=1;
|
||||
FILE *fp=(FILE *)b->ptr;
|
||||
FILE **fpp;
|
||||
char p[4];
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case BIO_CTRL_RESET:
|
||||
ret=(long)fseek(fp,num,0);
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret=(long)feof(fp);
|
||||
break;
|
||||
case BIO_CTRL_INFO:
|
||||
ret=ftell(fp);
|
||||
break;
|
||||
case BIO_C_SET_FILE_PTR:
|
||||
file_free(b);
|
||||
b->shutdown=(int)num;
|
||||
b->ptr=(char *)ptr;
|
||||
b->init=1;
|
||||
break;
|
||||
case BIO_C_SET_FILENAME:
|
||||
file_free(b);
|
||||
b->shutdown=(int)num&BIO_CLOSE;
|
||||
if (num & BIO_FP_APPEND)
|
||||
{
|
||||
if (num & BIO_FP_READ)
|
||||
strcpy(p,"a+");
|
||||
else strcpy(p,"a");
|
||||
}
|
||||
else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE))
|
||||
strcpy(p,"r+");
|
||||
else if (num & BIO_FP_WRITE)
|
||||
strcpy(p,"w");
|
||||
else if (num & BIO_FP_READ)
|
||||
strcpy(p,"r");
|
||||
else
|
||||
{
|
||||
BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE);
|
||||
ret=0;
|
||||
break;
|
||||
}
|
||||
#if defined(MSDOS) || defined(WINDOWS)
|
||||
if (!(num & BIO_FP_TEXT))
|
||||
strcat(p,"b");
|
||||
else
|
||||
strcat(p,"t");
|
||||
#endif
|
||||
fp=fopen(ptr,p);
|
||||
if (fp == NULL)
|
||||
{
|
||||
SYSerr(SYS_F_FOPEN,errno);
|
||||
BIOerr(BIO_F_FILE_CTRL,ERR_R_SYS_LIB);
|
||||
ret=0;
|
||||
break;
|
||||
}
|
||||
b->ptr=(char *)fp;
|
||||
b->init=1;
|
||||
break;
|
||||
case BIO_C_GET_FILE_PTR:
|
||||
/* the ptr parameter is actually a FILE ** in this case. */
|
||||
if (ptr != NULL)
|
||||
{
|
||||
fpp=(FILE **)ptr;
|
||||
*fpp=(FILE *)b->ptr;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_GET_CLOSE:
|
||||
ret=(long)b->shutdown;
|
||||
break;
|
||||
case BIO_CTRL_SET_CLOSE:
|
||||
b->shutdown=(int)num;
|
||||
break;
|
||||
case BIO_CTRL_FLUSH:
|
||||
fflush((FILE *)b->ptr);
|
||||
break;
|
||||
case BIO_CTRL_DUP:
|
||||
ret=1;
|
||||
break;
|
||||
|
||||
case BIO_CTRL_PENDING:
|
||||
case BIO_CTRL_PUSH:
|
||||
case BIO_CTRL_POP:
|
||||
default:
|
||||
ret=0;
|
||||
break;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK file_gets(bp,buf,size)
|
||||
BIO *bp;
|
||||
char *buf;
|
||||
int size;
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
buf[0]='\0';
|
||||
fgets(buf,size,(FILE *)bp->ptr);
|
||||
if (buf[0] != '\0')
|
||||
ret=strlen(buf);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int MS_CALLBACK file_puts(bp,str)
|
||||
BIO *bp;
|
||||
char *str;
|
||||
{
|
||||
int n,ret;
|
||||
|
||||
n=strlen(str);
|
||||
ret=file_write(bp,str,n);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
9
apps/c512-key.pem
Normal file
9
apps/c512-key.pem
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIBOwIBAAJBALtv55QyzG6i2PlwZ1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexm
|
||||
q/R4KedLjFEIYjocDui+IXs62NNtXrT8odkCAwEAAQJAbwXq0vJ/+uyEvsNgxLko
|
||||
/V86mGXQ/KrSkeKlL0r4ENxjcyeMAGoKu6J9yMY7+X9+Zm4nxShNfTsf/+Freoe1
|
||||
HQIhAPOSm5Q1YI+KIsII2GeVJx1U69+wnd71OasIPakS1L1XAiEAxQAW+J3/JWE0
|
||||
ftEYakbhUOKL8tD1OaFZS71/5GdG7E8CIQCefUMmySSvwd6kC0VlATSWbW+d+jp/
|
||||
nWmM1KvqnAo5uQIhALqEADu5U1Wvt8UN8UDGBRPQulHWNycuNV45d3nnskWPAiAw
|
||||
ueTyr6WsZ5+SD8g/Hy3xuvF3nPmJRH+rwvVihlcFOg==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
8
apps/c512-req.pem
Normal file
8
apps/c512-req.pem
Normal file
@@ -0,0 +1,8 @@
|
||||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIIBGzCBxgIBADBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEa
|
||||
MBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGkNsaWVudCB0ZXN0
|
||||
IGNlcnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALtv55QyzG6i
|
||||
2PlwZ1pah7++Gv8L5j6Hnyr/uTZE1NLG0ABDDexmq/R4KedLjFEIYjocDui+IXs6
|
||||
2NNtXrT8odkCAwEAATANBgkqhkiG9w0BAQQFAANBAC5JBTeji7RosqMaUIDzIW13
|
||||
oO6+kPhx9fXSpMFHIsY3aH92Milkov/2A4SuZTcnv/P6+8klmS0EaiUKcRzak4E=
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
@@ -1012,7 +1012,7 @@ bad:
|
||||
r->sequence=i;
|
||||
}
|
||||
|
||||
/* we how have a CRL */
|
||||
/* we now have a CRL */
|
||||
if (verbose) BIO_printf(bio_err,"signing CRL\n");
|
||||
if (md != NULL)
|
||||
{
|
||||
@@ -1024,6 +1024,10 @@ bad:
|
||||
}
|
||||
else
|
||||
dgst=EVP_md5();
|
||||
#ifndef NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
dgst = EVP_dss1() ;
|
||||
#endif
|
||||
if (!X509_CRL_sign(crl,pkey,dgst)) goto err;
|
||||
|
||||
PEM_write_bio_X509_CRL(Sout,crl);
|
||||
|
||||
8
apps/crl.out
Normal file
8
apps/crl.out
Normal file
@@ -0,0 +1,8 @@
|
||||
-----BEGIN X509 CRL-----
|
||||
MIIBDjCBuTANBgkqhkiG9w0BAQQFADBgMQswCQYDVQQGEwJBVTEMMAoGA1UECBMD
|
||||
UUxEMRkwFwYDVQQKExBNaW5jb20gUHR5LiBMdGQuMQswCQYDVQQLEwJDUzEbMBkG
|
||||
A1UEAxMSU1NMZWF5IGRlbW8gc2VydmVyFw05NzA3MDkwMDAwMjJaFw05NzA4MDgw
|
||||
MDAwMjJaMCgwEgIBARcNOTUxMDA5MjMzMjA1WjASAgEDFw05NTEyMDEwMTAwMDBa
|
||||
MA0GCSqGSIb3DQEBBAUAA0EAcEBIWVZPXxSlLMPPLfBi4s0N3lzTgskZkgO6pjZi
|
||||
oQRwh5vi5zFqDNQteGx7RTHpUYntgyoAZ87FZE0GOJgBaQ==
|
||||
-----END X509 CRL-----
|
||||
@@ -65,9 +65,7 @@ typedef struct {
|
||||
FUNCTION functions[] = {
|
||||
{FUNC_TYPE_GENERAL,"verify",verify_main},
|
||||
{FUNC_TYPE_GENERAL,"asn1parse",asn1parse_main},
|
||||
#ifndef NO_RSA
|
||||
{FUNC_TYPE_GENERAL,"req",req_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"dgst",dgst_main},
|
||||
#ifndef NO_DH
|
||||
{FUNC_TYPE_GENERAL,"dh",dh_main},
|
||||
@@ -77,9 +75,7 @@ FUNCTION functions[] = {
|
||||
{FUNC_TYPE_GENERAL,"gendh",gendh_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"errstr",errstr_main},
|
||||
#ifndef NO_RSA
|
||||
{FUNC_TYPE_GENERAL,"ca",ca_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"crl",crl_main},
|
||||
#ifndef NO_RSA
|
||||
{FUNC_TYPE_GENERAL,"rsa",rsa_main},
|
||||
@@ -90,9 +86,7 @@ FUNCTION functions[] = {
|
||||
#ifndef NO_DSA
|
||||
{FUNC_TYPE_GENERAL,"dsaparam",dsaparam_main},
|
||||
#endif
|
||||
#ifndef NO_RSA
|
||||
{FUNC_TYPE_GENERAL,"x509",x509_main},
|
||||
#endif
|
||||
#ifndef NO_RSA
|
||||
{FUNC_TYPE_GENERAL,"genrsa",genrsa_main},
|
||||
#endif
|
||||
|
||||
@@ -718,9 +718,11 @@ loop:
|
||||
goto end;
|
||||
}
|
||||
fprintf(stdout,"Modulus=");
|
||||
#ifndef NO_RSA
|
||||
if (pubkey->type == EVP_PKEY_RSA)
|
||||
BN_print(out,pubkey->pkey.rsa->n);
|
||||
else
|
||||
#endif
|
||||
fprintf(stdout,"Wrong Algorithm type");
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ static void sv_usage()
|
||||
{
|
||||
BIO_printf(bio_err,"usage: s_server [args ...]\n");
|
||||
BIO_printf(bio_err,"\n");
|
||||
BIO_printf(bio_err," -accept arg - port to accept on (default is %d\n",PORT);
|
||||
BIO_printf(bio_err," -accept arg - port to accept on (default is %d)\n",PORT);
|
||||
BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n");
|
||||
BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n");
|
||||
BIO_printf(bio_err," -cert arg - certificate file to use, PEM format assumed\n");
|
||||
|
||||
@@ -332,7 +332,12 @@ char *ip;
|
||||
if (ip == NULL)
|
||||
server.sin_addr.s_addr=INADDR_ANY;
|
||||
else
|
||||
/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
|
||||
#ifndef BIT_FIELD_LIMITS
|
||||
memcpy(&server.sin_addr.s_addr,ip,4);
|
||||
#else
|
||||
memcpy(&server.sin_addr,ip,4);
|
||||
#endif
|
||||
s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
|
||||
|
||||
if (s == INVALID_SOCKET) goto err;
|
||||
|
||||
BIN
apps/stuff/pkcs12.der
Normal file
BIN
apps/stuff/pkcs12.der
Normal file
Binary file not shown.
25
apps/stuff/pkcs7.ex1
Normal file
25
apps/stuff/pkcs7.ex1
Normal file
@@ -0,0 +1,25 @@
|
||||
-----BEGIN xxx-----
|
||||
MIAGCSqGSIb3DQEHAqCAMIACAQExADCABgkqhkiG9w0BBwEAAKCAMIIB
|
||||
rTCCAUkCAgC2MA0GCSqGSIb3DQEBAgUAME0xCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEcMBoGA1UECxMT
|
||||
UGVyc29uYSBDZXJ0aWZpY2F0ZTAeFw05NDA0MDkwMDUwMzdaFw05NDA4
|
||||
MDIxODM4NTdaMGcxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0
|
||||
YSBTZWN1cml0eSwgSW5jLjEcMBoGA1UECxMTUGVyc29uYSBDZXJ0aWZp
|
||||
Y2F0ZTEYMBYGA1UEAxMPU2V0ZWMgQXN0cm9ub215MFwwDQYJKoZIhvcN
|
||||
AQEBBQADSwAwSAJBAMy8QcW7RMrB4sTdQ8Nmb2DFmJmkWn+el+NdeamI
|
||||
DElX/qw9mIQu4xNj1FfepfJNxzPvA0OtMKhy6+bkrlyMEU8CAwEAATAN
|
||||
BgkqhkiG9w0BAQIFAANPAAYn7jDgirhiIL4wnP8nGzUisGSpsFsF4/7z
|
||||
2P2wqne6Qk8Cg/Dstu3RyaN78vAMGP8d82H5+Ndfhi2mRp4YHiGHz0Hl
|
||||
K6VbPfnyvS2wdjCCAccwggFRAgUCQAAAFDANBgkqhkiG9w0BAQIFADBf
|
||||
MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXUlNBIERhdGEgU2VjdXJpdHks
|
||||
IEluYy4xLjAsBgNVBAsTJUxvdyBBc3N1cmFuY2UgQ2VydGlmaWNhdGlv
|
||||
biBBdXRob3JpdHkwHhcNOTQwMTA3MDAwMDAwWhcNOTYwMTA3MjM1OTU5
|
||||
WjBNMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXUlNBIERhdGEgU2VjdXJp
|
||||
dHksIEluYy4xHDAaBgNVBAsTE1BlcnNvbmEgQ2VydGlmaWNhdGUwaTAN
|
||||
BgkqhkiG9w0BAQEFAANYADBVAk4GqghQDa9Xi/2zAdYEqJVIcYhlLN1F
|
||||
pI9tXQ1m6zZ39PYXK8Uhoj0Es7kWRv8hC04vqkOKwndWbzVtvoHQOmP8
|
||||
nOkkuBi+AQvgFoRcgOUCAwEAATANBgkqhkiG9w0BAQIFAANhAD/5Uo7x
|
||||
Ddp49oZm9GoNcPhZcW1e+nojLvHXWAU/CBkwfcR+FSf4hQ5eFu1AjYv6
|
||||
Wqf430Xe9Et5+jgnMTiq4LnwgTdA8xQX4elJz9QzQobkE3XVOjVAtCFc
|
||||
miin80RB8AAAMYAAAAAAAAAAAA==
|
||||
-----END xxx-----
|
||||
11
apps/stuff/pkcs7.ex2
Normal file
11
apps/stuff/pkcs7.ex2
Normal file
@@ -0,0 +1,11 @@
|
||||
-----BEGIN PRIVACY-ENHANCED MESSAGE-----
|
||||
MIAGCSqGSIb3DQEHBqCAMIACAQAwgAYJKoZIhvcNAQcBMBEGBSsOAwIHBAifqtdy
|
||||
x6uIMYCCARgvFzJtOZBn773DtmXlx037ck3giqnV0WC0QAx5f+fesAiGaxMqWcir
|
||||
r9XvT0nT0LgSQ/8tiLCDBEKdyCNgdcJAduy3D0r2sb5sNTT0TyL9uydG3w55vTnW
|
||||
aPbCPCWLudArI1UHDZbnoJICrVehxG/sYX069M8v6VO8PsJS7//hh1yM+0nekzQ5
|
||||
l1p0j7uWKu4W0csrlGqhLvEJanj6dQAGSTNCOoH3jzEXGQXntgesk8poFPfHdtj0
|
||||
5RH4MuJRajDmoEjlrNcnGl/BdHAd2JaCo6uZWGcnGAgVJ/TVfSVSwN5nlCK87tXl
|
||||
nL7DJwaPRYwxb3mnPKNq7ATiJPf5u162MbwxrddmiE7e3sST7naSN+GS0ateY5X7
|
||||
AAAAAAAAAAA=
|
||||
-----END PRIVACY-ENHANCED MESSAGE-----
|
||||
|
||||
12
apps/stuff/pkcs7.ex3
Normal file
12
apps/stuff/pkcs7.ex3
Normal file
@@ -0,0 +1,12 @@
|
||||
-----BEGIN PRIVACY-ENHANCED MESSAGE-----
|
||||
MIAGCSqGSIb3DQEHA6CAMIACAQAxgDCBqQIBADBTME0xCzAJBgNVBAYTAlVTMSAw
|
||||
HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEcMBoGA1UECxMTUGVyc29u
|
||||
YSBDZXJ0aWZpY2F0ZQICALYwDQYJKoZIhvcNAQEBBQAEQCU/R+YCJSUsV6XLilHG
|
||||
cNVzwqKcWzmT/rZ+duOv8Ggb7oO/d8H3xUVGQ2LsX4kYGq2szwj8Q6eWhsmhf4oz
|
||||
lvMAADCABgkqhkiG9w0BBwEwEQYFKw4DAgcECFif7BadXlw3oIAEgZBNcMexKe16
|
||||
+mNxx8YQPukBCL0bWqS86lvws/AgRkKPELmysBi5lco8MBCsWK/fCyrnxIRHs1oK
|
||||
BXBVlsAhKkkusk1kCf/GbXSAphdSgG+d6LxrNZwHbBFOX6A2hYS63Iczd5bOVDDW
|
||||
Op2gcgUtMJq6k2LFrs4L7HHqRPPlqNJ6j5mFP4xkzOCNIQynpD1rV6EECMIk/T7k
|
||||
1JLSAAAAAAAAAAAAAA==
|
||||
-----END PRIVACY-ENHANCED MESSAGE-----
|
||||
|
||||
46
apps/stuff/pkcs7.pem
Normal file
46
apps/stuff/pkcs7.pem
Normal file
@@ -0,0 +1,46 @@
|
||||
-----BEGIN PKCS7-----
|
||||
MIIIEgYJKoZIhvcNAQcCMIIIAwIBATEAMAsGCSqGSIb3DQEHAaCCBDUwggIhMIIB
|
||||
jgIFAnIAAGcwDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMxIDAeBgNVBAoT
|
||||
F1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2VydmVy
|
||||
IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk1MDUxNzAwMDAwMFoXDTk1MTEx
|
||||
NjIzNTk1OVowdzELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5h
|
||||
MRIwEAYDVQQHEwlDaGFybG90dGUxIzAhBgNVBAoTGlZuZXQgSW50ZXJuZXQgQWNj
|
||||
ZXNzLCBJbmMuMRYwFAYDVQQDFA13d3cqLnZuZXQubmV0MHwwDQYJKoZIhvcNAQEB
|
||||
BQADawAwaAJhAOngW+io4W1lAp1b2k4+KqICaLHatp6AWkPLpa3Li2mwmggSGeRD
|
||||
AmTI4FQB0EFrDMfKLOteHgGoDJ0vifmV5cKvevRt5Gn+xPn54Halu7i145iUldyv
|
||||
oViUNpWmLJhKTQIDAQABMA0GCSqGSIb3DQEBAgUAA34AQkyfJje6H8fxtN68TvXV
|
||||
RibnPpQol2jMbh0VnK9cP9ePvsXy+7JoGuWxj6zlgjZGwia49xITggZ+0b+wP51l
|
||||
5e8xEEc2K7eC5QVD0qh/NSqdPcVP+UG6UK/LT25w/yLuZgqJ3g87kGbOo9myLhkZ
|
||||
3jr3kXnsriBmwmqcjgUwggIMMIIBlgIFAkAAAEUwDQYJKoZIhvcNAQECBQAwXzEL
|
||||
MAkGA1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4w
|
||||
LAYDVQQLEyVMb3cgQXNzdXJhbmNlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
|
||||
DTk0MTEwOTIzMTk0NFoXDTk5MTIzMTIzMTk0NFowXzELMAkGA1UEBhMCVVMxIDAe
|
||||
BgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUg
|
||||
U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUA
|
||||
A4GJADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwji
|
||||
ioII0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJ
|
||||
VphIuR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJ
|
||||
KoZIhvcNAQECBQADYQAjOCnuhWTdRq+8PhUBSzKbOhmafQQPQ8Ltw+49U8N1zgq9
|
||||
1ROaW46znUQykAPUdaAIflEfV2e0ULuyOWCwDJ2ME7NUmWL86SLkk6QLC9iItjva
|
||||
h+tdpLV/+TerjmrxCWChggOyMIICjTCCAfowDQYJKoZIhvcNAQECBQAwXzELMAkG
|
||||
A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD
|
||||
VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5Fw05NTA1
|
||||
MDIwMjEyMjZaFw05NTA2MDEwMDAxNDlaMIIBaDAWAgUCQQAABBcNOTUwMjAxMTcy
|
||||
NDI2WjAWAgUCQQAACRcNOTUwMjEwMDIxNjM5WjAWAgUCQQAADxcNOTUwMjI0MDAx
|
||||
MjQ5WjAWAgUCQQAADBcNOTUwMjI1MDA0NjQ0WjAWAgUCQQAAGxcNOTUwMzEzMTg0
|
||||
MDQ5WjAWAgUCQQAAFhcNOTUwMzE1MTkxNjU0WjAWAgUCQQAAGhcNOTUwMzE1MTk0
|
||||
MDQxWjAWAgUCQQAAHxcNOTUwMzI0MTk0NDMzWjAWAgUCcgAABRcNOTUwMzI5MjAw
|
||||
NzExWjAWAgUCcgAAERcNOTUwMzMwMDIzNDI2WjAWAgUCQQAAIBcNOTUwNDA3MDEx
|
||||
MzIxWjAWAgUCcgAAHhcNOTUwNDA4MDAwMjU5WjAWAgUCcgAAQRcNOTUwNDI4MTcx
|
||||
NzI0WjAWAgUCcgAAOBcNOTUwNDI4MTcyNzIxWjAWAgUCcgAATBcNOTUwNTAyMDIx
|
||||
MjI2WjANBgkqhkiG9w0BAQIFAAN+AHqOEJXSDejYy0UwxxrH/9+N2z5xu/if0J6q
|
||||
QmK92W0hW158wpJg+ovV3+wQwvIEPRL2rocL0tKfAsVq1IawSJzSNgxG0lrcla3M
|
||||
rJBnZ4GaZDu4FutZh72MR3GtJaAL3iTJHJD55kK2D/VoyY1djlsPuNh6AEgdVwFA
|
||||
yp0vMIIBHTCBqDANBgkqhkiG9w0BAQIFADBfMQswCQYDVQQGEwJVUzEgMB4GA1UE
|
||||
ChMXUlNBIERhdGEgU2VjdXJpdHksIEluYy4xLjAsBgNVBAsTJUxvdyBBc3N1cmFu
|
||||
Y2UgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkXDTk1MDUwMTE5MjcyOVoXDTk1MDYw
|
||||
MTA4MDAwMFowGDAWAgUCQAAAXhcNOTUwMjA4MDE0NjIyWjANBgkqhkiG9w0BAQIF
|
||||
AANhAF70VxEAKgGlS2otYkWSqYJ286MMDbdAIoEGCDTtVuLCOP3YKHOSTjFhbIhL
|
||||
5mBd+Q/W+lKSqdoyYhdObaBk4I4Wk+/BE2QK1x4QhtYG144spESXIRIKAbhffg1g
|
||||
rRe/ETEA
|
||||
-----END PKCS7-----
|
||||
16
apps/test.ssl
Normal file
16
apps/test.ssl
Normal file
@@ -0,0 +1,16 @@
|
||||
www.microsoft.com:443
|
||||
sectest.microsoft.com:443
|
||||
https://sectest.microsoft.com/ClientAuth/test.asp
|
||||
ssl3.netscape.com:443
|
||||
ssl3.netscape.com:444
|
||||
www.openmarket.com:443 - no session ID caching. - no swap
|
||||
|
||||
Servers
|
||||
bad www.openmarket.com Open-Market-Secure-WebServer/V2.1
|
||||
bad www.microsoft.com Server: Microsoft-IIS/3.0
|
||||
good transact.netscape.com Netscape-Enterprise/2.01
|
||||
|
||||
clients
|
||||
good netscape
|
||||
hmm MSIE
|
||||
|
||||
@@ -110,7 +110,7 @@ static char *x509_usage[]={
|
||||
" missing, it is asssumed to be in the CA file.\n",
|
||||
" -CAcreateserial - create serial number file if it does not exist\n",
|
||||
" -CAserial - serial file\n",
|
||||
" -text - print the certitificate in text form\n",
|
||||
" -text - print the certificate in text form\n",
|
||||
" -C - print out C code forms\n",
|
||||
" -md2/-md5/-sha1/-mdc2 - digest to do an RSA sign with\n",
|
||||
NULL
|
||||
|
||||
59
certs/ICE-CA.pem
Normal file
59
certs/ICE-CA.pem
Normal file
@@ -0,0 +1,59 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 1 (0x1)
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority
|
||||
Validity
|
||||
Not Before: Apr 2 17:35:53 1997 GMT
|
||||
Not After : Apr 2 17:35:53 1998 GMT
|
||||
Subject: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsa
|
||||
RSA Public Key: (512 bit)
|
||||
Modulus (512 bit):
|
||||
00:82:75:ba:f6:d1:60:b5:f9:15:b3:6a:dd:29:8f:
|
||||
8b:a4:6f:1a:88:e0:50:43:40:0b:79:41:d5:d3:16:
|
||||
44:7d:74:65:17:42:06:52:0b:e9:50:c8:10:cd:24:
|
||||
e2:ae:8d:22:30:73:e6:b4:b7:93:1f:e5:6e:a2:ae:
|
||||
49:11:a5:c9:45
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Authority Key Identifier:
|
||||
0.........z.."p......e..
|
||||
X509v3 Subject Key Identifier:
|
||||
..~r..:..B.44fu......3
|
||||
X509v3 Key Usage: critical
|
||||
....
|
||||
X509v3 Certificate Policies: critical
|
||||
0.0...*...
|
||||
X509v3 Subject Alternative Name:
|
||||
0!..secude-support@darmstadt.gmd.de
|
||||
X509v3 Issuer Alternative Name:
|
||||
0I..ice-tel-ca@darmstadt.gmd.de.*http://www.darmstadt.gmd.de/ice-tel/euroca
|
||||
X509v3 Basic Constraints: critical
|
||||
0....
|
||||
X509v3 CRL Distribution Points:
|
||||
0200...,.*http://www.darmstadt.gmd.de/ice-tel/euroca
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
17:a2:88:b7:99:5a:05:41:e4:13:34:67:e6:1f:3e:26:ec:4b:
|
||||
69:f9:3e:28:22:be:9d:1c:ab:41:6f:0c:00:85:fe:45:74:f6:
|
||||
98:f0:ce:9b:65:53:4a:50:42:c7:d4:92:bd:d7:a2:a8:3d:98:
|
||||
88:73:cd:60:28:79:a3:fc:48:7a
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICzDCCAnagAwIBAgIBATANBgkqhkiG9w0BAQQFADBIMSEwHwYDVQQKExhFdXJv
|
||||
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
|
||||
QXV0aG9yaXR5MB4XDTk3MDQwMjE3MzU1M1oXDTk4MDQwMjE3MzU1M1owXDEhMB8G
|
||||
A1UEChMYRXVyb3BlYW4gSUNFLVRFTCBwcm9qZWN0MSMwIQYDVQQLExpWMy1DZXJ0
|
||||
aWZpY2F0aW9uIEF1dGhvcml0eTESMBAGA1UEBxMJRGFybXN0YWR0MFkwCgYEVQgB
|
||||
AQICAgADSwAwSAJBAIJ1uvbRYLX5FbNq3SmPi6RvGojgUENAC3lB1dMWRH10ZRdC
|
||||
BlIL6VDIEM0k4q6NIjBz5rS3kx/lbqKuSRGlyUUCAwEAAaOCATgwggE0MB8GA1Ud
|
||||
IwQYMBaAFIr3yNUOx3ro1yJw4AuJ1bbsZbzPMB0GA1UdDgQWBBR+cvL4OoacQog0
|
||||
NGZ1w9T80aIRMzAOBgNVHQ8BAf8EBAMCAfYwFAYDVR0gAQH/BAowCDAGBgQqAwQF
|
||||
MCoGA1UdEQQjMCGBH3NlY3VkZS1zdXBwb3J0QGRhcm1zdGFkdC5nbWQuZGUwUgYD
|
||||
VR0SBEswSYEbaWNlLXRlbC1jYUBkYXJtc3RhZHQuZ21kLmRlhipodHRwOi8vd3d3
|
||||
LmRhcm1zdGFkdC5nbWQuZGUvaWNlLXRlbC9ldXJvY2EwDwYDVR0TAQH/BAUwAwEB
|
||||
/zA7BgNVHR8ENDAyMDCgLqAshipodHRwOi8vd3d3LmRhcm1zdGFkdC5nbWQuZGUv
|
||||
aWNlLXRlbC9ldXJvY2EwDQYJKoZIhvcNAQEEBQADQQAXooi3mVoFQeQTNGfmHz4m
|
||||
7Etp+T4oIr6dHKtBbwwAhf5FdPaY8M6bZVNKUELH1JK916KoPZiIc81gKHmj/Eh6
|
||||
-----END CERTIFICATE-----
|
||||
48
certs/ICE-root.pem
Normal file
48
certs/ICE-root.pem
Normal file
@@ -0,0 +1,48 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 0 (0x0)
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority
|
||||
Validity
|
||||
Not Before: Apr 2 17:33:36 1997 GMT
|
||||
Not After : Apr 2 17:33:36 1998 GMT
|
||||
Subject: O=European ICE-TEL project, OU=V3-Certification Authority
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsa
|
||||
RSA Public Key: (512 bit)
|
||||
Modulus (512 bit):
|
||||
00:80:3e:eb:ae:47:a9:fe:10:54:0b:81:8b:9c:2b:
|
||||
82:ab:3a:61:36:65:8b:f3:73:9f:ac:ac:7a:15:a7:
|
||||
13:8f:b4:c4:ba:a3:0f:bc:a5:58:8d:cc:b1:93:31:
|
||||
9e:81:9e:8c:19:61:86:fa:52:73:54:d1:97:76:22:
|
||||
e7:c7:9f:41:cd
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
........z.."p......e..
|
||||
X509v3 Key Usage: critical
|
||||
....
|
||||
X509v3 Subject Alternative Name:
|
||||
0I.*http://www.darmstadt.gmd.de/ice-tel/euroca..ice-tel-ca@darmstadt.gmd.de
|
||||
X509v3 Basic Constraints: critical
|
||||
0....
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
76:69:61:db:b7:cf:8b:06:9e:d8:8c:96:53:d2:4d:a8:23:a6:
|
||||
03:44:e8:8f:24:a5:c0:84:a8:4b:77:d4:2d:2b:7d:37:91:67:
|
||||
f2:2c:ce:02:31:4c:6b:cc:ce:f2:68:a6:11:11:ab:7d:88:b8:
|
||||
7e:22:9f:25:06:60:bd:79:30:3d
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICFjCCAcCgAwIBAgIBADANBgkqhkiG9w0BAQQFADBIMSEwHwYDVQQKExhFdXJv
|
||||
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
|
||||
QXV0aG9yaXR5MB4XDTk3MDQwMjE3MzMzNloXDTk4MDQwMjE3MzMzNlowSDEhMB8G
|
||||
A1UEChMYRXVyb3BlYW4gSUNFLVRFTCBwcm9qZWN0MSMwIQYDVQQLExpWMy1DZXJ0
|
||||
aWZpY2F0aW9uIEF1dGhvcml0eTBZMAoGBFUIAQECAgIAA0sAMEgCQQCAPuuuR6n+
|
||||
EFQLgYucK4KrOmE2ZYvzc5+srHoVpxOPtMS6ow+8pViNzLGTMZ6BnowZYYb6UnNU
|
||||
0Zd2IufHn0HNAgMBAAGjgZcwgZQwHQYDVR0OBBYEFIr3yNUOx3ro1yJw4AuJ1bbs
|
||||
ZbzPMA4GA1UdDwEB/wQEAwIB9jBSBgNVHREESzBJhipodHRwOi8vd3d3LmRhcm1z
|
||||
dGFkdC5nbWQuZGUvaWNlLXRlbC9ldXJvY2GBG2ljZS10ZWwtY2FAZGFybXN0YWR0
|
||||
LmdtZC5kZTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBAUAA0EAdmlh27fP
|
||||
iwae2IyWU9JNqCOmA0TojySlwISoS3fULSt9N5Fn8izOAjFMa8zO8mimERGrfYi4
|
||||
fiKfJQZgvXkwPQ==
|
||||
-----END CERTIFICATE-----
|
||||
63
certs/ICE-user.pem
Normal file
63
certs/ICE-user.pem
Normal file
@@ -0,0 +1,63 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 1 (0x1)
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt
|
||||
Validity
|
||||
Not Before: Apr 2 17:35:59 1997 GMT
|
||||
Not After : Apr 2 17:35:59 1998 GMT
|
||||
Subject: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt, CN=USER
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsa
|
||||
RSA Public Key: (512 bit)
|
||||
Modulus (512 bit):
|
||||
00:a8:a8:53:63:49:1b:93:c3:c3:0b:6c:88:11:55:
|
||||
de:7e:6a:e2:f9:52:a0:dc:69:25:c4:c8:bf:55:e1:
|
||||
31:a8:ce:e4:a9:29:85:99:8a:15:9a:de:f6:2f:e1:
|
||||
b4:50:5f:5e:04:75:a6:f4:76:dc:3c:0e:39:dc:3a:
|
||||
be:3e:a4:61:8b
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Authority Key Identifier:
|
||||
0...~r..:..B.44fu......3
|
||||
X509v3 Subject Key Identifier:
|
||||
...... .*...1.*.......
|
||||
X509v3 Key Usage: critical
|
||||
....
|
||||
X509v3 Certificate Policies: critical
|
||||
0.0...*...0.......
|
||||
X509v3 Subject Alternative Name:
|
||||
0:..user@darmstadt.gmd.de.!http://www.darmstadt.gmd.de/~user
|
||||
X509v3 Issuer Alternative Name:
|
||||
0....gmdca@gmd.de..http://www.gmd.de..saturn.darmstadt.gmd.de.\1!0...U.
|
||||
..European ICE-TEL project1#0!..U....V3-Certification Authority1.0...U....Darmstadt..141.12.62.26
|
||||
X509v3 Basic Constraints: critical
|
||||
0.
|
||||
X509v3 CRL Distribution Points:
|
||||
0.0.......gmdca@gmd.de
|
||||
Signature Algorithm: md5WithRSAEncryption
|
||||
69:0c:e1:b7:a7:f2:d8:fb:e8:69:c0:13:cd:37:ad:21:06:22:
|
||||
4d:e8:c6:db:f1:04:0b:b7:e0:b3:d6:0c:81:03:ce:c3:6a:3e:
|
||||
c7:e7:24:24:a4:92:64:c2:83:83:06:42:53:0e:6f:09:1e:84:
|
||||
9a:f7:6f:63:9b:94:99:83:d6:a4
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDTzCCAvmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBcMSEwHwYDVQQKExhFdXJv
|
||||
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
|
||||
QXV0aG9yaXR5MRIwEAYDVQQHEwlEYXJtc3RhZHQwHhcNOTcwNDAyMTczNTU5WhcN
|
||||
OTgwNDAyMTczNTU5WjBrMSEwHwYDVQQKExhFdXJvcGVhbiBJQ0UtVEVMIHByb2pl
|
||||
Y3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24gQXV0aG9yaXR5MRIwEAYDVQQH
|
||||
EwlEYXJtc3RhZHQxDTALBgNVBAMTBFVTRVIwWTAKBgRVCAEBAgICAANLADBIAkEA
|
||||
qKhTY0kbk8PDC2yIEVXefmri+VKg3GklxMi/VeExqM7kqSmFmYoVmt72L+G0UF9e
|
||||
BHWm9HbcPA453Dq+PqRhiwIDAQABo4IBmDCCAZQwHwYDVR0jBBgwFoAUfnLy+DqG
|
||||
nEKINDRmdcPU/NGiETMwHQYDVR0OBBYEFJfc4B8gjSoRmLUx4Sq/ucIYiMrPMA4G
|
||||
A1UdDwEB/wQEAwIB8DAcBgNVHSABAf8EEjAQMAYGBCoDBAUwBgYECQgHBjBDBgNV
|
||||
HREEPDA6gRV1c2VyQGRhcm1zdGFkdC5nbWQuZGWGIWh0dHA6Ly93d3cuZGFybXN0
|
||||
YWR0LmdtZC5kZS9+dXNlcjCBsQYDVR0SBIGpMIGmgQxnbWRjYUBnbWQuZGWGEWh0
|
||||
dHA6Ly93d3cuZ21kLmRlghdzYXR1cm4uZGFybXN0YWR0LmdtZC5kZaRcMSEwHwYD
|
||||
VQQKExhFdXJvcGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRp
|
||||
ZmljYXRpb24gQXV0aG9yaXR5MRIwEAYDVQQHEwlEYXJtc3RhZHSHDDE0MS4xMi42
|
||||
Mi4yNjAMBgNVHRMBAf8EAjAAMB0GA1UdHwQWMBQwEqAQoA6BDGdtZGNhQGdtZC5k
|
||||
ZTANBgkqhkiG9w0BAQQFAANBAGkM4ben8tj76GnAE803rSEGIk3oxtvxBAu34LPW
|
||||
DIEDzsNqPsfnJCSkkmTCg4MGQlMObwkehJr3b2OblJmD1qQ=
|
||||
-----END CERTIFICATE-----
|
||||
9
certs/ICE.crl
Normal file
9
certs/ICE.crl
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN X509 CRL-----
|
||||
MIIBNDCBnjANBgkqhkiG9w0BAQIFADBFMSEwHwYDVQQKExhFdXJvcGVhbiBJQ0Ut
|
||||
VEVMIFByb2plY3QxIDAeBgNVBAsTF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5Fw05
|
||||
NzA2MDkxNDQyNDNaFw05NzA3MDkxNDQyNDNaMCgwEgIBChcNOTcwMzAzMTQ0MjU0
|
||||
WjASAgEJFw05NjEwMDIxMjI5MjdaMA0GCSqGSIb3DQEBAgUAA4GBAH4vgWo2Tej/
|
||||
i7kbiw4Imd30If91iosjClNpBFwvwUDBclPEeMuYimHbLOk4H8Nofc0fw11+U/IO
|
||||
KSNouUDcqG7B64oY7c4SXKn+i1MWOb5OJiWeodX3TehHjBlyWzoNMWCnYA8XqFP1
|
||||
mOKp8Jla1BibEZf14+/HqCi2hnZUiEXh
|
||||
-----END X509 CRL-----
|
||||
16
certs/vsign4.pem
Normal file
16
certs/vsign4.pem
Normal file
@@ -0,0 +1,16 @@
|
||||
subject=/C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
issuer= /C=US/O=VeriSign, Inc./OU=Class 4 Public Primary Certification Authority
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICMTCCAZoCBQKmAAABMA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMRcw
|
||||
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMg
|
||||
UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NjAxMjkwMDAwMDBa
|
||||
Fw05OTEyMzEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2ln
|
||||
biwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZp
|
||||
Y2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0LJ1
|
||||
9njQrlpQ9OlQqZ+M1++RlHDo0iSQdomF1t+s5gEXMoDwnZNHvJplnR+Xrr/phnVj
|
||||
IIm9gFidBAydqMEk6QvlMXi9/C0MN2qeeIDpRnX57aP7E3vIwUzSo+/1PLBij0pd
|
||||
O92VZ48TucE81qcmm+zDO3rZTbxtm+gVAePwR6kCAwEAATANBgkqhkiG9w0BAQIF
|
||||
AAOBgQBT3dPwnCR+QKri/AAa19oM/DJhuBUNlvP6Vxt/M3yv6ZiaYch6s7f/sdyZ
|
||||
g9ysEvxwyR84Qu1E9oAuW2szaayc01znX1oYx7EteQSWQZGZQbE8DbqEOcY7l/Am
|
||||
yY7uvcxClf8exwI/VAx49byqYHwCaejcrOICdmHEPgPq0ook0Q==
|
||||
-----END CERTIFICATE-----
|
||||
1
crypto/.cvsignore
Normal file
1
crypto/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -54,7 +54,7 @@ top:
|
||||
|
||||
all: date.h lib subdirs
|
||||
|
||||
date.h: ../Makefile.ssl ../VERSION
|
||||
date.h: ../Makefile.ssl
|
||||
echo "#define DATE \"`date`\"" >date.h
|
||||
|
||||
subdirs:
|
||||
@@ -74,11 +74,11 @@ files:
|
||||
|
||||
links:
|
||||
/bin/rm -f Makefile
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile ;
|
||||
$(TOP)/util/mklink.sh ../include $(HEADER) ;
|
||||
$(TOP)/util/mklink.sh ../test $(TEST) ;
|
||||
$(TOP)/util/mklink.sh ../apps $(APPS) ;
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile;
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
$(TOP)/util/mklink.sh ../include $(HEADER)
|
||||
$(TOP)/util/mklink.sh ../test $(TEST)
|
||||
$(TOP)/util/mklink.sh ../apps $(APPS)
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making links in $$i..."; \
|
||||
|
||||
1
crypto/asn1/.cvsignore
Normal file
1
crypto/asn1/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -69,7 +69,7 @@ static int asn1_get_length();
|
||||
static void asn1_put_length();
|
||||
#endif
|
||||
|
||||
char *ASN1_version="ASN1 part of SSLeay 0.9.1a 06-Jul-1998";
|
||||
char *ASN1_version="ASN.1 part of OpenSSL 0.9.1c 23-Dec-1998";
|
||||
|
||||
int ASN1_check_infinite_end(p,len)
|
||||
unsigned char **p;
|
||||
|
||||
117
crypto/asn1/pk.c
Normal file
117
crypto/asn1/pk.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* crypto/asn1/pk.c */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../error/err.h"
|
||||
#include "./asn1.h"
|
||||
#include "rsa.h"
|
||||
#include "x509.h"
|
||||
#include "pkcs7.h"
|
||||
|
||||
main()
|
||||
{
|
||||
PKCS7 *x;
|
||||
FILE *in;
|
||||
unsigned char buf[10240],buf2[10240],*p;
|
||||
int num,i;
|
||||
|
||||
PKCS7 *nx=NULL,*mx=NULL;
|
||||
|
||||
in=fopen("pkcs7.der","r");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("pkcs7.der");
|
||||
exit(1);
|
||||
}
|
||||
num=fread(buf,1,10240,in);
|
||||
fclose(in);
|
||||
|
||||
|
||||
p=buf;
|
||||
if (d2i_PKCS7(&nx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf);
|
||||
|
||||
exit(0);
|
||||
p=buf2;
|
||||
num=i2d_PKCS7(nx,&p);
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
if (memcmp(buf,buf2,num) != 0)
|
||||
{
|
||||
fprintf(stderr,"data difference\n");
|
||||
for (i=0; i<num; i++)
|
||||
fprintf(stderr,"%c%03d <%02X-%02X>\n",
|
||||
(buf[i] == buf2[i])?' ':'*',i,
|
||||
buf[i],buf2[i]);
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
p=buf2;
|
||||
if (d2i_PKCS7(&mx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
/* X509_print(stdout,mx);*/
|
||||
|
||||
exit(0);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
253
crypto/asn1/test.c
Normal file
253
crypto/asn1/test.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/* crypto/asn1/test.c */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../error/err.h"
|
||||
#include "./asn1.h"
|
||||
#include "rsa.h"
|
||||
#include "../x509/x509.h"
|
||||
#include "x509.h"
|
||||
|
||||
main()
|
||||
{
|
||||
main1();
|
||||
main2();
|
||||
main3();
|
||||
main4();
|
||||
}
|
||||
|
||||
main1()
|
||||
{
|
||||
FILE *in;
|
||||
unsigned char buf[10240],buf2[10240],*p;
|
||||
int num,i;
|
||||
|
||||
X509 *nx=NULL,*mx=NULL;
|
||||
|
||||
in=fopen("x.der","r");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("x.der");
|
||||
exit(1);
|
||||
}
|
||||
num=fread(buf,1,10240,in);
|
||||
fclose(in);
|
||||
|
||||
|
||||
p=buf;
|
||||
if (d2i_X509(&nx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf);
|
||||
|
||||
p=buf2;
|
||||
num=i2d_X509(nx,&p);
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
if (memcmp(buf,buf2,num) != 0)
|
||||
{
|
||||
fprintf(stderr,"data difference\n");
|
||||
for (i=0; i<num; i++)
|
||||
fprintf(stderr,"%c%03d <%02X-%02X>\n",
|
||||
(buf[i] == buf2[i])?' ':'*',i,
|
||||
buf[i],buf2[i]);
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
p=buf2;
|
||||
if (d2i_X509(&mx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
return(1);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
return(0);
|
||||
}
|
||||
|
||||
main2()
|
||||
{
|
||||
FILE *in;
|
||||
unsigned char buf[10240],buf2[10240],*p;
|
||||
int num,i;
|
||||
|
||||
X509_CRL *nx=NULL,*mx=NULL;
|
||||
|
||||
in=fopen("crl.der","r");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("crl.der");
|
||||
exit(1);
|
||||
}
|
||||
num=fread(buf,1,10240,in);
|
||||
fclose(in);
|
||||
|
||||
|
||||
p=buf;
|
||||
if (d2i_X509_CRL(&nx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf);
|
||||
|
||||
p=buf2;
|
||||
num=i2d_X509_CRL(nx,&p);
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
if (memcmp(buf,buf2,num) != 0)
|
||||
{
|
||||
fprintf(stderr,"data difference\n");
|
||||
for (i=0; i<num; i++)
|
||||
fprintf(stderr,"%c%03d <%02X-%02X>\n",
|
||||
(buf[i] == buf2[i])?' ':'*',i,
|
||||
buf[i],buf2[i]);
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return(1);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
return(0);
|
||||
}
|
||||
|
||||
main3()
|
||||
{
|
||||
FILE *in;
|
||||
unsigned char buf[10240],buf2[10240],*p;
|
||||
int num,i;
|
||||
|
||||
X509_REQ *nx=NULL,*mx=NULL;
|
||||
|
||||
in=fopen("req.der","r");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("req.der");
|
||||
exit(1);
|
||||
}
|
||||
num=fread(buf,1,10240,in);
|
||||
fclose(in);
|
||||
|
||||
|
||||
p=buf;
|
||||
if (d2i_X509_REQ(&nx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf);
|
||||
|
||||
p=buf2;
|
||||
num=i2d_X509_REQ(nx,&p);
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
if (memcmp(buf,buf2,num) != 0)
|
||||
{
|
||||
fprintf(stderr,"data difference\n");
|
||||
for (i=0; i<num; i++)
|
||||
fprintf(stderr,"%c%03d <%02X-%02X>\n",
|
||||
(buf[i] == buf2[i])?' ':'*',i,
|
||||
buf[i],buf2[i]);
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return(1);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
return(0);
|
||||
}
|
||||
|
||||
main4()
|
||||
{
|
||||
FILE *in;
|
||||
unsigned char buf[10240],buf2[10240],*p;
|
||||
int num,i;
|
||||
|
||||
RSA *nx=NULL,*mx=NULL;
|
||||
|
||||
in=fopen("rsa.der","r");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("rsa.der");
|
||||
exit(1);
|
||||
}
|
||||
num=fread(buf,1,10240,in);
|
||||
fclose(in);
|
||||
|
||||
|
||||
p=buf;
|
||||
if (d2i_RSAPrivateKey(&nx,&p,num) == NULL) goto err;
|
||||
printf("num=%d p-buf=%d\n",num,p-buf);
|
||||
|
||||
p=buf2;
|
||||
num=i2d_RSAPrivateKey(nx,&p);
|
||||
printf("num=%d p-buf=%d\n",num,p-buf2);
|
||||
|
||||
if (memcmp(buf,buf2,num) != 0)
|
||||
{
|
||||
fprintf(stderr,"data difference\n");
|
||||
for (i=0; i<num; i++)
|
||||
fprintf(stderr,"%c%03d <%02X-%02X>\n",
|
||||
(buf[i] == buf2[i])?' ':'*',i,
|
||||
buf[i],buf2[i]);
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return(1);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
return(0);
|
||||
}
|
||||
|
||||
1
crypto/bf/.cvsignore
Normal file
1
crypto/bf/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
159
crypto/bf/asm/bf586.pl
Normal file
159
crypto/bf/asm/bf586.pl
Normal file
@@ -0,0 +1,159 @@
|
||||
#!/usr/local/bin/perl
|
||||
#!/usr/local/bin/perl
|
||||
|
||||
$prog="bf586.pl";
|
||||
|
||||
# base code is in microsft
|
||||
# op dest, source
|
||||
# format.
|
||||
#
|
||||
|
||||
if ( ($ARGV[0] eq "elf"))
|
||||
{ require "x86unix.pl"; }
|
||||
elsif ( ($ARGV[0] eq "a.out"))
|
||||
{ $aout=1; require "x86unix.pl"; }
|
||||
elsif ( ($ARGV[0] eq "sol"))
|
||||
{ $sol=1; require "x86unix.pl"; }
|
||||
elsif ( ($ARGV[0] eq "cpp"))
|
||||
{ $cpp=1; require "x86unix.pl"; }
|
||||
elsif ( ($ARGV[0] eq "win32"))
|
||||
{ require "x86ms.pl"; }
|
||||
else
|
||||
{
|
||||
print STDERR <<"EOF";
|
||||
Pick one target type from
|
||||
elf - linux, FreeBSD etc
|
||||
a.out - old linux
|
||||
sol - x86 solaris
|
||||
cpp - format so x86unix.cpp can be used
|
||||
win32 - Windows 95/Windows NT
|
||||
EOF
|
||||
exit(1);
|
||||
}
|
||||
|
||||
&comment("Don't even think of reading this code");
|
||||
&comment("It was automatically generated by $prog");
|
||||
&comment("Which is a perl program used to generate the x86 assember for");
|
||||
&comment("any of elf, a.out, Win32, or Solaris");
|
||||
&comment("It can be found in SSLeay 0.7.0+");
|
||||
&comment("eric <eay\@cryptsoft.com>");
|
||||
&comment("");
|
||||
|
||||
&file("bfx86xxxx");
|
||||
|
||||
$BF_ROUNDS=16;
|
||||
$BF_OFF=($BF_ROUNDS+2)*4;
|
||||
$L="ecx";
|
||||
$R="edx";
|
||||
$P="edi";
|
||||
$tot="esi";
|
||||
$tmp1="eax";
|
||||
$tmp2="ebx";
|
||||
$tmp3="ebp";
|
||||
|
||||
&des_encrypt("BF_encrypt");
|
||||
|
||||
&file_end();
|
||||
|
||||
sub des_encrypt
|
||||
{
|
||||
local($name)=@_;
|
||||
|
||||
&function_begin($name,3,"");
|
||||
|
||||
&comment("");
|
||||
&comment("Load the 2 words");
|
||||
&mov("eax",&wparam(0));
|
||||
&mov($L,&DWP(0,"eax","",0));
|
||||
&mov($R,&DWP(4,"eax","",0));
|
||||
|
||||
&comment("");
|
||||
&comment("P pointer, s and enc flag");
|
||||
&mov($P,&wparam(1));
|
||||
|
||||
&xor( $tmp1, $tmp1);
|
||||
&xor( $tmp2, $tmp2);
|
||||
|
||||
# encrypting part
|
||||
|
||||
&mov("ebp",&wparam(2)); # get encrypt flag
|
||||
&cmp("ebp","0");
|
||||
&je(&label("start_decrypt"));
|
||||
|
||||
&xor($L,&DWP(0,$P,"",0));
|
||||
for ($i=0; $i<$BF_ROUNDS; $i+=2)
|
||||
{
|
||||
&comment("");
|
||||
&comment("Round $i");
|
||||
&BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
|
||||
|
||||
&comment("");
|
||||
&comment("Round ".sprintf("%d",$i+1));
|
||||
&BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
|
||||
}
|
||||
&xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
|
||||
|
||||
&mov("eax",&wparam(0));
|
||||
&mov(&DWP(0,"eax","",0),$R);
|
||||
&mov(&DWP(4,"eax","",0),$L);
|
||||
&function_end_A($name);
|
||||
|
||||
&set_label("start_decrypt");
|
||||
|
||||
&xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
|
||||
for ($i=$BF_ROUNDS; $i>0; $i-=2)
|
||||
{
|
||||
&comment("");
|
||||
&comment("Round $i");
|
||||
&BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
|
||||
&comment("");
|
||||
&comment("Round ".sprintf("%d",$i-1));
|
||||
&BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
|
||||
}
|
||||
&xor($R,&DWP(0,$P,"",0));
|
||||
|
||||
&mov("eax",&wparam(0));
|
||||
&mov(&DWP(0,"eax","",0),$R);
|
||||
&mov(&DWP(4,"eax","",0),$L);
|
||||
&function_end_A($name);
|
||||
|
||||
&function_end_B($name);
|
||||
}
|
||||
|
||||
sub BF_ENCRYPT
|
||||
{
|
||||
local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_;
|
||||
|
||||
&rotr( $R, 16);
|
||||
&mov( $tot, &DWP(&n2a($i*4),$P,"",0));
|
||||
|
||||
&movb( &LB($tmp1), &HB($R));
|
||||
&movb( &LB($tmp2), &LB($R));
|
||||
|
||||
&rotr( $R, 16);
|
||||
&xor( $L, $tot);
|
||||
|
||||
&mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4));
|
||||
&mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4));
|
||||
|
||||
&movb( &LB($tmp1), &HB($R));
|
||||
&movb( &LB($tmp2), &LB($R));
|
||||
|
||||
&add( $tot, $tmp3);
|
||||
&mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay
|
||||
|
||||
&xor( $tot, $tmp1);
|
||||
&mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4));
|
||||
|
||||
&add( $tot, $tmp3);
|
||||
&xor( $tmp1, $tmp1);
|
||||
|
||||
&xor( $L, $tot);
|
||||
# delay
|
||||
}
|
||||
|
||||
sub n2a
|
||||
{
|
||||
sprintf("%d",$_[0]);
|
||||
}
|
||||
|
||||
666
crypto/bf/asm/bx86-cpp.s
Normal file
666
crypto/bf/asm/bx86-cpp.s
Normal file
@@ -0,0 +1,666 @@
|
||||
/* Don't even think of reading this code */
|
||||
/* It was automatically generated by bf586.pl */
|
||||
/* Which is a perl program used to generate the x86 assember for */
|
||||
/* any of elf, a.out, Win32, or Solaris */
|
||||
/* It can be found in SSLeay 0.7.0+ */
|
||||
/* eric <eay@cryptsoft.com> */
|
||||
|
||||
.file "bfx86xxxx.s"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align ALIGN
|
||||
.globl BF_encrypt
|
||||
TYPE(BF_encrypt,@function)
|
||||
BF_encrypt:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
|
||||
/* Load the 2 words */
|
||||
movl 20(%esp), %eax
|
||||
movl (%eax), %ecx
|
||||
movl 4(%eax), %edx
|
||||
|
||||
/* P pointer, s and enc flag */
|
||||
movl 24(%esp), %edi
|
||||
xorl %eax, %eax
|
||||
xorl %ebx, %ebx
|
||||
movl 28(%esp), %ebp
|
||||
cmpl $0, %ebp
|
||||
je .L000start_decrypt
|
||||
xorl (%edi), %ecx
|
||||
|
||||
/* Round 0 */
|
||||
rorl $16, %ecx
|
||||
movl 4(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 1 */
|
||||
rorl $16, %edx
|
||||
movl 8(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 2 */
|
||||
rorl $16, %ecx
|
||||
movl 12(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 3 */
|
||||
rorl $16, %edx
|
||||
movl 16(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 4 */
|
||||
rorl $16, %ecx
|
||||
movl 20(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 5 */
|
||||
rorl $16, %edx
|
||||
movl 24(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 6 */
|
||||
rorl $16, %ecx
|
||||
movl 28(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 7 */
|
||||
rorl $16, %edx
|
||||
movl 32(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 8 */
|
||||
rorl $16, %ecx
|
||||
movl 36(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 9 */
|
||||
rorl $16, %edx
|
||||
movl 40(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 10 */
|
||||
rorl $16, %ecx
|
||||
movl 44(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 11 */
|
||||
rorl $16, %edx
|
||||
movl 48(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 12 */
|
||||
rorl $16, %ecx
|
||||
movl 52(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 13 */
|
||||
rorl $16, %edx
|
||||
movl 56(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 14 */
|
||||
rorl $16, %ecx
|
||||
movl 60(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 15 */
|
||||
rorl $16, %edx
|
||||
movl 64(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
xorl 68(%edi), %edx
|
||||
movl 20(%esp), %eax
|
||||
movl %edx, (%eax)
|
||||
movl %ecx, 4(%eax)
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.align ALIGN
|
||||
.L000start_decrypt:
|
||||
xorl 68(%edi), %ecx
|
||||
|
||||
/* Round 16 */
|
||||
rorl $16, %ecx
|
||||
movl 64(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 15 */
|
||||
rorl $16, %edx
|
||||
movl 60(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 14 */
|
||||
rorl $16, %ecx
|
||||
movl 56(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 13 */
|
||||
rorl $16, %edx
|
||||
movl 52(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 12 */
|
||||
rorl $16, %ecx
|
||||
movl 48(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 11 */
|
||||
rorl $16, %edx
|
||||
movl 44(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 10 */
|
||||
rorl $16, %ecx
|
||||
movl 40(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 9 */
|
||||
rorl $16, %edx
|
||||
movl 36(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 8 */
|
||||
rorl $16, %ecx
|
||||
movl 32(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 7 */
|
||||
rorl $16, %edx
|
||||
movl 28(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 6 */
|
||||
rorl $16, %ecx
|
||||
movl 24(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 5 */
|
||||
rorl $16, %edx
|
||||
movl 20(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 4 */
|
||||
rorl $16, %ecx
|
||||
movl 16(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 3 */
|
||||
rorl $16, %edx
|
||||
movl 12(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
|
||||
/* Round 2 */
|
||||
rorl $16, %ecx
|
||||
movl 8(%edi), %esi
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
rorl $16, %ecx
|
||||
xorl %esi, %edx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %ch, %al
|
||||
movb %cl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %edx
|
||||
|
||||
/* Round 1 */
|
||||
rorl $16, %edx
|
||||
movl 4(%edi), %esi
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
rorl $16, %edx
|
||||
xorl %esi, %ecx
|
||||
movl 72(%edi,%eax,4),%esi
|
||||
movl 1096(%edi,%ebx,4),%ebp
|
||||
movb %dh, %al
|
||||
movb %dl, %bl
|
||||
addl %ebp, %esi
|
||||
movl 2120(%edi,%eax,4),%eax
|
||||
xorl %eax, %esi
|
||||
movl 3144(%edi,%ebx,4),%ebp
|
||||
addl %ebp, %esi
|
||||
xorl %eax, %eax
|
||||
xorl %esi, %ecx
|
||||
xorl (%edi), %edx
|
||||
movl 20(%esp), %eax
|
||||
movl %edx, (%eax)
|
||||
movl %ecx, 4(%eax)
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.BF_encrypt_end:
|
||||
SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt)
|
||||
.ident "desasm.pl"
|
||||
663
crypto/bf/asm/win32.asm
Normal file
663
crypto/bf/asm/win32.asm
Normal file
@@ -0,0 +1,663 @@
|
||||
; Don't even think of reading this code
|
||||
; It was automatically generated by bf586.pl
|
||||
; Which is a perl program used to generate the x86 assember for
|
||||
; any of elf, a.out, Win32, or Solaris
|
||||
; It can be found in SSLeay 0.7.0+
|
||||
; eric <eay@cryptsoft.com>
|
||||
;
|
||||
TITLE bfx86xxxx.asm
|
||||
.386
|
||||
.model FLAT
|
||||
_TEXT SEGMENT
|
||||
PUBLIC _BF_encrypt
|
||||
EXTRN _des_SPtrans:DWORD
|
||||
_BF_encrypt PROC NEAR
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
;
|
||||
; Load the 2 words
|
||||
mov eax, DWORD PTR 20[esp]
|
||||
mov ecx, DWORD PTR [eax]
|
||||
mov edx, DWORD PTR 4[eax]
|
||||
;
|
||||
; P pointer, s and enc flag
|
||||
mov edi, DWORD PTR 24[esp]
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
mov ebp, DWORD PTR 28[esp]
|
||||
cmp ebp, 0
|
||||
je $L000start_decrypt
|
||||
xor ecx, DWORD PTR [edi]
|
||||
;
|
||||
; Round 0
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 4[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 1
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 8[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 2
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 12[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 3
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 16[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 4
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 20[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 5
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 24[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 6
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 28[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 7
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 32[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 8
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 36[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 9
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 40[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 10
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 44[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 11
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 48[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 12
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 52[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 13
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 56[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 14
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 60[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 15
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 64[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
xor edx, DWORD PTR 68[edi]
|
||||
mov eax, DWORD PTR 20[esp]
|
||||
mov DWORD PTR [eax],edx
|
||||
mov DWORD PTR 4[eax],ecx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
$L000start_decrypt:
|
||||
xor ecx, DWORD PTR 68[edi]
|
||||
;
|
||||
; Round 16
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 64[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 15
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 60[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 14
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 56[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 13
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 52[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 12
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 48[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 11
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 44[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 10
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 40[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 9
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 36[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 8
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 32[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 7
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 28[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 6
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 24[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 5
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 20[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 4
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 16[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 3
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 12[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
;
|
||||
; Round 2
|
||||
ror ecx, 16
|
||||
mov esi, DWORD PTR 8[edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
ror ecx, 16
|
||||
xor edx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, ch
|
||||
mov bl, cl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor edx, esi
|
||||
;
|
||||
; Round 1
|
||||
ror edx, 16
|
||||
mov esi, DWORD PTR 4[edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
ror edx, 16
|
||||
xor ecx, esi
|
||||
mov esi, DWORD PTR 72[eax*4+edi]
|
||||
mov ebp, DWORD PTR 1096[ebx*4+edi]
|
||||
mov al, dh
|
||||
mov bl, dl
|
||||
add esi, ebp
|
||||
mov eax, DWORD PTR 2120[eax*4+edi]
|
||||
xor esi, eax
|
||||
mov ebp, DWORD PTR 3144[ebx*4+edi]
|
||||
add esi, ebp
|
||||
xor eax, eax
|
||||
xor ecx, esi
|
||||
xor edx, DWORD PTR [edi]
|
||||
mov eax, DWORD PTR 20[esp]
|
||||
mov DWORD PTR [eax],edx
|
||||
mov DWORD PTR 4[eax],ecx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
_BF_encrypt ENDP
|
||||
_TEXT ENDS
|
||||
END
|
||||
@@ -64,7 +64,7 @@
|
||||
* CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993)
|
||||
*/
|
||||
|
||||
char *BF_version="BlowFish part of SSLeay 0.9.1a 06-Jul-1998";
|
||||
char *BF_version="BlowFish part of OpenSSL 0.9.1c 23-Dec-1998";
|
||||
|
||||
char *BF_options()
|
||||
{
|
||||
|
||||
243
crypto/bf/bf_locl
Normal file
243
crypto/bf/bf_locl
Normal file
@@ -0,0 +1,243 @@
|
||||
/* crypto/bf/bf_local.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@mincom.oz.au).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@mincom.oz.au)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*
|
||||
* Always modify bf_locl.org since bf_locl.h is automatically generated from
|
||||
* it during SSLeay configuration.
|
||||
*
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*/
|
||||
|
||||
/* Special defines which change the way the code is built depending on the
|
||||
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
|
||||
even newer MIPS CPU's, but at the moment one size fits all for
|
||||
optimization options. Older Sparc's work better with only UNROLL, but
|
||||
there's no way to tell at compile time what it is you're running on */
|
||||
|
||||
#if defined( sun ) /* Newer Sparc's */
|
||||
# define BF_PTR
|
||||
#elif defined( __ultrix ) /* Older MIPS */
|
||||
# define BF_PTR
|
||||
#elif defined( __osf1__ ) /* Alpha */
|
||||
/* None */
|
||||
#elif defined ( _AIX ) /* RS6000 */
|
||||
/* Unknown */
|
||||
#elif defined( __hpux ) /* HP-PA */
|
||||
/* None */
|
||||
#elif defined( __aux ) /* 68K */
|
||||
/* Unknown */
|
||||
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
|
||||
/* Unknown */
|
||||
#elif defined( __sgi ) /* Newer MIPS */
|
||||
# define BF_PTR
|
||||
#elif defined( i386 ) /* x86 boxes, should be gcc */
|
||||
# define BF_PTR2
|
||||
#elif defined( _MSC_VER ) /* x86 boxes, Visual C */
|
||||
# define BF_PTR2
|
||||
#endif /* Systems-specific speed defines */
|
||||
|
||||
#undef c2l
|
||||
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<<24L)
|
||||
|
||||
/* NOTE - c is not incremented as per c2l */
|
||||
#undef c2ln
|
||||
#define c2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 5: l2|=((unsigned long)(*(--(c)))); \
|
||||
case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 1: l1|=((unsigned long)(*(--(c)))); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef l2c
|
||||
#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
|
||||
|
||||
/* NOTE - c is not incremented as per l2c */
|
||||
#undef l2cn
|
||||
#define l2cn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per n2l */
|
||||
#define n2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c)))) ; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 5: l2|=((unsigned long)(*(--(c))))<<24; \
|
||||
case 4: l1 =((unsigned long)(*(--(c)))) ; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 1: l1|=((unsigned long)(*(--(c))))<<24; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per l2n */
|
||||
#define l2nn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef n2l
|
||||
#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++))))
|
||||
|
||||
#undef l2n
|
||||
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff))
|
||||
|
||||
/* This is actually a big endian algorithm, the most significate byte
|
||||
* is used to lookup array 0 */
|
||||
|
||||
/* use BF_PTR2 for intel boxes,
|
||||
* BF_PTR for sparc and MIPS/SGI
|
||||
* use nothing for Alpha and HP.
|
||||
*/
|
||||
#if !defined(BF_PTR) && !defined(BF_PTR2)
|
||||
#undef BF_PTR
|
||||
#endif
|
||||
|
||||
#define BF_M 0x3fc
|
||||
#define BF_0 22L
|
||||
#define BF_1 14L
|
||||
#define BF_2 6L
|
||||
#define BF_3 2L /* left shift */
|
||||
|
||||
#if defined(BF_PTR2)
|
||||
|
||||
/* This is basically a special pentium verson */
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
{ \
|
||||
BF_LONG t,u,v; \
|
||||
u=R>>BF_0; \
|
||||
v=R>>BF_1; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \
|
||||
u=R>>BF_2; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \
|
||||
v=R<<BF_3; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \
|
||||
LL^=P; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \
|
||||
LL^=t; \
|
||||
}
|
||||
|
||||
#elif defined(BF_PTR)
|
||||
|
||||
/* This is normally very good */
|
||||
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
LL^=P; \
|
||||
LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M)));
|
||||
#else
|
||||
|
||||
/* This will always work, even on 64 bit machines and strangly enough,
|
||||
* on the Alpha it is faster than the pointer versions (both 32 and 64
|
||||
* versions of BF_LONG) */
|
||||
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
LL^=P; \
|
||||
LL^=((( S[ (int)(R>>24L) ] + \
|
||||
S[0x0100+((int)(R>>16L)&0xff)])^ \
|
||||
S[0x0200+((int)(R>> 8L)&0xff)])+ \
|
||||
S[0x0300+((int)(R )&0xff)])&0xffffffffL;
|
||||
#endif
|
||||
@@ -70,7 +70,15 @@ extern "C" {
|
||||
* the Alpha, otherwise they will not. Strangly using the '8 byte'
|
||||
* BF_LONG and the default 'non-pointer' inner loop is the best configuration
|
||||
* for the Alpha */
|
||||
#define BF_LONG unsigned long
|
||||
#if defined(__sgi)
|
||||
# if (_MIPS_SZLONG==64)
|
||||
# define BF_LONG unsigned int
|
||||
# else
|
||||
# define BF_LONG unsigned long
|
||||
# endif
|
||||
#else
|
||||
# define BF_LONG unsigned long
|
||||
#endif
|
||||
|
||||
#define BF_ROUNDS 16
|
||||
#define BF_BLOCK 8
|
||||
|
||||
1
crypto/bio/.cvsignore
Normal file
1
crypto/bio/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -19,9 +19,8 @@
|
||||
#define BIO_F_CONN_STATE 115
|
||||
#define BIO_F_FILE_CTRL 116
|
||||
#define BIO_F_MEM_WRITE 117
|
||||
#define BIO_F_SOCKS4A_STATE 118
|
||||
#define BIO_F_SSL_NEW 119
|
||||
#define BIO_F_WSASTARTUP 120
|
||||
#define BIO_F_SSL_NEW 118
|
||||
#define BIO_F_WSASTARTUP 119
|
||||
|
||||
/* Reason codes. */
|
||||
#define BIO_R_ACCEPT_ERROR 100
|
||||
@@ -40,14 +39,10 @@
|
||||
#define BIO_R_NO_PORT_DEFINED 113
|
||||
#define BIO_R_NO_PORT_SPECIFIED 114
|
||||
#define BIO_R_NULL_PARAMETER 115
|
||||
#define BIO_R_SOCKS_ID_AND_IDENT_DID_NOT_MATCH 116
|
||||
#define BIO_R_SOCKS_REJECTED_CONNECTION 117
|
||||
#define BIO_R_SOCKS_UNABLE_TO_TALK_TO_IDENT_SERVER 118
|
||||
#define BIO_R_SOCKS_UNKNOWN_ERROR 119
|
||||
#define BIO_R_TAG_MISMATCH 120
|
||||
#define BIO_R_UNABLE_TO_BIND_SOCKET 121
|
||||
#define BIO_R_UNABLE_TO_CREATE_SOCKET 122
|
||||
#define BIO_R_UNABLE_TO_LISTEN_SOCKET 123
|
||||
#define BIO_R_UNINITALISED 124
|
||||
#define BIO_R_UNSUPPORTED_METHOD 125
|
||||
#define BIO_R_WSASTARTUP 126
|
||||
#define BIO_R_TAG_MISMATCH 116
|
||||
#define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
#define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
#define BIO_R_UNINITALISED 120
|
||||
#define BIO_R_UNSUPPORTED_METHOD 121
|
||||
#define BIO_R_WSASTARTUP 122
|
||||
|
||||
@@ -683,8 +683,8 @@ int BIO_printf();
|
||||
#define BIO_F_CONN_STATE 115
|
||||
#define BIO_F_FILE_CTRL 116
|
||||
#define BIO_F_MEM_WRITE 117
|
||||
#define BIO_F_SSL_NEW 119
|
||||
#define BIO_F_WSASTARTUP 120
|
||||
#define BIO_F_SSL_NEW 118
|
||||
#define BIO_F_WSASTARTUP 119
|
||||
|
||||
/* Reason codes. */
|
||||
#define BIO_R_ACCEPT_ERROR 100
|
||||
@@ -703,17 +703,13 @@ int BIO_printf();
|
||||
#define BIO_R_NO_PORT_DEFINED 113
|
||||
#define BIO_R_NO_PORT_SPECIFIED 114
|
||||
#define BIO_R_NULL_PARAMETER 115
|
||||
#define BIO_R_SOCKS_ID_AND_IDENT_DID_NOT_MATCH 116
|
||||
#define BIO_R_SOCKS_REJECTED_CONNECTION 117
|
||||
#define BIO_R_SOCKS_UNABLE_TO_TALK_TO_IDENT_SERVER 118
|
||||
#define BIO_R_SOCKS_UNKNOWN_ERROR 119
|
||||
#define BIO_R_TAG_MISMATCH 120
|
||||
#define BIO_R_UNABLE_TO_BIND_SOCKET 121
|
||||
#define BIO_R_UNABLE_TO_CREATE_SOCKET 122
|
||||
#define BIO_R_UNABLE_TO_LISTEN_SOCKET 123
|
||||
#define BIO_R_UNINITALISED 124
|
||||
#define BIO_R_UNSUPPORTED_METHOD 125
|
||||
#define BIO_R_WSASTARTUP 126
|
||||
#define BIO_R_TAG_MISMATCH 116
|
||||
#define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
#define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
#define BIO_R_UNINITALISED 120
|
||||
#define BIO_R_UNSUPPORTED_METHOD 121
|
||||
#define BIO_R_WSASTARTUP 122
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ static ERR_STRING_DATA BIO_str_functs[]=
|
||||
{ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"},
|
||||
{ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"},
|
||||
{ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"},
|
||||
{ERR_PACK(0,BIO_F_SOCKS4A_STATE,0), "SOCKS4A_STATE"},
|
||||
{ERR_PACK(0,BIO_F_SSL_NEW,0), "SSL_NEW"},
|
||||
{ERR_PACK(0,BIO_F_WSASTARTUP,0), "WSASTARTUP"},
|
||||
{0,NULL},
|
||||
@@ -105,10 +104,6 @@ static ERR_STRING_DATA BIO_str_reasons[]=
|
||||
{BIO_R_NO_PORT_DEFINED ,"no port defined"},
|
||||
{BIO_R_NO_PORT_SPECIFIED ,"no port specified"},
|
||||
{BIO_R_NULL_PARAMETER ,"null parameter"},
|
||||
{BIO_R_SOCKS_ID_AND_IDENT_DID_NOT_MATCH ,"socks id and ident did not match"},
|
||||
{BIO_R_SOCKS_REJECTED_CONNECTION ,"socks rejected connection"},
|
||||
{BIO_R_SOCKS_UNABLE_TO_TALK_TO_IDENT_SERVER,"socks unable to talk to ident server"},
|
||||
{BIO_R_SOCKS_UNKNOWN_ERROR ,"socks unknown error"},
|
||||
{BIO_R_TAG_MISMATCH ,"tag mismatch"},
|
||||
{BIO_R_UNABLE_TO_BIND_SOCKET ,"unable to bind socket"},
|
||||
{BIO_R_UNABLE_TO_CREATE_SOCKET ,"unable to create socket"},
|
||||
|
||||
1
crypto/bn/.cvsignore
Normal file
1
crypto/bn/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <stdio.h>
|
||||
{
|
||||
unsigned long a[10],b[10],c[10];
|
||||
|
||||
a[0]=0xFFFFFFFF;
|
||||
a[1]=0xFFFFFFFF;
|
||||
b[0]=0xFFFFFFFF;
|
||||
b[1]=0xFFFFFFFF;
|
||||
|
||||
c[2]=bn_add_words(c,a,b,2);
|
||||
printf("%08X %08X %08X\n",c[2],c[1],c[0]);
|
||||
}
|
||||
Binary file not shown.
646
crypto/bn/asm/r3000.s
Normal file
646
crypto/bn/asm/r3000.s
Normal file
@@ -0,0 +1,646 @@
|
||||
.file 1 "../bn_mulw.c"
|
||||
.set nobopt
|
||||
.option pic2
|
||||
|
||||
# GNU C 2.6.3 [AL 1.1, MM 40] SGI running IRIX 5.0 compiled by GNU C
|
||||
|
||||
# Cc1 defaults:
|
||||
# -mabicalls
|
||||
|
||||
# Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1):
|
||||
# -quiet -dumpbase -O2 -o
|
||||
|
||||
gcc2_compiled.:
|
||||
__gnu_compiled_c:
|
||||
.rdata
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x39,0x20
|
||||
.byte 0x24,0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x33,0x34,0x20
|
||||
.byte 0x24,0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x35,0x20,0x24
|
||||
.byte 0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24
|
||||
.byte 0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x33,0x20
|
||||
.byte 0x24,0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x37,0x38,0x20
|
||||
.byte 0x24,0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x33,0x2e,0x37,0x30,0x20
|
||||
.byte 0x24,0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x20,0x24
|
||||
.byte 0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x20,0x24
|
||||
.byte 0x0
|
||||
|
||||
.byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
|
||||
.byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24
|
||||
.byte 0x0
|
||||
.text
|
||||
.align 2
|
||||
.globl bn_mul_add_words
|
||||
.ent bn_mul_add_words
|
||||
bn_mul_add_words:
|
||||
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
|
||||
.mask 0x00000000,0
|
||||
.fmask 0x00000000,0
|
||||
.set noreorder
|
||||
.cpload $25
|
||||
.set reorder
|
||||
move $12,$4
|
||||
move $14,$5
|
||||
move $9,$6
|
||||
move $13,$7
|
||||
move $8,$0
|
||||
addu $10,$12,12
|
||||
addu $11,$14,12
|
||||
$L2:
|
||||
lw $6,0($14)
|
||||
#nop
|
||||
multu $13,$6
|
||||
mfhi $6
|
||||
mflo $7
|
||||
#nop
|
||||
move $5,$8
|
||||
move $4,$0
|
||||
lw $3,0($12)
|
||||
addu $9,$9,-1
|
||||
move $2,$0
|
||||
addu $7,$7,$3
|
||||
sltu $8,$7,$3
|
||||
addu $6,$6,$2
|
||||
addu $6,$6,$8
|
||||
addu $7,$7,$5
|
||||
sltu $2,$7,$5
|
||||
addu $6,$6,$4
|
||||
addu $6,$6,$2
|
||||
srl $3,$6,0
|
||||
move $2,$0
|
||||
move $8,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $9,$0,$L3
|
||||
sw $7,0($12)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $6,-8($11)
|
||||
#nop
|
||||
multu $13,$6
|
||||
mfhi $6
|
||||
mflo $7
|
||||
#nop
|
||||
move $5,$8
|
||||
move $4,$0
|
||||
lw $3,-8($10)
|
||||
addu $9,$9,-1
|
||||
move $2,$0
|
||||
addu $7,$7,$3
|
||||
sltu $8,$7,$3
|
||||
addu $6,$6,$2
|
||||
addu $6,$6,$8
|
||||
addu $7,$7,$5
|
||||
sltu $2,$7,$5
|
||||
addu $6,$6,$4
|
||||
addu $6,$6,$2
|
||||
srl $3,$6,0
|
||||
move $2,$0
|
||||
move $8,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $9,$0,$L3
|
||||
sw $7,-8($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $6,-4($11)
|
||||
#nop
|
||||
multu $13,$6
|
||||
mfhi $6
|
||||
mflo $7
|
||||
#nop
|
||||
move $5,$8
|
||||
move $4,$0
|
||||
lw $3,-4($10)
|
||||
addu $9,$9,-1
|
||||
move $2,$0
|
||||
addu $7,$7,$3
|
||||
sltu $8,$7,$3
|
||||
addu $6,$6,$2
|
||||
addu $6,$6,$8
|
||||
addu $7,$7,$5
|
||||
sltu $2,$7,$5
|
||||
addu $6,$6,$4
|
||||
addu $6,$6,$2
|
||||
srl $3,$6,0
|
||||
move $2,$0
|
||||
move $8,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $9,$0,$L3
|
||||
sw $7,-4($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $6,0($11)
|
||||
#nop
|
||||
multu $13,$6
|
||||
mfhi $6
|
||||
mflo $7
|
||||
#nop
|
||||
move $5,$8
|
||||
move $4,$0
|
||||
lw $3,0($10)
|
||||
addu $9,$9,-1
|
||||
move $2,$0
|
||||
addu $7,$7,$3
|
||||
sltu $8,$7,$3
|
||||
addu $6,$6,$2
|
||||
addu $6,$6,$8
|
||||
addu $7,$7,$5
|
||||
sltu $2,$7,$5
|
||||
addu $6,$6,$4
|
||||
addu $6,$6,$2
|
||||
srl $3,$6,0
|
||||
move $2,$0
|
||||
move $8,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $9,$0,$L3
|
||||
sw $7,0($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $11,$11,16
|
||||
addu $14,$14,16
|
||||
addu $10,$10,16
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L2
|
||||
addu $12,$12,16
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L3:
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $31
|
||||
move $2,$8
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
.end bn_mul_add_words
|
||||
.align 2
|
||||
.globl bn_mul_words
|
||||
.ent bn_mul_words
|
||||
bn_mul_words:
|
||||
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
|
||||
.mask 0x00000000,0
|
||||
.fmask 0x00000000,0
|
||||
.set noreorder
|
||||
.cpload $25
|
||||
.set reorder
|
||||
move $11,$4
|
||||
move $12,$5
|
||||
move $8,$6
|
||||
move $6,$0
|
||||
addu $10,$11,12
|
||||
addu $9,$12,12
|
||||
$L10:
|
||||
lw $4,0($12)
|
||||
#nop
|
||||
multu $7,$4
|
||||
mfhi $4
|
||||
mflo $5
|
||||
#nop
|
||||
move $3,$6
|
||||
move $2,$0
|
||||
addu $8,$8,-1
|
||||
addu $5,$5,$3
|
||||
sltu $6,$5,$3
|
||||
addu $4,$4,$2
|
||||
addu $4,$4,$6
|
||||
srl $3,$4,0
|
||||
move $2,$0
|
||||
move $6,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $8,$0,$L11
|
||||
sw $5,0($11)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $4,-8($9)
|
||||
#nop
|
||||
multu $7,$4
|
||||
mfhi $4
|
||||
mflo $5
|
||||
#nop
|
||||
move $3,$6
|
||||
move $2,$0
|
||||
addu $8,$8,-1
|
||||
addu $5,$5,$3
|
||||
sltu $6,$5,$3
|
||||
addu $4,$4,$2
|
||||
addu $4,$4,$6
|
||||
srl $3,$4,0
|
||||
move $2,$0
|
||||
move $6,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $8,$0,$L11
|
||||
sw $5,-8($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $4,-4($9)
|
||||
#nop
|
||||
multu $7,$4
|
||||
mfhi $4
|
||||
mflo $5
|
||||
#nop
|
||||
move $3,$6
|
||||
move $2,$0
|
||||
addu $8,$8,-1
|
||||
addu $5,$5,$3
|
||||
sltu $6,$5,$3
|
||||
addu $4,$4,$2
|
||||
addu $4,$4,$6
|
||||
srl $3,$4,0
|
||||
move $2,$0
|
||||
move $6,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $8,$0,$L11
|
||||
sw $5,-4($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $4,0($9)
|
||||
#nop
|
||||
multu $7,$4
|
||||
mfhi $4
|
||||
mflo $5
|
||||
#nop
|
||||
move $3,$6
|
||||
move $2,$0
|
||||
addu $8,$8,-1
|
||||
addu $5,$5,$3
|
||||
sltu $6,$5,$3
|
||||
addu $4,$4,$2
|
||||
addu $4,$4,$6
|
||||
srl $3,$4,0
|
||||
move $2,$0
|
||||
move $6,$3
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $8,$0,$L11
|
||||
sw $5,0($10)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $9,$9,16
|
||||
addu $12,$12,16
|
||||
addu $10,$10,16
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L10
|
||||
addu $11,$11,16
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L11:
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $31
|
||||
move $2,$6
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
.end bn_mul_words
|
||||
.align 2
|
||||
.globl bn_sqr_words
|
||||
.ent bn_sqr_words
|
||||
bn_sqr_words:
|
||||
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
|
||||
.mask 0x00000000,0
|
||||
.fmask 0x00000000,0
|
||||
.set noreorder
|
||||
.cpload $25
|
||||
.set reorder
|
||||
move $9,$4
|
||||
addu $7,$9,28
|
||||
addu $8,$5,12
|
||||
$L18:
|
||||
lw $2,0($5)
|
||||
#nop
|
||||
multu $2,$2
|
||||
mfhi $2
|
||||
mflo $3
|
||||
#nop
|
||||
addu $6,$6,-1
|
||||
sw $3,0($9)
|
||||
srl $3,$2,0
|
||||
move $2,$0
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $6,$0,$L19
|
||||
sw $3,-24($7)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $2,-8($8)
|
||||
#nop
|
||||
multu $2,$2
|
||||
mfhi $2
|
||||
mflo $3
|
||||
#nop
|
||||
addu $6,$6,-1
|
||||
sw $3,-20($7)
|
||||
srl $3,$2,0
|
||||
move $2,$0
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $6,$0,$L19
|
||||
sw $3,-16($7)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $2,-4($8)
|
||||
#nop
|
||||
multu $2,$2
|
||||
mfhi $2
|
||||
mflo $3
|
||||
#nop
|
||||
addu $6,$6,-1
|
||||
sw $3,-12($7)
|
||||
srl $3,$2,0
|
||||
move $2,$0
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $6,$0,$L19
|
||||
sw $3,-8($7)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
lw $2,0($8)
|
||||
#nop
|
||||
multu $2,$2
|
||||
mfhi $2
|
||||
mflo $3
|
||||
#nop
|
||||
addu $6,$6,-1
|
||||
sw $3,-4($7)
|
||||
srl $3,$2,0
|
||||
move $2,$0
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $6,$0,$L19
|
||||
sw $3,0($7)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $8,$8,16
|
||||
addu $5,$5,16
|
||||
addu $7,$7,32
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L18
|
||||
addu $9,$9,32
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L19:
|
||||
j $31
|
||||
.end bn_sqr_words
|
||||
.rdata
|
||||
.align 2
|
||||
$LC0:
|
||||
|
||||
.byte 0x44,0x69,0x76,0x69,0x73,0x69,0x6f,0x6e
|
||||
.byte 0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x6f
|
||||
.byte 0x76,0x65,0x72,0x66,0x6c,0x6f,0x77,0xa
|
||||
.byte 0x0
|
||||
.text
|
||||
.align 2
|
||||
.globl bn_div64
|
||||
.ent bn_div64
|
||||
bn_div64:
|
||||
.frame $sp,56,$31 # vars= 0, regs= 7/0, args= 16, extra= 8
|
||||
.mask 0x901f0000,-8
|
||||
.fmask 0x00000000,0
|
||||
.set noreorder
|
||||
.cpload $25
|
||||
.set reorder
|
||||
subu $sp,$sp,56
|
||||
.cprestore 16
|
||||
sw $16,24($sp)
|
||||
move $16,$4
|
||||
sw $17,28($sp)
|
||||
move $17,$5
|
||||
sw $18,32($sp)
|
||||
move $18,$6
|
||||
sw $20,40($sp)
|
||||
move $20,$0
|
||||
sw $19,36($sp)
|
||||
li $19,0x00000002 # 2
|
||||
sw $31,48($sp)
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
bne $18,$0,$L26
|
||||
sw $28,44($sp)
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L43
|
||||
li $2,-1 # 0xffffffff
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L26:
|
||||
move $4,$18
|
||||
jal BN_num_bits_word
|
||||
move $4,$2
|
||||
li $2,0x00000020 # 32
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $4,$2,$L27
|
||||
li $2,0x00000001 # 1
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
sll $2,$2,$4
|
||||
sltu $2,$2,$16
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $2,$0,$L44
|
||||
li $5,0x00000020 # 32
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
la $4,__iob+32
|
||||
la $5,$LC0
|
||||
jal fprintf
|
||||
jal abort
|
||||
$L27:
|
||||
li $5,0x00000020 # 32
|
||||
$L44:
|
||||
sltu $2,$16,$18
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
bne $2,$0,$L28
|
||||
subu $4,$5,$4
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
subu $16,$16,$18
|
||||
$L28:
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $4,$0,$L29
|
||||
li $10,-65536 # 0xffff0000
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
sll $18,$18,$4
|
||||
sll $3,$16,$4
|
||||
subu $2,$5,$4
|
||||
srl $2,$17,$2
|
||||
or $16,$3,$2
|
||||
sll $17,$17,$4
|
||||
$L29:
|
||||
srl $7,$18,16
|
||||
andi $9,$18,0xffff
|
||||
$L30:
|
||||
srl $2,$16,16
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $2,$7,$L34
|
||||
li $6,0x0000ffff # 65535
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
divu $6,$16,$7
|
||||
$L34:
|
||||
mult $6,$9
|
||||
mflo $5
|
||||
#nop
|
||||
#nop
|
||||
mult $6,$7
|
||||
and $2,$17,$10
|
||||
srl $8,$2,16
|
||||
mflo $4
|
||||
$L35:
|
||||
subu $3,$16,$4
|
||||
and $2,$3,$10
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
bne $2,$0,$L36
|
||||
sll $2,$3,16
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $2,$2,$8
|
||||
sltu $2,$2,$5
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $2,$0,$L36
|
||||
subu $5,$5,$9
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
subu $4,$4,$7
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L35
|
||||
addu $6,$6,-1
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L36:
|
||||
mult $6,$7
|
||||
mflo $5
|
||||
#nop
|
||||
#nop
|
||||
mult $6,$9
|
||||
mflo $4
|
||||
#nop
|
||||
#nop
|
||||
srl $3,$4,16
|
||||
sll $2,$4,16
|
||||
and $4,$2,$10
|
||||
sltu $2,$17,$4
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $2,$0,$L40
|
||||
addu $5,$5,$3
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $5,$5,1
|
||||
$L40:
|
||||
sltu $2,$16,$5
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $2,$0,$L41
|
||||
subu $17,$17,$4
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
addu $16,$16,$18
|
||||
addu $6,$6,-1
|
||||
$L41:
|
||||
addu $19,$19,-1
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
beq $19,$0,$L31
|
||||
subu $16,$16,$5
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
sll $20,$6,16
|
||||
sll $3,$16,16
|
||||
srl $2,$17,16
|
||||
or $16,$3,$2
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
j $L30
|
||||
sll $17,$17,16
|
||||
.set macro
|
||||
.set reorder
|
||||
|
||||
$L31:
|
||||
or $2,$20,$6
|
||||
$L43:
|
||||
lw $31,48($sp)
|
||||
lw $20,40($sp)
|
||||
lw $19,36($sp)
|
||||
lw $18,32($sp)
|
||||
lw $17,28($sp)
|
||||
lw $16,24($sp)
|
||||
addu $sp,$sp,56
|
||||
j $31
|
||||
.end bn_div64
|
||||
|
||||
.globl abort .text
|
||||
.globl fprintf .text
|
||||
.globl BN_num_bits_word .text
|
||||
272
crypto/bn/asm/x86-bsdi.s
Normal file
272
crypto/bn/asm/x86-bsdi.s
Normal file
@@ -0,0 +1,272 @@
|
||||
.file "bn_mulw.c"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 4
|
||||
.globl _bn_mul_add_word
|
||||
_bn_mul_add_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# si c
|
||||
# bp num
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
|
||||
shrl $2,%ebp # num/4
|
||||
je .L910
|
||||
|
||||
# .align 4
|
||||
.L110:
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 4
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl 12(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
decl %ebp # --num
|
||||
je .L910
|
||||
jmp .L110
|
||||
# .align 4
|
||||
.L910:
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
andl $3,%ebp
|
||||
je .L111
|
||||
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# .align 4
|
||||
.L111:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe1:
|
||||
.align 4
|
||||
.globl _bn_mul_word
|
||||
_bn_mul_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# num bp
|
||||
# si c
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 28(%esp),%ebp # num => bp
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
|
||||
# .align 4
|
||||
.L210:
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
jmp .L210
|
||||
# .align 4
|
||||
.L211:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe2:
|
||||
.align 4
|
||||
.globl _bn_sqr_words
|
||||
_bn_sqr_words:
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
movl 16(%esp),%esi # r
|
||||
movl 20(%esp),%edi # a
|
||||
movl 24(%esp),%ebx # n
|
||||
# .align 4
|
||||
shrl $2,%ebx
|
||||
jz .L99
|
||||
.L28:
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
movl 12(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,24(%esi) # put low into return addr
|
||||
movl %edx,28(%esi) # put high into return addr
|
||||
|
||||
addl $16,%edi
|
||||
addl $32,%esi
|
||||
decl %ebx # n-=4;
|
||||
jz .L99
|
||||
jmp .L28
|
||||
# .align 4
|
||||
.L99:
|
||||
movl 24(%esp),%ebx # n
|
||||
andl $3,%ebx
|
||||
jz .L29
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
.L29:
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
ret
|
||||
.Lfe3:
|
||||
.align 4
|
||||
.globl _bn_div64
|
||||
_bn_div64:
|
||||
movl 4(%esp),%edx # a
|
||||
movl 8(%esp),%eax # b
|
||||
divl 12(%esp) # ab/c
|
||||
ret
|
||||
.Lfe4:
|
||||
.ident "GCC: (GNU) 2.6.3"
|
||||
282
crypto/bn/asm/x86-lnx.s
Normal file
282
crypto/bn/asm/x86-lnx.s
Normal file
@@ -0,0 +1,282 @@
|
||||
.file "bn_mulw.c"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl bn_mul_add_word
|
||||
.type bn_mul_add_word,@function
|
||||
bn_mul_add_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# si c
|
||||
# bp num
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
|
||||
shrl $2,%ebp # num/4
|
||||
je .L910
|
||||
|
||||
.align 4
|
||||
.L110:
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 4
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl 12(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
decl %ebp # --num
|
||||
je .L910
|
||||
jmp .L110
|
||||
.align 4
|
||||
.L910:
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
andl $3,%ebp
|
||||
je .L111
|
||||
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
.align 4
|
||||
.L111:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe1:
|
||||
.size bn_mul_add_word,.Lfe1-bn_mul_add_word
|
||||
.align 16
|
||||
.globl bn_mul_word
|
||||
.type bn_mul_word,@function
|
||||
bn_mul_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# num bp
|
||||
# si c
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 28(%esp),%ebp # num => bp
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
|
||||
.align 4
|
||||
.L210:
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
jmp .L210
|
||||
.align 16
|
||||
.L211:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe2:
|
||||
.size bn_mul_word,.Lfe2-bn_mul_word
|
||||
|
||||
.align 16
|
||||
.globl bn_sqr_words
|
||||
.type bn_sqr_words,@function
|
||||
bn_sqr_words:
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
movl 16(%esp),%esi # r
|
||||
movl 20(%esp),%edi # a
|
||||
movl 24(%esp),%ebx # n
|
||||
.align 4
|
||||
shrl $2,%ebx
|
||||
jz .L99
|
||||
.L28:
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
movl 12(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,24(%esi) # put low into return addr
|
||||
movl %edx,28(%esi) # put high into return addr
|
||||
|
||||
addl $16,%edi
|
||||
addl $32,%esi
|
||||
decl %ebx # n-=4;
|
||||
jz .L99
|
||||
jmp .L28
|
||||
.align 16
|
||||
.L99:
|
||||
movl 24(%esp),%ebx # n
|
||||
andl $3,%ebx
|
||||
jz .L29
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
.L29:
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
ret
|
||||
.Lfe3:
|
||||
.size bn_sqr_words,.Lfe3-bn_sqr_words
|
||||
|
||||
.align 16
|
||||
.globl bn_div64
|
||||
.type bn_div64,@function
|
||||
bn_div64:
|
||||
movl 4(%esp),%edx # a
|
||||
movl 8(%esp),%eax # b
|
||||
divl 12(%esp) # ab/c
|
||||
ret
|
||||
.Lfe4:
|
||||
.size bn_div64,.Lfe4-bn_div64
|
||||
.ident "GCC: (GNU) 2.6.3"
|
||||
282
crypto/bn/asm/x86-lnxa.s
Normal file
282
crypto/bn/asm/x86-lnxa.s
Normal file
@@ -0,0 +1,282 @@
|
||||
.file "bn_mulw.c"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 4
|
||||
.globl _bn_mul_add_word
|
||||
.type _bn_mul_add_word,@function
|
||||
_bn_mul_add_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# si c
|
||||
# bp num
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
|
||||
shrl $2,%ebp # num/4
|
||||
je .L910
|
||||
|
||||
# .align 4
|
||||
.L110:
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+= carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# Round 4
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl 12(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
decl %ebp # --num
|
||||
je .L910
|
||||
jmp .L110
|
||||
# .align 4
|
||||
.L910:
|
||||
movl 28(%esp),%ebp # num => ebp
|
||||
andl $3,%ebp
|
||||
je .L111
|
||||
|
||||
# Round 1
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl (%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 2
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl 4(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L111
|
||||
|
||||
# Round 3
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl 8(%edi),%eax # *r+=L(t)
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r+=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
|
||||
# .align 4
|
||||
.L111:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe1:
|
||||
.size _bn_mul_add_word,.Lfe1-_bn_mul_add_word
|
||||
.align 4
|
||||
.globl _bn_mul_word
|
||||
.type _bn_mul_word,@function
|
||||
_bn_mul_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
# ax L(t)
|
||||
# dx H(t)
|
||||
# bx a
|
||||
# cx w
|
||||
# di r
|
||||
# num bp
|
||||
# si c
|
||||
xorl %esi,%esi # c=0
|
||||
movl 20(%esp),%edi # r => edi
|
||||
movl 24(%esp),%ebx # a => exb
|
||||
movl 28(%esp),%ebp # num => bp
|
||||
movl 32(%esp),%ecx # w => ecx
|
||||
|
||||
# .align 4
|
||||
.L210:
|
||||
movl %ecx,%eax # w => eax
|
||||
mull (%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 4(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,4(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 8(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,8(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax # w => eax
|
||||
mull 12(%ebx) # w * *a
|
||||
addl %esi,%eax # L(t)+=c
|
||||
adcl $0,%edx # H(t)+=carry
|
||||
movl %eax,12(%edi) # *r=L(t)
|
||||
movl %edx,%esi # c=H(t)
|
||||
decl %ebp # --num
|
||||
je .L211
|
||||
|
||||
addl $16,%ebx # a+=4 (4 words)
|
||||
addl $16,%edi # r+=4 (4 words)
|
||||
|
||||
jmp .L210
|
||||
# .align 4
|
||||
.L211:
|
||||
movl %esi,%eax # return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe2:
|
||||
.size _bn_mul_word,.Lfe2-_bn_mul_word
|
||||
|
||||
.align 4
|
||||
.globl _bn_sqr_words
|
||||
.type _bn_sqr_words,@function
|
||||
_bn_sqr_words:
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
movl 16(%esp),%esi # r
|
||||
movl 20(%esp),%edi # a
|
||||
movl 24(%esp),%ebx # n
|
||||
# .align 4
|
||||
shrl $2,%ebx
|
||||
jz .L99
|
||||
.L28:
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
movl 12(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,24(%esi) # put low into return addr
|
||||
movl %edx,28(%esi) # put high into return addr
|
||||
|
||||
addl $16,%edi
|
||||
addl $32,%esi
|
||||
decl %ebx # n-=4;
|
||||
jz .L99
|
||||
jmp .L28
|
||||
# .align 4
|
||||
.L99:
|
||||
movl 24(%esp),%ebx # n
|
||||
andl $3,%ebx
|
||||
jz .L29
|
||||
movl (%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,(%esi) # put low into return addr
|
||||
movl %edx,4(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 4(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,8(%esi) # put low into return addr
|
||||
movl %edx,12(%esi) # put high into return addr
|
||||
decl %ebx # n--;
|
||||
jz .L29
|
||||
movl 8(%edi),%eax # get a
|
||||
mull %eax # a*a
|
||||
movl %eax,16(%esi) # put low into return addr
|
||||
movl %edx,20(%esi) # put high into return addr
|
||||
|
||||
.L29:
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
ret
|
||||
.Lfe3:
|
||||
.size _bn_sqr_words,.Lfe3-_bn_sqr_words
|
||||
|
||||
.align 4
|
||||
.globl _bn_div64
|
||||
.type _bn_div64,@function
|
||||
_bn_div64:
|
||||
movl 4(%esp),%edx # a
|
||||
movl 8(%esp),%eax # b
|
||||
divl 12(%esp) # ab/c
|
||||
ret
|
||||
.Lfe4:
|
||||
.size _bn_div64,.Lfe4-_bn_div64
|
||||
.ident "GCC: (GNU) 2.6.3"
|
||||
224
crypto/bn/asm/x86-sol.s
Normal file
224
crypto/bn/asm/x86-sol.s
Normal file
@@ -0,0 +1,224 @@
|
||||
.file "bn_mulw.c"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl bn_mul_add_word
|
||||
.type bn_mul_add_word,@function
|
||||
bn_mul_add_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
/ ax L(t)
|
||||
/ dx H(t)
|
||||
/ bx a
|
||||
/ cx w
|
||||
/ di r
|
||||
/ si c
|
||||
/ bp num
|
||||
xorl %esi,%esi / c=0
|
||||
movl 20(%esp),%edi / r => edi
|
||||
movl 24(%esp),%ebx / a => exb
|
||||
movl 28(%esp),%ebp / num => ebp
|
||||
movl 32(%esp),%ecx / w => ecx
|
||||
|
||||
.align 4
|
||||
.L110:
|
||||
movl %ecx,%eax / w => eax
|
||||
mull (%ebx) / w * *a
|
||||
addl (%edi),%eax / L(t)+= *r
|
||||
adcl $0,%edx / H(t)+= carry
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L111
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 4(%ebx) / w * *a
|
||||
addl 4(%edi),%eax / L(t)+= *r
|
||||
adcl $0,%edx / H(t)+= carry
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,4(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L111
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 8(%ebx) / w * *a
|
||||
addl 8(%edi),%eax / L(t)+= *r
|
||||
adcl $0,%edx / H(t)+= carry
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,8(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L111
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 12(%ebx) / w * *a
|
||||
addl 12(%edi),%eax / L(t)+= *r
|
||||
adcl $0,%edx / H(t)+= carry
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,12(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L111
|
||||
|
||||
addl $16,%ebx / a+=4 (4 words)
|
||||
addl $16,%edi / r+=4 (4 words)
|
||||
|
||||
jmp .L110
|
||||
.align 16
|
||||
.L111:
|
||||
movl %esi,%eax / return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe1:
|
||||
.size bn_mul_add_word,.Lfe1-bn_mul_add_word
|
||||
.align 16
|
||||
.globl bn_mul_word
|
||||
.type bn_mul_word,@function
|
||||
bn_mul_word:
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
||||
/ ax L(t)
|
||||
/ dx H(t)
|
||||
/ bx a
|
||||
/ cx w
|
||||
/ di r
|
||||
/ num bp
|
||||
/ si c
|
||||
xorl %esi,%esi / c=0
|
||||
movl 20(%esp),%edi / r => edi
|
||||
movl 24(%esp),%ebx / a => exb
|
||||
movl 28(%esp),%ebp / num => ebp
|
||||
movl 32(%esp),%ecx / w => ecx
|
||||
|
||||
.align 4
|
||||
.L210:
|
||||
movl %ecx,%eax / w => eax
|
||||
mull (%ebx) / w * *a
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 4(%ebx) / w * *a
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,4(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 8(%ebx) / w * *a
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,8(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L211
|
||||
|
||||
movl %ecx,%eax / w => eax
|
||||
mull 12(%ebx) / w * *a
|
||||
addl %esi,%eax / L(t)+=c
|
||||
adcl $0,%edx / H(t)+=carry
|
||||
movl %eax,12(%edi) / *r=L(t)
|
||||
movl %edx,%esi / c=H(t)
|
||||
decl %ebp / --num
|
||||
je .L211
|
||||
|
||||
addl $16,%ebx / a+=4 (4 words)
|
||||
addl $16,%edi / r+=4 (4 words)
|
||||
|
||||
jmp .L210
|
||||
.align 16
|
||||
.L211:
|
||||
movl %esi,%eax / return(c)
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
.Lfe2:
|
||||
.size bn_mul_word,.Lfe2-bn_mul_word
|
||||
|
||||
.align 16
|
||||
.globl bn_sqr_words
|
||||
.type bn_sqr_words,@function
|
||||
bn_sqr_words:
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
movl 16(%esp),%esi / r
|
||||
movl 20(%esp),%edi / a
|
||||
movl 24(%esp),%ebx / n
|
||||
.align 4
|
||||
.L28:
|
||||
movl (%edi),%eax / get a
|
||||
mull %eax / a*a
|
||||
movl %eax,(%esi) / put low into return addr
|
||||
movl %edx,4(%esi) / put high into return addr
|
||||
decl %ebx / n--;
|
||||
je .L29
|
||||
|
||||
movl 4(%edi),%eax / get a
|
||||
mull %eax / a*a
|
||||
movl %eax,8(%esi) / put low into return addr
|
||||
movl %edx,12(%esi) / put high into return addr
|
||||
decl %ebx / n--;
|
||||
je .L29
|
||||
|
||||
movl 8(%edi),%eax / get a
|
||||
mull %eax / a*a
|
||||
movl %eax,16(%esi) / put low into return addr
|
||||
movl %edx,20(%esi) / put high into return addr
|
||||
decl %ebx / n--;
|
||||
je .L29
|
||||
|
||||
movl 12(%edi),%eax / get a
|
||||
mull %eax / a*a
|
||||
movl %eax,24(%esi) / put low into return addr
|
||||
movl %edx,28(%esi) / put high into return addr
|
||||
decl %ebx / n--;
|
||||
je .L29
|
||||
|
||||
addl $16,%edi
|
||||
addl $32,%esi
|
||||
jmp .L28
|
||||
.align 16
|
||||
.L29:
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
ret
|
||||
.Lfe3:
|
||||
.size bn_sqr_words,.Lfe3-bn_sqr_words
|
||||
|
||||
.align 16
|
||||
.globl bn_div64
|
||||
.type bn_div64,@function
|
||||
bn_div64:
|
||||
movl 4(%esp),%edx / a
|
||||
movl 8(%esp),%eax / b
|
||||
divl 12(%esp) / ab/c
|
||||
ret
|
||||
.Lfe4:
|
||||
.size bn_div64,.Lfe4-bn_div64
|
||||
.ident "GCC: (GNU) 2.6.3"
|
||||
288
crypto/bn/asm/x86nt32.asm
Normal file
288
crypto/bn/asm/x86nt32.asm
Normal file
@@ -0,0 +1,288 @@
|
||||
TITLE bn_mulw.c
|
||||
.386P
|
||||
.model FLAT
|
||||
PUBLIC _bn_mul_add_word
|
||||
_TEXT SEGMENT
|
||||
; File bn_mulw.c
|
||||
_bn_mul_add_word PROC NEAR
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
mov edi,DWORD PTR 20[esp] ; r
|
||||
mov ebx,DWORD PTR 24[esp] ; a
|
||||
mov ecx,DWORD PTR 32[esp] ; w
|
||||
xor esi,esi ; c=0
|
||||
|
||||
mov ebp,DWORD PTR 28[esp] ; num
|
||||
shr ebp,2 ; num/4
|
||||
jz $L666
|
||||
|
||||
$L546:
|
||||
; Round one
|
||||
mov eax,DWORD PTR [ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR [edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR [edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
|
||||
; Round two
|
||||
mov eax,DWORD PTR 4[ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR 4[edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR 4[edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
|
||||
; Round three
|
||||
mov eax,DWORD PTR 8[ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR 8[edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR 8[edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
|
||||
; Round four
|
||||
mov eax,DWORD PTR 12[ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR 12[edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR 12[edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
|
||||
add ebx,16
|
||||
add edi,16
|
||||
|
||||
dec ebp
|
||||
jz $L666
|
||||
jmp $L546
|
||||
$L666:
|
||||
mov ebp,DWORD PTR 28[esp] ; num
|
||||
and ebp,3 ; num%4
|
||||
jz $L547
|
||||
|
||||
; Round one
|
||||
mov eax,DWORD PTR [ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR [edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR [edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
dec ebp
|
||||
jz $L547
|
||||
; Round two
|
||||
mov eax,DWORD PTR 4[ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR 4[edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR 4[edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
dec ebp
|
||||
jz $L547
|
||||
; Round three
|
||||
mov eax,DWORD PTR 8[ebx] ; edx:eax = *a * w
|
||||
mul ecx
|
||||
add eax,DWORD PTR 8[edi] ; *r+=ax
|
||||
adc edx,0
|
||||
add eax,esi ; edx:eax += c
|
||||
adc edx,0
|
||||
mov DWORD PTR 8[edi],eax ; *r+=ax
|
||||
mov esi,edx ; c = overflow
|
||||
|
||||
$L547:
|
||||
mov eax,esi
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
_bn_mul_add_word ENDP
|
||||
_TEXT ENDS
|
||||
PUBLIC _bn_mul_word
|
||||
_TEXT SEGMENT
|
||||
_bn_mul_word PROC NEAR
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov edi,DWORD PTR 20[esp] ; r
|
||||
mov ebx,DWORD PTR 24[esp] ; a
|
||||
mov ebp,DWORD PTR 28[esp] ; num
|
||||
mov ecx,DWORD PTR 32[esp] ; w
|
||||
xor esi,esi ; c=0
|
||||
|
||||
shr ebp,2 ; num/4
|
||||
jz $L266
|
||||
|
||||
$L593:
|
||||
; Round one
|
||||
mov eax,DWORD PTR [ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR [edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
; Round two
|
||||
mov eax,DWORD PTR 4[ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR 4[edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
; Round three
|
||||
mov eax,DWORD PTR 8[ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR 8[edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
; Round four
|
||||
mov eax,DWORD PTR 12[ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR 12[edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
|
||||
add ebx,16
|
||||
add edi,16
|
||||
|
||||
dec ebp
|
||||
jz $L266
|
||||
jmp $L593
|
||||
$L266:
|
||||
mov ebp,DWORD PTR 28[esp] ; num
|
||||
and ebp,3
|
||||
jz $L601
|
||||
|
||||
; Round one
|
||||
mov eax,DWORD PTR [ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR [edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
dec ebp
|
||||
jz $L601
|
||||
; Round two
|
||||
mov eax,DWORD PTR 4[ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR 4[edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
dec ebp
|
||||
jz $L601
|
||||
; Round three
|
||||
mov eax,DWORD PTR 8[ebx] ; edx:eax= w * *a
|
||||
mul ecx
|
||||
add eax,esi ; edx:eax+=c
|
||||
adc edx,0
|
||||
mov DWORD PTR 8[edi],eax ; *r=eax
|
||||
mov esi,edx ; c=edx
|
||||
|
||||
$L601:
|
||||
mov eax,esi
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
_bn_mul_word ENDP
|
||||
_TEXT ENDS
|
||||
PUBLIC _bn_sqr_words
|
||||
_TEXT SEGMENT
|
||||
_bn_sqr_words PROC NEAR
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
mov esi,DWORD PTR 16[esp] ; r
|
||||
mov edi,DWORD PTR 20[esp] ; a
|
||||
mov ebx,DWORD PTR 24[esp] ; num
|
||||
|
||||
shr ebx,2 ; num/4
|
||||
jz $L111
|
||||
$L640:
|
||||
; Round 1
|
||||
mov eax, DWORD PTR [edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR [esi],eax
|
||||
mov DWORD PTR 4[esi],edx
|
||||
; Round 2
|
||||
mov eax, DWORD PTR 4[edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR 8[esi],eax
|
||||
mov DWORD PTR 12[esi],edx
|
||||
; Round 3
|
||||
mov eax, DWORD PTR 8[edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR 16[esi],eax
|
||||
mov DWORD PTR 20[esi],edx
|
||||
; Round 4
|
||||
mov eax, DWORD PTR 12[edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR 24[esi],eax
|
||||
mov DWORD PTR 28[esi],edx
|
||||
|
||||
add edi,16
|
||||
add esi,32
|
||||
|
||||
dec ebx
|
||||
jz $L111
|
||||
jmp $L640
|
||||
$L111:
|
||||
mov ebx,DWORD PTR 24[esp] ; num
|
||||
and ebx,3 ; num%3
|
||||
jz $L645
|
||||
|
||||
; Round 1
|
||||
mov eax, DWORD PTR [edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR [esi],eax
|
||||
mov DWORD PTR 4[esi],edx
|
||||
dec ebx
|
||||
jz $L645
|
||||
; Round 2
|
||||
mov eax, DWORD PTR 4[edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR 8[esi],eax
|
||||
mov DWORD PTR 12[esi],edx
|
||||
dec ebx
|
||||
jz $L645
|
||||
; Round 3
|
||||
mov eax, DWORD PTR 8[edi]
|
||||
mul eax ; *a * *a
|
||||
mov DWORD PTR 16[esi],eax
|
||||
mov DWORD PTR 20[esi],edx
|
||||
|
||||
$L645:
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
ret
|
||||
_bn_sqr_words ENDP
|
||||
_TEXT ENDS
|
||||
PUBLIC _bn_div64
|
||||
_TEXT SEGMENT
|
||||
_bn_div64 PROC NEAR
|
||||
mov edx, DWORD PTR 4[esp]
|
||||
mov eax, DWORD PTR 8[esp]
|
||||
div DWORD PTR 12[esp]
|
||||
ret
|
||||
_bn_div64 ENDP
|
||||
_TEXT ENDS
|
||||
END
|
||||
22
crypto/bn/asm/x86nt32.uu
Normal file
22
crypto/bn/asm/x86nt32.uu
Normal file
@@ -0,0 +1,22 @@
|
||||
begin 640 x86nt32.obj
|
||||
M3`$"`/H&DC-6`@``"P`````````N=&5X=```````````````\@$``&0`````
|
||||
M```````````````@`#!@+F1A=&$```#R`0````````````!6`@``````````
|
||||
M````````0``PP%535E>+?"04BUPD&(M,)"`S]HML)!S![0)T7(L#]^$#!X/2
|
||||
M``/&@](`B0>+\HM#!/?A`T<$@](``\:#T@")1P2+\HM#"/?A`T<(@](``\:#
|
||||
MT@")1PB+\HM##/?A`T<,@](``\:#T@")1PR+\H/#$(/'$$UT`NNDBVPD'(/E
|
||||
M`W1"BP/WX0,'@](``\:#T@")!XOR370MBT,$]^$#1P2#T@`#QH/2`(E'!(OR
|
||||
M3705BT,(]^$#1PB#T@`#QH/2`(E'"(ORB\9?7EM=PU535E>+?"04BUPD&(ML
|
||||
M)!R+3"0@,_;![0)T18L#]^$#QH/2`(D'B_*+0P3WX0/&@](`B4<$B_*+0PCW
|
||||
MX0/&@](`B4<(B_*+0PSWX0/&@](`B4<,B_*#PQ"#QQ!-=`+KNXML)!R#Y0-T
|
||||
M,8L#]^$#QH/2`(D'B_)-="&+0P3WX0/&@](`B4<$B_)-=`^+0PCWX0/&@](`
|
||||
MB4<(B_*+QE]>6UW#4U97BW0D$(M\)!2+7"08P>L"=#6+!_?@B0:)5@2+1P3W
|
||||
MX(E&"(E6#(M'"/?@B480B584BT<,]^")1AB)5AR#QQ"#QB!+=`+KRXM<)!B#
|
||||
MXP-T)8L']^")!HE6!$MT&8M'!/?@B48(B58,2W0+BT<(]^")1A")5A1?7EO#
|
||||
MBU0D!(M$)`CW="0,PRYF:6QE`````````/[_``!G`BY<8W)Y<'1O7&)N7&%S
|
||||
M;5QX.#9N=#,R+F%S;0```````````"YT97AT``````````$````#`?(!````
|
||||
M`````````````````"YD871A``````````(````#`0``````````````````
|
||||
M```````````$``````````$`(``"```````5````R0````$`(``"```````B
|
||||
M````:@$```$`(``"```````P````Y0$```$`(``"`#H```!?8FY?;75L7V%D
|
||||
L9%]W;W)D`%]B;E]M=6Q?=V]R9`!?8FY?<W%R7W=O<F1S`%]B;E]D:78V-```
|
||||
`
|
||||
end
|
||||
20
crypto/bn/asm/x86w16.uu
Normal file
20
crypto/bn/asm/x86w16.uu
Normal file
@@ -0,0 +1,20 @@
|
||||
begin 640 x86w16.obj
|
||||
M@!P`&BY<8W)Y<'1O7&)N7&%S;5QX.#9W,38N87-MQY8U```$7T)34P5?1$%4
|
||||
M009$1U)/55`&1E]415A4!4-/3E-4`T)34P5#3TY35`1$051!!$-/1$5EF`<`
|
||||
M2/`!!0H!&)@'`$@```,)`0R8!P!(```&"`$*F`<`2````@<!#YH(``3_`O\#
|
||||
M_P14D$4```$-7V)N7W-Q<E]W;W)D<U4!``E?8FY?9&EV-C3B`0`07V)N7VUU
|
||||
M;%]A9&1?=V]R9`````Q?8FY?;75L7W=O<F3<``#`B`0``*(!T:#T`0$``%53
|
||||
M5E<>!HOL,_:+?A".7A*+7A2.1A:+3AJ+;AC1[='M=&"+P2;W)P,%@](`$\:#
|
||||
MT@")!8ORB\$F]V<"`T4"@](`$\:#T@")10*+\HO!)O=G!`-%!(/2`!/&@](`
|
||||
MB44$B_*+P2;W9P8#10:#T@`3QH/2`(E%!HOR@\,(@\<(370"ZZ"+[(MN&(/E
|
||||
M`TUX18O!)O<G`P6#T@`3QH/2`(D%B_)->"^+P2;W9P(#10*#T@`3QH/2`(E%
|
||||
M`HOR37@6B\$F]V<$`T4$@](`$\:#T@")102+\HO&!Q]?7EM=RY!54U97'@8S
|
||||
M]HOLBWX0CEX2BUX4CD86BTX:BVX8B\$F]R<#QH/2`(D%B_)-=$*+P2;W9P(#
|
||||
MQH/2`(E%`HOR370OB\$F]V<$`\:#T@")102+\DUT'(O!)O=G!@/&@](`B44&
|
||||
MB_)-=`F#PPB#QPCKKI"+Q@<?7UY;7<N055-65QX&B^R+=A".7A*+?A2.1A:+
|
||||
M7AB+Z]'KT>MT.2:+!??@B02)5`(FBT4"]^")1`2)5`8FBT4$]^")1`B)5`HF
|
||||
MBT4&]^")1`R)5`Z#QPB#QA!+=`+KQX/E`TUX*":+!??@B02)5`)->!LFBT4"
|
||||
M]^")1`2)5`9->`PFBT4$]^")1`B)5`H''U]>6UW+58OLBU8&BT8(]W8*7<NZ
|
||||
%B@(``'0`
|
||||
`
|
||||
end
|
||||
23
crypto/bn/asm/x86w32.uu
Normal file
23
crypto/bn/asm/x86w32.uu
Normal file
@@ -0,0 +1,23 @@
|
||||
begin 640 x86w32.obj
|
||||
M@!P`&BY<8W)Y<'1O7&)N7&%S;5QX.#9W,S(N87-MR98U```$7T)34P5?1$%4
|
||||
M009$1U)/55`&1E]415A4!4-/3E-4`T)34P5#3TY35`1$051!!$-/1$5EF`<`
|
||||
M2(`"!0H!AY@'`$@```,)`0R8!P!(```&"`$*F`<`2````@<!#YH(``3_`O\#
|
||||
M_P14D$4```$-7V)N7W-Q<E]W;W)D<[\!``E?8FY?9&EV-C1H`@`07V)N7VUU
|
||||
M;%]A9&1?=V]R9`````Q?8FY?;75L7W=O<F0B`0"(B`0``*(!T:"$`@$``%53
|
||||
M9E97'@:+[&8S]HM^$HY>%(M>%HY&&&:+3AR+;AK1[='M#X2``&:+P68F]R=F
|
||||
M`P5F@](`9A/&9H/2`&:)!6:+\F:+P68F]V<$9@-%!&:#T@!F$\9F@](`9HE%
|
||||
M!&:+\F:+P68F]V<(9@-%"&:#T@!F$\9F@](`9HE%"&:+\F:+P68F]V<,9@-%
|
||||
M#&:#T@!F$\9F@](`9HE%#&:+\H/#$(/'$$UT`NN`B^R+;AJ#Y0-->%UFB\%F
|
||||
M)O<G9@,%9H/2`&83QF:#T@!FB05FB_)->#]FB\%F)O=G!&8#101F@](`9A/&
|
||||
M9H/2`&:)101FB_)->!YFB\%F)O=G"&8#10AF@](`9A/&9H/2`&:)10AFB_)F
|
||||
MB\9FB]9FP>H0!Q]?9EY;7<N055-F5E<>!F8S]HOLBWX2CEX4BUX6CD889HM.
|
||||
M'(MN&F:+P68F]R=F`\9F@](`9HD%9HOR37149HO!9B;W9P1F`\9F@](`9HE%
|
||||
M!&:+\DUT.V:+P68F]V<(9@/&9H/2`&:)10AFB_)-=")FB\%F)O=G#&8#QF:#
|
||||
MT@!FB44,9HOR370)@\,0@\<0ZY:09HO&9HO69L'J$`<?7V9>6UW+D%535E<>
|
||||
M!HOLBW80CEX2BWX4CD86BUX8B^O1Z]'K=$EF)HL%9O?@9HD$9HE4!&8FBT4$
|
||||
M9O?@9HE$"&:)5`QF)HM%"&;WX&:)1!!FB5049B:+10QF]^!FB4089HE4'(/'
|
||||
M$(/&($MT`NNW@^4#37@T9B:+!6;WX&:)!&:)5`1->"-F)HM%!&;WX&:)1`AF
|
||||
MB50,37@09B:+10AF]^!FB4009HE4%`<?7UY;7<M5B^QFBU8&9HM&"F;W=@YF
|
||||
.B]!FP>H07<O`B@(``'0`
|
||||
`
|
||||
end
|
||||
@@ -5,18 +5,20 @@
|
||||
#define BN_F_BN_BLINDING_INVERT 101
|
||||
#define BN_F_BN_BLINDING_NEW 102
|
||||
#define BN_F_BN_BLINDING_UPDATE 103
|
||||
#define BN_F_BN_BN2DEC 104
|
||||
#define BN_F_BN_BN2HEX 105
|
||||
#define BN_F_BN_CTX_NEW 106
|
||||
#define BN_F_BN_DIV 107
|
||||
#define BN_F_BN_EXPAND2 108
|
||||
#define BN_F_BN_MOD_EXP_MONT 109
|
||||
#define BN_F_BN_MOD_INVERSE 110
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 111
|
||||
#define BN_F_BN_MPI2BN 112
|
||||
#define BN_F_BN_NEW 113
|
||||
#define BN_F_BN_RAND 114
|
||||
#define BN_F_BN_USUB 115
|
||||
#define BN_F_BN_BL_CTX_INIT 104
|
||||
#define BN_F_BN_BL_CTX_NEW 105
|
||||
#define BN_F_BN_BN2DEC 106
|
||||
#define BN_F_BN_BN2HEX 107
|
||||
#define BN_F_BN_CTX_NEW 108
|
||||
#define BN_F_BN_DIV 109
|
||||
#define BN_F_BN_EXPAND2 110
|
||||
#define BN_F_BN_MOD_EXP_MONT 111
|
||||
#define BN_F_BN_MOD_INVERSE 112
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 113
|
||||
#define BN_F_BN_MPI2BN 114
|
||||
#define BN_F_BN_NEW 115
|
||||
#define BN_F_BN_RAND 116
|
||||
#define BN_F_BN_USUB 117
|
||||
|
||||
/* Reason codes. */
|
||||
#define BN_R_ARG2_LT_ARG3 100
|
||||
|
||||
@@ -79,7 +79,7 @@ extern "C" {
|
||||
|
||||
#define BN_MUL_COMBA
|
||||
#define BN_SQR_COMBA
|
||||
#undef BN_RECURSION
|
||||
#define BN_RECURSION
|
||||
#define RECP_MUL_MOD
|
||||
#define MONT_MUL_MOD
|
||||
|
||||
@@ -566,18 +566,20 @@ int BN_div_recp();
|
||||
#define BN_F_BN_BLINDING_INVERT 101
|
||||
#define BN_F_BN_BLINDING_NEW 102
|
||||
#define BN_F_BN_BLINDING_UPDATE 103
|
||||
#define BN_F_BN_BN2DEC 104
|
||||
#define BN_F_BN_BN2HEX 105
|
||||
#define BN_F_BN_CTX_NEW 106
|
||||
#define BN_F_BN_DIV 107
|
||||
#define BN_F_BN_EXPAND2 108
|
||||
#define BN_F_BN_MOD_EXP_MONT 109
|
||||
#define BN_F_BN_MOD_INVERSE 110
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 111
|
||||
#define BN_F_BN_MPI2BN 112
|
||||
#define BN_F_BN_NEW 113
|
||||
#define BN_F_BN_RAND 114
|
||||
#define BN_F_BN_USUB 115
|
||||
#define BN_F_BN_BL_CTX_INIT 104
|
||||
#define BN_F_BN_BL_CTX_NEW 105
|
||||
#define BN_F_BN_BN2DEC 106
|
||||
#define BN_F_BN_BN2HEX 107
|
||||
#define BN_F_BN_CTX_NEW 108
|
||||
#define BN_F_BN_DIV 109
|
||||
#define BN_F_BN_EXPAND2 110
|
||||
#define BN_F_BN_MOD_EXP_MONT 111
|
||||
#define BN_F_BN_MOD_INVERSE 112
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 113
|
||||
#define BN_F_BN_MPI2BN 114
|
||||
#define BN_F_BN_NEW 115
|
||||
#define BN_F_BN_RAND 116
|
||||
#define BN_F_BN_USUB 117
|
||||
|
||||
/* Reason codes. */
|
||||
#define BN_R_ARG2_LT_ARG3 100
|
||||
|
||||
@@ -566,18 +566,20 @@ int BN_div_recp();
|
||||
#define BN_F_BN_BLINDING_INVERT 101
|
||||
#define BN_F_BN_BLINDING_NEW 102
|
||||
#define BN_F_BN_BLINDING_UPDATE 103
|
||||
#define BN_F_BN_BN2DEC 104
|
||||
#define BN_F_BN_BN2HEX 105
|
||||
#define BN_F_BN_CTX_NEW 106
|
||||
#define BN_F_BN_DIV 107
|
||||
#define BN_F_BN_EXPAND2 108
|
||||
#define BN_F_BN_MOD_EXP_MONT 109
|
||||
#define BN_F_BN_MOD_INVERSE 110
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 111
|
||||
#define BN_F_BN_MPI2BN 112
|
||||
#define BN_F_BN_NEW 113
|
||||
#define BN_F_BN_RAND 114
|
||||
#define BN_F_BN_USUB 115
|
||||
#define BN_F_BN_BL_CTX_INIT 104
|
||||
#define BN_F_BN_BL_CTX_NEW 105
|
||||
#define BN_F_BN_BN2DEC 106
|
||||
#define BN_F_BN_BN2HEX 107
|
||||
#define BN_F_BN_CTX_NEW 108
|
||||
#define BN_F_BN_DIV 109
|
||||
#define BN_F_BN_EXPAND2 110
|
||||
#define BN_F_BN_MOD_EXP_MONT 111
|
||||
#define BN_F_BN_MOD_INVERSE 112
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 113
|
||||
#define BN_F_BN_MPI2BN 114
|
||||
#define BN_F_BN_NEW 115
|
||||
#define BN_F_BN_RAND 116
|
||||
#define BN_F_BN_USUB 117
|
||||
|
||||
/* Reason codes. */
|
||||
#define BN_R_ARG2_LT_ARG3 100
|
||||
|
||||
@@ -175,7 +175,10 @@ BIGNUM *r;
|
||||
BIGNUM *a;
|
||||
BIGNUM *b;
|
||||
{
|
||||
int max,min,ret=1;
|
||||
int max,min;
|
||||
#if 0
|
||||
int ret=1;
|
||||
#endif
|
||||
register BN_ULONG t1,t2,*ap,*bp,*rp;
|
||||
int i,carry;
|
||||
#if defined(IRIX_CC_BUG) && !defined(LINT)
|
||||
|
||||
144
crypto/bn/bn_bld.c
Normal file
144
crypto/bn/bn_bld.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/* crypto/bn/bn_bld.c */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
BN_BL_CTX *BN_BL_CTX_new()
|
||||
{
|
||||
BN_BL_CTX *ret;
|
||||
|
||||
if ((ret=(BN_BL_CTX *)Malloc(sizeof(BN_BL_CTX))) == NULL)
|
||||
{
|
||||
BNerr(BN_F_BN_BL_CTX_NEW,ERR_R_MALLOC_FAILURE);
|
||||
return(NULL);
|
||||
}
|
||||
if ((ret->num=BN_new()) == NULL) goto err;
|
||||
if ((ret->mod=BN_new()) == NULL) goto err;
|
||||
ret->inum=NULL;
|
||||
ret->count=16;
|
||||
ret->count=1;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int BN_BL_CTX_Init(a,mod)
|
||||
BN_BL_CTX *a;
|
||||
BIGNUM *mod;
|
||||
{
|
||||
int i;
|
||||
BN_CTX *ctx;
|
||||
|
||||
if ((ctx=BN_CTX_new()) == NULL) goto m_err;
|
||||
|
||||
if (BN_copy(a->mod,mod) == NULL) goto err;
|
||||
i=BN_num_bits(mod);
|
||||
if (!BN_rand(a->num,i,1,0)) goto err;
|
||||
|
||||
if (a->inum != NULL) BN_clear_free(a->inum);
|
||||
a->inum=BN_mod_inverse(a->num,a->mod,ctx)
|
||||
ret->count=16;
|
||||
return(1);
|
||||
m_err:
|
||||
BNerr(BN_F_BN_BL_CTX_INIT,ERR_R_MALLOC_FAILURE);
|
||||
err:
|
||||
return(0);
|
||||
}
|
||||
|
||||
BN_BL_CTX *BN_BL_CTX_Update(a)
|
||||
BN_BL_CTX *a;
|
||||
{
|
||||
BN_CTX *ctx;
|
||||
BN_BL_CTX *new;
|
||||
|
||||
if (--a->count > 0)
|
||||
return(1);
|
||||
|
||||
new=BN_BL_CTX_new();
|
||||
/* set/get lock */
|
||||
if ((ctx=BN_CTX_new()) == NULL)
|
||||
return(NULL);
|
||||
new->inum=BN_new();
|
||||
|
||||
BN_mod_mul(new->num,a->num,a->num,a->mod,ctx);
|
||||
BN_mod_mul(new->inum,a->inum,a->inum,a->mod,ctx);
|
||||
BN_copy(new->mod,a->mod);
|
||||
BN_BL_CTX_free(a);
|
||||
return(new);
|
||||
}
|
||||
|
||||
void BN_BL_CTX_free(a)
|
||||
BN_BL_CTX *a;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (a == NULL) return;
|
||||
|
||||
i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_RSA);
|
||||
if (i > 0) return;
|
||||
#ifdef REF_CHECK
|
||||
if (i < 0)
|
||||
{
|
||||
fprintf(stderr,"BN_BL_CTX_free, bad reference count\n");
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
if (a->num == NULL) BN_clear_free(a->num);
|
||||
if (a->inum == NULL) BN_clear_free(a->inum);
|
||||
if (a->mod == NULL) BN_clear_free(a->mod);
|
||||
}
|
||||
@@ -67,6 +67,8 @@ static ERR_STRING_DATA BN_str_functs[]=
|
||||
{ERR_PACK(0,BN_F_BN_BLINDING_INVERT,0), "BN_BLINDING_invert"},
|
||||
{ERR_PACK(0,BN_F_BN_BLINDING_NEW,0), "BN_BLINDING_new"},
|
||||
{ERR_PACK(0,BN_F_BN_BLINDING_UPDATE,0), "BN_BLINDING_update"},
|
||||
{ERR_PACK(0,BN_F_BN_BL_CTX_INIT,0), "BN_BL_CTX_INIT"},
|
||||
{ERR_PACK(0,BN_F_BN_BL_CTX_NEW,0), "BN_BL_CTX_NEW"},
|
||||
{ERR_PACK(0,BN_F_BN_BN2DEC,0), "BN_bn2dec"},
|
||||
{ERR_PACK(0,BN_F_BN_BN2HEX,0), "BN_bn2hex"},
|
||||
{ERR_PACK(0,BN_F_BN_CTX_NEW,0), "BN_CTX_new"},
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
char *BN_version="Big Number part of SSLeay 0.9.1a 06-Jul-1998";
|
||||
char *BN_version="Big Number part of OpenSSL 0.9.1c 23-Dec-1998";
|
||||
|
||||
/* For a 32 bit machine
|
||||
* 2 - 4 == 128
|
||||
|
||||
169
crypto/bn/bn_m.c
Normal file
169
crypto/bn/bn_m.c
Normal file
@@ -0,0 +1,169 @@
|
||||
/* crypto/bn/bn_m.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
#include "stack.h"
|
||||
|
||||
int limit=16;
|
||||
|
||||
typedef struct bn_pool_st
|
||||
{
|
||||
int used;
|
||||
int tos;
|
||||
STACK *sk;
|
||||
} BN_POOL;
|
||||
|
||||
BIGNUM *BN_POOL_push(bp)
|
||||
BN_POOL *bp;
|
||||
{
|
||||
BIGNUM *ret;
|
||||
|
||||
if (bp->used >= bp->tos)
|
||||
{
|
||||
ret=BN_new();
|
||||
sk_push(bp->sk,(char *)ret);
|
||||
bp->tos++;
|
||||
bp->used++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret=(BIGNUM *)sk_value(bp->sk,bp->used);
|
||||
bp->used++;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void BN_POOL_pop(bp,num)
|
||||
BN_POOL *bp;
|
||||
int num;
|
||||
{
|
||||
bp->used-=num;
|
||||
}
|
||||
|
||||
int BN_m(r,a,b)
|
||||
BIGNUM *r,*a,*b;
|
||||
{
|
||||
static BN_POOL bp;
|
||||
static init=1;
|
||||
|
||||
if (init)
|
||||
{
|
||||
bp.used=0;
|
||||
bp.tos=0;
|
||||
bp.sk=sk_new_null();
|
||||
init=0;
|
||||
}
|
||||
return(BN_mm(r,a,b,&bp));
|
||||
}
|
||||
|
||||
/* r must be different to a and b */
|
||||
int BN_mm(m, A, B, bp)
|
||||
BIGNUM *m,*A,*B;
|
||||
BN_POOL *bp;
|
||||
{
|
||||
int i,num;
|
||||
int an,bn;
|
||||
BIGNUM *a,*b,*c,*d,*ac,*bd;
|
||||
|
||||
an=A->top;
|
||||
bn=B->top;
|
||||
if ((an <= limit) || (bn <= limit))
|
||||
{
|
||||
return(BN_mul(m,A,B));
|
||||
}
|
||||
|
||||
a=BN_POOL_push(bp);
|
||||
b=BN_POOL_push(bp);
|
||||
c=BN_POOL_push(bp);
|
||||
d=BN_POOL_push(bp);
|
||||
ac=BN_POOL_push(bp);
|
||||
bd=BN_POOL_push(bp);
|
||||
|
||||
num=(an <= bn)?an:bn;
|
||||
num=1<<(BN_num_bits_word(num-1)-1);
|
||||
|
||||
/* Are going to now chop things into 'num' word chunks. */
|
||||
num*=BN_BITS2;
|
||||
|
||||
BN_copy(a,A);
|
||||
BN_mask_bits(a,num);
|
||||
BN_rshift(b,A,num);
|
||||
|
||||
BN_copy(c,B);
|
||||
BN_mask_bits(c,num);
|
||||
BN_rshift(d,B,num);
|
||||
|
||||
BN_sub(ac ,b,a);
|
||||
BN_sub(bd,c,d);
|
||||
BN_mm(m,ac,bd,bp);
|
||||
BN_mm(ac,a,c,bp);
|
||||
BN_mm(bd,b,d,bp);
|
||||
|
||||
BN_add(m,m,ac);
|
||||
BN_add(m,m,bd);
|
||||
BN_lshift(m,m,num);
|
||||
BN_lshift(bd,bd,num*2);
|
||||
|
||||
BN_add(m,m,ac);
|
||||
BN_add(m,m,bd);
|
||||
BN_POOL_pop(bp,6);
|
||||
return(1);
|
||||
}
|
||||
|
||||
97
crypto/bn/bn_mod.c
Normal file
97
crypto/bn/bn_mod.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* crypto/bn/bn_mod.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
/* rem != m */
|
||||
int BN_mod(rem, m, d,ctx)
|
||||
BIGNUM *rem;
|
||||
BIGNUM *m;
|
||||
BIGNUM *d;
|
||||
BN_CTX *ctx;
|
||||
{
|
||||
#if 0 /* The old slow way */
|
||||
int i,nm,nd;
|
||||
BIGNUM *dv;
|
||||
|
||||
if (BN_ucmp(m,d) < 0)
|
||||
return((BN_copy(rem,m) == NULL)?0:1);
|
||||
|
||||
dv=ctx->bn[ctx->tos];
|
||||
|
||||
if (!BN_copy(rem,m)) return(0);
|
||||
|
||||
nm=BN_num_bits(rem);
|
||||
nd=BN_num_bits(d);
|
||||
if (!BN_lshift(dv,d,nm-nd)) return(0);
|
||||
for (i=nm-nd; i>=0; i--)
|
||||
{
|
||||
if (BN_cmp(rem,dv) >= 0)
|
||||
{
|
||||
if (!BN_sub(rem,rem,dv)) return(0);
|
||||
}
|
||||
if (!BN_rshift1(dv,dv)) return(0);
|
||||
}
|
||||
return(1);
|
||||
#else
|
||||
return(BN_div(NULL,rem,m,d,ctx));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ printf("number BN_from_montgomery\n");
|
||||
/* hmm... if a is between i and 2*i, things are bad */
|
||||
if (a->top > i)
|
||||
{
|
||||
j=bn_add_words(ret->d,ret->d,&(a->d[i]),i);
|
||||
j=(int)(bn_add_words(ret->d,ret->d,&(a->d[i]),i));
|
||||
if (j) /* overflow */
|
||||
bn_sub_words(ret->d,ret->d,mont->N.d,i);
|
||||
}
|
||||
|
||||
@@ -176,16 +176,16 @@ printf(" bn_mul_recursive %d * %d\n",n2,n2);
|
||||
* r[32] holds (b[1]*b[1])
|
||||
*/
|
||||
|
||||
c1=bn_add_words(t,r,&(r[n2]),n2);
|
||||
c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
|
||||
|
||||
if (neg) /* if t[32] is negative */
|
||||
{
|
||||
c1-=bn_sub_words(&(t[n2]),t,&(t[n2]),n2);
|
||||
c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Might have a carry */
|
||||
c1+=bn_add_words(&(t[n2]),&(t[n2]),t,n2);
|
||||
c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
|
||||
@@ -193,7 +193,7 @@ printf(" bn_mul_recursive %d * %d\n",n2,n2);
|
||||
* r[32] holds (b[1]*b[1])
|
||||
* c1 holds the carry bits
|
||||
*/
|
||||
c1+=bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2);
|
||||
c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
|
||||
if (c1)
|
||||
{
|
||||
p= &(r[n+n2]);
|
||||
@@ -311,15 +311,15 @@ printf(" bn_mul_part_recursive %d * %d\n",tn+n,tn+n);
|
||||
* r[32] holds (b[1]*b[1])
|
||||
*/
|
||||
|
||||
c1=bn_add_words(t,r,&(r[n2]),n2);
|
||||
c1-=bn_sub_words(&(t[n2]),t,&(t[n2]),n2);
|
||||
c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
|
||||
c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
|
||||
* r[10] holds (a[0]*b[0])
|
||||
* r[32] holds (b[1]*b[1])
|
||||
* c1 holds the carry bits
|
||||
*/
|
||||
c1+=bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2);
|
||||
c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
|
||||
if (c1)
|
||||
{
|
||||
p= &(r[n+n2]);
|
||||
@@ -454,7 +454,7 @@ printf(" bn_mul_high %d * %d\n",n2,n2);
|
||||
if (l != NULL)
|
||||
{
|
||||
lp= &(t[n2+n]);
|
||||
c1=bn_add_words(lp,&(r[0]),&(l[0]),n);
|
||||
c1=(int)(bn_add_words(lp,&(r[0]),&(l[0]),n));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -463,7 +463,7 @@ printf(" bn_mul_high %d * %d\n",n2,n2);
|
||||
}
|
||||
|
||||
if (neg)
|
||||
neg=bn_sub_words(&(t[n2]),lp,&(t[0]),n);
|
||||
neg=(int)(bn_sub_words(&(t[n2]),lp,&(t[0]),n));
|
||||
else
|
||||
{
|
||||
bn_add_words(&(t[n2]),lp,&(t[0]),n);
|
||||
@@ -498,25 +498,25 @@ printf(" bn_mul_high %d * %d\n",n2,n2);
|
||||
if (l != NULL)
|
||||
{
|
||||
lp= &(t[n2]);
|
||||
c1= bn_add_words(lp,&(t[n2+n]),&(l[0]),n);
|
||||
c1= (int)(bn_add_words(lp,&(t[n2+n]),&(l[0]),n));
|
||||
}
|
||||
else
|
||||
{
|
||||
lp= &(t[n2+n]);
|
||||
c1=0;
|
||||
}
|
||||
c1+=bn_add_words(&(t[n2]),lp, &(r[0]),n);
|
||||
c1+=(int)(bn_add_words(&(t[n2]),lp, &(r[0]),n));
|
||||
if (oneg)
|
||||
c1-=bn_sub_words(&(t[n2]),&(t[n2]),&(t[0]),n);
|
||||
c1-=(int)(bn_sub_words(&(t[n2]),&(t[n2]),&(t[0]),n));
|
||||
else
|
||||
c1+=bn_add_words(&(t[n2]),&(t[n2]),&(t[0]),n);
|
||||
c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),&(t[0]),n));
|
||||
|
||||
c2 =bn_add_words(&(r[0]),&(r[0]),&(t[n2+n]),n);
|
||||
c2+=bn_add_words(&(r[0]),&(r[0]),&(r[n]),n);
|
||||
c2 =(int)(bn_add_words(&(r[0]),&(r[0]),&(t[n2+n]),n));
|
||||
c2+=(int)(bn_add_words(&(r[0]),&(r[0]),&(r[n]),n));
|
||||
if (oneg)
|
||||
c2-=bn_sub_words(&(r[0]),&(r[0]),&(t[n]),n);
|
||||
c2-=(int)(bn_sub_words(&(r[0]),&(r[0]),&(t[n]),n));
|
||||
else
|
||||
c2+=bn_add_words(&(r[0]),&(r[0]),&(t[n]),n);
|
||||
c2+=(int)(bn_add_words(&(r[0]),&(r[0]),&(t[n]),n));
|
||||
|
||||
if (c1 != 0) /* Add starting at r[0], could be +ve or -ve */
|
||||
{
|
||||
|
||||
366
crypto/bn/bn_mulw.c
Normal file
366
crypto/bn/bn_mulw.c
Normal file
@@ -0,0 +1,366 @@
|
||||
/* crypto/bn/bn_mulw.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
#ifdef BN_LLONG
|
||||
|
||||
BN_ULONG bn_mul_add_words(rp,ap,num,w)
|
||||
BN_ULONG *rp,*ap;
|
||||
int num;
|
||||
BN_ULONG w;
|
||||
{
|
||||
BN_ULONG c1=0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
mul_add(rp[0],ap[0],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[1],ap[1],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[2],ap[2],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[3],ap[3],w,c1);
|
||||
if (--num == 0) break;
|
||||
ap+=4;
|
||||
rp+=4;
|
||||
}
|
||||
|
||||
return(c1);
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_words(rp,ap,num,w)
|
||||
BN_ULONG *rp,*ap;
|
||||
int num;
|
||||
BN_ULONG w;
|
||||
{
|
||||
BN_ULONG c1=0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
mul(rp[0],ap[0],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul(rp[1],ap[1],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul(rp[2],ap[2],w,c1);
|
||||
if (--num == 0) break;
|
||||
mul(rp[3],ap[3],w,c1);
|
||||
if (--num == 0) break;
|
||||
ap+=4;
|
||||
rp+=4;
|
||||
}
|
||||
return(c1);
|
||||
}
|
||||
|
||||
void bn_sqr_words(r,a,n)
|
||||
BN_ULONG *r,*a;
|
||||
int n;
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
BN_ULLONG t;
|
||||
|
||||
t=(BN_ULLONG)(a[0])*(a[0]);
|
||||
r[0]=Lw(t); r[1]=Hw(t);
|
||||
if (--n == 0) break;
|
||||
|
||||
t=(BN_ULLONG)(a[1])*(a[1]);
|
||||
r[2]=Lw(t); r[3]=Hw(t);
|
||||
if (--n == 0) break;
|
||||
|
||||
t=(BN_ULLONG)(a[2])*(a[2]);
|
||||
r[4]=Lw(t); r[5]=Hw(t);
|
||||
if (--n == 0) break;
|
||||
|
||||
t=(BN_ULLONG)(a[3])*(a[3]);
|
||||
r[6]=Lw(t); r[7]=Hw(t);
|
||||
if (--n == 0) break;
|
||||
|
||||
a+=4;
|
||||
r+=8;
|
||||
}
|
||||
}
|
||||
|
||||
BN_ULONG bn_add_words(r,a,b,n)
|
||||
BN_ULONG *r,*a,*b;
|
||||
int n;
|
||||
{
|
||||
BN_ULLONG ll;
|
||||
|
||||
ll=0;
|
||||
for (;;)
|
||||
{
|
||||
ll+= (BN_ULLONG)a[0]+b[0];
|
||||
r[0]=(BN_ULONG)ll&BN_MASK2;
|
||||
ll>>=BN_BITS2;
|
||||
if (--n <= 0) break;
|
||||
|
||||
ll+= (BN_ULLONG)a[1]+b[1];
|
||||
r[1]=(BN_ULONG)ll&BN_MASK2;
|
||||
ll>>=BN_BITS2;
|
||||
if (--n <= 0) break;
|
||||
|
||||
ll+= (BN_ULLONG)a[2]+b[2];
|
||||
r[2]=(BN_ULONG)ll&BN_MASK2;
|
||||
ll>>=BN_BITS2;
|
||||
if (--n <= 0) break;
|
||||
|
||||
ll+= (BN_ULLONG)a[3]+b[3];
|
||||
r[3]=(BN_ULONG)ll&BN_MASK2;
|
||||
ll>>=BN_BITS2;
|
||||
if (--n <= 0) break;
|
||||
|
||||
a+=4;
|
||||
b+=4;
|
||||
r+=4;
|
||||
}
|
||||
return(ll&BN_MASK2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BN_ULONG bn_mul_add_words(rp,ap,num,w)
|
||||
BN_ULONG *rp,*ap;
|
||||
int num;
|
||||
BN_ULONG w;
|
||||
{
|
||||
BN_ULONG c=0;
|
||||
BN_ULONG bl,bh;
|
||||
|
||||
bl=LBITS(w);
|
||||
bh=HBITS(w);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
mul_add(rp[0],ap[0],bl,bh,c);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[1],ap[1],bl,bh,c);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[2],ap[2],bl,bh,c);
|
||||
if (--num == 0) break;
|
||||
mul_add(rp[3],ap[3],bl,bh,c);
|
||||
if (--num == 0) break;
|
||||
ap+=4;
|
||||
rp+=4;
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_words(rp,ap,num,w)
|
||||
BN_ULONG *rp,*ap;
|
||||
int num;
|
||||
BN_ULONG w;
|
||||
{
|
||||
BN_ULONG carry=0;
|
||||
BN_ULONG bl,bh;
|
||||
|
||||
bl=LBITS(w);
|
||||
bh=HBITS(w);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
mul(rp[0],ap[0],bl,bh,carry);
|
||||
if (--num == 0) break;
|
||||
mul(rp[1],ap[1],bl,bh,carry);
|
||||
if (--num == 0) break;
|
||||
mul(rp[2],ap[2],bl,bh,carry);
|
||||
if (--num == 0) break;
|
||||
mul(rp[3],ap[3],bl,bh,carry);
|
||||
if (--num == 0) break;
|
||||
ap+=4;
|
||||
rp+=4;
|
||||
}
|
||||
return(carry);
|
||||
}
|
||||
|
||||
void bn_sqr_words(r,a,n)
|
||||
BN_ULONG *r,*a;
|
||||
int n;
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
sqr64(r[0],r[1],a[0]);
|
||||
if (--n == 0) break;
|
||||
|
||||
sqr64(r[2],r[3],a[1]);
|
||||
if (--n == 0) break;
|
||||
|
||||
sqr64(r[4],r[5],a[2]);
|
||||
if (--n == 0) break;
|
||||
|
||||
sqr64(r[6],r[7],a[3]);
|
||||
if (--n == 0) break;
|
||||
|
||||
a+=4;
|
||||
r+=8;
|
||||
}
|
||||
}
|
||||
|
||||
BN_ULONG bn_add_words(r,a,b,n)
|
||||
BN_ULONG *r,*a,*b;
|
||||
int n;
|
||||
{
|
||||
BN_ULONG t1,t2;
|
||||
int carry,i;
|
||||
|
||||
carry=0;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
t1= *(a++);
|
||||
t2= *(b++);
|
||||
if (carry)
|
||||
{
|
||||
carry=(t2 >= ((~t1)&BN_MASK2));
|
||||
t2=(t1+t2+1)&BN_MASK2;
|
||||
}
|
||||
else
|
||||
{
|
||||
t2=(t1+t2)&BN_MASK2;
|
||||
carry=(t2<t1);
|
||||
}
|
||||
*(r++)=t2;
|
||||
}
|
||||
return(carry);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BN_LLONG) && defined(BN_DIV2W)
|
||||
|
||||
BN_ULONG bn_div64(h,l,d)
|
||||
BN_ULONG h,l,d;
|
||||
{
|
||||
return((BN_ULONG)(((((BN_ULLONG)h)<<BN_BITS2)|l)/(BN_ULLONG)d));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Divide h-l by d and return the result. */
|
||||
/* I need to test this some more :-( */
|
||||
BN_ULONG bn_div64(h,l,d)
|
||||
BN_ULONG h,l,d;
|
||||
{
|
||||
BN_ULONG dh,dl,q,ret=0,th,tl,t;
|
||||
int i,count=2;
|
||||
|
||||
if (d == 0) return(BN_MASK2);
|
||||
|
||||
i=BN_num_bits_word(d);
|
||||
if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i))
|
||||
{
|
||||
#if !defined(NO_STDIO) && !defined(WIN16)
|
||||
fprintf(stderr,"Division would overflow (%d)\n",i);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
i=BN_BITS2-i;
|
||||
if (h >= d) h-=d;
|
||||
|
||||
if (i)
|
||||
{
|
||||
d<<=i;
|
||||
h=(h<<i)|(l>>(BN_BITS2-i));
|
||||
l<<=i;
|
||||
}
|
||||
dh=(d&BN_MASK2h)>>BN_BITS4;
|
||||
dl=(d&BN_MASK2l);
|
||||
for (;;)
|
||||
{
|
||||
if ((h>>BN_BITS4) == dh)
|
||||
q=BN_MASK2l;
|
||||
else
|
||||
q=h/dh;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
t=(h-q*dh);
|
||||
if ((t&BN_MASK2h) ||
|
||||
((dl*q) <= (
|
||||
(t<<BN_BITS4)+
|
||||
((l&BN_MASK2h)>>BN_BITS4))))
|
||||
break;
|
||||
q--;
|
||||
}
|
||||
th=q*dh;
|
||||
tl=q*dl;
|
||||
t=(tl>>BN_BITS4);
|
||||
tl=(tl<<BN_BITS4)&BN_MASK2h;
|
||||
th+=t;
|
||||
|
||||
if (l < tl) th++;
|
||||
l-=tl;
|
||||
if (h < th)
|
||||
{
|
||||
h+=d;
|
||||
q--;
|
||||
}
|
||||
h-=th;
|
||||
|
||||
if (--count == 0) break;
|
||||
|
||||
ret=q<<BN_BITS4;
|
||||
h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2;
|
||||
l=(l&BN_MASK2l)<<BN_BITS4;
|
||||
}
|
||||
ret|=q;
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -241,17 +241,17 @@ printf(" bn_sqr_recursive %d * %d\n",n2,n2);
|
||||
* r[32] holds (b[1]*b[1])
|
||||
*/
|
||||
|
||||
c1=bn_add_words(t,r,&(r[n2]),n2);
|
||||
c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
|
||||
|
||||
/* t[32] is negative */
|
||||
c1-=bn_sub_words(&(t[n2]),t,&(t[n2]),n2);
|
||||
c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(a[1]-a[0])+(a[0]*a[0])+(a[1]*a[1])
|
||||
* r[10] holds (a[0]*a[0])
|
||||
* r[32] holds (a[1]*a[1])
|
||||
* c1 holds the carry bits
|
||||
*/
|
||||
c1+=bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2);
|
||||
c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
|
||||
if (c1)
|
||||
{
|
||||
p= &(r[n+n2]);
|
||||
|
||||
180
crypto/bn/bn_sub.c
Normal file
180
crypto/bn/bn_sub.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* crypto/bn/bn_sub.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
/* unsigned subtraction of b from a, a must be larger than b. */
|
||||
void bn_qsub(r, a, b)
|
||||
BIGNUM *r;
|
||||
BIGNUM *a;
|
||||
BIGNUM *b;
|
||||
{
|
||||
int max,min;
|
||||
register BN_ULONG t1,t2,*ap,*bp,*rp;
|
||||
int i,carry;
|
||||
#if defined(IRIX_CC_BUG) && !defined(LINT)
|
||||
int dummy;
|
||||
#endif
|
||||
|
||||
max=a->top;
|
||||
min=b->top;
|
||||
ap=a->d;
|
||||
bp=b->d;
|
||||
rp=r->d;
|
||||
|
||||
carry=0;
|
||||
for (i=0; i<min; i++)
|
||||
{
|
||||
t1= *(ap++);
|
||||
t2= *(bp++);
|
||||
if (carry)
|
||||
{
|
||||
carry=(t1 <= t2);
|
||||
t1=(t1-t2-1)&BN_MASK2;
|
||||
}
|
||||
else
|
||||
{
|
||||
carry=(t1 < t2);
|
||||
t1=(t1-t2)&BN_MASK2;
|
||||
}
|
||||
#if defined(IRIX_CC_BUG) && !defined(LINT)
|
||||
dummy=t1;
|
||||
#endif
|
||||
*(rp++)=t1&BN_MASK2;
|
||||
}
|
||||
if (carry) /* subtracted */
|
||||
{
|
||||
while (i < max)
|
||||
{
|
||||
i++;
|
||||
t1= *(ap++);
|
||||
t2=(t1-1)&BN_MASK2;
|
||||
*(rp++)=t2;
|
||||
if (t1 > t2) break;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
memcpy(rp,ap,sizeof(*rp)*(max-i));
|
||||
#else
|
||||
for (; i<max; i++)
|
||||
*(rp++)= *(ap++);
|
||||
#endif
|
||||
|
||||
r->top=max;
|
||||
bn_fix_top(r);
|
||||
}
|
||||
|
||||
int BN_sub(r, a, b)
|
||||
BIGNUM *r;
|
||||
BIGNUM *a;
|
||||
BIGNUM *b;
|
||||
{
|
||||
int max,i;
|
||||
int add=0,neg=0;
|
||||
BIGNUM *tmp;
|
||||
|
||||
/* a - b a-b
|
||||
* a - -b a+b
|
||||
* -a - b -(a+b)
|
||||
* -a - -b b-a
|
||||
*/
|
||||
if (a->neg)
|
||||
{
|
||||
if (b->neg)
|
||||
{ tmp=a; a=b; b=tmp; }
|
||||
else
|
||||
{ add=1; neg=1; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b->neg) { add=1; neg=0; }
|
||||
}
|
||||
|
||||
if (add)
|
||||
{
|
||||
/* As a fast max size, do a a->top | b->top */
|
||||
i=(a->top | b->top)+1;
|
||||
if (bn_wexpand(r,i) == NULL)
|
||||
return(0);
|
||||
if (i)
|
||||
bn_qadd(r,a,b);
|
||||
else
|
||||
bn_qadd(r,b,a);
|
||||
r->neg=neg;
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* We are actually doing a - b :-) */
|
||||
|
||||
max=(a->top > b->top)?a->top:b->top;
|
||||
if (bn_wexpand(r,max) == NULL) return(0);
|
||||
if (BN_ucmp(a,b) < 0)
|
||||
{
|
||||
bn_qsub(r,b,a);
|
||||
r->neg=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bn_qsub(r,a,b);
|
||||
r->neg=0;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
378
crypto/bn/stuff/bn_knuth.c
Normal file
378
crypto/bn/stuff/bn_knuth.c
Normal file
@@ -0,0 +1,378 @@
|
||||
/* crypto/bn/bn_knuth.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn.h"
|
||||
|
||||
/* This is just a test implementation, it has not been modified for
|
||||
* speed and it still has memory leaks. */
|
||||
|
||||
int BN_mask_bits(BIGNUM *a,int n);
|
||||
|
||||
#undef DEBUG
|
||||
#define MAIN
|
||||
|
||||
/* r must be different to a and b
|
||||
* Toom-Cook multiplication algorithm, taken from
|
||||
* The Art Of Computer Programming, Volume 2, Donald Knuth
|
||||
*/
|
||||
|
||||
#define CODE1 ((BIGNUM *)0x01)
|
||||
#define CODE2 ((BIGNUM *)0x02)
|
||||
#define CODE3 ((BIGNUM *)0x03)
|
||||
#define MAXK (30+1)
|
||||
|
||||
#define C3 3
|
||||
#define C4 4
|
||||
#define C5 5
|
||||
#define C6 6
|
||||
#define C7 7
|
||||
#define C8 8
|
||||
#define C9 9
|
||||
#define C10 10
|
||||
#define DONE 11
|
||||
|
||||
int new_total=0;
|
||||
int Free_total=0;
|
||||
int max=0,max_total=0;
|
||||
|
||||
BIGNUM *LBN_new(void );
|
||||
BIGNUM *LBN_dup(BIGNUM *a);
|
||||
void LBN_free(BIGNUM *a);
|
||||
|
||||
int BN_mul_knuth(w, a, b)
|
||||
BIGNUM *w;
|
||||
BIGNUM *a;
|
||||
BIGNUM *b;
|
||||
{
|
||||
int ret=1;
|
||||
int i,j,n,an,bn,y,z;
|
||||
BIGNUM *U[MAXK],*V[MAXK],*T[MAXK];
|
||||
BIGNUM *C[(MAXK*2*3)];
|
||||
BIGNUM *W[(MAXK*2)],*t1,*t2,*t3,*t4;
|
||||
int Utos,Vtos,Ctos,Wtos,Ttos;
|
||||
unsigned int k,Q,R;
|
||||
unsigned int q[MAXK];
|
||||
unsigned int r[MAXK];
|
||||
int state;
|
||||
|
||||
/* C1 */
|
||||
Utos=Vtos=Ctos=Wtos=Ttos=0;
|
||||
k=1;
|
||||
q[0]=q[1]=64;
|
||||
r[0]=r[1]=4;
|
||||
Q=6;
|
||||
R=2;
|
||||
|
||||
if (!bn_expand(w,BN_BITS2*2)) goto err;
|
||||
an=BN_num_bits(a);
|
||||
bn=BN_num_bits(b);
|
||||
n=(an > bn)?an:bn;
|
||||
while ((q[k-1]+q[k]) < n)
|
||||
{
|
||||
k++;
|
||||
Q+=R;
|
||||
i=R+1;
|
||||
if ((i*i) <= Q) R=i;
|
||||
q[k]=(1<<Q);
|
||||
r[k]=(1<<R);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("k =");
|
||||
for (i=0; i<=k; i++) printf("%7d",i);
|
||||
printf("\nq[k]=");
|
||||
for (i=0; i<=k; i++) printf("%7d",q[i]);
|
||||
printf("\nr[k]=");
|
||||
for (i=0; i<=k; i++) printf("%7d",r[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
/* C2 */
|
||||
C[Ctos++]=CODE1;
|
||||
if ((t1=LBN_dup(a)) == NULL) goto err;
|
||||
C[Ctos++]=t1;
|
||||
if ((t1=LBN_dup(b)) == NULL) goto err;
|
||||
C[Ctos++]=t1;
|
||||
|
||||
state=C3;
|
||||
for (;;)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("state=C%d, Ctos=%d Wtos=%d\n",state,Ctos,Wtos);
|
||||
#endif
|
||||
switch (state)
|
||||
{
|
||||
int lr,lq,lp;
|
||||
case C3:
|
||||
k--;
|
||||
if (k == 0)
|
||||
{
|
||||
t1=C[--Ctos];
|
||||
t2=C[--Ctos];
|
||||
#ifdef DEBUG
|
||||
printf("Ctos=%d poped %d\n",Ctos,2);
|
||||
#endif
|
||||
if ((t2->top == 0) || (t1->top == 0))
|
||||
w->top=0;
|
||||
else
|
||||
BN_mul(w,t1,t2);
|
||||
|
||||
LBN_free(t1); /* FREE */
|
||||
LBN_free(t2); /* FREE */
|
||||
state=C10;
|
||||
}
|
||||
else
|
||||
{
|
||||
lr=r[k];
|
||||
lq=q[k];
|
||||
lp=q[k-1]+q[k];
|
||||
state=C4;
|
||||
}
|
||||
break;
|
||||
case C4:
|
||||
for (z=0; z<2; z++) /* do for u and v */
|
||||
{
|
||||
/* break the item at C[Ctos-1]
|
||||
* into lr+1 parts of lq bits each
|
||||
* for j=0; j<=2r; j++
|
||||
*/
|
||||
t1=C[--Ctos]; /* pop off u */
|
||||
#ifdef DEBUG
|
||||
printf("Ctos=%d poped %d\n",Ctos,1);
|
||||
#endif
|
||||
if ((t2=LBN_dup(t1)) == NULL) goto err;
|
||||
BN_mask_bits(t2,lq);
|
||||
T[Ttos++]=t2;
|
||||
#ifdef DEBUG
|
||||
printf("C4 r=0 bits=%d\n",BN_num_bits(t2));
|
||||
#endif
|
||||
for (i=1; i<=lr; i++)
|
||||
{
|
||||
if (!BN_rshift(t1,t1,lq)) goto err;
|
||||
if ((t2=LBN_dup(t1)) == NULL) goto err;
|
||||
BN_mask_bits(t2,lq);
|
||||
T[Ttos++]=t2;
|
||||
#ifdef DEBUG
|
||||
printf("C4 r=%d bits=%d\n",i,
|
||||
BN_num_bits(t2));
|
||||
#endif
|
||||
}
|
||||
LBN_free(t1);
|
||||
|
||||
if ((t2=LBN_new()) == NULL) goto err;
|
||||
if ((t3=LBN_new()) == NULL) goto err;
|
||||
for (j=0; j<=2*lr; j++)
|
||||
{
|
||||
if ((t1=LBN_new()) == NULL) goto err;
|
||||
|
||||
if (!BN_set_word(t3,j)) goto err;
|
||||
for (i=lr; i>=0; i--)
|
||||
{
|
||||
if (!BN_mul(t2,t1,t3)) goto err;
|
||||
if (!BN_add(t1,t2,T[i])) goto err;
|
||||
}
|
||||
/* t1 is U(j) */
|
||||
if (z == 0)
|
||||
U[Utos++]=t1;
|
||||
else
|
||||
V[Vtos++]=t1;
|
||||
}
|
||||
LBN_free(t2);
|
||||
LBN_free(t3);
|
||||
while (Ttos) LBN_free(T[--Ttos]);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
for (i=0; i<Utos; i++)
|
||||
printf("U[%2d]=%4d bits\n",i,BN_num_bits(U[i]));
|
||||
for (i=0; i<Vtos; i++)
|
||||
printf("V[%2d]=%4d bits\n",i,BN_num_bits(V[i]));
|
||||
#endif
|
||||
/* C5 */
|
||||
#ifdef DEBUG
|
||||
printf("PUSH CODE2 and %d CODE3 onto stack\n",2*lr);
|
||||
#endif
|
||||
C[Ctos++]=CODE2;
|
||||
for (i=2*lr; i>0; i--)
|
||||
{
|
||||
C[Ctos++]=V[i];
|
||||
C[Ctos++]=U[i];
|
||||
C[Ctos++]=CODE3;
|
||||
}
|
||||
C[Ctos++]=V[0];
|
||||
C[Ctos++]=U[0];
|
||||
#ifdef DEBUG
|
||||
printf("Ctos=%d pushed %d\n",Ctos,2*lr*3+3);
|
||||
#endif
|
||||
Vtos=Utos=0;
|
||||
state=C3;
|
||||
break;
|
||||
case C6:
|
||||
if ((t1=LBN_dup(w)) == NULL) goto err;
|
||||
W[Wtos++]=t1;
|
||||
#ifdef DEBUG
|
||||
printf("put %d bit number onto w\n",BN_num_bits(t1));
|
||||
#endif
|
||||
state=C3;
|
||||
break;
|
||||
case C7:
|
||||
lr=r[k];
|
||||
lq=q[k];
|
||||
lp=q[k]+q[k-1];
|
||||
z=Wtos-2*lr-1;
|
||||
for (j=1; j<=2*lr; j++)
|
||||
{
|
||||
for (i=2*lr; i>=j; i--)
|
||||
{
|
||||
if (!BN_sub(W[z+i],W[z+i],W[z+i-1])) goto err;
|
||||
BN_div_word(W[z+i],j);
|
||||
}
|
||||
}
|
||||
state=C8;
|
||||
break;
|
||||
case C8:
|
||||
y=2*lr-1;
|
||||
if ((t1=LBN_new()) == NULL) goto err;
|
||||
if ((t3=LBN_new()) == NULL) goto err;
|
||||
|
||||
for (j=y; j>0; j--)
|
||||
{
|
||||
if (!BN_set_word(t3,j)) goto err;
|
||||
for (i=j; i<=y; i++)
|
||||
{
|
||||
if (!BN_mul(t1,W[z+i+1],t3)) goto err;
|
||||
if (!BN_sub(W[z+i],W[z+i],t1)) goto err;
|
||||
}
|
||||
}
|
||||
LBN_free(t1);
|
||||
LBN_free(t3);
|
||||
state=C9;
|
||||
break;
|
||||
case C9:
|
||||
BN_zero(w);
|
||||
#ifdef DEBUG
|
||||
printf("lq=%d\n",lq);
|
||||
#endif
|
||||
for (i=lr*2; i>=0; i--)
|
||||
{
|
||||
BN_lshift(w,w,lq);
|
||||
BN_add(w,w,W[z+i]);
|
||||
}
|
||||
for (i=0; i<=lr*2; i++)
|
||||
LBN_free(W[--Wtos]);
|
||||
state=C10;
|
||||
break;
|
||||
case C10:
|
||||
k++;
|
||||
t1=C[--Ctos];
|
||||
#ifdef DEBUG
|
||||
printf("Ctos=%d poped %d\n",Ctos,1);
|
||||
printf("code= CODE%d\n",t1);
|
||||
#endif
|
||||
if (t1 == CODE3)
|
||||
state=C6;
|
||||
else if (t1 == CODE2)
|
||||
{
|
||||
if ((t2=LBN_dup(w)) == NULL) goto err;
|
||||
W[Wtos++]=t2;
|
||||
state=C7;
|
||||
}
|
||||
else if (t1 == CODE1)
|
||||
{
|
||||
state=DONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("BAD ERROR\n");
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("bad state\n");
|
||||
goto err;
|
||||
break;
|
||||
}
|
||||
if (state == DONE) break;
|
||||
}
|
||||
ret=1;
|
||||
err:
|
||||
if (ret == 0) printf("ERROR\n");
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef MAIN
|
||||
main()
|
||||
{
|
||||
BIGNUM *a,*b,*r;
|
||||
int i;
|
||||
|
||||
if ((a=LBN_new()) == NULL) goto err;
|
||||
if ((b=LBN_new()) == NULL) goto err;
|
||||
if ((r=LBN_new()) == NULL) goto err;
|
||||
|
||||
if (!BN_rand(a,1024*2,0,0)) goto err;
|
||||
if (!BN_rand(b,1024*2,0,0)) goto err;
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
if (!BN_mul_knuth(r,a,b)) goto err; /**/
|
||||
/*if (!BN_mul(r,a,b)) goto err; /**/
|
||||
}
|
||||
BN_print(stdout,a); printf(" * ");
|
||||
BN_print(stdout,b); printf(" =\n");
|
||||
BN_print(stdout,r); printf("\n");
|
||||
|
||||
printf("BN_new() =%d\nBN_free()=%d max=%d\n",new_total,Free_total,max);
|
||||
|
||||
|
||||
exit(0);
|
||||
err:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_print_errors(stderr);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
int BN_mask_bits(a,n)
|
||||
BIGNUM *a;
|
||||
int n;
|
||||
{
|
||||
int b,w;
|
||||
|
||||
w=n/BN_BITS2;
|
||||
b=n%BN_BITS2;
|
||||
if (w >= a->top) return(0);
|
||||
if (b == 0)
|
||||
a->top=w;
|
||||
else
|
||||
{
|
||||
a->top=w+1;
|
||||
a->d[w]&= ~(BN_MASK2<<b);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
BIGNUM *LBN_dup(a)
|
||||
BIGNUM *a;
|
||||
{
|
||||
new_total++;
|
||||
max_total++;
|
||||
if (max_total > max) max=max_total;
|
||||
return(BN_dup(a));
|
||||
}
|
||||
|
||||
BIGNUM *LBN_new()
|
||||
{
|
||||
new_total++;
|
||||
max_total++;
|
||||
if (max_total > max) max=max_total;
|
||||
return(BN_new());
|
||||
}
|
||||
|
||||
void LBN_free(a)
|
||||
BIGNUM *a;
|
||||
{
|
||||
max_total--;
|
||||
if (max_total > max) max=max_total;
|
||||
Free_total++;
|
||||
BN_free(a);
|
||||
}
|
||||
340
crypto/bn/stuff/div.c
Normal file
340
crypto/bn/stuff/div.c
Normal file
@@ -0,0 +1,340 @@
|
||||
/* crypto/bn/div.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn.h"
|
||||
|
||||
BN_ULONG bn_div_2word();
|
||||
|
||||
int BN_div2(dv, rm, num, div,ctx)
|
||||
BIGNUM *dv;
|
||||
BIGNUM *rm;
|
||||
BIGNUM *num;
|
||||
BIGNUM *div;
|
||||
BN_CTX *ctx;
|
||||
{
|
||||
int norm_shift,i,j,nm,nd,loop;
|
||||
BIGNUM *tmp,wnum,*snum,*sdiv,*res;
|
||||
BN_ULONG *resp,*wnump;
|
||||
BN_ULONG d0,d1;
|
||||
int num_n,div_n;
|
||||
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,num); printf(" number\n");
|
||||
BN_print(stdout,div); printf(" divisor\n");
|
||||
#endif
|
||||
if (BN_is_zero(num))
|
||||
{
|
||||
BNerr(BN_F_BN_DIV,BN_R_DIV_BY_ZERO);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (BN_cmp(num,div) < 0)
|
||||
{
|
||||
if (rm != NULL)
|
||||
{ if (BN_copy(rm,num) == NULL) return(0); }
|
||||
if (dv != NULL) BN_zero(dv);
|
||||
return(1);
|
||||
}
|
||||
|
||||
tmp=ctx->bn[ctx->tos];
|
||||
snum=ctx->bn[ctx->tos+1];
|
||||
sdiv=ctx->bn[ctx->tos+2];
|
||||
if (dv == NULL)
|
||||
res=ctx->bn[ctx->tos+3];
|
||||
else res=dv;
|
||||
|
||||
/* First we normalise the numbers */
|
||||
norm_shift=BN_BITS2-((BN_num_bits(div))%BN_BITS2);
|
||||
BN_lshift(sdiv,div,norm_shift);
|
||||
norm_shift+=BN_BITS2;
|
||||
BN_lshift(snum,num,norm_shift);
|
||||
div_n=sdiv->top;
|
||||
num_n=snum->top;
|
||||
loop=num_n-div_n;
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,snum); printf(" shifted num, forget last word\n");
|
||||
BN_print(stdout,sdiv); printf(" shifted div\n");
|
||||
#endif
|
||||
|
||||
/* Lets setup a 'win'dow into snum
|
||||
* This is the part that corresponds to the current
|
||||
* 'area' being divided */
|
||||
wnum.d= &(snum->d[loop]);
|
||||
wnum.top= div_n;
|
||||
wnum.max= snum->max; /* a bit of a lie */
|
||||
wnum.neg= 0;
|
||||
|
||||
/* Get the top 2 words of sdiv */
|
||||
i=sdiv->top;
|
||||
d0=sdiv->d[div_n-1];
|
||||
d1=sdiv->d[div_n-2];
|
||||
|
||||
/* pointer to the 'top' of snum */
|
||||
wnump= &(snum->d[num_n-1]);
|
||||
|
||||
/* Setup to 'res' */
|
||||
res->neg=0;
|
||||
res->top=loop;
|
||||
resp= &(res->d[loop-1]);
|
||||
bn_expand(res,(loop+1)*BN_BITS2);
|
||||
|
||||
/* space for temp */
|
||||
bn_expand(tmp,(div_n+1)*BN_BITS2);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("wnum="); BN_print(stdout,&wnum); printf(" initial sub check\n");
|
||||
printf("div ="); BN_print(stdout,sdiv); printf(" loop=%d\n",loop);
|
||||
#endif
|
||||
if (BN_cmp(&wnum,sdiv) >= 0)
|
||||
{
|
||||
BN_sub(&wnum,&wnum,sdiv);
|
||||
*resp=1;
|
||||
res->d[res->top-1]=1;
|
||||
}
|
||||
else
|
||||
res->top--;
|
||||
resp--;
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,res); printf(" initial result\n");
|
||||
BN_print(stdout,&wnum); printf(" wnum\n");
|
||||
#endif
|
||||
|
||||
for (i=0; i<loop-1; i++)
|
||||
{
|
||||
BN_ULONG q,n0;
|
||||
BN_ULLONG t1,t2,t3;
|
||||
BN_ULONG l0;
|
||||
|
||||
wnum.d--;
|
||||
wnum.top++;
|
||||
|
||||
#ifdef DEBUG
|
||||
BN_print(stderr,&wnum); printf(" to divide\n");
|
||||
#endif
|
||||
|
||||
q=0;
|
||||
n0=wnump[0];
|
||||
t1=((BN_ULLONG)n0<<BN_BITS2)|wnump[-1];
|
||||
if (n0 == d0)
|
||||
q=BN_MASK2;
|
||||
else
|
||||
{
|
||||
t2=(t1/d0);
|
||||
q=(t2&BN_MASK2);
|
||||
#ifdef DEBUG
|
||||
printf("t1=%08X / d0=%08X = %X (%X)\n",t1,d0,q,t2);
|
||||
#endif
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
t2=(BN_ULLONG)d1*q;
|
||||
t3=t1-(BN_ULLONG)q*d0;
|
||||
#ifdef DEBUG
|
||||
printf("d1*q= %X n01-q*d0 = %X\n",t2,t3);
|
||||
#endif
|
||||
if ((t3>>BN_BITS2) ||
|
||||
(t2 <= ((t3<<BN_BITS2)+wnump[-2])))
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
printf("reduce q\n");
|
||||
#endif
|
||||
q--;
|
||||
}
|
||||
l0=bn_mul_word(tmp->d,sdiv->d,div_n,q);
|
||||
if (l0)
|
||||
tmp->d[div_n]=l0;
|
||||
else
|
||||
tmp->d[div_n]=0;
|
||||
for (j=div_n+1; j>0; j--)
|
||||
if (tmp->d[j-1]) break;
|
||||
tmp->top=j;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("q=%08X\n",q);
|
||||
BN_print(stdout,&wnum); printf(" number\n");
|
||||
BN_print(stdout,tmp); printf(" subtract\n");
|
||||
|
||||
BN_print(stdout,snum); printf(" shifted number before\n");
|
||||
BN_print(stdout,&wnum); printf(" wnum before\n");
|
||||
#endif
|
||||
j=wnum.top;
|
||||
BN_sub(&wnum,&wnum,tmp);
|
||||
snum->top=snum->top+wnum.top-j;
|
||||
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,&wnum); printf(" wnum after\n");
|
||||
BN_print(stdout,snum); printf(" shifted number after\n");
|
||||
#endif
|
||||
|
||||
if (wnum.neg)
|
||||
{
|
||||
q--;
|
||||
j=wnum.top;
|
||||
BN_add(&wnum,&wnum,sdiv);
|
||||
snum->top+=wnum.top-j;
|
||||
fprintf(stderr,"addback\n");
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,snum); printf("after addback************************:\n");
|
||||
#endif
|
||||
}
|
||||
*(resp--)=q;
|
||||
#ifdef DEBUG
|
||||
BN_print(stdout,res); printf(" result\n");
|
||||
#endif
|
||||
wnump--;
|
||||
}
|
||||
if (rm != NULL)
|
||||
BN_rshift(rm,snum,norm_shift);
|
||||
return(1);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
BIGNUM *a,*b,*c,*d;
|
||||
BIGNUM *cc,*dd;
|
||||
BN_CTX *ctx;
|
||||
int i,x;
|
||||
|
||||
a=BN_new();
|
||||
b=BN_new();
|
||||
c=BN_new();
|
||||
d=BN_new();
|
||||
cc=BN_new();
|
||||
dd=BN_new();
|
||||
ctx=BN_CTX_new();
|
||||
|
||||
for (i=0; i<10240; i++)
|
||||
{
|
||||
BN_rand(a,80,0,0);
|
||||
BN_rand(b,60,0,0);
|
||||
|
||||
BN_div2(d,c,a,b,ctx);
|
||||
BN_div(dd,cc,a,b,ctx);
|
||||
if ((BN_cmp(d,dd) != 0) || (BN_cmp(c,cc) != 0))
|
||||
{
|
||||
BN_print(stderr,a); fprintf(stderr," / ");
|
||||
BN_print(stderr,b); fprintf(stderr," d=");
|
||||
BN_print(stderr,d); fprintf(stderr," r= ");
|
||||
BN_print(stderr,c); fprintf(stderr,"\nd=");
|
||||
BN_print(stderr,dd); fprintf(stderr," r= ");
|
||||
BN_print(stderr,cc); fprintf(stderr,"\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef undef
|
||||
/*
|
||||
BN_rand(a,600,0,0);
|
||||
BN_rand(b,400,0,0);
|
||||
for (i=0; i<2000000; i++)
|
||||
{
|
||||
BN_div2(d,c,a,b,ctx);
|
||||
}
|
||||
*/
|
||||
/* for (i=0;;) */
|
||||
/* for (i=0; i<0xffffffff; i++)
|
||||
{
|
||||
BN_ULONG rr,r,a,b,c;
|
||||
BN_ULLONG l;
|
||||
|
||||
a=rand()&BN_MASK2;
|
||||
b=rand()&BN_MASK2;
|
||||
for (;;)
|
||||
{
|
||||
c=rand()&BN_MASK2;
|
||||
if (c) break;
|
||||
}
|
||||
/* for (x=1; x<256*256; x++) */
|
||||
{
|
||||
c=x;
|
||||
a=i>>8;
|
||||
b=i&0xff;
|
||||
a&= ~(0xFFFFFF<<(BN_num_bits_word(c)));
|
||||
|
||||
r=bn_div_2word(a,b,c);
|
||||
|
||||
rr=(BN_ULONG)((((BN_ULLONG)a<<BN_BITS2)|b)/c);
|
||||
|
||||
if ((i & 0xfffff) == 0) fprintf(stderr,"%d\n",i,r,rr);
|
||||
/*if (x == 255)
|
||||
fprintf(stderr,"%6d/%3d = %4d %4d\n",(a<<8)|b,c,r,rr); */
|
||||
if (rr != r)
|
||||
{
|
||||
fprintf(stderr,"%8d %02X%02X / %02X = %02X %02X\n",
|
||||
i,a,b,c,rr,r);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Divide h-l by d and return the result. */
|
||||
BN_ULONG bn_div_2word(l,h,d)
|
||||
BN_ULONG l,h,d;
|
||||
{
|
||||
BN_ULONG dh,dl,q,ret=0,th,tl,t,top;
|
||||
int i,count=2;
|
||||
|
||||
if (d == 0) return(-1);
|
||||
|
||||
i=BN_num_bits_word(d);
|
||||
if ((i != BN_BITS2) && (h > 1<<i))
|
||||
{
|
||||
fprintf(stderr,"Division would overflow\n");
|
||||
abort();
|
||||
}
|
||||
i=BN_BITS2-i;
|
||||
if (h >= d) h-=d;
|
||||
|
||||
if (i)
|
||||
{
|
||||
d<<=i;
|
||||
h=(h<<i)|(l>>(BN_BITS2-i));
|
||||
l<<=i;
|
||||
}
|
||||
dh=(d&BN_MASK2h)>>BN_BITS4;
|
||||
dl=(d&BN_MASK2l);
|
||||
for (;;)
|
||||
{
|
||||
if ((h>>BN_BITS4) == dh)
|
||||
q=BN_MASK2l;
|
||||
else
|
||||
q=h/dh;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
t=(h-q*dh);
|
||||
if ((t&BN_MASK2h) ||
|
||||
((dl*q) <= (
|
||||
(t<<BN_BITS4)+
|
||||
((l&BN_MASK2h)>>BN_BITS4))))
|
||||
break;
|
||||
q--;
|
||||
}
|
||||
th=q*dh;
|
||||
tl=q*dl;
|
||||
t=(tl>>BN_BITS4);
|
||||
tl=(tl<<BN_BITS4)&BN_MASK2h;
|
||||
th+=t;
|
||||
|
||||
if (l < tl) th++;
|
||||
l-=tl;
|
||||
if (h < th)
|
||||
{
|
||||
fprintf(stderr,"add back\n");
|
||||
h+=d;
|
||||
q--;
|
||||
}
|
||||
h-=th;
|
||||
|
||||
if (--count == 0) break;
|
||||
|
||||
ret=q<<BN_BITS4;
|
||||
h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2;
|
||||
l=(l&BN_MASK2l)<<BN_BITS4;
|
||||
}
|
||||
ret|=q;
|
||||
return(ret);
|
||||
}
|
||||
17
crypto/bn/stuff/mont.doc
Normal file
17
crypto/bn/stuff/mont.doc
Normal file
@@ -0,0 +1,17 @@
|
||||
All numbers (a) are stored aR mod N (except abRR)
|
||||
|
||||
RR = REDC(R*R) /* RR mod N */
|
||||
|
||||
|
||||
convert a -> aR
|
||||
convert b -> bR
|
||||
|
||||
{
|
||||
abRR = aR * bR
|
||||
abR = REDC(abRR); /* mod N */
|
||||
}
|
||||
|
||||
ab = REDC(abR); /* mod N */
|
||||
|
||||
|
||||
REDC strips off a multiplicaion by R mod N
|
||||
410
crypto/bn/stuff/wei_mulw.c
Normal file
410
crypto/bn/stuff/wei_mulw.c
Normal file
@@ -0,0 +1,410 @@
|
||||
/* crypto/bn/wei_mulw.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include "bn.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
BN_ULONG bn_add_word(BN_ULONG *a,BN_ULONG c,int num);
|
||||
BN_ULONG bn_add_words(BN_ULONG *ret,BN_ULONG *a,BN_ULONG *b,int num);
|
||||
BN_ULONG bn_sub_words(BN_ULONG *ret,BN_ULONG *a,BN_ULONG *b,int num);
|
||||
|
||||
void BN_mul_4words(BN_ULONG *ret,BN_ULONG a0,BN_ULONG a1,
|
||||
BN_ULONG b0,BN_ULONG b1);
|
||||
|
||||
void pr(a,n,s)
|
||||
BN_ULONG *a;
|
||||
int n;
|
||||
{
|
||||
while (n--)
|
||||
fprintf(stdout,"%02X",a[n]);
|
||||
fprintf(stdout,"%s",s);
|
||||
}
|
||||
|
||||
|
||||
BN_ULONG bn_add_word(a,w,num)
|
||||
BN_ULONG *a;
|
||||
BN_ULONG w;
|
||||
int num;
|
||||
{
|
||||
BN_ULONG t;
|
||||
|
||||
#ifdef DEBUG
|
||||
{ BN_ULONG *aa=a; int i; for (i=num; i>0; i--) fprintf(stdout,"%02X",aa[i-1]);
|
||||
fprintf(stdout," + %X - ",w); i=num;
|
||||
#endif
|
||||
|
||||
loop:
|
||||
t= *a;
|
||||
t=(t+w)&BN_MASK2;
|
||||
*(a++)=t;
|
||||
w=(t < w);
|
||||
if (w && --num) goto loop;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (; i>0; i--) fprintf(stdout,"%02X",aa[i-1]);
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return(w);
|
||||
}
|
||||
|
||||
BN_ULONG bn_add_words(r,a,b,num)
|
||||
BN_ULONG *r;
|
||||
BN_ULONG *a;
|
||||
BN_ULONG *b;
|
||||
int num;
|
||||
{
|
||||
#if defined(BN_LLONG)
|
||||
BN_ULLONG t;
|
||||
BN_ULONG c=0;
|
||||
int i;
|
||||
|
||||
if (num&1) abort();
|
||||
|
||||
for (i=0; i<num; i+=2)
|
||||
{
|
||||
t=(BN_ULLONG)a[i]+b[i]+c;
|
||||
r[i+0]=L(t);
|
||||
t=(BN_ULLONG) H(t)+a[i+1]+b[i+1];
|
||||
r[i+1]=L(t);
|
||||
c=H(t);
|
||||
}
|
||||
return(c);
|
||||
#else
|
||||
BN_ULONG c=0,t1,t2;
|
||||
|
||||
for ( ; num; num--)
|
||||
{
|
||||
t1= *(a++);
|
||||
t2= *(b++);
|
||||
|
||||
if (c)
|
||||
{
|
||||
c=(t2 >= ((~t1)&BN_MASK2));
|
||||
(*r++)=(t1+t2+1)&BN_MASK2;
|
||||
}
|
||||
else
|
||||
{
|
||||
t2=(t1+t2)&BN_MASK2;
|
||||
c=(t2 < t1);
|
||||
(*r++)=t2;
|
||||
}
|
||||
}
|
||||
return(c);
|
||||
#endif
|
||||
}
|
||||
|
||||
BN_ULONG bn_sub_words(r,a,b,num)
|
||||
BN_ULONG *r;
|
||||
BN_ULONG *a;
|
||||
BN_ULONG *b;
|
||||
int num;
|
||||
{
|
||||
#if defined(BN_LLONG)
|
||||
BN_ULLONG t;
|
||||
BN_ULONG c=0;
|
||||
int i;
|
||||
|
||||
if (num&1) abort();
|
||||
|
||||
for (i=0; i<num; i+=2)
|
||||
{
|
||||
t=(BN_ULLONG)a[i]-b[i]-c;
|
||||
r[i+0]=L(t);
|
||||
t=(BN_ULLONG)a[i+1]-b[i+1]-(0-H(t))&BN_MASK2;
|
||||
r[i+1]=L(t);
|
||||
c=H(t);
|
||||
}
|
||||
return(c);
|
||||
#else
|
||||
BN_ULONG c=0,t1,t2;
|
||||
|
||||
for ( ; num; num--)
|
||||
{
|
||||
t1= *(a++);
|
||||
t2= *(b++);
|
||||
|
||||
if (c)
|
||||
{
|
||||
c=(t1 <= t2);
|
||||
t1=(t1-t2-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
c=(t1 < t2);
|
||||
t1=(t1-t2);
|
||||
}
|
||||
(*r++)=t1&BN_MASK2;
|
||||
}
|
||||
return(c);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* ret[3,2,1,0] = a1,a0 * b1,b0 */
|
||||
void BN_mul_4words(ret,a0,a1,b0,b1)
|
||||
BN_ULONG *ret;
|
||||
BN_ULONG a0,a1,b0,b1;
|
||||
{
|
||||
BN_ULONG s,u;
|
||||
BN_ULLONG fix,a0b0,a1b1,tmp;
|
||||
|
||||
if (a1 >= a0)
|
||||
{
|
||||
s=(a1-a0);
|
||||
u=(b0-b1);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
if (b0 >= b1) s=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BN_ULONG u;
|
||||
|
||||
if (b0 > b1)
|
||||
{
|
||||
s=(b0-b1);
|
||||
u=(a1-a0);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
}
|
||||
else
|
||||
{
|
||||
u=(a0-a1);
|
||||
s=(b1-b0);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
s=0;
|
||||
}
|
||||
}
|
||||
|
||||
a0b0=(BN_ULLONG)a0*b0;
|
||||
ret[0]=L(a0b0);
|
||||
|
||||
a1b1=(BN_ULLONG)a1*b1;
|
||||
tmp=(BN_ULLONG) H(a0b0) + L(a0b0) + L(fix) + L(a1b1);
|
||||
ret[1]=L(tmp);
|
||||
|
||||
tmp=(BN_ULLONG) a1b1 + H(tmp) + H(a0b0) + H(fix) + H(a1b1) - s;
|
||||
ret[2]=L(tmp);
|
||||
ret[3]=H(tmp);
|
||||
}
|
||||
|
||||
/* ret[3,2,1,0] += a1,a0 * b1,b0 */
|
||||
BN_ULONG BN_mul_add_4words(ret,a0,a1,b0,b1)
|
||||
BN_ULONG *ret;
|
||||
BN_ULONG a0,a1,b0,b1;
|
||||
{
|
||||
BN_ULONG s,u;
|
||||
BN_ULLONG fix,a0b0,a1b1,tmp;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout,"%02X%02X%02X%02X",ret[3],ret[2],ret[1],ret[0]);
|
||||
fprintf(stdout," + ( %02X%02X * %02X%02X ) - ",a1,a0,b1,b0);
|
||||
#endif
|
||||
if (a1 >= a0)
|
||||
{
|
||||
s=(a1-a0);
|
||||
u=(b0-b1);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
if (b0 >= b1) s=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b0 > b1)
|
||||
{
|
||||
s=(b0-b1);
|
||||
u=(a1-a0);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
}
|
||||
else
|
||||
{
|
||||
u=(a0-a1);
|
||||
s=(b1-b0);
|
||||
fix=(BN_ULLONG)s*u;
|
||||
s=0;
|
||||
}
|
||||
}
|
||||
|
||||
a0b0=(BN_ULLONG)a0*b0;
|
||||
tmp=a0b0+ret[0];
|
||||
ret[0]=L(tmp);
|
||||
|
||||
a1b1=(BN_ULLONG)a1*b1;
|
||||
tmp=(BN_ULLONG) H(tmp) + L(a0b0) + L(fix) + L(a1b1) + ret[1];
|
||||
ret[1]=L(tmp);
|
||||
|
||||
tmp=(BN_ULLONG) H(tmp) + L(a1b1) + H(a0b0) +
|
||||
H(fix) + H(a1b1) -s + ret[2];
|
||||
ret[2]=L(tmp);
|
||||
|
||||
tmp=(BN_ULLONG) H(tmp) + H(a1b1) + ret[3];
|
||||
ret[3]=L(tmp);
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout,"%02X%02X%02X%02X%02X\n",H(tmp),ret[3],ret[2],ret[1],ret[0]);
|
||||
#endif
|
||||
return(H(tmp));
|
||||
}
|
||||
|
||||
/* ret[3,2,1,0] += a1,a0 * a1,a0 */
|
||||
void BN_sqr_4words(ret,a0,a1)
|
||||
BN_ULONG *ret;
|
||||
BN_ULONG a0,a1;
|
||||
{
|
||||
BN_ULONG s,u;
|
||||
BN_ULLONG tmp,tmp2;
|
||||
|
||||
tmp=(BN_ULLONG)a0*a0;
|
||||
ret[0]=L(tmp);
|
||||
|
||||
tmp2=(BN_ULLONG)a0*a1;
|
||||
tmp=(BN_ULLONG)H(tmp)+L(tmp2)*2;
|
||||
ret[1]=L(tmp);
|
||||
|
||||
tmp=(BN_ULLONG)a1*a1+H(tmp)+H(tmp2)*2;
|
||||
ret[2]=L(tmp);
|
||||
ret[3]=L(tmp);
|
||||
}
|
||||
|
||||
#define N0 (0)
|
||||
#define N1 (half)
|
||||
#define N2 (num)
|
||||
#define N3 (num+half)
|
||||
|
||||
#define word_cmp(r,a,b,num) \
|
||||
{ \
|
||||
int n=num; \
|
||||
\
|
||||
(r)=0; \
|
||||
while (n--) \
|
||||
{ \
|
||||
if ((a)[(n)] > (b)[(n)]) \
|
||||
{ (r)=1; break; } \
|
||||
else if ((a)[(n)] < (b)[(n)]) \
|
||||
{ (r)= -1; break; } \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* (a->top == b->top) && (a->top >= 2) && !(a->top & 1) */
|
||||
void bn_recursize_mul(r,t,a,b,num)
|
||||
BN_ULONG *r,*t,*a,*b;
|
||||
int num;
|
||||
{
|
||||
if ((num < 2) || (num&1))
|
||||
abort();
|
||||
|
||||
/* fprintf(stderr,"num=%d half=%d\n",num,num/2);*/
|
||||
if (num == 2)
|
||||
BN_mul_4words(r,a[0],a[1],b[0],b[1]);
|
||||
else if (num == 4)
|
||||
{
|
||||
BN_ULONG c,tmp;
|
||||
|
||||
BN_mul_4words(&(r[0]),a[0],a[1],b[0],b[1]);
|
||||
BN_mul_4words(&(r[4]),a[2],a[3],b[2],b[3]);
|
||||
|
||||
c =BN_mul_add_4words(&(r[2]),a[0],a[1],b[2],b[3]);
|
||||
c+=BN_mul_add_4words(&(r[2]),a[2],a[3],b[0],b[1]);
|
||||
|
||||
bn_add_word(&(r[6]),c,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
int half=num/2;
|
||||
int carry,cmp_a,cmp_b;
|
||||
|
||||
word_cmp(cmp_a,&(a[0]),&(a[half]),half);
|
||||
word_cmp(cmp_b,&(b[0]),&(b[half]),half);
|
||||
|
||||
switch (cmp_a*2+cmp_a+cmp_b)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_words(&(t[N0]),&(a[N1]),&(a[N0]),half);
|
||||
bn_sub_words(&(t[N1]),&(b[N0]),&(b[N1]),half);
|
||||
bn_recursize_mul(&(r[N1]),&(t[N2]),
|
||||
&(t[N0]),&(t[N1]),half);
|
||||
bn_sub_words(&(r[N2]),&(r[N2]),&(t[N0]),half);
|
||||
carry= -1;
|
||||
break;
|
||||
case -2:
|
||||
bn_sub_words(&(t[N0]),&(a[N1]),&(a[N0]),half);
|
||||
bn_sub_words(&(t[N1]),&(b[N0]),&(b[N1]),half);
|
||||
bn_recursize_mul(&(r[N1]),&(t[N2]),
|
||||
&(t[N0]),&(t[N1]),half);
|
||||
carry=0;
|
||||
break;
|
||||
case 2:
|
||||
bn_sub_words(&(t[N0]),&(a[N0]),&(a[N1]),half);
|
||||
bn_sub_words(&(t[N1]),&(b[N1]),&(b[N0]),half);
|
||||
bn_recursize_mul(&(r[N1]),&(t[N2]),
|
||||
&(t[N0]),&(t[N1]),half);
|
||||
carry=0;
|
||||
break;
|
||||
case 4:
|
||||
bn_sub_words(&(t[N0]),&(a[N1]),&(a[N0]),half);
|
||||
bn_sub_words(&(t[N1]),&(b[N0]),&(b[N1]),half);
|
||||
bn_recursize_mul(&(r[N1]),&(t[N2]),
|
||||
&(t[N0]),&(t[N1]),half);
|
||||
bn_sub_words(&(r[N2]),&(r[N2]),&(t[N1]),half);
|
||||
carry= -1;
|
||||
break;
|
||||
default:
|
||||
memset(&(r[N1]),0,sizeof(BN_ULONG)*num);
|
||||
break;
|
||||
}
|
||||
|
||||
bn_recursize_mul(&(t[N0]),&(t[N2]),&(a[N0]),&(b[N0]),half);
|
||||
#ifdef DEBUG
|
||||
pr(a,half," * ");
|
||||
pr(b,half," - ");
|
||||
pr(t,num," - 0\n");
|
||||
#endif
|
||||
memcpy(&(r[N0]),&(t[N0]),half*sizeof(BN_ULONG));
|
||||
if (bn_add_words(&(r[N1]),&(r[N1]),&(t[N1]),half))
|
||||
{ bn_add_word(&(t[N1]),1,half); }
|
||||
|
||||
carry+=bn_add_words(&(r[N1]),&(r[N1]),&(t[N0]),num);
|
||||
|
||||
bn_recursize_mul(&(t[N0]),&(t[N2]),&(a[N1]),&(b[N1]),half);
|
||||
|
||||
carry+=bn_add_words(&(r[N1]),&(r[N1]),&(t[N0]),num);
|
||||
carry+=bn_add_words(&(r[N2]),&(r[N2]),&(t[N0]),half);
|
||||
memcpy(&(r[N3]),&(t[N1]),half*sizeof(BN_ULONG));
|
||||
|
||||
bn_add_word(&(r[N3]),carry,half);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
BIGNUM *a,*b,*r,*t;
|
||||
int i,j;
|
||||
|
||||
a=BN_new();
|
||||
b=BN_new();
|
||||
r=BN_new();
|
||||
t=BN_new();
|
||||
|
||||
#define BITS 1024
|
||||
bn_expand(r,BITS*2);
|
||||
bn_expand(t,BITS*2);
|
||||
fprintf(stdout,"obase=16\n");
|
||||
fprintf(stdout,"ibase=16\n");
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
BN_rand(a,BITS,0,0);
|
||||
BN_rand(b,BITS,0,0);
|
||||
r->top=(BITS*2)/BN_BITS2;
|
||||
memset(r->d,0,sizeof(r->top)*sizeof(BN_ULONG));
|
||||
memset(t->d,0,sizeof(r->top)*sizeof(BN_ULONG));
|
||||
for (j=0; j<1000; j++)
|
||||
{
|
||||
|
||||
/* BN_mul(r,a,b); /**/
|
||||
bn_recursize_mul(r->d,t->d,a->d,b->d,a->top); /**/
|
||||
}
|
||||
BN_print(stdout,a); fprintf(stdout," * ");
|
||||
BN_print(stdout,b); fprintf(stdout," - ");
|
||||
BN_print(stdout,r); fprintf(stdout,"\n");
|
||||
}
|
||||
}
|
||||
1
crypto/buffer/.cvsignore
Normal file
1
crypto/buffer/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -66,7 +66,6 @@ static ERR_STRING_DATA BUF_str_functs[]=
|
||||
{ERR_PACK(0,BUF_F_BUF_MEM_GROW,0), "BUF_MEM_grow"},
|
||||
{ERR_PACK(0,BUF_F_BUF_MEM_NEW,0), "BUF_MEM_new"},
|
||||
{ERR_PACK(0,BUF_F_BUF_STRDUP,0), "BUF_strdup"},
|
||||
{ERR_PACK(0,BUF_F_PXYCLNT_READ,0), "PXYCLNT_READ"},
|
||||
{0,NULL},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
#define BUF_F_BUF_MEM_GROW 100
|
||||
#define BUF_F_BUF_MEM_NEW 101
|
||||
#define BUF_F_BUF_STRDUP 102
|
||||
#define BUF_F_PXYCLNT_READ 103
|
||||
|
||||
/* Reason codes. */
|
||||
|
||||
@@ -96,7 +96,6 @@ void ERR_load_BUF_strings();
|
||||
#define BUF_F_BUF_MEM_GROW 100
|
||||
#define BUF_F_BUF_MEM_NEW 101
|
||||
#define BUF_F_BUF_STRDUP 102
|
||||
#define BUF_F_PXYCLNT_READ 103
|
||||
|
||||
/* Reason codes. */
|
||||
|
||||
|
||||
1
crypto/cast/.cvsignore
Normal file
1
crypto/cast/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "cast.h"
|
||||
#include "cast_lcl.h"
|
||||
|
||||
char *CAST_version="CAST part of SSLeay 0.9.1a 06-Jul-1998";
|
||||
char *CAST_version="CAST part of OpenSSL 0.9.1c 23-Dec-1998";
|
||||
|
||||
void CAST_ecb_encrypt(in, out, ks, encrypt)
|
||||
unsigned char *in;
|
||||
|
||||
1
crypto/comp/.cvsignore
Normal file
1
crypto/comp/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
1
crypto/conf/.cvsignore
Normal file
1
crypto/conf/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -95,7 +95,7 @@ static CONF_VALUE *get_section();
|
||||
|
||||
#define scan_esc(p) ((((p)[1] == '\0')?(p++):(p+=2)),p)
|
||||
|
||||
char *CONF_version="CONF part of SSLeay 0.9.1a 06-Jul-1998";
|
||||
char *CONF_version="CONF part of OpenSSL 0.9.1c 23-Dec-1998";
|
||||
|
||||
LHASH *CONF_load(h,file,line)
|
||||
LHASH *h;
|
||||
|
||||
@@ -88,7 +88,7 @@ extern "C" {
|
||||
#define X509_CERT_AREA "/usr/local/ssl"
|
||||
#define X509_CERT_DIR "/usr/local/ssl/certs"
|
||||
#define X509_CERT_FILE "/usr/local/ssl/cert.pem"
|
||||
#define X509_PRIVATE_DIR "/usr/local/ssl/private"
|
||||
#define X509_PRIVATE_DIR "/usr/local/ssl/private"
|
||||
|
||||
#define X509_CERT_DIR_EVP "SSL_CERT_DIR"
|
||||
#define X509_CERT_FILE_EVP "SSL_CERT_FILE"
|
||||
|
||||
@@ -65,10 +65,12 @@ extern "C" {
|
||||
|
||||
#include "stack.h"
|
||||
|
||||
#define OPENSSL_VERSION_NUMBER 0x0913 /* Version 0.9.1c is 0913 */
|
||||
|
||||
/* Backward compatibility to SSLeay */
|
||||
/* This is more to be used to check the correct DLL is being used
|
||||
* in the MS world. */
|
||||
#define SSLEAY_VERSION_NUMBER 0x0911 /* Version 0.5.1c would be 0513 */
|
||||
|
||||
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
#define SSLEAY_VERSION 0
|
||||
/* #define SSLEAY_OPTIONS 1 no longer supported */
|
||||
#define SSLEAY_CFLAGS 2
|
||||
|
||||
@@ -66,7 +66,7 @@ char *SSLeay_version(t)
|
||||
int t;
|
||||
{
|
||||
if (t == SSLEAY_VERSION)
|
||||
return("SSLeay 0.9.1a 06-Jul-1998");
|
||||
return("OpenSSL 0.9.1c 23-Dec-1998");
|
||||
if (t == SSLEAY_BUILT_ON)
|
||||
{
|
||||
#ifdef DATE
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user