python/bls_ZZZ.py.in [93:149]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def to_str(octet_value): """Converts an octet type into a string Add all the values in an octet into an array. Args:: octet_value. An octet pointer type Returns:: String Raises: Exception """ i = 0 val = [] while i < octet_value.len: val.append(octet_value.val[i]) i = i + 1 out = b'' for x in val: out = out + x return out def make_octet(length, value=None): """Generates an octet pointer Generates an empty octet or one filled with the input value Args:: length: Length of empty octet value: Data to assign to octet Returns:: oct_ptr: octet pointer val: data associated with octet to prevent garbage collection Raises: """ oct_ptr = ffi.new("octet*") if value: val = ffi.new("char [%s]" % len(value), value) oct_ptr.val = val oct_ptr.max = len(value) oct_ptr.len = len(value) else: val = ffi.new("char []", length) oct_ptr.val = val oct_ptr.max = length oct_ptr.len = length return oct_ptr, val - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - python/mpin_ZZZ.py.in [132:188]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def to_str(octet_value): """Converts an octet type into a string Add all the values in an octet into an array. Args:: octet_value. An octet pointer type Returns:: String Raises: Exception """ i = 0 val = [] while i < octet_value.len: val.append(octet_value.val[i]) i = i + 1 out = b'' for x in val: out = out + x return out def make_octet(length, value=None): """Generates an octet pointer Generates an empty octet or one filled with the input value Args:: length: Length of empty octet value: Data to assign to octet Returns:: oct_ptr: octet pointer val: data associated with octet to prevent garbage collection Raises: """ oct_ptr = ffi.new("octet*") if value: val = ffi.new("char [%s]" % len(value), value) oct_ptr.val = val oct_ptr.max = len(value) oct_ptr.len = len(value) else: val = ffi.new("char []", length) oct_ptr.val = val oct_ptr.max = length oct_ptr.len = length return oct_ptr, val - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -