All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules
@ 2020-03-08 18:35 Romain Naour
  2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Romain Naour @ 2020-03-08 18:35 UTC (permalink / raw)
  To: buildroot

optee-os needs host-python-pycrypto build for python3. The only way we can
force building host-python modules for python3 is to select python3 package
for the target.

Since we want to avoid adding more host-python3-<modules>
(host-python-pycrypto host-python-pyelftools), select python3 package
even if it's not used.

This problem will be fixed as soon as python2 is removed.

Fixes:
File "scripts/pem_to_pub_c.py", line 24, in main
from Crypto.PublicKey import RSA
ImportError: No module named 'Crypto'

https://gitlab.com/buildroot.org/buildroot/-/jobs/456818689

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Etienne Carriere <etienne.carriere@linaro.org>
---
 configs/qemu_arm_vexpress_tz_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configs/qemu_arm_vexpress_tz_defconfig b/configs/qemu_arm_vexpress_tz_defconfig
index ccc0dca3ec..374612e549 100644
--- a/configs/qemu_arm_vexpress_tz_defconfig
+++ b/configs/qemu_arm_vexpress_tz_defconfig
@@ -38,6 +38,13 @@ BR2_PACKAGE_OPTEE_BENCHMARK=y
 BR2_PACKAGE_OPTEE_EXAMPLES=y
 BR2_PACKAGE_OPTEE_TEST=y
 
+# OP-TEE components needs host-python3 interpreter and it's modules
+BR2_PACKAGE_HOST_PYTHON3=y
+# Select python3 on the target to make sure Buildroot build host-python using
+# python3 and build all python modules for python3.
+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
+BR2_PACKAGE_PYTHON3=y
+
 # U-boot for booting the dear Linux kernel
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python
  2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
@ 2020-03-08 18:35 ` Romain Naour
  2020-03-08 20:06   ` Peter Korsgaard
  2020-03-15 11:00   ` Peter Korsgaard
  2020-03-08 18:35 ` [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility Romain Naour
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: Romain Naour @ 2020-03-08 18:35 UTC (permalink / raw)
  To: buildroot

Fixes:
TypeError: cannot use a str to initialize an array with typecode 'B'
  File "../../scripts/file_to_c.py", line 32, in main
    for x in array.array("B", inf.read()):
    for x in array.array("B", inf.read()):
TypeError: cannot use a str to initialize an array with typecode 'B'
TypeError: cannot use a str to initialize an array with typecode 'B'

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 .../0001-use-python3-instead-of-python.patch  | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 package/optee-test/0001-use-python3-instead-of-python.patch

diff --git a/package/optee-test/0001-use-python3-instead-of-python.patch b/package/optee-test/0001-use-python3-instead-of-python.patch
new file mode 100644
index 0000000000..2765a980db
--- /dev/null
+++ b/package/optee-test/0001-use-python3-instead-of-python.patch
@@ -0,0 +1,50 @@
+From cc3cb798375c5f47ea5c7579f32060933435e231 Mon Sep 17 00:00:00 2001
+From: Scott Branden <scott.branden@broadcom.com>
+Date: Fri, 27 Dec 2019 12:54:28 -0800
+Subject: [PATCH] use python3 instead of python
+
+use python3 instead of python as python2 is EOL January 2020.
+
+Signed-off-by: Scott Branden <scott.branden@broadcom.com>
+Reviewed-by: Jerome Forissier <jerome@forissier.org>
+Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, CFG_GCM_NIST_VECTORS=y)
+
+(cherry picked from commit 6271160639002a2580d80b75b5397a96d56329f2)
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ scripts/file_to_c.py       | 4 ++--
+ scripts/rsp_to_gcm_test.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/file_to_c.py b/scripts/file_to_c.py
+index ae16f52..b4ce2a2 100755
+--- a/scripts/file_to_c.py
++++ b/scripts/file_to_c.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # SPDX-License-Identifier: BSD-2-Clause
+ #
+ # Copyright (c) 2018, Linaro Limited
+@@ -29,7 +29,7 @@ def main():
+ 
+     f.write("const uint8_t " + args.name + "[] = {\n")
+     i = 0
+-    for x in array.array("B", inf.read()):
++    for x in array.array("B", map(ord, (inf.read()))):
+         f.write("0x" + '{0:02x}'.format(x) + ",")
+         i = i + 1
+         if i % 8 == 0:
+diff --git a/scripts/rsp_to_gcm_test.py b/scripts/rsp_to_gcm_test.py
+index 0543541..e4418be 100755
+--- a/scripts/rsp_to_gcm_test.py
++++ b/scripts/rsp_to_gcm_test.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ modes = {'encrypt': 0, 'decrypt': 1}
+ 
+-- 
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility
  2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
  2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
@ 2020-03-08 18:35 ` Romain Naour
  2020-03-08 20:08   ` Peter Korsgaard
  2020-03-08 18:35 ` [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting Romain Naour
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Romain Naour @ 2020-03-08 18:35 UTC (permalink / raw)
  To: buildroot

As reported by [1], time clock was deprecated in Python 3.3 and removed in Python 3.8.
Apply the patch from the PR [2] since there is no upstream activity.

Fixes:
>>> optee-os 3.7.0 Building
Traceback (most recent call last):
  File "scripts/sign.py", line 234, in <module>
    main()
  File "scripts/sign.py", line 224, in main
    {
  File "scripts/sign.py", line 189, in sign_ta
    sig = signer.sign(h)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Signature/PKCS1_v1_5.py", line 112, in sign
    m = self._key.decrypt(em)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 174, in decrypt
    return pubkey.pubkey.decrypt(self, ciphertext)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/pubkey.py", line 93, in decrypt
    plaintext=self._decrypt(ciphertext)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 235, in _decrypt
    r = getRandomRange(1, self.key.n-1, randfunc=self._randfunc)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Util/number.py", line 123, in getRandomRange
    value = getRandomInteger(bits, randfunc)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Util/number.py", line 104, in getRandomInteger
    S = randfunc(N>>3)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
    return _UserFriendlyRNG.read(self, bytes)
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
    self._ec.collect()
  File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
    t = time.clock()
AttributeError: module 'time' has no attribute 'clock'

This issue could be reproduced on the target.

[1] https://github.com/dlitz/pycrypto/issues/283
[2] https://github.com/dlitz/pycrypto/pull/296

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 ...ock-with-time.process_time-time-cloc.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch

diff --git a/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch b/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch
new file mode 100644
index 0000000000..b12b58ddf1
--- /dev/null
+++ b/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch
@@ -0,0 +1,35 @@
+From 6d76976527096cf0138d61fc25bd932d725f8436 Mon Sep 17 00:00:00 2001
+From: Fabian Topfstedt <topfstedt@schneevonmorgen.com>
+Date: Mon, 18 Nov 2019 22:19:35 +0100
+Subject: [PATCH] replaced time.clock with time.process_time (time clock was
+ flagged as deprecated in Python 3.3 and got removed in Python 3.8)
+
+Downloaded from github pull request [1].
+Related to issue [2].
+
+[1] https://github.com/dlitz/pycrypto/pull/296
+[2] https://github.com/dlitz/pycrypto/issues/283
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ lib/Crypto/Random/_UserFriendlyRNG.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Crypto/Random/_UserFriendlyRNG.py b/lib/Crypto/Random/_UserFriendlyRNG.py
+index 957e006..f389cfc 100644
+--- a/lib/Crypto/Random/_UserFriendlyRNG.py
++++ b/lib/Crypto/Random/_UserFriendlyRNG.py
+@@ -73,8 +73,8 @@ class _EntropyCollector(object):
+         t = time.time()
+         self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+ 
+-        # Add the fractional part of time.clock()
+-        t = time.clock()
++        # Add the fractional part of time.process_time()
++        t = time.process_time()
+         self._clock_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+ 
+ 
+-- 
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting
  2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
  2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
  2020-03-08 18:35 ` [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility Romain Naour
@ 2020-03-08 18:35 ` Romain Naour
  2020-03-08 20:10   ` Peter Korsgaard
  2020-03-08 19:58 ` [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Peter Korsgaard
  2020-03-15 10:59 ` Peter Korsgaard
  4 siblings, 1 reply; 10+ messages in thread
From: Romain Naour @ 2020-03-08 18:35 UTC (permalink / raw)
  To: buildroot

From: Adrien Grassein <adrien.grassein@smile.fr>

The Buildroot's gitlab testing infra reported a build issue
with the qemu_arm_vexpress_tz_defconfig due to host-python3
modules issues [1]. Thoses issues has been fixed by the
previous patch.

But the defconfig doesn't boot with the current master
(2020.02-rc3).

It turn out that is an Qemu 4.2.0 regression that was
fixed upstream by [2]. This issue was found by using
git bisect old/new.

Fixes:
$ ../host/bin/qemu-system-arm -machine virt -machine secure=on -cpu cortex-a15 -smp 1 -s -m 1024 -d unimp -serial stdio -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic -semihosting-config enable,target=native -bios bl1.bin
NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v2.0(release):2020.02-rc3-43-g9abf171ea6
NOTICE:  BL1: Built : 12:44:52, Mar  8 2020
ERROR:   Failed to load BL2 firmware.

After fixing host-python3 issue from [1]

[1] https://gitlab.com/buildroot.org/buildroot/-/jobs/456818689
[2] https://github.com/qemu/qemu/commit/21bf9b06cb6d07c6cc437dfd47b47b28c2bb79db

Signed-off-by: Adrien Grassein <adrien.grassein@smile.fr>
[Romain:
  - improve commit log
  - add upstream link
]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Gerome Burlats <gerome.burlats@smile.fr>
---
 ...emi-fix-SYS_OPEN-to-return-nonzero-f.patch | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 package/qemu/4.2.0/0003-target-arm-arm-semi-fix-SYS_OPEN-to-return-nonzero-f.patch

diff --git a/package/qemu/4.2.0/0003-target-arm-arm-semi-fix-SYS_OPEN-to-return-nonzero-f.patch b/package/qemu/4.2.0/0003-target-arm-arm-semi-fix-SYS_OPEN-to-return-nonzero-f.patch
new file mode 100644
index 0000000000..46652d8298
--- /dev/null
+++ b/package/qemu/4.2.0/0003-target-arm-arm-semi-fix-SYS_OPEN-to-return-nonzero-f.patch
@@ -0,0 +1,78 @@
+From 318f83f387678a3c0a2a729b506613011c6830b2 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Fri, 17 Jan 2020 14:09:30 +0000
+Subject: [PATCH] target/arm/arm-semi: fix SYS_OPEN to return nonzero
+ filehandle
+
+According to the specification "Semihosting for AArch32 and Aarch64",
+the SYS_OPEN operation should return:
+
+ - A nonzero handle if the call is successful
+ - -1 if the call is not successful
+
+So, it should never return 0.
+
+Prior to commit 35e9a0a8ce4b ("target/arm/arm-semi: Make semihosting
+code hand out its own file descriptors"), the guest fd matched to the
+host fd. It returned a nonzero handle on success since the fd 0 is
+already used for stdin.
+
+Now that the guest fd is the index of guestfd_array, it starts from 0.
+
+I noticed this issue particularly because Trusted Firmware-A built with
+PLAT=qemu is no longer working. Its io_semihosting driver only handles
+a positive return value as a valid filehandle.
+
+Basically, there are two ways to fix this:
+
+  - Use (guestfd - 1) as the index of guestfs_arrary. We need to insert
+    increment/decrement to convert the guestfd and the array index back
+    and forth.
+
+  - Keep using guestfd as the index of guestfs_array. The first entry
+    of guestfs_array is left unused.
+
+I thought the latter is simpler. We end up with wasting a small piece
+of memory for the unused first entry of guestfd_array, but this is
+probably not a big deal.
+
+Fixes: 35e9a0a8ce4b ("target/arm/arm-semi: Make semihosting code hand out its own file descriptors")
+Cc: qemu-stable at nongnu.org
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
+Message-id: 20200109041228.10131-1-masahiroy at kernel.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+
+(cherry picked from commit 21bf9b06cb6d07c6cc437dfd47b47b28c2bb79db)
+Signed-off-by: Adrien Grassein <adrien.grassein@smile.fr>
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ target/arm/arm-semi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
+index 6f7b6d801b..4275dfc345 100644
+--- a/target/arm/arm-semi.c
++++ b/target/arm/arm-semi.c
+@@ -144,7 +144,8 @@ static int alloc_guestfd(void)
+         guestfd_array = g_array_new(FALSE, TRUE, sizeof(GuestFD));
+     }
+ 
+-    for (i = 0; i < guestfd_array->len; i++) {
++    /* SYS_OPEN should return nonzero handle on success. Start guestfd from 1 */
++    for (i = 1; i < guestfd_array->len; i++) {
+         GuestFD *gf = &g_array_index(guestfd_array, GuestFD, i);
+ 
+         if (gf->type == GuestFDUnused) {
+@@ -168,7 +169,7 @@ static GuestFD *do_get_guestfd(int guestfd)
+         return NULL;
+     }
+ 
+-    if (guestfd < 0 || guestfd >= guestfd_array->len) {
++    if (guestfd <= 0 || guestfd >= guestfd_array->len) {
+         return NULL;
+     }
+ 
+-- 
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules
  2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
                   ` (2 preceding siblings ...)
  2020-03-08 18:35 ` [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting Romain Naour
@ 2020-03-08 19:58 ` Peter Korsgaard
  2020-03-15 10:59 ` Peter Korsgaard
  4 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-08 19:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > optee-os needs host-python-pycrypto build for python3. The only way we can
 > force building host-python modules for python3 is to select python3 package
 > for the target.

 > Since we want to avoid adding more host-python3-<modules>
 > (host-python-pycrypto host-python-pyelftools), select python3 package
 > even if it's not used.

 > This problem will be fixed as soon as python2 is removed.

 > Fixes:
 > File "scripts/pem_to_pub_c.py", line 24, in main
 > from Crypto.PublicKey import RSA
 > ImportError: No module named 'Crypto'

 > https://gitlab.com/buildroot.org/buildroot/-/jobs/456818689

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > Cc: Etienne Carriere <etienne.carriere@linaro.org>

It isn't great, but I also don't see any other quick solutions -
Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python
  2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
@ 2020-03-08 20:06   ` Peter Korsgaard
  2020-03-15 11:00   ` Peter Korsgaard
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-08 20:06 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > Fixes:
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 >   File "../../scripts/file_to_c.py", line 32, in main
 >     for x in array.array("B", inf.read()):
 >     for x in array.array("B", inf.read()):
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 > TypeError: cannot use a str to initialize an array with typecode 'B'

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>

Reworded the commit message a bit and committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility
  2020-03-08 18:35 ` [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility Romain Naour
@ 2020-03-08 20:08   ` Peter Korsgaard
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-08 20:08 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > As reported by [1], time clock was deprecated in Python 3.3 and removed in Python 3.8.
 > Apply the patch from the PR [2] since there is no upstream activity.

 > Fixes:
 >>>> optee-os 3.7.0 Building
 > Traceback (most recent call last):
 >   File "scripts/sign.py", line 234, in <module>
 >     main()
 >   File "scripts/sign.py", line 224, in main
 >     {
 >   File "scripts/sign.py", line 189, in sign_ta
 >     sig = signer.sign(h)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Signature/PKCS1_v1_5.py", line 112, in sign
 >     m = self._key.decrypt(em)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 174, in decrypt
 >     return pubkey.pubkey.decrypt(self, ciphertext)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/pubkey.py", line 93, in decrypt
 >     plaintext=self._decrypt(ciphertext)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 235, in _decrypt
 >     r = getRandomRange(1, self.key.n-1, randfunc=self._randfunc)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Util/number.py", line 123, in getRandomRange
 >     value = getRandomInteger(bits, randfunc)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Util/number.py", line 104, in getRandomInteger
 >     S = randfunc(N>>3)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
 >     return self._singleton.read(bytes)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
 >     return _UserFriendlyRNG.read(self, bytes)
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
 >     self._ec.collect()
 >   File "/home/naourr/buildroot/test/qemu_arm_vexpress_tz/host/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
 >     t = time.clock()
 > AttributeError: module 'time' has no attribute 'clock'

 > This issue could be reproduced on the target.

 > [1] https://github.com/dlitz/pycrypto/issues/283
 > [2] https://github.com/dlitz/pycrypto/pull/296

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > ---
 >  ...ock-with-time.process_time-time-cloc.patch | 35 +++++++++++++++++++
 >  1 file changed, 35 insertions(+)
 >  create mode 100644 package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch

 > diff --git a/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch b/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch
 > new file mode 100644
 > index 0000000000..b12b58ddf1
 > --- /dev/null
 > +++ b/package/python-pycrypto/0002-replaced-time.clock-with-time.process_time-time-cloc.patch
 > @@ -0,0 +1,35 @@
 > +From 6d76976527096cf0138d61fc25bd932d725f8436 Mon Sep 17 00:00:00 2001
 > +From: Fabian Topfstedt <topfstedt@schneevonmorgen.com>
 > +Date: Mon, 18 Nov 2019 22:19:35 +0100
 > +Subject: [PATCH] replaced time.clock with time.process_time (time clock was
 > + flagged as deprecated in Python 3.3 and got removed in Python 3.8)
 > +
 > +Downloaded from github pull request [1].
 > +Related to issue [2].
 > +
 > +[1] https://github.com/dlitz/pycrypto/pull/296
 > +[2] https://github.com/dlitz/pycrypto/issues/283
 > +
 > +Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > +---
 > + lib/Crypto/Random/_UserFriendlyRNG.py | 4 ++--
 > + 1 file changed, 2 insertions(+), 2 deletions(-)
 > +
 > +diff --git a/lib/Crypto/Random/_UserFriendlyRNG.py b/lib/Crypto/Random/_UserFriendlyRNG.py
 > +index 957e006..f389cfc 100644
 > +--- a/lib/Crypto/Random/_UserFriendlyRNG.py
 > ++++ b/lib/Crypto/Random/_UserFriendlyRNG.py
 > +@@ -73,8 +73,8 @@ class _EntropyCollector(object):
 > +         t = time.time()
 > +         self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
 > + 
 > +-        # Add the fractional part of time.clock()
 > +-        t = time.clock()
 > ++        # Add the fractional part of time.process_time()
 > ++        t = time.process_time()

This unfortunately does not work with python 2.x:

python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.process_time()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'process_time'
>>> time.clock()
0.016955

So we will need to make it conditional as long as we support python 2.x.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting
  2020-03-08 18:35 ` [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting Romain Naour
@ 2020-03-08 20:10   ` Peter Korsgaard
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-08 20:10 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > From: Adrien Grassein <adrien.grassein@smile.fr>
 > The Buildroot's gitlab testing infra reported a build issue
 > with the qemu_arm_vexpress_tz_defconfig due to host-python3
 > modules issues [1]. Thoses issues has been fixed by the
 > previous patch.

 > But the defconfig doesn't boot with the current master
 > (2020.02-rc3).

 > It turn out that is an Qemu 4.2.0 regression that was
 > fixed upstream by [2]. This issue was found by using
 > git bisect old/new.

 > Fixes:
 > $ ../host/bin/qemu-system-arm -machine virt -machine secure=on -cpu cortex-a15 -smp 1 -s -m 1024 -d unimp -serial stdio -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic -semihosting-config enable,target=native -bios bl1.bin
 > NOTICE:  Booting Trusted Firmware
 > NOTICE:  BL1: v2.0(release):2020.02-rc3-43-g9abf171ea6
 > NOTICE:  BL1: Built : 12:44:52, Mar  8 2020
 > ERROR:   Failed to load BL2 firmware.

 > After fixing host-python3 issue from [1]

 > [1] https://gitlab.com/buildroot.org/buildroot/-/jobs/456818689
 > [2] https://github.com/qemu/qemu/commit/21bf9b06cb6d07c6cc437dfd47b47b28c2bb79db

 > Signed-off-by: Adrien Grassein <adrien.grassein@smile.fr>
 > [Romain:
 >   - improve commit log
 >   - add upstream link
 > ]
 > Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > Cc: Etienne Carriere <etienne.carriere@linaro.org>
 > Cc: Gerome Burlats <gerome.burlats@smile.fr>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules
  2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
                   ` (3 preceding siblings ...)
  2020-03-08 19:58 ` [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Peter Korsgaard
@ 2020-03-15 10:59 ` Peter Korsgaard
  4 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-15 10:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > optee-os needs host-python-pycrypto build for python3. The only way we can
 > force building host-python modules for python3 is to select python3 package
 > for the target.

 > Since we want to avoid adding more host-python3-<modules>
 > (host-python-pycrypto host-python-pyelftools), select python3 package
 > even if it's not used.

 > This problem will be fixed as soon as python2 is removed.

 > Fixes:
 > File "scripts/pem_to_pub_c.py", line 24, in main
 > from Crypto.PublicKey import RSA
 > ImportError: No module named 'Crypto'

 > https://gitlab.com/buildroot.org/buildroot/-/jobs/456818689

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > Cc: Etienne Carriere <etienne.carriere@linaro.org>

Committed to 2019.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python
  2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
  2020-03-08 20:06   ` Peter Korsgaard
@ 2020-03-15 11:00   ` Peter Korsgaard
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2020-03-15 11:00 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > Fixes:
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 >   File "../../scripts/file_to_c.py", line 32, in main
 >     for x in array.array("B", inf.read()):
 >     for x in array.array("B", inf.read()):
 > TypeError: cannot use a str to initialize an array with typecode 'B'
 > TypeError: cannot use a str to initialize an array with typecode 'B'

 > Signed-off-by: Romain Naour <romain.naour@smile.fr>

Committed to 2019.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-15 11:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-08 18:35 [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Romain Naour
2020-03-08 18:35 ` [Buildroot] [PATCH 2/4] package/optee-test: use python3 instead of python Romain Naour
2020-03-08 20:06   ` Peter Korsgaard
2020-03-15 11:00   ` Peter Korsgaard
2020-03-08 18:35 ` [Buildroot] [PATCH 3/4] package/python-pycrypto: fix python3.8 compatibility Romain Naour
2020-03-08 20:08   ` Peter Korsgaard
2020-03-08 18:35 ` [Buildroot] [PATCH 4/4] package/qemu: Fix a regression in semihosting Romain Naour
2020-03-08 20:10   ` Peter Korsgaard
2020-03-08 19:58 ` [Buildroot] [PATCH 1/4] configs/qemu_arm_vexpress_tz_defconfig: optee needs host-python3 w/ modules Peter Korsgaard
2020-03-15 10:59 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.