refs bug #467
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 9 Apr 2010 18:40:28 +0000 (20:40 +0200)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 9 Apr 2010 18:40:28 +0000 (20:40 +0200)
whitelist dm7025 from tpm test and add beta warning to the documentation

doc/TPM
lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py

diff --git a/doc/TPM b/doc/TPM
index 2b2b2062a1a52363dc5bbff3165076bce6cd493f..20c02300300f95aa70cfcb0035e1623b35d63b9f 100644 (file)
--- a/doc/TPM
+++ b/doc/TPM
@@ -1,3 +1,6 @@
+The TPM check is currently to be considered a beta version. So please expect
+code changes in the future.
+
 If you'd like to write your own plugins and honor the efforts, Dream Multimedia
 puts into developing Enigma 2, you can protect your plugin against execution
 on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module)
 If you'd like to write your own plugins and honor the efforts, Dream Multimedia
 puts into developing Enigma 2, you can protect your plugin against execution
 on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module)
@@ -21,4 +24,4 @@ TPM check each time the plugin is called) or directly use it in the
 Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes
 (which will prevent the plugin from showing up at all). You can also implement
 a warning message for all possible TPM failure scenarios.
 Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes
 (which will prevent the plugin from showing up at all). You can also implement
 a warning message for all possible TPM failure scenarios.
-  
\ No newline at end of file
+  
index dafb283741e986b52d7cca4e9ca0202948884b71..0be09ccf1c56ac79ad8634bfff3cc4c9d2119677 100644 (file)
@@ -1,5 +1,6 @@
 from Screens.Screen import Screen
 from Plugins.Plugin import PluginDescriptor
 from Screens.Screen import Screen
 from Plugins.Plugin import PluginDescriptor
+from Tools.HardwareInfo import HardwareInfo
 from enigma import eTPM
 import sha
 
 from enigma import eTPM
 import sha
 
@@ -43,38 +44,40 @@ def read_random():
                return None
 
 def main(session, **kwargs):
                return None
 
 def main(session, **kwargs):
-       rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+       device = HardwareInfo().get_device_name()
+       if device != "dm7025":
+               rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+               
+               etpm = eTPM()
+               l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+               if l2cert is None:
+                       print "l2cert not found"
+                       return
        
        
-       etpm = eTPM()
-       l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
-       if l2cert is None:
-               print "l2cert not found"
-               return
-
-       l2key = validate_cert(l2cert, rootkey)
-       if l2key is None:
-               print "l2cert invalid"
-               return
-       
-       l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
-       if l3cert is None:
-               print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)"
-               return
-       
-       l3key = validate_cert(l3cert, l2key)
-       if l3key is None:
-               print "l3cert invalid"
-               return
-       
-       rnd = read_random()
-       if rnd is None:
-               print "random error"
-               return
-       val = etpm.challenge(rnd)
-       result = decrypt_block(val, l3key)
-       if result[80:88] == rnd:
+               l2key = validate_cert(l2cert, rootkey)
+               if l2key is None:
+                       print "l2cert invalid"
+                       return
+               
+               l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+               if l3cert is None:
+                       print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)"
+                       return
+               
+               l3key = validate_cert(l3cert, l2key)
+               if l3key is None:
+                       print "l3cert invalid"
+                       return
+               
+               rnd = read_random()
+               if rnd is None:
+                       print "random error"
+                       return
+               val = etpm.challenge(rnd)
+               result = decrypt_block(val, l3key)
+       if device == "dm7025" or result[80:88] == rnd:
                print "successfully finished the tpm test"
                print "successfully finished the tpm test"
-               # would start your plugin here
+                       # would start your plugin here
 
 def Plugins(**kwargs):
        return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main),
 
 def Plugins(**kwargs):
        return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main),