Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,8 @@ CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard \
src/*.c \
src/*.cc \
src/*.h \
src/crypto_impl/*.h \
src/crypto_impl/*.cc \
test/addons/*/*.cc \
test/addons/*/*.h \
test/cctest/*.cc \
Expand Down
13 changes: 13 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ parser.add_option('--openssl-use-def-ca-store',
dest='use_openssl_ca_store',
help='Use OpenSSL supplied CA store instead of compiled-in Mozilla CA copy.')

parser.add_option("--crypto-version",
action="store",
dest="crypto_version",
help="The version of the crypto implementation.")

shared_optgroup.add_option('--shared-http-parser',
action='store_true',
dest='shared_http_parser',
Expand Down Expand Up @@ -985,6 +990,14 @@ def configure_openssl(o):
else:
o['variables']['openssl_fips'] = ''

if options.crypto_version is None:
options.crypto_version = "openssl_1_0_2e"
print('Using default crypto_version = %s Please specify a specific '
'version if this does not match the version of the crypto library.'
% options.crypto_version)

o['variables']['node_crypto_version'] = options.crypto_version
o['defines'] += ['NODE_CRYPTO_VERSION=%s' % options.crypto_version]

if options.without_ssl:
def without_ssl_error(option):
Expand Down
1 change: 0 additions & 1 deletion lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ exports.createSecureContext = function createSecureContext(options, context) {
// freelist.)
if (options.singleUse) {
c.singleUse = true;
c.context.setFreeListLength(0);
}

return c;
Expand Down
9 changes: 8 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,21 @@
'test/cctest/test_base64.cc',
'test/cctest/test_environment.cc',
'test/cctest/test_util.cc',
'test/cctest/test_url.cc'
'test/cctest/test_url.cc',
'test/cctest/test_crypto_factory.cc',
],

'sources!': [
'src/node_main.cc'
],

'conditions': [
[ 'node_crypto_version=="openssl_1_0_2e"', {
'sources+': ['test/cctest/test_openssl_1_0_2e.cc'],
}],
[ 'node_crypto_version=="openssl_1_1_0f"', {
'sources+': ['test/cctest/test_openssl_1_1_0f.cc'],
}],
['v8_enable_inspector==1', {
'sources': [
'test/cctest/test_inspector_socket.cc',
Expand Down
37 changes: 30 additions & 7 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,39 @@
[ 'node_use_openssl=="true"', {
'defines': [ 'HAVE_OPENSSL=1' ],
'sources': [
'src/node_crypto.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/tls_wrap.cc',
'src/tls_wrap.h'
'src/node_crypto_factory.h',
'src/node_crypto_factory.cc',
],
'conditions': [
[ 'node_crypto_version=="openssl_1_0_2e"', {
'sources+': [
'src/crypto_impl/openssl/1_0_2e/node_crypto.cc',
'src/crypto_impl/openssl/1_0_2e/node_crypto_bio.cc',
'src/crypto_impl/openssl/1_0_2e/node_crypto_clienthello.cc',
'src/crypto_impl/openssl/1_0_2e/node_crypto.h',
'src/crypto_impl/openssl/1_0_2e/node_crypto_bio.h',
'src/crypto_impl/openssl/1_0_2e/node_crypto_clienthello.h',
'src/crypto_impl/openssl/1_0_2e/tls_wrap.cc',
'src/crypto_impl/openssl/1_0_2e/tls_wrap.h',
'src/crypto_impl/openssl/openssl.h',
'src/crypto_impl/openssl/1_0_2e/openssl_1_0_2e.cc',
],
}],
[ 'node_crypto_version=="openssl_1_1_0f"', {
'sources+': [
'src/crypto_impl/openssl/1_1_0f/node_crypto.cc',
'src/crypto_impl/openssl/1_1_0f/node_crypto_bio.cc',
'src/crypto_impl/openssl/1_1_0f/node_crypto_clienthello.cc',
'src/crypto_impl/openssl/1_1_0f/node_crypto.h',
'src/crypto_impl/openssl/1_1_0f/node_crypto_bio.h',
'src/crypto_impl/openssl/1_1_0f/node_crypto_clienthello.h',
'src/crypto_impl/openssl/1_1_0f/tls_wrap.cc',
'src/crypto_impl/openssl/1_1_0f/tls_wrap.h',
'src/crypto_impl/openssl/openssl.h',
'src/crypto_impl/openssl/1_1_0f/openssl_1_1_0f.cc',
],
}],
['openssl_fips != ""', {
'defines': [ 'NODE_FIPS_MODE' ],
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,9 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {

THROW_AND_RETURN_IF_NOT_BUFFER(args[0], "Ticket keys");

if (Buffer::Length(args[0]) != 48) {
return env->ThrowTypeError("Ticket keys length must be 48 bytes");
long length = SSL_CTX_get_tlsext_ticket_keys(wrap->ctx_, NULL, 0);
if (Buffer::Length(args[0]) != (size_t)length) {
return env->ThrowTypeError("Ticket keys length incorrect");
}

if (SSL_CTX_set_tlsext_ticket_keys(wrap->ctx_,
Expand Down
Loading