diff mbox series

Fix OpTee PyCryptodomex Python 2 vs 3 issue

Message ID a5494fd8-e371-84a5-b952-ebd6ab04a41b@brainlab.com
State Rejected
Headers show
Series Fix OpTee PyCryptodomex Python 2 vs 3 issue | expand

Commit Message

Jonatan Hatakeyama Zeidler Aug. 6, 2020, 9:30 a.m. UTC
Hi there,

I am using buildroot.2020.05.1. I am building optee with these options:

BR2_TARGET_OPTEE_OS=y
BR2_TARGET_OPTEE_OS_PLATFORM="k3-am65x"
BR2_TARGET_OPTEE_OS_CORE_IMAGES="tee-*_v2.bin"

These leads to

Traceback (most recent call last):
File "scripts/pem_to_pub_c.py", line 61, in <module>
main()
File "scripts/pem_to_pub_c.py", line 24, in main
from Cryptodome.PublicKey import RSA
ModuleNotFoundError: No module named 'Cryptodome'

during build of optee-os. The script scripts/pem_to_pub_c.py is run with Python3, while optee-os has Python2 dependencies:

OPTEE_OS_DEPENDENCIES = host-openssl host-python-pycryptodomex host-python-pyelftools.

Thus, the Cryptodome module is not found.

What fixed that for me is to add a python3-pycryptodomex package and change `optee-os` dependencies to Python3 ones. The patches are attached.

Let me know whether adding these patches makes sense to you.

Kind regards and thanks for your great work on buildroot,

Jonatan

--
Jonatan Hatakeyama Zeidler
Software Engineer
Brainlab Robotics

T +49 89 99 15 68 – 0
F +49 89 99 15 68 – 5033

Medineering GmbH
Olof-Palme-Str. 1, 81829 München, Germany
Sitz d. Gesellschaft: München - Handelsregister: München HRB 212991
VAT.: DE296021936
Managing Director: Dr.-Ing. Maximilian Krinninger, Dr.-Ing. Stephan Nowatschin

This email, including its attachments, is intended only for the confidential use of the individual to whom it is addressed. If you are not the intended recipient, any use, dissemination, distribution or copying of this message or its attachments is prohibited. If you have received this message in error, please notify us immediately, and delete this message and its attachments permanently from your system.

Comments

Thomas Petazzoni Aug. 6, 2020, 7:43 p.m. UTC | #1
Hello Jonatan,

On Thu, 6 Aug 2020 09:30:00 +0000
Jonatan Hatakeyama Zeidler <jonatan.zeidler@brainlab.com> wrote:

> These leads to
> 
> Traceback (most recent call last):
> File "scripts/pem_to_pub_c.py", line 61, in <module>
> main()
> File "scripts/pem_to_pub_c.py", line 24, in main
> from Cryptodome.PublicKey import RSA
> ModuleNotFoundError: No module named 'Cryptodome'
> 
> during build of optee-os. The script scripts/pem_to_pub_c.py is run with Python3, while optee-os has Python2 dependencies:
> 
> OPTEE_OS_DEPENDENCIES = host-openssl host-python-pycryptodomex host-python-pyelftools.
> 
> Thus, the Cryptodome module is not found.
> 
> What fixed that for me is to add a python3-pycryptodomex package and change `optee-os` dependencies to Python3 ones. The patches are attached.

I haven't reviewed your patch, nor the patch series I will point, but I
believe the patch series at:

  https://patchwork.ozlabs.org/project/buildroot/list/?series=191437

should address this issue.

Best regards,

Thomas
Jonatan Hatakeyama Zeidler Aug. 7, 2020, 7:12 a.m. UTC | #2
Hello Thomas,


On 06.08.20 21:43, Thomas Petazzoni wrote:
>
> I haven't reviewed your patch, nor the patch series I will point, but I
> believe the patch series at:
>
>   https://patchwork.ozlabs.org/project/buildroot/list/?series=191437
>
> should address this issue.

this addresses the same issue indeed. Is there anything I can do to help
get that merged?

Best regards

Jonatan
diff mbox series

Patch

From 0062e7f85a49265ee1d29465eab069c80b9080e4 Mon Sep 17 00:00:00 2001
From: Jonatan Hatakeyama Zeidler <jonatan.zeidler@medineering.de>
Date: Thu, 6 Aug 2020 11:27:27 +0200
Subject: [PATCH] Optee-OS use Python3 dependencies

---
 boot/optee-os/optee-os.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/optee-os/optee-os.mk b/boot/optee-os/optee-os.mk
index c6d1bbd..e9928b1 100644
--- a/boot/optee-os/optee-os.mk
+++ b/boot/optee-os/optee-os.mk
@@ -21,7 +21,7 @@  else
 OPTEE_OS_SITE = $(call github,OP-TEE,optee_os,$(OPTEE_OS_VERSION))
 endif
 
-OPTEE_OS_DEPENDENCIES = host-openssl host-python-pycryptodomex host-python-pyelftools
+OPTEE_OS_DEPENDENCIES = host-openssl host-python3-pycryptodomex host-python3-pyelftools
 
 # On 64bit targets, OP-TEE OS can be built in 32bit mode, or
 # can be built in 64bit mode and support 32bit and 64bit
-- 
2.7.4