Added support for enable/disable Web CCID on the fly.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2024-06-19 23:29:05 +02:00
parent f20fdc9bda
commit dd68554782
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3
3 changed files with 7 additions and 2 deletions

View File

@ -84,6 +84,7 @@ set(SOURCES ${SOURCES}
)
set(USB_ITF_CCID 1)
set(USB_ITF_WCID 1)
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
if(ESP_PLATFORM)
project(pico_hsm)

@ -1 +1 @@
Subproject commit a0e55ebfaed615a7627c63282d57fdfa3b7e106c
Subproject commit 218441a45a50993c585ad74b3d0a632d2cf1124e

View File

@ -95,8 +95,10 @@ def parse_args():
subparser_phy = parser_phy.add_subparsers(title='commands', dest='subcommand', required=True)
parser_phy_vp = subparser_phy.add_parser('vidpid', help='Sets VID/PID. Use VID:PID format (e.g. 1234:5678)')
parser_phy_ledn = subparser_phy.add_parser('led', help='Sets LED GPIO number.')
parser_phy_optwcid = subparser_phy.add_parser('wcid', help='Enable/Disable Web CCID interface.')
parser_phy_vp.add_argument('value', help='Value of the PHY option.', metavar='VAL', nargs='?')
parser_phy_ledn.add_argument('value', help='Value of the PHY option.', metavar='VAL', nargs='?')
parser_phy_optwcid.add_argument('value', choices=['enable', 'disable'], help='Enable/Disable Web CCID interface.', nargs='?')
parser_secure = subparser.add_parser('secure', help='Manages security of Pico HSM.')
subparser_secure = parser_secure.add_subparsers(title='commands', dest='subcommand', required=True)
@ -461,6 +463,8 @@ def phy(picohsm, args):
val = int(sp[0],16).to_bytes(2, 'big') + int(sp[1],16).to_bytes(2, 'big')
elif (args.subcommand == 'led'):
val = [int(val)]
elif (args.subcommand == 'wcid'):
val = val == 'enable'
ret = picohsm.phy(args.subcommand, val)
if (ret):
print(f'Current value: {hexlify(ret)}')
@ -468,7 +472,7 @@ def phy(picohsm, args):
print('Command executed successfully. Please, restart your Pico Key.')
def main(args):
sys.stderr.buffer.write(b'Pico HSM Tool v1.12\n')
sys.stderr.buffer.write(b'Pico HSM Tool v1.14\n')
sys.stderr.buffer.write(b'Author: Pol Henarejos\n')
sys.stderr.buffer.write(b'Report bugs to https://github.com/polhenarejos/pico-hsm/issues\n')
sys.stderr.buffer.write(b'\n\n')