Joyee Cheung
57c22e4a22
crypto: use EVP_MD_fetch and cache EVP_MD for hashes
...
On OpenSSL 3, migrate from EVP_get_digestbyname() to EVP_MD_fetch()
to get the implementation and use a per-Environment cache for it.
The EVP_MDs are freed during Environment cleanup.
Drive-by: declare the smart pointer for EVP_MD_CTX as EVPMDCtxPointer
instead of EVPMDPointer to avoid confusion with EVP_MD pointers.
PR-URL: https://github.com/nodejs/node/pull/51034
Refs: https://www.openssl.org/docs/man3.0/man7/crypto.html#Explicit-fetching
Refs: https://github.com/nodejs/performance/issues/136
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-01-05 22:16:27 +00:00
Aras Abbasi
83e6350b82
errors: improve hideStackFrames
...
PR-URL: https://github.com/nodejs/node/pull/49990
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-11 16:25:08 +00:00
Tobias Nießen
78842cf213
crypto: remove getDefaultEncoding()
...
Refs: https://github.com/nodejs/node/pull/47182
Refs: https://github.com/nodejs/node/pull/47869
Refs: https://github.com/nodejs/node/pull/47943
Refs: https://github.com/nodejs/node/pull/47998
Refs: https://github.com/nodejs/node/pull/49140
Refs: https://github.com/nodejs/node/pull/49145
Refs: https://github.com/nodejs/node/pull/49167
Refs: https://github.com/nodejs/node/pull/49169
PR-URL: https://github.com/nodejs/node/pull/49170
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-08-19 12:55:30 +05:30
Tobias Nießen
5b4c7bd78f
crypto: fix setEngine() when OPENSSL_NO_ENGINE set
...
When OpenSSL is configured with OPENSSL_NO_ENGINE, setEngine() currently
throws an internal error because the C++ binding does not export the
relevant function, which causes _setEngine() to be undefined within JS.
Instead, match the behavior of tls/secure-context.js and throw the
existing error code ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED when OpenSSL
has been configured with OPENSSL_NO_ENGINE.
PR-URL: https://github.com/nodejs/node/pull/47977
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2023-05-15 15:39:11 +00:00
Tobias Nießen
9374700d7a
crypto: remove DEFAULT_ENCODING
...
Citing 76b0bdf720 from 2012, "only use
this as a temporary measure."
Getting or setting DEFAULT_ENCODING has emitted a warning ever since
Node.js 10, so it seems appropriate to remove it in Node.js 20 five
years later. The last Node.js version that did not emit a warning
reached its end-of-life status at the end of 2019.
This commit only removes the public API so that the change can land in
time for Node.js 20.
Refs: https://github.com/nodejs/node-v0.x-archive/pull/4179
Refs: https://github.com/nodejs/node/pull/18333
PR-URL: https://github.com/nodejs/node/pull/47182
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com >
Reviewed-By: Erick Wendel <erick.workspace@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2023-03-26 18:03:58 +00:00
Antoine du Hamel
ab8942848b
lib: enforce use of trailing commas
...
PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-03-06 10:44:14 +01:00
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
...
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-02-14 18:45:16 +01:00
Filip Skokan
3ef38c4bd7
crypto: use WebIDL converters in WebCryptoAPI
...
WebCryptoAPI functions' arguments are now coersed and validated as per
their WebIDL definitions like in other Web Crypto API implementations.
This further improves interoperability with other implementations of
Web Crypto API.
PR-URL: https://github.com/nodejs/node/pull/46067
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-01-17 08:57:58 +00:00
Antoine du Hamel
bb908fc886
crypto: simplify lazy loading of internal modules
...
The internal `require()` is actually just one map load (to see if the
module is already loaded) + one property load (state check for circular
dependencies) for modules that are already loaded.
Refs: https://github.com/nodejs/node/pull/45659#discussion_r1033762328
PR-URL: https://github.com/nodejs/node/pull/45809
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-12-12 15:17:44 +00:00
Filip Skokan
73a5112583
crypto: handle more webcrypto errors with OperationError
...
PR-URL: https://github.com/nodejs/node/pull/45320
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-11-07 06:35:35 +00:00
Filip Skokan
214354fc9f
crypto: fix webcrypto HMAC "get key length" in deriveKey and generateKey
...
PR-URL: https://github.com/nodejs/node/pull/44917
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-10-12 19:18:38 +00:00
Filip Skokan
0d80e7344e
crypto: add causes to applicable webcrypto's OperationError
...
PR-URL: https://github.com/nodejs/node/pull/44890
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-10-10 01:12:28 +00:00
Filip Skokan
ac1b90eed1
crypto: fix webcrypto operation errors to be OperationError
...
PR-URL: https://github.com/nodejs/node/pull/44171
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-08-12 19:29:14 +00:00
Filip Skokan
fbfb91ba33
crypto: remove Node.js-specific webcrypto extensions
...
PR-URL: https://github.com/nodejs/node/pull/43310
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-06-11 08:04:20 +01:00
Filip Skokan
7e5da97d15
crypto: add CFRG curves to Web Crypto API
...
PR-URL: https://github.com/nodejs/node/pull/42507
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-06-04 07:20:27 +01:00
Tobias Nießen
75dbb86c58
crypto: clean up parameter validation in HKDF
...
PR-URL: https://github.com/nodejs/node/pull/42924
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
2022-05-02 18:46:04 +01:00
Rich Trott
49547abe99
lib: prepare files for no-var lint rule
...
PR-URL: https://github.com/nodejs/node/pull/42573
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2022-04-04 10:53:28 +00:00
Filip Skokan
5d0eb10c80
crypto: do not add undefined hash in webcrypto normalizeAlgorithm
...
PR-URL: https://github.com/nodejs/node/pull/42559
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-04-03 11:11:21 +01:00
XadillaX
2de139b5d5
lib: make lazyDOMException more common
...
PR-URL: https://github.com/nodejs/node/pull/39105
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-28 13:44:28 +08:00
Antoine du Hamel
26e318a321
doc: use HEAD instead of master for links
...
PR-URL: https://github.com/nodejs/node/pull/38518
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-05-05 10:45:30 +02:00
Filip Skokan
c81d0fa9bc
crypto: use correct webcrypto RSASSA-PKCS1-v1_5 algorithm name
...
PR-URL: https://github.com/nodejs/node/pull/38029
Refs: https://www.w3.org/TR/WebCryptoAPI/#rsassa-pkcs1
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-04-04 00:08:37 +02:00
Antoine du Hamel
75259c7492
crypto: refactor hasAnyNotIn to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37433
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2021-02-26 16:34:04 +01:00
Rich Trott
b461a1b125
doc,lib: prepare for stricter multi-line array linting
...
We're about to turn on a requirement for dangling commas.
PR-URL: https://github.com/nodejs/node/pull/37088
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-02-19 09:55:35 -08:00
ZiJian Liu
e884fd7d34
lib: refactor to use validateNumber
...
PR-URL: https://github.com/nodejs/node/pull/36993
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-22 19:54:34 -08:00
James M Snell
bd899bc656
crypto: experimental (Ed/X)25519/(Ed/X)448 support
...
Implements initial experimental support for Curve25519 and
Curve448 support for both ECDH and sign/verify in Web Crypto.
Introduced as a Node.js-specific extension to Web Crypto.
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/36076
PR-URL: https://github.com/nodejs/node/pull/36879
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2021-01-18 08:12:08 -08:00
Filip Skokan
1772ae7029
crypto: add keyObject.asymmetricKeyDetails for asymmetric keys
...
This API exposes key details. It is conceptually different from the
previously discussed keyObject.fields property since it does not give
access to information that could compromise the security of the key, and
the obtained information cannot be used to uniquely identify a key.
The intended purpose is to determine "security properties" of keys, e.g.
to generate a new key pair with the same parameters, or to decide
whether a key is secure enough.
closes #30045
PR-URL: https://github.com/nodejs/node/pull/36188
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-14 14:24:48 +01:00
James M Snell
03c056401f
crypto: implement basic secure heap support
...
Adds two new command line arguments:
* `--secure-heap=n`, which causes node.js to initialize
an openssl secure heap of `n` bytes on openssl initialization.
* `--secure-heap-min=n`, which specifies the minimum allocation
from the secure heap.
* A new method `crypto.secureHeapUsed()` that returns details
about the total and used secure heap allocation.
The secure heap is an openssl feature that allows certain kinds
of potentially sensitive information (such as private key
BigNums) to be allocated from a dedicated memory area that is
protected against pointer over- and underruns.
The secure heap is a fixed size, so it's important that users
pick a large enough size to cover the crypto operations they
intend to utilize.
The secure heap is disabled by default.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36779
Refs: https://github.com/nodejs/node/pull/36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-11 10:39:00 -08:00
James M Snell
dae283d96f
crypto: refactoring internals, add WebCrypto
...
Fixes: https://github.com/nodejs/node/issues/678
Refs: https://github.com/nodejs/node/issues/26854
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/35093
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-07 17:27:05 -07:00
Anna Henningsen
1d7be3253f
crypto: move typechecking for timingSafeEqual into C++
...
This makes the function more robust against V8 inlining.
Fixes: https://github.com/nodejs/node/issues/34073
PR-URL: https://github.com/nodejs/node/pull/34141
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
2020-07-03 12:01:03 -07:00
Sebastien Ahkrin
eac3f0adc4
lib: replace Symbol global by the primordials Symbol
...
PR-URL: https://github.com/nodejs/node/pull/30737
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-12-08 13:38:58 +01:00
Ruben Bridgewater
eb05d68815
crypto: refactor array buffer view validation
...
This is just a refactoring to reduce code and computational overhead.
PR-URL: https://github.com/nodejs/node/pull/29683
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-10-01 22:39:37 +02:00
61743063cc
crypto: use byteLength in timingSafeEqual
...
PR-URL: https://github.com/nodejs/node/pull/29657
Co-authored-by: ZaneHannanAU <ZaneHannanAU@users.noreply.github.com >
Co-authored-by: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
2019-09-25 15:58:15 -03:00
Tobias Nießen
2f1ed5c063
crypto: remove legacy native handles
...
PR-URL: https://github.com/nodejs/node/pull/27011
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2019-04-04 16:45:41 +02:00
Ruben Bridgewater
751c92d972
crypto: remove obsolete encoding check
...
This renames the parameters for clarity and removes the check for
undefined encoding. That will always default to `utf8`.
PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-27 17:05:18 +01:00
Michaël Zasso
e83d7e8d88
crypto: put legacy _handle accessors on prototypes
...
Creating deprecated accessors each time an object is created is very
time consuming.
Refs: https://github.com/nodejs/node/pull/22747
Fixes: https://github.com/nodejs/node/issues/24266
PR-URL: https://github.com/nodejs/node/pull/24269
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-11-11 20:01:31 +01:00
Anna Henningsen
87b808f761
src,lib: move natives and constants to internalBinding()
...
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/23663
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-10-21 03:17:12 +02:00
Gus Caplan
e7f710c1d4
bootstrapper: move internalBinding to NativeModule
...
internalBinding is used so often that it should just automatically be
available for usage in internals.
PR-URL: https://github.com/nodejs/node/pull/23025
Refs: https://github.com/nodejs/node/commit/2a9eb31
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-04 11:55:34 +02:00
Tobias Nießen
360465dfe2
crypto: assign missing deprecation code
...
PR-URL: https://github.com/nodejs/node/pull/22827
Refs: https://github.com/nodejs/node/pull/22747
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-09-13 01:08:59 +02:00
Tobias Nießen
0ade10df79
crypto: hide native handles from JS modules
...
PR-URL: https://github.com/nodejs/node/pull/22747
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-09-12 22:20:27 +02:00
Daniel Bevenius
bf5cc3bf1a
crypto: move process.binding('crypto') to internal
...
This commit makes the crypto builtin an internal builtin, and
changes usage of the builtin from using process.binding('crypto')
to use internalBinding instead.
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22426
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-08-24 00:49:29 +02:00
Jon Moss
e570ae79f5
lib: extract validateString validator
...
Pulls out a common argument validator to `internal/validators`
PR-URL: https://github.com/nodejs/node/pull/22101
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-08-07 10:51:27 -04:00
Ben Noordhuis
59ace5752a
lib: rename checkIsArrayBufferView()
...
Rename it to validateArrayBufferView() to align with validateInt32()
and friends.
Swap the name and the value in the argument list for consistency,
although any reasonable person will agree it's a crime against
humanity to put the value before the name.
PR-URL: https://github.com/nodejs/node/pull/20816
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-06-13 15:59:08 +02:00
Ben Noordhuis
d669251f67
lib: replace checkUint() with validateInt32()
...
PR-URL: https://github.com/nodejs/node/pull/20816
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-06-13 15:59:06 +02:00
Ben Noordhuis
58176e352c
crypto: DRY type checking
...
Factor out some common code. The `checkUint()` function will also be
used in a follow-up commit that adds scrypt support to core.
PR-URL: https://github.com/nodejs/node/pull/20816
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-06-13 15:57:16 +02:00
Daniel Bevenius
fe70af9072
crypto: add checkIsArrayBufferView
...
This commit adds a checkIsArrayBufferView function to avoid some code
duplication in sig.js
PR-URL: https://github.com/nodejs/node/pull/20251
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-04-26 07:48:56 +02:00
Ruben Bridgewater
c6b6c92185
lib: always show ERR_INVALID_ARG_TYPE received part
...
This makes a effort to make sure all of these errors will actually
also show the received input.
On top of that it refactors a few tests for better maintainability.
It will also change the returned type to always be a simple typeof
instead of special handling null.
PR-URL: https://github.com/nodejs/node/pull/19445
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-25 01:45:37 +01:00
Michaël Zasso
1d2fd8b65b
lib: port remaining errors to new system
...
PR-URL: https://github.com/nodejs/node/pull/19137
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-07 14:54:38 +01:00
James M Snell
eeada6ca63
crypto: migrate timingSafeEqual to internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/16448
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-10-26 07:47:16 -07:00
James M Snell
a78327f48b
crypto: migrate setEngine to internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/16429
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-10-25 11:33:19 -07:00
James M Snell
c75f87cc4c
crypto: refactor the crypto module
...
* Split single monolithic file into multiple
* Make Certificate methods static
* Allow randomFill(Sync) to use any ArrayBufferView
* Use internal/errors throughout
* Improve arg validation in Hash/Hmac
* Doc updates
PR-URL: https://github.com/nodejs/node/pull/15231
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-09-18 08:10:59 -07:00