GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.9] bpo-40791: Make compare_digest more constant-time. (GH-20444) by miss-islington · Pull Request #23436 · python/cpython

Conversation

@miss-islington

@miss-islington miss-islington commented Nov 21, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • bpo-40791: Make compare_digest more constant-time.

The existing volatile left/right pointers guarantee that the reads will all occur, but does not guarantee that they will be used. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between result and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change GH-1 from https://bugs.python.org/issue40791 .)
(cherry picked from commit 3172936)

Co-authored-by: Devin Jeanpierre [email protected]

https://bugs.python.org/issue40791

Automerge-Triggered-By: GH:gpshead

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ssbr @miss-islington
bpo-40791: Make compare_digest more constant-time. (pythonGH-20444)
0e4ccb3
* bpo-40791: Make compare_digest more constant-time.

The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change GH-1 from https://bugs.python.org/issue40791 .)
(cherry picked from commit 3172936)

Co-authored-by: Devin Jeanpierre <[email protected]>
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 21, 2020
@bedevere-bot bedevere-bot added type-bug An unexpected behavior, bug, or error type-security A security issue labels Nov 21, 2020
@bedevere-bot bedevere-bot mentioned this pull request Nov 21, 2020
bpo-40791: Make compare_digest more constant-time. #20444
Merged
@bedevere-bot bedevere-bot added the awaiting review label Nov 21, 2020
gpshead
gpshead approved these changes Nov 21, 2020
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Nov 21, 2020
@gpshead gpshead added the 🤖 automerge label Nov 21, 2020
@miss-islington

miss-islington commented Nov 21, 2020

Copy link
Copy Markdown
Contributor Author

@ssbr and @gpshead: Status check is done, and it's a success ✅ .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington
miss-islington merged commit c1bbca5 into python:3.9 Nov 21, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Nov 21, 2020
@miss-islington
miss-islington deleted the backport-3172936-3.9 branch November 21, 2020 09:18
@miss-islington

miss-islington commented Nov 21, 2020

Copy link
Copy Markdown
Contributor Author

@ssbr and @gpshead: Status check is done, and it's a success ✅ .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ssbr ssbr mannequin mentioned this pull request Aug 24, 2023
hmac.compare_digest could try harder to be constant-time. #84968
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead gpshead approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-bug An unexpected behavior, bug, or error type-security A security issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@miss-islington @gpshead @the-knights-who-say-ni @bedevere-bot @ssbr
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.