vendor: sha256 32bit updated. (#2459)

This commit is contained in:
Harshavardhana 2016-08-16 16:19:29 -07:00 committed by GitHub
parent 4dec50ba51
commit 0a3d43273f
11 changed files with 122 additions and 36 deletions

View File

@ -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

33
vendor/github.com/minio/sha256-simd/cpuid_arm.go generated vendored Normal file
View File

@ -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
}

View File

@ -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()
}
}
// Sum256 - single caller sha256 helper

View File

@ -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]
}

View File

@ -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]
}

View File

@ -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]
}

24
vendor/github.com/minio/sha256-simd/sha256block_386.go generated vendored Normal file
View File

@ -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) {}

View File

@ -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]
}

24
vendor/github.com/minio/sha256-simd/sha256block_arm.go generated vendored Normal file
View File

@ -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) {}

6
vendor/vendor.json vendored
View File

@ -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",