diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2023-03-28 12:49:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 23:49:01 -0400 |
commit | da18a74f9fb50becfae33da80e0184fe56a640ce (patch) | |
tree | b801d2648c48ae604b81e6a4023005a2857aed88 /src | |
parent | 983aa3151e38849a495720fa6b607d7b9cc53f89 (diff) | |
download | pyopenssl-git-da18a74f9fb50becfae33da80e0184fe56a640ce.tar.gz |
port changelog (#1205)
* port changelog
* forward port the nid2sn workaround
Diffstat (limited to 'src')
-rw-r--r-- | src/OpenSSL/crypto.py | 9 |
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: """ |