summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/fpsensor/fpsensor.cc (renamed from common/fpsensor/fpsensor.c)29
1 files changed, 20 insertions, 9 deletions
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.cc
index 3e97741705..a4a6eefaa9 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.cc
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include "compile_time_macros.h"
+
+extern "C" {
#include "atomic.h"
#include "clock.h"
#include "common.h"
@@ -25,6 +28,7 @@
#include "trng.h"
#include "util.h"
#include "watchdog.h"
+}
#if !defined(CONFIG_RNG)
#error "fpsensor requires RNG"
@@ -231,7 +235,7 @@ static void fp_process_finger(void)
}
#endif /* HAVE_FP_PRIVATE_DRIVER */
-void fp_task(void)
+extern "C" void fp_task(void)
{
int timeout_us = -1;
@@ -336,8 +340,9 @@ void fp_task(void)
static enum ec_status fp_command_passthru(struct host_cmd_handler_args *args)
{
- const struct ec_params_fp_passthru *params = args->params;
- void *out = args->response;
+ const struct ec_params_fp_passthru *params =
+ static_cast<const ec_params_fp_passthru *>(args->params);
+ uint8_t *out = static_cast<uint8_t *>(args->response);
int rc;
enum ec_status ret = EC_RES_SUCCESS;
@@ -369,7 +374,8 @@ DECLARE_HOST_COMMAND(EC_CMD_FP_PASSTHRU, fp_command_passthru, EC_VER_MASK(0));
static enum ec_status fp_command_info(struct host_cmd_handler_args *args)
{
- struct ec_response_fp_info *r = args->response;
+ struct ec_response_fp_info *r =
+ static_cast<ec_response_fp_info *>(args->response);
#ifdef HAVE_FP_PRIVATE_DRIVER
if (fp_sensor_get_info(r) < 0)
@@ -409,7 +415,8 @@ int validate_fp_buffer_offset(const uint32_t buffer_size, const uint32_t offset,
static enum ec_status fp_command_frame(struct host_cmd_handler_args *args)
{
- const struct ec_params_fp_frame *params = args->params;
+ const struct ec_params_fp_frame *params =
+ static_cast<const struct ec_params_fp_frame *>(args->params);
void *out = args->response;
uint32_t idx = FP_FRAME_GET_BUFFER_INDEX(params->offset);
uint32_t offset = params->offset & FP_FRAME_OFFSET_MASK;
@@ -473,7 +480,8 @@ static enum ec_status fp_command_frame(struct host_cmd_handler_args *args)
* The beginning of the buffer contains nonce, encryption_salt
* and tag.
*/
- enc_info = (void *)fp_enc_buffer;
+ enc_info = (struct ec_fp_template_encryption_metadata
+ *)(fp_enc_buffer);
enc_info->struct_version = FP_TEMPLATE_FORMAT_VERSION;
trng_init();
trng_rand_bytes(enc_info->nonce, FP_CONTEXT_NONCE_BYTES);
@@ -534,7 +542,8 @@ DECLARE_HOST_COMMAND(EC_CMD_FP_FRAME, fp_command_frame, EC_VER_MASK(0));
static enum ec_status fp_command_stats(struct host_cmd_handler_args *args)
{
- struct ec_response_fp_stats *r = args->response;
+ struct ec_response_fp_stats *r =
+ static_cast<struct ec_response_fp_stats *>(args->response);
r->capture_time_us = capture_time_us;
r->matching_time_us = matching_time_us;
@@ -575,7 +584,8 @@ validate_template_format(struct ec_fp_template_encryption_metadata *enc_info)
static enum ec_status fp_command_template(struct host_cmd_handler_args *args)
{
- const struct ec_params_fp_template *params = args->params;
+ const struct ec_params_fp_template *params =
+ static_cast<const struct ec_params_fp_template *>(args->params);
uint32_t size = params->size & ~FP_TEMPLATE_COMMIT;
int xfer_complete = params->size & FP_TEMPLATE_COMMIT;
uint32_t offset = params->offset;
@@ -614,7 +624,8 @@ static enum ec_status fp_command_template(struct host_cmd_handler_args *args)
* The beginning of the buffer contains nonce, encryption_salt
* and tag.
*/
- enc_info = (void *)fp_enc_buffer;
+ enc_info = (struct ec_fp_template_encryption_metadata *)
+ fp_enc_buffer;
ret = validate_template_format(enc_info);
if (ret != EC_RES_SUCCESS) {
CPRINTS("fgr%d: Template format not supported", idx);