Skip to content

Commit 5346f83

Browse files
Add optee-ftpm_manufacturer package
1 parent 8e44ecc commit 5346f83

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

default.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ let
7676
inherit bspSrc gitRepos l4tVersion;
7777
}) buildTOS buildOpteeTaDevKit opteeClient;
7878

79-
optee-gen-ekb = pkgs.callPackage ./pkgs/optee-gen-ekb { inherit opteeClient; };
79+
optee-gen-ekb = callPackage ./pkgs/optee-gen-ekb { inherit opteeClient; };
80+
optee-ftpm-manufacturer = callPackage ./pkgs/optee-ftpm_manufacturer { inherit opteeClient; };
8081

8182
flash-tools = callPackage ./pkgs/flash-tools {
8283
inherit bspSrc l4tVersion;
@@ -176,7 +177,7 @@ rec {
176177
inherit otaUtils;
177178

178179
inherit opteeClient;
179-
inherit optee-gen-ekb;
180+
inherit optee-gen-ekb optee-ftpm-manufacturer;
180181

181182
# TODO: Source packages. source_sync.sh from bspSrc
182183
# GST plugins
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
opteeClient,
3+
stdenvNoCC,
4+
python3,
5+
fetchFromGitHub,
6+
openssl
7+
}:
8+
let
9+
# Latest 1.5.1 release fails in x509.Name.build likely due
10+
# to PR270 and/or PR271. https://github.com/wbond/asn1crypto/pull/270
11+
asn1crypto' = python3.pkgs.asn1crypto.overrideAttrs (prev: {
12+
version = "unstable-git-20231103";
13+
src = fetchFromGitHub {
14+
owner = "wbond";
15+
repo = "asn1crypto";
16+
rev = "b763a757bb2bef2ab63620611ddd8006d5e9e4a2";
17+
hash = "sha256-11WajEDtisiJsKQjZMSd5sDog3DuuBzf1PcgSY+uuXY=";
18+
};
19+
});
20+
in
21+
stdenvNoCC.mkDerivation {
22+
pname = "optee-ftpm-manufacturer";
23+
version = opteeClient.version;
24+
src = opteeClient.src;
25+
pythonPath = with python3.pkgs; [
26+
asn1crypto' # use newer, pinned version
27+
cryptography
28+
ecdsa
29+
numpy
30+
oscrypto
31+
pyaes
32+
pycryptodome
33+
pycryptodomex
34+
];
35+
nativeBuildInputs = [ python3.pkgs.wrapPython ];
36+
format = "none";
37+
installPhase = ''
38+
mkdir -p $out/bin $out/lib
39+
cp optee/samples/ftpm-helper/host/tool/ftpm_manufacturer_gen_ek_csr.sh $out/bin/optee-ftpm-manufacturer
40+
substituteInPlace $out/bin/optee-ftpm-manufacturer \
41+
--replace './ftpm_manufacturer_gen_ek_csr_tool.py' "$out/lib/ftpm_manufacturer_gen_ek_csr_tool.py"
42+
patchShebangs $out/bin/optee-ftpm-manufacturer
43+
cp optee/samples/ftpm-helper/host/tool/ftpm_manufacturer_gen_ek_csr_tool.py $out/lib/ftpm_manufacturer_gen_ek_csr_tool.py
44+
cp -r optee/samples/ftpm-helper/host/tool/lib $out/lib/lib
45+
wrapPythonProgramsIn "$out/lib" "$pythonPath"
46+
'';
47+
postFixup = ''
48+
wrapProgram $out/bin/optee-ftpm-manufacturer \
49+
--prefix PATH : ${openssl}/bin
50+
'';
51+
}

0 commit comments

Comments
 (0)