vendor: sha256 32bit updated. (#2459)

master
Harshavardhana 8 years ago committed by GitHub
parent 4dec50ba51
commit 0a3d43273f
  1. 2
      Makefile
  2. 33
      vendor/github.com/minio/sha256-simd/cpuid_arm.go
  3. 13
      vendor/github.com/minio/sha256-simd/sha256.go
  4. 9
      vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go
  5. 9
      vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go
  6. 9
      vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go
  7. 24
      vendor/github.com/minio/sha256-simd/sha256block_386.go
  8. 27
      vendor/github.com/minio/sha256-simd/sha256block_amd64.go
  9. 24
      vendor/github.com/minio/sha256-simd/sha256block_arm.go
  10. 2
      vendor/github.com/minio/sha256-simd/sha256block_arm64.go
  11. 6
      vendor/vendor.json

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save