process_pbkey(processed_xml)

if (args.bypass):
    allowable_fw_list = []
else:
    allowable_fw_list = generate_allowable_fw_list(processed_xml)
allowable_fw_header = generate_allowable_fw_header(allowable_fw_list)

if (args.bypass):
    keys_list = []
else:
    keys_list = generate_pbkey_list()
keys_header = generate_pbkey_header(keys_list)

platform_id = get_platform_id(processed_xml)
platform_header = generate_platform_info(platform_id)

pfm_header_instance = manifest_common.generate_manifest_header(pfm_id, key_size, manifest_types.PFM)
pfm_header_instance.length = ctypes.sizeof(pfm_header_instance) + keys_header.length + \
    allowable_fw_header.length + pfm_header_instance.sig_length + platform_header.header.length

pfm = generate_pfm(pfm_header_instance, allowable_fw_header, allowable_fw_list, keys_header,
    keys_list, platform_header)

manifest_common.write_manifest(sign, pfm, key, output,
    pfm_header_instance.length - pfm_header_instance.sig_length,
    pfm_header_instance.sig_length)

print("Completed PFM generation: {0}".format(output))

示例#2
0
pcd_len += toc_len

manifest_header.length = pcd_len + manifest_header.sig_length

pcd_buf = (ctypes.c_ubyte * pcd_len)()
offset = 0

ctypes.memmove(
    ctypes.addressof(pcd_buf) + offset, ctypes.addressof(manifest_header),
    manifest_header_len)
offset += manifest_header_len

ctypes.memmove(
    ctypes.addressof(pcd_buf) + offset, ctypes.addressof(toc), toc_len)
offset += toc_len

for element in elements_list:
    element_len = ctypes.sizeof(element)
    ctypes.memmove(
        ctypes.addressof(pcd_buf) + offset, ctypes.addressof(element),
        element_len)

    offset += element_len

manifest_common.write_manifest(
    xml_version, sign, pcd_buf, key, key_size, key_type, output,
    manifest_header.length - manifest_header.sig_length,
    manifest_header.sig_length)

print("Completed PCD generation: {0}".format(output))
示例#3
0
    if (args.bypass):
        keys_list = []
    else:
        keys_list = generate_pbkey_list()
    keys_header = generate_pbkey_header(keys_list)

    platform_id_header = pfm_platform_header(0, len(platform_id), 0)
    platform_header = manifest_common.generate_platform_info(
        platform_id_header, platform_id)

    platform_header_length = ctypes.sizeof(platform_header)
    platform_header_length_buf = platform_header_length.to_bytes(
        ctypes.sizeof(ctypes.c_ushort), byteorder="little")
    platform_header.header[0] = platform_header_length_buf[0]
    platform_header.header[1] = platform_header_length_buf[1]

    pfm_header_instance.length = ctypes.sizeof(pfm_header_instance) + keys_header.length + \
        allowable_fw_header.length + pfm_header_instance.sig_length + platform_header_length

    pfm = generate_pfm(pfm_header_instance, allowable_fw_header,
                       allowable_fw_list, keys_header, keys_list,
                       platform_header)

manifest_common.write_manifest(
    xml_version, sign, pfm, key, key_size, key_type, output,
    pfm_header_instance.length - pfm_header_instance.sig_length,
    pfm_header_instance.sig_length)

print("Completed PFM generation: {0}".format(output))
示例#4
0
if "components" in processed_xml:
    components, num_components = generate_components_buf(
        processed_xml["components"])

components_header = generate_components_header(ctypes.sizeof(components),
                                               num_components)

rot_header = generate_rot_header(processed_xml["rot"],
                                 processed_xml["rot"]["interface"],
                                 processed_xml["cpld"],
                                 processed_xml["policy"], num_ports)

platform_id_header = generate_platform_id_header(
    len(processed_xml["platform_id"]))

header = generate_pcd_header (rot_header.length + components_header.length + \
                              platform_id_header.length)
manifest_header = manifest_common.generate_manifest_header(
    id, key_size, manifest_types.PCD)
manifest_header.length = ctypes.sizeof (manifest_header) + header.length + \
    manifest_header.sig_length

pcd = generate_pcd(manifest_header, header, rot_header, ports,
                   components_header, components, platform_id_header,
                   processed_xml["platform_id"])

manifest_common.write_manifest (sign, pcd, key, output, manifest_header.length - \
                                manifest_header.sig_length, manifest_header.sig_length)

print("Completed PCD generation: {0}".format(output))