sum_amd64.go 674 B

123456789101112131415161718192021
  1. // Copyright 2012 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
  5. package poly1305
  6. // This function is implemented in poly1305_amd64.s
  7. func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte)
  8. // Sum generates an authenticator for m using a one-time key and puts the
  9. // 16-byte result into out. Authenticating two different messages with the same
  10. // key allows an attacker to forge messages at will.
  11. func Sum(out *[16]byte, m []byte, key *[32]byte) {
  12. var mPtr *byte
  13. if len(m) > 0 {
  14. mPtr = &m[0]
  15. }
  16. poly1305(out, mPtr, uint64(len(m)), key)
  17. }