Skip to content

Commit

Permalink
fixup: fix the crash
Browse files Browse the repository at this point in the history
looks like cython does not generate correct code for what I tried.
  • Loading branch information
ThomasWaldmann committed Jan 24, 2021
1 parent bf1f23c commit e9c4085
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/borg/crypto/low_level.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,10 @@ cdef class AES256_CTR_BLAKE2b(AES256_CTR_BASE):
cdef mac_compute(self, const unsigned char *data1, int data1_len,
const unsigned char *data2, int data2_len,
unsigned char *mac_buf):
data = bytes(self.mac_key[:128]) + bytes(data1[:data1_len]) + bytes(data2[:data2_len])
data = self.mac_key[:128] + data1[:data1_len] + data2[:data2_len]
mac = hashlib.blake2b(data, digest_size=self.mac_len).digest()
mac_buf[:self.mac_len] = mac[:self.mac_len]
for i in range(self.mac_len):
mac_buf[i] = mac[i]

cdef mac_verify(self, const unsigned char *data1, int data1_len,
const unsigned char *data2, int data2_len,
Expand Down

0 comments on commit e9c4085

Please sign in to comment.