Skip to content
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

src: remove public API for option variables #23069

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
26 changes: 2 additions & 24 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ bool SafeGetenv(const char* key, std::string* text) {


void* ArrayBufferAllocator::Allocate(size_t size) {
if (zero_fill_field_ || zero_fill_all_buffers)
if (zero_fill_field_ || per_process_opts->zero_fill_all_buffers)
return UncheckedCalloc(size);
else
return UncheckedMalloc(size);
Expand Down Expand Up @@ -1925,8 +1925,7 @@ void SetupProcessObject(Environment* env,
}

// --no-deprecation
// TODO(addaleax): Uncomment the commented part.
if (/*env->options()->*/no_deprecation) {
if (env->options()->no_deprecation) {
READONLY_PROPERTY(process, "noDeprecation", True(env->isolate()));
}

Expand Down Expand Up @@ -2447,16 +2446,6 @@ inline void PlatformInit() {
#endif // _WIN32
}

// TODO(addaleax): Remove, both from the public API and in implementation.
bool no_deprecation = false;
#if HAVE_OPENSSL
bool ssl_openssl_cert_store = false;
#if NODE_FIPS_MODE
bool enable_fips_crypto = false;
bool force_fips_crypto = false;
#endif
#endif

void ProcessArgv(std::vector<std::string>* args,
std::vector<std::string>* exec_args,
bool is_env) {
Expand Down Expand Up @@ -2540,17 +2529,6 @@ void ProcessArgv(std::vector<std::string>* args,
if (v8_args_as_char_ptr.size() > 1) {
exit(9);
}

// TODO(addaleax): Remove.
zero_fill_all_buffers = per_process_opts->zero_fill_all_buffers;
no_deprecation = per_process_opts->per_isolate->per_env->no_deprecation;
#if HAVE_OPENSSL
ssl_openssl_cert_store = per_process_opts->ssl_openssl_cert_store;
#if NODE_FIPS_MODE
enable_fips_crypto = per_process_opts->enable_fips_crypto;
force_fips_crypto = per_process_opts->force_fips_crypto;
#endif
#endif
}


Expand Down
14 changes: 0 additions & 14 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,6 @@ typedef intptr_t ssize_t;

namespace node {

// TODO(addaleax): Remove all of these.
NODE_DEPRECATED("use command-line flags",
NODE_EXTERN extern bool no_deprecation);
#if HAVE_OPENSSL
NODE_DEPRECATED("use command-line flags",
NODE_EXTERN extern bool ssl_openssl_cert_store);
# if NODE_FIPS_MODE
NODE_DEPRECATED("use command-line flags",
NODE_EXTERN extern bool enable_fips_crypto);
NODE_DEPRECATED("user command-line flags",
NODE_EXTERN extern bool force_fips_crypto);
# endif
#endif

// TODO(addaleax): Officially deprecate this and replace it with something
// better suited for a public embedder API.
NODE_EXTERN int Start(int argc, char* argv[]);
Expand Down
8 changes: 3 additions & 5 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@

namespace node {

// if true, all Buffer and SlowBuffer instances will automatically zero-fill
bool zero_fill_all_buffers = false;

namespace {

inline void* BufferMalloc(size_t length) {
return zero_fill_all_buffers ? node::UncheckedCalloc(length) :
node::UncheckedMalloc(length);
return per_process_opts->zero_fill_all_buffers ?
node::UncheckedCalloc(length) :
node::UncheckedMalloc(length);
}

} // namespace
Expand Down
4 changes: 0 additions & 4 deletions src/node_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

namespace node {

// TODO(addaleax): Remove this.
NODE_DEPRECATED("use command-line flags",
extern bool zero_fill_all_buffers);

namespace Buffer {

static const unsigned int kMaxLength = v8::TypedArray::kMaxLength;
Expand Down
2 changes: 1 addition & 1 deletion src/node_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void Initialize(Local<Object> target,
#ifdef NODE_FIPS_MODE
READONLY_BOOLEAN_PROPERTY("fipsMode");
// TODO(addaleax): Use options parser variable instead.
if (force_fips_crypto)
if (per_process_opts->force_fips_crypto)
READONLY_BOOLEAN_PROPERTY("fipsForced");
#endif

Expand Down
13 changes: 4 additions & 9 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,7 @@ static X509_STORE* NewRootCertStore() {
if (*system_cert_path != '\0') {
X509_STORE_load_locations(store, system_cert_path, nullptr);
}
// TODO(addaleax): Replace `ssl_openssl_cert_store` with
// `per_process_opts->ssl_openssl_cert_store`.
if (ssl_openssl_cert_store) {
if (per_process_opts->ssl_openssl_cert_store) {
X509_STORE_set_default_paths(store);
} else {
for (X509* cert : root_certs_vector) {
Expand Down Expand Up @@ -5578,10 +5576,8 @@ void InitCryptoOnce() {
#ifdef NODE_FIPS_MODE
/* Override FIPS settings in cnf file, if needed. */
unsigned long err = 0; // NOLINT(runtime/int)
// TODO(addaleax): Use commented part instead.
/*if (per_process_opts->enable_fips_crypto ||
per_process_opts->force_fips_crypto) {*/
if (enable_fips_crypto || force_fips_crypto) {
if (per_process_opts->enable_fips_crypto ||
per_process_opts->force_fips_crypto) {
if (0 == FIPS_mode() && !FIPS_mode_set(1)) {
err = ERR_get_error();
}
Expand Down Expand Up @@ -5644,8 +5640,7 @@ void GetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
}

void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
// TODO(addaleax): Use options parser variables instead.
CHECK(!force_fips_crypto);
CHECK(!per_process_opts->force_fips_crypto);
Environment* env = Environment::GetCurrent(args);
const bool enabled = FIPS_mode();
bool enable;
Expand Down