aboutsummaryrefslogtreecommitdiffstats
path: root/src/x931_rng.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add interfaces for add_entropy_source and add_entropy tolloyd2008-06-281-0/+16
| | | | | | | | | | | RandomNumberGenerator, and make ANSI_X931_PRNG's implementations just forward the arguments to the underlying RNG. This allows seeding the RNG even if no entropy modules are loaded into the library. Also it allows actually adding user-specified data; to do it otherwise would require creating the RNG objects yourself and retaining a pointer to the Randpool, which is pretty bogus. Move Null_RNG to rng.h
* Reseed the underlying PRNG when ANSI_X931_PRNG:reseed is calledlloyd2008-06-281-0/+2
|
* New structure for entropy sources + RNGs. The entropy sources are owned bylloyd2008-06-271-16/+11
| | | | | | | Randpool, it will query them as needed (or if asked to do so). New function make_rng() that creates an RNG (X9.31 backed by a Randpool) and seeds it. Remove the entropy source related code from the Modules/Builtin_Modules classes.
* Remove PRNG_Unseeded throw() specifies from the RNG randomize() functions.lloyd2008-06-271-1/+1
| | | | | | They were probably not a good idea. If nothing else, these functions might throw bad_alloc, and possibly other errors. Something broad like std::exception might be applicable, but that seems pointlessly broad.
* Remove Randpool header from X9.31 PRNG code: the RNGs are now decoupledlloyd2008-06-101-1/+0
|
* We must have ANSI_X931_RNG::clear() call destroy() on V, which sets thelloyd2008-06-071-1/+1
| | | | | | length to zero. That is because we encoded our seededness state as being if (and only if) V has non-zero length. After clearing, we have reset all state.
* Change how the ANSI X9.31 generator tells that it is seeded. Previously,lloyd2008-06-071-15/+11
| | | | | | | | | | | | | it was seeded if and only if the underlying PRNG was seeded. However if the PRNG always returned as being seeded, we would never generate a V value, etc (leaving them at the default zero). This would not occur with any of Botan's built in PRNGs since their implementations require that add_randomness be called at least once before is_seeded will return true. However this is not an invariant of the general RandomNumberGenerator interface. Now, the X9.31 PRNG is only seeded after it has a) detected that the PRNG is seeded, and b) generated a new random key and V vector.
* Remove both default arguments to the constructor of ANSI_X931_RNG.lloyd2008-05-241-6/+5
| | | | | | | | | | | | | | | | | | If the second argument was NULL, it would default to a new Randpool. But this introduces an annoying dependency: really it is the caller who is relying on Randpool. Make this explicit by passing a new Randpool pointer to the constructor in Library_State. This will break all callers using ANSI_X931_RNG's constructors with default arguments. To regain the previous behavior, change: ANSI_X931_RNG rng; ANSI_X931_RNG rng("/*cipher name*/"); to ANSI_X931_RNG rng(/*cipher name, default was AES-256 */, new Randpool); You are free to pass another PRNG object if you like. This make require inclusion of <botan/randpool.h>
* Always set the position to the start of the block when generating a newlloyd2008-04-151-3/+2
| | | | | | | | | | | | | | block of data in the X9.31 PRNG (previously, adding entropy would cause a new block to be computed but the read pointer would be the same as it had been in the old block). Nominally this is very slightly faster (we don't throw away bytes we just computed) but the change is more to make the code more obvious/explicit; I was surprised by its old behavior, which seems bad. In theory it could introduce additional weaknesses, if gaining advantage to this partial block that was being thrown away assisted in an attack (I do not know of any attacks against the X9.31 PRNG that work that way, however).
* Change the copyrights in all files in the Botan tree to directly reflectlloyd2008-04-101-1/+1
| | | | | | the actual copyright holders. For rationale, see my post to botan-devel on April 9, subject 'Changing license to directly reflect contributors' (http://www.randombit.net/pipermail/botan-devel/2008-April/000527.html)
* Mostly revert 2f4fd18182d5a75c40cd831e7ee3c314be5c57d6, only keep thelloyd2008-03-101-1/+1
| | | | | updated dates on files that have actually changed this year. This makes the diff across versions readable again.
* Mass update of the copyright date. Honestly I don't know why I bother,lloyd2008-02-141-1/+1
| | | | | | | but might as well keep it up to date. And it's easier to do it once with a 'perl -pi' command than to update each file over time. Apologies to anyone looking at diffs.
* Bump copyright year to 2007lloyd2007-01-201-1/+1
|
* Initial checkin1.5.6lloyd2006-05-181-0/+136