repair bad return value in authentication checks

This commit is contained in:
Thomas S Hatch 2011-10-27 16:36:17 -06:00
parent 8ce25aa6da
commit 2385e77adc

View File

@ -273,7 +273,7 @@ class Crypticle(object):
data = data[:-self.SIG_SIZE]
if hmac.new(hmac_key, data, hashlib.sha256).digest() != sig:
log.warning('Failed to authenticate message')
return {}
return ''
#raise AuthenticationError('message authentication failed')
iv_bytes = data[:self.AES_BLOCK_SIZE]
data = data[self.AES_BLOCK_SIZE:]
@ -293,7 +293,7 @@ class Crypticle(object):
'''
data = self.decrypt(data)
# simple integrity check to verify that we got meaningful data
if data.startswith(self.PICKLE_PAD):
if not data.startswith(self.PICKLE_PAD):
return {}
return pickler.loads(data[len(self.PICKLE_PAD):])