Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
Diff: src/d7a_alp.cpp
- Revision:
- 87:9b885d12dbb4
- Parent:
- 84:e5388f1b8ed9
- Child:
- 88:dcebea09aac7
--- a/src/d7a_alp.cpp Fri Jan 06 15:33:26 2017 +0000 +++ b/src/d7a_alp.cpp Mon Mar 13 11:56:35 2017 +0000 @@ -24,12 +24,13 @@ #define ALP_CMD_MAX_LENGHT (256) static uint8_t g_alp_tag; +static uint8_t g_alp_root_key_size; static uint8_t g_alp_buffer[ALP_CMD_MAX_LENGHT]; static UnsolicitedMsgFunction g_alp_uns_msg; static OS_Queue<d7a_com_rx_msg_t, 8> g_alp_pkt_queue; static OS_Queue<d7a_com_rx_msg_t, 8> g_alp_pl_queue; -static OS_Thread g_alp_thread(osPriorityHigh, 512, NULL); +static OS_Thread g_alp_thread(osPriorityHigh, 512, NULL); void d7a_alp_thread(); @@ -37,7 +38,8 @@ { ALP_FPRINT("\r\n"); - g_alp_uns_msg = uns_msg; + g_alp_uns_msg = uns_msg; + g_alp_root_key_size = D7A_ROOT_KEY_SIZE; osStatus err = g_alp_thread.start(d7a_alp_thread); ASSERT(err == osOK, "Failed to start d7a_alp_thread (err: %d)\r\n", err); @@ -344,10 +346,10 @@ *p++ = 42; // Auth protocol ID sha256_init(); sha256_update(req, req_size); - sha256_update((uint8_t*)root_key, D7A_ROOT_KEY_SIZE); + sha256_update((uint8_t*)root_key, g_alp_root_key_size); sha256_final(hash); //PRINT_DATA("Req : ", "%02X ", (uint8_t*)req, req_size, "\r\n"); - //PRINT_DATA("Key : ", "%d ", (uint8_t*)root_key, D7A_ROOT_KEY_SIZE, "\r\n"); + //PRINT_DATA("Key : ", "%d ", (uint8_t*)root_key, g_alp_root_key_size, "\r\n"); //PRINT_DATA("Token: ", "%02X", hash, D7A_AUTH_PROTOCOLE_TOKEN_SIZE, "\r\n"); p += d7a_alp_add(p, hash, D7A_AUTH_PROTOCOLE_TOKEN_SIZE); @@ -635,6 +637,10 @@ return ret; } +void d7a_alp_set_root_key_size(uint8_t size) +{ + g_alp_root_key_size = size; +} void d7a_alp_thread() {