Skip to content

[autobackport: sssd-2-13] Openssl 4 fixes#8715

Merged
alexey-tikhonov merged 3 commits into
SSSD:sssd-2-13from
sssd-bot:SSSD-sssd-backport-pr8667-to-sssd-2-13
May 19, 2026
Merged

[autobackport: sssd-2-13] Openssl 4 fixes#8715
alexey-tikhonov merged 3 commits into
SSSD:sssd-2-13from
sssd-bot:SSSD-sssd-backport-pr8667-to-sssd-2-13

Conversation

@sssd-bot

Copy link
Copy Markdown
Contributor

This is an automatic backport of PR#8667 Openssl 4 fixes to branch sssd-2-13, created by @simo5.

Please make sure this backport is correct.

Note

The commits were cherry-picked without conflicts.

You can push changes to this pull request

git remote add sssd-bot [email protected]:sssd-bot/sssd.git
git fetch sssd-bot refs/heads/SSSD-sssd-backport-pr8667-to-sssd-2-13
git checkout SSSD-sssd-backport-pr8667-to-sssd-2-13
git push sssd-bot SSSD-sssd-backport-pr8667-to-sssd-2-13 --force

Original commits
ab6713f - Correct x400Address type check in crypto.m4
b197d9d - Update certmap for OpenSSL 4.0 compatibility
770ae6c - Add const qualifier to X509_NAME pointers

Backported commits

  • a1ce2ab - Correct x400Address type check in crypto.m4
  • efef859 - Update certmap for OpenSSL 4.0 compatibility
  • 9c47802 - Add const qualifier to X509_NAME pointers

Original Pull Request Body

I think this is a better patch than #8614

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the codebase for OpenSSL 3.0 compatibility by replacing direct access to ASN1_STRING structure members with accessor functions and introducing const qualifiers to various X509 and ASN1 types. Feedback identifies a potential crash in sss_cert_content_crypto.c due to a missing type check on ASN1_TYPE before sequence access. Additionally, several instances of adding const to X509_NAME in p11_child_openssl.c are flagged as problematic for backward compatibility with OpenSSL 1.1.1, which is still used in some supported environments like RHEL 8.

Comment on lines +251 to +252
p = ASN1_STRING_get0_data(oct);
princ = d2i_KRB5PrincipalName(NULL, &p, ASN1_STRING_length(oct));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The code accesses current->d.otherName->value->value.sequence and passes it to ASN1_STRING_get0_data without verifying that the ASN1_TYPE is actually a sequence. If a malformed certificate contains an otherName with a different type for the PKINIT OID, oct might be NULL or contain invalid data, leading to a crash. A type check using ASN1_TYPE_get() should be added before accessing the sequence value, similar to the implementation in add_nt_princ_to_san_list.

    if (ASN1_TYPE_get(current->d.otherName->value) != V_ASN1_SEQUENCE || oct == NULL) {
        return EINVAL;
    }
    p = ASN1_STRING_get0_data(oct);
    princ = d2i_KRB5PrincipalName(NULL, &p, ASN1_STRING_length(oct));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

this issue is present in the original code as well. I will add a check in a different PR.

bye,
Sumit

char *port = NULL;
int use_ssl;
X509_NAME *issuer_name = NULL;
const X509_NAME *issuer_name = NULL;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Changing issuer_name to const X509_NAME * may cause compilation warnings or errors on OpenSSL versions prior to 3.0 (such as 1.1.1), where X509_OBJECT_retrieve_by_subject expects a non-const X509_NAME *. Since SSSD 2.13 may still be built against OpenSSL 1.1.1 on some supported platforms (e.g., RHEL 8), it is safer to keep this variable as X509_NAME * to maintain cross-version compatibility without requiring explicit casts at every call site.

    X509_NAME *issuer_name = NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

yes, there is a compiler warning on RHEL-8 with OpenSSL 1.1.1 but I think it can be ignored for the time being since it is not expected that this SSSD branch is used on this platform (there is even other issues which prevent the compilation on RHEL-8 without changes). I can add a fix for this in a different PR.

bye,
Sumit

@alexey-tikhonov alexey-tikhonov May 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can add a fix for this in a different PR.

@sumit-bose, maybe we could drop support of openssl-1 in sssd-2-13+?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

in general yes but it might be more friendly to deprecate first, e.g. in the release notes of sssd-2.13.1 and remove support with sssd-2.14?

bye,
Sumit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we still can skip fixing compilation, then it's also fine.

struct cert_list *list = NULL;
struct cert_list *item;
X509_NAME *tmp_name;
const X509_NAME *tmp_name;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Declaring tmp_name as const X509_NAME * introduces a compatibility issue with OpenSSL 1.1.1, where X509_NAME_oneline (used at line 1097) expects a non-const X509_NAME *. This will likely result in build failures on platforms using older OpenSSL versions if warnings are treated as errors. It is recommended to revert this to X509_NAME *.

    X509_NAME *tmp_name;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as with issuer_name.

@sumit-bose sumit-bose left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

originals and backports matches and valid Gemini comments can be handled imo in a new PR, ACK.

bye,
Sumit

@alexey-tikhonov
alexey-tikhonov removed their request for review May 19, 2026 16:42
@alexey-tikhonov alexey-tikhonov removed their assignment May 19, 2026
@alexey-tikhonov alexey-tikhonov added no-backport This should go to target branch only. Accepted labels May 19, 2026
simo5 and others added 3 commits May 19, 2026 16:43
Update the compilation check for the x400Address field in the GENERAL_NAME
struct. By comparing the address of the field against an ASN1_STRING double
pointer, it ensures the compiler strictly and safely verifies the exact type
during autoconf checks without causing invalid pointer arithmetic errors.

Co-authored-by: Gemini <[email protected]>
Signed-off-by: Simo Sorce <[email protected]>
Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Sumit Bose <[email protected]>
(cherry picked from commit ab6713f)
Replace direct struct field accesses with OpenSSL accessor functions like
ASN1_STRING_get0_data and ASN1_STRING_length. Add const qualifiers to
ensure compatibilitty with OpenSSL 4.0.

Signed-off-by: Simo Sorce <[email protected]>
Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Sumit Bose <[email protected]>
(cherry picked from commit b197d9d)
The issuer_name and subject_name variables in get_issuer_subject_str have been
updated to use the const qualifier. This improves const-correctness and
prevents accidental modification of the certificate data.

Signed-off-by: Simo Sorce <[email protected]>
Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Sumit Bose <[email protected]>
(cherry picked from commit 770ae6c)
@sssd-bot

Copy link
Copy Markdown
Contributor Author

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-44-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the SSSD-sssd-backport-pr8667-to-sssd-2-13 branch from 9c47802 to 73c6a0b Compare May 19, 2026 16:43
@alexey-tikhonov
alexey-tikhonov merged commit 52547f7 into SSSD:sssd-2-13 May 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants