python-fido2 has a bug which does not allow to use 0xff as ConfigVendorPrototype.

It encodes an uint8_t to int8_t and thus, the command must be <= 0x7f.

Fixes #22.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-11-02 22:14:42 +01:00
parent 65039c0959
commit 421bea6421
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3
2 changed files with 5 additions and 4 deletions

View File

@ -64,7 +64,7 @@ int cbor_config(const uint8_t *data, size_t len) {
raw_subpara = (uint8_t *) cbor_value_get_next_byte(&_f1);
CBOR_PARSE_MAP_START(_f1, 2)
{
if (subcommand == 0xff) {
if (subcommand == 0x7f) {
CBOR_FIELD_GET_UINT(subpara, 2);
if (subpara == 0x01) {
CBOR_FIELD_GET_UINT(vendorCommandId, 2);
@ -134,7 +134,7 @@ int cbor_config(const uint8_t *data, size_t len) {
CBOR_ERROR(CTAP2_ERR_PIN_AUTH_INVALID);
}
if (subcommand == 0xff) {
if (subcommand == 0x7f) {
if (vendorCommandId == CTAP_CONFIG_AUT_DISABLE) {
if (!file_has_data(ef_keydev_enc)) {
CBOR_ERROR(CTAP2_ERR_NOT_ALLOWED);

View File

@ -81,6 +81,7 @@ class VendorConfig(Config):
class CMD(IntEnum):
CONFIG_AUT_ENABLE = 0x03e43f56b34285e2
CONFIG_AUT_DISABLE = 0x1831a40f04a25ed9
CONFIG_VENDOR_PROTOTYPE = 0x7f
class RESP(IntEnum):
KEY_AGREEMENT = 0x01
@ -90,7 +91,7 @@ class VendorConfig(Config):
def enable_device_aut(self, ct):
self._call(
Config.CMD.CONFIG_VENDOR_PROTOTYPE,
VendorConfig.CMD.CONFIG_VENDOR_PROTOTYPE,
{
VendorConfig.PARAM.VENDOR_COMMAND_ID: VendorConfig.CMD.CONFIG_AUT_ENABLE,
VendorConfig.PARAM.VENDOR_AUT_CT: ct
@ -99,7 +100,7 @@ class VendorConfig(Config):
def disable_device_aut(self):
self._call(
Config.CMD.CONFIG_VENDOR_PROTOTYPE,
VendorConfig.CMD.CONFIG_VENDOR_PROTOTYPE,
{
VendorConfig.PARAM.VENDOR_COMMAND_ID: VendorConfig.CMD.CONFIG_AUT_DISABLE
},