Refactor to move prov stuff to coreprov.c (1/4)