/*---------------------------------------------------------------------------*/ static void send_helloack(void *ptr) { struct akes_nbr_entry *entry; uint8_t challenges[2 * AKES_NBR_CHALLENGE_LEN]; uint8_t *secret; PRINTF("akes: Sending HELLOACK\n"); entry = (struct akes_nbr_entry *)ptr; akes_nbr_copy_challenge(challenges, entry->tentative->challenge); csprng_rand(challenges + AKES_NBR_CHALLENGE_LEN, AKES_NBR_CHALLENGE_LEN); akes_nbr_copy_challenge(entry->tentative->challenge, challenges + AKES_NBR_CHALLENGE_LEN); /* write payload */ prepare_update_command(entry->permanent ? AKES_HELLOACK_P_IDENTIFIER : AKES_HELLOACK_IDENTIFIER, entry, AKES_NBR_TENTATIVE); /* generate pairwise key */ secret = AKES_SCHEME.get_secret_with_hello_sender(akes_nbr_get_addr(entry)); if(!secret) { PRINTF("akes: No secret with HELLO sender\n"); return; } generate_pairwise_key(challenges, secret); akes_nbr_copy_key(entry->tentative->tentative_pairwise_key, challenges); adaptivesec_send_command_frame(); }
/*---------------------------------------------------------------------------*/ static void init(void) { cmd_broker_init(); #if AKES_NBR_WITH_GROUP_KEYS csprng_rand(adaptivesec_group_key, AKES_NBR_KEY_LEN); #endif /* AKES_NBR_WITH_GROUP_KEYS */ akes_nbr_init(); ADAPTIVESEC_STRATEGY.init(); akes_trickle_start(); }
/*---------------------------------------------------------------------------*/ static void change_hello_challenge(void) { csprng_rand(hello_challenge, AKES_NBR_CHALLENGE_LEN); }