sum_amd64.go 650 B

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