consistently rename signature to mac

This commit is contained in:
Florian Weingarten committed 2015-04-30 13:41:50 -04:00
1 parent c500b94216
commit 90e6a8eb86
5 files changed
+79 -76

No files matched your search

+5 -5
View File
@@ -45,10 +45,10 @@ var poly1305_tests = []struct {
func TestPoly1305(t *testing.T) {
for _, test := range poly1305_tests {
key := &SigningKey{}
key := &MACKey{}
copy(key.K[:], test.k)
copy(key.R[:], test.r)
mac := poly1305Sign(test.msg, test.nonce, key)
mac := poly1305MAC(test.msg, test.nonce, key)
if !bytes.Equal(mac, test.mac) {
t.Fatalf("wrong mac calculated, want: %02x, got: %02x", test.mac, mac)
@@ -62,7 +62,7 @@ func TestPoly1305(t *testing.T) {
var testValues = []struct {
ekey EncryptionKey
skey SigningKey
skey MACKey
ciphertext []byte
plaintext []byte
}{
@@ -71,7 +71,7 @@ var testValues = []struct {
0x30, 0x3e, 0x86, 0x87, 0xb1, 0xd7, 0xdb, 0x18, 0x42, 0x1b, 0xdc, 0x6b, 0xb8, 0x58, 0x8c, 0xca,
0xda, 0xc4, 0xd5, 0x9e, 0xe8, 0x7b, 0x8f, 0xf7, 0x0c, 0x44, 0xe6, 0x35, 0x79, 0x0c, 0xaf, 0xef,
}),
skey: SigningKey{
skey: MACKey{
K: [...]byte{0xef, 0x4d, 0x88, 0x24, 0xcb, 0x80, 0xb2, 0xbc, 0xc5, 0xfb, 0xff, 0x8a, 0x9b, 0x12, 0xa4, 0x2c},
R: [...]byte{0xcc, 0x8d, 0x4b, 0x94, 0x8e, 0xe0, 0xeb, 0xfe, 0x1d, 0x41, 0x5d, 0xe9, 0x21, 0xd1, 0x03, 0x53},
},
@@ -91,7 +91,7 @@ func TestCrypto(t *testing.T) {
// test encryption
k := &Key{
Encrypt: tv.ekey,
Sign: tv.skey,
MAC: tv.skey,
}
msg, err := Encrypt(k, msg, tv.plaintext)