LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build amd64,!gccgo | 5 // +build amd64,!gccgo |
6 | 6 |
7 package poly1305 | 7 package poly1305 |
8 | 8 |
9 // This function is implemented in poly1305_amd64.s | 9 // This function is implemented in poly1305_amd64.s |
| 10 |
| 11 //go:noescape |
| 12 |
10 func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte) | 13 func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte) |
11 | 14 |
12 // Sum generates an authenticator for m using a one-time key and puts the | 15 // Sum generates an authenticator for m using a one-time key and puts the |
13 // 16-byte result into out. Authenticating two different messages with the same | 16 // 16-byte result into out. Authenticating two different messages with the same |
14 // key allows an attacker to forge messages at will. | 17 // key allows an attacker to forge messages at will. |
15 func Sum(out *[16]byte, m []byte, key *[32]byte) { | 18 func Sum(out *[16]byte, m []byte, key *[32]byte) { |
16 var mPtr *byte | 19 var mPtr *byte |
17 if len(m) > 0 { | 20 if len(m) > 0 { |
18 mPtr = &m[0] | 21 mPtr = &m[0] |
19 } | 22 } |
20 poly1305(out, mPtr, uint64(len(m)), key) | 23 poly1305(out, mPtr, uint64(len(m)), key) |
21 } | 24 } |
LEFT | RIGHT |