Verified Commit e8158550 authored by Vojtech Myslivec's avatar Vojtech Myslivec 🚀

Move common constants to init module

parent e2cb0b13
......@@ -3,3 +3,13 @@ MOX OTP python package
"""
__version__ = '0.1-alpha'
# hash algorithm used for message signature
HASH_TYPE = "sha512"
# Paths to kernel sysfs API
SYSFS_ROOT = "/sys/devices/platform/soc/soc:internal-regs@d0000000/soc:internal-regs@d0000000:crypto@0/"
PUBKEY_PATH = SYSFS_ROOT + "mox_pubkey"
SIGN_PATH = SYSFS_ROOT + "mox_do_sign"
SERIAL_PATH = SYSFS_ROOT + "mox_serial_number"
......@@ -9,9 +9,7 @@ from .checks import check_serial, check_pubkey
from .exceptions import MoxOtpApiError, MoxOtpSetupError, MoxOtpUsageError
from .helpers import errprint, first_line_of_file, hash_type
from .checks import PUBKEY_PATH, SERIAL_PATH, SIGN_PATH
from .__init__ import PUBKEY_PATH, SERIAL_PATH, SIGN_PATH
# number of bytes to read at once
CHUNK_SIZE = 1024
......
......@@ -7,8 +7,7 @@ import sys
from .helpers import hash_type_length
from .__init__ import __version__
from .helpers import HASH_TYPE
from .__init__ import __version__, HASH_TYPE
def type_hexstr(hexstr):
......
......@@ -8,11 +8,7 @@ from functools import wraps
from .exceptions import MoxOtpApiError, MoxOtpSetupError
from .helpers import first_line_of_file
SYSFS_ROOT = "/sys/devices/platform/soc/soc:internal-regs@d0000000/soc:internal-regs@d0000000:crypto@0/"
PUBKEY_PATH = SYSFS_ROOT + "mox_pubkey"
SIGN_PATH = SYSFS_ROOT + "mox_do_sign"
SERIAL_PATH = SYSFS_ROOT + "mox_serial_number"
from .__init__ import PUBKEY_PATH, SERIAL_PATH, SYSFS_ROOT
def check_sysfs():
......
......@@ -7,9 +7,7 @@ import sys
from .exceptions import MoxOtpSetupError
# hash algorithm used for message signature
HASH_TYPE = "sha512"
from .__init__ import HASH_TYPE
def errprint(*args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment