]> Cypherpunks repositories - gostls13.git/commitdiff
Replace SliceReader with bytes.Buffer.
authorAdam Langley <agl@golang.org>
Thu, 22 Oct 2009 02:49:01 +0000 (19:49 -0700)
committerAdam Langley <agl@golang.org>
Thu, 22 Oct 2009 02:49:01 +0000 (19:49 -0700)
R=r
APPROVED=r
DELTA=16  (0 added, 15 deleted, 1 changed)
OCL=35976
CL=35978

src/pkg/crypto/rsa/rsa_test.go

index 0247e97adbbb9259813b0d80ea7d50cafa77b035..a30982c940963c8a4430b9686294a7717d74902e 100644 (file)
@@ -42,21 +42,6 @@ func TestKeyGeneration(t *testing.T) {
        }
 }
 
-type SliceReader struct {
-       s       []byte;
-       offset  int;
-}
-
-func (s SliceReader) Read(out []byte) (n int, err os.Error) {
-       if s.offset == len(s.s) {
-               err = os.EOF;
-               return;
-       }
-       n = bytes.Copy(out, s.s[s.offset : len(s.s)]);
-       s.offset += n;
-       return;
-}
-
 type testEncryptOAEPMessage struct {
        in      []byte;
        seed    []byte;
@@ -78,7 +63,7 @@ func TestEncryptOAEP(t *testing.T) {
                public := PublicKey{n, test.e};
 
                for j, message := range test.msgs {
-                       randomSource := SliceReader{message.seed, 0};
+                       randomSource := bytes.NewBuffer(message.seed);
                        out, err := EncryptOAEP(sha1, randomSource, &public, message.in, nil);
                        if err != nil {
                                t.Errorf("#%d,%d error: %s", i, j, err);