Bluetooth: SMP: Add LE SC smp_g6 init test
This runs smp_g2 function with test vectors from Core Specification 4.2. Change-Id: I96ef51e9133182a38c3fd007764bdd633d8f9e3f Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
16e7c44fb2
commit
ab81fe9d45
1 changed files with 36 additions and 0 deletions
|
@ -2786,6 +2786,36 @@ static int smp_f6_test(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int smp_g2_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 y[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21,
|
||||
0x6e, 0x5f, 0xa7, 0x25, 0xcc, 0xe7, 0xe8, 0xa6 };
|
||||
uint32_t exp_val = 0x2f9ed5ba % 1000000;
|
||||
uint32_t val;
|
||||
int err;
|
||||
|
||||
err = smp_g2(u, v, x, y, &val);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (val != exp_val) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smp_self_test(void)
|
||||
{
|
||||
int err;
|
||||
|
@ -2820,6 +2850,12 @@ static int smp_self_test(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
err = smp_g2_test();
|
||||
if (err) {
|
||||
BT_ERR("SMP g2 self test failed\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue