Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SecureChannel] Update Check-In Protocol Test vectors #33272

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/protocols/secure_channel/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ import("${chip_root}/src/app/icd/icd.gni")

chip_test_suite("tests") {
output_name = "libSecureChannelTests"
test_sources = [ "TestCheckInCounter.cpp" ]

test_sources = [
"TestCheckInCounter.cpp",
"TestCheckinMsg.cpp",
]

sources = [ "CheckIn_Message_test_vectors.h" ]

cflags = [ "-Wconversion" ]
public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/protocols/secure_channel",
"${chip_root}/src/protocols/secure_channel:check-in-counter",
"${dir_pw_unit_test}",
]
Expand All @@ -25,7 +34,6 @@ chip_test_suite_using_nltest("tests_nltest") {

test_sources = [
"TestCASESession.cpp",
"TestCheckinMsg.cpp",
"TestDefaultSessionResumptionStorage.cpp",
"TestPASESession.cpp",
"TestPairingSession.cpp",
Expand All @@ -36,11 +44,7 @@ chip_test_suite_using_nltest("tests_nltest") {
# "TestMessageCounterManager.cpp",
]

sources = [ "CheckIn_Message_test_vectors.h" ]

public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/crypto/tests:tests.lib",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
Expand Down
47 changes: 24 additions & 23 deletions src/protocols/secure_channel/tests/CheckIn_Message_test_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,20 @@ const CheckIn_Message_test_vector vector3 = { .key = kKey3,

const uint8_t kKey4[] = { 0xca, 0x67, 0xd4, 0x1f, 0xf7, 0x11, 0x29, 0x10, 0xfd, 0xd1, 0x8a, 0x1b, 0xf9, 0x9e, 0xa9, 0x74 };

const uint8_t kApplicationData4[] = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61,
0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x75, 0x65, 0x72 };
const uint8_t kApplicationData4[] = {
0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72
};

const uint8_t kNonce4[] = { 0x7a, 0x97, 0x72, 0x24, 0x3c, 0x97, 0xc8, 0x7d, 0x5f, 0x3a, 0x31, 0xc4, 0xe6 };

const uint8_t kCiphertext4[] = { 0xdb, 0xbc, 0x1a, 0xa5, 0x66, 0xc4, 0x43, 0xc2, 0x05, 0x86, 0x06,
0x6b, 0x42, 0x7b, 0xfc, 0xaa, 0xad, 0x78, 0xca, 0x5d, 0xad };
const uint8_t kCiphertext4[] = { 0xdb, 0xbc, 0x1a, 0xa5, 0x66, 0xc4, 0x43, 0xc2, 0x05, 0x86,
0x06, 0x6b, 0x42, 0x7b, 0xfc, 0xaa, 0xad, 0x78, 0xda, 0x4a };

const uint8_t kMic4[] = { 0x3d, 0x79, 0x78, 0xf7, 0x04, 0xe6, 0x30, 0xac, 0x04, 0x3f, 0xbf, 0xaa, 0x81, 0x25, 0xb2, 0xac };
const uint8_t kMic4[] = { 0x10, 0x5a, 0x13, 0x42, 0xad, 0xbf, 0x3f, 0x47, 0x98, 0xcd, 0x81, 0xb9, 0xef, 0x97, 0xbb, 0xb7 };

const uint8_t kPayload4[] = { 0x7a, 0x97, 0x72, 0x24, 0x3c, 0x97, 0xc8, 0x7d, 0x5f, 0x3a, 0x31, 0xc4, 0xe6, 0xdb, 0xbc, 0x1a, 0xa5,
0x66, 0xc4, 0x43, 0xc2, 0x05, 0x86, 0x06, 0x6b, 0x42, 0x7b, 0xfc, 0xaa, 0xad, 0x78, 0xca, 0x5d, 0xad,
0x3d, 0x79, 0x78, 0xf7, 0x04, 0xe6, 0x30, 0xac, 0x04, 0x3f, 0xbf, 0xaa, 0x81, 0x25, 0xb2, 0xac };
0x66, 0xc4, 0x43, 0xc2, 0x05, 0x86, 0x06, 0x6b, 0x42, 0x7b, 0xfc, 0xaa, 0xad, 0x78, 0xda, 0x4a, 0x10,
0x5a, 0x13, 0x42, 0xad, 0xbf, 0x3f, 0x47, 0x98, 0xcd, 0x81, 0xb9, 0xef, 0x97, 0xbb, 0xb7 };

const CheckIn_Message_test_vector vector4 = { .key = kKey4,
.key_len = sizeof(kKey4),
Expand All @@ -178,19 +179,19 @@ const CheckIn_Message_test_vector vector4 = { .key = kKey4,
const uint8_t kKey5[] = { 0xca, 0x67, 0xd4, 0x1f, 0xf7, 0x11, 0x29, 0x10, 0xfd, 0xd1, 0x8a, 0x1b, 0xf9, 0x9e, 0xa9, 0x74 };

const uint8_t kApplicationData5[] = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x6f,
0x6e, 0x67, 0x75, 0x65, 0x72, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67 };
0x6e, 0x67, 0x65, 0x72, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67 };

const uint8_t kNonce5[] = { 0x06, 0x34, 0x67, 0x6e, 0xa6, 0xe0, 0x70, 0x7b, 0x7a, 0xd7, 0x81, 0x4f, 0xf8 };

const uint8_t kCiphertext5[] = { 0x2e, 0x5b, 0x18, 0xd1, 0x9a, 0x23, 0xb2, 0xe4, 0xfa, 0xdf, 0x82, 0x92, 0x53, 0x51,
0x7f, 0xf3, 0xc9, 0x1d, 0x9d, 0x50, 0xd6, 0x62, 0x5d, 0x18, 0x29, 0x0f, 0xb1, 0x21 };
0x7f, 0xf3, 0xc9, 0x1d, 0x8d, 0x47, 0x84, 0x31, 0x5a, 0x1e, 0x32, 0x08, 0xb8 };

const uint8_t kMic5[] = { 0x8b, 0x5d, 0xef, 0x99, 0x65, 0xb4, 0xdc, 0x3a, 0x87, 0x25, 0xc2, 0xeb, 0x2e, 0x18, 0x25, 0x98 };
const uint8_t kMic5[] = { 0xec, 0xf6, 0x11, 0x8b, 0x02, 0x1a, 0x5a, 0x4c, 0xd4, 0xe9, 0xd4, 0x13, 0x8d, 0xff, 0x29, 0x71 };

const uint8_t kPayload5[] = { 0x06, 0x34, 0x67, 0x6e, 0xa6, 0xe0, 0x70, 0x7b, 0x7a, 0xd7, 0x81, 0x4f, 0xf8, 0x2e, 0x5b,
0x18, 0xd1, 0x9a, 0x23, 0xb2, 0xe4, 0xfa, 0xdf, 0x82, 0x92, 0x53, 0x51, 0x7f, 0xf3, 0xc9,
0x1d, 0x9d, 0x50, 0xd6, 0x62, 0x5d, 0x18, 0x29, 0x0f, 0xb1, 0x21, 0x8b, 0x5d, 0xef, 0x99,
0x65, 0xb4, 0xdc, 0x3a, 0x87, 0x25, 0xc2, 0xeb, 0x2e, 0x18, 0x25, 0x98 };
const uint8_t kPayload5[] = { 0x06, 0x34, 0x67, 0x6e, 0xa6, 0xe0, 0x70, 0x7b, 0x7a, 0xd7, 0x81, 0x4f, 0xf8, 0x2e,
0x5b, 0x18, 0xd1, 0x9a, 0x23, 0xb2, 0xe4, 0xfa, 0xdf, 0x82, 0x92, 0x53, 0x51, 0x7f,
0xf3, 0xc9, 0x1d, 0x8d, 0x47, 0x84, 0x31, 0x5a, 0x1e, 0x32, 0x08, 0xb8, 0xec, 0xf6,
0x11, 0x8b, 0x02, 0x1a, 0x5a, 0x4c, 0xd4, 0xe9, 0xd4, 0x13, 0x8d, 0xff, 0x29, 0x71 };

const CheckIn_Message_test_vector vector5 = { .key = kKey5,
.key_len = sizeof(kKey5),
Expand All @@ -216,25 +217,25 @@ const uint8_t kInvalidNonceKey[] = {
0xca, 0x67, 0xd4, 0x1f, 0xf7, 0x11, 0x29, 0x10, 0xfd, 0xd1, 0x8a, 0x1b, 0xf9, 0x9e, 0xa9, 0x74
};

const uint8_t kInvalidNonceApplicationData[] = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6c,
0x6f, 0x6e, 0x67, 0x75, 0x65, 0x72, 0x20, 0x6c, 0x6f, 0x6e, 0x67,
0x75, 0x65, 0x72, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67 };
const uint8_t kInvalidNonceApplicationData[] = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20,
0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x20, 0x6c, 0x6f, 0x6e,
0x67, 0x65, 0x72, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67 };

const uint8_t kInvalidNonceNonce[] = { 0x06, 0x34, 0x67, 0x6e, 0xa6, 0xe0, 0x70, 0x7b, 0x7a, 0xd7, 0x81, 0x4f, 0xf8 };

const uint8_t kInvalidNonceCiphertext[] = { 0x29, 0x5b, 0x18, 0xd1, 0x9a, 0x23, 0xb2, 0xe4, 0xfa, 0xdf, 0x82, 0x92,
0x53, 0x51, 0x7f, 0xf3, 0xc9, 0x1d, 0x9d, 0x50, 0xd6, 0x62, 0x42, 0x03,
0x35, 0x01, 0xaa, 0x23, 0xad, 0x19, 0xcb, 0x6f, 0x5b, 0xee, 0x56, 0xb3 };
0x53, 0x51, 0x7f, 0xf3, 0xc9, 0x1d, 0x8d, 0x47, 0x84, 0x2e, 0x41, 0x02,
0x3c, 0x03, 0xad, 0x66, 0xac, 0x4d, 0xca, 0x72, 0x47, 0xe0 };

const uint8_t kInvalidNonceMic[] = {
0xd5, 0x8a, 0x92, 0x2b, 0x66, 0x44, 0x89, 0x3e, 0x66, 0x31, 0x8b, 0xb5, 0x53, 0x79, 0x24, 0x8b
0xe4, 0xc6, 0x6b, 0xd9, 0xd3, 0x99, 0x13, 0xe2, 0x3d, 0x82, 0x32, 0xb9, 0x61, 0xfa, 0x92, 0x26
};

const uint8_t kInvalidNoncePayload[] = { 0x06, 0x34, 0x67, 0x6e, 0xa6, 0xe0, 0x70, 0x7b, 0x7a, 0xd7, 0x81, 0x4f, 0xf8,
0x29, 0x5b, 0x18, 0xd1, 0x9a, 0x23, 0xb2, 0xe4, 0xfa, 0xdf, 0x82, 0x92, 0x53,
0x51, 0x7f, 0xf3, 0xc9, 0x1d, 0x9d, 0x50, 0xd6, 0x62, 0x42, 0x03, 0x35, 0x01,
0xaa, 0x23, 0xad, 0x19, 0xcb, 0x6f, 0x5b, 0xee, 0x56, 0xb3, 0xd5, 0x8a, 0x92,
0x2b, 0x66, 0x44, 0x89, 0x3e, 0x66, 0x31, 0x8b, 0xb5, 0x53, 0x79, 0x24, 0x8b };
0x51, 0x7f, 0xf3, 0xc9, 0x1d, 0x8d, 0x47, 0x84, 0x2e, 0x41, 0x02, 0x3c, 0x03,
0xad, 0x66, 0xac, 0x4d, 0xca, 0x72, 0x47, 0xe0, 0xe4, 0xc6, 0x6b, 0xd9, 0xd3,
0x99, 0x13, 0xe2, 0x3d, 0x82, 0x32, 0xb9, 0x61, 0xfa, 0x92, 0x26 };

const CheckIn_Message_test_vector invalidNonceVector = { .key = kInvalidNonceKey,
.key_len = sizeof(kInvalidNonceKey),
Expand Down
Loading
Loading