-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
crypto: fix misleading positional argument #57843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nodejs-github-bot
merged 1 commit into
nodejs:main
from
tniessen:crypto-createcipherbase-isencrypt
Apr 13, 2025
Merged
crypto: fix misleading positional argument #57843
nodejs-github-bot
merged 1 commit into
nodejs:main
from
tniessen:crypto-createcipherbase-isencrypt
Apr 13, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The fourth positional argument of `createCipherBase` is `true` when called from within the `Cipheriv` constructor and `false`when called from within the `Decipheriv` constructor. This value is then passed to the `CipherBase::New()` method, which treats it as follows: args[0]->IsTrue() ? kCipher : kDecipher However, the current name of said positional argument is `decipher` and thus indicates the exact opposite: when the argument is set to true, the instance is *not* a `Decipheriv` object. Therefore, this commit renames the argument to `isEncrypt`, which matches the actual semantics.
Review requested:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #57843 +/- ##
=======================================
Coverage 90.22% 90.23%
=======================================
Files 630 630
Lines 185481 185481
Branches 36364 36372 +8
=======================================
+ Hits 167357 167368 +11
+ Misses 11004 10994 -10
+ Partials 7120 7119 -1
🚀 New features to boost your workflow:
|
targos
approved these changes
Apr 12, 2025
lpinca
approved these changes
Apr 12, 2025
geeksilva97
approved these changes
Apr 12, 2025
jasnell
approved these changes
Apr 12, 2025
Landed in 29af9ce |
RafaelGSS
pushed a commit
that referenced
this pull request
May 1, 2025
The fourth positional argument of `createCipherBase` is `true` when called from within the `Cipheriv` constructor and `false`when called from within the `Decipheriv` constructor. This value is then passed to the `CipherBase::New()` method, which treats it as follows: args[0]->IsTrue() ? kCipher : kDecipher However, the current name of said positional argument is `decipher` and thus indicates the exact opposite: when the argument is set to true, the instance is *not* a `Decipheriv` object. Therefore, this commit renames the argument to `isEncrypt`, which matches the actual semantics. PR-URL: #57843 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
RafaelGSS
pushed a commit
that referenced
this pull request
May 2, 2025
The fourth positional argument of `createCipherBase` is `true` when called from within the `Cipheriv` constructor and `false`when called from within the `Decipheriv` constructor. This value is then passed to the `CipherBase::New()` method, which treats it as follows: args[0]->IsTrue() ? kCipher : kDecipher However, the current name of said positional argument is `decipher` and thus indicates the exact opposite: when the argument is set to true, the instance is *not* a `Decipheriv` object. Therefore, this commit renames the argument to `isEncrypt`, which matches the actual semantics. PR-URL: #57843 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This needs a manual backport for v22.x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
backport-requested-v22.x
PRs awaiting manual backport to the v22.x-staging branch.
crypto
Issues and PRs related to the crypto subsystem.
needs-ci
PRs that need a full CI run.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fourth positional argument of
createCipherBase
istrue
when called from within theCipheriv
constructor andfalse
when called from within theDecipheriv
constructor. This value is then passed to theCipherBase::New()
method, which treats it as follows:However, the current name of said positional argument is
decipher
and thus indicates the exact opposite: when the argument is set to true, the instance is not aDecipheriv
object. Therefore, this commit renames the argument toisEncrypt
, which matches the actual semantics.