Move ktls.c into the record layer