-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-enable python 3 testing #328
re-enable python 3 testing #328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For full Python 3 compatibility, you also need the following two changes:
diff --git a/tools/tpm2_pkcs11/commandlets_keys.py b/tools/tpm2_pkcs11/commandlets_keys.py
index d9b6c4b..066a67d 100644
--- a/tools/tpm2_pkcs11/commandlets_keys.py
+++ b/tools/tpm2_pkcs11/commandlets_keys.py
@@ -518,7 +518,7 @@ class AddCert(Command):
path = args['path']
label = args['label']
- keylabel = args['key_label']
+ keylabel = args['key_label'].encode()
certpath = args['cert']
# rather than use pycryptography x509 parser, which gives native type access to certficiate
@@ -531,7 +531,7 @@ class AddCert(Command):
# print(cert.prettyPrint())
- h = binascii.hexlify
+ h = lambda b : binascii.hexlify(b).decode()
b = berenc.encode
d = derenc.encode
f8b8f73
to
1c9f737
Compare
python2 and python3 differ in behavior on reading from a file that was opened with the binary flag. In python2 the read data is a str, in python3 its bytes. This is posing an issue in the asn1 calls as outlined in bug: - etingof/pyasn1#185 We can work around this for now, since pem files are always string, remove the binary flag and open pem w/o binary mode flag Additionally, python3 and python 2 differe in handling str and bytes and python3 requires more type correctness. Fix all this in a way that works with python2 and python3 Releates to bug tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
1c9f737
to
14ce431
Compare
Yeah I go those today |
This reverts commit 0d92fce. Fixes: tpm2-software#327 Signed-off-by: William Roberts <william.c.roberts@intel.com>
14ce431
to
b478853
Compare
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
=========================================
Coverage ? 76.81%
=========================================
Files ? 25
Lines ? 4921
Branches ? 0
=========================================
Hits ? 3780
Misses ? 1141
Partials ? 0 Continue to review full report at Codecov.
|
Figured out the issue, for details see commit messages and etingof/pyasn1#185