1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-21 13:47:16 +00:00

Merge pull request #6370 from bket/fix_build_libressl

Fix build with LibreSSL
This commit is contained in:
TW 2022-02-26 23:02:59 +01:00 committed by GitHub
commit 1dca742494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View file

@ -7,4 +7,8 @@
const EVP_CIPHER *EVP_aes_256_ocb(void){ /* dummy, so that code compiles */
return NULL;
}
const EVP_CIPHER *EVP_chacha20_poly1305(void){ /* dummy, so that code compiles */
return NULL;
}
#endif

View file

@ -5,6 +5,7 @@
#if defined(LIBRESSL_VERSION_NUMBER)
const EVP_CIPHER *EVP_aes_256_ocb(void); /* dummy, so that code compiles */
const EVP_CIPHER *EVP_chacha20_poly1305(void); /* dummy, so that code compiles */
#endif
#if !defined(LIBRESSL_VERSION_NUMBER)

View file

@ -97,6 +97,7 @@ cdef extern from "_crypto_helpers.h":
long LIBRESSL_VERSION_NUMBER
const EVP_CIPHER *EVP_aes_256_ocb() # dummy
const EVP_CIPHER *EVP_chacha20_poly1305() # dummy
is_libressl = bool(LIBRESSL_VERSION_NUMBER)
@ -640,7 +641,8 @@ cdef class AES256_OCB(_AES_BASE):
cdef class CHACHA20_POLY1305(_CHACHA_BASE):
@classmethod
def requirements_check(cls):
pass
if is_libressl:
raise ValueError('CHACHA20-POLY1305 is not implemented by LibreSSL (yet?).')
def __init__(self, mac_key, enc_key, iv=None, header_len=1, aad_offset=1):
self.requirements_check()

View file

@ -98,15 +98,15 @@ def test_AE(self):
header = b'\x23'
tests = [
# (ciphersuite class, exp_mac, exp_cdata)
(CHACHA20_POLY1305,
b'fd08594796e0706cde1e8b461e3e0555',
b'a093e4b0387526f085d3c40cca84a35230a5c0dd766453b77ba38bcff775',)
]
if not is_libressl:
tests += [
(AES256_OCB,
b'b6909c23c9aaebd9abbe1ff42097652d',
b'877ce46d2f62dee54699cebc3ba41d9ab613f7c486778c1b3636664b1493', ),
(CHACHA20_POLY1305,
b'fd08594796e0706cde1e8b461e3e0555',
b'a093e4b0387526f085d3c40cca84a35230a5c0dd766453b77ba38bcff775', )
]
for cs_cls, exp_mac, exp_cdata in tests:
# print(repr(cs_cls))
@ -142,15 +142,15 @@ def test_AEAD(self):
header = b'\x12\x34\x56'
tests = [
# (ciphersuite class, exp_mac, exp_cdata)
(CHACHA20_POLY1305,
b'b7e7c9a79f2404e14f9aad156bf091dd',
b'a093e4b0387526f085d3c40cca84a35230a5c0dd766453b77ba38bcff775',)
]
if not is_libressl:
tests += [
(AES256_OCB,
b'f2748c412af1c7ead81863a18c2c1893',
b'877ce46d2f62dee54699cebc3ba41d9ab613f7c486778c1b3636664b1493', ),
(CHACHA20_POLY1305,
b'b7e7c9a79f2404e14f9aad156bf091dd',
b'a093e4b0387526f085d3c40cca84a35230a5c0dd766453b77ba38bcff775', )
]
for cs_cls, exp_mac, exp_cdata in tests:
# print(repr(cs_cls))