@@ -212,7 +212,7 @@ static int CryptoPemCallback(char *buf, int size, int rwflag, void *u) {
212212
213213
214214void ThrowCryptoError (Environment* env,
215- unsigned long err,
215+ unsigned long err, // NOLINT(runtime/int)
216216 const char * default_message = nullptr ) {
217217 HandleScope scope (env->isolate ());
218218 if (err != 0 || default_message == nullptr ) {
@@ -458,7 +458,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
458458
459459 if (!key) {
460460 BIO_free_all (bio);
461- unsigned long err = ERR_get_error ();
461+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
462462 if (!err) {
463463 return env->ThrowError (" PEM_read_bio_PrivateKey" );
464464 }
@@ -470,7 +470,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
470470 BIO_free_all (bio);
471471
472472 if (!rv) {
473- unsigned long err = ERR_get_error ();
473+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
474474 if (!err)
475475 return env->ThrowError (" SSL_CTX_use_PrivateKey" );
476476 return ThrowCryptoError (env, err);
@@ -588,7 +588,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
588588
589589 X509* extra = nullptr ;
590590 int ret = 0 ;
591- unsigned long err = 0 ;
591+ unsigned long err = 0 ; // NOLINT(runtime/int)
592592
593593 // Read extra certs
594594 STACK_OF (X509)* extra_certs = sk_X509_new_null ();
@@ -664,7 +664,7 @@ void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {
664664 BIO_free_all (bio);
665665
666666 if (!rv) {
667- unsigned long err = ERR_get_error ();
667+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
668668 if (!err) {
669669 return env->ThrowError (" SSL_CTX_use_certificate_chain" );
670670 }
@@ -873,7 +873,9 @@ void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) {
873873 return sc->env ()->ThrowTypeError (" Options must be an integer value" );
874874 }
875875
876- SSL_CTX_set_options (sc->ctx_ , static_cast <long >(args[0 ]->IntegerValue ()));
876+ SSL_CTX_set_options (
877+ sc->ctx_ ,
878+ static_cast <long >(args[0 ]->IntegerValue ())); // NOLINT(runtime/int)
877879}
878880
879881
@@ -1016,7 +1018,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
10161018 delete[] pass;
10171019
10181020 if (!ret) {
1019- unsigned long err = ERR_get_error ();
1021+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
10201022 const char * str = ERR_reason_error_string (err);
10211023 return env->ThrowError (str);
10221024 }
@@ -1458,7 +1460,7 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
14581460 String::kNormalString , mem->length ));
14591461 (void ) BIO_reset (bio);
14601462
1461- unsigned long exponent_word = BN_get_word (rsa->e );
1463+ BN_ULONG exponent_word = BN_get_word (rsa->e );
14621464 BIO_printf (bio, " 0x%lx" , exponent_word);
14631465
14641466 BIO_get_mem_ptr (bio, &mem);
@@ -1928,7 +1930,8 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
19281930 // XXX(bnoordhuis) The UNABLE_TO_GET_ISSUER_CERT error when there is no
19291931 // peer certificate is questionable but it's compatible with what was
19301932 // here before.
1931- long x509_verify_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
1933+ long x509_verify_error = // NOLINT(runtime/int)
1934+ X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
19321935 if (X509* peer_cert = SSL_get_peer_certificate (w->ssl_ )) {
19331936 X509_free (peer_cert);
19341937 x509_verify_error = SSL_get_verify_result (w->ssl_ );
@@ -2157,11 +2160,6 @@ void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
21572160#endif // OPENSSL_NPN_NEGOTIATED
21582161
21592162#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
2160- typedef struct tlsextalpnctx_st {
2161- unsigned char * data;
2162- unsigned short len;
2163- } tlsextalpnctx;
2164-
21652163template <class Base >
21662164int SSLWrap<Base>::SelectALPNCallback(SSL* s,
21672165 const unsigned char ** out,
@@ -2401,7 +2399,7 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
24012399 if (rv)
24022400 rv = w->SetCACerts (sc);
24032401 if (!rv) {
2404- unsigned long err = ERR_get_error ();
2402+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
24052403 if (!err)
24062404 return env->ThrowError (" CertCbDone" );
24072405 return ThrowCryptoError (env, err);
@@ -2839,7 +2837,7 @@ void Connection::New(const FunctionCallbackInfo<Value>& args) {
28392837 SSL_set_bio (conn->ssl_ , conn->bio_read_ , conn->bio_write_ );
28402838
28412839#ifdef SSL_MODE_RELEASE_BUFFERS
2842- long mode = SSL_get_mode (conn->ssl_ );
2840+ long mode = SSL_get_mode (conn->ssl_ ); // NOLINT(runtime/int)
28432841 SSL_set_mode (conn->ssl_ , mode | SSL_MODE_RELEASE_BUFFERS);
28442842#endif
28452843
@@ -3838,7 +3836,7 @@ void SignBase::CheckThrow(SignBase::Error error) {
38383836 case kSignPrivateKey :
38393837 case kSignPublicKey :
38403838 {
3841- unsigned long err = ERR_get_error ();
3839+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
38423840 if (err)
38433841 return ThrowCryptoError (env (), err);
38443842 switch (error) {
@@ -5415,11 +5413,11 @@ class RandomBytesRequest : public AsyncWrap {
54155413 size_ = 0 ;
54165414 }
54175415
5418- inline unsigned long error () const {
5416+ inline unsigned long error () const { // NOLINT(runtime/int)
54195417 return error_;
54205418 }
54215419
5422- inline void set_error (unsigned long err) {
5420+ inline void set_error (unsigned long err) { // NOLINT(runtime/int)
54235421 error_ = err;
54245422 }
54255423
@@ -5428,7 +5426,7 @@ class RandomBytesRequest : public AsyncWrap {
54285426 uv_work_t work_req_;
54295427
54305428 private:
5431- unsigned long error_;
5429+ unsigned long error_; // NOLINT(runtime/int)
54325430 size_t size_;
54335431 char * data_;
54345432};
@@ -5446,9 +5444,9 @@ void RandomBytesWork(uv_work_t* work_req) {
54465444
54475445 // RAND_bytes() returns 0 on error.
54485446 if (r == 0 ) {
5449- req->set_error (ERR_get_error ());
5447+ req->set_error (ERR_get_error ()); // NOLINT(runtime/int)
54505448 } else if (r == -1 ) {
5451- req->set_error (static_cast <unsigned long >(-1 ));
5449+ req->set_error (static_cast <unsigned long >(-1 )); // NOLINT(runtime/int)
54525450 }
54535451}
54545452
@@ -5458,7 +5456,7 @@ void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) {
54585456 if (req->error ()) {
54595457 char errmsg[256 ] = " Operation not supported" ;
54605458
5461- if (req->error () != static_cast <unsigned long >(-1 ))
5459+ if (req->error () != static_cast <unsigned long >(-1 )) // NOLINT(runtime/int)
54625460 ERR_error_string_n (req->error (), errmsg, sizeof errmsg);
54635461
54645462 argv[0 ] = Exception::Error (OneByteString (req->env ()->isolate (), errmsg));
@@ -5797,7 +5795,7 @@ void InitCryptoOnce() {
57975795
57985796#ifdef NODE_FIPS_MODE
57995797 /* Override FIPS settings in cnf file, if needed. */
5800- unsigned long err = 0 ;
5798+ unsigned long err = 0 ; // NOLINT(runtime/int)
58015799 if (enable_fips_crypto || force_fips_crypto) {
58025800 if (0 == FIPS_mode () && !FIPS_mode_set (1 )) {
58035801 err = ERR_get_error ();
@@ -5879,7 +5877,7 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
58795877 return env->ThrowError (
58805878 " Cannot set FIPS mode, it was forced with --force-fips at startup." );
58815879 } else if (!FIPS_mode_set (mode)) {
5882- unsigned long err = ERR_get_error ();
5880+ unsigned long err = ERR_get_error (); // NOLINT(runtime/int)
58835881 return ThrowCryptoError (env, err);
58845882 }
58855883#else
0 commit comments