From 0a3d43273f2706e249a379eb247f80c727e7fe74 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 16 Aug 2016 16:19:29 -0700 Subject: [PATCH] vendor: sha256 32bit updated. (#2459) --- Makefile | 2 +- .../github.com/minio/sha256-simd/cpuid_arm.go | 33 +++++++++++++++++++ vendor/github.com/minio/sha256-simd/sha256.go | 13 +++++--- .../sha256-simd/sha256blockAvx2_amd64.go | 9 ----- .../minio/sha256-simd/sha256blockAvx_amd64.go | 9 ----- .../sha256-simd/sha256blockSsse_amd64.go | 9 ----- .../minio/sha256-simd/sha256block_386.go | 24 ++++++++++++++ .../minio/sha256-simd/sha256block_amd64.go | 27 +++++++++++++++ .../minio/sha256-simd/sha256block_arm.go | 24 ++++++++++++++ .../minio/sha256-simd/sha256block_arm64.go | 2 +- vendor/vendor.json | 6 ++-- 11 files changed, 122 insertions(+), 36 deletions(-) create mode 100644 vendor/github.com/minio/sha256-simd/cpuid_arm.go create mode 100644 vendor/github.com/minio/sha256-simd/sha256block_386.go create mode 100644 vendor/github.com/minio/sha256-simd/sha256block_arm.go diff --git a/Makefile b/Makefile index d49fb21d1..eb442f4a3 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ deadcode: @GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/deadcode spelling: - @GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error * + @GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error *.go @GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error pkg/**/* test: build diff --git a/vendor/github.com/minio/sha256-simd/cpuid_arm.go b/vendor/github.com/minio/sha256-simd/cpuid_arm.go new file mode 100644 index 000000000..28637d391 --- /dev/null +++ b/vendor/github.com/minio/sha256-simd/cpuid_arm.go @@ -0,0 +1,33 @@ +// Minio Cloud Storage, (C) 2016 Minio, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package sha256 + +func cpuid(op uint32) (eax, ebx, ecx, edx uint32) { + return 0, 0, 0, 0 +} + +func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) { + return 0, 0, 0, 0 +} + +func xgetbv(index uint32) (eax, edx uint32) { + return 0, 0 +} + +func haveArmSha() bool { + // TODO: Implement feature detection for ARM + return true +} diff --git a/vendor/github.com/minio/sha256-simd/sha256.go b/vendor/github.com/minio/sha256-simd/sha256.go index a0cb8aabf..a753e2886 100644 --- a/vendor/github.com/minio/sha256-simd/sha256.go +++ b/vendor/github.com/minio/sha256-simd/sha256.go @@ -19,6 +19,7 @@ package sha256 import ( "crypto/sha256" "hash" + "runtime" ) // Size - The size of a SHA256 checksum in bytes. @@ -62,7 +63,12 @@ func (d *digest) Reset() { } func block(dig *digest, p []byte) { - switch true { + is386bit := runtime.GOARCH == "386" + isARM := runtime.GOARCH == "arm" + if is386bit || isARM { + blockGeneric(dig, p) + } + switch !is386bit && !isARM { case avx2: blockAvx2Go(dig, p) case avx: @@ -82,10 +88,9 @@ func New() hash.Hash { d := new(digest) d.Reset() return d - } else { - // default back to the standard golang implementation - return sha256.New() } + // default back to the standard golang implementation + return sha256.New() } // Sum256 - single caller sha256 helper diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go index cf113c731..43ee7a948 100644 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go +++ b/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go @@ -20,12 +20,3 @@ package sha256 //go:noescape func blockAvx2(h []uint32, message []uint8) - -func blockAvx2Go(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockAvx2(h[:], p[:]) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go index dabf6a71c..eb8a0ff0c 100644 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go +++ b/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go @@ -20,12 +20,3 @@ package sha256 //go:noescape func blockAvx(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) - -func blockAvxGo(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockAvx(h[:], p[:], 0, 0, 0, 0) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} diff --git a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go index f4f093696..54abbb0f0 100644 --- a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go +++ b/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go @@ -20,12 +20,3 @@ package sha256 //go:noescape func blockSsse(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) - -func blockSsseGo(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockSsse(h[:], p[:], 0, 0, 0, 0) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_386.go b/vendor/github.com/minio/sha256-simd/sha256block_386.go new file mode 100644 index 000000000..84b54ae85 --- /dev/null +++ b/vendor/github.com/minio/sha256-simd/sha256block_386.go @@ -0,0 +1,24 @@ +//+build !noasm + +/* + * Minio Cloud Storage, (C) 2016 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sha256 + +func blockArmGo(dig *digest, p []byte) {} +func blockAvx2Go(dig *digest, p []byte) {} +func blockAvxGo(dig *digest, p []byte) {} +func blockSsseGo(dig *digest, p []byte) {} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_amd64.go b/vendor/github.com/minio/sha256-simd/sha256block_amd64.go index 68d892767..b6db61e3f 100644 --- a/vendor/github.com/minio/sha256-simd/sha256block_amd64.go +++ b/vendor/github.com/minio/sha256-simd/sha256block_amd64.go @@ -19,3 +19,30 @@ package sha256 func blockArmGo(dig *digest, p []byte) {} + +func blockAvxGo(dig *digest, p []byte) { + + h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} + + blockAvx(h[:], p[:], 0, 0, 0, 0) + + dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] +} + +func blockAvx2Go(dig *digest, p []byte) { + + h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} + + blockAvx2(h[:], p[:]) + + dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] +} + +func blockSsseGo(dig *digest, p []byte) { + + h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} + + blockSsse(h[:], p[:], 0, 0, 0, 0) + + dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] +} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_arm.go b/vendor/github.com/minio/sha256-simd/sha256block_arm.go new file mode 100644 index 000000000..d892504aa --- /dev/null +++ b/vendor/github.com/minio/sha256-simd/sha256block_arm.go @@ -0,0 +1,24 @@ +//+build !noasm + +/* + * Minio Cloud Storage, (C) 2016 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sha256 + +func blockAvx2Go(dig *digest, p []byte) {} +func blockAvxGo(dig *digest, p []byte) {} +func blockSsseGo(dig *digest, p []byte) {} +func blockArmGo(dig *digest, p []byte) {} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_arm64.go b/vendor/github.com/minio/sha256-simd/sha256block_arm64.go index 15a57e6af..299cf3366 100644 --- a/vendor/github.com/minio/sha256-simd/sha256block_arm64.go +++ b/vendor/github.com/minio/sha256-simd/sha256block_arm64.go @@ -19,7 +19,7 @@ package sha256 func blockAvx2Go(dig *digest, p []byte) {} -func blockAvxGo(dig *digest, p []byte) {} +func blockAvxGo(dig *digest, p []byte) {} func blockSsseGo(dig *digest, p []byte) {} //go:noescape diff --git a/vendor/vendor.json b/vendor/vendor.json index 8a1cadb5a..bbd46d62c 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -119,10 +119,10 @@ "revisionTime": "2016-07-24T00:05:56Z" }, { - "checksumSHA1": "pGgL9xre+/LmNfZV7rNE8uyAovQ=", + "checksumSHA1": "i8Hl0yGP1jqorMgfFMoJCItnI38=", "path": "github.com/minio/sha256-simd", - "revision": "8058cafa697e657caa0beb136bd3cbda50fc4496", - "revisionTime": "2016-07-28T21:10:57Z" + "revision": "6f50cd1d784b2bea46167b6929f16c0d12eefbfb", + "revisionTime": "2016-08-16T22:25:11Z" }, { "path": "github.com/pkg/profile",