Esempio n. 1
0
    def test_ValidateVerifiedBootImages_nonSystemRootImage(self):
        input_tmp = common.MakeTempDir()
        os.mkdir(os.path.join(input_tmp, 'IMAGES'))
        system_image = os.path.join(input_tmp, 'IMAGES', 'system.img')
        self._generate_system_image(system_image)

        # Pack the verity key into the root dir in system.img.
        verity_key_mincrypt = os.path.join(input_tmp, 'ROOT', 'verity_key')
        os.makedirs(os.path.dirname(verity_key_mincrypt))
        shutil.copyfile(os.path.join(self.testdata_dir, 'testkey_mincrypt'),
                        verity_key_mincrypt)

        # And a copy in ramdisk.
        verity_key_ramdisk = os.path.join(input_tmp, 'BOOT', 'RAMDISK',
                                          'verity_key')
        os.makedirs(os.path.dirname(verity_key_ramdisk))
        shutil.copyfile(os.path.join(self.testdata_dir, 'testkey_mincrypt'),
                        verity_key_ramdisk)

        info_dict = {
            'verity': 'true',
        }
        options = {
            'verity_key': os.path.join(self.testdata_dir, 'testkey.x509.pem'),
            'verity_key_mincrypt': verity_key_mincrypt,
        }
        ValidateVerifiedBootImages(input_tmp, info_dict, options)
Esempio n. 2
0
    def test_ValidateVerifiedBootImages_bootImage(self):
        input_tmp = common.MakeTempDir()
        os.mkdir(os.path.join(input_tmp, 'IMAGES'))
        boot_image = os.path.join(input_tmp, 'IMAGES', 'boot.img')
        self._generate_boot_image(boot_image)

        info_dict = {
            'boot_signer': 'true',
        }
        options = {
            'verity_key': os.path.join(self.testdata_dir, 'testkey.x509.pem'),
        }
        ValidateVerifiedBootImages(input_tmp, info_dict, options)