aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc
Commit message (Collapse)AuthorAgeFilesLines
* Two more locking_allocator bugs. In allocate, we did not setlloyd2012-05-251-5/+9
| | | | | | | | | | | best_fit->first in cases where we had an almost exact match (exact fit but with some alignment bytes at the start), meaning that not only would we lose those bytes forever, but that we might later hand out a range overlapping with what we handed to our current caller. Also, in deallocate, lower_bound on the freelist might return end() (for instance if the freelist is entirely empty). Avoid trying to update the iterator in that case.
* Fix alignment again and add assert checks so we don't mess up again.lloyd2012-05-251-4/+30
| | | | | | We previously ignored a block that was exactly the right size for the allocation and the needed alignment. If we find such a block prefer it over any other (non-exact) blocks to minimize fragmentation.
* For block and stream ciphers, don't set the size of the key vectorslloyd2012-05-251-0/+8
| | | | | | | | | | | until we are actually setting a key. This avoids the problem of prototype objects consuming not just memory but the precious few bytes of mlock'able memory that we're given by Linux. Use clear_mem instead of a loop in BigInt::mask_bits If OS2ECP encounters an invalid format type, include what type it was in the exception message.
* Instead of a map of start->length for recording the free list use alloyd2012-05-242-33/+44
| | | | | | vector of (start,length) where we are careful to maintain the correct ordering. Much much faster than the map version as it mostly avoids allocations and copies.
* Properly align return values of mlock_allocator. Be more careful aboutlloyd2012-05-221-13/+34
| | | | | | | | | | | pointer checks as a sufficiently smart compiler might optimize way pointer comparisons otherwise. Avoid using an iterator value after we have released it from the map. Reduce the default buffer size to 1K to reduce pressure on mlock memory. Drop the old mlock wrapper code.
* Remove a debug call in secmem.h.lloyd2012-05-224-4/+220
| | | | | | | | | Add a new mlock allocator which is far superior to the previous one both in terms of behavior (will lock exactly as much memory as we can actually mlock and will fall back to new/delete in all other cases), and much better and much simpler freelist than the old mem_pool code. Currently we only support systems with mmap+mlock, however it should be easy to extend to also support Windows VirtualLock if desired.
* Replace 0 and NULL pointer constants with nullptr. Also fix an oldlloyd2012-05-181-3/+4
| | | | style cast in secmem.h
* Fairly huge update that replaces the old secmem types with std::vectorlloyd2012-05-1812-1109/+63
| | | | | | using a custom allocator. Currently our allocator just does new/delete with a memset before deletion, and the mmap and mlock allocators have been removed.
* First step towards replacing the existing containers with std::vectorlloyd2012-05-181-11/+25
| | | | | | with a custom allocator; remove the 3 argument version of MemoryRegion::copy, replacing with freestanding buffer_insert function.
* propagate from branch 'net.randombit.botan.tls-state-machine' (head ↵lloyd2012-04-252-10/+13
|\ | | | | | | | | | | a4741cd07f50a9e1b29b0dd97c6fb8697c038ade) to branch 'net.randombit.botan.cxx11' (head 116e5ff139c07000be431e07d3472cc8f3919b91)
| * Avoid a few maintainer mode flag warnings. Remove -Weffc++ from thelloyd2012-04-202-6/+9
| | | | | | | | | | list of maintainer mode flags. It produces some very useful warnings, but also a lot of noisy junk that I really don't care about.
| * The comments incorrectly described end as returning the last element,lloyd2012-04-091-4/+4
| | | | | | | | | | rather than one past the end. Reported by Stuart Maclean on the mailing list.
* | propagate from branch 'net.randombit.botan.tls-state-machine' (head ↵lloyd2012-02-206-34/+17
|\ \ | |/ |/| | | | | | | 0ceb9cde62a2b3614901ae85a53546d9fc641326) to branch 'net.randombit.botan.cxx11' (head 777e65950ef3706a82e5df20dcca7fcc999ca533)
| * Use nullptrlloyd2011-07-122-7/+7
| |
| * propagate from branch 'net.randombit.botan' (head ↵lloyd2011-06-131-0/+10
| |\ | | | | | | | | | | | | | | | b200c1f710e56d39764e567c005eec43448d865d) to branch 'net.randombit.botan.c++0x' (head 527546a7d65baf5315c947602ad0937b65950cf1)
| * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2011-06-135-27/+10
| |\ \ | | | | | | | | | | | | | | | | | | | | 150bd11dd8090559ee1e83394b8283bf93a018de) to branch 'net.randombit.botan.c++0x' (head 7480693bb3f1e8a4e039a3e7ba3d9a7007f9730e)
| | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-11-045-27/+10
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | 303b2518a80553214b1e5ab4d9b96ef54629cbc7) to branch 'net.randombit.botan.c++0x' (head d734eefabe4816be4dd3e3e6e7bb13b7ab5be148)
| | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-10-135-27/+10
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2898d79f992f27a328a3e41d34b46eb1052da0de) to branch 'net.randombit.botan.c++0x' (head 6cba76268fd69a73195760c021b7f881b8a6552c)
| | | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-09-071-2/+2
| | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fb78974f57bc3065d8537ebeb5210c86e74e9bb1) to branch 'net.randombit.botan.c++0x' (head dcb30c0029c7e44a75d0d8b859447a6c9df97cde)
| | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-09-035-27/+10
| | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a29c41b4a949207b1544096c3afab668f8b5179e) to branch 'net.randombit.botan.c++0x' (head a9d0c2f805b3c20a4c648575d7256959db8329fe)
| | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-08-135-27/+10
| | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0a3348f52bf558bc2282e1066c2913a72a1aeda5) to branch 'net.randombit.botan.c++0x' (head 552c20ae8874f12da779fc25ea368e36e71cbfe8)
| | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-07-095-27/+10
| | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 161b5c0300b72baa746f101fda1e2b4a7c71818c) to branch 'net.randombit.botan.c++0x' (head 1fc3875bb8daf4ad0e90ba66db72642203cb9984)
| | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-06-222-3/+40
| | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 647eeb4f4cf8fa4cf487cdc463d48f09fe18658e) to branch 'net.randombit.botan.c++0x' (head 2539675db91883b11895ddc5244721e93c413321)
| | | | | | | * \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-06-176-30/+40
| | | | | | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 294e2082ce9231d6165276e2f2a4153a0116aca3) to branch 'net.randombit.botan.c++0x' (head 0b695fad10f924601e07b009fcd781191fafcb28)
| | | | | | | * \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-05-251-8/+16
| | | | | | | |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 879d1fc83844976a01b9e3188c4f0b5ddb237f0e) to branch 'net.randombit.botan.c++0x' (head 4a0af13da3b0e21d6275cd6ec0c835d6bf757c8d)
| | | | | | | * \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-04-091-47/+10
| | | | | | | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 75d272c759511a9a99a371ddc74bd17b2c1453b6) to branch 'net.randombit.botan.c++0x' (head 2ce9ba37cb9287a3d875921240d6682100625b9f)
| | | | | | | * \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-03-101-1/+1
| | | | | | | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 74e9e8642943d126a5e5efa5be1da8351f0fb6d7) to branch 'net.randombit.botan.c++0x' (head 24371f742c2a1c7e5f3aace364fbb21e01c94657)
| | | | | | | * \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-01-215-18/+10
| | | | | | | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 12382647ef0a28fcb11c824c77b670cc88a4f721) to branch 'net.randombit.botan.c++0x' (head b586a3286d2c4d547ad3add5af9df1455bf4b87b)
| | | | | | | | * \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-12-1610-24/+32
| | | | | | | | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 744dccf92270cf16b80b50ee2759424c9866b256) to branch 'net.randombit.botan.c++0x' (head 2aa1acac1d05e8ea9991fe39015b1db9abc3b24e)
| | | | | | | | * \ \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-11-175-18/+10
| | | | | | | | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0ac5a29496b4e50775827d9655c064f6d1c98813) to branch 'net.randombit.botan.c++0x' (head 3232da044d41756582b53da9d14c3ac07e9b2916)
| | | | | | | | | * \ \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-11-171-30/+17
| | | | | | | | | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cfb19182987fc95b2a8885584a38edb10b4709b3) to branch 'net.randombit.botan.c++0x' (head 1570877c463fed4b632bc49a5b5ee27c57de2cb5)
| | | | | | | | | * | | | | | | | | | Use auto for long iterator names, etc.lloyd2009-11-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It will be nice to convert to the range-based for loop once that's available.
| | | | | | | | | * | | | | | | | | | propagate from branch 'net.randombit.botan' (head ↵lloyd2009-11-025-15/+7
| | | | | | | | | |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2773c2310e8c0a51975987a2dd6c5824c8d43882) to branch 'net.randombit.botan.c++0x' (head f13cf5d7e89706c882604299b508f356c20aae3a)
| | | | | | | | | | * \ \ \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-09-172-2/+2
| | | | | | | | | | |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 92e05ab242e4b6998d685961c53700534a673bce) to branch 'net.randombit.botan.c++0x' (head 27ce37b971ec5cb1f80a9a95b13d5a951b96653b)
| | | | | | | | | | * | | | | | | | | | | Remove dep on mutex module (doesn't exist here). Use initializer list in ↵lloyd2009-09-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libstate.cpp
| | | | | | | | | | * | | | | | | | | | | propagate from branch 'net.randombit.botan' (head ↵lloyd2009-09-084-11/+7
| | | | | | | | | | |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5cadcc57872bef55226579df57349fe09a93d1f5) to branch 'net.randombit.botan.c++0x' (head d1747f0394aa4442e5b32b9102b830e1a86f0e5a)
| | | | | | | | | | | * \ \ \ \ \ \ \ \ \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-07-215-8/+452
| | | | | | | | | | | |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 95eb8083f5884531e5ca0667388f8a6fb6d05c41) to branch 'net.randombit.botan.c++0x' (head 56e105e678540c8bcafa4d0198c19a9489fbf8d1)
| | | | | | | | | | | * | | | | | | | | | | | Remove the mutex classes in favor of C++0x's std::mutex and std::lock_guardlloyd2009-04-014-11/+7
| | | | | | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | | | | | Fix -Wreorder warninglloyd2012-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | | | | | Use initializer list, make destructor virtuallloyd2012-01-061-2/+2
| |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | | | | Add std::swap specialization for memory containerslloyd2011-06-131-0/+10
|/ / / / / / / / / / / / / / / / / / / / /
* | | | | | | | | | | | | | | | | | | | | Write zeros in 4K blockslloyd2011-06-071-7/+9
| | | | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | | | Fix the very basic operations for encoding and decoding alloyd2011-05-171-7/+0
|/ / / / / / / / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | certificate policies extension, though it's really not supported at all. Remove test code from secmem.h Fix building the examples
* | | | | | | | | | | | | | | | | | | | Remove MemoryRegion::set entirelylloyd2010-11-021-20/+34
| | | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | | Make MemoryRegion::set protected, change all callerslloyd2010-10-291-8/+10
|/ / / / / / / / / / / / / / / / / / /
* | | | | | | | | | | | | | | | | | | s/u32bit/size_t/ in alloclloyd2010-10-128-79/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also handle partial writes in alloc_mmap
* | | | | | | | | | | | | | | | | | | Use a full write instead of seek+write to create a sparselloyd2010-10-121-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file. FreeBSD's man page for mmap warns that using NOSYNC with sparse files causes problems. Closes PR 30
* | | | | | | | | | | | | | | | | | | Fix, wasn't returning pointerlloyd2010-09-261-0/+1
| | | | | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | | | Malloc_Allocator isn't a pool, so it needs to fail directly if malloclloyd2010-09-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fails, not just return 0 since callers expect that the allocator will either succeed or throw.
* | | | | | | | | | | | | | | | | | | Use push_back for the single value += operatorlloyd2010-09-151-3/+1
| | | | | | | | | | | | | | | | | | |