<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 06/06/2018 09:08 PM, bushuanshuan
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:D237CD4C63C62845B60C4EC54378105D216D34E1@dggemi509-mbs.china.huawei.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:\5B8B\4F53;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@\5B8B\4F53";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +static int<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+qemuExtTPMStartEmulator(virQEMUDriverPtr driver,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+ virDomainDefPtr def,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+ qemuDomainLogContextPtr logCtxt)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + if (!(cmd =
qemuTPMEmulatorBuildCommand(tpm, def->name, def->uuid,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+
driver->privileged,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+
cfg->swtpm_user,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+
cfg->swtpm_group)))<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + goto
cleanup;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + if
(qemuExtDeviceLogCommand(logCtxt, cmd, "TPM Emulator") <
0)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + goto
cleanup;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +
virCommandSetErrorBuffer(cmd, &errbuf);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + if
(virCommandRun(cmd, &exitstatus) < 0 || exitstatus !=
0) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> +
virReportError(VIR_ERR_INTERNAL_ERROR,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+ _("Could not start 'swtpm'.
exitstatus: %d, "<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">>
+ "error: %s"), exitstatus, errbuf);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + goto
cleanup;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> + }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Now that the sensitive
data in NVRAM need to be protected, it might be a feasible
way that swtpm uses the 'key' to encrypt it when VM
shutdown.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I wonder why don't use
the key when swtpm process is launched here.
</span></p>
</div>
</blockquote>
<br>
Adding support for vTPM state encryption can be added later on, but
then only be used for newly created vTPMs (those that are not
encyrpted remain not encrypted).<br>
<br>
<blockquote type="cite"
cite="mid:D237CD4C63C62845B60C4EC54378105D216D34E1@dggemi509-mbs.china.huawei.com">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Of course, we should
avoid to let the key exposed in system log when we design
the encryption scheme.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Another question is:
where we can store the key securely. Maybe physical TPM can
help this.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">What do you think about
this question?</span></p>
</div>
</blockquote>
<br>
libvirt supports 'secrets' and they could be encrypted by a TPM. So
far I think they are primarily protected through file access control
bits.<br>
<br>
Stefan<br>
<br>
<blockquote type="cite"
cite="mid:D237CD4C63C62845B60C4EC54378105D216D34E1@dggemi509-mbs.china.huawei.com">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Shuanshuan Bu<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>