Skip to content

Commit 9919146

Browse files
committed
authentication: fido2: hide internal symbols from the API docs
A number of symbols in the public FIDO2 headers are implementation details of the subsystem core. They are not part of the application API, and they are not part of the contract with out-of-tree transport, storage, user presence or attestation backends either. Wrap them in @cond INTERNAL_HIDDEN blocks so they no longer show up in the generated API documentation: - CTAP2 status and command codes (enum fido2_status, enum fido2_cmd). The core casts the status to a raw response byte before handing the buffer to a transport, and dispatches on the raw command byte, so neither appears in any public signature. - struct fido2_device_info, built by the core and consumed by the internal CBOR encoder, together with the constants that only exist to size or describe it: FIDO2_AAGUID_SIZE, FIDO2_MAX_VERSIONS, FIDO2_MAX_EXTENSIONS and FIDO2_TRANSPORT_{USB,BLE,NFC}. - The credential ID and authenticatorData layout constants (FIDO2_DISCOVERABLE_CRED_ID_SIZE, FIDO2_NON_DISCOVERABLE_CRED_ID_SIZE, FIDO2_AUTH_DATA_HEADER_SIZE, FIDO2_ATTESTED_CRED_DATA_MAX_SIZE, FIDO2_AUTH_DATA_MAX_SIZE) and the authenticatorData flags (AUTH_DATA_FLAG_*). - The COSE/ECDH key encoding constants (FIDO2_P256_UNCOMPRESSED_KEY_SIZE, FIDO2_P256_COORD_SIZE, FIDO2_EC_POINT_UNCOMPRESSED). What a backend implementer needs stays documented: struct fido2_credential and the macros sizing its fields, FIDO2_SHA256_SIZE, FIDO2_PIN_HASH_SIZE, FIDO2_ECDSA_SIG_MAX_SIZE (used by an attestation backend to size its signature buffer, as the in-tree self attestation one does), FIDO2_EXT_*, enum fido2_cred_protect and enum fido2_cose_alg. While at it, drop a stray "8" from the FIDO2_AUTH_DATA_MAX_SIZE brief and add the missing @brief to FIDO2_ATTESTATION_FMT_MAX_LEN. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org> Assisted-by: Claude:opus-5
1 parent 8dafb9a commit 9919146

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

include/zephyr/authentication/fido2/fido2_attestation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" {
3030
#define FIDO2_ATTESTATION_FMT_PACKED "packed"
3131
/** @brief No attestation */
3232
#define FIDO2_ATTESTATION_FMT_NONE "none"
33-
/** Maximum attestation format identifier length. */
33+
/** @brief Maximum attestation format identifier length */
3434
#define FIDO2_ATTESTATION_FMT_MAX_LEN 32
3535

3636
/**

include/zephyr/authentication/fido2/fido2_types.h

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,20 @@ extern "C" {
4646
/** @brief Maximum user ID size in bytes */
4747
#define FIDO2_USER_ID_MAX_SIZE 64
4848

49-
/** @brief AAGUID size in bytes */
50-
#define FIDO2_AAGUID_SIZE 16
51-
5249
/** @brief SHA-256 hash size */
5350
#define FIDO2_SHA256_SIZE 32
5451

5552
/** @brief PIN hash size */
5653
#define FIDO2_PIN_HASH_SIZE 16
5754

55+
/** @brief ASN.1-encoded ECDSA signature length */
56+
#define FIDO2_ECDSA_SIG_MAX_SIZE 72
57+
58+
/** @cond INTERNAL_HIDDEN */
59+
60+
/** @brief AAGUID size in bytes */
61+
#define FIDO2_AAGUID_SIZE 16
62+
5863
/** @brief Size of a discoverable credential ID */
5964
#define FIDO2_DISCOVERABLE_CRED_ID_SIZE 32
6065

@@ -68,7 +73,7 @@ extern "C" {
6873
#define FIDO2_ATTESTED_CRED_DATA_MAX_SIZE \
6974
(FIDO2_AAGUID_SIZE + 2 + FIDO2_CREDENTIAL_ID_MAX_SIZE + FIDO2_COSE_KEY_MAX_SIZE)
7075

71-
/** @brief Maximum authenticatorData size 8 */
76+
/** @brief Maximum authenticatorData size */
7277
#define FIDO2_AUTH_DATA_MAX_SIZE (FIDO2_AUTH_DATA_HEADER_SIZE + FIDO2_ATTESTED_CRED_DATA_MAX_SIZE)
7378

7479
/** @brief Maximum number of supported extensions */
@@ -86,8 +91,7 @@ extern "C" {
8691
/** @brief EC point prefix */
8792
#define FIDO2_EC_POINT_UNCOMPRESSED 0x04
8893

89-
/** @brief ASN.1-encoded ECDSA signature length */
90-
#define FIDO2_ECDSA_SIG_MAX_SIZE 72
94+
/** @endcond */
9195

9296
/** @brief Credential extension HMAC secret */
9397
#define FIDO2_EXT_HMAC_SECRET BIT(0)
@@ -98,6 +102,8 @@ extern "C" {
98102
/** @brief Credential extension thirdPartyPayment */
99103
#define FIDO2_EXT_THIRD_PARTY_PAY BIT(3)
100104

105+
/** @cond INTERNAL_HIDDEN */
106+
101107
/** @brief Transport USB */
102108
#define FIDO2_TRANSPORT_USB BIT(0)
103109
/** @brief Transport BLE */
@@ -178,6 +184,8 @@ enum fido2_cmd {
178184
FIDO2_CMD_SELECTION = 0x0B, /**< Authenticator selection */
179185
};
180186

187+
/** @endcond */
188+
181189
/** @brief Credential protection levels */
182190
enum fido2_cred_protect {
183191
/** UV optional; credential usable without verification */
@@ -230,6 +238,8 @@ struct fido2_credential {
230238
uint8_t cred_protect;
231239
};
232240

241+
/** @cond INTERNAL_HIDDEN */
242+
233243
/**
234244
* @brief Device information returned by authenticatorGetInfo.
235245
*/
@@ -277,6 +287,8 @@ struct fido2_device_info {
277287
uint8_t min_pin_length;
278288
};
279289

290+
/** @endcond */
291+
280292
#ifdef __cplusplus
281293
}
282294
#endif

0 commit comments

Comments
 (0)