浏览代码

remove our hmac_sha256 tests

as we're just calling python stdlib there,
we can assume that they have tests for it.
Thomas Waldmann 3 年之前
父节点
当前提交
2566671d85
共有 1 个文件被更改,包括 1 次插入27 次删除
  1. 1 27
      src/borg/testsuite/crypto.py

+ 1 - 27
src/borg/testsuite/crypto.py

@@ -1,7 +1,7 @@
 from binascii import hexlify, unhexlify
 
 from ..crypto.low_level import AES256_CTR_HMAC_SHA256, AES256_OCB, CHACHA20_POLY1305, UNENCRYPTED, \
-                               IntegrityError, blake2b_128, blake2b_256, hmac_sha256, is_libressl
+                               IntegrityError, blake2b_128, blake2b_256, is_libressl
 from ..crypto.low_level import bytes_to_long, bytes_to_int, long_to_bytes
 from ..crypto.low_level import hkdf_hmac_sha512
 
@@ -177,32 +177,6 @@ class CryptoTestCase(BaseTestCase):
             self.assert_raises(IntegrityError,
                                lambda: cs.decrypt(hdr_mac_iv_cdata_corrupted))
 
-    def test_hmac_sha256(self):
-        # RFC 4231 test vectors
-        key = b'\x0b' * 20
-        # Also test that this works with memory views
-        data = memoryview(unhexlify('4869205468657265'))
-        hmac = unhexlify('b0344c61d8db38535ca8afceaf0bf12b'
-                         '881dc200c9833da726e9376c2e32cff7')
-        assert hmac_sha256(key, data) == hmac
-        key = unhexlify('4a656665')
-        data = unhexlify('7768617420646f2079612077616e7420'
-                         '666f72206e6f7468696e673f')
-        hmac = unhexlify('5bdcc146bf60754e6a042426089575c7'
-                         '5a003f089d2739839dec58b964ec3843')
-        assert hmac_sha256(key, data) == hmac
-        key = b'\xaa' * 20
-        data = b'\xdd' * 50
-        hmac = unhexlify('773ea91e36800e46854db8ebd09181a7'
-                         '2959098b3ef8c122d9635514ced565fe')
-        assert hmac_sha256(key, data) == hmac
-        key = unhexlify('0102030405060708090a0b0c0d0e0f10'
-                        '111213141516171819')
-        data = b'\xcd' * 50
-        hmac = unhexlify('82558a389a443c0ea4cc819899f2083a'
-                         '85f0faa3e578f8077a2e3ff46729665b')
-        assert hmac_sha256(key, data) == hmac
-
     def test_blake2b_256(self):
         # In BLAKE2 the output length actually is part of the hashes personality - it is *not* simple truncation like in
         # the SHA-2 family. Therefore we need to generate test vectors ourselves (as is true for most applications that