fixed up typos from fixing goling stuff

This commit is contained in:
Derek McQuay 2016-03-12 21:04:16 -08:00
parent 878a06980c
commit 4de75d2080
2 changed files with 18 additions and 18 deletions

View File

@ -464,7 +464,7 @@ func xtime(cur byte) []byte {
return bytes
}
func ffmutl(cur []byte, multiplier byte) byte {
func ffmult(cur []byte, multiplier byte) byte {
if multiplier == 1 {
return cur[0]
} else if multiplier == 2 {
@ -484,10 +484,10 @@ func ffmutl(cur []byte, multiplier byte) byte {
}
func mixColumnsAssist(cur []byte) []byte {
a1 := ffmutl(xtime(cur[0]), mm[0]) ^ ffmutl(xtime(cur[1]), mm[1]) ^ ffmutl(xtime(cur[2]), mm[2]) ^ ffmutl(xtime(cur[3]), mm[3])
a2 := ffmutl(xtime(cur[0]), mm[4]) ^ ffmutl(xtime(cur[1]), mm[5]) ^ ffmutl(xtime(cur[2]), mm[6]) ^ ffmutl(xtime(cur[3]), mm[7])
a3 := ffmutl(xtime(cur[0]), mm[8]) ^ ffmutl(xtime(cur[1]), mm[9]) ^ ffmutl(xtime(cur[2]), mm[10]) ^ ffmutl(xtime(cur[3]), mm[11])
a4 := ffmutl(xtime(cur[0]), mm[12]) ^ ffmutl(xtime(cur[1]), mm[13]) ^ ffmutl(xtime(cur[2]), mm[14]) ^ ffmutl(xtime(cur[3]), mm[15])
a1 := ffmult(xtime(cur[0]), mm[0]) ^ ffmult(xtime(cur[1]), mm[1]) ^ ffmult(xtime(cur[2]), mm[2]) ^ ffmult(xtime(cur[3]), mm[3])
a2 := ffmult(xtime(cur[0]), mm[4]) ^ ffmult(xtime(cur[1]), mm[5]) ^ ffmult(xtime(cur[2]), mm[6]) ^ ffmult(xtime(cur[3]), mm[7])
a3 := ffmult(xtime(cur[0]), mm[8]) ^ ffmult(xtime(cur[1]), mm[9]) ^ ffmult(xtime(cur[2]), mm[10]) ^ ffmult(xtime(cur[3]), mm[11])
a4 := ffmult(xtime(cur[0]), mm[12]) ^ ffmult(xtime(cur[1]), mm[13]) ^ ffmult(xtime(cur[2]), mm[14]) ^ ffmult(xtime(cur[3]), mm[15])
return []byte{a1, a2, a3, a4}
}
@ -528,10 +528,10 @@ func invMixColumns(cur Block) Block {
}
func invMixColumnsAssist(cur []byte) []byte {
a1 := ffmutl(xtime(cur[0]), iMM[0]) ^ ffmutl(xtime(cur[1]), iMM[1]) ^ ffmutl(xtime(cur[2]), iMM[2]) ^ ffmutl(xtime(cur[3]), iMM[3])
a2 := ffmutl(xtime(cur[0]), iMM[4]) ^ ffmutl(xtime(cur[1]), iMM[5]) ^ ffmutl(xtime(cur[2]), iMM[6]) ^ ffmutl(xtime(cur[3]), iMM[7])
a3 := ffmutl(xtime(cur[0]), iMM[8]) ^ ffmutl(xtime(cur[1]), iMM[9]) ^ ffmutl(xtime(cur[2]), iMM[10]) ^ ffmutl(xtime(cur[3]), iMM[11])
a4 := ffmutl(xtime(cur[0]), iMM[12]) ^ ffmutl(xtime(cur[1]), iMM[13]) ^ ffmutl(xtime(cur[2]), iMM[14]) ^ ffmutl(xtime(cur[3]), iMM[15])
a1 := ffmult(xtime(cur[0]), iMM[0]) ^ ffmult(xtime(cur[1]), iMM[1]) ^ ffmult(xtime(cur[2]), iMM[2]) ^ ffmult(xtime(cur[3]), iMM[3])
a2 := ffmult(xtime(cur[0]), iMM[4]) ^ ffmult(xtime(cur[1]), iMM[5]) ^ ffmult(xtime(cur[2]), iMM[6]) ^ ffmult(xtime(cur[3]), iMM[7])
a3 := ffmult(xtime(cur[0]), iMM[8]) ^ ffmult(xtime(cur[1]), iMM[9]) ^ ffmult(xtime(cur[2]), iMM[10]) ^ ffmult(xtime(cur[3]), iMM[11])
a4 := ffmult(xtime(cur[0]), iMM[12]) ^ ffmult(xtime(cur[1]), iMM[13]) ^ ffmult(xtime(cur[2]), iMM[14]) ^ ffmult(xtime(cur[3]), iMM[15])
return []byte{a1, a2, a3, a4}
}

View File

@ -18,7 +18,7 @@ func TestShiftRows(t *testing.T) {
10, 11, 8, 9,
15, 12, 13, 14,
}
actual := ShiftRows(input)
actual := shiftRows(input)
if !bytes.Equal(expected, actual) {
t.Errorf(
"failed to get right ShiftRows:\n\texpected: % x\n\t actual: % x",
@ -42,7 +42,7 @@ func TestSubBytes(t *testing.T) {
0x11, 0x98, 0x5d, 0x52,
0xae, 0xf1, 0xe5, 0x30,
}
actual := SubBytes(input)
actual := subBytes(input)
if !bytes.Equal(expected, actual) {
t.Errorf(
"failed to get right ShiftRows:\n\texpected: % x\n\t actual: % x",
@ -56,7 +56,7 @@ func TestSplitBytes(t *testing.T) {
input := byte(0xab)
expected1 := byte(0xa)
expected2 := byte(0xb)
actual1, actual2 := SplitBytes(input)
actual1, actual2 := splitBytes(input)
if expected1 != actual1 || expected2 != actual2 {
t.Errorf(
"failed to get SplitBytes:\n\texpected: 0x%x 0x%x\n\t actual: 0x%x 0x%x",
@ -74,7 +74,7 @@ func TestXtime(t *testing.T) {
0x14, 0x28, 0x50, 0xa0,
0x5b, 0xb6, 0x77, 0xee,
}
actual := Xtime(input)
actual := xtime(input)
if !bytes.Equal(expected, actual) {
t.Errorf(
"failed to get Xtime:\n\texpected: % x\n\tactual: % x",
@ -85,13 +85,13 @@ func TestXtime(t *testing.T) {
}
func TestFFmult(t *testing.T) {
input := Xtime(0x14)
input := xtime(0x14)
expected1 := byte(0x14)
expected2 := byte(0x28)
expected3 := byte(0x3c)
actual1 := FFmult(input, 1)
actual2 := FFmult(input, 2)
actual3 := FFmult(input, 3)
actual1 := ffmult(input, 1)
actual2 := ffmult(input, 2)
actual3 := ffmult(input, 3)
if expected1 != actual1 || expected2 != actual2 || expected3 != actual3 {
t.Errorf(
"failed to get FFmult:\n\texpected: 0x% x 0x% x 0x% x\n\t actual:0x% x 0x% x 0x% x",
@ -118,7 +118,7 @@ func TestMixColumns(t *testing.T) {
0xa1, 0x58, 0xbd, 0x01,
0xbc, 0x9d, 0xf8, 0x01,
}
actual := MixColumns(input)
actual := mixColumns(input)
for i := 0; i < 16; i++ {
if actual[i] != expected[i] {
t.Errorf(