/* ARGSUSED */ void random_yarrow_deinit(void) { struct harvest *np; enum esource e; /* Deregister the randomness harvesting routine */ random_yarrow_deinit_harvester(); /* * Command the hash/reseed thread to end and wait for it to finish */ random_kthread_control = -1; tsleep((void *)&random_kthread_control, 0, "term", 0); /* Destroy the harvest fifos */ while (!STAILQ_EMPTY(&emptyfifo.head)) { np = STAILQ_FIRST(&emptyfifo.head); STAILQ_REMOVE_HEAD(&emptyfifo.head, next); free(np, M_ENTROPY); } for (e = RANDOM_START; e < ENTROPYSOURCE; e++) { while (!STAILQ_EMPTY(&harvestfifo[e].head)) { np = STAILQ_FIRST(&harvestfifo[e].head); STAILQ_REMOVE_HEAD(&harvestfifo[e].head, next); free(np, M_ENTROPY); } } random_yarrow_deinit_alg(); mtx_destroy(&harvest_mtx); sysctl_ctx_free(&random_clist); }
void randomdev_deinit(void) { /* Deregister the randomness harvesting routine */ randomdev_deinit_harvester(); /* * Command the hash/reseed thread to end and wait for it to finish */ random_kthread_control = -1; tsleep((void *)&random_kthread_control, 0, "term", 0); #if defined(RANDOM_YARROW) random_yarrow_deinit_alg(); #endif #if defined(RANDOM_FORTUNA) random_fortuna_deinit_alg(); #endif sysctl_ctx_free(&random_clist); }