# -*- coding: utf-8 -*-

from modules.part2_structures.marshal.tpm2_partx_marshal_simple_type import SimpleMarshaller
from modules.part2_structures.marshal import tpm2_partx_marshal_templates
import settings


class BitsTableMarshaller(SimpleMarshaller):

    def __init__(self):
        SimpleMarshaller.__init__(self)

    # Generate unmarshal function for Bits tables
    # Parameters: values used to substitute fields of the template
    # Returns:
    # generated source code
    def create_unmarshal_code(self, mrshl_type, to_type, reserved, rc_fail="TPM_RC_VALUE"):

        reserved = reserved.lower()

        if settings.SPEC_VERSION_INT < 138:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits_pre138
        else:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits
        code = template.safe_substitute(TYPE=mrshl_type, TO_TYPE=to_type, RESERVED=reserved, RC_FAIL=rc_fail)

        return code

bacdd290630e848c3dbd004137d9e61963e2121a
<mask token>


class BitsTableMarshaller(SimpleMarshaller):
    <mask token>
    <mask token>

<mask token>


class BitsTableMarshaller(SimpleMarshaller):
    <mask token>

    def create_unmarshal_code(self, mrshl_type, to_type, reserved, rc_fail=
        'TPM_RC_VALUE'):
        reserved = reserved.lower()
        if settings.SPEC_VERSION_INT < 138:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits_pre138
        else:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits
        code = template.safe_substitute(TYPE=mrshl_type, TO_TYPE=to_type,
            RESERVED=reserved, RC_FAIL=rc_fail)
        return code

<mask token>


class BitsTableMarshaller(SimpleMarshaller):

    def __init__(self):
        SimpleMarshaller.__init__(self)

    def create_unmarshal_code(self, mrshl_type, to_type, reserved, rc_fail=
        'TPM_RC_VALUE'):
        reserved = reserved.lower()
        if settings.SPEC_VERSION_INT < 138:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits_pre138
        else:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits
        code = template.safe_substitute(TYPE=mrshl_type, TO_TYPE=to_type,
            RESERVED=reserved, RC_FAIL=rc_fail)
        return code

from modules.part2_structures.marshal.tpm2_partx_marshal_simple_type import SimpleMarshaller
from modules.part2_structures.marshal import tpm2_partx_marshal_templates
import settings


class BitsTableMarshaller(SimpleMarshaller):

    def __init__(self):
        SimpleMarshaller.__init__(self)

    def create_unmarshal_code(self, mrshl_type, to_type, reserved, rc_fail=
        'TPM_RC_VALUE'):
        reserved = reserved.lower()
        if settings.SPEC_VERSION_INT < 138:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits_pre138
        else:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits
        code = template.safe_substitute(TYPE=mrshl_type, TO_TYPE=to_type,
            RESERVED=reserved, RC_FAIL=rc_fail)
        return code

# -*- coding: utf-8 -*-

from modules.part2_structures.marshal.tpm2_partx_marshal_simple_type import SimpleMarshaller
from modules.part2_structures.marshal import tpm2_partx_marshal_templates
import settings


class BitsTableMarshaller(SimpleMarshaller):

    def __init__(self):
        SimpleMarshaller.__init__(self)

    # Generate unmarshal function for Bits tables
    # Parameters: values used to substitute fields of the template
    # Returns:
    # generated source code
    def create_unmarshal_code(self, mrshl_type, to_type, reserved, rc_fail="TPM_RC_VALUE"):

        reserved = reserved.lower()

        if settings.SPEC_VERSION_INT < 138:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits_pre138
        else:
            template = tpm2_partx_marshal_templates.TYPE_Unmarshal_bits
        code = template.safe_substitute(TYPE=mrshl_type, TO_TYPE=to_type, RESERVED=reserved, RC_FAIL=rc_fail)

        return code
