/*---------------------------------------------------------------------------*/ PROCESS_THREAD(test_mic_process, ev, data) { static struct etimer et; PROCESS_BEGIN(); while(1) { printf("Mic : %d\n",get_mic()); etimer_set(&et, CLOCK_SECOND / 8); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); ; } PROCESS_END(); }
static void test_mic(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2) { krb5_data msg, mic; int32_t val; msg.data = "foo"; msg.length = 3; krb5_data_zero(&mic); val = get_mic(c1, hc1, &msg, &mic); if (val) errx(1, "get_mic failed to host: %s", c1->moniker); val = verify_mic(c2, hc2, &msg, &mic); if (val) errx(1, "verify_mic failed to host: %s", c2->moniker); krb5_data_free(&mic); }