solokeys / solo1-cli

Solo 1 library and CLI in Python
https://pypi.org/project/solo-python
Apache License 2.0
185 stars 69 forks source link

Legacy signatures #41

Closed conorpp closed 5 years ago

conorpp commented 5 years ago

@szszszsz I removed your --end_page and did this instead to more easily support older versions of bootloader.

def sign_firmware(sk_name, hex_file, ):
    v1 = sign_firmware_for_version(sk_name, hex_file, 19)
    v2 = sign_firmware_for_version(sk_name, hex_file, 20)

    # use fw from v2 since it's smaller.
    fw = v2['firmware']

    return {
        'firmware': fw,
        'signature': v2['signature'],
        # signatures to use for different versions of bootloader
        'versions':{
            '<=2.3.0' : {
                'signature': v1['signature']
            },
            '>2.3.0' : {
                'signature': v2['signature']
            }
        }
    }

def sign_firmware_for_version(sk_name, hex_file, APPLICATION_END_PAGE):
# ... 
conorpp commented 5 years ago

Happy to accept further changes