swtpm_setup: Refactor duplicate code into swtpm_tpm2_write_cert_nvram

Also rename the variable purpose to certtype since this better describes
what it is.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
1 file changed