Explorar o código

EVP_DecryptFinal_ex: fix check for return value

seems like the current docs were updated.
was "positive return code".
now specifically mentions 0 and 1.
Thomas Waldmann %!s(int64=3) %!d(string=hai) anos
pai
achega
bb949b25ea
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/borg/crypto/low_level.pyx

+ 1 - 1
src/borg/crypto/low_level.pyx

@@ -568,7 +568,7 @@ cdef class _AEAD_BASE:
                 raise CryptoError('EVP_DecryptUpdate failed')
             offset += olen
             rc = EVP_DecryptFinal_ex(self.ctx, odata+offset, &olen)
-            if rc <= 0:
+            if not rc:
                 # a failure here means corrupted or tampered tag (mac) or data.
                 raise IntegrityError('Authentication / EVP_DecryptFinal_ex failed')
             offset += olen