mirror of
https://github.com/9001/copyparty.git
synced 2026-11-10 12:18:22 +00:00
dk/fk constant-time (#1658)
This commit is contained in:
1 parent
74b17374c2
commit
a31870cbd3
1 file changed
+3
-2
@@ -17,6 +17,7 @@ import threading # typechk
|
||||
import time
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from hmac import compare_digest as ct_eq
|
||||
from operator import itemgetter
|
||||
|
||||
import jinja2 # typechk
|
||||
@@ -4586,7 +4587,7 @@ class HttpCli(object):
|
||||
ap = vn.canonical(self.rem)
|
||||
|
||||
zs = self.gen_fk(2, self.args.dk_salt, ap, 0, 0)[:dk_len]
|
||||
if req == zs:
|
||||
if ct_eq(req, zs):
|
||||
return True
|
||||
|
||||
t = "wrong dirkey, want %s, got %s\n vp: %r\n ap: %r"
|
||||
@@ -4614,7 +4615,7 @@ class HttpCli(object):
|
||||
alg, self.args.fk_salt, ap, st.st_size, 0 if ANYWIN else st.st_ino
|
||||
)[:fk_len]
|
||||
|
||||
if req == zs:
|
||||
if ct_eq(req, zs):
|
||||
return True
|
||||
|
||||
t = "wrong filekey, want %s, got %s\n vp: %r\n ap: %r"
|
||||
|
||||
Reference in new issue
Block a user