mirror of
https://github.com/borgbackup/borg.git
synced 2024-08-15 07:10:33 +03:00
Merge pull request #6454 from bket/fix-benchmark-cpu
`borg benchmark cpu` fails with libressl
This commit is contained in:
commit
c641e31e82
@ -591,19 +591,24 @@ def chunkit(chunker_name, *args, **kwargs):
|
||||
|
||||
from borg.crypto.low_level import AES256_CTR_BLAKE2b, AES256_CTR_HMAC_SHA256
|
||||
from borg.crypto.low_level import AES256_OCB, CHACHA20_POLY1305
|
||||
from borg.crypto.low_level import is_libressl
|
||||
print("Encryption =====================================================")
|
||||
size = "1GB"
|
||||
|
||||
for spec, func in [
|
||||
tests = [
|
||||
("aes-256-ctr-hmac-sha256", lambda: AES256_CTR_HMAC_SHA256(
|
||||
key_256, key_256, iv=key_128, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
("aes-256-ctr-blake2b", lambda: AES256_CTR_BLAKE2b(
|
||||
key_256*4, key_256, iv=key_128, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
("aes-256-ocb", lambda: AES256_OCB(
|
||||
None, key_256, iv=key_96, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
("chacha20-poly1305", lambda: CHACHA20_POLY1305(
|
||||
None, key_256, iv=key_96, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
]:
|
||||
]
|
||||
if not is_libressl:
|
||||
tests.extend([
|
||||
("aes-256-ocb", lambda: AES256_OCB(
|
||||
None, key_256, iv=key_96, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
("chacha20-poly1305", lambda: CHACHA20_POLY1305(
|
||||
None, key_256, iv=key_96, header_len=1, aad_offset=1).encrypt(random_10M, header=b'X')),
|
||||
])
|
||||
for spec, func in tests:
|
||||
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
|
||||
|
||||
from borg.compress import CompressionSpec
|
||||
|
Loading…
Reference in New Issue
Block a user