mirror of
https://github.com/borgbackup/borg.git
synced 2024-09-11 04:25:26 +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_CTR_BLAKE2b, AES256_CTR_HMAC_SHA256
|
||||||
from borg.crypto.low_level import AES256_OCB, CHACHA20_POLY1305
|
from borg.crypto.low_level import AES256_OCB, CHACHA20_POLY1305
|
||||||
|
from borg.crypto.low_level import is_libressl
|
||||||
print("Encryption =====================================================")
|
print("Encryption =====================================================")
|
||||||
size = "1GB"
|
size = "1GB"
|
||||||
|
|
||||||
for spec, func in [
|
tests = [
|
||||||
("aes-256-ctr-hmac-sha256", lambda: AES256_CTR_HMAC_SHA256(
|
("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')),
|
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(
|
("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')),
|
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')),
|
if not is_libressl:
|
||||||
("chacha20-poly1305", lambda: CHACHA20_POLY1305(
|
tests.extend([
|
||||||
None, key_256, iv=key_96, 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')),
|
||||||
|
])
|
||||||
|
for spec, func in tests:
|
||||||
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
|
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
|
||||||
|
|
||||||
from borg.compress import CompressionSpec
|
from borg.compress import CompressionSpec
|
||||||
|
Loading…
Reference in New Issue
Block a user