From 84112abc717896aac2a8d15729ad174276dbc24d Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 18 Sep 2020 10:51:40 +0200 Subject: [PATCH] device: Add new FP_DEVICE_ERROR_UNTRUSTED error code Throw a specific error when we are unable to verify the integrety of the device. --- libfprint/fp-device.h | 2 ++ libfprint/fpi-device.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/libfprint/fp-device.h b/libfprint/fp-device.h index c2ecd5e..0736706 100644 --- a/libfprint/fp-device.h +++ b/libfprint/fp-device.h @@ -92,6 +92,7 @@ typedef enum { * @FP_DEVICE_ERROR_DATA_FULL: No space on device available for operation * @FP_DEVICE_ERROR_DATA_DUPLICATE: Enrolling template duplicates storaged templates * @FP_DEVICE_ERROR_REMOVED: The device has been removed. + * @FP_DEVICE_ERROR_UNTRUSTED: Device cannot be trusted * * Error codes for device operations. More specific errors from other domains * such as #G_IO_ERROR or #G_USB_DEVICE_ERROR may also be reported. @@ -109,6 +110,7 @@ typedef enum { FP_DEVICE_ERROR_DATA_DUPLICATE, /* Leave some room to add more DATA related errors */ FP_DEVICE_ERROR_REMOVED = 0x100, + FP_DEVICE_ERROR_UNTRUSTED, } FpDeviceError; GQuark fp_device_retry_quark (void); diff --git a/libfprint/fpi-device.c b/libfprint/fpi-device.c index 231dde9..3b8eed6 100644 --- a/libfprint/fpi-device.c +++ b/libfprint/fpi-device.c @@ -143,6 +143,10 @@ fpi_device_error_new (FpDeviceError error) msg = "This device has been removed from the system."; break; + case FP_DEVICE_ERROR_UNTRUSTED: + msg = "Could not verify integrity of the device, it cannot be trusted!"; + break; + default: g_warning ("Unsupported error, returning general error instead!"); error = FP_DEVICE_ERROR_GENERAL;