Data Structures | |
class | _CtypeIterator |
class | AtcaReference |
class | AtcaStructure |
class | AtcaUnion |
class | cal_buffer |
Functions | |
def | indent (lines, insert) |
def | _force_local_library () |
def | load_cryptoauthlib (lib=None) |
def | get_cryptoauthlib () |
def | get_device_name (revision) |
def | get_device_name_with_device_id (revision) |
def | get_device_type_id (name) |
def | get_size_by_name (name) |
def | get_ctype_by_name (name) |
def | get_ctype_structure_instance (structure, value) |
def | get_ctype_array_instance (array, value) |
def | _get_field_definition (obj, name) |
def | _def_to_field (f_type, f_size=None) |
def | _convert_pointer_to_list (p, length) |
def | _get_attribute_from_ctypes (obj, obj_type, length=None, *args) |
def | _check_type_rationality (cls) |
def | _array_to_code (obj, name=None, parent=None, **kwargs) |
def | _object_definition_code (obj, name=None, parent=None, parent_name=None, anon=None, type_info=None, check_names={}, **kwargs) |
def | _union_to_code (obj, name=None, parent=None, anon=None, entry=None, parent_name=None, type_info=None, **kwargs) |
def | _structure_to_code (obj, name=None, parent=None, type_info=None, parent_name=None, **kwargs) |
def | _obj_to_code (obj, name, parent=None, anon=None, parent_name=None, **kwargs) |
def | _pointer_to_code (obj, name=None, parent=None, parent_name=None, check_names={}, skip_references=[], **kwargs) |
def | _is_pointer (obj, type_info=None, **kwargs) |
def | _to_code (obj, name=None, **kwargs) |
def | _structure_to_string (item, int level=0) |
def | _ctype_from_definition (cls) |
def | ctypes_to_bytes (obj) |
def | create_byte_buffer (init_or_size) |
Variables | |
try : | |
dict | ATCA_NAMES = {'i2c': 'i2c', 'hid': 'kithid', 'sha': 'sha204', 'ecc': 'eccx08'} |
None | _CRYPTO_LIB = None |
dict | _CTYPES_BY_SIZE = {1: c_uint8, 2: c_uint16, 4:c_uint32} |
_fields_ | |
Cryptoauthlib Library Management
|
protected |
Convert an array like item from a ctypes structure into a C language formatted string
|
protected |
This checks the structure or union size against the constants that are stored in the library during compilation. This is not an absolute guarentee that alignment is completely correct but it will catch most cases of incompability between the compiled library that is installed and the python module
|
protected |
Pointer types can be frustrating to interact with generally when processing data in python so this converts them into types that are iterable and bounded
|
protected |
Extends the ctypes structure and union types to add a new attribute _def_ which is a dictionary of field attributes. This extends functionality by quite a bit by supporting additional types and field linkages
|
protected |
Helper function to convert an entry in the _def_ dictionary to the tuple required for a _field_ entry
|
protected |
In some environments loading seems to fail under all circumstances unless brute forcing it.
|
protected |
Helper function that is used by AtcaStructure and AtcaUnion to intercept attribute access to those objects and convert the resulting values into easier to use python objects based on the configuration of the structure/union
|
protected |
Get meta information about the ctypes structure/union by accessing the field description attributes of the class that were provided as part of the ctype structure/union definition
|
protected |
Checks to see if object looks like a pointer
|
protected |
Convert python/ctypes object into a C language representation
|
protected |
Emits the first half of the assignment of this object
|
protected |
Convert the pointer into a representative object by creating a definition in the prepend area
|
protected |
Emits a string with a C language representation of the structure(s) following pointers the best that is can
|
protected |
Emits a readable string of the structure elements coverting types and following pointers and arrays the best that is can
|
protected |
Map object types to the proper renderer function by catching pointer like objects first Returns: (append, prepend)
def cryptoauthlib.library.ctypes_to_bytes | ( | obj | ) |
Convert a ctypes structure/array into bytes. This is for python2 compatibility
def cryptoauthlib.library.get_cryptoauthlib | ( | ) |
This is a helper function for the other python files in this module to use the loaded library
def cryptoauthlib.library.get_ctype_array_instance | ( | array, | |
value | |||
) |
Internal Helper Function: Convert python list into ctype array :param value: Value to convert :param array: Conversion Class (resulting type) :return:
def cryptoauthlib.library.get_ctype_by_name | ( | name | ) |
For known (atca_utils_sizes.c) types that are custom to the library retrieve the size
def cryptoauthlib.library.get_ctype_structure_instance | ( | structure, | |
value | |||
) |
Internal Helper Function: Convert a value into the correct ctypes structure for a given field :param value: Value to convert :param structure: Conversion Class (resulting type) :return:
def cryptoauthlib.library.get_device_name | ( | revision | ) |
Returns the device name based on the info byte array values returned by atcab_info
def cryptoauthlib.library.get_device_name_with_device_id | ( | revision | ) |
Returns the device name based on the info byte array values returned by atcab_info for ECC204 family
def cryptoauthlib.library.get_device_type_id | ( | name | ) |
Returns the ATCADeviceType value based on the device name
def cryptoauthlib.library.get_size_by_name | ( | name | ) |
Get the size of an object in the library using the name_size api from atca_utils_sizes.c
def cryptoauthlib.library.load_cryptoauthlib | ( | lib = None | ) |
Load CryptoAauthLib into Python environment raise LibraryLoadError if cryptoauthlib library can't be loaded