src: remove public API for option variables
PR-URL: https://github.com/nodejs/node/pull/23069 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
d527dde360
commit
cc31d8b2d4
26
src/node.cc
26
src/node.cc
@ -610,7 +610,7 @@ fail:
|
|||||||
|
|
||||||
|
|
||||||
void* ArrayBufferAllocator::Allocate(size_t size) {
|
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);
|
return UncheckedCalloc(size);
|
||||||
else
|
else
|
||||||
return UncheckedMalloc(size);
|
return UncheckedMalloc(size);
|
||||||
@ -1920,8 +1920,7 @@ void SetupProcessObject(Environment* env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --no-deprecation
|
// --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()));
|
READONLY_PROPERTY(process, "noDeprecation", True(env->isolate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2442,16 +2441,6 @@ inline void PlatformInit() {
|
|||||||
#endif // _WIN32
|
#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,
|
void ProcessArgv(std::vector<std::string>* args,
|
||||||
std::vector<std::string>* exec_args,
|
std::vector<std::string>* exec_args,
|
||||||
bool is_env) {
|
bool is_env) {
|
||||||
@ -2535,17 +2524,6 @@ void ProcessArgv(std::vector<std::string>* args,
|
|||||||
if (v8_args_as_char_ptr.size() > 1) {
|
if (v8_args_as_char_ptr.size() > 1) {
|
||||||
exit(9);
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
14
src/node.h
14
src/node.h
@ -202,20 +202,6 @@ typedef intptr_t ssize_t;
|
|||||||
|
|
||||||
namespace node {
|
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
|
// TODO(addaleax): Officially deprecate this and replace it with something
|
||||||
// better suited for a public embedder API.
|
// better suited for a public embedder API.
|
||||||
NODE_EXTERN int Start(int argc, char* argv[]);
|
NODE_EXTERN int Start(int argc, char* argv[]);
|
||||||
|
@ -56,13 +56,11 @@
|
|||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
// if true, all Buffer and SlowBuffer instances will automatically zero-fill
|
|
||||||
bool zero_fill_all_buffers = false;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline void* BufferMalloc(size_t length) {
|
inline void* BufferMalloc(size_t length) {
|
||||||
return zero_fill_all_buffers ? node::UncheckedCalloc(length) :
|
return per_process_opts->zero_fill_all_buffers ?
|
||||||
|
node::UncheckedCalloc(length) :
|
||||||
node::UncheckedMalloc(length);
|
node::UncheckedMalloc(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
// TODO(addaleax): Remove this.
|
|
||||||
NODE_DEPRECATED("use command-line flags",
|
|
||||||
extern bool zero_fill_all_buffers);
|
|
||||||
|
|
||||||
namespace Buffer {
|
namespace Buffer {
|
||||||
|
|
||||||
static const unsigned int kMaxLength = v8::TypedArray::kMaxLength;
|
static const unsigned int kMaxLength = v8::TypedArray::kMaxLength;
|
||||||
|
@ -56,7 +56,7 @@ static void Initialize(Local<Object> target,
|
|||||||
#ifdef NODE_FIPS_MODE
|
#ifdef NODE_FIPS_MODE
|
||||||
READONLY_BOOLEAN_PROPERTY("fipsMode");
|
READONLY_BOOLEAN_PROPERTY("fipsMode");
|
||||||
// TODO(addaleax): Use options parser variable instead.
|
// TODO(addaleax): Use options parser variable instead.
|
||||||
if (force_fips_crypto)
|
if (per_process_opts->force_fips_crypto)
|
||||||
READONLY_BOOLEAN_PROPERTY("fipsForced");
|
READONLY_BOOLEAN_PROPERTY("fipsForced");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -751,9 +751,7 @@ static X509_STORE* NewRootCertStore() {
|
|||||||
if (*system_cert_path != '\0') {
|
if (*system_cert_path != '\0') {
|
||||||
X509_STORE_load_locations(store, system_cert_path, nullptr);
|
X509_STORE_load_locations(store, system_cert_path, nullptr);
|
||||||
}
|
}
|
||||||
// TODO(addaleax): Replace `ssl_openssl_cert_store` with
|
if (per_process_opts->ssl_openssl_cert_store) {
|
||||||
// `per_process_opts->ssl_openssl_cert_store`.
|
|
||||||
if (ssl_openssl_cert_store) {
|
|
||||||
X509_STORE_set_default_paths(store);
|
X509_STORE_set_default_paths(store);
|
||||||
} else {
|
} else {
|
||||||
for (X509* cert : root_certs_vector) {
|
for (X509* cert : root_certs_vector) {
|
||||||
@ -5585,10 +5583,8 @@ void InitCryptoOnce() {
|
|||||||
#ifdef NODE_FIPS_MODE
|
#ifdef NODE_FIPS_MODE
|
||||||
/* Override FIPS settings in cnf file, if needed. */
|
/* Override FIPS settings in cnf file, if needed. */
|
||||||
unsigned long err = 0; // NOLINT(runtime/int)
|
unsigned long err = 0; // NOLINT(runtime/int)
|
||||||
// TODO(addaleax): Use commented part instead.
|
if (per_process_opts->enable_fips_crypto ||
|
||||||
/*if (per_process_opts->enable_fips_crypto ||
|
per_process_opts->force_fips_crypto) {
|
||||||
per_process_opts->force_fips_crypto) {*/
|
|
||||||
if (enable_fips_crypto || force_fips_crypto) {
|
|
||||||
if (0 == FIPS_mode() && !FIPS_mode_set(1)) {
|
if (0 == FIPS_mode() && !FIPS_mode_set(1)) {
|
||||||
err = ERR_get_error();
|
err = ERR_get_error();
|
||||||
}
|
}
|
||||||
@ -5651,8 +5647,7 @@ void GetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
|
void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
|
||||||
// TODO(addaleax): Use options parser variables instead.
|
CHECK(!per_process_opts->force_fips_crypto);
|
||||||
CHECK(!force_fips_crypto);
|
|
||||||
Environment* env = Environment::GetCurrent(args);
|
Environment* env = Environment::GetCurrent(args);
|
||||||
const bool enabled = FIPS_mode();
|
const bool enabled = FIPS_mode();
|
||||||
bool enable;
|
bool enable;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user