Skip to content

gh-141801: Use accessors for ASN1_STRING fields#141802

Merged
gpshead merged 3 commits intopython:mainfrom
davidben:asn1-str-accessors
Nov 22, 2025
Merged

gh-141801: Use accessors for ASN1_STRING fields#141802
gpshead merged 3 commits intopython:mainfrom
davidben:asn1-str-accessors

Conversation

@davidben
Copy link
Copy Markdown
Contributor

@davidben davidben commented Nov 20, 2025

While ASN1_STRING is currently exposed, it is better to use the accessors. See openssl/openssl#29117 where, if the type were opaque, OpenSSL's X509 objects could be much more memory-efficient.

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.
@davidben
Copy link
Copy Markdown
Contributor Author

Don't think this needs a NEWS entry, but happy to add one if you all prefer:

strictly internal changes with no user-visible effects

Copy link
Copy Markdown
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When were those macros added? and are they available on alternative implementations of libssl?

Comment thread Modules/_ssl.c Outdated
Comment thread Modules/_ssl.c Outdated
davidben and others added 2 commits November 22, 2025 16:54
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@davidben
Copy link
Copy Markdown
Contributor Author

When were those macros added? and are they available on alternative implementations of libssl?

1.1.0 I believe. And yes, they're in BoringSSL and LibreSSL.

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Nov 22, 2025

Considering AWS-LC tests are fine, I think we can make that change.

@gpshead gpshead added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 22, 2025
@gpshead gpshead merged commit c41fce0 into python:main Nov 22, 2025
52 checks passed
@miss-islington-app
Copy link
Copy Markdown

Thanks @davidben for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2025
…onGH-141802)

* pythongh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------
(cherry picked from commit c41fce0)

Co-authored-by: David Benjamin <davidben@davidben.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Nov 22, 2025

GH-141847 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 22, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2025
…onGH-141802)

* pythongh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------
(cherry picked from commit c41fce0)

Co-authored-by: David Benjamin <davidben@davidben.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Nov 22, 2025

GH-141848 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Nov 22, 2025
gpshead pushed a commit that referenced this pull request Nov 22, 2025
…141802) (#141847)

gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802)

* gh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c



* Update Modules/_ssl.c



---------
(cherry picked from commit c41fce0)

Co-authored-by: David Benjamin <davidben@davidben.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gpshead pushed a commit that referenced this pull request Nov 22, 2025
…141802) (#141848)

gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802)

* gh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c



* Update Modules/_ssl.c



---------
(cherry picked from commit c41fce0)

Co-authored-by: David Benjamin <davidben@davidben.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
botovq added a commit to botovq/ports that referenced this pull request Dec 4, 2025
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
…onGH-141802)

* pythongh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
…onGH-141802)

* pythongh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See openssl/openssl#29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Modules/_ssl.c

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
botovq added a commit to botovq/ports-opaque-strings that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants