{"id":255,"date":"2009-10-22T22:43:29","date_gmt":"2009-10-23T06:43:29","guid":{"rendered":"http:\/\/www.outflux.net\/blog\/?p=255"},"modified":"2009-10-24T20:17:29","modified_gmt":"2009-10-25T04:17:29","slug":"tpm-as-rng","status":"publish","type":"post","link":"https:\/\/outflux.net\/blog\/archives\/2009\/10\/22\/tpm-as-rng\/","title":{"rendered":"TPM as RNG"},"content":{"rendered":"<p>I was reminded about some <a href=\"http:\/\/www.trustedcomputinggroup.org\/resources\/tpm_main_specification\">TPM<\/a> coding I&#8217;d done to <a href=\"http:\/\/outflux.net\/tpm\/tpm-getrand.c\">get random bytes<\/a> from the pRNG on my TPM-enabled system from <a href=\"http:\/\/domsch.com\/blog\/?p=107\">Matt Domsch&#8217;s recent post<\/a>.  I&#8217;m not fully convinced that the pRNG of the TPM is an appropriate source of entropy, but it does pass my simple <a href=\"http:\/\/en.wikipedia.org\/wiki\/FIPS_140\">FIPS-140-2<\/a> <a href=\"http:\/\/outflux.net\/tpm\/fips-140-2.py\">test<\/a>.<\/p>\n<p>I had to find the <a href=\"http:\/\/downloadmirror.intel.com\/15034\/eng\/DQ965CO_TPM_QuickRefGuide03.pdf\">Intel TPM docs<\/a> to figure out how to enable TPM on my system.  It was under &#8220;Advanced \/ Peripherals&#8221;.  I was expecting it under &#8220;Security&#8221;, like every other BIOS I&#8217;d seen.  After that:<\/p>\n<p><code><\/p>\n<blockquote><p>\n$ <strong>sudo apt-get install trousers tpm-tools<\/strong><br \/>\n...<br \/>\n$ <strong>sudo modprobe tpm_tis<\/strong><br \/>\n$ <strong>dmesg | grep -i tpm<\/strong><br \/>\n[676618.167313] tpm_tis 00:07: 1.2 TPM (device-id 0xFE, rev-id 70)<br \/>\n$ <strong>sudo service trousers start<\/strong><br \/>\n...<br \/>\n$ <strong>tpm_version<\/strong><br \/>\n  TPM 1.2 Version Info:<br \/>\n  Chip Version:        1.2.2.16<br \/>\n  Spec Level:          2<br \/>\n  Errata Revision:     1<br \/>\n  TPM Vendor ID:       WEC<br \/>\n  TPM Version:         01010000<br \/>\n  Manufacturer Info:   57454300<br \/>\n$ <strong>.\/tpm-getrand | hexdump -C<\/strong><br \/>\n00000000  61 07 23 ff 71 3e 25 e8  f0 d5 de a7 a3 07 21 dc  |a.#.q&gt;%.......!.|\n<\/p><\/blockquote>\n<p><\/code><\/p>\n<p>I could run rngd with a named pipe, but it&#8217;d be nice to have a new driver that could run a command instead to get the next 20000 bits.<\/p>\n<p><strong>UPDATE<\/strong>: I&#8217;ve <a href=\"http:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi?msg=15;filename=tpm-rng.patch;att=1;bug=542599\">implemented<\/a> this in rngd now.<\/p>\n<p style='text-align:left'>&copy; 2009, <a href=\"https:\/\/outflux.net\/blog\/\">Kees Cook<\/a>. This work is licensed under a <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\">Creative Commons Attribution-ShareAlike 4.0 License<\/a>.<br \/><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><img decoding=\"async\" alt=\"CC BY-SA 4.0\" style=\"border-width:0\" src=\"https:\/\/i.creativecommons.org\/l\/by-sa\/4.0\/88x31.png\" \/><\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was reminded about some TPM coding I&#8217;d done to get random bytes from the pRNG on my TPM-enabled system from Matt Domsch&#8217;s recent post. I&#8217;m not fully convinced that the pRNG of the TPM is an appropriate source of entropy, but it does pass my simple FIPS-140-2 test. I had to find the Intel [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,6,14,19],"tags":[],"_links":{"self":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/255"}],"collection":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":7,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/255\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}