virDomainSEVDefFormat(virBufferPtr buf, virDomainSEVDefPtr sev)
{
    if (!sev)
        return;

    virBufferAsprintf(buf, "<launchSecurity type='%s'>\n",
                      virDomainLaunchSecurityTypeToString(sev->sectype));
    virBufferAdjustIndent(buf, 2);

    virBufferAsprintf(buf, "<cbitpos>%d</cbitpos>\n", sev->cbitpos);
    virBufferAsprintf(buf, "<reducedPhysBits>%d</reducedPhysBits>\n",
                      sev->reduced_phys_bits);
    virBufferAsprintf(buf, "<policy>0x%04x</policy>\n", sev->policy);
    if (sev->dh_cert)
        virBufferEscapeString(buf, "<dhCert>%s</dhCert>\n", sev->dh_cert);

    if (sev->session)
        virBufferEscapeString(buf, "<session>%s</session>\n", sev->session);

    virBufferAdjustIndent(buf, -2);
    virBufferAddLit(buf, "</launchSecurity>\n");
}
virDomainSEVDefFormat(virBufferPtr buf, virDomainSEVDefPtr sev)
{
    if (!sev)
        return;

    virBufferAsprintf(buf, "<launchSecurity type='%s'>\n",
                      virDomainLaunchSecurityTypeToString(sev->sectype));
    virBufferAdjustIndent(buf, 2);

    virBufferAsprintf(buf, "<cbitpos>%d</cbitpos>\n", sev->cbitpos);
    virBufferAsprintf(buf, "<reducedPhysBits>%d</reducedPhysBits>\n",
                      sev->reduced_phys_bits);
    virBufferAsprintf(buf, "<policy>0x%04x</policy>\n", sev->policy);
    if (sev->dh_cert)
        virBufferEscapeString(buf, "<dhCert>%s</dhCert>\n", sev->dh_cert);

    if (sev->session)
        virBufferEscapeString(buf, "<session>%s</session>\n", sev->session);

    virBufferAdjustIndent(buf, -2);
    virBufferAddLit(buf, "</launchSecurity>\n");
}