-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
crypto: validate RSA-PSS saltLength in subtle.sign and subtle.verify #52262
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -517,6 +517,15 @@ function getBlockSize(name) { | |
} | ||
} | ||
|
||
function getDigestSizeInBytes(name) { | ||
switch (name) { | ||
case 'SHA-1': return 20; | ||
case 'SHA-256': return 32; | ||
case 'SHA-384': return 48; | ||
case 'SHA-512': return 64; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a default with unreachable (like throw error) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's done the same way as the method above. I don't feel it's necessary. Used hashes are verified far before this is ever invoked. |
||
} | ||
} | ||
|
||
const kKeyOps = { | ||
sign: 1, | ||
verify: 2, | ||
|
@@ -596,6 +605,7 @@ module.exports = { | |
bigIntArrayToUnsignedBigInt, | ||
bigIntArrayToUnsignedInt, | ||
getBlockSize, | ||
getDigestSizeInBytes, | ||
getStringOption, | ||
getUsagesUnion, | ||
secureHeapUsed, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is not sync anymore. Does this make this semver-major change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not. The entire API surface of webcrypto is async functions.