예제 #1
0
async def view_ident(*a):
    # show the XPUB, and other ident on screen
    from main import settings, pa
    from version import serial_number
    import callgate, stash

    tpl = '''\
Master Key Fingerprint:

  {xfp:08x}

USB Serial Number:

  {serial}

Extended Master Key:

{xpub}
'''
    msg = tpl.format(xpub=settings.get('xpub', '(none yet)'),
                     xfp=settings.get('xfp', 0),
                     serial=serial_number())

    if pa.is_secondary:
        msg += '\n(Secondary wallet)\n'

    if stash.bip39_passphrase:
        msg += '\nBIP39 passphrase is in effect.\n'

    bn = callgate.get_bag_number()
    if bn:
        msg += '\nShipping Bag:\n  %s\n' % bn

    await ux_show_story(msg)
예제 #2
0
파일: version.py 프로젝트: yahiheb/firmware
def probe_system():
    # run-once code to determine what hardware we are running on
    global hw_label, has_608, has_fatram, is_factory_mode

    from sigheader import RAM_BOOT_FLAGS, RBF_FACTORY_MODE
    import ckcc, callgate, stm
    from machine import Pin

    # NOTE: mk1 not supported anymore.
    # PA10 is pulled-down in Mark2, open in previous revs
    #mark2 = (Pin('MARK2', Pin.IN, pull=Pin.PULL_UP).value() == 0)
    #
    #if not mark2:
    #    has_membrane = False
    #    hw_label = 'mk1'

    hw_label = 'mk2'

    has_fatram = ckcc.is_stm32l496()

    if has_fatram:
        hw_label = 'mk3'

    has_608 = callgate.has_608()

    # Boot loader needs to tell us stuff about how we were booted, sometimes:
    # - did we just install a new version, for example
    # - are we running in "factory mode" with flash un-secured?
    is_factory_mode = bool(stm.mem32[RAM_BOOT_FLAGS] & RBF_FACTORY_MODE)
    bn = callgate.get_bag_number()
    if bn:
        # this path supports testing/dev with RDP!=2, which normal production bootroms enforce
        is_factory_mode = False
예제 #3
0
파일: usb.py 프로젝트: Coldcard/firmware
    def handle_bag_number(self, bag_num):
        import version, callgate
        from glob import dis
        from pincodes import pa

        if version.is_factory_mode and bag_num:
            # check state first
            assert settings.get('tested', False)
            assert pa.is_blank()
            assert 8 <= len(bag_num) < 32

            # do the change
            failed = callgate.set_bag_number(bag_num)
            assert not failed

            callgate.set_rdp_level(2 if not is_devmode else 0)
            pa.greenlight_firmware()
            dis.fullscreen(bytes(bag_num).decode())

            self.call_after(callgate.show_logout, 1)

        # always report the existing/new value
        val = callgate.get_bag_number() or b''

        return b'asci' + val
예제 #4
0
async def show_bag_number(*a):
    import callgate
    bn = callgate.get_bag_number() or 'UNBAGGED!'

    await ux_show_story('''\
Your new Coldcard should have arrived SEALED in a bag with the above number. Please take a moment to confirm the number and look for any signs of tampering.
\n
Take pictures and contact support@coinkite if you have concerns.''', title=bn)
예제 #5
0
def is_factory_mode():
    from sigheader import RAM_BOOT_FLAGS, RBF_FACTORY_MODE
    import stm, callgate

    is_factory = bool(stm.mem32[RAM_BOOT_FLAGS] & RBF_FACTORY_MODE)

    bn = callgate.get_bag_number()
    if bn:
        # this path supports testing/dev with RDP!=2, which normal production bootroms enforce
        is_factory = False

    return is_factory
예제 #6
0
파일: version.py 프로젝트: mluczak/firmware
def is_factory_mode():
    from sigheader import RAM_BOOT_FLAGS, RBF_FACTORY_MODE
    import stm, callgate

    is_factory = bool(stm.mem32[RAM_BOOT_FLAGS] & RBF_FACTORY_MODE)

    bn = callgate.get_bag_number()
    if bn:
        # XXX until we master RDP=2, we need this workaround
        is_factory = False

    return is_factory