@ -2279,7 +2279,7 @@ int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void* arg) {
size_t len = Buffer : : Length ( obj ) ;
size_t len = Buffer : : Length ( obj ) ;
// OpenSSL takes control of the pointer after accepting it
// OpenSSL takes control of the pointer after accepting it
char * data = reinterpret_cast < char * > ( m alloc( len ) ) ;
char * data = reinterpret_cast < char * > ( node : : M alloc( len ) ) ;
CHECK_NE ( data , nullptr ) ;
CHECK_NE ( data , nullptr ) ;
memcpy ( data , resp , len ) ;
memcpy ( data , resp , len ) ;
@ -3330,7 +3330,7 @@ bool CipherBase::GetAuthTag(char** out, unsigned int* out_len) const {
if ( initialised_ | | kind_ ! = kCipher | | ! auth_tag_ )
if ( initialised_ | | kind_ ! = kCipher | | ! auth_tag_ )
return false ;
return false ;
* out_len = auth_tag_len_ ;
* out_len = auth_tag_len_ ;
* out = static_cast < char * > ( m alloc( auth_tag_len_ ) ) ;
* out = static_cast < char * > ( node : : M alloc( auth_tag_len_ ) ) ;
CHECK_NE ( * out , nullptr ) ;
CHECK_NE ( * out , nullptr ) ;
memcpy ( * out , auth_tag_ , auth_tag_len_ ) ;
memcpy ( * out , auth_tag_ , auth_tag_len_ ) ;
return true ;
return true ;
@ -4906,7 +4906,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
// NOTE: field_size is in bits
// NOTE: field_size is in bits
int field_size = EC_GROUP_get_degree ( ecdh - > group_ ) ;
int field_size = EC_GROUP_get_degree ( ecdh - > group_ ) ;
size_t out_len = ( field_size + 7 ) / 8 ;
size_t out_len = ( field_size + 7 ) / 8 ;
char * out = static_cast < char * > ( m alloc( out_len ) ) ;
char * out = static_cast < char * > ( node : : M alloc( out_len ) ) ;
CHECK_NE ( out , nullptr ) ;
CHECK_NE ( out , nullptr ) ;
int r = ECDH_compute_key ( out , out_len , pub , ecdh - > key_ , nullptr ) ;
int r = ECDH_compute_key ( out , out_len , pub , ecdh - > key_ , nullptr ) ;
@ -4942,7 +4942,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
if ( size = = 0 )
if ( size = = 0 )
return env - > ThrowError ( " Failed to get public key length " ) ;
return env - > ThrowError ( " Failed to get public key length " ) ;
unsigned char * out = static_cast < unsigned char * > ( m alloc( size ) ) ;
unsigned char * out = static_cast < unsigned char * > ( node : : M alloc( size ) ) ;
CHECK_NE ( out , nullptr ) ;
CHECK_NE ( out , nullptr ) ;
int r = EC_POINT_point2oct ( ecdh - > group_ , pub , form , out , size , nullptr ) ;
int r = EC_POINT_point2oct ( ecdh - > group_ , pub , form , out , size , nullptr ) ;
@ -4968,7 +4968,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
return env - > ThrowError ( " Failed to get ECDH private key " ) ;
return env - > ThrowError ( " Failed to get ECDH private key " ) ;
int size = BN_num_bytes ( b ) ;
int size = BN_num_bytes ( b ) ;
unsigned char * out = static_cast < unsigned char * > ( m alloc( size ) ) ;
unsigned char * out = static_cast < unsigned char * > ( node : : M alloc( size ) ) ;
CHECK_NE ( out , nullptr ) ;
CHECK_NE ( out , nullptr ) ;
if ( size ! = BN_bn2bin ( b , out ) ) {
if ( size ! = BN_bn2bin ( b , out ) ) {
@ -5099,7 +5099,7 @@ class PBKDF2Request : public AsyncWrap {
saltlen_ ( saltlen ) ,
saltlen_ ( saltlen ) ,
salt_ ( salt ) ,
salt_ ( salt ) ,
keylen_ ( keylen ) ,
keylen_ ( keylen ) ,
key_ ( static_cast < char * > ( m alloc( keylen ) ) ) ,
key_ ( static_cast < char * > ( node : : M alloc( keylen ) ) ) ,
iter_ ( iter ) {
iter_ ( iter ) {
if ( key ( ) = = nullptr )
if ( key ( ) = = nullptr )
FatalError ( " node::PBKDF2Request() " , " Out of Memory " ) ;
FatalError ( " node::PBKDF2Request() " , " Out of Memory " ) ;
@ -5262,7 +5262,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
THROW_AND_RETURN_IF_NOT_BUFFER ( args [ 1 ] , " Salt " ) ;
THROW_AND_RETURN_IF_NOT_BUFFER ( args [ 1 ] , " Salt " ) ;
pass = static_cast < char * > ( m alloc( passlen ) ) ;
pass = static_cast < char * > ( node : : M alloc( passlen ) ) ;
if ( pass = = nullptr ) {
if ( pass = = nullptr ) {
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
}
}
@ -5274,7 +5274,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
goto err ;
goto err ;
}
}
salt = static_cast < char * > ( m alloc( saltlen ) ) ;
salt = static_cast < char * > ( node : : M alloc( saltlen ) ) ;
if ( salt = = nullptr ) {
if ( salt = = nullptr ) {
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
}
}
@ -5367,7 +5367,7 @@ class RandomBytesRequest : public AsyncWrap {
: AsyncWrap ( env , object , AsyncWrap : : PROVIDER_CRYPTO ) ,
: AsyncWrap ( env , object , AsyncWrap : : PROVIDER_CRYPTO ) ,
error_ ( 0 ) ,
error_ ( 0 ) ,
size_ ( size ) ,
size_ ( size ) ,
data_ ( static_cast < char * > ( m alloc( size ) ) ) {
data_ ( static_cast < char * > ( node : : M alloc( size ) ) ) {
if ( data ( ) = = nullptr )
if ( data ( ) = = nullptr )
FatalError ( " node::RandomBytesRequest() " , " Out of Memory " ) ;
FatalError ( " node::RandomBytesRequest() " , " Out of Memory " ) ;
Wrap ( object , this ) ;
Wrap ( object , this ) ;
@ -5596,7 +5596,7 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {
if ( num_curves ) {
if ( num_curves ) {
alloc_size = sizeof ( * curves ) * num_curves ;
alloc_size = sizeof ( * curves ) * num_curves ;
curves = static_cast < EC_builtin_curve * > ( m alloc( alloc_size ) ) ;
curves = static_cast < EC_builtin_curve * > ( node : : M alloc( alloc_size ) ) ;
CHECK_NE ( curves , nullptr ) ;
CHECK_NE ( curves , nullptr ) ;