@ -2280,7 +2280,6 @@ int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void* arg) {
// OpenSSL takes control of the pointer after accepting it
// OpenSSL takes control of the pointer after accepting it
char * data = node : : Malloc ( len ) ;
char * data = node : : Malloc ( len ) ;
CHECK_NE ( data , nullptr ) ;
memcpy ( data , resp , len ) ;
memcpy ( data , resp , len ) ;
if ( ! SSL_set_tlsext_status_ocsp_resp ( s , data , len ) )
if ( ! SSL_set_tlsext_status_ocsp_resp ( s , data , len ) )
@ -3331,7 +3330,6 @@ bool CipherBase::GetAuthTag(char** out, unsigned int* out_len) const {
return false ;
return false ;
* out_len = auth_tag_len_ ;
* out_len = auth_tag_len_ ;
* out = node : : Malloc ( auth_tag_len_ ) ;
* out = node : : Malloc ( auth_tag_len_ ) ;
CHECK_NE ( * out , nullptr ) ;
memcpy ( * out , auth_tag_ , auth_tag_len_ ) ;
memcpy ( * out , auth_tag_ , auth_tag_len_ ) ;
return true ;
return true ;
}
}
@ -4907,7 +4905,6 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
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 = node : : Malloc ( out_len ) ;
char * out = node : : Malloc ( out_len ) ;
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 ) ;
EC_POINT_free ( pub ) ;
EC_POINT_free ( pub ) ;
@ -4943,7 +4940,6 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
return env - > ThrowError ( " Failed to get public key length " ) ;
return env - > ThrowError ( " Failed to get public key length " ) ;
unsigned char * out = node : : Malloc < unsigned char > ( size ) ;
unsigned char * out = node : : Malloc < unsigned char > ( size ) ;
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 ) ;
if ( r ! = size ) {
if ( r ! = size ) {
@ -4969,7 +4965,6 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
int size = BN_num_bytes ( b ) ;
int size = BN_num_bytes ( b ) ;
unsigned char * out = node : : Malloc < unsigned char > ( size ) ;
unsigned char * out = node : : Malloc < unsigned char > ( size ) ;
CHECK_NE ( out , nullptr ) ;
if ( size ! = BN_bn2bin ( b , out ) ) {
if ( size ! = BN_bn2bin ( b , out ) ) {
free ( out ) ;
free ( out ) ;
@ -5101,8 +5096,6 @@ class PBKDF2Request : public AsyncWrap {
keylen_ ( keylen ) ,
keylen_ ( keylen ) ,
key_ ( node : : Malloc ( keylen ) ) ,
key_ ( node : : Malloc ( keylen ) ) ,
iter_ ( iter ) {
iter_ ( iter ) {
if ( key ( ) = = nullptr )
FatalError ( " node::PBKDF2Request() " , " Out of Memory " ) ;
Wrap ( object , this ) ;
Wrap ( object , this ) ;
}
}
@ -5263,9 +5256,6 @@ 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 = node : : Malloc ( passlen ) ;
pass = node : : Malloc ( passlen ) ;
if ( pass = = nullptr ) {
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
}
memcpy ( pass , Buffer : : Data ( args [ 0 ] ) , passlen ) ;
memcpy ( pass , Buffer : : Data ( args [ 0 ] ) , passlen ) ;
saltlen = Buffer : : Length ( args [ 1 ] ) ;
saltlen = Buffer : : Length ( args [ 1 ] ) ;
@ -5275,9 +5265,6 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
}
}
salt = node : : Malloc ( saltlen ) ;
salt = node : : Malloc ( saltlen ) ;
if ( salt = = nullptr ) {
FatalError ( " node::PBKDF2() " , " Out of Memory " ) ;
}
memcpy ( salt , Buffer : : Data ( args [ 1 ] ) , saltlen ) ;
memcpy ( salt , Buffer : : Data ( args [ 1 ] ) , saltlen ) ;
if ( ! args [ 2 ] - > IsNumber ( ) ) {
if ( ! args [ 2 ] - > IsNumber ( ) ) {
@ -5368,8 +5355,6 @@ class RandomBytesRequest : public AsyncWrap {
error_ ( 0 ) ,
error_ ( 0 ) ,
size_ ( size ) ,
size_ ( size ) ,
data_ ( node : : Malloc ( size ) ) {
data_ ( node : : Malloc ( size ) ) {
if ( data ( ) = = nullptr )
FatalError ( " node::RandomBytesRequest() " , " Out of Memory " ) ;
Wrap ( object , this ) ;
Wrap ( object , this ) ;
}
}
@ -5596,8 +5581,6 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {
if ( num_curves ) {
if ( num_curves ) {
curves = node : : Malloc < EC_builtin_curve > ( num_curves ) ;
curves = node : : Malloc < EC_builtin_curve > ( num_curves ) ;
CHECK_NE ( curves , nullptr ) ;
if ( EC_get_builtin_curves ( curves , num_curves ) ) {
if ( EC_get_builtin_curves ( curves , num_curves ) ) {
for ( size_t i = 0 ; i < num_curves ; i + + ) {
for ( size_t i = 0 ; i < num_curves ; i + + ) {
arr - > Set ( i , OneByteString ( env - > isolate ( ) , OBJ_nid2sn ( curves [ i ] . nid ) ) ) ;
arr - > Set ( i , OneByteString ( env - > isolate ( ) , OBJ_nid2sn ( curves [ i ] . nid ) ) ) ;