diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 79768e983b8155..3babec6e32fc05 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -153,7 +153,7 @@ template int SSLWrap::SelectALPNCallback( #endif // TLSEXT_TYPE_application_layer_protocol_negotiation -static int PasswordCallback(char *buf, int size, int rwflag, void *u) { +static int PasswordCallback(char* buf, int size, int rwflag, void* u) { if (u) { size_t buflen = static_cast(size); size_t len = strlen(static_cast(u)); @@ -206,7 +206,7 @@ static ENGINE* LoadEngineById(const char* engine_id, char (*errmsg)[1024]) { // for the OpenSSL CLI, but works poorly for Node.js because it involves // synchronous interaction with the controlling terminal, something we never // want, and use this function to avoid it. -static int NoPasswordCallback(char *buf, int size, int rwflag, void *u) { +static int NoPasswordCallback(char* buf, int size, int rwflag, void* u) { return 0; } @@ -311,7 +311,7 @@ bool EntropySource(unsigned char* buffer, size_t length) { void SecureContext::Initialize(Environment* env, Local target) { - Local t = env->NewFunctionTemplate(SecureContext::New); + Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); Local secureContextString = FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext"); @@ -464,8 +464,7 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { RAND_bytes(sc->ticket_key_aes_, sizeof(sc->ticket_key_aes_)) <= 0) { return env->ThrowError("Error generating ticket keys"); } - SSL_CTX_set_tlsext_ticket_key_cb(sc->ctx_.get(), - SecureContext::TicketCompatibilityCallback); + SSL_CTX_set_tlsext_ticket_key_cb(sc->ctx_.get(), TicketCompatibilityCallback); } @@ -727,7 +726,7 @@ static X509_STORE* NewRootCertStore() { if (root_certs_vector.empty()) { for (size_t i = 0; i < arraysize(root_certs); i++) { BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i])); - X509 *x509 = PEM_read_bio_X509(bp, nullptr, NoPasswordCallback, nullptr); + X509* x509 = PEM_read_bio_X509(bp, nullptr, NoPasswordCallback, nullptr); BIO_free(bp); // Parse errors from the built-in roots are fatal. @@ -744,7 +743,7 @@ static X509_STORE* NewRootCertStore() { if (ssl_openssl_cert_store) { X509_STORE_set_default_paths(store); } else { - for (X509 *cert : root_certs_vector) { + for (X509* cert : root_certs_vector) { X509_up_ref(cert); X509_STORE_add_cert(store, cert); } @@ -1916,8 +1915,7 @@ void SSLWrap::SetSession(const FunctionCallbackInfo& args) { sbuf.assign(p, p + slen); const unsigned char* p = reinterpret_cast(sbuf.data()); - SSLSessionPointer sess( - d2i_SSL_SESSION(nullptr, &p, slen)); + SSLSessionPointer sess(d2i_SSL_SESSION(nullptr, &p, slen)); if (sess == nullptr) return; @@ -1996,7 +1994,7 @@ void SSLWrap::GetTLSTicket(const FunctionCallbackInfo& args) { if (sess == nullptr) return; - const unsigned char *ticket; + const unsigned char* ticket; size_t length; SSL_SESSION_get0_ticket(sess, &ticket, &length); @@ -2020,8 +2018,7 @@ void SSLWrap::NewSessionDone(const FunctionCallbackInfo& args) { template -void SSLWrap::SetOCSPResponse( - const v8::FunctionCallbackInfo& args) { +void SSLWrap::SetOCSPResponse(const FunctionCallbackInfo& args) { #ifdef NODE__HAVE_TLSEXT_STATUS_CB Base* w; ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); @@ -2038,8 +2035,7 @@ void SSLWrap::SetOCSPResponse( template -void SSLWrap::RequestOCSP( - const v8::FunctionCallbackInfo& args) { +void SSLWrap::RequestOCSP(const FunctionCallbackInfo& args) { #ifdef NODE__HAVE_TLSEXT_STATUS_CB Base* w; ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); @@ -2051,7 +2047,7 @@ void SSLWrap::RequestOCSP( template void SSLWrap::GetEphemeralKeyInfo( - const v8::FunctionCallbackInfo& args) { + const FunctionCallbackInfo& args) { Base* w; ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); Environment* env = Environment::GetCurrent(args); @@ -2111,7 +2107,7 @@ void SSLWrap::GetEphemeralKeyInfo( #ifdef SSL_set_max_send_fragment template void SSLWrap::SetMaxSendFragment( - const v8::FunctionCallbackInfo& args) { + const FunctionCallbackInfo& args) { CHECK(args.Length() >= 1 && args[0]->IsNumber()); Base* w; @@ -2265,7 +2261,7 @@ int SSLWrap::SelectALPNCallback(SSL* s, template void SSLWrap::GetALPNNegotiatedProto( - const FunctionCallbackInfo& args) { + const FunctionCallbackInfo& args) { #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation Base* w; ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); @@ -2285,8 +2281,7 @@ void SSLWrap::GetALPNNegotiatedProto( template -void SSLWrap::SetALPNProtocols( - const FunctionCallbackInfo& args) { +void SSLWrap::SetALPNProtocols(const FunctionCallbackInfo& args) { #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation Base* w; ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); @@ -2776,7 +2771,7 @@ static bool IsValidGCMTagLength(unsigned int tag_len) { return tag_len == 4 || tag_len == 8 || (tag_len >= 12 && tag_len <= 16); } -bool CipherBase::InitAuthenticated(const char *cipher_type, int iv_len, +bool CipherBase::InitAuthenticated(const char* cipher_type, int iv_len, unsigned int auth_tag_len) { CHECK(IsAuthenticatedMode()); @@ -3084,7 +3079,7 @@ void CipherBase::SetAutoPadding(const FunctionCallbackInfo& args) { } -bool CipherBase::Final(unsigned char** out, int *out_len) { +bool CipherBase::Final(unsigned char** out, int* out_len) { if (!ctx_) return false; @@ -3156,7 +3151,7 @@ void CipherBase::Final(const FunctionCallbackInfo& args) { } -void Hmac::Initialize(Environment* env, v8::Local target) { +void Hmac::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3276,7 +3271,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { } -void Hash::Initialize(Environment* env, v8::Local target) { +void Hash::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3468,7 +3463,7 @@ static bool ApplyRSAOptions(const EVPKeyPointer& pkey, -void Sign::Initialize(Environment* env, v8::Local target) { +void Sign::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3634,7 +3629,7 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { } -void Verify::Initialize(Environment* env, v8::Local target) { +void Verify::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -4214,7 +4209,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo& args) { Buffer::New(env->isolate(), data.release(), data.size).ToLocalChecked()); } -void DiffieHellman::SetKey(const v8::FunctionCallbackInfo& args, +void DiffieHellman::SetKey(const v8::FunctionCallbackInfo& args, int (*set_field)(DH*, BIGNUM*), const char* what) { Environment* env = Environment::GetCurrent(args);