mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-03 10:20:18 +00:00
test/sm: fix g2 calculation
This commit is contained in:
parent
a348424464
commit
4a4069a0a0
@ -290,7 +290,7 @@ static uint32_t g2(const sm_key256_t u, const sm_key256_t v, const sm_key_t x, c
|
|||||||
memcpy(buffer+64, y, 16);
|
memcpy(buffer+64, y, 16);
|
||||||
sm_key_t cmac;
|
sm_key_t cmac;
|
||||||
aes_cmac(cmac, x, buffer, sizeof(buffer));
|
aes_cmac(cmac, x, buffer, sizeof(buffer));
|
||||||
return big_endian_read_32(buffer, 12);
|
return big_endian_read_32(cmac, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
// h6(W, keyID) = AES-CMACW(keyID)
|
// h6(W, keyID) = AES-CMACW(keyID)
|
||||||
@ -395,7 +395,7 @@ int main(void){
|
|||||||
uint8_t g2_res_buffer[4];
|
uint8_t g2_res_buffer[4];
|
||||||
parse_hex(g2_res_buffer, g2_res_string);
|
parse_hex(g2_res_buffer, g2_res_string);
|
||||||
uint32_t g2_res = big_endian_read_32(g2_res_buffer, 0);
|
uint32_t g2_res = big_endian_read_32(g2_res_buffer, 0);
|
||||||
if (g2_test == g2_res){
|
if (g2_test != g2_res){
|
||||||
printf("G2 incorrect!\n");
|
printf("G2 incorrect!\n");
|
||||||
} else {
|
} else {
|
||||||
printf("G2 correct!\n");
|
printf("G2 correct!\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user