GeezerVison is showing github.com — crypto: estimate kExternalSize · nodejs/node@201393f
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_crypto.h +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -106,7 +106,13 @@ class SecureContext : public BaseObject { |
106 | 106 | static const int kTicketKeyIVIndex = 4; |
107 | 107 |
|
108 | 108 | protected: |
| 109 | +#if OPENSSL_VERSION_NUMBER < 0x10100000L |
109 | 110 | static const int64_t kExternalSize = sizeof(SSL_CTX); |
| 111 | +#else |
| 112 | + // OpenSSL 1.1.0 has opaque structures. This is an estimate based on the size |
| 113 | + // as of OpenSSL 1.1.0f. |
| 114 | + static const int64_t kExternalSize = 872; |
| 115 | +#endif |
110 | 116 |
|
111 | 117 | static void New(const v8::FunctionCallbackInfo<v8::Value>& args); |
112 | 118 | static void Init(const v8::FunctionCallbackInfo<v8::Value>& args); |
@@ -220,11 +226,17 @@ class SSLWrap { |
220 | 226 | protected: |
221 | 227 | typedef void (*CertCb)(void* arg); |
222 | 228 |
|
| 229 | +#if OPENSSL_VERSION_NUMBER < 0x10100000L |
223 | 230 | // Size allocated by OpenSSL: one for SSL structure, one for SSL3_STATE and |
224 | 231 | // some for buffers. |
225 | 232 | // NOTE: Actually it is much more than this |
226 | 233 | static const int64_t kExternalSize = |
227 | 234 | sizeof(SSL) + sizeof(SSL3_STATE) + 42 * 1024; |
| 235 | +#else |
| 236 | + // OpenSSL 1.1.0 has opaque structures. This is an estimate based on the size |
| 237 | + // as of OpenSSL 1.1.0f. |
| 238 | + static const int64_t kExternalSize = 4448 + 1024 + 42 * 1024; |
| 239 | +#endif |
228 | 240 |
|
229 | 241 | static void InitNPN(SecureContext* sc); |
230 | 242 | static void AddMethods(Environment* env, v8::Local<v8::FunctionTemplate> t); |
|