-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: simplify Hmac::HmacUpdate #22132
Conversation
This makes HmacUpdate slightly simpler and introduces a CHECK instead of ignoring invalid input types.
cc @nodejs/crypto |
@nodejs/security-wg |
r = hmac->HmacUpdate(decoder.out(), decoder.size()); | ||
} else if (args[0]->IsArrayBufferView()) { | ||
} else { | ||
CHECK(args[0]->IsArrayBufferView()); |
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.
Does this work as expected? We weren't exactly crashing at an illegal argument before. It must be fine if it's type-checked in JS-land (in which case, do we even need it?)
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 is being type-checked in JS, but in case someone calls the binding directly or finds a way to avoid JS type-checking, this is here for safety.
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.
Sounds good!
Landed in 7e29453 |
This makes HmacUpdate slightly simpler and introduces a CHECK instead of ignoring invalid input types. PR-URL: #22132 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This makes HmacUpdate slightly simpler and introduces a CHECK instead of ignoring invalid input types. PR-URL: #22132 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This makes
HmacUpdate
slightly simpler and introduces aCHECK
instead of ignoring invalid input types. The JS layer shouldn't pass invalid inputs anyway.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes