Bluetooth: SMP: Add LE SC smp_f4 init test

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

Change-Id: If083d8c9c81b98af97ed900db2004482b3e886e3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-10-29 16:32:29 +01:00 committed by Anas Nashif
commit ce246c1289

View file

@ -2187,6 +2187,36 @@ static int smp_sign_test(void)
return 0;
}
static int smp_f4_test(void)
{
uint8_t u[32] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc,
0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef,
0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e,
0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20 };
uint8_t v[32] = { 0xfd, 0xc5, 0x7f, 0xf4, 0x49, 0xdd, 0x4f, 0x6b,
0xfb, 0x7c, 0x9d, 0xf1, 0xc2, 0x9a, 0xcb, 0x59,
0x2a, 0xe7, 0xd4, 0xee, 0xfb, 0xfc, 0x0a, 0x90,
0x9a, 0xbb, 0xf6, 0x32, 0x3d, 0x8b, 0x18, 0x55 };
uint8_t x[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff,
0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 };
uint8_t z = 0x00;
uint8_t exp[16] = { 0x2d, 0x87, 0x74, 0xa9, 0xbe, 0xa1, 0xed, 0xf1,
0x1c, 0xbd, 0xa9, 0x07, 0xf1, 0x16, 0xc9, 0xf2 };
uint8_t res[16];
int err;
err = smp_f4(u, v, x, z, res);
if (err) {
return err;
}
if (memcmp(res, exp, 16)) {
return -EINVAL;
}
return 0;
}
static int smp_self_test(void)
{
int err;
@ -2203,6 +2233,12 @@ static int smp_self_test(void)
return err;
}
err = smp_f4_test();
if (err) {
BT_ERR("SMP f4 self test failed\n");
return err;
}
return 0;
}
#else