summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-10-03 18:49:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-04 15:52:15 -0700
commit12181aacdeed24db30241c597ea72259900b2e94 (patch)
tree17a857a82fc0c63633c882edd2b110147ab78af0
parent04db902fee7dc7ae615fbb22454dc247a534c1f0 (diff)
downloadchrome-ec-12181aacdeed24db30241c597ea72259900b2e94.tar.gz
common: make rma_auth work with the server
A couple of bugs have crept in with the latest series of patches: - the board ID value endianness does not have to be changed - the test RMA server public key value is wrong BRANCH=cr50 BUG=b:67007905 TEST=the generated challenge is now accepted by the server, and the generated auth code matches between the server and the Cr50. Change-Id: I18f413ab0bcc14d9cc50b115ac3784fdfcd5851c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/700798 Reviewed-by: Michael Tang <ntang@chromium.org>
-rw-r--r--board/cr50/board.h10
-rw-r--r--common/rma_auth.c2
-rw-r--r--test/rma_auth.c5
3 files changed, 6 insertions, 11 deletions
diff --git a/board/cr50/board.h b/board/cr50/board.h
index 4b22ee957f..c576857bb5 100644
--- a/board/cr50/board.h
+++ b/board/cr50/board.h
@@ -350,11 +350,11 @@ enum nvmem_users {
#define CONFIG_RNG
/* Dummy values to be replaced with real ones. */
-#define CONFIG_RMA_AUTH_SERVER_PUBLIC_KEY { \
- 0x47, 0x3b, 0xa5, 0xdb, 0xc4, 0xbb, 0xd6, 0x77, \
- 0x20, 0xbd, 0xd8, 0xbd, 0xc8, 0x7a, 0xbb, 0x07, \
- 0x03, 0x79, 0xba, 0x7b, 0x52, 0x8c, 0xec, 0xb3, \
- 0x4d, 0xaa, 0x69, 0xf5, 0x65, 0xb4, 0x31, 0xad}
+#define CONFIG_RMA_AUTH_SERVER_PUBLIC_KEY { \
+ 0x03, 0xae, 0x2d, 0x2c, 0x06, 0x23, 0xe0, 0x73, \
+ 0x0d, 0xd3, 0xb7, 0x92, 0xac, 0x54, 0xc5, 0xfd, \
+ 0x7e, 0x9c, 0xf0, 0xa8, 0xeb, 0x7e, 0x2a, 0xb5, \
+ 0xdb, 0xf4, 0x79, 0x5f, 0x8a, 0x0f, 0x28, 0x3f}
#define CONFIG_RMA_AUTH_SERVER_KEY_ID 0x10
#endif /* __CROS_EC_BOARD_H */
diff --git a/common/rma_auth.c b/common/rma_auth.c
index ade4e4697b..e7f6db121f 100644
--- a/common/rma_auth.c
+++ b/common/rma_auth.c
@@ -102,8 +102,6 @@ int rma_create_challenge(void)
if (read_board_id(&bid))
return EC_ERROR_UNKNOWN;
- /* The server wants this as a string, not a number. */
- bid.type = htobe32(bid.type);
memcpy(c.board_id, &bid.type, sizeof(c.board_id));
unique_device_id_size = system_get_chip_unique_id(&device_id);
diff --git a/test/rma_auth.c b/test/rma_auth.c
index 1ff0c63ea5..ced910d778 100644
--- a/test/rma_auth.c
+++ b/test/rma_auth.c
@@ -63,7 +63,6 @@ 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)) {
@@ -102,9 +101,7 @@ 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.
*/
- 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))) {
+ if (memcmp(c.board_id, dummy_board_id, sizeof(c.board_id))) {
printf("BoardID mismatch\n");
return -1;
}