diff options
Diffstat (limited to 'test/rma_auth.c')
-rw-r--r-- | test/rma_auth.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/rma_auth.c b/test/rma_auth.c index d833a2c33b..1ff0c63ea5 100644 --- a/test/rma_auth.c +++ b/test/rma_auth.c @@ -5,6 +5,7 @@ * Test RMA auth challenge/response */ +#include <endian.h> #include <stdio.h> #include "common.h" #include "chip/g/board_id.h" @@ -62,6 +63,7 @@ int rma_server_side(char *out_auth_code, const char *challenge) uint8_t hmac[32]; struct rma_challenge c; uint8_t *cptr = (uint8_t *)&c; + uint32_t inverted_board_id; /* Convert the challenge back into binary */ if (base32_decode(cptr, 8 * sizeof(c), challenge, 9) != 8 * sizeof(c)) { @@ -100,7 +102,9 @@ int rma_server_side(char *out_auth_code, const char *challenge) * Since this is just a test, here we'll just make sure the BoardID * and DeviceID match what we expected. */ - if (memcmp(c.board_id, dummy_board_id, sizeof(c.board_id))) { + memcpy(&inverted_board_id, dummy_board_id, sizeof(inverted_board_id)); + inverted_board_id = be32toh(inverted_board_id); + if (memcmp(c.board_id, &inverted_board_id, sizeof(c.board_id))) { printf("BoardID mismatch\n"); return -1; } |