summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Casey <bobbycasey@google.com>2023-02-17 14:20:35 -0500
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-02 22:57:44 +0000
commit924704afa7ce884f5aae1d68d43cfbcbd98392e9 (patch)
treefeb953f0e8f0bfb21d1dad093e77b5b3bc4423dd
parentb03820fc23e64a4141283ae198415a918d50ba5f (diff)
downloadchrome-ec-924704afa7ce884f5aae1d68d43cfbcbd98392e9.tar.gz
fpsensor: Rename fpsensor_private.h to fpsensor_utils.h
Rename fpsensor_private.h as it does not contain any private interfaces and is included by non-private source files. BRANCH=none BUG=none TEST=make BOARD=bloonchipper TEST=make BOARD=dartmonkey TEST=make run-fpsensor_crypto Signed-off-by: Bobby Casey <bobbycasey@google.com> Change-Id: I4f9233c8c7b5ffdf84fdd0c11c3166dd65f4a913 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4273186 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--common/fpsensor/fpsensor.cc2
-rw-r--r--common/fpsensor/fpsensor_crypto.c2
-rw-r--r--common/fpsensor/fpsensor_private.h23
-rw-r--r--common/fpsensor/fpsensor_state.c2
-rw-r--r--common/mock/fpsensor_crypto_mock.c2
-rw-r--r--driver/fingerprint/fpc/fpc_sensor.c2
-rw-r--r--include/fpsensor_utils.h24
-rw-r--r--test/fpsensor.c2
8 files changed, 30 insertions, 29 deletions
diff --git a/common/fpsensor/fpsensor.cc b/common/fpsensor/fpsensor.cc
index 0c194419c9..2f961d6f58 100644
--- a/common/fpsensor/fpsensor.cc
+++ b/common/fpsensor/fpsensor.cc
@@ -15,8 +15,8 @@ extern "C" {
#include "fpsensor.h"
#include "fpsensor_crypto.h"
#include "fpsensor_detect.h"
-#include "fpsensor_private.h"
#include "fpsensor_state.h"
+#include "fpsensor_utils.h"
#include "gpio.h"
#include "host_command.h"
#include "link_defs.h"
diff --git a/common/fpsensor/fpsensor_crypto.c b/common/fpsensor/fpsensor_crypto.c
index aac50bb297..0fa387707b 100644
--- a/common/fpsensor/fpsensor_crypto.c
+++ b/common/fpsensor/fpsensor_crypto.c
@@ -6,8 +6,8 @@
#include "aes.h"
#include "cryptoc/util.h"
#include "fpsensor_crypto.h"
-#include "fpsensor_private.h"
#include "fpsensor_state.h"
+#include "fpsensor_utils.h"
#include "rollback.h"
#include <stdbool.h>
diff --git a/common/fpsensor/fpsensor_private.h b/common/fpsensor/fpsensor_private.h
deleted file mode 100644
index 5c076a0808..0000000000
--- a/common/fpsensor/fpsensor_private.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2019 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Internal header file for common/fpsensor directory */
-
-#ifndef __CROS_EC_FPSENSOR_PRIVATE_H
-#define __CROS_EC_FPSENSOR_PRIVATE_H
-
-#include <stdint.h>
-
-#define CPRINTF(format, args...) cprintf(CC_FP, format, ##args)
-#define CPRINTS(format, args...) cprints(CC_FP, format, ##args)
-
-#ifdef __cplusplus
-extern "C"
-#endif
- int
- validate_fp_buffer_offset(uint32_t buffer_size, uint32_t offset,
- uint32_t size);
-
-#endif /* __CROS_EC_FPSENSOR_PRIVATE_H */
diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c
index 8153df9883..bf728ab5b6 100644
--- a/common/fpsensor/fpsensor_state.c
+++ b/common/fpsensor/fpsensor_state.c
@@ -9,8 +9,8 @@
#include "ec_commands.h"
#include "fpsensor.h"
#include "fpsensor_crypto.h"
-#include "fpsensor_private.h"
#include "fpsensor_state.h"
+#include "fpsensor_utils.h"
#include "host_command.h"
#include "system.h"
#include "task.h"
diff --git a/common/mock/fpsensor_crypto_mock.c b/common/mock/fpsensor_crypto_mock.c
index 334f98300a..df88615e63 100644
--- a/common/mock/fpsensor_crypto_mock.c
+++ b/common/mock/fpsensor_crypto_mock.c
@@ -11,7 +11,7 @@
#include "compile_time_macros.h"
#include "console.h"
#include "ec_commands.h"
-#include "fpsensor_private.h"
+#include "fpsensor_utils.h"
#include "mock/fpsensor_crypto_mock.h"
#include "sha256.h"
diff --git a/driver/fingerprint/fpc/fpc_sensor.c b/driver/fingerprint/fpc/fpc_sensor.c
index 9cb97a9125..e2891e4d18 100644
--- a/driver/fingerprint/fpc/fpc_sensor.c
+++ b/driver/fingerprint/fpc/fpc_sensor.c
@@ -5,9 +5,9 @@
#include <stddef.h>
-#include <common/fpsensor/fpsensor_private.h>
#include <include/fpsensor.h>
#include <include/fpsensor_state.h>
+#include <include/fpsensor_utils.h>
#if defined(CONFIG_FP_SENSOR_FPC1025) || defined(CONFIG_FP_SENSOR_FPC1035)
#include "bep/fpc_private.h"
#elif defined(CONFIG_FP_SENSOR_FPC1145)
diff --git a/include/fpsensor_utils.h b/include/fpsensor_utils.h
new file mode 100644
index 0000000000..c0d88042d7
--- /dev/null
+++ b/include/fpsensor_utils.h
@@ -0,0 +1,24 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Misc utilities for fingerprint management */
+
+#ifndef __CROS_EC_FPSENSOR_UTILS_H
+#define __CROS_EC_FPSENSOR_UTILS_H
+
+#define CPRINTF(format, args...) cprintf(CC_FP, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_FP, format, ##args)
+
+/**
+ * Test that size+offset does not exceed buffer_size
+ *
+ * Returns:
+ * EC_ERROR_OVERFLOW: if size+offset does not fit in uint32_t
+ * EC_ERROR_INVAL: if size+offset > buffer_size
+ * EC_SUCCESS: otherwise
+ */
+int validate_fp_buffer_offset(uint32_t buffer_size, uint32_t offset,
+ uint32_t size);
+#endif /* __CROS_EC_FPSENSOR_UTILS_H */
diff --git a/test/fpsensor.c b/test/fpsensor.c
index 2daaa0d2cf..d7ddcbebcb 100644
--- a/test/fpsensor.c
+++ b/test/fpsensor.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "common/fpsensor/fpsensor_private.h"
#include "ec_commands.h"
+#include "fpsensor_utils.h"
#include "mock/fpsensor_detect_mock.h"
#include "string.h"
#include "test_util.h"