Commit Graph

27 Commits

Author SHA1 Message Date
Nathaniel Mitchell 7787fcf219 Resolve config issues found by extract_registers.py
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2026-04-21 15:22:58 -07:00
Nathaniel Mitchell 2629b44254 Add function to cross reference registers to find errors
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2026-04-21 15:22:58 -07:00
Nathaniel Mitchell 356c25da94 Add extract_registers.py script and readme
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2026-01-29 11:29:55 -08:00
Nathaniel Mitchell 4b65243d9c Fix more unit tests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2025-03-10 09:06:35 -07:00
Nathaniel Mitchell b1533ea07c Update strip_record to fix bug and update run_chipsec_module
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-25 16:34:37 -07:00
Nathaniel Mitchell a7df794272 Update sgx_check unit test and add script to shorten recordings
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-20 08:32:48 -07:00
Frinzell, Aaron 537caa4a81 Move from distutil for Python 3.12
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-08-07 16:37:40 -07:00
Frinzell, Aaron 2e9977bdc1 Update qemu_efi.py for code port
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-05-08 09:27:49 -07:00
Nathaniel Mitchell 814995e345 Rename win7 driver/helper to windows
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-26 16:52:26 -07:00
Nicolas Iooss 37ed61704d Improve the wording in the message creating the VM disk image
"Converting to QCow2 format in /tmp/..." is clearer.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2022-09-29 16:10:13 -07:00
Nicolas Iooss 5155d71342 Add a script which starts a QEMU virtual machine with a UEFI shell
To easily test using chipsec in a UEFI environment, it is useful to be
able to run it in a virtual machine. On most Linux distributions, QEMU
can be used to start a UEFI shell in a virtual machine. By providing a
`startup.nsh` file, some commands can even be automatically entered!

Moreover:

- OVMF embeds the UEFI shell. There is no need to download a `Shell.efi`
  file. But by default QEMU tries to boot with PXE (network boot). I
  have not found a nice way to prevent this, so instead I removed the
  NIC of the machine with `-nic none` option.

- `qemu-img convert` can create a FAT partition from a directory, thanks
  to QEMU's Virtual VFAT storage engine. This enables creating an ESP
  (EFI System Partition) without needing to mount a temporary filesystem
  and without using GNU mtools commands (`mmd` and `mcopy`).

Provide a shell script which prepares an ESP with chipsec and the Python
module, and launches a QEMU virtual machine from it. It works on Ubuntu
20.04 and 22.04:

    sudo apt install ovmf qemu-system-x86 qemu-utils
    ./scripts/qemu_efi.py

Then in the UEFI shell:

    Shell> fs0:
    FS0:\> cd chipsec
    FS0:\chipsec\> python368.efi chipsec_util.py -i cpu cpuid 0

    ################################################################
    ##                                                            ##
    ##  CHIPSEC: Platform Hardware Security Assessment Framework  ##
    ##                                                            ##
    ################################################################
    [CHIPSEC] Version :
    [CHIPSEC] OS      : uefi
    [CHIPSEC] Python  : 3.6.8 (64-bit)

    [CHIPSEC] API mode: using CHIPSEC kernel module API
    [-] ERROR: Unknown Platform: VID = 0x8086, DID = 0x1237, RID = 0x02
    [!] WARNING: *******************************************************************
    [!] WARNING: * Unknown platform!
    [!] WARNING: * Platform dependent functionality will likely be incorrect
    [!] WARNING: * Error Message: "Unknown Platform: VID = 0x8086, DID = 0x1237, RID = 0x02"
    [!] WARNING: *******************************************************************
    [CHIPSEC] Helper  : EfiHelper (None)
    [CHIPSEC] Platform: UnknownPlatform
    [CHIPSEC]      VID: FFFF
    [CHIPSEC]      DID: FFFF
    [CHIPSEC]      RID: FF
    [CHIPSEC] PCH     : Default PCH
    [CHIPSEC]      VID: FFFF
    [CHIPSEC]      DID: FFFF
    [CHIPSEC]      RID: FF
    [CHIPSEC] Executing command 'cpu' with args ['cpuid', '0']

    [CHIPSEC] CPUID < EAX: 0x00000000
    [CHIPSEC]         ECX: 0x00000000
    [CHIPSEC] CPUID > EAX: 0x0000000D
    [CHIPSEC]         EBX: 0x68747541
    [CHIPSEC]         ECX: 0x444D4163
    [CHIPSEC]         EDX: 0x69746E65
    [CHIPSEC] (cpu) time elapsed 0.000

As typing a command in the virtual UEFI Shell can be quite cumbersome,
it is possible to directly provide it to the script. For example:

    $ ./scripts/qemu_efi.py -u ' -i' cpu cpuid 0

N.B. the options of chipsec commands are escaped with a space (`' -i'`)
to work around limitations of Python's `argparse` module. In this
example, `-i` is required as chipsec does not support the default
platform emulated by QEMU yet.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2022-09-29 16:10:13 -07:00
Nathaniel Mitchell c8c14e21be Remove shebang from all but the entry points. Update ep to py3
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-08-12 08:27:33 -07:00
Aaron Frinzell 1192759715 Build scripts 2020-10-28 09:51:40 -07:00
brentholtsclaw f7fe1be074 More whitespace cleanup
E231, E201, E226

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2020-07-31 13:46:13 -07:00
Assaf Carlsbad 32fc6914e4 Fix packing of XML config files. 2020-07-30 09:18:47 -07:00
brentholtsclaw a00b2838e5 Cleanup trailing whitespace
W291,W293,W391

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2020-07-01 15:44:21 -07:00
Assaf Carlsbad 439a1b198f Pack Shell.efi and te.cfg as py2exe data files. 2020-02-28 15:48:18 -08:00
Assaf Carlsbad a41b9640c9 Delete unused source_dir. 2020-02-28 15:45:37 -08:00
Assaf Carlsbad aa87823b48 Make root_dir relative to __file__. 2020-02-28 15:45:37 -08:00
Assaf Carlsbad d162892ad1 Don't rely on py2exe to create the dist dir. 2020-02-05 11:14:01 -08:00
Assaf Carlsbad 0f5d1d7dfc Fix embedding of version information on binaries. 2020-02-05 11:14:01 -08:00
Assaf Carlsbad f01cca7511 Update comment. 2020-02-05 11:14:01 -08:00
Assaf Carlsbad c7d516e87b Remove commented-out code. 2020-02-05 11:14:01 -08:00
Assaf Carlsbad eea61d3806 Use print as a function. 2020-02-05 11:14:01 -08:00
Assaf Carlsbad 90ad30cfe0 Pack blacklist.json as a data file when building CHIPSEC with py2exe. 2020-01-13 10:42:04 -08:00
BrentHoltsclaw 2efeda4345 Merge python3-rc2 branch into master (#656) 2019-08-15 14:11:20 -07:00
abazhaniuk 94fe7f02f1 change setup.py build driver by default. change root directory of chipsec. move WARNING.txt to chipsec. remove PKG-INFO (#107) 2016-10-18 18:19:42 -07:00