diff options
Diffstat (limited to 'src/pkg/crypto')
32 files changed, 35 insertions, 372 deletions
diff --git a/src/pkg/crypto/aes/Makefile b/src/pkg/crypto/aes/Makefile index c62275b3c..f7352cb91 100644 --- a/src/pkg/crypto/aes/Makefile +++ b/src/pkg/crypto/aes/Makefile @@ -2,75 +2,12 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m >Makefile - -D=/crypto/ - include $(GOROOT)/src/Make.$(GOARCH) -AR=gopack - -default: packages - -clean: - rm -rf *.[$(OS)] *.a [$(OS)].out _obj - -test: packages - gotest - -coverage: packages - gotest - 6cov -g `pwd` | grep -v '_test\.go:' - -%.$O: %.go - $(GC) -I_obj $*.go - -%.$O: %.c - $(CC) $*.c - -%.$O: %.s - $(AS) $*.s - -O1=\ - const.$O\ - -O2=\ - block.$O\ - -O3=\ - cipher.$O\ - - -phases: a1 a2 a3 -_obj$D/aes.a: phases - -a1: $(O1) - $(AR) grc _obj$D/aes.a const.$O - rm -f $(O1) - -a2: $(O2) - $(AR) grc _obj$D/aes.a block.$O - rm -f $(O2) - -a3: $(O3) - $(AR) grc _obj$D/aes.a cipher.$O - rm -f $(O3) - - -newpkg: clean - mkdir -p _obj$D - $(AR) grc _obj$D/aes.a - -$(O1): newpkg -$(O2): a1 -$(O3): a2 -$(O4): a3 - -nuke: clean - rm -f $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/aes.a -packages: _obj$D/aes.a +TARG=crypto/aes +GOFILES=\ + block.go\ + cipher.go\ + const.go\ -install: packages - test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D - cp _obj$D/aes.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/aes.a +include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/crypto/aes/aes_test.go b/src/pkg/crypto/aes/aes_test.go index 2f6cb4a92..95e43f117 100644 --- a/src/pkg/crypto/aes/aes_test.go +++ b/src/pkg/crypto/aes/aes_test.go @@ -5,7 +5,6 @@ package aes import ( - "crypto/aes"; "fmt"; "testing"; ) diff --git a/src/pkg/crypto/aes/block.go b/src/pkg/crypto/aes/block.go index 3c67d1c3c..fb4efc191 100644 --- a/src/pkg/crypto/aes/block.go +++ b/src/pkg/crypto/aes/block.go @@ -36,8 +36,6 @@ package aes -import "crypto/aes" - // Encrypt one block from src into dst, using the expanded key xk. func encryptBlock(xk []uint32, src, dst []byte) { var s0, s1, s2, s3, t0, t1, t2, t3 uint32; diff --git a/src/pkg/crypto/aes/cipher.go b/src/pkg/crypto/aes/cipher.go index e430c9e14..e73335feb 100644 --- a/src/pkg/crypto/aes/cipher.go +++ b/src/pkg/crypto/aes/cipher.go @@ -5,7 +5,6 @@ package aes import ( - "crypto/aes"; "os"; "strconv"; ) diff --git a/src/pkg/crypto/block/Makefile b/src/pkg/crypto/block/Makefile index e8bc8e907..a277d0dd9 100644 --- a/src/pkg/crypto/block/Makefile +++ b/src/pkg/crypto/block/Makefile @@ -2,81 +2,18 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m >Makefile - -D=/crypto/ - include $(GOROOT)/src/Make.$(GOARCH) -AR=gopack - -default: packages - -clean: - rm -rf *.[$(OS)] *.a [$(OS)].out _obj - -test: packages - gotest - -coverage: packages - gotest - 6cov -g `pwd` | grep -v '_test\.go:' - -%.$O: %.go - $(GC) -I_obj $*.go - -%.$O: %.c - $(CC) $*.c - -%.$O: %.s - $(AS) $*.s - -O1=\ - cipher.$O\ - xor.$O\ - -O2=\ - cmac.$O\ - ctr.$O\ - ecb.$O\ - ofb.$O\ - -O3=\ - cbc.$O\ - cfb.$O\ - eax.$O\ - - -phases: a1 a2 a3 -_obj$D/block.a: phases - -a1: $(O1) - $(AR) grc _obj$D/block.a cipher.$O xor.$O - rm -f $(O1) - -a2: $(O2) - $(AR) grc _obj$D/block.a cmac.$O ctr.$O ecb.$O ofb.$O - rm -f $(O2) - -a3: $(O3) - $(AR) grc _obj$D/block.a cbc.$O cfb.$O eax.$O - rm -f $(O3) - - -newpkg: clean - mkdir -p _obj$D - $(AR) grc _obj$D/block.a - -$(O1): newpkg -$(O2): a1 -$(O3): a2 -$(O4): a3 - -nuke: clean - rm -f $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/block.a - -packages: _obj$D/block.a -install: packages - test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D - cp _obj$D/block.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/block.a +TARG=crypto/block +GOFILES=\ + cbc.go\ + cfb.go\ + cipher.go\ + cmac.go\ + ctr.go\ + eax.go\ + ecb.go\ + ofb.go\ + xor.go\ + +include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/crypto/block/cbc.go b/src/pkg/crypto/block/cbc.go index 85a746b72..3aea0c182 100644 --- a/src/pkg/crypto/block/cbc.go +++ b/src/pkg/crypto/block/cbc.go @@ -12,7 +12,6 @@ package block import ( - "crypto/block"; "io"; ) diff --git a/src/pkg/crypto/block/cbc_aes_test.go b/src/pkg/crypto/block/cbc_aes_test.go index 0c10b171d..51e30b5f4 100644 --- a/src/pkg/crypto/block/cbc_aes_test.go +++ b/src/pkg/crypto/block/cbc_aes_test.go @@ -10,17 +10,12 @@ package block -// gobuild: $GC ecb_aes_test.go - import ( "bytes"; "crypto/aes"; - "crypto/block"; "io"; "os"; "testing"; - - "./ecb_aes_test"; ) type cbcTest struct { diff --git a/src/pkg/crypto/block/cfb.go b/src/pkg/crypto/block/cfb.go index 5c4c09a1b..0d73827b4 100644 --- a/src/pkg/crypto/block/cfb.go +++ b/src/pkg/crypto/block/cfb.go @@ -13,7 +13,6 @@ package block import ( - "crypto/block"; "io"; ) diff --git a/src/pkg/crypto/block/cfb_aes_test.go b/src/pkg/crypto/block/cfb_aes_test.go index 95b251196..b0dcef7b2 100644 --- a/src/pkg/crypto/block/cfb_aes_test.go +++ b/src/pkg/crypto/block/cfb_aes_test.go @@ -10,17 +10,12 @@ package block -// gobuild: $GC ecb_aes_test.go - import ( "bytes"; "crypto/aes"; - "crypto/block"; "io"; "os"; "testing"; - - "./ecb_aes_test"; ) type cfbTest struct { diff --git a/src/pkg/crypto/block/cmac.go b/src/pkg/crypto/block/cmac.go index 40697cabd..a556cf567 100644 --- a/src/pkg/crypto/block/cmac.go +++ b/src/pkg/crypto/block/cmac.go @@ -8,7 +8,6 @@ package block import ( - "crypto/block"; "io"; "os"; ) diff --git a/src/pkg/crypto/block/cmac_aes_test.go b/src/pkg/crypto/block/cmac_aes_test.go index 9284ac40a..3b2602c51 100644 --- a/src/pkg/crypto/block/cmac_aes_test.go +++ b/src/pkg/crypto/block/cmac_aes_test.go @@ -6,14 +6,9 @@ package block -// gobuild: $GC ecb_aes_test.go - import ( "crypto/aes"; - "crypto/block"; "testing"; - - "./ecb_aes_test"; ) type cmacAESTest struct { diff --git a/src/pkg/crypto/block/ctr.go b/src/pkg/crypto/block/ctr.go index eecb615ad..38700c185 100644 --- a/src/pkg/crypto/block/ctr.go +++ b/src/pkg/crypto/block/ctr.go @@ -13,7 +13,6 @@ package block import ( - "crypto/block"; "io"; ) diff --git a/src/pkg/crypto/block/ctr_aes_test.go b/src/pkg/crypto/block/ctr_aes_test.go index dceb85a8b..4f90af173 100644 --- a/src/pkg/crypto/block/ctr_aes_test.go +++ b/src/pkg/crypto/block/ctr_aes_test.go @@ -13,12 +13,9 @@ package block import ( "bytes"; "crypto/aes"; - "crypto/block"; "io"; "os"; "testing"; - - "./ecb_aes_test"; ) type ctrTest struct { @@ -86,7 +83,7 @@ func TestCTR_AES(t *testing.T) { for j := 0; j <= 5; j += 5 { var crypt bytes.Buffer; in := tt.in[0:len(tt.in) - j]; - w := block.NewCTRWriter(c, tt.iv, &crypt); + w := NewCTRWriter(c, tt.iv, &crypt); var r io.Reader = io.NewByteReader(in); n, err := io.Copy(r, w); if n != int64(len(in)) || err != nil { @@ -99,7 +96,7 @@ func TestCTR_AES(t *testing.T) { for j := 0; j <= 7; j += 7 { var plain bytes.Buffer; out := tt.out[0:len(tt.out) - j]; - r := block.NewCTRReader(c, tt.iv, io.NewByteReader(out)); + r := NewCTRReader(c, tt.iv, io.NewByteReader(out)); w := &plain; n, err := io.Copy(r, w); if n != int64(len(out)) || err != nil { diff --git a/src/pkg/crypto/block/eax.go b/src/pkg/crypto/block/eax.go index 301564074..bac721dbf 100644 --- a/src/pkg/crypto/block/eax.go +++ b/src/pkg/crypto/block/eax.go @@ -15,7 +15,6 @@ package block import ( - "crypto/block"; "fmt"; "io"; "os"; diff --git a/src/pkg/crypto/block/eax_aes_test.go b/src/pkg/crypto/block/eax_aes_test.go index b4280ee11..94a3d7c40 100644 --- a/src/pkg/crypto/block/eax_aes_test.go +++ b/src/pkg/crypto/block/eax_aes_test.go @@ -7,7 +7,6 @@ package block import ( "bytes"; "crypto/aes"; - "crypto/block"; "fmt"; "io"; "testing"; diff --git a/src/pkg/crypto/block/ecb.go b/src/pkg/crypto/block/ecb.go index 134ac6da0..d250b18ec 100644 --- a/src/pkg/crypto/block/ecb.go +++ b/src/pkg/crypto/block/ecb.go @@ -14,7 +14,6 @@ package block import ( - "crypto/block"; "io"; "os"; "strconv"; diff --git a/src/pkg/crypto/block/ecb_aes_test.go b/src/pkg/crypto/block/ecb_aes_test.go index 518897df5..7359c6ce7 100644 --- a/src/pkg/crypto/block/ecb_aes_test.go +++ b/src/pkg/crypto/block/ecb_aes_test.go @@ -13,7 +13,6 @@ package block import ( "bytes"; "crypto/aes"; - "crypto/block"; "io"; "os"; "testing"; diff --git a/src/pkg/crypto/block/ecb_test.go b/src/pkg/crypto/block/ecb_test.go index 872226512..0938cbe7a 100644 --- a/src/pkg/crypto/block/ecb_test.go +++ b/src/pkg/crypto/block/ecb_test.go @@ -6,7 +6,6 @@ package block import ( "bytes"; - "crypto/block"; "fmt"; "io"; "testing"; diff --git a/src/pkg/crypto/block/ofb.go b/src/pkg/crypto/block/ofb.go index 084274a08..f6d5f98ad 100644 --- a/src/pkg/crypto/block/ofb.go +++ b/src/pkg/crypto/block/ofb.go @@ -13,7 +13,6 @@ package block import ( - "crypto/block"; "io"; ) diff --git a/src/pkg/crypto/block/ofb_aes_test.go b/src/pkg/crypto/block/ofb_aes_test.go index 96673fecb..303202d71 100644 --- a/src/pkg/crypto/block/ofb_aes_test.go +++ b/src/pkg/crypto/block/ofb_aes_test.go @@ -10,17 +10,12 @@ package block -// gotest: $GC ecb_aes_test.go - import ( "bytes"; "crypto/aes"; - "crypto/block"; "io"; "os"; "testing"; - - "./ecb_aes_test"; ) type ofbTest struct { diff --git a/src/pkg/crypto/block/xor.go b/src/pkg/crypto/block/xor.go index 63229dbb4..675dcb77a 100644 --- a/src/pkg/crypto/block/xor.go +++ b/src/pkg/crypto/block/xor.go @@ -7,7 +7,6 @@ package block import ( - "crypto/block"; "io"; "os"; ) diff --git a/src/pkg/crypto/block/xor_test.go b/src/pkg/crypto/block/xor_test.go index 1dca92e55..7e26533c4 100644 --- a/src/pkg/crypto/block/xor_test.go +++ b/src/pkg/crypto/block/xor_test.go @@ -6,7 +6,6 @@ package block import ( "bytes"; - "crypto/block"; "fmt"; "io"; "testing"; diff --git a/src/pkg/crypto/hmac/Makefile b/src/pkg/crypto/hmac/Makefile index 1da3f58dd..9da53a474 100644 --- a/src/pkg/crypto/hmac/Makefile +++ b/src/pkg/crypto/hmac/Makefile @@ -2,59 +2,10 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m >Makefile - -D=/crypto/ - include $(GOROOT)/src/Make.$(GOARCH) -AR=gopack - -default: packages - -clean: - rm -rf *.[$(OS)] *.a [$(OS)].out _obj - -test: packages - gotest - -coverage: packages - gotest - 6cov -g `pwd` | grep -v '_test\.go:' - -%.$O: %.go - $(GC) -I_obj $*.go - -%.$O: %.c - $(CC) $*.c - -%.$O: %.s - $(AS) $*.s - -O1=\ - hmac.$O\ - - -phases: a1 -_obj$D/hmac.a: phases - -a1: $(O1) - $(AR) grc _obj$D/hmac.a hmac.$O - rm -f $(O1) - - -newpkg: clean - mkdir -p _obj$D - $(AR) grc _obj$D/hmac.a - -$(O1): newpkg -$(O2): a1 - -nuke: clean - rm -f $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/hmac.a -packages: _obj$D/hmac.a +TARG=crypto/hmac +GOFILES=\ + hmac.go\ -install: packages - test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D - cp _obj$D/hmac.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/hmac.a +include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/crypto/hmac/hmac_test.go b/src/pkg/crypto/hmac/hmac_test.go index 74fcacfb5..d0de00dce 100644 --- a/src/pkg/crypto/hmac/hmac_test.go +++ b/src/pkg/crypto/hmac/hmac_test.go @@ -8,7 +8,6 @@ package hmac import ( "hash"; - "crypto/hmac"; "fmt"; "strings"; "testing"; diff --git a/src/pkg/crypto/md5/Makefile b/src/pkg/crypto/md5/Makefile index b6c88d45a..53fcf874a 100644 --- a/src/pkg/crypto/md5/Makefile +++ b/src/pkg/crypto/md5/Makefile @@ -2,67 +2,11 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m >Makefile - -D=/crypto/ - include $(GOROOT)/src/Make.$(GOARCH) -AR=gopack - -default: packages - -clean: - rm -rf *.[$(OS)] *.a [$(OS)].out _obj - -test: packages - gotest - -coverage: packages - gotest - 6cov -g `pwd` | grep -v '_test\.go:' - -%.$O: %.go - $(GC) -I_obj $*.go - -%.$O: %.c - $(CC) $*.c - -%.$O: %.s - $(AS) $*.s - -O1=\ - md5.$O\ - -O2=\ - md5block.$O\ - - -phases: a1 a2 -_obj$D/md5.a: phases - -a1: $(O1) - $(AR) grc _obj$D/md5.a md5.$O - rm -f $(O1) - -a2: $(O2) - $(AR) grc _obj$D/md5.a md5block.$O - rm -f $(O2) - - -newpkg: clean - mkdir -p _obj$D - $(AR) grc _obj$D/md5.a - -$(O1): newpkg -$(O2): a1 -$(O3): a2 - -nuke: clean - rm -f $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/md5.a -packages: _obj$D/md5.a +TARG=crypto/md5 +GOFILES=\ + md5.go\ + md5block.go\ -install: packages - test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D - cp _obj$D/md5.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/md5.a +include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/crypto/md5/md5.go b/src/pkg/crypto/md5/md5.go index cbc007f01..a47d91341 100644 --- a/src/pkg/crypto/md5/md5.go +++ b/src/pkg/crypto/md5/md5.go @@ -50,8 +50,6 @@ func (d *digest) Size() int { return Size; } -func _Block(dig *digest, p []byte) int - func (d *digest) Write(p []byte) (nn int, err os.Error) { nn = len(p); d.len += uint64(nn); diff --git a/src/pkg/crypto/md5/md5_test.go b/src/pkg/crypto/md5/md5_test.go index f610f1143..c6319c7d8 100644 --- a/src/pkg/crypto/md5/md5_test.go +++ b/src/pkg/crypto/md5/md5_test.go @@ -6,7 +6,6 @@ package md5 import ( "fmt"; - "crypto/md5"; "io"; "testing"; ) diff --git a/src/pkg/crypto/md5/md5block.go b/src/pkg/crypto/md5/md5block.go index 2776c8795..6ca9d58e0 100644 --- a/src/pkg/crypto/md5/md5block.go +++ b/src/pkg/crypto/md5/md5block.go @@ -8,8 +8,6 @@ package md5 -import "crypto/md5" - // table[i] = int((1<<32) * abs(sin(i+1 radians))). var table = []uint32 { // round 1 diff --git a/src/pkg/crypto/sha1/Makefile b/src/pkg/crypto/sha1/Makefile index 03ffe4fd7..940e2ff15 100644 --- a/src/pkg/crypto/sha1/Makefile +++ b/src/pkg/crypto/sha1/Makefile @@ -2,67 +2,11 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m >Makefile - -D=/crypto/ - include $(GOROOT)/src/Make.$(GOARCH) -AR=gopack - -default: packages - -clean: - rm -rf *.[$(OS)] *.a [$(OS)].out _obj - -test: packages - gotest - -coverage: packages - gotest - 6cov -g `pwd` | grep -v '_test\.go:' - -%.$O: %.go - $(GC) -I_obj $*.go - -%.$O: %.c - $(CC) $*.c - -%.$O: %.s - $(AS) $*.s - -O1=\ - sha1.$O\ - -O2=\ - sha1block.$O\ - - -phases: a1 a2 -_obj$D/sha1.a: phases - -a1: $(O1) - $(AR) grc _obj$D/sha1.a sha1.$O - rm -f $(O1) - -a2: $(O2) - $(AR) grc _obj$D/sha1.a sha1block.$O - rm -f $(O2) - - -newpkg: clean - mkdir -p _obj$D - $(AR) grc _obj$D/sha1.a - -$(O1): newpkg -$(O2): a1 -$(O3): a2 - -nuke: clean - rm -f $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/sha1.a -packages: _obj$D/sha1.a +TARG=crypto/sha1 +GOFILES=\ + sha1.go\ + sha1block.go\ -install: packages - test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D - cp _obj$D/sha1.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/sha1.a +include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/crypto/sha1/sha1.go b/src/pkg/crypto/sha1/sha1.go index a4cccd7a3..fd553895c 100644 --- a/src/pkg/crypto/sha1/sha1.go +++ b/src/pkg/crypto/sha1/sha1.go @@ -52,8 +52,6 @@ func (d *digest) Size() int { return Size; } -func _Block(dig *digest, p []byte) int - func (d *digest) Write(p []byte) (nn int, err os.Error) { nn = len(p); d.len += uint64(nn); diff --git a/src/pkg/crypto/sha1/sha1_test.go b/src/pkg/crypto/sha1/sha1_test.go index 381cc76ee..d2f3788a4 100644 --- a/src/pkg/crypto/sha1/sha1_test.go +++ b/src/pkg/crypto/sha1/sha1_test.go @@ -8,7 +8,6 @@ package sha1 import ( "fmt"; - "crypto/sha1"; "io"; "testing"; ) diff --git a/src/pkg/crypto/sha1/sha1block.go b/src/pkg/crypto/sha1/sha1block.go index 01ddd9506..023703b8f 100644 --- a/src/pkg/crypto/sha1/sha1block.go +++ b/src/pkg/crypto/sha1/sha1block.go @@ -8,8 +8,6 @@ package sha1 -import "crypto/sha1" - const ( _K0 = 0x5A827999; _K1 = 0x6ED9EBA1; |