GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: avoid possible race during NodeBIO initialization · nodejs/node@b2ac7a7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_crypto.cc
    • node_crypto.h
    • node_crypto_bio.cc
    • node_crypto_bio.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5126,6 +5126,8 @@ void InitCryptoOnce() {
51265126
ERR_load_ENGINE_strings();
51275127
ENGINE_load_builtin_engines();
51285128
#endif // !OPENSSL_NO_ENGINE
5129+
5130+
NodeBIO::GetMethod();
51295131
}
51305132

51315133

Collapse file

‎src/node_crypto.h‎

Copy file name to clipboardExpand all lines: src/node_crypto.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx);
9797

9898
extern void UseExtraCaCerts(const std::string& file);
9999

100+
void InitCryptoOnce();
101+
100102
class SecureContext : public BaseObject {
101103
public:
102104
~SecureContext() override {
Collapse file

‎src/node_crypto_bio.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto_bio.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ const BIO_METHOD* NodeBIO::GetMethod() {
247247

248248
return &method;
249249
#else
250+
// This is called from InitCryptoOnce() to avoid race conditions during
251+
// initialization.
250252
static BIO_METHOD* method = nullptr;
251253

252254
if (method == nullptr) {
Collapse file

‎src/node_crypto_bio.h‎

Copy file name to clipboardExpand all lines: src/node_crypto_bio.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ class NodeBIO : public MemoryRetainer {
164164
int eof_return_ = -1;
165165
Buffer* read_head_ = nullptr;
166166
Buffer* write_head_ = nullptr;
167+
168+
friend void node::crypto::InitCryptoOnce();
167169
};
168170

169171
} // namespace crypto

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.