*
* @file webauthn-hal.h
* @version 1.0
- * @brief APIs for hardware abrstraction layer of WebAuthn Authenticator.
+ * @brief APIs for hardware abstraction layer of WebAuthn Authenticator.
*/
#ifndef __WEBAUTHN_HAL__
#define __WEBAUTHN_HAL__
#define WEBAUTHN_HAL_API __attribute__((visibility("default")))
/**
- * @brief Library path of the plugin implemenation for hybrid transport
+ * @brief Library path of the plugin implementation for hybrid transport
*/
#define WAH_PLUGIN_SO_PATH_HYBRID HYBRID_PLUGIN_SO_PATH
* @{
*/
-#define WATUH_API_VERSION_NUMBER 0x00000001
+#define WAUTHN_API_VERSION_NUMBER 0x00000001
/**
* @brief WebAuthn Errors.
* @remarks Multiple transport values can be combined using bit-wise operation.
*/
typedef enum __wauthn_authenticator_transport {
- WAUTHN_TRANSPORT_NONE = 0x00000000, /**< No tranport specificed */
+ WAUTHN_TRANSPORT_NONE = 0x00000000, /**< No transport specified */
WAUTHN_TRANSPORT_USB = 0x00000001, /**< "usb" */
WAUTHN_TRANSPORT_NFC = 0x00000002, /**< "nfc" */
WAUTHN_TRANSPORT_BLE = 0x00000004, /**< "ble" */
* https://www.w3.org/TR/webauthn-3/#authenticatorattestationresponse
*
* @see wauthn_make_credential()
- * @see #wauthn_pubkey_credential_attestaion_s
+ * @see #wauthn_pubkey_credential_attestation_s
* @see #wauthn_authenticator_transport_e
* @see #wauthn_cose_algorithm_e
*/
} wauthn_authenticator_attestation_response_s;
/**
- * @brief The structure for response of wauthn_get_assersion.
+ * @brief The structure for response of wauthn_get_assertion.
* @since_tizen 9.0
*
* @remarks Refer to the following W3C specification for more information.
* https://www.w3.org/TR/webauthn-3/#authenticatorassertionresponse
*
- * @see wauthn_get_assersion()
+ * @see wauthn_get_assertion()
* @see #wauthn_pubkey_credential_assertion_s
*/
typedef struct __wauthn_authenticator_assertion_response {
size_t size; /**<
the number of params */
wauthn_pubkey_cred_param_s *params; /**<
- the sequenece of #wauthn_pubkey_cred_param_s */
+ the sequence of #wauthn_pubkey_cred_param_s */
} wauthn_pubkey_cred_params_s;
/**
size_t size; /**<
the number of descriptors */
wauthn_pubkey_cred_descriptor_s *descriptors; /**<
- the sequenece of #wauthn_pubkey_cred_descriptor_s */
+ the sequence of #wauthn_pubkey_cred_descriptor_s */
} wauthn_pubkey_cred_descriptors_s;
/**
size_t size; /**<
the number of extensions */
wauthn_authentication_ext_s *extensions; /**<
- the sequenece of #wauthn_authentication_ext_s */
+ the sequence of #wauthn_authentication_ext_s */
} wauthn_authentication_exts_s;
/**
wauthn_authenticator_attachment_e attachment; /**<
Authenticator attachment modality*/
wauthn_resident_key_requirement_e resident_key; /**<
- Specifies the extent to which the Relying Party desires to create a client-side discoverable credentialy*/
+ Specifies the extent to which the Relying Party desires to create a client-side discoverable credential*/
bool require_resident_key; /**<
Relying Parties SHOULD set it to true if, and only if, residentKey is set to required.*/
wauthn_user_verification_requirement_e user_verification; /**<
size_t size; /**<
the number of hints */
wauthn_pubkey_cred_hint_e *hints; /**<
- the sequenece of #wauthn_pubkey_cred_hint_e */
+ the sequence of #wauthn_pubkey_cred_hint_e */
} wauthn_pubkey_cred_hints_s;
/**
* @brief The structure for a linked device data.
* @since_tizen 9.0
*
- * @remarks The linked device data is used for state assisited transaction.
- * From the successful QR initiated transcation, the linked device data
+ * @remarks The linked device data is used for state assisted transaction.
+ * From the successful QR initiated transaction, the linked device data
* might be returned from an authenticator to a webauthn client
- * via #wauthn_pubkey_credential_attestaion_s or #wauthn_pubkey_credential_assertion_s.
+ * via #wauthn_pubkey_credential_attestation_s or #wauthn_pubkey_credential_assertion_s.
* Then the client can store the linked device data and use it in the next call
* for #wauthn_pubkey_cred_creation_options_s or #wauthn_pubkey_cred_request_options_s.
- * Then the stated assisted transction will start instead of QR initiated transtion.
+ * Then the stated assisted transaction will start instead of QR initiated transaction.
*
* @remarks For more information, find a section with the keyword, "linking map",
* from the following specification.
size_t size; /**<
the number of attestation_formats */
wauthn_const_buffer_s *attestation_formats; /**<
- the sequenece of #wauthn_const_buffer_s */
+ the sequence of #wauthn_const_buffer_s */
} wauthn_attestation_formats_s;
/**
* @see #wauthn_authentication_exts_s
* @see #wauthn_hybrid_linked_data_s
*/
-typedef struct __wauthn_pubkey_credential_attestaion {
+typedef struct __wauthn_pubkey_credential_attestation {
wauthn_const_buffer_s *id; /**<
The based64url encoding of credential’s identifier.*/
wauthn_pubkey_cred_type_e type; /**<
upon the Relying Party's invocation of #wauthn_make_credential(). (optional)*/
wauthn_hybrid_linked_data_s *linked_device; /**<
Linked Device Connection Info (optional) */
-} wauthn_pubkey_credential_attestaion_s;
+} wauthn_pubkey_credential_attestation_s;
/**
* @brief The structure for a publickey_credential response for wauthn_get_assertion().
* @brief Invoked when the response for the make credential request need to be returned.
* @since_tizen 9.0
* @param[in] pubkey_cred The publickey credential contains response data.
- * @param[in] result The result of the #wauthn_make_credential reqeust.
+ * @param[in] result The result of the #wauthn_make_credential request.
* #WAUTHN_ERROR_NONE if the request is completed well,
* #WAUTHN_ERROR_CANCELLED if the request is cancelled by #wauthn_cancel request.
* @param[in] user_data The user data passed from the callback structure, #wauthn_mc_callbacks_s.
* @see #wauthn_mc_callbacks_s
- * @see #wauthn_pubkey_credential_attestaion_s
+ * @see #wauthn_pubkey_credential_attestation_s
*/
-typedef void (*wauthn_cb_mc_on_response)(const wauthn_pubkey_credential_attestaion_s *pubkey_cred,
+typedef void (*wauthn_cb_mc_on_response)(const wauthn_pubkey_credential_attestation_s *pubkey_cred,
wauthn_error_e result,
void *user_data);
* @brief Invoked when the response for the get assertion request need to be returned.
* @since_tizen 9.0
* @param[in] pubkey_cred The publickey credential contains response data.
- * @param[in] result The result of the reqeust.
+ * @param[in] result The result of the request.
* #WAUTHN_ERROR_NONE if the request is completed well,
* #WAUTHN_ERROR_CANCELLED if the request is cancelled by #wauthn_cancel request.
* @param[in] user_data The user data passed from the callback structure, #wauthn_ga_callbacks_s.
* @remarks This API must be called before other APIs are called.
*
* @param[in] api_version_number API version number to set.
- * Use #WATUH_API_VERSION_NUMBER as an input.
+ * Use #WAUTHN_API_VERSION_NUMBER as an input.
*
* @return @c 0 on success,
* otherwise a negative error value
public:
typedef wauthn_pubkey_cred_creation_options_s Options;
typedef wauthn_mc_callbacks_s Callbacks;
- typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+ typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
explicit ClientRequestMC() : ClientRequest(WebAuthnCall::MAKE_CREDENTIAL)
{
SET(COMMON_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
SET(COMMON_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/wauth-error.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/wauthn-error.cpp
${CMAKE_CURRENT_SOURCE_DIR}/singleton.cpp
${CMAKE_CURRENT_SOURCE_DIR}/webauthn-log.cpp
${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp
char *buffer = NULL;
for (;;) {
- // Add one extra characted for end of string null value
+ // Add one extra character for end of string null value
char *newBuffer = static_cast<char *>(::realloc(buffer, size + 1));
if (!newBuffer) {
case ERANGE:
if (size <= (sizeof(size_t) >> 1)){
- // Incease buffer size and retry
+ // Increase buffer size and retry
size <<= 1;
continue;
}
*
* @file message-buffer.h
* @version 1.0
- * @brief Implementatin of MessageBuffer.
+ * @brief Implementation of MessageBuffer.
*/
#pragma once
// For struct body itself
void WAuthnCtypeSerializer::serializeStructBody(IStream& stream, const void *data, size_t struct_size) {
- size_t lengh = (data == nullptr) ? 0 : struct_size;
- serialize(stream, reinterpret_cast<const unsigned char*>(data), lengh);
+ size_t length = (data == nullptr) ? 0 : struct_size;
+ serialize(stream, reinterpret_cast<const unsigned char*>(data), length);
}
void WAuthnCtypeSerializer::deserializeStructBody(IStream& stream, void **data, size_t struct_size) {
if (data == nullptr)
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_const_buffer_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_const_buffer_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->data, data->size);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_const_buffer_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void**>(data), sizeof(wauthn_const_buffer_s));
__checkValidity(*data);
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->data), &((*data)->size));
}
// For wauthn_authenticator_attestation_response_s
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_attestation_response_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_attestation_response_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->client_data_json);
serialize(stream, data->attestation_object);
serialize(stream, data->authenticator_data);
serialize(stream, data->subject_pubkey_info);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_attestation_response_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_attestation_response_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->client_data_json));
deserialize(stream, &((*data)->attestation_object));
deserialize(stream, &((*data)->authenticator_data));
// For wauthn_authenticator_assertion_response_s
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_assertion_response_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_assertion_response_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->client_data_json);
serialize(stream, data->authenticator_data);
serialize(stream, data->signature);
serialize(stream, data->attestation_object);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_assertion_response_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_assertion_response_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->client_data_json));
deserialize(stream, &((*data)->authenticator_data));
deserialize(stream, &((*data)->signature));
// For wauthn_rp_entity_s
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_rp_entity_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_rp_entity_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->name);
serialize(stream, data->id);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_rp_entity_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_rp_entity_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->name));
deserialize(stream, &((*data)->id));
}
// For wauthn_user_entity_s
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_user_entity_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_user_entity_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->name);
serialize(stream, data->id);
serialize(stream, data->display_name);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_user_entity_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_user_entity_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->name));
deserialize(stream, &((*data)->id));
deserialize(stream, &((*data)->display_name));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_param_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_param_s));
// No pointers in struct
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_param_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_param_s));
__checkValidity(*data);
// No pointers in struct
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_params_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_params_s));
if (data == nullptr)
return;
__serializeArrayItem(stream, reinterpret_cast<const void *>(data->params + i), sizeof(wauthn_pubkey_cred_params_s));
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_params_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_params_s));
if (*data == nullptr)
return;
(*data)->params = nullptr;
}
__checkValidity(*data);
- // Deseriallize array
+ // Deserialize array
wauthn_pubkey_cred_param_s* tmp;
for(size_t i=0; i < (*data)->size; i++ ) {
__deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_params_s));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_descriptor_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_descriptor_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
__serializePointerContents(stream, data);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_descriptor_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_descriptor_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
__deserializePointerContents(stream, *data);
}
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_descriptors_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_descriptors_s));
if (data == nullptr)
return;
// Serialize array
for(size_t i=0; i < data->size; i++ )
__serializeArrayItem(stream, reinterpret_cast<const void *>(data->descriptors + i), sizeof(wauthn_pubkey_cred_descriptor_s));
- // Seriallize the contents of pointers in struct array
+ // Serialize the contents of pointers in struct array
for(size_t i=0; i < data->size; i++ )
__serializePointerContents(stream, data->descriptors + i);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_descriptors_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_descriptors_s));
if (*data == nullptr)
return;
(*data)->descriptors = nullptr;
return;
}
- // Deseriallize array
+ // Deserialize array
wauthn_pubkey_cred_descriptor_s* tmp;
for(size_t i=0; i < (*data)->size; i++ ) {
__deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_descriptor_s));
if (i == 0) // set pointer to the first parameter
(*data)->descriptors = tmp;
}
- // Deseriallize the contents of pointers in struct array
+ // Deserialize the contents of pointers in struct array
for(size_t i=0; i < (*data)->size; i++ )
__deserializePointerContents(stream, (*data)->descriptors + i);
}
WAuthnCtypeSerializer::deserialize(stream, &(data->extension_value));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authentication_ext_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authentication_ext_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
__serializePointerContents(stream, data);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authentication_ext_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authentication_ext_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
__deserializePointerContents(stream, *data);
}
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authentication_exts_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authentication_exts_s));
if (data == nullptr)
return;
// Serialize array
for(size_t i=0; i < data->size; i++ )
__serializeArrayItem(stream, reinterpret_cast<const void *>(data->extensions + i), sizeof(wauthn_authentication_ext_s));
- // Seriallize the contents of pointers in struct array
+ // Serialize the contents of pointers in struct array
for(size_t i=0; i < data->size; i++ )
__serializePointerContents(stream, data->extensions + i);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authentication_exts_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authentication_exts_s));
if (*data == nullptr)
return;
(*data)->extensions = nullptr;
return;
}
- // Deseriallize array
+ // Deserialize array
wauthn_authentication_ext_s* tmp;
for(size_t i=0; i < (*data)->size; i++ ) {
__deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_authentication_ext_s));
if (i == 0) // set pointer to the first parameter
(*data)->extensions = tmp;
}
- // Deseriallize the contents of pointers in struct array
+ // Deserialize the contents of pointers in struct array
for(size_t i=0; i < (*data)->size; i++ )
__deserializePointerContents(stream, (*data)->extensions + i);
}
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_sel_cri_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_sel_cri_s));
// No pointers in struct
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_sel_cri_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_sel_cri_s));
__checkValidity(*data);
// No pointers in struct
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_hints_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_hints_s));
if (data == nullptr)
return;
__serializeArrayItem(stream, reinterpret_cast<const void *>(data->hints + i), sizeof(wauthn_pubkey_cred_hint_e));
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_hints_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_hints_s));
if (*data == nullptr)
return;
return;
}
__checkValidity(*data);
- // Deseriallize array
+ // Deserialize array
wauthn_pubkey_cred_hint_e* tmp;
for(size_t i=0; i < (*data)->size; i++ ) {
__deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_hint_e));
// For wauthn_hybrid_linked_data_s
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_hybrid_linked_data_s* data) {
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_hybrid_linked_data_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->contact_id);
serialize(stream, data->link_id);
serialize(stream, data->link_secret);
serialize(stream, data->tunnel_server_domain);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_hybrid_linked_data_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_hybrid_linked_data_s));
if (*data == nullptr)
return;
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->contact_id));
deserialize(stream, &((*data)->link_id));
deserialize(stream, &((*data)->link_secret));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_attestation_formats_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_attestation_formats_s));
if (data == nullptr)
return;
// Serialize array
for(size_t i=0; i < data->size; i++ )
__serializeArrayItem(stream, reinterpret_cast<const void *>(data->attestation_formats + i), sizeof(wauthn_const_buffer_s));
- // Seriallize the contents of pointers in struct array
+ // Serialize the contents of pointers in struct array
for(size_t i=0; i < data->size; i++ )
__serializePointerContents(stream, data->attestation_formats + i);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_attestation_formats_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_attestation_formats_s));
if (*data == nullptr)
return;
return;
}
__checkValidity(*data);
- // Deseriallize array
+ // Deserialize array
wauthn_const_buffer_s* tmp;
for(size_t i=0; i < (*data)->size; i++ ) {
__deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_const_buffer_s));
if (i == 0) // set pointer to the first parameter
(*data)->attestation_formats = tmp;
}
- // Deseriallize the contents of pointers in struct array
+ // Deserialize the contents of pointers in struct array
for(size_t i=0; i < (*data)->size; i++ )
__deserializePointerContents(stream, (*data)->attestation_formats + i);
}
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_creation_options_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_creation_options_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->rp);
serialize(stream, data->user);
serialize(stream, data->pubkey_cred_params);
serialize(stream, data->linked_device);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_creation_options_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_creation_options_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->rp));
deserialize(stream, &((*data)->user));
deserialize(stream, &((*data)->pubkey_cred_params));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_request_options_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_request_options_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->rpId);
serialize(stream, data->allow_credentials);
serialize(stream, data->hints);
serialize(stream, data->linked_device);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_request_options_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_request_options_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->rpId));
deserialize(stream, &((*data)->allow_credentials));
deserialize(stream, &((*data)->hints));
deserialize(stream, &((*data)->linked_device));
}
-// For wauthn_pubkey_credential_attestaion_s
-void __checkValidity(const wauthn_pubkey_credential_attestaion_s* data) {
+// For wauthn_pubkey_credential_attestation_s
+void __checkValidity(const wauthn_pubkey_credential_attestation_s* data) {
if (data == nullptr)
return;
__checkValidity(data->type);
__checkValidity(data->authenticator_attachment);
}
-void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data) {
+void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data) {
__checkValidity(data);
- // Seriallize struct itself
- serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_attestaion_s));
+ // Serialize struct itself
+ serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_attestation_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->id);
serialize(stream, data->rawId);
serialize(stream, data->response);
serialize(stream, data->extensions);
serialize(stream, data->linked_device);
}
-void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_attestaion_s** data) {
- // Deseriallize struct itself
- deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_attestaion_s));
+void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_attestation_s** data) {
+ // Deserialize struct itself
+ deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_attestation_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->id));
deserialize(stream, &((*data)->rawId));
deserialize(stream, &((*data)->response));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_assertion_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_assertion_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->id);
serialize(stream, data->rawId);
serialize(stream, data->response);
serialize(stream, data->linked_device);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_assertion_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_assertion_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->id));
deserialize(stream, &((*data)->rawId));
deserialize(stream, &((*data)->response));
}
void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_client_data_s* data) {
__checkValidity(data);
- // Seriallize struct itself
+ // Serialize struct itself
serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_client_data_s));
if (data == nullptr)
return;
- // Seriallize the contents of struct's pointers
+ // Serialize the contents of struct's pointers
serialize(stream, data->client_data_json);
}
void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_client_data_s** data) {
- // Deseriallize struct itself
+ // Deserialize struct itself
deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_client_data_s));
if (*data == nullptr)
return;
__checkValidity(*data);
- // Deseriallize the contents of struct's pointers
+ // Deserialize the contents of struct's pointers
deserialize(stream, &((*data)->client_data_json));
}
const size_t MAX_BUFFER_SIZE = 128 * 1024 * 1024; // 128 MB
const size_t MAX_ARRAY_COUNT = 1024;
-// Serialize & Deserialze struct types in wetauthn-types.h
+// Serialize & Deserialize struct types in webauthn-types.h
struct WAuthnCtypeSerializer {
private:
static void serializeStructBody(IStream& stream, const void *data, size_t struct_size);
static void serialize(IStream& stream, const wauthn_pubkey_cred_request_options_s* data);
static void deserialize(IStream& stream, wauthn_pubkey_cred_request_options_s** data);
- static void serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data);
- static void deserialize(IStream& stream, wauthn_pubkey_credential_attestaion_s** data);
+ static void serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data);
+ static void deserialize(IStream& stream, wauthn_pubkey_credential_attestation_s** data);
static void serialize(IStream& stream, const wauthn_pubkey_credential_assertion_s* data);
static void deserialize(IStream& stream, wauthn_pubkey_credential_assertion_s** data);
{
WAuthnCtypeSerializer::serialize(stream, data);
}
- // For wauthn_pubkey_credential_attestaion_s
- static void Serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data)
+ // For wauthn_pubkey_credential_attestation_s
+ static void Serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data)
{
WAuthnCtypeSerializer::serialize(stream, data);
}
// 2. The returned data(more exactly *data) points to somewhere of m_buffer of MessageBuffer.
// So the returned data is only valid while the stream is alive.
//###########################################################################################
- // This convers all other C types.
+ // This converts all other C types.
template<typename T>
static void Deserialize(IStream& stream, T** data)
{
//
// Note:
//
- // To remove posibility of instantiating directly Class,
+ // To remove possibility of instantiating directly Class,
// make Class' default constructor protected
//
+++ /dev/null
-/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/*
- * @file wauth-error.cpp
- * @version 1.0
- * @brief Error related functions
- */
-
-#include <webauthn.h>
-
-
-#define WAUTHN_CODE_DESCRIBE(name) case name: return #name
-
-const char * wauthn_error_to_string(int error) {
- switch (error) {
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NONE);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_UNKNOWN);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_PARAMETER);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_PERMISSION_DENIED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_SUPPORTED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_ALLOWED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_STATE);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ENCODING_FAILED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_SOCKET);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NO_SUCH_SERVICE);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ACCESS_DENIED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_MEMORY);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_CANCELLED);
- WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_TIMEOUT);
- default: return "Code not defined";
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file wauthn-error.cpp
+ * @version 1.0
+ * @brief Error related functions
+ */
+
+#include <webauthn.h>
+
+
+#define WAUTHN_CODE_DESCRIBE(name) case name: return #name
+
+const char * wauthn_error_to_string(int error) {
+ switch (error) {
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NONE);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_UNKNOWN);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_PARAMETER);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_PERMISSION_DENIED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_SUPPORTED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_ALLOWED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_STATE);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ENCODING_FAILED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_SOCKET);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NO_SUCH_SERVICE);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ACCESS_DENIED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_MEMORY);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_CANCELLED);
+ WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_TIMEOUT);
+ default: return "Code not defined";
+ }
+}
} catch (const std::exception &e) {
LogError("Error in starting service, details:\n" << e.what());
} catch (...) {
- LogError("Error in starting service, unknown exception occured");
+ LogError("Error in starting service, unknown exception occurred");
}
return EXIT_FAILURE;
}
#endif
LogDebug("Stopping server..");
return ret;
-}
\ No newline at end of file
+}
user_data_s *userData = GetUserData(user_data);
if (userData != nullptr)
{
- MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+ MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
Serialization::Serialize(buffer, result, pubkey_cred);
- userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+ userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
}
else
{
public:
typedef wauthn_pubkey_cred_creation_options_s Options;
typedef wauthn_mc_callbacks_s Callbacks;
- typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+ typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
std::string GetAPI() {return m_API;}
user_data_s *userData = GetUserData(user_data);
if (userData != nullptr)
{
- MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+ MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
Serialization::Serialize(buffer, result, pubkey_cred);
- userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+ userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
}
else
{
user_data_s *userData = GetUserData(user_data);
if (userData != nullptr && qr_contents != nullptr)
{
- MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+ MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
Serialization::Serialize(buffer, WAUTHN_ERROR_NONE, std::string(qr_contents));
- userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+ userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
}
else
LogError("Cannot write qr_contents to client");
namespace WA {
-SocketManager *GenericService::GetSocketmanager()
+SocketManager *GenericService::GetSocketManager()
{
return this->m_serviceManager;
}
void ProcessEvent(Event &&msg);
/**
- * Get the sockekmanager
+ * Get the socket manager
* @return The object of socket manager
*/
- SocketManager *GetSocketmanager();
+ SocketManager *GetSocketManager();
virtual SocketManager::ServiceDescription GetServiceDescription() = 0;
return;
}
else if (std::numeric_limits<int>::max() - SD_VECTOR_INCREASE_SIZE <= client) {
- LogError("An integer overflow my occur due to addtion between fd("
+ LogError("An integer overflow my occur due to addition between fd("
<< client << ")and SD_VECTOR_INCREASE_SIZE("
<< SD_VECTOR_INCREASE_SIZE << ")");
return;
int n = sd_listen_fds(0);
if (n < 0) {
- LogError("Error in sd_listend_fds");
- ThrowMsg(Exception::InitFailed, "Error in sd_listend_fds");
+ LogError("Error in sd_listen_fds");
+ ThrowMsg(Exception::InitFailed, "Error in sd_listen_fds");
}
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; ++fd) {
desc.buffer = std::move(buffer);
desc.buffer.ModeOutput();
- LogDebug("Calling ReadyforWrite");
+ LogDebug("Calling ReadyForWrite");
ReadyForWrite(connectionID.sock);
}
public:
typedef wauthn_pubkey_cred_creation_options_s Options;
typedef wauthn_mc_callbacks_s Callbacks;
- typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+ typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
explicit TestClientRequestMC() : TestClientRequest(WebAuthnCall::MAKE_CREDENTIAL) {}
};
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
{
int ret = 0;
try{
- FileLocker fileLocker("/invalidpath/webauthn-test.lock", true);
+ FileLocker fileLocker("/invalid-path/webauthn-test.lock", true);
} catch (FileLockerException::LockFailed &e)
{
ret = 1;
};
template<typename T, typename U>
-void __serializeDeserializeWtihWAuthnCtypeSerializer(MessageBuffer& buffer, T data, U deserialized)
+void __serializeDeserializeWithWAuthnCtypeSerializer(MessageBuffer& buffer, T data, U deserialized)
{
buffer.InitForStreaming();
WAuthnCtypeSerializer::serialize(buffer, data);
}
template<typename T, typename F>
-void __testSerialization(T data, F cmpfunction)
+void __testSerialization(T data, F cmpFunction)
{
MessageBuffer buffer0;
T deserialized0;
- __serializeDeserializeWtihWAuthnCtypeSerializer(buffer0, data, &deserialized0);
- EXPECT_EQ(cmpfunction(data, deserialized0), true);
+ __serializeDeserializeWithWAuthnCtypeSerializer(buffer0, data, &deserialized0);
+ EXPECT_EQ(cmpFunction(data, deserialized0), true);
MessageBuffer buffer1;
T deserialized1;
__serializeDeserializeStruct(buffer1, data, &deserialized1);
- EXPECT_EQ(cmpfunction(data, deserialized1), true);
+ EXPECT_EQ(cmpFunction(data, deserialized1), true);
}
void __fillBufferWithTestCommonData(MessageBuffer& buffer,
TEST_F(WAuthnSerializationTest, unsignedCharPtr_P)
{
unsigned char data[13] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,};
- unsigned char *nulldata = nullptr;
+ unsigned char *nullData = nullptr;
__testUnsignedCharPtr(data, sizeof(data));
- __testUnsignedCharPtr(nulldata, 0);
+ __testUnsignedCharPtr(nullData, 0);
}
TEST_F(WAuthnSerializationTest, unsignedCharPtr_N1)
{
{
const char *data = "This is a test data.";
const char *size0data ="";
- const char *nulldata = nullptr;
+ const char *nullData = nullptr;
__testSerialization(data, __compareCstring);
__testSerialization(size0data, __compareCstring);
- __testSerialization(nulldata, __compareCstring);
+ __testSerialization(nullData, __compareCstring);
}
TEST_F(WAuthnSerializationTest, CharPtr_N1)
{// serialize: for too large length
__testDeserializeForTooLongLength(deserialized);
}
TEST_F(WAuthnSerializationTest, CharPtr_N3)
-{// deserialize: for invalid C String lenght
+{// deserialize: for invalid C String length
// strlen(data) = 4, length in buffer stream = 8
unsigned char data[8] = {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00};
MessageBuffer buffer;
TEST_F(WAuthnSerializationTest, wauthn_rp_entity_s_P)
{
__testSerialization(&TestCommonData::rpEntity, __compareWAuthnRpEntityS);
- __testSerialization(&TestCommonData::emptyRpEntiy, __compareWAuthnRpEntityS);
+ __testSerialization(&TestCommonData::emptyRpEntity, __compareWAuthnRpEntityS);
__testSerialization(static_cast<wauthn_rp_entity_s *>(nullptr), __compareWAuthnRpEntityS);
}
TEST_F(WAuthnSerializationTest, wauthn_rp_entity_s_N1)
}
TEST_F(WAuthnSerializationTest, wauthn_hybrid_linked_data_s_P)
{
- __testSerialization(&TestCommonData::hybirdLinkedData, __compareWAuthnHybridLinkedDataS);
- __testSerialization(&TestCommonData::emptyHybirdLinkedData, __compareWAuthnHybridLinkedDataS);
+ __testSerialization(&TestCommonData::hybridLinkedData, __compareWAuthnHybridLinkedDataS);
+ __testSerialization(&TestCommonData::emptyHybridLinkedData, __compareWAuthnHybridLinkedDataS);
__testSerialization(static_cast<wauthn_hybrid_linked_data_s *>(nullptr), __compareWAuthnHybridLinkedDataS);
}
TEST_F(WAuthnSerializationTest, wauthn_hybrid_linked_data_s_N1)
__testDeserializeInvalidMember(data);
}
-bool __compareWAuthnPubkeyCredentialAttestionS(const wauthn_pubkey_credential_attestaion_s *expected,
- const wauthn_pubkey_credential_attestaion_s *actual)
+bool __compareWAuthnPubkeyCredentialAttestationS(const wauthn_pubkey_credential_attestation_s *expected,
+ const wauthn_pubkey_credential_attestation_s *actual)
{
if (actual == nullptr || expected == nullptr)
return (actual == expected);
return false;
return true;
}
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_P)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_P)
{
__testSerialization(&TestCommonData::pubkeyCredentialAttestation,
- __compareWAuthnPubkeyCredentialAttestionS);
+ __compareWAuthnPubkeyCredentialAttestationS);
__testSerialization(&TestCommonData::emptyPubkeyCredentialAttestation,
- __compareWAuthnPubkeyCredentialAttestionS);
- __testSerialization(static_cast<wauthn_pubkey_credential_attestaion_s *>(nullptr),
- __compareWAuthnPubkeyCredentialAttestionS);
+ __compareWAuthnPubkeyCredentialAttestationS);
+ __testSerialization(static_cast<wauthn_pubkey_credential_attestation_s *>(nullptr),
+ __compareWAuthnPubkeyCredentialAttestationS);
}
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N1)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N1)
{// serialize: invalid member
- wauthn_pubkey_credential_attestaion_s data1 = TestCommonData::pubkeyCredentialAttestation;
+ wauthn_pubkey_credential_attestation_s data1 = TestCommonData::pubkeyCredentialAttestation;
data1.type = static_cast<wauthn_pubkey_cred_type_e>(0x00FFFFFF);
__testSerializeForInvalidMember(&data1);
- wauthn_pubkey_credential_attestaion_s data2 = TestCommonData::pubkeyCredentialAttestation;
+ wauthn_pubkey_credential_attestation_s data2 = TestCommonData::pubkeyCredentialAttestation;
data2.authenticator_attachment = static_cast<wauthn_authenticator_attachment_e>(0x00FFFFFF);
__testSerializeForInvalidMember(&data2);
}
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N2)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N2)
{// deserialize: for too large length
- wauthn_pubkey_credential_attestaion_s *deserialized = nullptr;
+ wauthn_pubkey_credential_attestation_s *deserialized = nullptr;
__testDeserializeForTooLongLength(deserialized);
}
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N3)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N3)
{// deserialize: for invalid type
- wauthn_pubkey_credential_attestaion_s data = TestCommonData::pubkeyCredentialAttestation;
+ wauthn_pubkey_credential_attestation_s data = TestCommonData::pubkeyCredentialAttestation;
data.type = static_cast<wauthn_pubkey_cred_type_e>(0x00FFFFFF);
__testDeserializeInvalidMember(data);
}
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N4)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N4)
{// deserialize: for invalid authenticator_attachment
- wauthn_pubkey_credential_attestaion_s data = TestCommonData::pubkeyCredentialAttestation;
+ wauthn_pubkey_credential_attestation_s data = TestCommonData::pubkeyCredentialAttestation;
data.authenticator_attachment = static_cast<wauthn_authenticator_attachment_e>(0x00FFFFFF);
__testDeserializeInvalidMember(data);
}
}
template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerialization(T first, U second, FT cmpfirst, FU cmpsecond,
+void __testMultipleSerialization(T first, U second, FT cmp_first, FU cmp_second,
T deserialized_first, U deserialized_second)
{
MessageBuffer buffer;
buffer.ModeStreaming();
Deserialization::Deserialize(buffer, &deserialized_first, &deserialized_second);
- EXPECT_EQ(cmpfirst(first, deserialized_first), true);
- EXPECT_EQ(cmpsecond(second, deserialized_second), true);
+ EXPECT_EQ(cmp_first(first, deserialized_first), true);
+ EXPECT_EQ(cmp_second(second, deserialized_second), true);
}
template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerialization(T first, U second, FT cmpfirst, FU cmpsecond)
+void __testMultipleSerialization(T first, U second, FT cmp_first, FU cmp_second)
{
T deserialized_first = nullptr;
U deserialized_second = nullptr;
- __testMultipleSerialization(first, second, cmpfirst, cmpsecond,
+ __testMultipleSerialization(first, second, cmp_first, cmp_second,
deserialized_first, deserialized_second);
}
template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerializationWAuthErrorE(T first, U second, FT cmpfirst, FU cmpsecond)
+void __testMultipleSerializationWAuthErrorE(T first, U second, FT cmp_first, FU cmp_second)
{
T deserialized_first = nullptr;
U deserialized_second = WAUTHN_ERROR_NONE;
- __testMultipleSerialization(first, second, cmpfirst, cmpsecond,
+ __testMultipleSerialization(first, second, cmp_first, cmp_second,
deserialized_first, deserialized_second);
}
TEST_F(WAuthnSerializationTest, multiple_serialization_mcres_P)
{
- wauthn_pubkey_credential_attestaion_s *pubkeyCred = &TestCommonData::pubkeyCredentialAttestation;
+ wauthn_pubkey_credential_attestation_s *pubkeyCred = &TestCommonData::pubkeyCredentialAttestation;
wauthn_error_e result = WAUTHN_ERROR_PERMISSION_DENIED;
__testMultipleSerializationWAuthErrorE(pubkeyCred, result,
- __compareWAuthnPubkeyCredentialAttestionS, __compareWAuthErrorE);
+ __compareWAuthnPubkeyCredentialAttestationS, __compareWAuthErrorE);
}
TEST_F(WAuthnSerializationTest, multiple_serialization_gares_P)
sleep(1);
ret = 0;
} catch (...) {
- std::cout << "Error in starting service, unknown exception occured" << std::endl;
+ std::cout << "Error in starting service, unknown exception occurred" << std::endl;
ret = -1;
}
EXPECT_EQ(ret, 0);
}
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn
const char *name = "test name";
const char *id = "test id";
wauthn_rp_entity_s rpEntity = {name, id};
- wauthn_rp_entity_s emptyRpEntiy = {nullptr, nullptr};
+ wauthn_rp_entity_s emptyRpEntity = {nullptr, nullptr};
unsigned char idRaw[06] = {0x01, 0x02, 0x03, 0x04, };
wauthn_const_buffer_s bufferId = {idRaw, sizeof(idRaw)};
wauthn_const_buffer_s authenticatorName = {authenticatorNameRaw, sizeof(authenticatorNameRaw)};
wauthn_const_buffer_s authPubkey = {authPubkeyRaw, sizeof(authPubkeyRaw)};
wauthn_const_buffer_s tunnelServerDomain = {tunnelServerDomainRaw, sizeof(tunnelServerDomainRaw)};
- wauthn_hybrid_linked_data_s hybirdLinkedData = {&contactId, &linkId, &linkSecret, &authenticatorPubkey,
+ wauthn_hybrid_linked_data_s hybridLinkedData = {&contactId, &linkId, &linkSecret, &authenticatorPubkey,
&authenticatorName, &signature, &authPubkey, &tunnelServerDomain};
- wauthn_hybrid_linked_data_s emptyHybirdLinkedData = {nullptr, nullptr, nullptr, nullptr,
+ wauthn_hybrid_linked_data_s emptyHybridLinkedData = {nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr};
unsigned char bufferRaw0[06] = {0x01, 0x02, 0x03, 0x04, };
wauthn_attestation_pref_e attestation = AP_DIRECT;
wauthn_pubkey_cred_creation_options_s pubkeyCredCreationOptions = {&rpEntity, &userEntity,
&pubkeyCredParams2, timeout, &pubkeyCredDescriptors2, &authenticatorSelCri, &pubkeyCredHints2,
- attestation, &attestationFormats1, &authenticationExts2, &hybirdLinkedData};
+ attestation, &attestationFormats1, &authenticationExts2, &hybridLinkedData};
wauthn_pubkey_cred_creation_options_s pubkeyCredCreationOptionsWithQR = {&rpEntity, &userEntity,
&pubkeyCredParams2, timeout, &pubkeyCredDescriptors2, &authenticatorSelCri, &pubkeyCredHints2,
attestation, &attestationFormats1, &authenticationExts2, nullptr};
const char *rpId = "test RP ID";
wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptions = {timeout, const_cast<char *>(rpId),
&pubkeyCredDescriptors2, user_verification, &pubkeyCredHints2, attestation, &attestationFormats1,
- &authenticationExts2, &hybirdLinkedData};
+ &authenticationExts2, &hybridLinkedData};
wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptionsWithQR = {timeout, const_cast<char *>(rpId),
&pubkeyCredDescriptors2, user_verification, &pubkeyCredHints2, attestation, &attestationFormats1,
&authenticationExts2, nullptr};
wauthn_pubkey_cred_request_options_s emptyPubkeyCredRequestOptions = {0, nullptr,
nullptr, UVR_NONE, nullptr, AP_NONE, nullptr, nullptr, nullptr};
- wauthn_pubkey_credential_attestaion_s pubkeyCredentialAttestation = {&bufferId, pubkeyCredType, &bufferId0,
- &authenticatorAttestationResponse, attachment, &authenticationExts2, &hybirdLinkedData};
- wauthn_pubkey_credential_attestaion_s emptyPubkeyCredentialAttestation = {nullptr, pubkeyCredType, nullptr,
+ wauthn_pubkey_credential_attestation_s pubkeyCredentialAttestation = {&bufferId, pubkeyCredType, &bufferId0,
+ &authenticatorAttestationResponse, attachment, &authenticationExts2, &hybridLinkedData};
+ wauthn_pubkey_credential_attestation_s emptyPubkeyCredentialAttestation = {nullptr, pubkeyCredType, nullptr,
nullptr, attachment, nullptr, nullptr};
wauthn_pubkey_credential_assertion_s pubkeyCredentialAssertion = {&bufferId, pubkeyCredType, &bufferId0,
- &authenticatorAssertionResponse, attachment, &authenticationExts2, &hybirdLinkedData};
+ &authenticatorAssertionResponse, attachment, &authenticationExts2, &hybridLinkedData};
wauthn_pubkey_credential_assertion_s emptyPubkeyCredentialAssertion = {nullptr, pubkeyCredType, nullptr,
nullptr, attachment, nullptr, nullptr};
wauthn_client_data_s emptyClientData = {nullptr, hashAlg};
} // namespace TestCommonData
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn
}
inline void test_cb_mc_response(
- const wauthn_pubkey_credential_attestaion_s *pubkey_cred,
+ const wauthn_pubkey_credential_attestation_s *pubkey_cred,
wauthn_error_e result,
void *user_data)
{
extern const char *name;
extern const char *id;
extern wauthn_rp_entity_s rpEntity;
- extern wauthn_rp_entity_s emptyRpEntiy;
+ extern wauthn_rp_entity_s emptyRpEntity;
extern unsigned char idRaw[06];
extern wauthn_const_buffer_s bufferId;
extern wauthn_const_buffer_s authenticatorName;
extern wauthn_const_buffer_s authPubkey;
extern wauthn_const_buffer_s tunnelServerDomain;
- extern wauthn_hybrid_linked_data_s hybirdLinkedData;
- extern wauthn_hybrid_linked_data_s emptyHybirdLinkedData;
+ extern wauthn_hybrid_linked_data_s hybridLinkedData;
+ extern wauthn_hybrid_linked_data_s emptyHybridLinkedData;
extern unsigned char bufferRaw0[06];
extern unsigned char bufferRaw1[16];
extern wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptionsWithQR;
extern wauthn_pubkey_cred_request_options_s emptyPubkeyCredRequestOptions;
- extern wauthn_pubkey_credential_attestaion_s pubkeyCredentialAttestation;
- extern wauthn_pubkey_credential_attestaion_s emptyPubkeyCredentialAttestation;
+ extern wauthn_pubkey_credential_attestation_s pubkeyCredentialAttestation;
+ extern wauthn_pubkey_credential_attestation_s emptyPubkeyCredentialAttestation;
extern wauthn_pubkey_credential_assertion_s pubkeyCredentialAssertion;
extern wauthn_pubkey_credential_assertion_s emptyPubkeyCredentialAssertion;
extern wauthn_client_data_s emptyClientData;
} // namespace TestCommonData
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn