Skip to content

x509-create-sign.cpp: Fix build failure with Openssl 4.0 - #794

Open
LocutusOfBorg wants to merge 1 commit into
VirtualBox:mainfrom
LocutusOfBorg:patch-1
Open

x509-create-sign.cpp: Fix build failure with Openssl 4.0#794
LocutusOfBorg wants to merge 1 commit into
VirtualBox:mainfrom
LocutusOfBorg:patch-1

Conversation

@LocutusOfBorg

Copy link
Copy Markdown

No description provided.

@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Jul 29, 2026
@LocutusOfBorg

Copy link
Copy Markdown
Author

OCA signed.

klaus-vb
klaus-vb previously approved these changes Jul 31, 2026

@klaus-vb klaus-vb 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.

Much appreciated. Looks good to me, and I'll see that it gets integrated.

The second change made me look at how I can test it easily, and I ended up spotting unfinished code and some pre-existing coding style violations... will take care of that in a follow-up change after this one is integrating (hope the OCA signing is ticked off soon).

@LocutusOfBorg

Copy link
Copy Markdown
Author

Hello, for the OCA I don't really know, for the X509_NAME, feel free to avoid the cast, I really don't like it but duplicating the variables just to please gcc was even worse :)

@loqs

loqs commented Aug 3, 2026

Copy link
Copy Markdown

I really don't like it but duplicating the variables just to please gcc was even worse :)

In future OpenSSL versions X509_get_subject_name could return read only memory and with the cast it will compile without error or has upstream OpenSSL committed to not doing this and your approach is considered good practice? Other projects avoided this approach znc/znc@94bcf91 mumble-voip/mumble@1f00fb3. @eworm-de

@LocutusOfBorg

Copy link
Copy Markdown
Author

@loqs please have a new look, thanks!

@loqs

loqs commented Aug 6, 2026

Copy link
Copy Markdown

@LocutusOfBorg Thank you.

klaus-vb added a commit that referenced this pull request Aug 6, 2026
…e with OpenSSL 4.0. Inspired by github:gh-794.

svn:sync-xref-src-repo-rev: r174697
klaus-vb added a commit that referenced this pull request Aug 6, 2026
* r174697: Runtime/common/crypto: Code cleanup regarding const, fix build failure with OpenSSL 4.0. Inspired by github:gh-794.

* r174698: Runtime/common/crypto/x509-create-sign.cpp: Cleanup, fix parameter to meet naming conventions.
Runtime/tools/RTSignTool.cpp: Fix code for creating self-signed certificate.



svn:sync-xref-src-repo-rev: r174699
@klaus-vb

klaus-vb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I have applied a close derivative of the initial proposal (due to overload yesterday just visible now), and have thought about the issue @loqs raised, but decided to keep the code as is for now.

The reason is the pitfall which @LocutusOfBorg stepped into: the original code is sneakily modifying the (assumed writable) subject name "by reference", and then set the issuer name to the same. In the second change this is now fully broken: it creates an empty name object and sets the subject name to it (by value, meaning it will be empty), then updates the name object to contain the actual subject name and then sets the issuer name to it. Not the same as before, and certainly not the right thing for creating a self-signed cert.

No need to propose further fixes, I'll take care of it soon and will point to the adjustment to be reviewed by further people. Before closing this PR.

klaus-vb added a commit that referenced this pull request Aug 6, 2026
…t name. No longer adjust it "by reference" and set the issuer to the same, instead use the clean approach of creating a name object first and setting both subject and issuer name. github:gh-794

svn:sync-xref-src-repo-rev: r174705
klaus-vb added a commit that referenced this pull request Aug 6, 2026
…Change handling of subject name. No longer adjust it "by reference" and set the issuer to the same, instead use the clean approach of creating a name object first and setting both subject and issuer name. github:gh-794

svn:sync-xref-src-repo-rev: r174706
@klaus-vb

klaus-vb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The brokenness of the second change would've been visible with the now actually working RTSignTool create-self-signed-rsa-cert command, but I understand this isn't easily available in a fully automated build including packaging, because RTSignTool isn't packaged.

Whatever, see becbd31 for the cleaned up code avoiding to write to the some day maybe actually read-only subject name object inside cert object. Feedback welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants