Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
node_crypto.cc File Reference
#include "node.h"
#include "node_buffer.h"
#include "node_constants.h"
#include "node_crypto.h"
#include "node_crypto_bio.h"
#include "node_crypto_groups.h"
#include "node_mutex.h"
#include "tls_wrap.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "string_bytes.h"
#include "util.h"
#include "util-inl.h"
#include "v8.h"
#include "CNNICHashWhitelist.inc"
#include "StartComAndWoSignData.inc"
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "node_root_certs.h"
Include dependency graph for node_crypto.cc:

Go to the source code of this file.

Data Structures

class  PBKDF2Request
 
class  RandomBytesRequest
 
class  CipherPushContext
 

Namespaces

 node
 
 node::crypto
 

Macros

#define THROW_AND_RETURN_IF_NOT_STRING_OR_BUFFER(val, prefix)
 
#define THROW_AND_RETURN_IF_NOT_BUFFER(val, prefix)
 
#define THROW_AND_RETURN_IF_NOT_STRING(val, prefix)
 
#define CASE_X509_ERR(CODE)   case X509_V_ERR_##CODE: code = #CODE; break;
 
#define DEBUG_PRINT(...)
 

Functions

void ThrowCryptoError (Environment *env, unsigned long err, const char *default_message=nullptr)
 
void CheckEntropy ()
 
bool EntropySource (unsigned char *buffer, size_t length)
 
int SSL_CTX_get_issuer (SSL_CTX *ctx, X509 *cert, X509 **issuer)
 
int SSL_CTX_use_certificate_chain (SSL_CTX *ctx, X509 *x, STACK_OF(X509) *extra_certs, X509 **cert, X509 **issuer)
 
int SSL_CTX_use_certificate_chain (SSL_CTX *ctx, BIO *in, X509 **cert, X509 **issuer)
 
void UseExtraCaCerts (const std::string &file)
 
int compar (const void *a, const void *b)
 
int IsSelfSigned (X509 *cert)
 
X509 * FindRoot (STACK_OF(X509) *sk)
 
bool CertIsStartComOrWoSign (X509_NAME *name)
 
bool CheckStartComOrWoSign (X509_NAME *root_name, X509 *cert)
 
CheckResult CheckWhitelistedServerCert (X509_STORE_CTX *ctx)
 
int VerifyCallback (int preverify_ok, X509_STORE_CTX *ctx)
 
void PBKDF2 (const FunctionCallbackInfo< Value > &args)
 
void RandomBytesWork (uv_work_t *work_req)
 
void RandomBytesCheck (RandomBytesRequest *req, Local< Value >(*argv)[2])
 
void RandomBytesAfter (uv_work_t *work_req, int status)
 
void RandomBytesProcessSync (Environment *env, RandomBytesRequest *req, Local< Value >(*argv)[2])
 
void RandomBytes (const FunctionCallbackInfo< Value > &args)
 
void RandomBytesBuffer (const FunctionCallbackInfo< Value > &args)
 
void GetSSLCiphers (const FunctionCallbackInfo< Value > &args)
 
void GetCiphers (const FunctionCallbackInfo< Value > &args)
 
void GetHashes (const FunctionCallbackInfo< Value > &args)
 
void GetCurves (const FunctionCallbackInfo< Value > &args)
 
bool VerifySpkac (const char *data, unsigned int len)
 
void VerifySpkac (const FunctionCallbackInfo< Value > &args)
 
char * ExportPublicKey (const char *data, int len, size_t *size)
 
void ExportPublicKey (const FunctionCallbackInfo< Value > &args)
 
const char * ExportChallenge (const char *data, int len)
 
void ExportChallenge (const FunctionCallbackInfo< Value > &args)
 
void TimingSafeEqual (const FunctionCallbackInfo< Value > &args)
 
void InitCryptoOnce ()
 
void SetEngine (const FunctionCallbackInfo< Value > &args)
 
void GetFipsCrypto (const FunctionCallbackInfo< Value > &args)
 
void SetFipsCrypto (const FunctionCallbackInfo< Value > &args)
 
void InitCrypto (Local< Object > target, Local< Value > unused, Local< Context > context, void *priv)
 

Macro Definition Documentation

◆ CASE_X509_ERR

#define CASE_X509_ERR (   CODE)    case X509_V_ERR_##CODE: code = #CODE; break;

◆ DEBUG_PRINT

#define DEBUG_PRINT (   ...)

Definition at line 2589 of file node_crypto.cc.

◆ THROW_AND_RETURN_IF_NOT_BUFFER

#define THROW_AND_RETURN_IF_NOT_BUFFER (   val,
  prefix 
)
Value:
do { \
if (!Buffer::HasInstance(val)) { \
return env->ThrowTypeError(prefix " must be a buffer"); \
} \
} while (0)
bool HasInstance(Local< Value > val)
Definition: node_buffer.cc:201

Definition at line 61 of file node_crypto.cc.

Referenced by node::crypto::ExportChallenge(), node::crypto::ExportPublicKey(), node::crypto::PBKDF2(), node::crypto::TimingSafeEqual(), node::crypto::UseExtraCaCerts(), node::crypto::VerifyCallback(), and node::crypto::VerifySpkac().

◆ THROW_AND_RETURN_IF_NOT_STRING

#define THROW_AND_RETURN_IF_NOT_STRING (   val,
  prefix 
)
Value:
do { \
if (!val->IsString()) { \
return env->ThrowTypeError(prefix " must be a string"); \
} \
} while (0)

Definition at line 68 of file node_crypto.cc.

Referenced by node::crypto::EntropySource(), node::crypto::UseExtraCaCerts(), and node::crypto::VerifyCallback().

◆ THROW_AND_RETURN_IF_NOT_STRING_OR_BUFFER

#define THROW_AND_RETURN_IF_NOT_STRING_OR_BUFFER (   val,
  prefix 
)
Value:
do { \
if (!Buffer::HasInstance(val) && !val->IsString()) { \
return env->ThrowTypeError(prefix " must be a string or a buffer"); \
} \
} while (0)
bool HasInstance(Local< Value > val)
Definition: node_buffer.cc:201

Definition at line 54 of file node_crypto.cc.

Referenced by node::crypto::VerifyCallback().