diff --git a/node.gyp b/node.gyp
index 23134d1056..62b393b7d2 100644
--- a/node.gyp
+++ b/node.gyp
@@ -801,12 +801,14 @@
[ 'node_use_openssl=="true"', {
'sources': [
'src/node_crypto.cc',
+ 'src/node_crypto_common.cc',
'src/node_crypto_bio.cc',
'src/node_crypto_clienthello.cc',
'src/node_crypto.h',
'src/node_crypto_bio.h',
'src/node_crypto_clienthello.h',
'src/node_crypto_clienthello-inl.h',
+ 'src/node_crypto_common.h',
'src/node_crypto_groups.h',
'src/tls_wrap.cc',
'src/tls_wrap.h',
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index bae09d65d6..6d91b57c2e 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -24,6 +24,7 @@
#include "node_crypto_bio.h"
#include "node_crypto_clienthello-inl.h"
#include "node_crypto_groups.h"
+#include "node_crypto_common.h"
#include "node_errors.h"
#include "node_mutex.h"
#include "node_process.h"
@@ -2270,46 +2271,12 @@ void SSLWrap::GetPeerCertificate(
const FunctionCallbackInfo& args) {
Base* w;
ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder());
- Environment* env = w->ssl_env();
-
- ClearErrorOnReturn clear_error_on_return;
-
- Local