diff options
Diffstat (limited to 'satp/crypto-kd_test.go')
-rw-r--r-- | satp/crypto-kd_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/satp/crypto-kd_test.go b/satp/crypto-kd_test.go index 0ba2bf0..1c01fc9 100644 --- a/satp/crypto-kd_test.go +++ b/satp/crypto-kd_test.go @@ -36,20 +36,28 @@ import ( func TestKDGetLabel(t *testing.T) { testvectors := []struct { - dir KeyDirection + role KDRole + dir Direction usage KeyUsage label uint32 }{ - {DirLeft, UsageEncryptKey, 0x356A192B}, - {DirRight, UsageEncryptKey, 0xDA4B9237}, - {DirLeft, UsageEncryptSalt, 0x77DE68DA}, - {DirRight, UsageEncryptSalt, 0x1B645389}, - {DirLeft, UsageAuthKey, 0xAC3478D6}, - {DirRight, UsageAuthKey, 0xC1DFD96E}, + {RoleLeft, Outbound, UsageEncryptKey, 0x356A192B}, + {RoleRight, Outbound, UsageEncryptKey, 0xDA4B9237}, + {RoleAlice, Outbound, UsageEncryptSalt, 0x77DE68DA}, + {RoleBob, Outbound, UsageEncryptSalt, 0x1B645389}, + {RoleServer, Outbound, UsageAuthKey, 0xAC3478D6}, + {RoleClient, Outbound, UsageAuthKey, 0xC1DFD96E}, + + {RoleAlice, Inbound, UsageEncryptKey, 0xDA4B9237}, + {RoleBob, Inbound, UsageEncryptKey, 0x356A192B}, + {RoleServer, Inbound, UsageEncryptSalt, 0x1B645389}, + {RoleClient, Inbound, UsageEncryptSalt, 0x77DE68DA}, + {RoleLeft, Inbound, UsageAuthKey, 0xC1DFD96E}, + {RoleRight, Inbound, UsageAuthKey, 0xAC3478D6}, } for _, vector := range testvectors { - label := getKDLabel(vector.dir, vector.usage) + label := getKDLabel(vector.role, vector.dir, vector.usage) if label != vector.label { t.Fatalf("returned label is invalid, is: 0x%08X, should be 0x%08X", label, vector.label) } |