Bluetooth: SMP: Add LE SC smp_f6 init test

This run smp_f6 function with test vectors from Core Specification 4.2.

Change-Id: I6a29be3c8f90ca787d90c957cb6667853e823002
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-11-10 08:45:28 +01:00 committed by Anas Nashif
commit 1ec6ba6d83

View file

@ -2680,6 +2680,36 @@ static int smp_f5_test(void)
return 0;
}
static int smp_f6_test(void)
{
uint8_t w[16] = { 0x20, 0x6e, 0x63, 0xce, 0x20, 0x6a, 0x3f, 0xfd,
0x02, 0x4a, 0x08, 0xa1, 0x76, 0xf1, 0x65, 0x29 };
uint8_t n1[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff,
0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 };
uint8_t n2[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21,
0x6e, 0x5f, 0xa7, 0x25, 0xcc, 0xe7, 0xe8, 0xa6 };
uint8_t r[16] = { 0xc8, 0x0f, 0x2d, 0x0c, 0xd2, 0x42, 0xda, 0x08,
0x54, 0xbb, 0x53, 0xb4, 0x3b, 0x34, 0xa3, 0x12 };
uint8_t io_cap[3] = { 0x02, 0x01, 0x01 };
bt_addr_le_t a1 = { .type = 0x00,
.val = { 0xce, 0xbf, 0x37, 0x37, 0x12, 0x56 } };
bt_addr_le_t a2 = { .type = 0x00,
.val = {0xc1, 0xcf, 0x2d, 0x70, 0x13, 0xa7 } };
uint8_t exp[16] = { 0x61, 0x8f, 0x95, 0xda, 0x09, 0x0b, 0x6c, 0xd2,
0xc5, 0xe8, 0xd0, 0x9c, 0x98, 0x73, 0xc4, 0xe3 };
uint8_t res[16];
int err;
err = smp_f6(w, n1, n2, r, io_cap, &a1, &a2, res);
if (err)
return err;
if (memcmp(res, exp, 16))
return -EINVAL;
return 0;
}
static int smp_self_test(void)
{
int err;
@ -2708,6 +2738,12 @@ static int smp_self_test(void)
return err;
}
err = smp_f6_test();
if (err) {
BT_ERR("SMP f6 self test failed\n");
return err;
}
return 0;
}
#else