Skip to content

Commit

Permalink
add more debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Oct 13, 2023
1 parent 7e48c17 commit 427e45f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 1 deletion.
84 changes: 84 additions & 0 deletions FIDO2 Conformance Testing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"description": "CanoKey Authenticator",
"aaguid": "244eb29e-e090-4e49-81fe-1f20f8d3b8f4",
"authenticatorVersion": 201,
"protocolFamily": "fido2",
"schema": 3,
"upv": [
{
"major": 1,
"minor": 1
}
],
"authenticationAlgorithms": ["secp256r1_ecdsa_sha256_raw", "ed25519_eddsa_sha512_raw"],
"publicKeyAlgAndEncodings": ["cose"],
"attestationTypes": ["basic_full"],
"userVerificationDetails": [
[
{ "userVerificationMethod": "none" }
],
[
{ "userVerificationMethod": "presence_internal" }
],
[
{ "userVerificationMethod": "passcode_external" }
],
[
{ "userVerificationMethod": "passcode_external" },
{ "userVerificationMethod": "presence_internal" }
]
],
"keyProtection": ["hardware", "secure_element"],
"matcherProtection": ["on_chip"],
"tcDisplay": [],
"attestationRootCertificates": [
"MIIDMjCCAhqgAwIBAgIUAvaAGy8lEWimeNJniABYTEpv1GowDQYJKoZIhvcNAQELBQAwMTEvMC0GA1UEAwwmQ2Fub0tleXMgRklETyBBdHRlc3RhdGlvbiBSb290IENBIE5vLjEwHhcNMjAwNzA4MTEzNzMzWhcNNDAwMTA1MTEzNzMzWjAxMS8wLQYDVQQDDCZDYW5vS2V5cyBGSURPIEF0dGVzdGF0aW9uIFJvb3QgQ0EgTm8uMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK7eBQHp4sJBXOEM9JivpoQvS/neBPCdp2h36PGDzx6wZ5AP8UZOw5a+VFeresLm00qo5qWOJ2ajFlupjmXVpfsYnao1DDbI3ZDZkbIePj0NmnTProHr4N73gBGGaErKW+IURVGsvXAZcPz/qeGclo4ZFH4th6RZT4nJzOUd5rwB5Z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],
"extensions": [
"credBlob",
"credProtect",
"hmac-secret",
"largeBlobKey"
],
"aaguid": "244eb29ee0904e4981fe1f20f8d3b8f4",
"options": {
"rk": true,
"credMgmt": true,
"clientPin": false,
"largeBlobs": true,
"pinUvAuthToken": true,
"makeCredUvNotRqd": true
},
"maxMsgSize": 1300,
"pinUvAuthProtocols": [
1,
2
],
"maxCredentialCountInList": 8,
"maxCredentialIdLength": 70,
"transports": [
"nfc",
"usb"
],
"algorithms": [
{
"alg": -7,
"type": "public-key"
},
{
"alg": -8,
"type": "public-key"
}
],
"maxSerializedLargeBlobArray": 4096,
"firmwareVersion": 201,
"maxCredBlobLength": 32
}
}
2 changes: 2 additions & 0 deletions applets/ctap/ctap-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ uint8_t parse_client_pin(CborParser *parser, CTAP_client_pin *cp, const uint8_t
if (len == 0 || len > SHA256_DIGEST_LENGTH) return CTAP2_ERR_PIN_AUTH_INVALID;
ret = cbor_value_copy_byte_string(&map, cp->pin_uv_auth_param, &len, NULL);
CHECK_CBOR_RET(ret);
DBG_MSG("pin_uv_auth_param: ");
PRINT_HEX(cp->pin_uv_auth_param, len);
cp->parsed_params |= PARAM_PIN_UV_AUTH_PARAM;
break;

Expand Down
7 changes: 6 additions & 1 deletion applets/ctap/ctap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,7 @@ static uint8_t ctap_client_pin(CborEncoder *encoder, const uint8_t *params, size
int err, retries;
switch (cp.sub_command) {
case CP_CMD_GET_PIN_RETRIES:
DBG_MSG("Subcommand Get Pin Retries\n");
ret = cbor_encoder_create_map(encoder, &map, 1);
CHECK_CBOR_RET(ret);
ret = cbor_encode_int(&map, CP_RESP_PIN_RETRIES);
Expand All @@ -1375,6 +1376,7 @@ static uint8_t ctap_client_pin(CborEncoder *encoder, const uint8_t *params, size
break;

case CP_CMD_GET_KEY_AGREEMENT:
DBG_MSG("Subcommand Get Key Agreement\n");
ret = cbor_encoder_create_map(encoder, &map, 1);
CHECK_CBOR_RET(ret);
ret = cbor_encode_int(&map, CP_RESP_KEY_AGREEMENT);
Expand All @@ -1393,13 +1395,14 @@ static uint8_t ctap_client_pin(CborEncoder *encoder, const uint8_t *params, size
break;

case CP_CMD_SET_PIN:
DBG_MSG("Subcommand Set Pin\n");
err = has_pin();
if (err < 0) return CTAP2_ERR_UNHANDLED_REQUEST;
if (err > 0) return CTAP2_ERR_PIN_AUTH_INVALID;
ret = cp_decapsulate(cp.key_agreement, cp.pin_uv_auth_protocol);
CHECK_PARSER_RET(ret);
DBG_MSG("Shared Secret: ");
PRINT_HEX(cp.key_agreement, PUB_KEY_SIZE);
PRINT_HEX(cp.key_agreement, SHARED_SECRET_SIZE);
if (!cp_verify(cp.key_agreement, SHARED_SECRET_SIZE, cp.new_pin_enc,
cp.pin_uv_auth_protocol == 1 ? PIN_ENC_SIZE_P1 : PIN_ENC_SIZE_P2, cp.pin_uv_auth_param,
cp.pin_uv_auth_protocol)) {
Expand All @@ -1423,6 +1426,7 @@ static uint8_t ctap_client_pin(CborEncoder *encoder, const uint8_t *params, size
break;

case CP_CMD_CHANGE_PIN:
DBG_MSG("Subcommand Change Pin\n");
err = has_pin();
if (err < 0) return CTAP2_ERR_UNHANDLED_REQUEST;
if (err == 0) return CTAP2_ERR_PIN_NOT_SET;
Expand Down Expand Up @@ -1486,6 +1490,7 @@ static uint8_t ctap_client_pin(CborEncoder *encoder, const uint8_t *params, size

case CP_CMD_GET_PIN_TOKEN:
case CP_CMD_GET_PIN_UV_AUTH_TOKEN_USING_PIN_WITH_PERMISSIONS:
DBG_MSG("Subcommand Get Pin Token\n");
// https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-errata-20220621.html#getPinToken
// https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-errata-20220621.html#getPinUvAuthTokenUsingPinWithPermissions
err = has_pin();
Expand Down
2 changes: 2 additions & 0 deletions applets/ctap/secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ void cp_get_public_key(uint8_t *buf) {

int cp_decapsulate(uint8_t *buf, int pin_protocol) {
int ret = ecdh(SECP256R1, ka_key.pri, buf, buf);
DBG_MSG("ECDH: ");
PRINT_HEX(buf, PUBLIC_KEY_LENGTH[SECP256R1]);
if (ret < 0) return 1;
if (pin_protocol == 1)
sha256_raw(buf, PRI_KEY_SIZE, buf);
Expand Down

0 comments on commit 427e45f

Please sign in to comment.