summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/crypto/sig.js4
-rw-r--r--test/parallel/test-crypto-sign-verify.js10
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/internal/crypto/sig.js b/lib/internal/crypto/sig.js
index 4a0c66f9cf..ed3693d6fe 100644
--- a/lib/internal/crypto/sig.js
+++ b/lib/internal/crypto/sig.js
@@ -60,8 +60,8 @@ function getSaltLength(options) {
}
function getIntOption(name, defaultValue, options) {
- if (options.hasOwnProperty(name)) {
- const value = options[name];
+ const value = options[name];
+ if (value !== undefined) {
if (value === value >> 0) {
return value;
} else {
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index ca7f2986e1..e0b0d3fd7b 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -32,23 +32,23 @@ const modSize = 1024;
common.expectsError(
() => crypto.createVerify('SHA256').verify({
key: certPem,
- padding: undefined,
+ padding: null,
}, ''),
{
code: 'ERR_INVALID_OPT_VALUE',
type: TypeError,
- message: 'The value "undefined" is invalid for option "padding"'
+ message: 'The value "null" is invalid for option "padding"'
});
common.expectsError(
() => crypto.createVerify('SHA256').verify({
key: certPem,
- saltLength: undefined,
+ saltLength: null,
}, ''),
{
code: 'ERR_INVALID_OPT_VALUE',
type: TypeError,
- message: 'The value "undefined" is invalid for option "saltLength"'
+ message: 'The value "null" is invalid for option "saltLength"'
});
// Test signing and verifying
@@ -233,7 +233,7 @@ common.expectsError(
// Test exceptions for invalid `padding` and `saltLength` values
{
- [null, undefined, NaN, 'boom', {}, [], true, false]
+ [null, NaN, 'boom', {}, [], true, false]
.forEach((invalidValue) => {
common.expectsError(() => {
crypto.createSign('SHA256')