summaryrefslogtreecommitdiff
path: root/extra/yassl/taocrypt
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2006-09-25 16:40:29 +0200
committermsvensson@neptunus.(none) <>2006-09-25 16:40:29 +0200
commit64a64d0fbf29443cd0229bba0d7b2dfdf9624306 (patch)
tree1f8d7ab8dca1697f70a230f4fdcbd108cdf21ccf /extra/yassl/taocrypt
parentd8e27606e1716d674ce03588cb8e763fbc260b62 (diff)
downloadmariadb-git-64a64d0fbf29443cd0229bba0d7b2dfdf9624306.tar.gz
Import yaSSL version 1.4.0
Diffstat (limited to 'extra/yassl/taocrypt')
-rw-r--r--extra/yassl/taocrypt/COPYING340
-rw-r--r--extra/yassl/taocrypt/INSTALL229
-rw-r--r--extra/yassl/taocrypt/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/README37
-rw-r--r--extra/yassl/taocrypt/benchmark/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/include/asn.hpp6
-rw-r--r--extra/yassl/taocrypt/include/block.hpp12
-rw-r--r--extra/yassl/taocrypt/include/blowfish.hpp6
-rw-r--r--extra/yassl/taocrypt/include/error.hpp4
-rw-r--r--extra/yassl/taocrypt/include/file.hpp2
-rw-r--r--extra/yassl/taocrypt/include/integer.hpp2
-rw-r--r--extra/yassl/taocrypt/include/misc.hpp17
-rw-r--r--extra/yassl/taocrypt/include/pwdbased.hpp2
-rw-r--r--extra/yassl/taocrypt/include/twofish.hpp6
-rw-r--r--extra/yassl/taocrypt/mySTL/algorithm.hpp115
-rw-r--r--extra/yassl/taocrypt/mySTL/helpers.hpp160
-rw-r--r--extra/yassl/taocrypt/mySTL/list.hpp374
-rw-r--r--extra/yassl/taocrypt/mySTL/memory.hpp143
-rw-r--r--extra/yassl/taocrypt/mySTL/memory_array.hpp142
-rw-r--r--extra/yassl/taocrypt/mySTL/pair.hpp65
-rw-r--r--extra/yassl/taocrypt/mySTL/stdexcept.hpp84
-rw-r--r--extra/yassl/taocrypt/mySTL/vector.hpp161
-rw-r--r--extra/yassl/taocrypt/src/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp15
-rw-r--r--extra/yassl/taocrypt/src/asn.cpp9
-rw-r--r--extra/yassl/taocrypt/src/blowfish.cpp2
-rw-r--r--extra/yassl/taocrypt/src/des.cpp9
-rw-r--r--extra/yassl/taocrypt/src/dh.cpp2
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp12
-rw-r--r--extra/yassl/taocrypt/src/md4.cpp10
-rw-r--r--extra/yassl/taocrypt/src/md5.cpp11
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp10
-rw-r--r--extra/yassl/taocrypt/src/random.cpp68
-rw-r--r--extra/yassl/taocrypt/src/ripemd.cpp10
-rw-r--r--extra/yassl/taocrypt/src/sha.cpp11
-rw-r--r--extra/yassl/taocrypt/src/template_instnt.cpp7
-rw-r--r--extra/yassl/taocrypt/test/Makefile.am2
37 files changed, 2025 insertions, 66 deletions
diff --git a/extra/yassl/taocrypt/COPYING b/extra/yassl/taocrypt/COPYING
new file mode 100644
index 00000000000..d60c31a97a5
--- /dev/null
+++ b/extra/yassl/taocrypt/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/extra/yassl/taocrypt/INSTALL b/extra/yassl/taocrypt/INSTALL
new file mode 100644
index 00000000000..54caf7c190f
--- /dev/null
+++ b/extra/yassl/taocrypt/INSTALL
@@ -0,0 +1,229 @@
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am
index e232b499cc7..f1340b38437 100644
--- a/extra/yassl/taocrypt/Makefile.am
+++ b/extra/yassl/taocrypt/Makefile.am
@@ -1,2 +1,2 @@
SUBDIRS = src test benchmark
-EXTRA_DIST = taocrypt.dsw taocrypt.dsp CMakeLists.txt
+EXTRA_DIST = taocrypt.dsw taocrypt.dsp CMakeLists.txt $(wildcard mySTL/*.hpp)
diff --git a/extra/yassl/taocrypt/README b/extra/yassl/taocrypt/README
new file mode 100644
index 00000000000..34e1744492e
--- /dev/null
+++ b/extra/yassl/taocrypt/README
@@ -0,0 +1,37 @@
+TaoCrypt release 0.9.0 09/18/2006
+
+This is the first release of TaoCrypt, it was previously only included with
+yaSSL. TaoCrypt is highly portable and fast, its features include:
+
+One way hash functions: SHA-1, MD2, MD4, MD5, RIPEMD-160
+Message authentication codes: HMAC
+Block Ciphers: DES, Triple-DES, AES, Blowfish, Twofish
+Stream Ciphers: ARC4
+Public Key Crypto: RSA, DSA, Diffie-Hellman
+Password based key derivation: PBKDF2 from PKCS #5
+Pseudo Random Number Generators
+Lare Integer Support
+Base 16/64 encoding/decoding
+DER encoding/decoding
+X.509 processing
+SSE2 and ia32 asm for the right processors and compilers
+
+
+To build on Unix
+
+ ./configure
+ make
+
+ To test the build, from the ./test directory run ./test
+
+
+On Windows
+
+ Open the taocrypt project workspace
+ Choose (Re)Build All
+
+ To test the build, run the test executable
+
+
+Please send any questions or comments to todd@yassl.com.
+
diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am
index 81200ff7e6a..3bdbaa8f0dc 100644
--- a/extra/yassl/taocrypt/benchmark/Makefile.am
+++ b/extra/yassl/taocrypt/benchmark/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I../include -I../../mySTL
+INCLUDES = -I../include -I../mySTL
bin_PROGRAMS = benchmark
benchmark_SOURCES = benchmark.cpp
benchmark_LDFLAGS = -L../src
diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp
index 8bea2ae780b..dbee54be6f1 100644
--- a/extra/yassl/taocrypt/include/asn.hpp
+++ b/extra/yassl/taocrypt/include/asn.hpp
@@ -33,10 +33,12 @@
#include "misc.hpp"
#include "block.hpp"
-#include "list.hpp"
#include "error.hpp"
+#include STL_LIST_FILE
+namespace STL = STL_NAMESPACE;
+
namespace TaoCrypt {
@@ -232,7 +234,7 @@ private:
};
-typedef mySTL::list<Signer*> SignerList;
+typedef STL::list<Signer*> SignerList;
enum SigType { SHAwDSA = 517, MD2wRSA = 646, MD5wRSA = 648, SHAwRSA =649};
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp
index 88cb06f62f1..a931158a83d 100644
--- a/extra/yassl/taocrypt/include/block.hpp
+++ b/extra/yassl/taocrypt/include/block.hpp
@@ -31,12 +31,14 @@
#ifndef TAO_CRYPT_BLOCK_HPP
#define TAO_CRYPT_BLOCK_HPP
-#include "algorithm.hpp" // mySTL::swap
#include "misc.hpp"
#include <string.h> // memcpy
#include <stddef.h> // ptrdiff_t
+#include STL_ALGORITHM_FILE
+namespace STL = STL_NAMESPACE;
+
namespace TaoCrypt {
@@ -80,7 +82,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize,
typename A::pointer newPointer = b.allocate(newSize, 0);
memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize));
a.deallocate(p, oldSize);
- mySTL::swap(a, b);
+ STL::swap(a, b);
return newPointer;
}
else {
@@ -183,9 +185,9 @@ public:
}
void Swap(Block& other) {
- mySTL::swap(sz_, other.sz_);
- mySTL::swap(buffer_, other.buffer_);
- mySTL::swap(allocator_, other.allocator_);
+ STL::swap(sz_, other.sz_);
+ STL::swap(buffer_, other.buffer_);
+ STL::swap(allocator_, other.allocator_);
}
~Block() { allocator_.deallocate(buffer_, sz_); }
diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp
index fbc4f223702..40953624232 100644
--- a/extra/yassl/taocrypt/include/blowfish.hpp
+++ b/extra/yassl/taocrypt/include/blowfish.hpp
@@ -32,7 +32,11 @@
#include "misc.hpp"
#include "modes.hpp"
-#include "algorithm.hpp"
+#include STL_ALGORITHM_FILE
+
+
+namespace STL = STL_NAMESPACE;
+
namespace TaoCrypt {
diff --git a/extra/yassl/taocrypt/include/error.hpp b/extra/yassl/taocrypt/include/error.hpp
index b0ff9b280ba..1a93056db45 100644
--- a/extra/yassl/taocrypt/include/error.hpp
+++ b/extra/yassl/taocrypt/include/error.hpp
@@ -37,7 +37,7 @@ namespace TaoCrypt {
enum ErrorNumber {
-NO_ERROR = 0, // "not in error state"
+NO_ERROR_E = 0, // "not in error state"
// RandomNumberGenerator
WINCRYPT_E = 1001, // "bad wincrypt acquire"
@@ -78,7 +78,7 @@ SIG_OTHER_E = 1039 // "bad other signature confirmation"
struct Error {
ErrorNumber what_; // description number, 0 for no error
- explicit Error(ErrorNumber w = NO_ERROR) : what_(w) {}
+ explicit Error(ErrorNumber w = NO_ERROR_E) : what_(w) {}
ErrorNumber What() const { return what_; }
void SetError(ErrorNumber w) { what_ = w; }
diff --git a/extra/yassl/taocrypt/include/file.hpp b/extra/yassl/taocrypt/include/file.hpp
index 87fc6139f8f..c12b5c73bac 100644
--- a/extra/yassl/taocrypt/include/file.hpp
+++ b/extra/yassl/taocrypt/include/file.hpp
@@ -83,7 +83,7 @@ private:
void Swap(Source& other)
{
buffer_.Swap(other.buffer_);
- mySTL::swap(current_, other.current_);
+ STL::swap(current_, other.current_);
}
};
diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp
index 7e4f6450316..70b4dc79e73 100644
--- a/extra/yassl/taocrypt/include/integer.hpp
+++ b/extra/yassl/taocrypt/include/integer.hpp
@@ -44,8 +44,8 @@
#include "block.hpp"
#include "random.hpp"
#include "file.hpp"
-#include "algorithm.hpp" // mySTL::swap
#include <string.h>
+#include STL_ALGORITHM_FILE
#ifdef TAOCRYPT_X86ASM_AVAILABLE
diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp
index 48604620706..3d2d4c62466 100644
--- a/extra/yassl/taocrypt/include/misc.hpp
+++ b/extra/yassl/taocrypt/include/misc.hpp
@@ -198,6 +198,23 @@ void CleanUp();
#endif
+#ifdef USE_SYS_STL
+ // use system STL
+ #define STL_VECTOR_FILE <vector>
+ #define STL_LIST_FILE <list>
+ #define STL_ALGORITHM_FILE <algorithm>
+ #define STL_MEMORY_FILE <memory>
+ #define STL_NAMESPACE std
+#else
+ // use mySTL
+ #define STL_VECTOR_FILE "vector.hpp"
+ #define STL_LIST_FILE "list.hpp"
+ #define STL_ALGORITHM_FILE "algorithm.hpp"
+ #define STL_MEMORY_FILE "memory.hpp"
+ #define STL_NAMESPACE mySTL
+#endif
+
+
// ***************** DLL related ********************
#ifdef TAOCRYPT_WIN32_AVAILABLE
diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp
index c3e916e3d83..78df7ede02e 100644
--- a/extra/yassl/taocrypt/include/pwdbased.hpp
+++ b/extra/yassl/taocrypt/include/pwdbased.hpp
@@ -74,7 +74,7 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd,
}
hmac.Final(buffer.get_buffer());
- word32 segmentLen = mySTL::min(dLen, buffer.size());
+ word32 segmentLen = min(dLen, buffer.size());
memcpy(derived, buffer.get_buffer(), segmentLen);
for (j = 1; j < iterations; j++) {
diff --git a/extra/yassl/taocrypt/include/twofish.hpp b/extra/yassl/taocrypt/include/twofish.hpp
index 0529c37d6c5..ba144d2defb 100644
--- a/extra/yassl/taocrypt/include/twofish.hpp
+++ b/extra/yassl/taocrypt/include/twofish.hpp
@@ -32,7 +32,11 @@
#include "misc.hpp"
#include "modes.hpp"
-#include "algorithm.hpp"
+#include STL_ALGORITHM_FILE
+
+
+namespace STL = STL_NAMESPACE;
+
namespace TaoCrypt {
diff --git a/extra/yassl/taocrypt/mySTL/algorithm.hpp b/extra/yassl/taocrypt/mySTL/algorithm.hpp
new file mode 100644
index 00000000000..9a51d1f2281
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/algorithm.hpp
@@ -0,0 +1,115 @@
+/* mySTL algorithm.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL algorithm implements max, min, for_each, swap, find_if, copy,
+ * copy_backward, fill
+ */
+
+#ifndef mySTL_ALGORITHM_HPP
+#define mySTL_ALGORITHM_HPP
+
+
+namespace mySTL {
+
+
+template<typename T>
+inline const T& max(const T& a, const T&b)
+{
+ return a < b ? b : a;
+}
+
+
+template<typename T>
+inline const T& min(const T& a, const T&b)
+{
+ return b < a ? b : a;
+}
+
+
+template<typename InIter, typename Func>
+Func for_each(InIter first, InIter last, Func op)
+{
+ while (first != last) {
+ op(*first);
+ ++first;
+ }
+ return op;
+}
+
+
+template<typename T>
+inline void swap(T& a, T& b)
+{
+ T tmp = a;
+ a = b;
+ b = tmp;
+}
+
+
+template<typename InIter, typename Pred>
+InIter find_if(InIter first, InIter last, Pred pred)
+{
+ while (first != last && !pred(*first))
+ ++first;
+ return first;
+}
+
+
+template<typename InputIter, typename OutputIter>
+inline OutputIter copy(InputIter first, InputIter last, OutputIter place)
+{
+ while (first != last) {
+ *place = *first;
+ ++first;
+ ++place;
+ }
+ return place;
+}
+
+
+template<typename InputIter, typename OutputIter>
+inline OutputIter
+copy_backward(InputIter first, InputIter last, OutputIter place)
+{
+ while (first != last)
+ *--place = *--last;
+ return place;
+}
+
+
+template<typename InputIter, typename T>
+void fill(InputIter first, InputIter last, const T& v)
+{
+ while (first != last) {
+ *first = v;
+ ++first;
+ }
+}
+
+
+} // namespace mySTL
+
+#endif // mySTL_ALGORITHM_HPP
diff --git a/extra/yassl/taocrypt/mySTL/helpers.hpp b/extra/yassl/taocrypt/mySTL/helpers.hpp
new file mode 100644
index 00000000000..3332ac97ace
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/helpers.hpp
@@ -0,0 +1,160 @@
+/* mySTL helpers.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL helpers implements misc constructs for vector and list
+ *
+ */
+
+#ifndef mySTL_HELPERS_HPP
+#define mySTL_HELPERS_HPP
+
+#include <stdlib.h>
+#ifdef _MSC_VER
+ #include <new>
+#endif
+
+/*
+ Workaround for the lack of operator new(size_t, void*)
+ in IBM VA C++ 6.0
+ Also used as a workaround to avoid including <new>
+*/
+ struct Dummy {};
+
+ inline void* operator new(size_t size, Dummy* d)
+ {
+ return static_cast<void*>(d);
+ }
+
+ // for compilers that want matching delete
+ inline void operator delete(void* ptr, Dummy* d)
+ {
+ }
+
+ typedef Dummy* yassl_pointer;
+
+namespace mySTL {
+
+
+template <typename T, typename T2>
+inline void construct(T* p, const T2& value)
+{
+ new (reinterpret_cast<yassl_pointer>(p)) T(value);
+}
+
+
+template <typename T>
+inline void construct(T* p)
+{
+ new (reinterpret_cast<yassl_pointer>(p)) T();
+}
+
+
+template <typename T>
+inline void destroy(T* p)
+{
+ p->~T();
+}
+
+
+template <typename Iter>
+void destroy(Iter first, Iter last)
+{
+ while (first != last) {
+ destroy(&*first);
+ ++first;
+ }
+}
+
+
+template <typename Iter, typename PlaceIter>
+PlaceIter uninit_copy(Iter first, Iter last, PlaceIter place)
+{
+ while (first != last) {
+ construct(&*place, *first);
+ ++first;
+ ++place;
+ }
+ return place;
+}
+
+
+template <typename PlaceIter, typename Size, typename T>
+PlaceIter uninit_fill_n(PlaceIter place, Size n, const T& value)
+{
+ while (n) {
+ construct(&*place, value);
+ --n;
+ ++place;
+ }
+ return place;
+}
+
+
+template <typename T>
+T* GetArrayMemory(size_t items)
+{
+ unsigned char* ret;
+
+ #ifdef YASSL_LIB
+ ret = NEW_YS unsigned char[sizeof(T) * items];
+ #else
+ ret = NEW_TC unsigned char[sizeof(T) * items];
+ #endif
+
+ return reinterpret_cast<T*>(ret);
+}
+
+
+template <typename T>
+void FreeArrayMemory(T* ptr)
+{
+ unsigned char* p = reinterpret_cast<unsigned char*>(ptr);
+
+ #ifdef YASSL_LIB
+ yaSSL::ysArrayDelete(p);
+ #else
+ TaoCrypt::tcArrayDelete(p);
+ #endif
+}
+
+
+
+static void* GetMemory(size_t bytes)
+{
+ return GetArrayMemory<unsigned char>(bytes);
+}
+
+
+static void FreeMemory(void* ptr)
+{
+ FreeArrayMemory(ptr);
+}
+
+
+
+} // namespace mySTL
+
+#endif // mySTL_HELPERS_HPP
diff --git a/extra/yassl/taocrypt/mySTL/list.hpp b/extra/yassl/taocrypt/mySTL/list.hpp
new file mode 100644
index 00000000000..831c5bbbbbd
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/list.hpp
@@ -0,0 +1,374 @@
+/* mySTL list.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL list implements a simple list
+ *
+ */
+
+#ifndef mySTL_LIST_HPP
+#define mySTL_LIST_HPP
+
+
+#include "helpers.hpp"
+
+
+namespace mySTL {
+
+
+
+template<typename T>
+class list {
+
+#ifdef __SUNPRO_CC
+/*
+ Sun Forte 7 C++ v. 5.4 needs class 'node' public to be visible to
+ the nested class 'iterator' (a non-standard behaviour).
+*/
+public:
+#endif
+
+ struct node {
+ node(T t) : prev_(0), next_(0), value_(t) {}
+
+ node* prev_;
+ node* next_;
+ T value_;
+ };
+public:
+ list() : head_(0), tail_(0), sz_(0) {}
+ ~list();
+
+ void push_front(T);
+ void pop_front();
+ T front() const;
+ void push_back(T);
+ void pop_back();
+ T back() const;
+ bool remove(T);
+ size_t size() const { return sz_; }
+ bool empty() const { return sz_ == 0; }
+
+ class iterator {
+ node* current_;
+ public:
+ explicit iterator(node* p = 0) : current_(p) {}
+
+ T& operator*() const
+ {
+ return current_->value_;
+ }
+
+ T* operator->() const
+ {
+ return &(operator*());
+ }
+
+ iterator& operator++()
+ {
+ current_ = current_->next_;
+ return *this;
+ }
+
+ iterator& operator--()
+ {
+ current_ = current_->prev_;
+ return *this;
+ }
+
+ iterator operator++(int)
+ {
+ iterator tmp = *this;
+ current_ = current_->next_;
+ return tmp;
+ }
+
+ iterator operator--(int)
+ {
+ iterator tmp = *this;
+ current_ = current_->prev_;
+ return tmp;
+ }
+
+ bool operator==(const iterator& other) const
+ {
+ return current_ == other.current_;
+ }
+
+ bool operator!=(const iterator& other) const
+ {
+ return current_ != other.current_;
+ }
+
+ friend class list<T>;
+ };
+
+
+ class reverse_iterator {
+ node* current_;
+ public:
+ explicit reverse_iterator(node* p = 0) : current_(p) {}
+
+ T& operator*() const
+ {
+ return current_->value_;
+ }
+
+ T* operator->() const
+ {
+ return &(operator*());
+ }
+
+ reverse_iterator& operator++()
+ {
+ current_ = current_->prev_;
+ return *this;
+ }
+
+ reverse_iterator& operator--()
+ {
+ current_ = current_->next_;
+ return *this;
+ }
+
+ reverse_iterator operator++(int)
+ {
+ reverse_iterator tmp = *this;
+ current_ = current_->prev_;
+ return tmp;
+ }
+
+ reverse_iterator operator--(int)
+ {
+ reverse_iterator tmp = *this;
+ current_ = current_->next_;
+ return tmp;
+ }
+
+ bool operator==(const reverse_iterator& other) const
+ {
+ return current_ == other.current_;
+ }
+
+ bool operator!=(const reverse_iterator& other) const
+ {
+ return current_ != other.current_;
+ }
+
+ friend class list<T>;
+ };
+
+ bool erase(iterator);
+
+ iterator begin() const { return iterator(head_); }
+ reverse_iterator rbegin() const { return reverse_iterator(tail_); }
+ iterator end() const { return iterator(); }
+ reverse_iterator rend() const { return reverse_iterator(); }
+
+ typedef iterator const_iterator; // for now
+
+ class underflow {};
+ class overflow {};
+private:
+ node* head_;
+ node* tail_;
+ size_t sz_;
+
+ node* look_up(T);
+
+ list(const list&); // hide copy
+ list& operator=(const list&); // and assign
+};
+
+
+template<typename T>
+list<T>::~list()
+{
+ node* start = head_;
+ node* next_;
+
+ for (; start; start = next_) {
+ next_ = start->next_;
+ destroy(start);
+ FreeMemory(start);
+ }
+}
+
+
+template<typename T>
+void list<T>::push_front(T t)
+{
+ void* mem = GetMemory(sizeof(node));
+ node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
+
+ if (head_) {
+ add->next_ = head_;
+ head_->prev_ = add;
+ }
+ else
+ tail_ = add;
+
+ head_ = add;
+ ++sz_;
+}
+
+
+template<typename T>
+void list<T>::pop_front()
+{
+ node* front = head_;
+
+ if (head_ == 0)
+ return;
+ else if (head_ == tail_)
+ head_ = tail_ = 0;
+ else {
+ head_ = head_->next_;
+ head_->prev_ = 0;
+ }
+ destroy(front);
+ FreeMemory(front);
+ --sz_;
+}
+
+
+template<typename T>
+T list<T>::front() const
+{
+ if (head_ == 0) return T();
+ return head_->value_;
+}
+
+
+template<typename T>
+void list<T>::push_back(T t)
+{
+ void* mem = GetMemory(sizeof(node));
+ node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
+
+ if (tail_) {
+ tail_->next_ = add;
+ add->prev_ = tail_;
+ }
+ else
+ head_ = add;
+
+ tail_ = add;
+ ++sz_;
+}
+
+
+template<typename T>
+void list<T>::pop_back()
+{
+ node* rear = tail_;
+
+ if (tail_ == 0)
+ return;
+ else if (tail_ == head_)
+ tail_ = head_ = 0;
+ else {
+ tail_ = tail_->prev_;
+ tail_->next_ = 0;
+ }
+ destroy(rear);
+ FreeMemory(rear);
+ --sz_;
+}
+
+
+template<typename T>
+T list<T>::back() const
+{
+ if (tail_ == 0) return T();
+ return tail_->value_;
+}
+
+
+template<typename T>
+typename list<T>::node* list<T>::look_up(T t)
+{
+ node* list = head_;
+
+ if (list == 0) return 0;
+
+ for (; list; list = list->next_)
+ if (list->value_ == t)
+ return list;
+
+ return 0;
+}
+
+
+template<typename T>
+bool list<T>::remove(T t)
+{
+ node* del = look_up(t);
+
+ if (del == 0)
+ return false;
+ else if (del == head_)
+ pop_front();
+ else if (del == tail_)
+ pop_back();
+ else {
+ del->prev_->next_ = del->next_;
+ del->next_->prev_ = del->prev_;
+
+ destroy(del);
+ FreeMemory(del);
+ --sz_;
+ }
+ return true;
+}
+
+
+template<typename T>
+bool list<T>::erase(iterator iter)
+{
+ node* del = iter.current_;
+
+ if (del == 0)
+ return false;
+ else if (del == head_)
+ pop_front();
+ else if (del == tail_)
+ pop_back();
+ else {
+ del->prev_->next_ = del->next_;
+ del->next_->prev_ = del->prev_;
+
+ destroy(del);
+ FreeMemory(del);
+ --sz_;
+ }
+ return true;
+}
+
+
+
+} // namespace mySTL
+
+#endif // mySTL_LIST_HPP
diff --git a/extra/yassl/taocrypt/mySTL/memory.hpp b/extra/yassl/taocrypt/mySTL/memory.hpp
new file mode 100644
index 00000000000..5855423c6fc
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/memory.hpp
@@ -0,0 +1,143 @@
+/* mySTL memory.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL memory implements auto_ptr
+ *
+ */
+
+#ifndef mySTL_MEMORY_HPP
+#define mySTL_MEMORY_HPP
+
+#include "memory_array.hpp" // for auto_array
+
+#ifdef _MSC_VER
+ // disable operator-> warning for builtins
+ #pragma warning(disable:4284)
+#endif
+
+
+namespace mySTL {
+
+
+template<typename T>
+struct auto_ptr_ref {
+ T* ptr_;
+ explicit auto_ptr_ref(T* p) : ptr_(p) {}
+};
+
+
+template<typename T>
+class auto_ptr {
+ T* ptr_;
+
+ void Destroy()
+ {
+ #ifdef YASSL_LIB
+ yaSSL::ysDelete(ptr_);
+ #else
+ TaoCrypt::tcDelete(ptr_);
+ #endif
+ }
+public:
+ explicit auto_ptr(T* p = 0) : ptr_(p) {}
+
+ ~auto_ptr()
+ {
+ Destroy();
+ }
+
+
+ auto_ptr(auto_ptr& other) : ptr_(other.release()) {}
+
+ auto_ptr& operator=(auto_ptr& that)
+ {
+ if (this != &that) {
+ Destroy();
+ ptr_ = that.release();
+ }
+ return *this;
+ }
+
+
+ T* operator->() const
+ {
+ return ptr_;
+ }
+
+ T& operator*() const
+ {
+ return *ptr_;
+ }
+
+ T* get() const
+ {
+ return ptr_;
+ }
+
+ T* release()
+ {
+ T* tmp = ptr_;
+ ptr_ = 0;
+ return tmp;
+ }
+
+ void reset(T* p = 0)
+ {
+ if (ptr_ != p) {
+ Destroy();
+ ptr_ = p;
+ }
+ }
+
+ // auto_ptr_ref conversions
+ auto_ptr(auto_ptr_ref<T> ref) : ptr_(ref.ptr_) {}
+
+ auto_ptr& operator=(auto_ptr_ref<T> ref)
+ {
+ if (this->ptr_ != ref.ptr_) {
+ Destroy();
+ ptr_ = ref.ptr_;
+ }
+ return *this;
+ }
+
+ template<typename T2>
+ operator auto_ptr<T2>()
+ {
+ return auto_ptr<T2>(this->release());
+ }
+
+ template<typename T2>
+ operator auto_ptr_ref<T2>()
+ {
+ return auto_ptr_ref<T2>(this->release());
+ }
+};
+
+
+} // namespace mySTL
+
+#endif // mySTL_MEMORY_HPP
diff --git a/extra/yassl/taocrypt/mySTL/memory_array.hpp b/extra/yassl/taocrypt/mySTL/memory_array.hpp
new file mode 100644
index 00000000000..f089c69f815
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/memory_array.hpp
@@ -0,0 +1,142 @@
+/* mySTL memory_array.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL memory_arry implements auto_array
+ *
+ */
+
+#ifndef mySTL_MEMORY_ARRAY_HPP
+#define mySTL_MEMORY_ARRAY_HPP
+
+
+#ifdef _MSC_VER
+ // disable operator-> warning for builtins
+ #pragma warning(disable:4284)
+#endif
+
+
+namespace mySTL {
+
+
+template<typename T>
+struct auto_array_ref {
+ T* ptr_;
+ explicit auto_array_ref(T* p) : ptr_(p) {}
+};
+
+
+template<typename T>
+class auto_array {
+ T* ptr_;
+
+ void Destroy()
+ {
+ #ifdef YASSL_LIB
+ yaSSL::ysArrayDelete(ptr_);
+ #else
+ TaoCrypt::tcArrayDelete(ptr_);
+ #endif
+ }
+public:
+ explicit auto_array(T* p = 0) : ptr_(p) {}
+
+ ~auto_array()
+ {
+ Destroy();
+ }
+
+
+ auto_array(auto_array& other) : ptr_(other.release()) {}
+
+ auto_array& operator=(auto_array& that)
+ {
+ if (this != &that) {
+ Destroy();
+ ptr_ = that.release();
+ }
+ return *this;
+ }
+
+
+ T* operator->() const
+ {
+ return ptr_;
+ }
+
+ T& operator*() const
+ {
+ return *ptr_;
+ }
+
+ T* get() const
+ {
+ return ptr_;
+ }
+
+ T* release()
+ {
+ T* tmp = ptr_;
+ ptr_ = 0;
+ return tmp;
+ }
+
+ void reset(T* p = 0)
+ {
+ if (ptr_ != p) {
+ Destroy();
+ ptr_ = p;
+ }
+ }
+
+ // auto_array_ref conversions
+ auto_array(auto_array_ref<T> ref) : ptr_(ref.ptr_) {}
+
+ auto_array& operator=(auto_array_ref<T> ref)
+ {
+ if (this->ptr_ != ref.ptr_) {
+ Destroy();
+ ptr_ = ref.ptr_;
+ }
+ return *this;
+ }
+
+ template<typename T2>
+ operator auto_array<T2>()
+ {
+ return auto_array<T2>(this->release());
+ }
+
+ template<typename T2>
+ operator auto_array_ref<T2>()
+ {
+ return auto_array_ref<T2>(this->release());
+ }
+};
+
+
+} // namespace mySTL
+
+#endif // mySTL_MEMORY_ARRAY_HPP
diff --git a/extra/yassl/taocrypt/mySTL/pair.hpp b/extra/yassl/taocrypt/mySTL/pair.hpp
new file mode 100644
index 00000000000..13916fece13
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/pair.hpp
@@ -0,0 +1,65 @@
+/* mySTL pair.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL pair implements pair
+ *
+ */
+
+#ifndef mySTL_PAIR_HPP
+#define mySTL_PAIR_HPP
+
+
+
+namespace mySTL {
+
+
+template<typename T1, typename T2>
+struct pair {
+ typedef T1 first_type;
+ typedef T2 second_type;
+
+ first_type first;
+ second_type second;
+
+ pair() {}
+ pair(const T1& t1, const T2& t2) : first(t1), second(t2) {}
+
+ template<typename U1, typename U2>
+ pair(const pair<U1, U2>& p) : first(p.first), second(p.second) {}
+};
+
+
+template<typename T1, typename T2>
+inline pair<T1, T2> make_pair(const T1& a, const T2& b)
+{
+ return pair<T1, T2>(a, b);
+}
+
+
+
+} // namespace mySTL
+
+#endif // mySTL_PAIR_HPP
diff --git a/extra/yassl/taocrypt/mySTL/stdexcept.hpp b/extra/yassl/taocrypt/mySTL/stdexcept.hpp
new file mode 100644
index 00000000000..4fd343ae6fd
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/stdexcept.hpp
@@ -0,0 +1,84 @@
+/* mySTL stdexcept.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL memory implements exception, runtime_error
+ *
+ */
+
+#ifndef mySTL_STDEXCEPT_HPP
+#define mySTL_STDEXCEPT_HPP
+
+
+#include <string.h> // strncpy
+#include <assert.h> // assert
+#include <stdlib.h> // size_t
+
+
+namespace mySTL {
+
+
+class exception {
+public:
+ exception() {}
+ virtual ~exception() {} // to shut up compiler warnings
+
+ virtual const char* what() const { return ""; }
+
+ // for compiler generated call, never used
+ static void operator delete(void*) { assert(0); }
+private:
+ // don't allow dynamic creation of exceptions
+ static void* operator new(size_t);
+};
+
+
+class named_exception : public exception {
+public:
+ enum { NAME_SIZE = 80 };
+
+ explicit named_exception(const char* str)
+ {
+ strncpy(name_, str, NAME_SIZE);
+ name_[NAME_SIZE - 1] = 0;
+ }
+
+ virtual const char* what() const { return name_; }
+private:
+ char name_[NAME_SIZE];
+};
+
+
+class runtime_error : public named_exception {
+public:
+ explicit runtime_error(const char* str) : named_exception(str) {}
+};
+
+
+
+
+} // namespace mySTL
+
+#endif // mySTL_STDEXCEPT_HPP
diff --git a/extra/yassl/taocrypt/mySTL/vector.hpp b/extra/yassl/taocrypt/mySTL/vector.hpp
new file mode 100644
index 00000000000..902e014f75b
--- /dev/null
+++ b/extra/yassl/taocrypt/mySTL/vector.hpp
@@ -0,0 +1,161 @@
+/* mySTL vector.hpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+/* mySTL vector implements simple vector, w/ swap
+ *
+ */
+
+#ifndef mySTL_VECTOR_HPP
+#define mySTL_VECTOR_HPP
+
+#include "helpers.hpp" // construct, destory, fill, etc.
+#include "algorithm.hpp" // swap
+#include <assert.h> // assert
+
+
+namespace mySTL {
+
+
+template <typename T>
+struct vector_base {
+ T* start_;
+ T* finish_;
+ T* end_of_storage_;
+
+ vector_base() : start_(0), finish_(0), end_of_storage_(0) {}
+ vector_base(size_t n)
+ {
+ start_ = GetArrayMemory<T>(n);
+ finish_ = start_;
+ end_of_storage_ = start_ + n;
+ }
+
+ ~vector_base()
+ {
+ FreeArrayMemory(start_);
+ }
+
+ void Swap(vector_base& that)
+ {
+ swap(start_, that.start_);
+ swap(finish_, that.finish_);
+ swap(end_of_storage_, that.end_of_storage_);
+ }
+};
+
+
+
+template <typename T>
+class vector {
+public:
+ typedef T* iterator;
+ typedef const T* const_iterator;
+
+ vector() {}
+ explicit vector(size_t n) : vec_(n)
+ {
+ vec_.finish_ = uninit_fill_n(vec_.start_, n, T());
+ }
+
+ ~vector() { destroy(vec_.start_, vec_.finish_); }
+
+ vector(const vector& other) : vec_(other.size())
+ {
+ vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
+ vec_.start_);
+ }
+
+ size_t capacity() const { return vec_.end_of_storage_ - vec_.start_; }
+
+ size_t size() const { return vec_.finish_ - vec_.start_; }
+
+ T& operator[](size_t idx) { return *(vec_.start_ + idx); }
+ const T& operator[](size_t idx) const { return *(vec_.start_ + idx); }
+
+ const T* begin() const { return vec_.start_; }
+ const T* end() const { return vec_.finish_; }
+
+ void push_back(const T& v)
+ {
+ if (vec_.finish_ != vec_.end_of_storage_) {
+ construct(vec_.finish_, v);
+ ++vec_.finish_;
+ }
+ else {
+ vector tmp(size() * 2 + 1, *this);
+ construct(tmp.vec_.finish_, v);
+ ++tmp.vec_.finish_;
+ Swap(tmp);
+ }
+ }
+
+ void resize(size_t n, const T& v)
+ {
+ if (n == size()) return;
+
+ if (n < size()) {
+ T* first = vec_.start_ + n;
+ destroy(first, vec_.finish_);
+ vec_.finish_ -= vec_.finish_ - first;
+ }
+ else {
+ vector tmp(n, *this);
+ tmp.vec_.finish_ = uninit_fill_n(tmp.vec_.finish_, n - size(), v);
+ Swap(tmp);
+ }
+ }
+
+ void reserve(size_t n)
+ {
+ if (capacity() < n) {
+ vector tmp(n, *this);
+ Swap(tmp);
+ }
+ }
+
+ void Swap(vector& that)
+ {
+ vec_.Swap(that.vec_);
+ }
+private:
+ vector_base<T> vec_;
+
+ vector& operator=(const vector&); // hide assign
+
+ // for growing, n must be bigger than other size
+ vector(size_t n, const vector& other) : vec_(n)
+ {
+ assert(n > other.size());
+ vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
+ vec_.start_);
+ }
+};
+
+
+
+} // namespace mySTL
+
+#endif // mySTL_VECTOR_HPP
diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am
index 1110ed335b8..ff96f3206f9 100644
--- a/extra/yassl/taocrypt/src/Makefile.am
+++ b/extra/yassl/taocrypt/src/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I../include -I../../mySTL
+INCLUDES = -I../include -I../mySTL
noinst_LTLIBRARIES = libtaocrypt.la
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index e9bc3fceac0..375cd6cd524 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -29,7 +29,10 @@
#include "runtime.hpp"
#include "algebra.hpp"
-#include "vector.hpp" // mySTL::vector (simple)
+#include STL_VECTOR_FILE
+
+
+namespace STL = STL_NAMESPACE;
namespace TaoCrypt {
@@ -82,7 +85,7 @@ const Integer& AbstractEuclideanDomain::Mod(const Element &a,
const Integer& AbstractEuclideanDomain::Gcd(const Element &a,
const Element &b) const
{
- mySTL::vector<Element> g(3);
+ STL::vector<Element> g(3);
g[0]= b;
g[1]= a;
unsigned int i0=0, i1=1, i2=2;
@@ -115,7 +118,7 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
const unsigned w = (expLen <= 46 ? 1 : (expLen <= 260 ? 2 : 3));
const unsigned tableSize = 1<<w;
- mySTL::vector<Element> powerTable(tableSize << w);
+ STL::vector<Element> powerTable(tableSize << w);
powerTable[1] = x;
powerTable[tableSize] = y;
@@ -240,8 +243,8 @@ struct WindowSlider
void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
const Integer *expBegin, unsigned int expCount) const
{
- mySTL::vector<mySTL::vector<Element> > buckets(expCount);
- mySTL::vector<WindowSlider> exponents;
+ STL::vector<STL::vector<Element> > buckets(expCount);
+ STL::vector<WindowSlider> exponents;
exponents.reserve(expCount);
unsigned int i;
@@ -332,6 +335,8 @@ void AbstractRing::SimultaneousExponentiate(Integer *results,
namespace mySTL {
template TaoCrypt::WindowSlider* uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
template void destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
+template TaoCrypt::WindowSlider* GetArrayMemory<TaoCrypt::WindowSlider>(size_t);
+template void FreeArrayMemory<TaoCrypt::WindowSlider>(TaoCrypt::WindowSlider*);
}
#endif
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp
index 45fb1e60a0c..3dc3638d85f 100644
--- a/extra/yassl/taocrypt/src/asn.cpp
+++ b/extra/yassl/taocrypt/src/asn.cpp
@@ -38,7 +38,8 @@
#include "sha.hpp"
#include "coding.hpp"
#include <time.h> // gmtime();
-#include "memory.hpp" // mySTL::auto_ptr
+#include "memory.hpp" // some auto_ptr don't have reset, also need auto_array
+
namespace TaoCrypt {
@@ -202,13 +203,13 @@ void PublicKey::SetKey(const byte* k)
void PublicKey::AddToEnd(const byte* data, word32 len)
{
- mySTL::auto_ptr<byte> tmp(NEW_TC byte[sz_ + len], tcArrayDelete);
+ mySTL::auto_array<byte> tmp(NEW_TC byte[sz_ + len]);
memcpy(tmp.get(), key_, sz_);
memcpy(tmp.get() + sz_, data, len);
byte* del = 0;
- mySTL::swap(del, key_);
+ STL::swap(del, key_);
tcArrayDelete(del);
key_ = tmp.release();
@@ -856,7 +857,7 @@ bool CertDecoder::ValidateSignature(SignerList* signers)
bool CertDecoder::ConfirmSignature(Source& pub)
{
HashType ht;
- mySTL::auto_ptr<HASH> hasher(tcDelete);
+ mySTL::auto_ptr<HASH> hasher;
if (signatureOID_ == MD5wRSA) {
hasher.reset(NEW_TC MD5);
diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp
index cc929cd7d41..40ae1a17e6c 100644
--- a/extra/yassl/taocrypt/src/blowfish.cpp
+++ b/extra/yassl/taocrypt/src/blowfish.cpp
@@ -133,7 +133,7 @@ void Blowfish::SetKey(const byte* key_string, word32 keylength, CipherDir dir)
if (dir==DECRYPTION)
for (i=0; i<(ROUNDS+2)/2; i++)
- mySTL::swap(pbox_[i], pbox_[ROUNDS+1-i]);
+ STL::swap(pbox_[i], pbox_[ROUNDS+1-i]);
}
diff --git a/extra/yassl/taocrypt/src/des.cpp b/extra/yassl/taocrypt/src/des.cpp
index 054c8c2eb78..2628e142bae 100644
--- a/extra/yassl/taocrypt/src/des.cpp
+++ b/extra/yassl/taocrypt/src/des.cpp
@@ -34,7 +34,10 @@
#include "runtime.hpp"
#include "des.hpp"
-#include "algorithm.hpp" // mySTL::swap
+#include STL_ALGORITHM_FILE
+
+
+namespace STL = STL_NAMESPACE;
#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
@@ -265,8 +268,8 @@ void BasicDES::SetKey(const byte* key, word32 /*length*/, CipherDir dir)
// reverse key schedule order
if (dir == DECRYPTION)
for (i = 0; i < 16; i += 2) {
- mySTL::swap(k_[i], k_[32 - 2 - i]);
- mySTL::swap(k_[i+1], k_[32 - 1 - i]);
+ STL::swap(k_[i], k_[32 - 2 - i]);
+ STL::swap(k_[i+1], k_[32 - 1 - i]);
}
}
diff --git a/extra/yassl/taocrypt/src/dh.cpp b/extra/yassl/taocrypt/src/dh.cpp
index aec7122b70b..671a20d0d78 100644
--- a/extra/yassl/taocrypt/src/dh.cpp
+++ b/extra/yassl/taocrypt/src/dh.cpp
@@ -61,7 +61,7 @@ void DH::GenerateKeyPair(RandomNumberGenerator& rng, byte* priv, byte* pub)
// Generate private value
void DH::GeneratePrivate(RandomNumberGenerator& rng, byte* priv)
{
- Integer x(rng, Integer::One(), mySTL::min(p_ - 1,
+ Integer x(rng, Integer::One(), min(p_ - 1,
Integer::Power2(2*DiscreteLogWorkFactor(p_.BitCount())) ) );
x.Encode(priv, p_.ByteCount());
}
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index 823c0c5e193..500160cfe37 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -1094,7 +1094,7 @@ static bool IsP4()
word32 cpuid[4];
CpuId(0, cpuid);
- mySTL::swap(cpuid[2], cpuid[3]);
+ STL::swap(cpuid[2], cpuid[3]);
if (memcmp(cpuid+1, "GenuineIntel", 12) != 0)
return false;
@@ -2384,8 +2384,8 @@ void AsymmetricMultiply(word *R, word *T, const word *A, unsigned int NA,
if (NA > NB)
{
- mySTL::swap(A, B);
- mySTL::swap(NA, NB);
+ STL::swap(A, B);
+ STL::swap(NA, NB);
}
assert(NB % NA == 0);
@@ -2521,8 +2521,8 @@ unsigned int AlmostInverse(word *R, word *T, const word *A, unsigned int NA,
if (Compare(f, g, fgLen)==-1)
{
- mySTL::swap(f, g);
- mySTL::swap(b, c);
+ STL::swap(f, g);
+ STL::swap(b, c);
s++;
}
@@ -3162,7 +3162,7 @@ signed long Integer::ConvertToLong() const
void Integer::Swap(Integer& a)
{
reg_.Swap(a.reg_);
- mySTL::swap(sign_, a.sign_);
+ STL::swap(sign_, a.sign_);
}
diff --git a/extra/yassl/taocrypt/src/md4.cpp b/extra/yassl/taocrypt/src/md4.cpp
index 6012330cba3..0dee8bf40cb 100644
--- a/extra/yassl/taocrypt/src/md4.cpp
+++ b/extra/yassl/taocrypt/src/md4.cpp
@@ -28,9 +28,11 @@
#include "runtime.hpp"
#include "md4.hpp"
-#include "algorithm.hpp" // mySTL::swap
+#include STL_ALGORITHM_FILE
+namespace STL = STL_NAMESPACE;
+
namespace TaoCrypt {
@@ -69,9 +71,9 @@ MD4& MD4::operator= (const MD4& that)
void MD4::Swap(MD4& other)
{
- mySTL::swap(loLen_, other.loLen_);
- mySTL::swap(hiLen_, other.hiLen_);
- mySTL::swap(buffLen_, other.buffLen_);
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
diff --git a/extra/yassl/taocrypt/src/md5.cpp b/extra/yassl/taocrypt/src/md5.cpp
index f7b0b1ee2dc..2bddc7fe308 100644
--- a/extra/yassl/taocrypt/src/md5.cpp
+++ b/extra/yassl/taocrypt/src/md5.cpp
@@ -28,7 +28,10 @@
#include "runtime.hpp"
#include "md5.hpp"
-#include "algorithm.hpp" // mySTL::swap
+#include STL_ALGORITHM_FILE
+
+
+namespace STL = STL_NAMESPACE;
#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
@@ -72,9 +75,9 @@ MD5& MD5::operator= (const MD5& that)
void MD5::Swap(MD5& other)
{
- mySTL::swap(loLen_, other.loLen_);
- mySTL::swap(hiLen_, other.hiLen_);
- mySTL::swap(buffLen_, other.buffLen_);
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp
index a33ca4fa432..c66377b917d 100644
--- a/extra/yassl/taocrypt/src/misc.cpp
+++ b/extra/yassl/taocrypt/src/misc.cpp
@@ -29,16 +29,6 @@
#include "runtime.hpp"
#include "misc.hpp"
-#if !defined(YASSL_MYSQL_COMPATIBLE)
-extern "C" {
-
- // for libcurl configure test, these are the signatures they use
- // locking handled internally by library
- char CRYPTO_lock() { return 0;}
- char CRYPTO_add_lock() { return 0;}
-} // extern "C"
-#endif
-
#ifdef YASSL_PURE_C
void* operator new(size_t sz, TaoCrypt::new_t)
diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp
index 2ee1e57a663..c7bb6ae9549 100644
--- a/extra/yassl/taocrypt/src/random.cpp
+++ b/extra/yassl/taocrypt/src/random.cpp
@@ -31,7 +31,7 @@
#include "runtime.hpp"
#include "random.hpp"
#include <string.h>
-
+#include <time.h>
#if defined(_WIN32)
#define _WIN32_WINNT 0x0400
@@ -74,6 +74,8 @@ byte RandomNumberGenerator::GenerateByte()
#if defined(_WIN32)
+/* The OS_Seed implementation for windows */
+
OS_Seed::OS_Seed()
{
if(!CryptAcquireContext(&handle_, 0, 0, PROV_RSA_FULL,
@@ -95,8 +97,70 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz)
}
-#else // _WIN32
+#elif defined(__NETWARE__)
+
+/* The OS_Seed implementation for Netware */
+
+#include <nks/thread.h>
+#include <nks/plat.h>
+
+// Loop on high resulution Read Time Stamp Counter
+static void NetwareSeed(byte* output, word32 sz)
+{
+ word32 tscResult;
+
+ for (word32 i = 0; i < sz; i += sizeof(tscResult)) {
+ #if defined(__GNUC__)
+ asm volatile("rdtsc" : "=A" (tscResult));
+ #else
+ #ifdef __MWERKS__
+ asm {
+ #else
+ __asm {
+ #endif
+ rdtsc
+ mov tscResult, eax
+ }
+ #endif
+
+ memcpy(output, &tscResult, sizeof(tscResult));
+ output += sizeof(tscResult);
+
+ NXThreadYield(); // induce more variance
+ }
+}
+
+
+OS_Seed::OS_Seed()
+{
+}
+
+
+OS_Seed::~OS_Seed()
+{
+}
+
+
+void OS_Seed::GenerateSeed(byte* output, word32 sz)
+{
+ /*
+ Try to use NXSeedRandom as it will generate a strong
+ seed using the onboard 82802 chip
+
+ As it's not always supported, fallback to default
+ implementation if an error is returned
+ */
+
+ if (NXSeedRandom(sz, output) != 0)
+ {
+ NetwareSeed(output, sz);
+ }
+}
+
+
+#else
+/* The default OS_Seed implementation */
OS_Seed::OS_Seed()
{
diff --git a/extra/yassl/taocrypt/src/ripemd.cpp b/extra/yassl/taocrypt/src/ripemd.cpp
index c791189544f..03c09edde84 100644
--- a/extra/yassl/taocrypt/src/ripemd.cpp
+++ b/extra/yassl/taocrypt/src/ripemd.cpp
@@ -28,9 +28,11 @@
#include "runtime.hpp"
#include "ripemd.hpp"
-#include "algorithm.hpp" // mySTL::swap
+#include STL_ALGORITHM_FILE
+namespace STL = STL_NAMESPACE;
+
#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
#define DO_RIPEMD_ASM
@@ -75,9 +77,9 @@ RIPEMD160& RIPEMD160::operator= (const RIPEMD160& that)
void RIPEMD160::Swap(RIPEMD160& other)
{
- mySTL::swap(loLen_, other.loLen_);
- mySTL::swap(hiLen_, other.hiLen_);
- mySTL::swap(buffLen_, other.buffLen_);
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
diff --git a/extra/yassl/taocrypt/src/sha.cpp b/extra/yassl/taocrypt/src/sha.cpp
index b877e2b7857..280d42fb3d4 100644
--- a/extra/yassl/taocrypt/src/sha.cpp
+++ b/extra/yassl/taocrypt/src/sha.cpp
@@ -27,8 +27,11 @@
#include "runtime.hpp"
#include <string.h>
-#include "algorithm.hpp" // mySTL::swap
#include "sha.hpp"
+#include STL_ALGORITHM_FILE
+
+
+namespace STL = STL_NAMESPACE;
#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
@@ -96,9 +99,9 @@ SHA& SHA::operator= (const SHA& that)
void SHA::Swap(SHA& other)
{
- mySTL::swap(loLen_, other.loLen_);
- mySTL::swap(hiLen_, other.hiLen_);
- mySTL::swap(buffLen_, other.buffLen_);
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
diff --git a/extra/yassl/taocrypt/src/template_instnt.cpp b/extra/yassl/taocrypt/src/template_instnt.cpp
index 512c5cf9dce..db1ae645e09 100644
--- a/extra/yassl/taocrypt/src/template_instnt.cpp
+++ b/extra/yassl/taocrypt/src/template_instnt.cpp
@@ -77,6 +77,13 @@ template void destroy<vector<TaoCrypt::Integer>*>(vector<TaoCrypt::Integer>*, ve
template TaoCrypt::Integer* uninit_copy<TaoCrypt::Integer*, TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*);
template TaoCrypt::Integer* uninit_fill_n<TaoCrypt::Integer*, size_t, TaoCrypt::Integer>(TaoCrypt::Integer*, size_t, TaoCrypt::Integer const&);
template void destroy<TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*);
+template TaoCrypt::byte* GetArrayMemory<TaoCrypt::byte>(size_t);
+template void FreeArrayMemory<TaoCrypt::byte>(TaoCrypt::byte*);
+template TaoCrypt::Integer* GetArrayMemory<TaoCrypt::Integer>(size_t);
+template void FreeArrayMemory<TaoCrypt::Integer>(TaoCrypt::Integer*);
+template vector<TaoCrypt::Integer>* GetArrayMemory<vector<TaoCrypt::Integer> >(size_t);
+template void FreeArrayMemory<vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*);
+template void FreeArrayMemory<void>(void*);
}
#endif
diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am
index 0b238f1e057..221b8bac5ad 100644
--- a/extra/yassl/taocrypt/test/Makefile.am
+++ b/extra/yassl/taocrypt/test/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I../include -I../../mySTL
+INCLUDES = -I../include -I../mySTL
bin_PROGRAMS = test
test_SOURCES = test.cpp
test_LDFLAGS = -L../src