Fix bad uses of OpenSSL 0.9 API - #2441
Conversation
These ASN1_STRING_* API functions have been available since OpenSSL 1.1, and Squid provides portability wrappers for OpenSSL v1.0. OpenSSL v4 removes struct asn1_string_st from public availability. Leading to compile problem: error: invalid use of incomplete type ASN1_OCTET_STRING
| // GEN_DNS is an IA5STRING. IA5STRING is a subset of ASCII that does not | ||
| // need to be converted to UTF-8 (or some such) before we parse it. | ||
| const auto buffer = Ssl::AsnToSBuf(*san.d.dNSName); | ||
| const SBuf buffer(reinterpret_cast<const char *>(ASN1_STRING_get0_data(san.d.dNSName)), ASN1_STRING_length(san.d.dNSName)); |
There was a problem hiding this comment.
Why replace our reusable conversion function with this direct conversation code?
There was a problem hiding this comment.
It is used only once, increases dependency footprint, wrong scope, and badly named. Overall "bad design" and you would say.
There was a problem hiding this comment.
I disagree with your assessment. Please undo this out of scope removal.
There was a problem hiding this comment.
That would be your personal coding style preferences.
Best practice coding is not to create gratuitous wrapper APIs for a single line of code - especially when the wrapper merely existing adds code dependencies.
|
Building squid-7.7 with this PR applied, gcc-16.x and OpenSSL 4.0.2 is still broken: |
|
@bkuhls aye, this is the first of a series of PRs needed to make OpenSSL v4 builds work. This one scoped at fixing the |
Direct access to struct asn1_string_st internals has been
deprecated since OpenSSL v1.0.
OpenSSL v4 removes struct asn1_string_st from public
availability. Leading to compile problem:
error: invalid use of incomplete type ASN1_OCTET_STRING
Squid should be using the API for OpenSSL v1.1 and later.