aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Move reverse_bytes from bit_ops.h to bit_ops.cpplloyd2007-10-211-0/+30
|
* sha160.cpp needs include of bit_ops.h, problem was masked by the asm versionslloyd2007-10-191-0/+1
| | | | when I was testing on x86 and x86-64 machines.
* bit_ops.h no longer includes loadstor.hlloyd2007-10-1954-30/+52
| | | | | | | | | Where loadstor.h was needed but only implicitly included via bit_ops.h, include it directly Add endian reversal functions to bit_ops.h Remove some unneeded includes in big_ops2.cpp and a few other files.
* Fold an XOR operation that was happening during SEED encryption/decryption tolloyd2007-10-191-6/+6
| | | | | occur inside the key schedule instead. This should lead to (slightly) better scheduling in the compiled code by reducing the length of a critical path.
* Don't hard code any directories to search for programs into es_unix.lloyd2007-10-191-1/+1
| | | | | | | All are now specified through the config. The new default is just /bin, /sbin, /usr/bin, and /usr/sbin. Formerly /usr/ucb, /usr/etc, and /etc were also searched. If you want this behavior again you have to explicitly set the rng/unix_path configuration setting.
* merge of '7abb64699f9d0ffd4305b8c5686ce581f68c01ed'lloyd2007-10-191-0/+2
|\ | | | | | | and 'dda7bbd71591790326178cc71409a956cf121d6b'
| * The flag that we had run a slow pollwas only set if one was forced fromlloyd2007-10-191-0/+2
| | | | | | | | | | | | a fast poll request, and not if a slow poll was specifically requested. So a sequence of slow and then fast polls would trigger a second slow poll, which was not desired.
* | Add support for IPv4 addresses in the X.509 alternative name extension.lloyd2007-10-163-5/+28
| | | | | | | | Original patch from Yves Jerschow.
* | Add functions that can convert between binary IPv4 addresses and standardlloyd2007-10-161-1/+43
| | | | | | | | decimal-dotted string notation.
* | Truncate the X9.42 PRF output if the counter overflows.lloyd2007-10-151-1/+1
| |
* | Make some formatting between the encryption and decryption code equivalent.lloyd2007-10-151-1/+4
| |
* | Use shorter variable names in the TEA code.lloyd2007-10-151-12/+12
| |
* | Move the self tests from LibraryInitializer::initialize tolloyd2007-10-152-7/+7
|/ | | | | Library_State::initialize: now the LibraryInitializer is just a simple wrapper to create/destroy the state with no other operations.
* The last checkin did not work; the Library_State constructor called code1.7.2lloyd2007-10-132-9/+31
| | | | | | | | that called global_state(), which cased an infinite recursion. Make creating a Library_State a two-phase operation, first an empty constructor (just sets all pointers to NULL), then an initializer that sets up everything needed to start up the library.
* Move most of the initializer code directly into the Library_State constructorlloyd2007-10-132-80/+65
|
* If we attempt to access the global state, and it is null, calllloyd2007-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LibraryInitializer::initialize(), which will set it for us (or fail by throwing an exception, which will be propogated to the caller). So any instances of creating a LibraryInitializer where no option arguments are passed can be removed; instead that initialization will run when or if you execute an operation where Botan requires the services provided in the state. Because no options are passed, the library will be using the default (debug and not thread safe) mutex type: so hopefully you'll quickly get an exception when the debug mutex realizes it is being used in a threaded application, but there is risk of operations silently failing before that happens. You can call LibraryInitializer::deinitialize() at the end of your main function (or whenever you think you won't need Botan anymore), to free the global state; if not a number of cleanup destructors will not run (including the final scrub of memory). You can even shut down Botan speculatively; if it turns out you need it again, it just means you'll have to take the cost of another initialization. However in applications that use Botan only in small bursts, or in rarely taken codepaths, you can remove the state entirely and suffer zero memory overhead. This probably only makes sense in memory constrained systems, but it's reasonable to do now. Speculatively deallocating the state is probably not thread safe without extra work. One thread calling deinitialize() would invalidate pointers that would have been visible to other threads. One (untested) idea: have an atomic integer with the number of current threads using Botan. If any thread decrements and hits zero, it could deinitialize Botan safely. This might cause too many repeated startup/shutdowns, which would depend on the app use pattern. In addition, since you can't pass arguments to the new Library_State, you can't specify the use of real mutexes (or anything else): so for right now, this only works in applications that are fine with the standard options. I want to find a way to get that working, though, since it's very inelegant. Currently a Default_Mutex (not at all thread safe but somewhat error checking) will be used. And self test will always be run (more on that below). I wrote a program that just initializes and shuts down in a tight loop. Running on my Gentoo box (Core2 E6400, gcc 4.1.2): thread_safe? selftest? time (ms) ------------ --------- --------- no yes 6.1 no no 3.8 yes yes 6.7 yes no 3.8 If you're actually worried that the library might start up OK but then start failing basic self tests, what you actually want to do is have a thread that runs diagnostics on your entire process state (including calling Botan's self test code) every N seconds. The question is how to get arguments from the outside world to the constructor of the Library_State that is created inside of global_state(): avoiding many self tests to save a bit of time (many applications won't care about the extra cost but sometimes 2 or 3 ms is important), and thread safety (beacuse you can't specify to use a real mutex).
* Add OIDs for SHA-224, SHA-256, SHA-384, SHA-512, and DSA with SHA-224 andlloyd2007-10-031-1/+9
| | | | SHA-256 (from draft-ietf-pkix-sha2-dsa-ecdsa-01)
* If DL_Group's constructor can't find a group, throw a reasonably informativelloyd2007-09-291-1/+6
| | | | exception instead of one for a PEM decode error which is not very helpful.
* Use the OUTPUT_LENGTH constant instead of assuming the block size of the cipherlloyd2007-09-171-6/+7
| | | | is 64 bits.
* Check in an initial implementation of CBC-MAC.lloyd2007-09-162-0/+110
| | | | | | | The test vectors were generated by Crypto++ 5.5 on a Linux/x86-64 machine. Test vectors for CBC-MAC(DES) all pass, for inputs up to 63 bytes. For CBC-MAC(AES-128), all test vectors with inputs over 10 bytes fail to verify against what Crypto++ produces. Unknown at this time where the bug lies.
* Use Botan:: prefixes to work around a bug in Visual Studio C++ 2003. Patchlloyd2007-07-271-2/+2
| | | | from Christophe Meessen on the development list.
* If counter overflows, truncate the output of KDF2. That effectivelylloyd2007-07-261-1/+1
| | | | | limits the output to just a bit under 2^32 bytes, which is the maximum you can request anyway.
* Avoid C-style casts (as detected by GCC's -Wold-style-cast) and instead use lloyd2007-07-2334-99/+109
| | | | static_cast or reinterpret_cast, as needed.
* Use std::string::data() instead of std::string::c_str() in cases where welloyd2007-07-219-10/+10
| | | | | just want access to the underlying data representation but don't care if the return value is NULL terminated or not.
* Combine the Blowfish initial sbox contents into a single 1024 element array.lloyd2007-07-172-98/+91
|
* If an algorithm cache lookup fails, index the newly created prototype objectlloyd2007-07-171-6/+7
| | | | | | | | | | | | | | | | | | | | | under the name that the algorithm was originally requested by. This enables proper caching for algorithm names which deref_alias fails to fully dereference such as "HMAC(SHA-1)". The previous code had two major problems with names of that type, firstly that the cache was effectively bypassed due to all prototype objects in Algorithm_Cache_Impl being indexed by their canonical names rather than the alias that they were requested under, and that there existed a race condition where a prototype object might be deleted while in use in multithreaded code. The downside of this change is that using multiple names to refer to a single algorithm causes multiple prototype objects to be created, one for each name that is in use. However the memory overhead of this should be fairly minimal and given the severity of the race condition this seems like a worthwhile tradeoff. A more complete fix would be to fix deref_alias to properly derference all alias names. That fix would be complimentary with this change in that if deref_alias handled all names properly there would be a single prototype object and there would then be no additional memory overhead to the cache.
* We don't need to use locked memory in the X.509 distinguished name.lloyd2007-06-111-1/+1
|
* On an assignment or initialization split across lines, put the = at the endlloyd2007-05-312-6/+6
| | | | of the line rather than the start.
* propagate from branch 'net.randombit.botan.stable' (head ↵lloyd2007-05-311-1/+1
|\ | | | | | | | | | | e92fe807f749c526669303bd1530dd76a4d10a86) to branch 'net.randombit.botan' (head 04a56f961f413296df6637b77ec45aa444513cfc)
| * Typo: RFC 882 instead of 822. Reported by Yves Jerschow.lloyd2007-05-311-1/+1
| |
* | Use the word-loading operations in SHA-384/SHA-512 as welllloyd2007-05-311-5/+4
| |
* | Write functions to handle loading and saving words a block at a time, taking ↵lloyd2007-05-3136-425/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into account endian differences. The current code does not take advantage of the knowledge of which endianness we are running on; an optimization suggested by Yves Jerschow is to use (unsafe) casts to speed up the load/store operations. This turns out to provide large performance increases (30% or more) in some cases. Even without the unsafe casts, this version seems to average a few percent faster, probably because the longer loading loops have been partially or fully unrolled. This also makes the code implementing low-level algorithms like ciphers and hashes a bit more succint.
* | Enable DATA_ENCIPHERMENT in constraints for encryption keys.lloyd2007-05-181-1/+1
| |
* | Check in a change from Yves Jerschow optimizing the HMAC key schedule.lloyd2007-05-151-5/+11
| | | | | | | | | | Seems to be about 2-3 times faster in the case where the key is smaller than the hash's block size, which is almost always the case.
* | propagate from branch 'net.randombit.botan.stable' (head ↵lloyd2007-04-251-11/+1
|\| | | | | | | | | | | 8a2b79c64a13d3f70b0211d4f985a678951a9663) to branch 'net.randombit.botan' (head 677686443a5bb53b03d147999947448a9dc2679a)
| * Check in a working fix for the mem_pool issues encountered by some Visuallloyd2007-04-251-11/+1
| | | | | | | | Studio users.
| * Revert the last change; it actually broke the memory allocators in alloyd2007-04-231-1/+1
| | | | | | | | fairly massive way.
| * Fixes for Visual C++ 2005; it wasn't picking up the needed conversionlloyd2007-04-231-2/+3
| | | | | | | | from a void* to a Memory_Block, so call the constructor explicitly.
* | Small cleanups.lloyd2007-03-101-1/+0
| |
* | Add new OIDs for Rabin-Williams and Nyberg-Rueppel keys and signatures.lloyd2007-03-101-0/+23
| | | | | | | | | | These were allocated out of my IANA assigned arc, which is documented at http://www.randombit.net/text/oids.html
* | Catch exceptions in OIDS::lookup and rethrow a Lookup_Error. Attempting tolloyd2007-03-101-2/+10
| | | | | | | | | | | | encode a public key that did not have an OID for its key format resulted in a very confusing exception (thrown from char2digit) that was completely meaningless to anyone.
* | Move the version query code out of base.cpp and into version.cpp; I havelloyd2007-03-082-18/+28
| | | | | | | | | | | | | | a feeling I may want to perform automated source changes to the version strings (eg, to insert a monotone revision ID), but I'd just as soon perform such operations on as small a file as possible to limit any damage that might occur due to a source code rewriting script gone awry.
* | Inline the definition of Tiger::round into Tiger::pass, which was its onlylloyd2007-03-071-21/+55
| | | | | | | | | | | | caller. The resulting code is longer and somewhat harder to read, but it's giving 25-30% performance increases on my Core2, and something a bit lower but still measurable on the P4.
* | Add startup selftests for SHA-256 and HMAC(SHA-256)lloyd2007-03-041-0/+18
| |
* | Introduce a class Seed which represents the domain parameter seed, ratherlloyd2007-03-041-15/+30
| | | | | | | | than using an unadorned buffer with the increment() function.
* | Use prefix rather than postfix increment in places where it can be used.lloyd2007-03-034-6/+6
| |
* | Alter one of the constructors of DL_Group to take a parameter specifyinglloyd2007-03-032-36/+56
| | | | | | | | | | | | | | | | | | how big q should be. Add FIPS 186-3 DSA parameter generation, this allows for generating larger (2048 and 3072 bit) DSA keys. At this time there do not seem to be official test vectors for 186-3, and I have not checked against other implementations. Tests will be constructed using the latest OpenSSL snapshot.
* | BigInt::operator[] now guards against accesses that are larger than thelloyd2007-03-031-0/+17
| | | | | | | | current register size; reads return 0, writes extend the buffer.
* | Add a version of BigInt::binary_decode taking a MemoryRegion of byteslloyd2007-03-011-0/+8
| |
* | Inline the round functions of RC2. This is about 15% faster on my machine,lloyd2007-03-011-52/+48
| | | | | | | | and actually reduced the total line count.