Skip to content

Use custom OpenSSL libctx in md and cipher handling code #18516

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bukka
Copy link
Member

@bukka bukka commented May 7, 2025

The is another chunk of work to support custom libctx - this time in cipher and message digest code.

@bukka
Copy link
Member Author

bukka commented May 7, 2025

This needs a bit more work to free stuff correctly so moving to draft.

@bukka bukka force-pushed the openssl_libctx_md_and_cipher branch from 4b93dca to 2655b22 Compare May 21, 2025 21:21
@bukka bukka marked this pull request as ready for review May 22, 2025 09:49
@bukka
Copy link
Member Author

bukka commented May 22, 2025

Pipeline is green so this is ready for review!

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Preliminary suggestion


const EVP_CIPHER *php_openssl_get_evp_cipher_from_algo(zend_long algo)
{
if (algo < 0 || algo >= (zend_long)(sizeof(php_openssl_cipher_names) / sizeof(*php_openssl_cipher_names))) {
Copy link
Member

Choose a reason for hiding this comment

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

One neat trick is to make the type of algo zend_ulong. Then you only need the >= check and don't need the zend_long cast. Same suggestion for php_openssl_get_evp_md_from_algo

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

Successfully merging this pull request may close these issues.

2 participants