Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audk SecurityPkg hashing is broken since merge of new PE loader #2430

Open
mikebeaton opened this issue Sep 28, 2024 · 0 comments
Open

audk SecurityPkg hashing is broken since merge of new PE loader #2430

mikebeaton opened this issue Sep 28, 2024 · 0 comments

Comments

@mikebeaton
Copy link
Contributor

acidanthera/audk@a955e88 "SecurePE: Replaced old PE loader with Secure one" breaks SecurityPkg hashing. In particular, OvmfPkg can no longer be compiled with -D TPM2_ENABLE.

For example:

build -p OvmfPkg/OvmfPkgIa32X64.dsc -b DEBUG -t XCODE5 -a IA32 -a X64 -D TPM2_ENABLE

fails with

/Users/mjsbeaton/OpenSource/audk/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c:119:3: error: incompatible function pointer types initializing 'HASH_INIT' (aka 'unsigned long long (*)(unsigned long long *)') with an expression of type 'BOOLEAN (void **)' (aka 'unsigned char (void **)') [-Werror,-Wincompatible-function-pointer-types]
  Sm3HashInit,
  ^~~~~~~~~~~
/Users/mjsbeaton/OpenSource/audk/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c:120:3: error: incompatible function pointer types initializing 'HASH_UPDATE' (aka 'unsigned long long (*)(unsigned long long, void *, unsigned long long)') with an expression of type 'BOOLEAN (void *, const void *, UINTN)' (aka 'unsigned char (void *, const void *, unsigned long long)') [-Werror,-Wincompatible-function-pointer-types]
  Sm3HashUpdate,
  ^~~~~~~~~~~~~
/Users/mjsbeaton/OpenSource/audk/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c:121:3: error: incompatible function pointer types initializing 'HASH_FINAL' (aka 'unsigned long long (*)(unsigned long long, TPML_DIGEST_VALUES *)') with an expression of type 'BOOLEAN (void *, TPML_DIGEST_VALUES *)' (aka 'unsigned char (void *, TPML_DIGEST_VALUES *)') [-Werror,-Wincompatible-function-pointer-types]
  Sm3HashFinal,
  ^~~~~~~~~~~~
3 errors generated.

The error is correct. The commit has updated the methods in question to return BOOLEAN where they previously returned EFI_STATUS:

acidanthera/audk@a955e88#diff-11a5b6c447f1dc018c114f8e2f769347c0ad8268f2310d77309eb2275c64a3d9 (takes a while to load)

But they are being assigned to an interface which still expects them to return EFI_STATUS:

https://github.com/acidanthera/audk/blob/a955e8811bc9e34d7d01ab373aefaecc5fde5a3c/SecurityPkg/Include/Library/HashLib.h#L90-L150

@mikebeaton mikebeaton changed the title audk SecurityPkg hashing is broken by merge of new PE loader audk SecurityPkg hashing is broken since merge of new PE loader Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants