mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
Switch from pycryptodome to pycryptodomex
So for some weird historical reasons, the same python module is available as pycryptodome (Crypto.* namespace) and pycryptodomex (Cryptodome.* namespace). See the following information on the project homepage: https://www.pycryptodome.org/src/installation To make things extra-weird, Debian choose to package pycryptodomex as python3-pycryptodome (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886291). So in order to support both Debian-packaged and differently-installed packages, let's switch to pycryotodomex on all platforms/installers. Change-Id: I04daed01f51f9702595ef9f9e0d7fcdf1e4adb62
This commit is contained in:
@@ -46,7 +46,7 @@ Please install the following dependencies:
|
|||||||
- termcolor
|
- termcolor
|
||||||
- colorlog
|
- colorlog
|
||||||
- packaging
|
- packaging
|
||||||
- pycryptodome
|
- pycryptodomex
|
||||||
|
|
||||||
Example for Debian:
|
Example for Debian:
|
||||||
```sh
|
```sh
|
||||||
@@ -54,6 +54,7 @@ sudo apt-get install --no-install-recommends \
|
|||||||
pcscd libpcsclite-dev \
|
pcscd libpcsclite-dev \
|
||||||
python3 \
|
python3 \
|
||||||
python3-setuptools \
|
python3-setuptools \
|
||||||
|
python3-pycryptodome \
|
||||||
python3-pyscard \
|
python3-pyscard \
|
||||||
python3-pip
|
python3-pip
|
||||||
pip3 install --user -r requirements.txt
|
pip3 install --user -r requirements.txt
|
||||||
|
|||||||
@@ -150,8 +150,8 @@ class OtaDialect(abc.ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
from Crypto.Cipher import DES, DES3, AES
|
from Cryptodome.Cipher import DES, DES3, AES
|
||||||
from Crypto.Hash import CMAC
|
from Cryptodome.Hash import CMAC
|
||||||
|
|
||||||
class OtaAlgo(abc.ABC):
|
class OtaAlgo(abc.ABC):
|
||||||
iv = property(lambda self: bytes([0] * self.blocksize))
|
iv = property(lambda self: bytes([0] * self.blocksize))
|
||||||
|
|||||||
@@ -616,9 +616,9 @@ def derive_milenage_opc(ki_hex: Hexstr, op_hex: Hexstr) -> Hexstr:
|
|||||||
"""
|
"""
|
||||||
Run the milenage algorithm to calculate OPC from Ki and OP
|
Run the milenage algorithm to calculate OPC from Ki and OP
|
||||||
"""
|
"""
|
||||||
from Crypto.Cipher import AES
|
from Cryptodome.Cipher import AES
|
||||||
# pylint: disable=no-name-in-module
|
# pylint: disable=no-name-in-module
|
||||||
from Crypto.Util.strxor import strxor
|
from Cryptodome.Util.strxor import strxor
|
||||||
from pySim.utils import b2h
|
from pySim.utils import b2h
|
||||||
|
|
||||||
# We pass in hex string and now need to work on bytes
|
# We pass in hex string and now need to work on bytes
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ gsm0338
|
|||||||
pyyaml>=5.1
|
pyyaml>=5.1
|
||||||
termcolor
|
termcolor
|
||||||
colorlog
|
colorlog
|
||||||
pycryptodome
|
pycryptodomex
|
||||||
packaging
|
packaging
|
||||||
|
|||||||
Reference in New Issue
Block a user