diff --git a/include/cbor.h b/include/cbor.h index f1e5e4a..e5623e5 100644 --- a/include/cbor.h +++ b/include/cbor.h @@ -28,7 +28,7 @@ typedef int cbor_parse_map_item(const cb0r_t key, const cb0r_t value, void *data * @param cbor_map The map to iterate over. * @param cb The callback to call for each entry. * @param data User-supplied additional context data passed to the callback. - * @return int FIDO_OK if map could be iterated completely. + * @return int FIDO_OK if the map could be iterated completely. */ int cbor_iter_map(cb0r_t cbor_map, cbor_parse_map_item *cb, void *data); @@ -38,7 +38,7 @@ int cbor_iter_map(cb0r_t cbor_map, cbor_parse_map_item *cb, void *data); * @param cbor_array The array to iterate over. * @param cb The callback to call for each entry. * @param data User-supplied additional context data passed to the callback. - * @return int FIDO_OK if array could be iterated completely. + * @return int FIDO_OK if the array could be iterated completely. */ int cbor_iter_array(cb0r_t cbor_array, cbor_parse_array_item *cb, void* data); @@ -88,7 +88,7 @@ void cbor_writer_reset(cbor_writer_t writer, uint8_t* buffer, const size_t buffe * @brief Check a writer's status. * * @param writer The writer to check. - * @return true iff no error occurred and writer->buffer can be used. + * @return true if no error occurred and writer->buffer can be used. */ bool cbor_writer_is_ok(cbor_writer_t writer); diff --git a/include/dev.h b/include/dev.h index 3c654e3..adae84f 100644 --- a/include/dev.h +++ b/include/dev.h @@ -80,7 +80,7 @@ void fido_dev_set_transport(fido_dev_t *dev, const fido_dev_transport_t *transpo * Initializes the connection and makes it ready for communication. * * @param dev A pointer to the FIDO device to be opened. - * @return intFIDO_OK when the operation was successful. + * @return intFIDO_OK if the operation was successful. */ int fido_dev_open(fido_dev_t *dev); @@ -90,7 +90,7 @@ int fido_dev_open(fido_dev_t *dev); * Closes the connection to the device. * * @param dev A pointer to the FIDO device to be closed. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ int fido_dev_close(fido_dev_t *dev); diff --git a/include/internal.h b/include/internal.h index ec27e74..c3ffe9f 100644 --- a/include/internal.h +++ b/include/internal.h @@ -21,7 +21,7 @@ * @param cmd The CTAP command to receive data from. * @param buf A pointer to the destination buffer. * @param len The size of the destination buffer. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ int fido_rx(fido_dev_t *d, const uint8_t cmd, void *buf, const size_t len); @@ -33,7 +33,7 @@ int fido_rx(fido_dev_t *d, const uint8_t cmd, void *buf, const size_t len); * @param cmd The CTAP command to transmit. * @param buf A pointer to the source buffer. * @param len The size of the source buffer. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ int fido_tx(fido_dev_t *d, const uint8_t cmd, const void *buf, const size_t len); int fido_get_random(void *buf, size_t len); @@ -46,7 +46,7 @@ int fido_get_random(void *buf, size_t len); * @param len The length of the memory area pointed to by buf. * @param dst A pointer to the destination buffer. * @param count The number of bytes to read. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ int fido_buf_read(const unsigned char **buf, size_t *len, void *dst, size_t count); @@ -58,6 +58,6 @@ int fido_buf_read(const unsigned char **buf, size_t *len, void *dst, size_t coun * @param len The length of the memory area pointed to by buf. * @param src The source buffer. * @param count The number of bytes to write. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ int fido_buf_write(unsigned char **buf, size_t *len, const void *src, size_t count); diff --git a/src/assertion.c b/src/assertion.c index 19a4475..f091ea9 100644 --- a/src/assertion.c +++ b/src/assertion.c @@ -118,7 +118,7 @@ static const uint8_t KEY_ID[] PROGMEM_MARKER = "id"; * @param key The CBOR key. * @param assert The CBOR value. * @param arg The assert reply argument to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int cbor_assert_decode_credential(const cb0r_t key, const cb0r_t value, void *arg) { if (!cbor_utf8string_is_definite(key)) { @@ -156,7 +156,7 @@ static int cbor_assert_decode_credential(const cb0r_t key, const cb0r_t value, v * * @param auth_data_raw The raw auth data. * @param ca The reply entry to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int cbor_assert_decode_auth_data_inner(void* auth_data_raw, fido_assert_reply_t *ca) { uint8_t* auth_data_bytes = (uint8_t*) auth_data_raw; @@ -183,7 +183,7 @@ static int cbor_assert_decode_auth_data_inner(void* auth_data_raw, fido_assert_r * * @param auth_data The CBOR encoded authentication data. * @param ca The reply entry to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int cbor_assert_decode_auth_data(const cb0r_t auth_data, fido_assert_reply_t *ca) { if (!cbor_bytestring_is_definite(auth_data)) { @@ -204,7 +204,7 @@ static int cbor_assert_decode_auth_data(const cb0r_t auth_data, fido_assert_repl * * @param signature The CBOR encoded signature data. * @param ca The reply entry to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int cbor_assert_decode_signature(const cb0r_t signature, fido_assert_reply_t *ca) { if (!cbor_bytestring_is_definite(signature)) { @@ -223,7 +223,7 @@ static int cbor_assert_decode_signature(const cb0r_t signature, fido_assert_repl * * @param large_blob_key The CBOR encoded signature data. * @param ca The reply entry to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int cbor_assert_decode_large_blob_key(const cb0r_t large_blob_key, fido_assert_reply_t *ca) { if (!cbor_bytestring_is_definite(large_blob_key)) { @@ -244,7 +244,7 @@ static int cbor_assert_decode_large_blob_key(const cb0r_t large_blob_key, fido_a * @param key The cb0r element representing the map key * @param value The cb0r element representing the map value * @param arg User-passed argument (here: assertion reply). - * @return int FIDO_OK if entry could be parsed. + * @return int FIDO_OK if the entry could be parsed. */ static int parse_get_assert_reply_entry(const cb0r_t key, const cb0r_t value, void *arg) { if (key->type != CB0R_INT || key->value > UINT8_MAX) { @@ -280,7 +280,7 @@ static int parse_get_assert_reply_entry(const cb0r_t key, const cb0r_t value, vo * * @param dev The device to communicate to. * @param assert The assertion request data. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int fido_dev_get_assert_tx( fido_dev_t *dev, @@ -332,7 +332,7 @@ static int fido_dev_get_assert_tx( * @param dev The device to communicate to. * @param assert The assertion request data. * @param reply A pointer to the structure to store the parsed data to. - * @return int FIDO_OK if performed successfully + * @return int FIDO_OK if the operation was successful. */ static int fido_dev_get_assert_rx( fido_dev_t *dev, diff --git a/src/dev.c b/src/dev.c index a38aa38..571a24d 100644 --- a/src/dev.c +++ b/src/dev.c @@ -114,8 +114,8 @@ bool fido_dev_is_fido(fido_dev_t *dev) { /** * @brief Open a FIDO device sending an initialization command. * - * @param dev - * @return int A FIDO_ERR + * @param dev The FIDO device to open. + * @return int FIDO_OK if the operation was successful. */ static int fido_dev_open_tx(fido_dev_t *dev) { int r; @@ -158,8 +158,8 @@ static int fido_dev_open_tx(fido_dev_t *dev) { /** * @brief Open a device and ensure that is a FIDO one by receiving an initialization response. * - * @param dev - * @return int A FIDO_ERR + * @param dev The FIDO device to open. + * @return int FIDO_OK if the operation was successful. */ static int fido_dev_open_rx(fido_dev_t *dev) { fido_cbor_info_t info = { 0 }; diff --git a/src/info.c b/src/info.c index b7c1310..f839fd8 100644 --- a/src/info.c +++ b/src/info.c @@ -66,7 +66,7 @@ void fido_cbor_info_reset(fido_cbor_info_t *ci) { * * @param value The value containing the AAGUID. * @param ci The info to copy the ID to. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int copy_aaguid(const cb0r_t value, fido_cbor_info_t *ci) { if (!cbor_bytestring_is_definite(value) || value->length != sizeof(ci->aaguid)) { @@ -81,7 +81,7 @@ static int copy_aaguid(const cb0r_t value, fido_cbor_info_t *ci) { * * @param value The value to decode. * @param target A pointer to a location to store the decoded value at. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int decode_uint64(const cb0r_t value, uint64_t *target) { if (value->type != CB0R_INT) { @@ -226,7 +226,7 @@ static int cbor_info_decode_options(const cb0r_t key, const cb0r_t value, void * * * @param element The cb0r element containing the byte representing the protocol * @param arg User-passed argument (here: CBOR info). - * @return int FIDO_OK if protocol could be parsed. + * @return int FIDO_OK if the protocol could be parsed. */ static int cbor_info_decode_protocol(const cb0r_t element, void *arg) { fido_cbor_info_t *ci = (fido_cbor_info_t*)arg; @@ -253,7 +253,7 @@ static int cbor_info_decode_protocol(const cb0r_t element, void *arg) { * * @param element The cb0r element representing the transport * @param arg User-passed argument (here: CBOR info). - * @return int FIDO_OK if transport could be parsed. + * @return int FIDO_OK if the transport could be parsed. */ static int cbor_info_decode_transport(const cb0r_t element, void *arg) { fido_cbor_info_t *ci = (fido_cbor_info_t*)arg; @@ -281,7 +281,7 @@ static int cbor_info_decode_transport(const cb0r_t element, void *arg) { * @param key The cb0r element representing the algorithm key * @param value The cb0r element representing the algorithm identifier * @param arg User-passed argument (here: CBOR info). - * @return int FIDO_OK if algorithm could be parsed. + * @return int FIDO_OK if the algorithm could be parsed. */ static int cbor_info_decode_algorithm_entry(const cb0r_t key, const cb0r_t value, void *arg) { fido_cbor_info_t *ci = (fido_cbor_info_t*)arg; @@ -327,7 +327,7 @@ static int cbor_info_decode_algorithm_entry(const cb0r_t key, const cb0r_t value * * @param element The cb0r element representing the algorithm map * @param arg User-passed argument (here: CBOR info). - * @return int FIDO_OK if map could be parsed. + * @return int FIDO_OK if the map could be parsed. */ static int cbor_info_decode_algorithm(const cb0r_t element, void *arg) { if (element->type != CB0R_MAP) { @@ -343,7 +343,7 @@ static int cbor_info_decode_algorithm(const cb0r_t element, void *arg) { * @param key The cb0r element representing the map key * @param value The cb0r element representing the map value * @param arg User-passed argument (here: CBOR info). - * @return int FIDO_OK if entry could be parsed. + * @return int FIDO_OK if the entry could be parsed. */ static int parse_info_reply_entry(const cb0r_t key, const cb0r_t value, void *arg) { if (key->type != CB0R_INT || key->value > UINT8_MAX) { @@ -390,7 +390,7 @@ static int parse_info_reply_entry(const cb0r_t key, const cb0r_t value, void *ar * @brief Send a CTAP authenticatorGetInfo command. * * @param dev The device to communicate to. - * @return int FIDO_OK if transmission succeeded. + * @return int FIDO_OK if the transmission succeeded. */ static int fido_dev_get_cbor_info_tx(fido_dev_t *dev) { const unsigned char cbor[] = { CTAP_CBOR_GETINFO }; @@ -410,7 +410,7 @@ static int fido_dev_get_cbor_info_tx(fido_dev_t *dev) { * * @param dev The device to communicate to. * @param ci The fido_cbor_info_t to write the parsed reply to. - * @return int FIDO_OK if transmission succeeded. + * @return int FIDO_OK if the transmission succeeded. */ static int fido_dev_get_cbor_info_rx(fido_dev_t *dev, fido_cbor_info_t *ci) { unsigned char msg[dev->maxmsgsize]; diff --git a/src/largeblob.c b/src/largeblob.c index 432da85..4fa52b9 100644 --- a/src/largeblob.c +++ b/src/largeblob.c @@ -134,7 +134,7 @@ static bool largeblob_array_check(fido_blob_t *array) { * @param dev The device to read the large blob from. * @param offset The offset in the large blob to start reading from. * @param count The amount of bytes to read. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int largeblob_get_tx(fido_dev_t *dev, size_t offset, size_t count) { // 32 > 1 byte command + 1 byte map header + 1 byte get key + max. 9 byte get value + 1 byte offset key + max. 9 byte offset value @@ -192,7 +192,7 @@ static int parse_largeblob_reply(const cb0r_t key, const cb0r_t value, void *arg * * @param dev The device to read the answer from. * @param chunk The chunk to store the returned large blob chunk in. Must already be allocated. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int largeblob_get_rx(fido_dev_t *dev, fido_blob_t *chunk) { uint8_t msg[dev->maxmsgsize]; @@ -285,7 +285,7 @@ typedef struct largeblob_array_entry { * @param compressed Pointer to the compressed data. * @param compressed_len Length of the compressed data. * @param uncompressed_len_expected Expected length of the uncompressed data, to ensure that we got everything. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int fido_uncompress(fido_blob_t* out, uint8_t *compressed, size_t compressed_len, size_t uncompressed_len_expected) { uint32_t uncompressed_len_actual = out->max_length; @@ -306,7 +306,7 @@ static int fido_uncompress(fido_blob_t* out, uint8_t *compressed, size_t compres * @param key The CBOR key value of the entry. * @param value The CBOR encoded value. * @param data The largeblob array entry object to store the parsed data to. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int largeblob_parse_array_entry(cb0r_t key, cb0r_t value, void *data) { largeblob_array_entry_t *entry = (largeblob_array_entry_t*) data; @@ -362,7 +362,7 @@ static int largeblob_parse_array_entry(cb0r_t key, cb0r_t value, void *data) { * * @param value The CBOR encoded value. * @param data The largeblob array lookup parameters. This also contains the buffer where we write the uncompressed data to. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int largeblob_array_lookup(cb0r_t value, void* data) { largeblob_array_lookup_param_t *param = (largeblob_array_lookup_param_t*) data; diff --git a/src/nfc.c b/src/nfc.c index 36383e4..bdabf50 100644 --- a/src/nfc.c +++ b/src/nfc.c @@ -25,7 +25,7 @@ static const uint8_t fido_version_fido2[] PROGMEM_MARKER = "FIDO_2_0"; * @param dev The device to receive data from. * @param buf The buffer to write the received data to. * @param len The length of the buffer. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int rx_init(fido_dev_t *dev, unsigned char *buf, const size_t len) { @@ -69,7 +69,7 @@ static int rx_init(fido_dev_t *dev, unsigned char *buf, const size_t len) * @param sw The buffer to write the status word to. * @param buf A pointer to a pointer to a buffer where the received data is located. The pointer to the buffer will be advanced. * @param count The remaining length of the buffer, will be reduced. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int rx_apdu(fido_dev_t *dev, uint8_t sw[2], unsigned char **buf, size_t *count) { uint8_t f[256 + 2]; @@ -99,7 +99,7 @@ static int rx_apdu(fido_dev_t *dev, uint8_t sw[2], unsigned char **buf, size_t * * * @param dev The device to transmit data to. * @param count The amount of data expected to receive. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int tx_get_response(fido_dev_t *dev, uint8_t count) { @@ -165,7 +165,7 @@ static int rx_msg(fido_dev_t *dev, unsigned char *buf, const size_t len) { * @param dev The device to receive data from. * @param buf The buffer to write the received data to. * @param len The length of the buffer. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int rx_cbor(fido_dev_t *dev, unsigned char *buf, const size_t count) { int r; @@ -183,7 +183,7 @@ static int rx_cbor(fido_dev_t *dev, unsigned char *buf, const size_t count) { * @param cmd The CTAP command that was executed. * @param buf The buffer to write the response to. * @param len The length of the buffer. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int nfc_rx(struct fido_dev *dev, const uint8_t cmd, unsigned char *buf, const size_t len) { switch (cmd) { @@ -207,7 +207,7 @@ static int nfc_rx(struct fido_dev *dev, const uint8_t cmd, unsigned char *buf, c * @param payload The payload to send. * @param payload_len The length of the payload. * @param cla_flags The ISO7816 class flags to use. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int tx_short_apdu( fido_dev_t *dev, @@ -260,7 +260,7 @@ static int tx_short_apdu( * * @param dev The device to receive data from. * @param apdu The ISO7816 APDU to send. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int nfc_do_tx(fido_dev_t *dev, const iso7816_apdu_t *apdu) { uint16_t apdu_len = apdu->payload_len; @@ -291,7 +291,7 @@ static int nfc_do_tx(fido_dev_t *dev, const iso7816_apdu_t *apdu) { * @param cmd The CTAP command. * @param buf The payload to send. * @param len The length of the payload. - * @return int FIDO_OK when the operation was successful. + * @return int FIDO_OK if the operation was successful. */ static int nfc_tx(struct fido_dev *dev, const uint8_t cmd, const unsigned char *buf, const size_t len) { iso7816_apdu_t apdu;