feat: add sgx-dcap.pck_id_retrieval_tool

for `PCKIDRetrievalTool`

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-03-13 15:21:31 +01:00
parent c66c2e4343
commit 795851e244
Signed by: harald
GPG key ID: F519A1143B3FBE32

View file

@ -11,13 +11,9 @@
, curl , curl
, zip , zip
, nixsgx , nixsgx
, , makeWrapper
}: }:
stdenv.mkDerivation rec {
let inherit (lib) optional; in
let
self = stdenv.mkDerivation rec {
pname = "sgx-dcap"; pname = "sgx-dcap";
version = "1.20"; version = "1.20";
@ -63,6 +59,7 @@ let
"ra_uefi" "ra_uefi"
"tdx_logic" "tdx_logic"
"libtdx_attest" "libtdx_attest"
"pck_id_retrieval_tool"
]; ];
patches = [ patches = [
@ -87,8 +84,7 @@ let
# sigh... Intel! # sigh... Intel!
installPhase = '' installPhase = ''
# set -x #set -xe
set -e
runHook preInstall runHook preInstall
# sigh... Intel! # sigh... Intel!
@ -111,6 +107,7 @@ let
./QuoteGeneration/installer/linux/common/libtdx-attest ./QuoteGeneration/installer/linux/common/libtdx-attest
./tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-network ./tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-network
./tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-uefi ./tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-uefi
./tools/PCKRetrievalTool/installer/common/sgx-pck-id-retrieval-tool
#./QuoteGeneration/installer/linux/common/sgx-dcap-pccs #./QuoteGeneration/installer/linux/common/sgx-dcap-pccs
) )
@ -149,9 +146,10 @@ let
"$ra_network" "$ra_network"
tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-uefi/output/libsgx-ra-uefi tools/SGXPlatformRegistration/package/installer/common/libsgx-ra-uefi/output/libsgx-ra-uefi
"$ra_uefi" "$ra_uefi"
tools/PCKRetrievalTool/installer/common/sgx-pck-id-retrieval-tool/output
"$pck_id_retrieval_tool"
#QuoteGeneration/installer/linux/common/sgx-dcap-pccs/output #QuoteGeneration/installer/linux/common/sgx-dcap-pccs/output
#"$pccs" #"$pccs"
# sgx-pck-id-retrieval-tool
# sgx-ra-service # sgx-ra-service
# tdx-qgs # tdx-qgs
) )
@ -164,8 +162,22 @@ let
mkdir -p "$dst" mkdir -p "$dst"
if [[ -d "$out/$src/opt/intel" ]]; then
find "$out/$src/opt/intel"
moveToOutput "$src/opt/intel" "$dst"
mkdir "$dst/bin"
mv "$dst/$src/opt/intel"/*/* "$dst/bin/"
fi
if [[ -d "$out/$src" ]]; then
find "$out/$src"
moveToOutput "$src" "$dst" moveToOutput "$src" "$dst"
fi
if [[ -d "$out/$src-dev" ]]; then
find "$out/$src-dev"
moveToOutput "$src-dev" "$dst" moveToOutput "$src-dev" "$dst"
fi
mv "$dst"/$src/* "$dst"/ mv "$dst"/$src/* "$dst"/
@ -187,11 +199,24 @@ let
mkdir -p "$out"/share/doc mkdir -p "$out"/share/doc
echo Hello > "$out"/share/doc/README.md echo Hello > "$out"/share/doc/README.md
rm "$pck_id_retrieval_tool"/bin/lib*so*
mkdir "$pck_id_retrieval_tool"/lib
cp QuoteGeneration/psw/ae/data/prebuilt/libsgx_id_enclave.signed.so "$pck_id_retrieval_tool"/lib
ln -fs ../lib/libsgx_id_enclave.signed.so "$pck_id_retrieval_tool"/bin/libsgx_id_enclave.signed.so.1
cp QuoteGeneration/psw/ae/data/prebuilt/libsgx_pce.signed.so "$pck_id_retrieval_tool"/lib
ln -fs ../lib/libsgx_pce.signed.so "$pck_id_retrieval_tool"/bin/libsgx_pce.signed.so.1
#set +x
runHook postInstall runHook postInstall
''; '';
postFixup = ''
wrapProgram "$pck_id_retrieval_tool/bin/PCKIDRetrievalTool" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ nixsgx.sgx-psw ]}:$ra_uefi/lib:$ra_network/lib"
'';
nativeBuildInputs = [ nativeBuildInputs = [
nixsgx.sgx-sdk makeWrapper
cmake cmake
openssl openssl
python3 python3
@ -202,6 +227,10 @@ let
zip zip
]; ];
buildInputs = [
nixsgx.sgx-sdk
];
doCheck = false; doCheck = false;
dontDisableStatic = false; dontDisableStatic = false;
@ -212,6 +241,4 @@ let
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];
license = with licenses; [ bsd3 ]; license = with licenses; [ bsd3 ];
}; };
}; }
in
self