RETVAL_TRUE;
} else {
+ php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "error opening file %s", filename);
}
- if (certresource == NULL && cert) {
+ if (Z_TYPE_P(zcert) != IS_RESOURCE) {
X509_free(cert);
}
- BIO_free(bio_out);
+
+ if (!BIO_free(bio_out)) {
+ php_openssl_store_errors();
+ }
}
/* }}} */
ZVAL_STRINGL(zout, bio_buf->data, bio_buf->length);
RETVAL_TRUE;
+ } else {
+ php_openssl_store_errors();
}
- if (certresource == NULL && cert != NULL) {
+ BIO_free(bio_out);
+
+cleanup:
+ if (Z_TYPE_P(zcert) != IS_RESOURCE) {
X509_free(cert);
}
- BIO_free(bio_out);
}
/* }}} */
php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
goto cleanup;
}
- if (cert && !X509_check_private_key(cert, priv_key)) {
+ if (!X509_check_private_key(cert, priv_key)) {
+ php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "private key does not correspond to cert");
goto cleanup;
}