Skip to content

Commit

Permalink
SecurityPkg: Added SecurityPkg to CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Krichanov committed Nov 1, 2024
1 parent 020db62 commit 0e8927d
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 19 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ jobs:
SKIP_TESTS: 1
SKIP_PACKAGE: 1

- name: Build SecurityPkg
if: always()
run: ./efibuild.sh
env:
SELFPKG: SecurityPkg
ARCHS: IA32,X64
SKIP_TESTS: 1
SKIP_PACKAGE: 1

build-windows:
name: Windows VS2019
runs-on: windows-latest
Expand Down Expand Up @@ -249,6 +258,15 @@ jobs:
SKIP_TESTS: 1
SKIP_PACKAGE: 1

- name: Build SecurityPkg
if: always()
run: ./efibuild.sh
env:
SELFPKG: SecurityPkg
ARCHS: IA32,X64
SKIP_TESTS: 1
SKIP_PACKAGE: 1

build-linux-clangpdb:
name: Linux CLANGPDB
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -373,6 +391,18 @@ jobs:
SKIP_TESTS: 1
SKIP_PACKAGE: 1

- name: Build SecurityPkg
if: always()
run: docker compose run build-package
env:
SELFPKG: SecurityPkg
SELFPKG_DIR: SecurityPkg
TOOLCHAINS: CLANGPDB
ARCHS: IA32,X64
TARGETS: RELEASE,DEBUG,NOOPT
SKIP_TESTS: 1
SKIP_PACKAGE: 1

build-linux-clangdwarf:
name: Linux CLANGDWARF
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -497,6 +527,18 @@ jobs:
SKIP_TESTS: 1
SKIP_PACKAGE: 1

- name: Build SecurityPkg
if: always()
run: docker compose run build-package
env:
SELFPKG: SecurityPkg
SELFPKG_DIR: SecurityPkg
TOOLCHAINS: CLANGDWARF
ARCHS: IA32,X64
TARGETS: RELEASE,DEBUG,NOOPT
SKIP_TESTS: 1
SKIP_PACKAGE: 1

build-linux-gcc5:
name: Linux GCC
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -620,3 +662,15 @@ jobs:
TARGETS: RELEASE,DEBUG,NOOPT
SKIP_TESTS: 1
SKIP_PACKAGE: 1

- name: Build SecurityPkg
if: always()
run: docker compose run build-package
env:
SELFPKG: SecurityPkg
SELFPKG_DIR: SecurityPkg
TOOLCHAINS: GCC
ARCHS: IA32,X64
TARGETS: RELEASE,DEBUG,NOOPT
SKIP_TESTS: 1
SKIP_PACKAGE: 1
2 changes: 1 addition & 1 deletion STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
| $${\color{lightblue}RedfishPkg/}$$ |
| RedfishPkg.dsc | IA32 X64 ARM AARCH64 RISCV64 | DEBUG RELEASE NOOPT |||
| $${\color{lightblue}SecurityPkg/}$$ |
| SecurityPkg.dsc | IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64 | DEBUG RELEASE NOOPT | ||
| SecurityPkg.dsc | IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64 | DEBUG RELEASE NOOPT | GCC CLANGDWARF CLANGPDB VS2019 XCODE5 ||
| Test/SecurityPkgHostTest.dsc | IA32 X64 | NOOPT |||
| $${\color{lightblue}ShellPkg/}$$ |
| ShellPkg.dsc | IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64 | DEBUG RELEASE NOOPT |||
Expand Down
37 changes: 19 additions & 18 deletions SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ Tpm2GetAlgoFromHashMask (
@retval EFI_SUCCESS Hash sequence start and HandleHandle returned.
@retval EFI_OUT_OF_RESOURCES No enough resource to start hash.
**/
BOOLEAN
EFI_STATUS
EFIAPI
HashStart (
OUT VOID **HashHandle
OUT HASH_HANDLE *HashHandle
)
{
TPMI_DH_OBJECT SequenceHandle;
Expand All @@ -72,12 +72,13 @@ HashStart (
AlgoId = Tpm2GetAlgoFromHashMask ();

Status = Tpm2HashSequenceStart (AlgoId, &SequenceHandle);
if (!EFI_ERROR (Status)) {
*HashHandle = (VOID *)(UINTN)SequenceHandle;
return TRUE;
if (EFI_ERROR (Status)) {
return Status;
}

return FALSE;
*HashHandle = (HASH_HANDLE)SequenceHandle;

return EFI_SUCCESS;
}

/**
Expand All @@ -89,11 +90,11 @@ HashStart (
@retval EFI_SUCCESS Hash sequence updated.
**/
BOOLEAN
EFI_STATUS
EFIAPI
HashUpdate (
IN VOID *HashHandle,
IN CONST VOID *DataToHash,
IN HASH_HANDLE HashHandle,
IN VOID *DataToHash,
IN UINTN DataToHashLen
)
{
Expand All @@ -108,9 +109,9 @@ HashUpdate (
CopyMem (HashBuffer.buffer, Buffer, sizeof (HashBuffer.buffer));
Buffer += sizeof (HashBuffer.buffer);

Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)(UINTN)HashHandle, &HashBuffer);
Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)HashHandle, &HashBuffer);
if (EFI_ERROR (Status)) {
return FALSE;
return Status;
}
}

Expand All @@ -119,12 +120,12 @@ HashUpdate (
//
HashBuffer.size = (UINT16)HashLen;
CopyMem (HashBuffer.buffer, Buffer, (UINTN)HashLen);
Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)(UINTN)HashHandle, &HashBuffer);
Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)HashHandle, &HashBuffer);
if (EFI_ERROR (Status)) {
return FALSE;
return Status;
}

return TRUE;
return EFI_SUCCESS;
}

/**
Expand All @@ -141,7 +142,7 @@ HashUpdate (
EFI_STATUS
EFIAPI
HashCompleteAndExtend (
IN VOID *HashHandle,
IN HASH_HANDLE HashHandle,
IN TPMI_DH_PCR PcrIndex,
IN VOID *DataToHash,
IN UINTN DataToHashLen,
Expand All @@ -163,7 +164,7 @@ HashCompleteAndExtend (
CopyMem (HashBuffer.buffer, Buffer, sizeof (HashBuffer.buffer));
Buffer += sizeof (HashBuffer.buffer);

Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)(UINTN)HashHandle, &HashBuffer);
Status = Tpm2SequenceUpdate ((TPMI_DH_OBJECT)HashHandle, &HashBuffer);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
Expand All @@ -181,13 +182,13 @@ HashCompleteAndExtend (
if (AlgoId == TPM_ALG_NULL) {
Status = Tpm2EventSequenceComplete (
PcrIndex,
(TPMI_DH_OBJECT)(UINTN)HashHandle,
(TPMI_DH_OBJECT)HashHandle,
&HashBuffer,
DigestList
);
} else {
Status = Tpm2SequenceComplete (
(TPMI_DH_OBJECT)(UINTN)HashHandle,
(TPMI_DH_OBJECT)HashHandle,
&HashBuffer,
&Result
);
Expand Down

0 comments on commit 0e8927d

Please sign in to comment.