if (str == NULL) {
php_openssl_store_errors();
} else if (!php_openssl_open_base_dir_chk(str)) {
- BIO *oid_bio = BIO_new_file(str, "r");
+ BIO *oid_bio = BIO_new_file(str, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
if (oid_bio) {
OBJ_create_objects(oid_bio);
BIO_free(oid_bio);
return NULL;
}
- in = BIO_new_file(Z_STRVAL_P(val) + (sizeof("file://") - 1), "r");
+ in = BIO_new_file(Z_STRVAL_P(val) + (sizeof("file://") - 1), PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
if (in == NULL) {
php_openssl_store_errors();
return NULL;
return;
}
- bio_out = BIO_new_file(filename, "w");
+ bio_out = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (bio_out) {
if (!notext && !X509_print(bio_out, cert)) {
php_openssl_store_errors();
goto end;
}
- if(!(in=BIO_new_file(certfile, "r"))) {
+ if(!(in=BIO_new_file(certfile, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY)))) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "error opening the file, %s", certfile);
sk_X509_free(stack);
p12 = PKCS12_create(pass, friendly_name, priv_key, cert, ca, 0, 0, 0, 0, 0);
if (p12 != NULL) {
- bio_out = BIO_new_file(filename, "w");
+ bio_out = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (bio_out != NULL) {
i2d_PKCS12_bio(bio_out, p12);
if (php_openssl_open_base_dir_chk(filename)) {
return NULL;
}
- in = BIO_new_file(filename, "r");
+ in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
} else {
in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val));
}
return;
}
- bio_out = BIO_new_file(filename, "w");
+ bio_out = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (bio_out != NULL) {
if (!notext && !X509_REQ_print(bio_out, csr)) {
php_openssl_store_errors();
/* not a X509 certificate, try to retrieve public key */
BIO* in;
if (filename) {
- in = BIO_new_file(filename, "r");
+ in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
} else {
in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val));
}
if (php_openssl_open_base_dir_chk(filename)) {
TMP_CLEAN;
}
- in = BIO_new_file(filename, "r");
+ in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
} else {
in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val));
}
PHP_SSL_REQ_INIT(&req);
if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) {
- bio_out = BIO_new_file(filename, "w");
+ bio_out = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (bio_out == NULL) {
php_openssl_store_errors();
goto clean_exit;
goto clean_exit;
}
- dataout = BIO_new_file(datafilename, "w");
+ dataout = BIO_new_file(datafilename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (dataout == NULL) {
php_openssl_store_errors();
goto clean_exit;
goto clean_exit;
}
- certout = BIO_new_file(signersfilename, "w");
+ certout = BIO_new_file(signersfilename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (certout) {
int i;
signers = PKCS7_get0_signers(p7, NULL, (int)flags);
goto clean_exit;
}
- outfile = BIO_new_file(outfilename, "w");
+ outfile = BIO_new_file(outfilename, PHP_OPENSSL_BIO_MODE_W(flags));
if (outfile == NULL) {
php_openssl_store_errors();
goto clean_exit;
goto clean_exit;
}
- outfile = BIO_new_file(outfilename, "w");
+ outfile = BIO_new_file(outfilename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (outfile == NULL) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "error opening output file %s!", outfilename);