Package list golang-github-minio-sha256-simd / 7afc6ba
Updated version 0.0~git20161219.0.e82e73b from 'upstream/0.0_git20161219.0.e82e73b' with Debian dir 037f7597145c53780956efc415568fb9c64d6388 Alexandre Viau 4 years ago
6 changed file(s) with 87 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
+0
-1
.gitignore less more
0 .pc
2727 }
2828
2929 func haveArmSha() bool {
30 // TODO: Implement feature detection for ARM
31 return true
30 return false
3231 }
+0
-33
cpuid_arm64.go less more
0 // Minio Cloud Storage, (C) 2016 Minio, Inc.
1 //
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 //
14
15 package sha256
16
17 func cpuid(op uint32) (eax, ebx, ecx, edx uint32) {
18 return 0, 0, 0, 0
19 }
20
21 func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) {
22 return 0, 0, 0, 0
23 }
24
25 func xgetbv(index uint32) (eax, edx uint32) {
26 return 0, 0
27 }
28
29 func haveArmSha() bool {
30 // TODO: Implement feature detection for ARM
31 return true
32 }
0 // +build arm64,linux
1
2 // Minio Cloud Storage, (C) 2016 Minio, Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 package sha256
18
19 import (
20 "bytes"
21 "io/ioutil"
22 )
23
24 func cpuid(op uint32) (eax, ebx, ecx, edx uint32) {
25 return 0, 0, 0, 0
26 }
27
28 func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) {
29 return 0, 0, 0, 0
30 }
31
32 func xgetbv(index uint32) (eax, edx uint32) {
33 return 0, 0
34 }
35
36 // File to check for cpu capabilities.
37 const procCPUInfo = "/proc/cpuinfo"
38
39 // Feature to check for.
40 const sha256Feature = "sha2"
41
42 func haveArmSha() bool {
43 cpuInfo, err := ioutil.ReadFile(procCPUInfo)
44 if err != nil {
45 return false
46 }
47 return bytes.Contains(cpuInfo, []byte(sha256Feature))
48 }
0 // +build arm64,!linux
1
2 // Minio Cloud Storage, (C) 2016 Minio, Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 package sha256
18
19 func cpuid(op uint32) (eax, ebx, ecx, edx uint32) {
20 return 0, 0, 0, 0
21 }
22
23 func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) {
24 return 0, 0, 0, 0
25 }
26
27 func xgetbv(index uint32) (eax, edx uint32) {
28 return 0, 0
29 }
30
31 // Check for sha2 instruction flag.
32 func haveArmSha() bool {
33 return false
34 }
8888 d.Reset()
8989 return d
9090 }
91 // default back to the standard golang implementation
91 // Fallback to the standard golang implementation
92 // if no features were found.
9293 return sha256.New()
9394 }
9495