Sorry for the late response but reviewing scf_tmpl.c took longer than I expected. Just a few minor comments.
-tony scf_tmpl.c: 1068 - Isn't this a redundant assertion? 1956 - Shouldn't this assertion be done prior to obtaining the handle? 4198 - Need to free(encoded)? 5067, 5071 and others - We don't need to set these to NULL, do we?