Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Feb 10, 2025

Follow-up to #17721

@Girgias Girgias marked this pull request as ready for review February 11, 2025 13:28
@Girgias Girgias requested a review from bukka as a code owner February 11, 2025 13:28
@Girgias Girgias force-pushed the openssl-follow-up branch from ffde1ab to 0df4f1a Compare August 4, 2025 15:40
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.

Perhaps target 8.3?

@Girgias
Copy link
Member Author

Girgias commented Aug 5, 2025

Perhaps target 8.3?

Maybe.

But I also don't know why CI is completely red. Might wait and see if this is related to #19369

@nielsdos
Copy link
Member

nielsdos commented Aug 5, 2025

Perhaps target 8.3?

Maybe.

But I also don't know why CI is completely red. Might wait and see if this is related to #19369

Hm I doubt it. Try rebasing?

@bukka
Copy link
Member

bukka commented Aug 9, 2025

This is not correct because failure to load rand file when rand status is still 1 is not really a problem. We should probably not even try to load such file if it doesn't exist to prevent https://bugs.php.net/bug.php?id=78444 . Also the error messages are already triggered for real errors.

So what we should do is to stat the loaded file and return success if it doesn't exist or fail to load but the status is still 1. For write, there is probably not much point to return anything.

In reality there should be no reason to even try to load the file but we can leave it for extra paranoid users. But if it fails, it's not really an issue as I mentioned.

Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

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

As mentioned in the comment above, the behavior needs to change as described. This is incorrect.

char *randfile = php_openssl_conf_get_string(req->req_config, req->section_name, "RANDFILE");
php_openssl_load_rand_file(randfile, &egdsocket, &seeded);
if (php_openssl_load_rand_file(randfile, &egdsocket, &seeded) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Failed to load RANDFILE");
Copy link
Member

Choose a reason for hiding this comment

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

There is no point for extra warning.

cleanup:
php_openssl_write_rand_file(randfile, egdsocket, seeded);
if (php_openssl_write_rand_file(randfile, egdsocket, seeded) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Failed to write to RANDFILE");
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@bukka
Copy link
Member

bukka commented Aug 9, 2025

I would probably target just master as it's not a big deal.

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.

3 participants