cjihrig
09519953ea
src: fix compiler warnings in node_crypto.cc
...
During the time between https://github.com/nodejs/node/pull/24234
being opened and it landing, a V8 update occurred that deprecated
several APIs. This commit fixes the following compiler warnings:
../src/node_crypto.cc:3342:11:
warning: 'Set' is deprecated: Use maybe version
../src/node_crypto.cc:3345:13:
warning: 'GetFunction' is deprecated: Use maybe version
PR-URL: https://github.com/nodejs/node/pull/25205
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-12-26 11:07:57 -05:00
Tobias Nießen
8f300bc8a7
crypto: always accept certificates as public keys
...
PR-URL: https://github.com/nodejs/node/pull/24234
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-24 14:50:25 +01:00
Tobias Nießen
823d86c47c
crypto: add key object API
...
This commit makes multiple important changes:
1. A new key object API is introduced. The KeyObject class itself is
not exposed to users, instead, several new APIs can be used to
construct key objects: createSecretKey, createPrivateKey and
createPublicKey. The new API also allows to convert between
different key formats, and even though the API itself is not
compatible to the WebCrypto standard in any way, it makes
interoperability much simpler.
2. Key objects can be used instead of the raw key material in all
relevant crypto APIs.
3. The handling of asymmetric keys has been unified and greatly
improved. Node.js now fully supports both PEM-encoded and
DER-encoded public and private keys.
4. Conversions between buffers and strings have been moved to native
code for sensitive data such as symmetric keys due to security
considerations such as zeroing temporary buffers.
5. For compatibility with older versions of the crypto API, this
change allows to specify Buffers and strings as the "passphrase"
option when reading or writing an encoded key. Note that this
can result in unexpected behavior if the password contains a
null byte.
PR-URL: https://github.com/nodejs/node/pull/24234
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-24 14:50:16 +01:00
Joyee Cheung
e9703619e0
src: move GetOpenSSLVersion into node_metadata.cc
...
Instead of implementing it in node_crypto.cc even though the only
place that needs it is the `Metadata::Versions` constructor.
PR-URL: https://github.com/nodejs/node/pull/25115
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-21 07:46:28 +08:00
Sam Roberts
19b59bfe17
tls: re-define max supported version as 1.2
...
Several secureProtocol strings allow any supported TLS version as the
maximum, but our maximum supported protocol version is TLSv1.2 even if
someone configures a build against an OpenSSL that supports TLSv1.3.
Fixes: https://github.com/nodejs/node/issues/24658
PR-URL: https://github.com/nodejs/node/pull/25024
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-12-17 09:00:27 -08:00
Sam Roberts
2e4a163012
tls: support "BEGIN TRUSTED CERTIFICATE" for ca:
...
Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.
Fixes: https://github.com/nodejs/node/issues/24761
PR-URL: https://github.com/nodejs/node/pull/24733
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-12-11 15:28:58 -08:00
cjihrig
24e6b709ea
src: use isolate version of BooleanValue()
...
This fixes deprecation warnings.
PR-URL: https://github.com/nodejs/node/pull/24883
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-12-08 22:42:05 -08:00
Daniel Bevenius
cbf0e5a1f4
src: remove finalized_ member from Hash class
...
This commit removes the finalized_ member from the Hash class as it does
not seem to be used in any valuable way. Commit c75f87cc4c ("crypto:
refactor the crypto module") removed the check where it was previously
used.
PR-URL: https://github.com/nodejs/node/pull/24822
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-12-07 05:40:44 +01:00
Sam Roberts
b05b330025
tls: add code for ERR_TLS_INVALID_PROTOCOL_METHOD
...
Add an error code property to invalid `secureProtocol` method
exceptions.
PR-URL: https://github.com/nodejs/node/pull/24729
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-03 07:38:59 +01:00
Ben Noordhuis
3513b0c3d9
crypto: harden bignum-to-binary conversions
...
PR-URL: https://github.com/nodejs/node/pull/24719
Refs: https://github.com/nodejs/node/issues/24645
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-03 07:29:56 +01:00
Sam Roberts
f512f5ea13
tls: add min/max protocol version options
...
The existing secureProtocol option only allows setting the allowed
protocol to a specific version, or setting it to "all supported
versions". It also used obscure strings based on OpenSSL C API
functions. Directly setting the min or max is easier to use and explain.
PR-URL: https://github.com/nodejs/node/pull/24405
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
2018-11-22 09:14:58 -08:00
Sam Roberts
0512d68e42
tls: include RSA bit size in X.509 public key info
...
For symmetricality with the EC public key info, and because its useful.
PR-URL: https://github.com/nodejs/node/pull/24358
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-11-20 13:21:08 -08:00
Sam Roberts
fe303b9b2d
tls: include elliptic curve X.509 public key info
...
X.509 certs are provided to the user in a parsed object form by a number
of TLS APIs. Include public key info for elliptic curves as well, not
just RSA.
- pubkey: the public key
- bits: the strength of the curve
- asn1Curve: the ASN.1 OID for the curve
- nistCurve: the NIST nickname for the curve, if it has one
PR-URL: https://github.com/nodejs/node/pull/24358
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-11-20 13:21:08 -08:00
Sam Roberts
54b4beb506
tls: support TLS_client_method, TLS_server_method
...
Add the two TLS protocol method functions which were missing. They seem
useful, and are already documented as being supported (indirectly, our
docs just point to OpenSSL's docs).
PR-URL: https://github.com/nodejs/node/pull/24386
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-11-19 11:21:11 -08:00
Gagandeep Singh
efa5bf9cf6
crypto: remove unnecessary fully qualified names
...
PR-URL: https://github.com/nodejs/node/pull/24452
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-17 18:24:49 -05:00
Sam Roberts
db35fee1e1
tls: get the local certificate after tls handshake
...
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.
Fix: https://github.com/nodejs/node/issues/24095
PR-URL: https://github.com/nodejs/node/pull/24261
Fixes: https://github.com/nodejs/node/issues/24095
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-11-13 20:42:57 -08:00
Ben Noordhuis
60eca6a5d4
tls: disable TLS v1.0 and v1.1 by default
...
Refs: https://blog.mozilla.org/security/2018/10/15/removing-old-versions-of-tls/
PR-URL: https://github.com/nodejs/node/pull/23814
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-11-13 16:05:51 +01:00
Gabriel Schulhof
0603c0a53f
src: bundle persistent-to-local methods as class
...
Create a class `PersistentToLocal` which contains three methods,
`Strong`, `Weak`, and `Default`:
* `Strong` returns a `Local` from a strong persistent reference,
* `Weak` returns a `Local` from a weak persistent reference, and
* `Default` decides based on `IsWeak()` which of the above two to call.
These replace `node::StrongPersistentToLocal()`,
`node::WeakPersistentToLocal()`, and `node::PersistentToLocal()`,
respectively.
PR-URL: https://github.com/nodejs/node/pull/24276
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-13 05:27:40 +01:00
Daniel Bevenius
344d33eef1
src: fix v8 compiler warnings in src
...
This commit changes the code to use the maybe version.
PR-URL: https://github.com/nodejs/node/pull/24246
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-11 08:02:30 +01:00
chux0519
5c59622243
crypto: add support for chacha20-poly1305 for AEAD
...
openSSL supports AEAD_CHACHA20_POLY1305(rfc7539) since 1.1.
PR-URL: https://github.com/nodejs/node/pull/24081
Fixes: https://github.com/nodejs/node/issues/24080
Refs: https://tools.ietf.org/html/rfc7539
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-11-07 18:43:41 -05:00
Daniel Bevenius
30219bfc57
crypto: add SET_INTEGER_CONSANT macro
...
This commit introduces a SET_INTEGER_CONSANT macro to reduce some code
duplication in SecureContext::Initialize.
PR-URL: https://github.com/nodejs/node/pull/23687
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-10-24 05:41:38 +02:00
Sam Roberts
bff53c5a9d
crypto: strip unwanted space from openssl version
...
Remove trailing " \n" from `process.versions.openssl`.
d3d6cd3eca was incorrectly printing this trailer, but because the
target buffer size was claimed to be the length of the version string,
the trailer was truncated off.
9ed4646df0 corrected the target buffer size, but then the trailer
started to appear in process.versions.
Added a test to check for regressions.
PR-URL: https://github.com/nodejs/node/pull/23678
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-10-22 20:39:45 -07:00
Anna Henningsen
20282b1cb0
src: use more explicit return type in Sign::SignFinal()
...
Using the non-indexed variant of `std::get<>` broke Travis CI.
Also, this allows us to be a bit more concise when returning
from `SignFinal()` due to some error condition.
Refs: https://github.com/nodejs/node/pull/23427
PR-URL: https://github.com/nodejs/node/pull/23779
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-10-21 03:09:10 +02:00
Ouyang Yadong
87719d792b
tls: load NODE_EXTRA_CA_CERTS at startup
...
This commit makes node load extra certificates at startup instead
of first use.
PR-URL: https://github.com/nodejs/node/pull/23354
Fixes: https://github.com/nodejs/node/issues/20434
Refs: https://github.com/nodejs/node/issues/20432
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-10-20 09:21:16 -04:00
Tobias Nießen
c0d86b9e61
crypto: remove DiffieHellman.initialised_
...
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.
PR-URL: https://github.com/nodejs/node/pull/23717
Refs: https://github.com/nodejs/node/pull/23648
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-20 00:40:31 +02:00
Tobias Nießen
7bd2912669
crypto: reduce memory usage of SignFinal
...
The fixed-size buffer on the stack is unnecessary and way too large
for most applications. This change removes it and allocates the
required memory directly instead of copying into heap later.
PR-URL: https://github.com/nodejs/node/pull/23427
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-10-20 00:38:21 +02:00
Ben Noordhuis
92d67fefe2
crypto: DRY Diffie-Hellman initialization code
...
PR-URL: https://github.com/nodejs/node/pull/23657
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-10-18 05:51:28 +02:00
Tobias Nießen
e2f58c71dd
crypto: simplify internal state handling
...
Uninitialized instances are not exposed to users, so this condition should
always be true.
PR-URL: https://github.com/nodejs/node/pull/23648
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-10-17 18:48:30 +02:00
Tobias Nießen
4e2862ad9e
crypto: simplify error handling in ECDH::New
...
The type of the argument is being checked within JS which makes the
type checking in C++ unnecessary.
PR-URL: https://github.com/nodejs/node/pull/23647
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-10-17 18:45:26 +02:00
Shelley Vohr
ca2eec4639
src: remove OCB support ifdef OPENSSL_NO_OCB
...
Electron uses BoringSSL which does not support OCB . It is also
possible to build OpenSSL without support for OCB for Node.js.
This commit disables OCB if OPENSSL_NO_OCB is defined.
PR-URL: https://github.com/nodejs/node/pull/23635
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-10-16 23:26:47 +02:00
Bruce A. MacNaughton
20b3698ac1
src: throw if functions used as constructors in node_crypto.cc
...
Throw an error if verify_error_getter_templ or
verify_error_getter_templ2 are used as constructors.
PR-URL: https://github.com/nodejs/node/pull/23582
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-10-14 22:21:39 +02:00
Ben Noordhuis
9ed4646df0
crypto: fix length argument to snprintf()
...
Introduced in commit d3d6cd3eca ("src: improve SSL version extraction
logic".)
PR-URL: https://github.com/nodejs/node/pull/23622
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-10-12 20:04:54 -07:00
Gireesh Punathil
d3d6cd3eca
src: improve SSL version extraction logic
...
The openssl version as defined in ssl libraries is complex.
The current logic to extract the major.minor.patch format
uses C semantics to loop through the text and search for
specific patterns. Use C++ string to tidy it up.
PR-URL: https://github.com/nodejs/node/pull/23050
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-10-11 21:25:52 -07:00
Vitaly Dyatlov
3f08c004c5
src: revert removal of SecureContext _external getter
...
This `_external` getter is essential for some libs to work:
uWebSockets as an example.
PR-URL: https://github.com/nodejs/node/pull/21711
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-11 21:04:55 -07:00
Brandon Smith
13340d47fc
benchmark,doc,lib,src,test,tools: fix typos
...
PR-URL: https://github.com/nodejs/node/pull/23302
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-10-09 16:53:12 +03:00
cjihrig
78b4369f09
src: remove unneeded variables in node_crypto.cc
...
PR-URL: https://github.com/nodejs/node/pull/23297
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-09 08:33:15 -04:00
cjihrig
43a1bc30c1
src: fix ToObject() usage in node_crypto.cc
...
PR-URL: https://github.com/nodejs/node/pull/23298
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-08 17:42:21 -04:00
Daniel Bevenius
8d218a9bb9
crypto: replace goto SSL_CTX_use_certificate_chain
...
This commit removes the goto statements in SSL_CTX_use_certificate_chain
by using a unique_ptr.
PR-URL: https://github.com/nodejs/node/pull/23113
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-08 05:48:20 +02:00
Daniel Bevenius
a8c145807e
crypto: add virtual dtor to KeyPairGenerationConfig
...
Currently the KeyPairGenerationConfigs class has a virtual function
but no virtual destructor which means that if delete is called on a
KeyPairGenerationConfig pointer to a derived instance, the derived
destructor will not get called.
The following warning is currently being printed when
compiling:
warning: delete called on 'node::crypto::KeyPairGenerationConfig' that
is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
delete __ptr;
This commit adds a virtual destructor.
PR-URL: https://github.com/nodejs/node/pull/23215
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-05 05:11:18 +02:00
Anna Henningsen
cc31d8b2d4
src: remove public API for option variables
...
PR-URL: https://github.com/nodejs/node/pull/23069
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-10-03 14:08:06 -07:00
Tobias Nießen
ad07e44b37
crypto: make PEM parsing RFC7468-compliant
...
PR-URL: https://github.com/nodejs/node/pull/23164
Fixes: https://github.com/nodejs/node/issues/13612
Fixes: https://github.com/nodejs/node/issues/22815
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-02 12:16:46 +02:00
Tobias Nießen
0a1c65079a
crypto: add support for PEM-level encryption
...
This adds support for PEM-level encryption as defined in RFC 1421.
PEM-level encryption is intentionally unsupported for PKCS#8 private
keys since PKCS#8 defines a newer encryption format.
PR-URL: https://github.com/nodejs/node/pull/23151
Refs: https://github.com/nodejs/node/pull/22660
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-02 11:32:16 +02:00
Daniel Bevenius
8316c6f047
crypto: remove unnecessary calls to TLS_method()
...
PR-URL: https://github.com/nodejs/node/pull/23077
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-09-28 09:32:24 +02:00
Jeremy Apthorp
7dae8729aa
crypto: enable auto cert chaining for BoringSSL
...
OpenSSL enables this feature by default, but BoringSSL doesn't. This
change makes it so that when building node with BoringSSL, the
behaviour matches OpenSSL's.
PR-URL: https://github.com/nodejs/node/pull/22110
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-09-27 19:35:50 +02:00
Tobias Nießen
b7bdde013a
crypto: deduplicate cipher initialization code
...
CipherBase::Init and CipherBase::InitIv contain a lot of duplicate
code, this commit moves that into a separate function.
PR-URL: https://github.com/nodejs/node/pull/23011
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-09-26 05:27:02 +02:00
Tobias Nießen
3eb2adbb8e
crypto: remove unnecessary usage of goto
...
The control flow can easily be refactored to use break instead of
goto.
PR-URL: https://github.com/nodejs/node/pull/23018
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-09-25 05:33:58 +02:00
Andreas Haas
7dde560beb
src: replace deprecated uses of FunctionTemplate::GetFunction
...
PR-URL: https://github.com/nodejs/node/pull/22993
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-09-24 05:44:28 +02:00
Tobias Nießen
058c5b81cd
crypto: do not allow multiple calls to setAuthTag
...
Calling setAuthTag multiple times can result in hard to detect bugs
since to the user, it is unclear which invocation actually affected
OpenSSL.
PR-URL: https://github.com/nodejs/node/pull/22931
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-09-21 11:40:35 +02:00
Tobias Nießen
8c502f54ce
crypto: add API for key pair generation
...
This adds support for RSA, DSA and EC key pair generation with a
variety of possible output formats etc.
PR-URL: https://github.com/nodejs/node/pull/22660
Fixes: https://github.com/nodejs/node/issues/15116
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-09-20 14:31:14 +02:00
Tobias Nießen
a9e7369b11
crypto: fix edge case in authenticated encryption
...
Restricting the authentication tag length and calling update or
setAAD before setAuthTag caused an incorrect authentication tag to
be passed to OpenSSL: The auth_tag_len_ field was already set, so
the implementation assumed that the tag itself was known as well.
PR-URL: https://github.com/nodejs/node/pull/22828
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-09-18 12:55:07 +02:00