aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/credits.txt5
-rw-r--r--doc/license.txt2
-rw-r--r--doc/log.txt8
-rw-r--r--include/sha1prng.h41
-rw-r--r--src/sha1prng.cpp167
5 files changed, 5 insertions, 218 deletions
diff --git a/doc/credits.txt b/doc/credits.txt
index cdf6a2bba..57c33b72b 100644
--- a/doc/credits.txt
+++ b/doc/credits.txt
@@ -17,11 +17,6 @@ D: Binary file I/O support, allocator fixes
N: Hany Greiss
D: Windows porting
-N: Manuel Hartl
-E: hartl@flexsecure.de
-W: http://www.flexsecure.de/
-D: SHA1PRNG
-
N: Yves Jerschow
E: Yves.Jerschow@uni-duesseldorf.de
D: Optimizations for memory load/store and HMAC
diff --git a/doc/license.txt b/doc/license.txt
index 43cc7decb..827bc839b 100644
--- a/doc/license.txt
+++ b/doc/license.txt
@@ -5,8 +5,6 @@ Copyright (C) 1999-2008 Jack Lloyd
2005-2006 Matt Johnston
2006 Luca Piccarreta
2007 Yves Jerschow
- 2007 FlexSecure GmbH
- 2007 Manuel Hartl
Redistribution and use in source and binary forms, for any use, with or without
modification, is permitted provided that the following conditions are met:
diff --git a/doc/log.txt b/doc/log.txt
index f7159c1fa..e48877393 100644
--- a/doc/log.txt
+++ b/doc/log.txt
@@ -1,11 +1,13 @@
-* 1.7.7, ????-??-??
- - Add implementation of SHA1PRNG, contributed by FlexSecure GmbH
- - Add a test suite for the ANSI X9.31 PRNG
+* 1.7.7, 2008-07-??
- Remove many uses of the global PRNG object
+ - Add a test suite for the ANSI X9.31 PRNG
+ - Much cleaner and (mostly) thread-safe reimplementation of es_ftw
- Remove both default arguments to ANSI_X931_RNG's constructor
- Remove the randomizing version of OctetString::change
- Make the cipher and MAC to use in Randpool configurable
+ - Move RandomNumberGenerator declaration to rng.h
+ - Fix an error decoding BER UNIVERSAL types with special taggings
* 1.7.6, 2008-05-05
- Initial support for Windows DLLs, from Joel Low
diff --git a/include/sha1prng.h b/include/sha1prng.h
deleted file mode 100644
index 01d251078..000000000
--- a/include/sha1prng.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************
-* SHA1PRNG RNG Header File *
-* (C) 2007 FlexSecure GmbH / Manuel Hartl *
-* (C) 2008 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_SHA1PRNG_H__
-#define BOTAN_SHA1PRNG_H__
-
-#include <botan/rng.h>
-#include <botan/base.h>
-
-namespace Botan {
-
-/*************************************************
-* SHA1PRNG *
-*************************************************/
-class BOTAN_DLL SHA1PRNG : public RandomNumberGenerator
- {
- public:
- void randomize(byte[], u32bit) throw(PRNG_Unseeded);
- bool is_seeded() const;
- void clear() throw();
- std::string name() const;
-
- SHA1PRNG(RandomNumberGenerator* = 0);
- ~SHA1PRNG();
- private:
- void add_randomness(const byte[], u32bit);
- void update_state(byte[]);
-
- RandomNumberGenerator* prng;
- HashFunction* hash;
- SecureVector<byte> buffer;
- SecureVector<byte> state;
- int buf_pos;
- };
-
-}
-
-#endif
diff --git a/src/sha1prng.cpp b/src/sha1prng.cpp
deleted file mode 100644
index 562b001bd..000000000
--- a/src/sha1prng.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*************************************************
-* SHA1PRNG Source File *
-* (C) 2007 FlexSecure GmbH / Manuel Hartl *
-* (C) 2008 Jack Lloyd *
-*************************************************/
-
-#include <botan/sha1prng.h>
-#include <botan/lookup.h>
-#include <botan/bit_ops.h>
-#include <algorithm>
-
-namespace Botan {
-
-/*************************************************
-* Generate a buffer of random bytes *
-*************************************************/
-void SHA1PRNG::randomize(byte result[], u32bit length) throw(PRNG_Unseeded)
- {
- if(!is_seeded())
- throw PRNG_Unseeded(name());
-
- const u32bit SHA1_BYTES = hash->OUTPUT_LENGTH;
-
- u32bit resultIndex=0;
- /**
- * use ramining bytes from buffer for result
- */
- if(buf_pos>0)
- {
- u32bit remainderCountIndex=buf_pos;
- unsigned int j = length >= (unsigned)(SHA1_BYTES - buf_pos) ? SHA1_BYTES - buf_pos : length;
-
- for(;resultIndex < j;resultIndex++)
- {
- result[resultIndex] = buffer[remainderCountIndex];
- buffer[remainderCountIndex++] = 0;
- }
-
- buf_pos += j;
- }
-
- /**
- * fill result with fresh random bytes
- */
- while(resultIndex < length)
- {
- hash->update(state.begin(),SHA1_BYTES);
- hash->final(buffer.begin());
- update_state(buffer.begin());
- int k=length-1 <= SHA1_BYTES ? length : SHA1_BYTES;
- for(int j = 0;j < k; j++)
- {
- result[resultIndex++] = buffer[j];
- buffer[j] = 0;
- }
- buf_pos+=k;
- }
- buf_pos %=SHA1_BYTES;
- }
-
-/*************************************************
-* Refill the internal state *
-*************************************************/
-void SHA1PRNG::update_state(byte update[])
- {
- signed int i = 1;
- bool flag2 = false;
-
- for(u32bit k = 0; k < state.size(); k++)
- {
- int b1 = state[k]%256;
- if(b1>128)
- {
- b1-=256;
- }
-
- int b2 = update[k]%256;
- if(b2>128)
- {
- b2-=256;
- }
- int j = b1+b2+i;
- if(j>256)
- {
- j-=256;
- }
- flag2 |= state.begin()[k] != (byte)j;
- state.begin()[k] = (byte)j;
- i = j >> 8;
- }
-
- if(!flag2)
- {
- state[0]++;
- }
- }
-
-/*************************************************
-* Add entropy to internal state *
-*************************************************/
-void SHA1PRNG::add_randomness(const byte data[], u32bit length)
- {
- prng->add_entropy(data, length);
- MemoryVector<byte> for_rand;
- for_rand.set(data, length);
-
- if(prng->is_seeded())
- {
- prng->randomize(for_rand, length);
- hash->clear();
- hash->update(for_rand,length);
- hash->final(state.begin());
- }
- }
-
-/*************************************************
-* Check if the RNG is seeded *
-*************************************************/
-bool SHA1PRNG::is_seeded() const
- {
- return prng->is_seeded();
- }
-
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
-void SHA1PRNG::clear() throw()
- {
- hash->clear();
- prng->clear();
- }
-
-/*************************************************
-* Return the name of this type *
-*************************************************/
-std::string SHA1PRNG::name() const
- {
- return "SHA1PRNG";
- }
-
-/*************************************************
-* SHA1PRNG Constructor *
-*************************************************/
-SHA1PRNG::SHA1PRNG(RandomNumberGenerator* prng_ptr)
- {
- if(!prng_ptr)
- throw Invalid_Argument("SHA1PRNG constructor: NULL prng");
-
- hash = get_hash("SHA-1");
- prng = prng_ptr;
-
- buf_pos = 0;
-
- state.grow_to(hash->OUTPUT_LENGTH);
- buffer.grow_to(hash->OUTPUT_LENGTH);
- }
-
-/*************************************************
-* SHA1PRNG Destructor *
-*************************************************/
-SHA1PRNG::~SHA1PRNG()
- {
- delete hash;
- delete prng;
- }
-
-}