示例#1
0
    def update_data_model(self, data_model):
        entries = []
        for entry in self.root.module.entry:
            entries.append({
                'name': entry.name,
                'value': entry.value,
                'ignore': entry.ignore,
                'description': entry.description
            })

        for entry in entries:
            if entry['ignore'] == False:
                if entry['name'] == 'L1_encryption_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())
                elif entry['name'] == 'ROT_encryption_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())

        data_model_filtered = auto_gen_model.filter_by_owner(
            data_model, dm_defines.OWNER_OEM)
        rules = _RULES(self.chipset)
        rules.process(entries, data_model_filtered)

        return (data_model + data_model_filtered)
示例#2
0
    def update_data_model(self, data_model):
        entries = []
        for entry in self.root.module.entry:
            entries.append({
                'name': entry.name,
                'value': entry.value,
                'ignore': entry.ignore,
                'description': entry.description
            })

        pk_hash_set = False
        check_for_pk_hash = False

        # Fuseblower - Secboot Mode
        for entry in entries:
            if entry['ignore'] == False:
                if entry['name'] == 'root_cert_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())
                    pk_hash_set = True
                elif entry['name'] == 'root_cert_hash':
                    hash_check = entry['value'].replace('0', '')
                    if len(hash_check) > 0:
                        pk_hash_set = True
                elif 'PK_Hash_in_Fuse' in entry['name']:
                    if entry['value'] == 'true' or entry['value'] == 'True':
                        check_for_pk_hash = True

        # Fuseblower - 8996 chipset
        for entry in entries:
            if entry['ignore'] == False:
                if entry['name'] == 'root_cert_hash0_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())
                    pk_hash_set = True
                elif entry['name'] == 'root_cert_hash0':
                    hash_check = entry['value'].replace('0', '')
                    if len(hash_check) > 0:
                        pk_hash_set = True
                elif 'PK_Hash_in_Fuse' in entry['name']:
                    if entry['value'] == 'true' or entry['value'] == 'True':
                        check_for_pk_hash = True

        # Fuseblower - 806x chipset
        for entry in entries:
            if entry['ignore'] == False:
                if entry['name'] == 'root_certfile':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())
                    pk_hash_set = True
                elif entry['name'] == 'root_certhash':
                    hash_check = entry['value'].replace('0', '')
                    if len(hash_check) > 0:
                        pk_hash_set = True
                elif 'PK_Hash_in_Fuse' in entry['name']:
                    if entry['value'] == 'true' or entry['value'] == 'True':
                        check_for_pk_hash = True

        # before processing rules, check to make sure if any PK_Hash_in_fuse is set, OEM_PK_HASH entry is programmed
        if check_for_pk_hash and not pk_hash_set:
            raise RuntimeError(
                "One of the PK_Hash_in_Fuse is set to true but root_cert_hash/root_cert_hash0/root_certhash or root_cert_file/root_cert_hash0_file/root_certfile is not set!"
            )

        # Fuseblower - RoT Mode
        for entry in entries:
            if entry['ignore'] == False:
                if entry['name'] == 'pk_hash1_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())
                elif entry['name'] == 'image_encr_key1_file':
                    dt = datautils.DataHandler(
                        datautils.get_cb_dict(
                            path_basepath=os.path.dirname(self.config_path)))
                    entry['value'] = dt.validate(
                        entry['value'], datautils.path_handler.TypePath())

        data_model_filtered = auto_gen_model.filter_by_owner(
            data_model, dm_defines.OWNER_OEM)
        rules = _RULES(self.chipset)
        rules.process(entries, data_model_filtered)

        return (data_model + data_model_filtered)
示例#3
0
 def __init__(self, structure, excluded_tags=None):
     assert isinstance(structure, dict)
     self.structure = structure
     self.excluded_tags = [] if excluded_tags is None else excluded_tags
     cb_dict = get_cb_dict(path_basepath=os.path.curdir)
     self.root = DataHandler(cb_dict).detail(self.structure)
示例#4
0
 def __init__(self, structure):
     assert isinstance(structure, dict)
     self.structure = structure
     cb_dict = get_cb_dict(path_basepath=os.path.curdir)
     self.root = DataHandler(cb_dict).detail(self.structure)