Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ext/openssl/openssl_backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,10 @@ EVP_PKEY *php_openssl_generate_private_key(struct php_x509_request * req)

int egdsocket, seeded;
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.

return NULL;
}

EVP_PKEY *key = NULL;
EVP_PKEY *params = NULL;
Expand Down Expand Up @@ -1543,7 +1546,9 @@ EVP_PKEY *php_openssl_generate_private_key(struct php_x509_request * req)
req->priv_key = key;

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

}
EVP_PKEY_free(params);
EVP_PKEY_CTX_free(ctx);
return key;
Expand Down
Loading