Subversion Repositories freemyipod

Rev

Rev 379 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 379 Rev 381
Line 656... Line 656...
656
            Encrypts a buffer using a hardware key
656
            Encrypts a buffer using a hardware key
657
        """
657
        """
658
        addr = self._hexint(addr)
658
        addr = self._hexint(addr)
659
        size = self._hexint(size)
659
        size = self._hexint(size)
660
        keyindex = self._hexint(keyindex)
660
        keyindex = self._hexint(keyindex)
-
 
661
        self.embios.lib.dev.timeout = 30000
661
        self.embios.aesencrypt(addr, size, keyindex)
662
        self.embios.aesencrypt(addr, size, keyindex)
662
    
663
    
663
    @command
664
    @command
664
    def aesdecrypt(self, addr, size, keyindex):
665
    def aesdecrypt(self, addr, size, keyindex):
665
        """
666
        """
666
            Decrypts a buffer using a hardware key
667
            Decrypts a buffer using a hardware key
667
        """
668
        """
668
        addr = self._hexint(addr)
669
        addr = self._hexint(addr)
669
        size = self._hexint(size)
670
        size = self._hexint(size)
670
        keyindex = self._hexint(keyindex)
671
        keyindex = self._hexint(keyindex)
-
 
672
        self.embios.lib.dev.timeout = 30000
671
        self.embios.aesdecrypt(addr, size, keyindex)
673
        self.embios.aesdecrypt(addr, size, keyindex)
672
    
674
    
673
    @command
675
    @command
674
    def hmac_sha1(self, addr, size, destination):
676
    def hmac_sha1(self, addr, size, destination):
675
        """
677
        """
Line 679... Line 681...
679
        size = self._hexint(size)
681
        size = self._hexint(size)
680
        destination = self._hexint(destination)
682
        destination = self._hexint(destination)
681
        sha1size = 0x14
683
        sha1size = 0x14
682
        self.logger.info("Generating hmac-sha1 hash from the buffer at "+self._hex(addr)+" with the size "+self._hex(size)+
684
        self.logger.info("Generating hmac-sha1 hash from the buffer at "+self._hex(addr)+" with the size "+self._hex(size)+
683
                         " and saving it to "+self._hex(destination)+" - "+self._hex(destination+sha1size)+"...")
685
                         " and saving it to "+self._hex(destination)+" - "+self._hex(destination+sha1size)+"...")
-
 
686
        self.embios.lib.dev.timeout = 30000
684
        self.embios.hmac_sha1(addr, size, destination)
687
        self.embios.hmac_sha1(addr, size, destination)
685
        self.logger.info("done\n")
688
        self.logger.info("done\n")
686
        data = self.embios.read(destination, sha1size)
689
        data = self.embios.read(destination, sha1size)
687
        hash = ord(data)
690
        hash = ord(data)
688
        self.logger.info("The generated hash is "+self._hex(hash))
691
        self.logger.info("The generated hash is "+self._hex(hash))