Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 1 | // Copyright 2015 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 | |
Robert Sloan | 6f79a50 | 2017-04-03 09:16:40 -0700 | [diff] [blame] | 5 | // +build arm,!gccgo,!appengine,!nacl |
Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 6 | |
| 7 | package poly1305 |
| 8 | |
Robert Sloan | 6f79a50 | 2017-04-03 09:16:40 -0700 | [diff] [blame] | 9 | // This function is implemented in sum_arm.s |
Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 10 | //go:noescape |
Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 11 | func poly1305_auth_armv6(out *[16]byte, m *byte, mlen uint32, key *[32]byte) |
| 12 | |
| 13 | // Sum generates an authenticator for m using a one-time key and puts the |
| 14 | // 16-byte result into out. Authenticating two different messages with the same |
| 15 | // key allows an attacker to forge messages at will. |
| 16 | func Sum(out *[16]byte, m []byte, key *[32]byte) { |
| 17 | var mPtr *byte |
| 18 | if len(m) > 0 { |
| 19 | mPtr = &m[0] |
| 20 | } |
| 21 | poly1305_auth_armv6(out, mPtr, uint32(len(m)), key) |
| 22 | } |