summaryrefslogtreecommitdiff
path: root/src/OpenSSL/crypto.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2023-03-28 12:06:50 +0900
committerGitHub <noreply@github.com>2023-03-27 23:06:50 -0400
commit12bc43bc7a2faee3e7de742a705e19e05645fe12 (patch)
tree461a60e0c7546770304e077e513de06df1e1c4c1 /src/OpenSSL/crypto.py
parent240ae6fd46ab2752148136ce5855e5e975adc96b (diff)
downloadpyopenssl-git-23.1.x.tar.gz
work around openssl 3.1.0 bug and bump for 23.1.1 (#1204)23.1.123.1.x
* work around openssl 3.1.0 bug and bump for 23.1.1 * remove a CI job that can't succeed cryptographyMain does not support 3.6
Diffstat (limited to 'src/OpenSSL/crypto.py')
-rw-r--r--src/OpenSSL/crypto.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index 8b12769..f5dd312 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -904,7 +904,14 @@ class X509Extension:
"""
obj = _lib.X509_EXTENSION_get_object(self._extension)
nid = _lib.OBJ_obj2nid(obj)
- return _ffi.string(_lib.OBJ_nid2sn(nid))
+ # OpenSSL 3.1.0 has a bug where nid2sn returns NULL for NIDs that
+ # previously returned UNDEF. This is a workaround for that issue.
+ # https://github.com/openssl/openssl/commit/908ba3ed9adbb3df90f76
+ buf = _lib.OBJ_nid2sn(nid)
+ if buf != _ffi.NULL:
+ return _ffi.string(buf)
+ else:
+ return b"UNDEF"
def get_data(self) -> bytes:
"""