Re: [freenet-dev] [freenet-cvs] r19694 - trunk/freenet/src/f…

Top Page
Author: Matthew Toseland
Date:  
To: devl
Subject: Re: [freenet-dev] [freenet-cvs] r19694 - trunk/freenet/src/freenet/support/io
Delete this message
Reply to this message
gpg: Signature made Sat May 3 18:44:26 2008 UTC using DSA key ID E43DA450
gpg: Good signature from "Matthew John Toseland <toad@amphibian.dyndns.org>"
On Saturday 03 May 2008 12:48, nextgens@??? wrote:
> Author: nextgens
> Date: 2008-05-03 11:48:01 +0000 (Sat, 03 May 2008)
> New Revision: 19694
>
> Modified:
>

trunk/freenet/src/freenet/support/io/PaddedEphemerallyEncryptedBucket.java
> Log:
> Don't instanciate a new MT; use the existing one.


Does this mean we use the MT for key generation? We ought to use Yarrow for
that.
>
> Modified:

trunk/freenet/src/freenet/support/io/PaddedEphemerallyEncryptedBucket.java
> ===================================================================
> ---

trunk/freenet/src/freenet/support/io/PaddedEphemerallyEncryptedBucket.java    
2008-05-03 11:45:09 UTC (rev 19693)
> +++

trunk/freenet/src/freenet/support/io/PaddedEphemerallyEncryptedBucket.java    
2008-05-03 11:48:01 UTC (rev 19694)
> @@ -28,7 +28,7 @@
>
>     private final Bucket bucket;
>     private final int minPaddedSize;
> -    private final RandomSource origRandom;
> +    private final RandomSource randomSource;
>     private SoftReference /* <Rijndael> */ aesRef;
>     /** The decryption key. */
>     private final byte[] key;
> @@ -45,7 +45,7 @@
>      * @throws UnsupportedCipherException
>      */
>     public PaddedEphemerallyEncryptedBucket(Bucket bucket, int minSize,

RandomSource origRandom) {
> -        this.origRandom = origRandom;
> +        this.randomSource = origRandom;
>         this.bucket = bucket;
>         if(bucket.size() != 0) throw new IllegalArgumentException("Bucket must be

empty");
>         byte[] tempKey = new byte[32];
> @@ -72,7 +72,7 @@
>         if(bucket.size() < knownSize)
>             throw new IOException("Bucket "+bucket+" is too small on disk -

knownSize="+knownSize+" but bucket.size="+bucket.size()+" for "+bucket);
>         this.dataLength = knownSize;
> -        this.origRandom = origRandom;
> +        this.randomSource = origRandom;
>         this.bucket = bucket;
>         if(key.length != 32) throw new IllegalArgumentException("Key wrong

length: "+key.length);
>         this.key = key;
> @@ -82,7 +82,7 @@
>     }
>
>     public PaddedEphemerallyEncryptedBucket(SimpleFieldSet fs, RandomSource

origRandom, PersistentFileTracker f) throws CannotCreateFromFieldSetException
{
> -        this.origRandom = origRandom;
> +        this.randomSource = origRandom;
>         String tmp = fs.get("DataLength");
>         if(tmp == null)
>             throw new CannotCreateFromFieldSetException("No DataLength");
> @@ -180,14 +180,13 @@
>                     return;
>                 }
>                 synchronized(PaddedEphemerallyEncryptedBucket.this) {
> -                    MersenneTwister paddingSource = new

MersenneTwister(origRandom.nextLong());
>                     long finalLength = paddedLength();
>                     long padding = finalLength - dataLength;
>                     byte[] buf = new byte[4096];
>                     long writtenPadding = 0;
>                     while(writtenPadding < padding) {
>                         int left = (int) Math.min((padding - writtenPadding),

(long)buf.length);
> -                        paddingSource.nextBytes(buf);
> +                        randomSource.nextBytes(buf);
>                         out.write(buf, 0, left);
>                         writtenPadding += left;
>                     }
>
> _______________________________________________
> cvs mailing list
> cvs@???
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>