From 23eac4f149edc62bb7ccc36db623f9301e2d2fda Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 21 Jun 2020 15:27:45 -0400 Subject: Preliminary support for Python 3 This is a first step towards moving all of the Cryptech code from Python 2 to Python 3. At this stage, the goal is to make the same source code work in both language dialects, and to build packages which install both versions of the library code. This is a necessary step along the way, but since Python 2 is already past EOL as of this writing and since some distributions have started dropping all support for Python 2, we will almost certainly want to drop all Python 2 support in the relatively near future, if only because it's not really to do all the packaging right for both versions at once without much more trouble than a dead language dialect is probably worth. All platforms we care about should support Python 3 already, any that don't probably have much worse problems. So the primary purpose of pushing this particular commit is to archive what will probably be the last version supporting Python 2, while giving folks a chance to test the incoming Python 3 support a bit. Once we've cut loose from Python 2 for good, there's some cleanup we can and should do (eg, all the gymnastics to work around Python 2's handling of bytes as a form of text rather than a sequence of small integers), but for the moment we want to keep that compatability, albeit briefly. --- source/Makefile | 4 +++- source/debian/rules | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/Makefile b/source/Makefile index 5095766..5913f47 100644 --- a/source/Makefile +++ b/source/Makefile @@ -22,4 +22,6 @@ install: all install -D -m 644 cryptech-alpha-firmware.tar.gz ${DESTDIR}/usr/share/cryptech-alpha-firmware.tar.gz install -D -m 644 sw/pkcs11/libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so ln -s libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so.0 - python setup.py install --install-layout=deb --root=${DESTDIR} + python2 setup.py install --install-layout=deb --root=${DESTDIR} + python3 setup.py install --install-layout=deb --root=${DESTDIR} + find ${DESTDIR} -type d -name __pycache__ -exec rm -rf {} + diff --git a/source/debian/rules b/source/debian/rules index a0c3a65..0a37e86 100755 --- a/source/debian/rules +++ b/source/debian/rules @@ -19,7 +19,7 @@ include /usr/share/dpkg/default.mk include /usr/share/dpkg/pkg-info.mk %: - dh $@ --with python2 + dh $@ --with python2,python3 # Distinct binary package versions for a single source package built # on multiple releases, to keep reprepro happy. See: -- cgit v1.2.3 From 9e6b0d1117e21f2e6d092e337c5c522726016467 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 12 Jul 2020 18:25:56 -0400 Subject: Attempt to go Python3-only Ubuntu 20.04 no longer really supports Python 2, so we'd have to fork the packaging code if we wanted to keep support for Python 2 elsewhere. Given that Python 3 has been around for a more than a decade and that Python 2 was formally EOLed more than six months ago as of this writing, this seems like an unnecessary complication. The biggest change is rewriting the Homebrew formula for Python 3. --- source/Makefile | 1 - source/debian/rules | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'source') diff --git a/source/Makefile b/source/Makefile index 5913f47..0e1f613 100644 --- a/source/Makefile +++ b/source/Makefile @@ -22,6 +22,5 @@ install: all install -D -m 644 cryptech-alpha-firmware.tar.gz ${DESTDIR}/usr/share/cryptech-alpha-firmware.tar.gz install -D -m 644 sw/pkcs11/libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so ln -s libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so.0 - python2 setup.py install --install-layout=deb --root=${DESTDIR} python3 setup.py install --install-layout=deb --root=${DESTDIR} find ${DESTDIR} -type d -name __pycache__ -exec rm -rf {} + diff --git a/source/debian/rules b/source/debian/rules index 0a37e86..607ba42 100755 --- a/source/debian/rules +++ b/source/debian/rules @@ -19,7 +19,7 @@ include /usr/share/dpkg/default.mk include /usr/share/dpkg/pkg-info.mk %: - dh $@ --with python2,python3 + dh $@ --with python3 # Distinct binary package versions for a single source package built # on multiple releases, to keep reprepro happy. See: -- cgit v1.2.3 From 4d6f6ceebcb0422bfcf3443e7f4eb7a9eb1e4338 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 13 Jul 2020 00:36:11 -0400 Subject: Still more fun building packages with Python 3 --- source/sw/libhal | 2 +- source/sw/pkcs11 | 2 +- source/sw/stm32 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/sw/libhal b/source/sw/libhal index aab1cf4..f120a26 160000 --- a/source/sw/libhal +++ b/source/sw/libhal @@ -1 +1 @@ -Subproject commit aab1cf4d694b4d4fefa77f02b4c42d7683a2f43f +Subproject commit f120a263ec422739d201843a5979bfabdf410708 diff --git a/source/sw/pkcs11 b/source/sw/pkcs11 index 5936bef..bf8e254 160000 --- a/source/sw/pkcs11 +++ b/source/sw/pkcs11 @@ -1 +1 @@ -Subproject commit 5936befa654ce79b2f9ee7cd4f3beb6489bac227 +Subproject commit bf8e254c435c972a7ab28700eab48a2b6ae79c57 diff --git a/source/sw/stm32 b/source/sw/stm32 index 52f72e1..b7e1cf4 160000 --- a/source/sw/stm32 +++ b/source/sw/stm32 @@ -1 +1 @@ -Subproject commit 52f72e1e5dc5d3b646b54363f811ee2fd7958c19 +Subproject commit b7e1cf46f7c88740732dea1d9885193567af2e78 -- cgit v1.2.3 From ed161c5f748ce4ffa382b78b4718fe1bc6a98a03 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 13 Jul 2020 01:26:43 -0400 Subject: Rewrite script to use subprocess.run(), another python -> python3 --- source/sw/pkcs11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/sw/pkcs11 b/source/sw/pkcs11 index bf8e254..3b33d6d 160000 --- a/source/sw/pkcs11 +++ b/source/sw/pkcs11 @@ -1 +1 @@ -Subproject commit bf8e254c435c972a7ab28700eab48a2b6ae79c57 +Subproject commit 3b33d6df40d6c6b12611ece5c45592d95bd4c12c -- cgit v1.2.3 From a14301091cfd8fda6eef5b637fff15bac2509791 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 13 Jul 2020 10:37:31 -0400 Subject: Missed (one?) script while converting to Python 3 --- source/sw/pkcs11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/sw/pkcs11 b/source/sw/pkcs11 index 3b33d6d..b424b2a 160000 --- a/source/sw/pkcs11 +++ b/source/sw/pkcs11 @@ -1 +1 @@ -Subproject commit 3b33d6df40d6c6b12611ece5c45592d95bd4c12c +Subproject commit b424b2af8b3e5097eb7e829d2a728a1720d5d0bd -- cgit v1.2.3 From 127ea05727538019f6914a70cfde14331355ad26 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 1 Sep 2020 11:02:50 -0400 Subject: Pull up submodules * One more Python3 fix * Joachim's latest SHA-1 tweaks --- source/core/hash/sha1 | 2 +- source/sw/stm32 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/core/hash/sha1 b/source/core/hash/sha1 index d3564a0..a4085c1 160000 --- a/source/core/hash/sha1 +++ b/source/core/hash/sha1 @@ -1 +1 @@ -Subproject commit d3564a0907fe14b92ab02e4da2d9f733bc32e347 +Subproject commit a4085c16e207ebfda27e4589b3a7641b0b6ea627 diff --git a/source/sw/stm32 b/source/sw/stm32 index b7e1cf4..4050df5 160000 --- a/source/sw/stm32 +++ b/source/sw/stm32 @@ -1 +1 @@ -Subproject commit b7e1cf46f7c88740732dea1d9885193567af2e78 +Subproject commit 4050df583c3221e55e7ada23c211cfc38fae7d89 -- cgit v1.2.3 From b142a775c297a32f5ffbdf0dc1bb1ddef62e2dc6 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 1 Sep 2020 18:45:50 -0400 Subject: Shake out a few more Python 3 bugs * PyCrypto doesn't work right with Python 3.8, kludge around it for now * Farbled a few more str <-> bytes conversions in cryptech_upload --- source/sw/libhal | 2 +- source/sw/stm32 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/sw/libhal b/source/sw/libhal index f120a26..9733c5e 160000 --- a/source/sw/libhal +++ b/source/sw/libhal @@ -1 +1 @@ -Subproject commit f120a263ec422739d201843a5979bfabdf410708 +Subproject commit 9733c5e7faf9aee874c1176381abcda98deb48f9 diff --git a/source/sw/stm32 b/source/sw/stm32 index 4050df5..646454d 160000 --- a/source/sw/stm32 +++ b/source/sw/stm32 @@ -1 +1 @@ -Subproject commit 4050df583c3221e55e7ada23c211cfc38fae7d89 +Subproject commit 646454d4264ae27769cb20f31f31eb7cb0b9a908 -- cgit v1.2.3 From 3e82e03f24fdde680a4224427b6bb58237b966bc Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 2 Sep 2020 02:22:40 -0400 Subject: Well of course there had to be one last dumb Python3 string bug --- source/sw/libhal | 2 +- source/sw/stm32 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/sw/libhal b/source/sw/libhal index 9733c5e..6212a59 160000 --- a/source/sw/libhal +++ b/source/sw/libhal @@ -1 +1 @@ -Subproject commit 9733c5e7faf9aee874c1176381abcda98deb48f9 +Subproject commit 6212a592c52372080c7c5035c6a2513dcb50cf61 diff --git a/source/sw/stm32 b/source/sw/stm32 index 646454d..314ba09 160000 --- a/source/sw/stm32 +++ b/source/sw/stm32 @@ -1 +1 @@ -Subproject commit 646454d4264ae27769cb20f31f31eb7cb0b9a908 +Subproject commit 314ba09b1447ec20c7ffad587691c83b965e7400 -- cgit v1.2.3