You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
936 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build amd64,!gccgo,!appengine
  5. package blake2s
  6. var (
  7. useSSE4 = supportSSE4()
  8. useSSSE3 = supportSSSE3()
  9. useSSE2 = true // Always available on amd64
  10. useGeneric = false
  11. )
  12. //go:noescape
  13. func supportSSSE3() bool
  14. //go:noescape
  15. func supportSSE4() bool
  16. //go:noescape
  17. func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  18. //go:noescape
  19. func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  20. //go:noescape
  21. func hashBlocksSSE4(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  22. func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
  23. if useSSE4 {
  24. hashBlocksSSE4(h, c, flag, blocks)
  25. } else if useSSSE3 {
  26. hashBlocksSSSE3(h, c, flag, blocks)
  27. } else {
  28. hashBlocksSSE2(h, c, flag, blocks)
  29. }
  30. }