Skip to content

Commit

Permalink
Try to import AES from Cryptodome, use Crypto as a fallback
Browse files Browse the repository at this point in the history
We need AES_CCM, which is only available in an unreleased version of
Crypto. Moreover, Crypto is technically abandoned.

The drop-in replacement, which does come with AES_CCM, is Cryptodome.
It can be packaged to either use the Crypto namespace (hence being a
drop-in replacement) or use its own Cryptodome namespace. In the
latter case, the package is commonly referred to as cryptodomex.

There is no consensus among Linux distributions on which of these two
approaches is taken (and potentially, both can coexist). To get around
this, we now first try to import AES from Cryptodome and only if that
fails, import it from Crypto. This should work on all distributions.
Hopefully.
  • Loading branch information
DrMcCoy committed Apr 17, 2020
1 parent 52cc878 commit 27020d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tg3442_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@

import binascii
from bs4 import BeautifulSoup
from Crypto.Cipher import AES
try:
from Cryptodome.Cipher import AES
except ImportError:
from Crypto.Cipher import AES
import hashlib
import json
import re
Expand Down

0 comments on commit 27020d8

Please sign in to comment.