Staging
v0.8.1
https://github.com/python/cpython
Revision c1bbca5b004b3f74d240ef8a76ff445cc1a27efb authored by Miss Islington (bot) on 21 November 2020, 09:18:41 UTC, committed by GitHub on 21 November 2020, 09:18:41 UTC

* 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 31729366e2bc09632e78f3896dbce0ae64914f28)

Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
1 parent ed02018
History
Tip revision: c1bbca5b004b3f74d240ef8a76ff445cc1a27efb authored by Miss Islington (bot) on 21 November 2020, 09:18:41 UTC
bpo-40791: Make compare_digest more constant-time. (GH-20444)
Tip revision: c1bbca5
File Mode Size
clinic
stringlib
README -rw-r--r-- 41 bytes
abstract.c -rw-r--r-- 70.7 KB
accu.c -rw-r--r-- 2.4 KB
boolobject.c -rw-r--r-- 6.6 KB
bytearrayobject.c -rw-r--r-- 72.1 KB
bytes_methods.c -rw-r--r-- 21.2 KB
bytesobject.c -rw-r--r-- 99.6 KB
call.c -rw-r--r-- 29.0 KB
capsule.c -rw-r--r-- 7.3 KB
cellobject.c -rw-r--r-- 5.6 KB
classobject.c -rw-r--r-- 18.0 KB
codeobject.c -rw-r--r-- 35.0 KB
complexobject.c -rw-r--r-- 31.6 KB
descrobject.c -rw-r--r-- 60.9 KB
dict-common.h -rw-r--r-- 2.2 KB
dictnotes.txt -rw-r--r-- 6.0 KB
dictobject.c -rw-r--r-- 142.1 KB
enumobject.c -rw-r--r-- 13.6 KB
exceptions.c -rw-r--r-- 87.7 KB
fileobject.c -rw-r--r-- 16.9 KB
floatobject.c -rw-r--r-- 69.5 KB
frameobject.c -rw-r--r-- 35.9 KB
funcobject.c -rw-r--r-- 31.1 KB
genericaliasobject.c -rw-r--r-- 16.9 KB
genobject.c -rw-r--r-- 66.7 KB
interpreteridobject.c -rw-r--r-- 8.6 KB
iterobject.c -rw-r--r-- 9.1 KB
listobject.c -rw-r--r-- 98.2 KB
listsort.txt -rw-r--r-- 35.3 KB
lnotab_notes.txt -rw-r--r-- 5.9 KB
longobject.c -rw-r--r-- 174.3 KB
memoryobject.c -rw-r--r-- 91.7 KB
methodobject.c -rw-r--r-- 17.0 KB
moduleobject.c -rw-r--r-- 24.8 KB
namespaceobject.c -rw-r--r-- 7.4 KB
object.c -rw-r--r-- 60.9 KB
obmalloc.c -rw-r--r-- 88.0 KB
odictobject.c -rw-r--r-- 73.6 KB
picklebufobject.c -rw-r--r-- 6.0 KB
rangeobject.c -rw-r--r-- 35.6 KB
setobject.c -rw-r--r-- 72.1 KB
sliceobject.c -rw-r--r-- 19.1 KB
structseq.c -rw-r--r-- 14.9 KB
tupleobject.c -rw-r--r-- 31.6 KB
typeobject.c -rw-r--r-- 252.4 KB
typeslots.inc -rw-r--r-- 4.0 KB
typeslots.py -rwxr-xr-x 1.2 KB
unicodectype.c -rw-r--r-- 7.5 KB
unicodeobject.c -rw-r--r-- 470.0 KB
unicodetype_db.h -rw-r--r-- 249.6 KB
weakrefobject.c -rw-r--r-- 31.5 KB

README

back to top