diff options
-rw-r--r-- | meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2/0001-encrypt_secret.py-fix-for-python3.patch | 56 | ||||
-rw-r--r-- | meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb | 1 |
2 files changed, 57 insertions, 0 deletions
diff --git a/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2/0001-encrypt_secret.py-fix-for-python3.patch b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2/0001-encrypt_secret.py-fix-for-python3.patch new file mode 100644 index 0000000..c029e26 --- /dev/null +++ b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2/0001-encrypt_secret.py-fix-for-python3.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From bfdfa6aea6f0c4ca5b075d172ef510899af01962 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
3 | Date: Fri, 20 Aug 2021 17:34:42 +0800 | ||
4 | Subject: [PATCH] encrypt_secret.py: fix for python3 | ||
5 | |||
6 | Fixes: | ||
7 | encrypt_secret.py -i "H31i05" > "primary_key.secret" || exit 1 | ||
8 | ERROR: Unable to encrypt the secret | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | |||
12 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
13 | --- | ||
14 | scripts/encrypt_secret.py.in | 16 +++++++++------- | ||
15 | 1 file changed, 9 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/scripts/encrypt_secret.py.in b/scripts/encrypt_secret.py.in | ||
18 | index ffd3213..e739183 100755 | ||
19 | --- a/scripts/encrypt_secret.py.in | ||
20 | +++ b/scripts/encrypt_secret.py.in | ||
21 | @@ -15,23 +15,25 @@ class Secret(): | ||
22 | def encrypt(self, input): | ||
23 | _ = SECRET_XOR_BYTE_CODE | ||
24 | |||
25 | - input = bytes(input) | ||
26 | + input = bytes(input, 'utf-8') | ||
27 | out = str() | ||
28 | - for b in input: | ||
29 | + for i in input: | ||
30 | + b = bytes([i]) | ||
31 | b = struct.unpack('<1B', b)[0] | ||
32 | _ = b ^ _ | ||
33 | - out = out + struct.pack('<1B', _) | ||
34 | + out = out + struct.pack('<1B', _).decode('utf-8') | ||
35 | |||
36 | return out | ||
37 | - | ||
38 | + | ||
39 | def decrypt(self, input): | ||
40 | _ = SECRET_XOR_BYTE_CODE | ||
41 | |||
42 | - input = bytes(input) | ||
43 | + input = bytes(input, 'utf-8') | ||
44 | out = str() | ||
45 | - for b in input: | ||
46 | + for i in input: | ||
47 | + b = bytes([i]) | ||
48 | b = struct.unpack('<1B', b)[0] | ||
49 | - out = out + struct.pack('<1B', b ^ _) | ||
50 | + out = out + struct.pack('<1B', b ^ _).decode('utf-8') | ||
51 | _ = b | ||
52 | |||
53 | return out | ||
54 | -- | ||
55 | 2.25.1 | ||
56 | |||
diff --git a/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb index e0ba90c..f80880f 100644 --- a/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb +++ b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb | |||
@@ -27,6 +27,7 @@ SRC_URI = "\ | |||
27 | file://0001-lib-Makefile-set-correct-soname-for-libcryptfs-tpm2.patch \ | 27 | file://0001-lib-Makefile-set-correct-soname-for-libcryptfs-tpm2.patch \ |
28 | file://0001-Remove-build-time-from-show_banner.patch \ | 28 | file://0001-Remove-build-time-from-show_banner.patch \ |
29 | file://0001-env.mk-fix-LDFLAGS-expansion.patch \ | 29 | file://0001-env.mk-fix-LDFLAGS-expansion.patch \ |
30 | file://0001-encrypt_secret.py-fix-for-python3.patch \ | ||
30 | " | 31 | " |
31 | SRCREV = "87c35c63090a33d4de437f518b8da9f2d1f1d828" | 32 | SRCREV = "87c35c63090a33d4de437f518b8da9f2d1f1d828" |
32 | 33 | ||