* Add firmware data retrieval
* Apply suggestions from code review
* Remove FW info native versions from linux/win helpers and added results to info module
---------
Signed-off-by: Dan Scott <dan.scott@intel.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
linuxhelper's kern_set_EFI_variable only sets default value for attr if no
value has been passed in. In some call-chains (uefi var-write) however None
is being passed in, resulting in the following error from:
struct.error: required argument is not an integer
Make attr optional input and override if value is None with default value.
Signed-off-by: Tamas K Lengyel <tamas.lengyel@oracle.com>
Currently the common.uefi.access_uefispec -a modify test modifications to variables
with the default variable attribute of nv | bs | rs (0x7). In this patch we make
this behavior more configurable.
By default the -a modify option will attempt to modify only the content of the variable,
but will not attempt to change the existing attributes of the variable. We have observed
cases where the test used this way uncovered more issues on variables where different
attributes were used and we did not attempt changing the attribute.
By specifying an optional attribute with -a modify,<attribute> the user can now test
variable modification with any attribute instead of just the currently hard-coded one.
Signed-off-by: Tamas K Lengyel <tamas.lengyel@oracle.com>
* Convert str to byte object in linuxhelper's kern_set_EFI_variable
This is required to be able to successfuly run the common.uefi.access_uefispec -a modify
test from under Linux and resolve the following error:
ERROR: Exception occurred during chipsec.modules.common.uefi.access_uefispec.run(): 'argument for 's' must be a bytes object'
Signed-off-by: Tamas K Lengyel <tamas.lengyel@oracle.com>
* Use recommended best practice isinstance for type checking
Co-authored-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
---------
Signed-off-by: Tamas K Lengyel <tamas.lengyel@oracle.com>
Co-authored-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
Python for Windows Extensions (pywin32) was migrated from SourceForge to GitHub 7 years ago. Just quick update here to fix the referenced URL. [no functional change to Chipsec implied in this commit]
Signed-off-by: William Leara <william.leara@dell.com>
* Add Win Cert types to uefi_fv and spi_uefi
* Move uefi search to library.uefi folder
* Move uefi_fv to library.uefi
* Move uefi_compression to library.uefi>
* Move uefi_common to library.uefi
* Move uefi_platform to library.uefi
* Move spi_uefi to library.uefi
* Add library.uefi.sleep_scripts file
* Move S3 functionality into sleep_state file
* Add varstore and variable files to library.uefi
* Fixup Flake8 suggestions
* Rename library uefi files to remove uefi_
* This change changes the filename of any file under the library.uefi to remove the uefi as part of the name.
* Fix Errors when testing changes
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
`windowshelper.py` uses a path with backslashes without proper escaping.
While this works because `\s` and `\c` are not valid escape sequences,
this makes flake8 report:
/chipsec/helper/windows/windowshelper.py:71:53: W605 invalid escape sequence '\s'
/chipsec/helper/windows/windowshelper.py:71:67: W605 invalid escape sequence '\c'
Fix this by splitting the path when invoking `os.path.join`.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Commit 99f9052438 ("Remove filehelper") removed `from_file` and
`to_file` from `OsHelper` but it remained in `BaseHelper`. Remove these
parameters too.
While at it, remove the similar parameters from the mock helper used in
tests.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
With these annotations, mypy no longer report any issues in strict mode:
$ mypy --strict chipsec/helper/linuxnative/cpuid.py
Success: no issues found in 1 source file
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Make the machine code `bytes` instead of `list`. This makes it no longer
necessary to cast it to `c_ubyte * size` before using it.
While at it, add `mmap.MAP_PRIVATE` flag to the mapping, as it is not
needed to create a `MAP_SHARED` mapping for the code (which is the
default flag).
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Now that chipsec is no longer compatible with Python2, this import is no
longer useful.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
There is no point in doing a lazy-import with
`chipsec.helper.linuxnative.cpuid`, as the `cpuid` function is almost
always called when starting chipsec, to display the banner.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>