[tpm2] Re: How do I use Microsoft's sim (TSS.MSR) with lib tss2-esys
Markus Willhelm Schmid <willhelm.schmid at gmail.com>
| Newsgroups | dev.linux.lists.tpm2 |
|---|---|
| Message-ID | <CAMs2GAoZeLi6H+fGDVY7oCYKB_TWe74ZMEJaReBT-xxiD+8B-Q@mail.gmail.com> |
Markus Willhelm Schmid
11:24 AM (0 minutes ago)
to Kenneth
Thank you Ken, but I am OK just using Microsoft's TPM Simulator.exe, which
I now got working after modifying tpm2-tss/src/util/io.c. The MS simulator
only listens on IPv4 and io.c may fail since the list from getaddrinfo may
return IPv6 address before IPv4 address. I did not look into the logic, I
just did a quick fix:
if (*sock == INVALID_SOCKET
|| p->ai_family != AF_INET) //PATCH MS sim listens on IPv4 only
continue;
On Fri, Mar 11, 2022 at 5:34 AM Kenneth Goldman <kgoldman(a)us.ibm.com> wrote:
> On Thu, 2022-03-10 at 07:44 -0800, Markus Willhelm Schmid wrote:
> > I made an error in my previous email, I pasted in the URL to IBM's TCC
> > stack and not to IBM's SW TPM. This is what I am trying to compile.
> > INVALID URI REMOVED
> > rojects_ibmswtpm2_&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=DZCVG43VcL8GTne
> > MZb8k8lEwb-O1GZktFfre1-mlmiA&m=k6WL9yJ4ArEed9DYXhOAaVAksQL5eN0-AESxyTz
> > f2Oo&s=jrTnVugnHRzLNiYwgHBvGhVR1XxGQJy1WFmXGZQyrBw&e=
>
>
> FYI Ken has a staged version that's ready to go with OpenSSL 3.0.1:
> https://github.com/kgoldman/ibmswtpm2/tree/next
>
> [kgold] A bit of background. The TPM reference code (from the
> specification) sometimes looks inside a OpenSSL structure that was later
> made opaque. Each time a new openssl version is released, I check to see
> if the structure has changed. The #error message reminds me to check. So
> far, we're good to 3.0.1.
>
> As Bill said, the staged version updated the check.
>
attachment.htm
(text/html, 8.3 KB)
<div dir="ltr"><div class="gmail-aju" style="float:none;padding:0px 16px;display:flex;height:80px;min-width:40px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div class="gmail-aCi" style=""><img id="gmail-:60_10-e" name=":60" src="https://lh3.googleusercontent.com/a/AATXAJyEgam4xgnoQKK4mpDwZsCOFcTcwwcgw6TX9qtY=s80-mo" class="gmail-ajn" aria-hidden="true" style="display: block; width: 40px; height: 40px; border-radius: 50%; background-color: rgb(164, 194, 244);"></div></div><div class="gmail-gs" style="margin:0px;padding:0px 0px 20px;width:556px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div class="gmail-gE gmail-iv gmail-gt" style="font-size:0.875rem;padding:20px 0px 0px"><table cellpadding="0" class="gmail-cf gmail-gJ" style="border-collapse:collapse;margin-top:0px;width:auto;font-size:0.875rem;letter-spacing:0.2px;display:block"><tbody style="display:block"><tr class="gmail-acZ" style="height:auto;display:flex"><td class="gmail-gF gmail-gK" style="white-space:nowrap;padding:0px;vertical-align:top;width:290.5px;line-height:20px;display:block;max-height:20px"><table cellpadding="0" class="gmail-cf gmail-ix" style="border-collapse:collapse;table-layout:fixed;width:290.5px"><tbody><tr><td class="gmail-c2" style="display:flex"><h3 class="gmail-iw" style="overflow:hidden;font-size:0.75rem;font-weight:inherit;margin:inherit;text-overflow:ellipsis;letter-spacing:0.3px;color:rgb(95,99,104);line-height:20px"><span class="gmail-qu" role="gridcell" tabindex="-1"><span name="Markus Willhelm Schmid" class="gmail-gD" style="color:rgb(32,33,36);font-size:0.875rem;font-weight:bold;display:inline;vertical-align:top;letter-spacing:0.2px;line-height:20px"><span style="vertical-align:top">Markus Willhelm Schmid</span></span></span></h3></td></tr></tbody></table></td><td class="gmail-gH gmail-bAk" style="text-align:right;white-space:nowrap;vertical-align:top;display:block;max-height:20px"><div class="gmail-gK" style="padding:0px;display:flex"><span id="gmail-:dw" class="gmail-g3" title="Mar 11, 2022, 11:24 AM" alt="Mar 11, 2022, 11:24 AM" role="gridcell" tabindex="-1" style="vertical-align:top;margin:0px;font-size:0.75rem;letter-spacing:0.3px;color:rgb(95,99,104);display:block;line-height:20px">11:24 AM (0 minutes ago)</span><div class="gmail-zd gmail-bi4" aria-label="Not starred" tabindex="0" role="checkbox" aria-checked="false" style="display:inline-block;height:20px;margin-left:20px;outline:0px"><span class="gmail-T-KT" style="display:inline-flex;height:20px;text-align:center;width:20px;padding:0px;margin:0px;border:none;outline:none"></span></div></div></td><td class="gmail-gH" style="text-align:right;white-space:nowrap;vertical-align:top;display:flex"></td><td class="gmail-gH gmail-acX gmail-bAm" rowspan="2" style="text-align:right;white-space:nowrap;vertical-align:top;display:block;max-height:20px"><div class="gmail-T-I gmail-J-J5-Ji gmail-T-I-Js-IF gmail-aaq gmail-T-I-ax7 gmail-L3" role="button" tabindex="0" aria-label="Reply" style="display:inline-flex;border-radius:2px 0px 0px 2px;font-size:0.875rem;text-align:center;margin:0px 0px 0px 20px;height:20px;line-height:18px;min-width:0px;outline:none;padding:0px;background:transparent;color:rgb(68,68,68);border:none"><img class="gmail-hB gmail-T-I-J3" role="button" src="https://mail.google.com/mail/u/0/images/cleardot.gif" alt="" style="background: url("https://www.gstatic.com/images/icons/material/system/2x/reply_black_20dp.png") 50% 50% / 20px no-repeat; height: 20px; margin: 0px; vertical-align: middle; width: 20px; opacity: 0.54; display: inline-block; padding: 0px; transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1) 0s;"></div><div id="gmail-:dl" class="gmail-T-I gmail-J-J5-Ji gmail-T-I-Js-Gs gmail-aap gmail-T-I-awG gmail-T-I-ax7 gmail-L3" role="button" tabindex="0" aria-expanded="false" aria-haspopup="true" aria-label="More" style="display:inline-flex;border-radius:0px 2px 2px 0px;font-size:0.875rem;text-align:center;margin:0px 0px 0px 20px;height:20px;line-height:18px;min-width:0px;outline:none;padding:0px;background:transparent;color:rgb(68,68,68);border:none"><img class="gmail-hA gmail-T-I-J3" role="menu" src="https://mail.google.com/mail/u/0/images/cleardot.gif" alt="" style="background: url("https://www.gstatic.com/images/icons/material/system/2x/more_vert_black_20dp.png") 50% 50% / 20px no-repeat; height: 20px; width: 20px; margin: 0px; vertical-align: middle; opacity: 0.54; display: inline-block; padding: 0px; transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1) 0s;"></div></td></tr><tr class="gmail-acZ gmail-xD" style="height:auto;display:flex"><td colspan="3"><table cellpadding="0" class="gmail-cf gmail-adz" style="border-collapse:collapse;table-layout:fixed;white-space:nowrap;width:556px"><tbody><tr><td class="gmail-ady" style="overflow:visible;text-overflow:ellipsis;display:flex;line-height:20px"><div class="gmail-iw gmail-ajw" style="overflow:hidden;max-width:92%;display:inline-block"><span class="gmail-hb" style="vertical-align:top;color:rgb(95,99,104);font-size:0.75rem;letter-spacing:0.3px;line-height:20px">to <span name="Kenneth" class="gmail-g2" style="vertical-align:top">Kenneth</span></span></div><div id="gmail-:dm" aria-haspopup="true" class="gmail-ajy" role="button" tabindex="0" aria-label="Show details" style="display:inline-flex;margin-left:4px;vertical-align:top;border:none;outline:none"><img class="gmail-ajz" src="https://mail.google.com/mail/u/0/images/cleardot.gif" alt="" style="background: url("https://www.gstatic.com/images/icons/material/system/2x/arrow_drop_down_black_20dp.png") 50% 50% / 20px no-repeat; cursor: pointer; padding: 0px; vertical-align: baseline; height: 20px; width: 20px; border: none; margin: 0px 0px 0px auto; right: 0px; top: 0px; display: flex; opacity: 0.54;"></div></td></tr></tbody></table></td></tr></tbody></table></div><div id="gmail-:e0"><div class="gmail-qQVYZb"></div><div class="gmail-utdU2e"></div><div class="gmail-lQs8Hd"></div><div class="gmail-btm"></div></div><div class="gmail-"><div class="gmail-aHl" style=""></div><div id="gmail-:dn" tabindex="-1"></div><div id="gmail-:dy" class="gmail-ii gmail-gt gmail-adO" style="direction:ltr;margin:8px 0px 0px;padding:0px;font-size:0.875rem"><div id="gmail-:dz" class="gmail-a3s gmail-aiL" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif;overflow:hidden"><div dir="ltr">Thank you Ken, but I am OK just using Microsoft's TPM Simulator.exe, which I now got working after modifying tpm2-tss/src/util/io.c. The MS simulator only listens on IPv4 and io.c may fail since the list from getaddrinfo may return IPv6 address before IPv4 address. I did not look into the logic, I just did a quick fix:<div> if (*sock == INVALID_SOCKET<br> || p->ai_family != AF_INET) //PATCH MS sim listens on IPv4 only<br> continue; </div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 11, 2022 at 5:34 AM Kenneth Goldman <<a href="mailto:[email protected]">[email protected]</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 2022-03-10 at 07:44 -0800, Markus Willhelm Schmid wrote:<br> > I made an error in my previous email, I pasted in the URL to IBM's TCC <br> > stack and not to IBM's SW TPM. This is what I am trying to compile.<br> > INVALID URI REMOVED<br> > rojects_ibmswtpm2_&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=DZCVG43VcL8GTne<br> > MZb8k8lEwb-O1GZktFfre1-mlmiA&m=k6WL9yJ4ArEed9DYXhOAaVAksQL5eN0-AESxyTz<br> > f2Oo&s=jrTnVugnHRzLNiYwgHBvGhVR1XxGQJy1WFmXGZQyrBw&e=<br> <br> <br> FYI Ken has a staged version that's ready to go with OpenSSL 3.0.1:<br> <a href="https://github.com/kgoldman/ibmswtpm2/tree/next" rel="noreferrer" target="_blank">https://github.com/kgoldman/ibmswtpm2/tree/next</a> <br> <br> [kgold] A bit of background. The TPM reference code (from the specification) sometimes looks inside a OpenSSL structure that was later made opaque. Each time a new openssl version is released, I check to see if the structure has changed. The #error message reminds me to check. So far, we're good to 3.0.1.<br> <br> As Bill said, the staged version updated the check.<br> </blockquote></div>