-
Notifications
You must be signed in to change notification settings - Fork 184
Treat ASN1_STRING as opaque #978
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
Conversation
This helper only reads from its in parameter. Making that const avoids a couple of casts in an upcoming change.
|
The test failure seems unrelated. I forgot to mention: I have versions of this patch that apply to the version of this gem bundled in Ruby 3.3.10 and 3.4.7 which I'm happy to share if it helps you. |
OpenSSL plans to make asn1_string_st opaque, the struct underlying most ASN.1 types such as ASN1_*STRING, ASN1_ENUMERATED, ASN1_INTEGER, etc. Most of ruby/openssl's C code can be straigtforwardly converted to use accessors available since OpenSS
This uses the normal accessors but leaves out BIT STRINGS, which will need compat implementations for ASN1_BIT_STRING_get_length() and ASN1_BIT_STRING_set1() for older libcryptos. openssl/openssl#29184 openssl/openssl#29185
6cd4e38 to
0dc34ce
Compare
|
Thanks for the PR! This makes sense.
That sounds even better. Actually, I'd appreciate if you can update these, but this can also be left for later.
This is unlikely to be backported since maintenance branches accept bugfixes only. Anyone needing to use an old Ruby with OpenSSL 4.x should be able to skip the bundled |
0dc34ce to
a41cf28
Compare
Done.
Understood. Thanks for the quick turnaround. |
rhenium
left a comment
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.
Thanks!
OpenSSL plans to make
ASN1_STRINGopaque along with all the other types sharing the same underlyingstruct asn1_string_st:For most purposes there are accessors available in all supported libraries. The one exception is the
ASN1_BIT_STRINGtype, which requires new API to deal with the unused bits octet, see:Dealing with this has to wait until the interface has settled, at which point we can provide a compat-interface, so this PR doesn't touch BIT STRINGS.
The diff in this pull request is almost entirely mechanical.
A better approach might be to move
asn1str_to_strtoossl.[ch](and rename it toossl_asn1str_to_str()?) and then convert the various calls torb_str_new()with nested ASN1_STRING unpacking to that.Finally, in the diff you can see that there's also a
/* const_cast: workaround for old OpenSSL */inossl_asn1.cthat can be removed along with the cast. Happy to send a PR for that.