diff --git a/core/java/src/gnu/crypto/prng/FortunaStandalone.java b/core/java/src/gnu/crypto/prng/FortunaStandalone.java index 7ffd26a2936a77d298ea49c3abd6712828e38025..f444c11ec941b7b5330a2bc237072c223cd3731d 100644 --- a/core/java/src/gnu/crypto/prng/FortunaStandalone.java +++ b/core/java/src/gnu/crypto/prng/FortunaStandalone.java @@ -95,7 +95,7 @@ import net.i2p.crypto.SHA256Generator; * * NOTE: As of 0.8.8, uses the java.security.MessageDigest instead of GNU Sha256Standalone */ -public class FortunaStandalone extends BasePRNGStandalone implements Serializable, RandomEventListenerStandalone +public class FortunaStandalone extends BasePRNGStandalone implements Serializable { private static final long serialVersionUID = 0xFACADE; @@ -191,19 +191,6 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl pool = (pool + 1) % NUM_POOLS; } - public void addRandomEvent(RandomEventStandalone event) - { - if (event.getPoolNumber() < 0 || event.getPoolNumber() >= pools.length) - throw new IllegalArgumentException("pool number out of range: " - + event.getPoolNumber()); - pools[event.getPoolNumber()].update(event.getSourceNumber()); - pools[event.getPoolNumber()].update((byte) event.getData().length); - byte data[] = event.getData(); - pools[event.getPoolNumber()].update(data, 0, data.length); //event.getData()); - if (event.getPoolNumber() == 0) - pool0Count += event.getData().length; - } - // Reading and writing this object is equivalent to storing and retrieving // the seed. diff --git a/core/java/src/gnu/crypto/prng/IRandomStandalone.java b/core/java/src/gnu/crypto/prng/IRandomStandalone.java index 9d7e81fd021936745c61fc5061a28b159d50c8a0..580ab4de0e1afc380c0eca1a6f6b86c850762574 100644 --- a/core/java/src/gnu/crypto/prng/IRandomStandalone.java +++ b/core/java/src/gnu/crypto/prng/IRandomStandalone.java @@ -114,10 +114,9 @@ public interface IRandomStandalone extends Cloneable { * * @return the next 8 bits of random data generated from this instance. * @throws IllegalStateException if the instance is not yet initialised. - * @throws LimitReachedExceptionStandalone this instance has reached its * theoretical limit for generating non-repetitive pseudo-random data. */ - byte nextByte() throws IllegalStateException, LimitReachedExceptionStandalone; + byte nextByte() throws IllegalStateException; /** * <p>Fills the designated byte array, starting from byte at index @@ -131,11 +130,10 @@ public interface IRandomStandalone extends Cloneable { * @param length the maximum number of required random bytes. This method * does nothing if this parameter is less than <code>1</code>. * @throws IllegalStateException if the instance is not yet initialised. - * @throws LimitReachedExceptionStandalone this instance has reached its * theoretical limit for generating non-repetitive pseudo-random data. */ void nextBytes(byte[] out, int offset, int length) - throws IllegalStateException, LimitReachedExceptionStandalone; + throws IllegalStateException; /** * <p>Supplement, or possibly replace, the random state of this PRNG with diff --git a/core/java/src/gnu/crypto/prng/LimitReachedExceptionStandalone.java b/core/java/src/gnu/crypto/prng/LimitReachedExceptionStandalone.java deleted file mode 100644 index 509a2d9713298aa731727c1866997e08896f8482..0000000000000000000000000000000000000000 --- a/core/java/src/gnu/crypto/prng/LimitReachedExceptionStandalone.java +++ /dev/null @@ -1,73 +0,0 @@ -package gnu.crypto.prng; - -// ---------------------------------------------------------------------------- -// $Id: LimitReachedExceptionStandalone.java,v 1.1 2005/10/22 13:10:00 jrandom Exp $ -// -// Copyright (C) 2001, 2002, Free Software Foundation, Inc. -// -// This file is part of GNU Crypto. -// -// GNU Crypto 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, or (at your option) -// any later version. -// -// GNU Crypto 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; see the file COPYING. If not, write to the -// -// Free Software Foundation Inc., -// 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301 -// USA -// -// Linking this library statically or dynamically with other modules is -// making a combined work based on this library. Thus, the terms and -// conditions of the GNU General Public License cover the whole -// combination. -// -// As a special exception, the copyright holders of this library give -// you permission to link this library with independent modules to -// produce an executable, regardless of the license terms of these -// independent modules, and to copy and distribute the resulting -// executable under terms of your choice, provided that you also meet, -// for each linked independent module, the terms and conditions of the -// license of that module. An independent module is a module which is -// not derived from or based on this library. If you modify this -// library, you may extend this exception to your version of the -// library, but you are not obligated to do so. If you do not wish to -// do so, delete this exception statement from your version. -// ---------------------------------------------------------------------------- - -/** - * A checked exception that indicates that a pseudo random number generated has - * reached its theoretical limit in generating random bytes. - * - * @version $Revision: 1.1 $ - */ -public class LimitReachedExceptionStandalone extends Exception { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - - public LimitReachedExceptionStandalone() { - super(); - } - - public LimitReachedExceptionStandalone(String msg) { - super(msg); - } - - // Class methods - // ------------------------------------------------------------------------- - - // Instant methods - // ------------------------------------------------------------------------- -} diff --git a/core/java/src/gnu/crypto/prng/RandomEventListenerStandalone.java b/core/java/src/gnu/crypto/prng/RandomEventListenerStandalone.java deleted file mode 100644 index dee897bfd0b7f794713a5865b59acc56eac14649..0000000000000000000000000000000000000000 --- a/core/java/src/gnu/crypto/prng/RandomEventListenerStandalone.java +++ /dev/null @@ -1,53 +0,0 @@ -/* RandomEventListenerStandalone.java -- event listener - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Crypto. - -GNU Crypto 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, or (at your option) any -later version. - -GNU Crypto 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; see the file COPYING. If not, write to the - - Free Software Foundation Inc., - 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 - USA - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.crypto.prng; - -import java.util.EventListener; - -/** - * An interface for entropy accumulators that will be notified of random - * events. - */ -public interface RandomEventListenerStandalone extends EventListener -{ - void addRandomEvent(RandomEventStandalone event); -} diff --git a/core/java/src/gnu/crypto/prng/RandomEventStandalone.java b/core/java/src/gnu/crypto/prng/RandomEventStandalone.java deleted file mode 100644 index 235bd27d1a13491d2b5bd0bf5551b6245d81db28..0000000000000000000000000000000000000000 --- a/core/java/src/gnu/crypto/prng/RandomEventStandalone.java +++ /dev/null @@ -1,82 +0,0 @@ -/* RandomEventStandalone.java -- a random event. - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Crypto. - -GNU Crypto 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, or (at your option) any -later version. - -GNU Crypto 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; see the file COPYING. If not, write to the - - Free Software Foundation Inc., - 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 - USA - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.crypto.prng; - -import java.util.EventObject; - -/** - * An interface for entropy accumulators that will be notified of random - * events. - */ -public class RandomEventStandalone extends EventObject -{ - - private final byte sourceNumber; - private final byte poolNumber; - private final byte[] data; - - public RandomEventStandalone(Object source, byte sourceNumber, byte poolNumber, - byte[] data) - { - super(source); - this.sourceNumber = sourceNumber; - this.poolNumber = poolNumber; - if (data.length == 0 || data.length > 32) - throw new IllegalArgumentException("random events take between 1 and 32 bytes of data"); - this.data = data.clone(); - } - - public byte getSourceNumber() - { - return sourceNumber; - } - - public byte getPoolNumber() - { - return poolNumber; - } - - public byte[] getData() - { - return data; - } -}