summaryrefslogtreecommitdiff
path: root/passlib/handlers/scram.py
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/handlers/scram.py')
-rw-r--r--passlib/handlers/scram.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/passlib/handlers/scram.py b/passlib/handlers/scram.py
index e7919a2..036d7c2 100644
--- a/passlib/handlers/scram.py
+++ b/passlib/handlers/scram.py
@@ -285,7 +285,7 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
raise ValueError("SCRAM limits algorithm names to "
"9 characters: %r" % (alg,))
if not isinstance(digest, bytes):
- raise TypeError("digests must be raw bytes")
+ raise uh.exc.ExpectedTypeError(digest, "raw bytes", "digests")
# TODO: verify digest size (if digest is known)
if 'sha-1' not in checksum:
# NOTE: required because of SCRAM spec.
@@ -374,9 +374,8 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
else:
failed = True
if correct and failed:
- warning("scram hash verified inconsistently, may be corrupted",
- PasslibHashWarning)
- return False
+ raise ValueError("scram hash verified inconsistently, "
+ "may be corrupted")
else:
return correct
else:
@@ -385,7 +384,8 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
if alg in chkmap:
other = self._calc_checksum(secret, alg)
return consteq(other, chkmap[alg])
- # there should *always* be at least sha-1.
+ # there should always be sha-1 at the very least,
+ # or something went wrong inside _norm_algs()
raise AssertionError("sha-1 digest not found!")
#=========================================================