summaryrefslogtreecommitdiffstats
path: root/gallery_dl/aes.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-12-02 00:31:59 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2024-12-02 00:31:59 -0500
commit1981ccaaea6eab2cf32536ec5afe132a870914d8 (patch)
tree013f1e17d922d3a6abf7f57aa6a175c2ce5d93bc /gallery_dl/aes.py
parentfc004701f923bb954a22c7fec2ae8d607e78cb2b (diff)
New upstream version 1.28.0.upstream/1.28.0
Diffstat (limited to 'gallery_dl/aes.py')
-rw-r--r--gallery_dl/aes.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gallery_dl/aes.py b/gallery_dl/aes.py
index 22cb052..891104a 100644
--- a/gallery_dl/aes.py
+++ b/gallery_dl/aes.py
@@ -227,11 +227,12 @@ def aes_gcm_decrypt_and_verify(data, key, tag, nonce):
decrypted_data = aes_ctr_decrypt(
data, key, iv_ctr + [0] * (BLOCK_SIZE_BYTES - len(iv_ctr)))
- pad_len = len(data) // 16 * 16
+ pad_len = (
+ (BLOCK_SIZE_BYTES - (len(data) % BLOCK_SIZE_BYTES)) % BLOCK_SIZE_BYTES)
s_tag = ghash(
hash_subkey,
data +
- [0] * (BLOCK_SIZE_BYTES - len(data) + pad_len) + # pad
+ [0] * pad_len + # pad
bytes_to_intlist(
(0 * 8).to_bytes(8, "big") + # length of associated data
((len(data) * 8).to_bytes(8, "big")) # length of data