Fixes for OpenSSL-4 support#8614
Conversation
In OpenSSL-4 ASN1_STRING is an opaque object and components can only be accessed wit the corresponding functions.
In OpenSSL-4 some functions are changed to return const values.
In OpenSSL-4 some functions are changed to return const values.
There was a problem hiding this comment.
Code Review
This pull request implements compatibility for OpenSSL 4.0 by introducing an OSSL4_CONST macro and replacing direct access to OpenSSL structures with accessor functions. The review feedback suggests moving the duplicated OSSL4_CONST macro definition to a common header file to improve maintainability and ensure consistency across the project.
sssd-bot
left a comment
There was a problem hiding this comment.
Review done using Claude Code / claude-opus-4-6
Functional Issues
No functional issues found. The accessor replacements (ASN1_STRING_get0_data, ASN1_STRING_length) and const-qualification changes are correct and consistent across both files. Return types match variable declarations, and the accessor functions have been available since OpenSSL 1.1.0 so there is no compatibility concern for supported OpenSSL versions.
Nits & Non-functional Issues
-
Duplicate
OSSL4_CONSTmacro definition — The macro is defined identically insrc/lib/certmap/sss_cert_content_crypto.c:39-43andsrc/p11_child/p11_child_openssl.c:40-44. It should be moved to a shared header (e.g.src/util/crypto/sss_crypto.h) to avoid divergence if the version check ever needs updating. -
Unnecessary cast at GEN_DIRNAME — At
src/lib/certmap/sss_cert_content_crypto.c:677,current->d.directoryName(typeX509_NAME *) is explicitly cast toOSSL4_CONST X509_NAME *. This cast is unnecessary because C implicitly converts pointer-to-T to pointer-to-const-T. Passingcurrent->d.directoryNamedirectly would work and be cleaner.
Confirmed Issues from Existing Review Comments
- Duplicate macro (gemini-code-assist) — Both review comments from gemini-code-assist flag the duplicated
OSSL4_CONSTmacro across the two files. This is a valid concern (see nit #1 above). The macro should live in a single shared header.
|
Hi, just a comment about the duplicated HTH bye, |
|
@sumit-bose, re:
|
In OpenSSL-4 ASN1_STRING is completely opaque and suitable functions must be used to return the components. Additionally some functions are changed to return
constvalues.There is one open issue,
X509_STORE_get0_objects()is deprecated in OpenSSL-4, but still present. This will be fixed in a separate PR.