| Server IP : 82.148.16.210 / Your IP : 216.73.216.249 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/proc/thread-self/root/usr/include/nodejs/src/crypto/ |
Upload File : |
#ifndef SRC_CRYPTO_CRYPTO_RANDOM_H_
#define SRC_CRYPTO_CRYPTO_RANDOM_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "base_object.h"
#include "crypto/crypto_util.h"
#include "env.h"
#include "memory_tracker.h"
#include "node_internals.h"
#include "v8.h"
namespace node {
namespace crypto {
struct RandomBytesConfig final : public MemoryRetainer {
unsigned char* buffer;
size_t size;
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(RandomBytesConfig)
SET_SELF_SIZE(RandomBytesConfig)
};
struct RandomBytesTraits final {
using AdditionalParameters = RandomBytesConfig;
static constexpr const char* JobName = "RandomBytesJob";
static constexpr AsyncWrap::ProviderType Provider =
AsyncWrap::PROVIDER_RANDOMBYTESREQUEST;
static v8::Maybe<bool> AdditionalConfig(
CryptoJobMode mode,
const v8::FunctionCallbackInfo<v8::Value>& args,
unsigned int offset,
RandomBytesConfig* params);
static bool DeriveBits(
Environment* env,
const RandomBytesConfig& params,
ByteSource* out_);
static v8::Maybe<bool> EncodeOutput(
Environment* env,
const RandomBytesConfig& params,
ByteSource* unused,
v8::Local<v8::Value>* result);
};
using RandomBytesJob = DeriveBitsJob<RandomBytesTraits>;
struct RandomPrimeConfig final : public MemoryRetainer {
BignumPointer prime;
BignumPointer rem;
BignumPointer add;
int bits;
bool safe;
void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(RandomPrimeConfig)
SET_SELF_SIZE(RandomPrimeConfig)
};
struct RandomPrimeTraits final {
using AdditionalParameters = RandomPrimeConfig;
static constexpr const char* JobName = "RandomPrimeJob";
static constexpr AsyncWrap::ProviderType Provider =
AsyncWrap::PROVIDER_RANDOMPRIMEREQUEST;
static v8::Maybe<bool> AdditionalConfig(
CryptoJobMode mode,
const v8::FunctionCallbackInfo<v8::Value>& args,
unsigned int offset,
RandomPrimeConfig* params);
static bool DeriveBits(
Environment* env,
const RandomPrimeConfig& params,
ByteSource* out_);
static v8::Maybe<bool> EncodeOutput(
Environment* env,
const RandomPrimeConfig& params,
ByteSource* unused,
v8::Local<v8::Value>* result);
};
using RandomPrimeJob = DeriveBitsJob<RandomPrimeTraits>;
struct CheckPrimeConfig final : public MemoryRetainer {
BignumPointer candidate;
int checks = 1;
void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(CheckPrimeConfig)
SET_SELF_SIZE(CheckPrimeConfig)
};
struct CheckPrimeTraits final {
using AdditionalParameters = CheckPrimeConfig;
static constexpr const char* JobName = "CheckPrimeJob";
static constexpr AsyncWrap::ProviderType Provider =
AsyncWrap::PROVIDER_CHECKPRIMEREQUEST;
static v8::Maybe<bool> AdditionalConfig(
CryptoJobMode mode,
const v8::FunctionCallbackInfo<v8::Value>& args,
unsigned int offset,
CheckPrimeConfig* params);
static bool DeriveBits(
Environment* env,
const CheckPrimeConfig& params,
ByteSource* out);
static v8::Maybe<bool> EncodeOutput(
Environment* env,
const CheckPrimeConfig& params,
ByteSource* out,
v8::Local<v8::Value>* result);
};
using CheckPrimeJob = DeriveBitsJob<CheckPrimeTraits>;
namespace Random {
void Initialize(Environment* env, v8::Local<v8::Object> target);
void RegisterExternalReferences(ExternalReferenceRegistry* registry);
} // namespace Random
} // namespace crypto
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_CRYPTO_CRYPTO_RANDOM_H_