Skip to content
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

doc: add note about timingSafeEqual for TypedArray #36323

Closed

Conversation

Copy link
Member

@tniessen tniessen commented Nov 30, 2020

Since #29657, timingSafeEqual uses byteLength instead of length. When comparing different types (e.g., Uint8Array and Uint16Array), the result can depend on the byte order of the system architecture.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added crypto doc labels Nov 30, 2020
must have the same byte length.

If at least one of `a` and `b` is a `TypedArray`, the result may depend on
the platform byte order.
Copy link
Member

@addaleax addaleax Dec 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may depend sounds like this isn’t deterministic, but I assume it is? It’s always going to depend on the platform byte order, right?

Copy link
Member Author

@tniessen tniessen Dec 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! My thinking was that the result of some inputs (e.g., timingSafeEqual(new Uint8Array([1, 1]), new Uint16Array([0x0101]))) does not depend on the platform byte order, but that's probably not what others would take away from the way I worded it.

Copy link
Member

@addaleax addaleax Dec 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I see … maybe I would say something like If at least one of `a` and `b` is a `TypedArray` with more than one byte per entry, like `Uint16Array`, the result will be computed using platform byte order?

Copy link
Member Author

@tniessen tniessen Dec 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the delay, fixed!

Trott
Trott approved these changes Dec 3, 2020
Copy link
Member

@Trott Trott left a comment

LGTM with the elimination of may from the text.

Copy link
Member

@mhdawson mhdawson left a comment

LGTM with @addaleax's suggestion

Thanks Anna!
@tniessen tniessen added the request-ci label Dec 17, 2020
@github-actions github-actions bot removed the request-ci label Dec 17, 2020
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Dec 17, 2020

tniessen added a commit that referenced this issue Dec 17, 2020
PR-URL: #36323
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@tniessen
Copy link
Member Author

@tniessen tniessen commented Dec 17, 2020

Landed in 6255973, thank you for reviewing!

@tniessen tniessen closed this Dec 17, 2020
targos pushed a commit that referenced this issue Dec 21, 2020
PR-URL: #36323
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@tniessen tniessen deleted the doc-note-about-timingsafeequal branch Jan 15, 2021
targos pushed a commit that referenced this issue May 1, 2021
PR-URL: #36323
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto doc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants