Fingerprintd:Engine is the policy the trustlet cannot supply. It never polls for a finger: the normal world captures a frame, decides whether a finger is there, and tells it. So finger detection, edge reporting and the accounting all live out here, and they are the parts most easily got wrong in a way that reads as bad hardware. Baseline refuses to be a fixed threshold. The capture metric is per frame, so it scales with how many frames a capture asks for, and it drifts upward while idle -- an early session read "18 -> 24 with a finger" as weak detection when the values were climbing regardless of what was on the sensor. The floor is the maximum of the idle samples, and an uncalibrated Baseline calls nothing a finger rather than inventing a threshold. TouchTracker keeps the two modes apart. Enrolment reports touch on the rising edge and release on the falling one and nothing while held, mirroring stock, whose entire enrolment trace contains no image-ready event; emitting one per held frame feeds the algorithm near-duplicate images from a single press. Authentication does want it, because event 7 reaches the matcher unconditionally. AuthTally exists to stop two counting mistakes. Only a terminal verdict is an attempt -- counting rescan frames as rejections is what turned an 8-for-8 run into an apparent 8-of-39. And a press that ran out of frames without reaching a verdict is UNDECIDED, not failed; treating it as a failure is the same error one level up, which is why decided presses are counted separately. The tests replay the three recorded runs in order rather than as totals, because press structure only exists in the order. That makes the per-press claim re-derivable here instead of quoted: the enrolled finger matched on all five presses although five of its twenty frames did not, the wrong-finger control matched nothing, and on the stock-budget run five of ten presses reached a verdict and all five matched. Verified by mutation: counting undecided presses as decided, using a baseline before calibration, emitting image-ready during enrolment, and taking the first idle sample as the floor each fail the suite.
58 lines
2.1 KiB
C++
58 lines
2.1 KiB
C++
// SPDX-License-Identifier: GPL-3.0-only
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
// lint-disable-file no-char-pointer
|
|
import std;
|
|
import Crafter.Build;
|
|
#include "lint-rules.h"
|
|
namespace fs = std::filesystem;
|
|
using namespace Crafter;
|
|
|
|
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
|
|
// fingerprintd-core — the wire formats and state machines as a static
|
|
// library of pure C++ modules. Deliberately free of GLib, libqcomtee and
|
|
// every system header: the byte-level decisions in here were the whole
|
|
// cost of this project, so they are pinned by tests that run on a dev box
|
|
// with no phone, no TEE and no sensor.
|
|
static auto Core = std::make_unique<Configuration>();
|
|
Core->path = "./";
|
|
Core->name = "fingerprintd-core";
|
|
Core->outputName = "fingerprintd-core";
|
|
ApplyStandardArgs(*Core, args);
|
|
Core->type = ConfigurationType::LibraryStatic;
|
|
{
|
|
std::array<fs::path, 5> ifaces = {
|
|
"interfaces/Fingerprintd",
|
|
"interfaces/Fingerprintd-Sfs",
|
|
"interfaces/Fingerprintd-Rpmb",
|
|
"interfaces/Fingerprintd-Ta",
|
|
"interfaces/Fingerprintd-Engine",
|
|
};
|
|
std::array<fs::path, 0> impls = {};
|
|
Core->GetInterfacesAndImplementations(ifaces, impls);
|
|
}
|
|
|
|
// fingerprintd — the daemon: sensor rail, QTEE session, the gpfile and
|
|
// RPMB listeners, and the bus surface, wrapped around the core.
|
|
Configuration cfg;
|
|
cfg.path = "./";
|
|
cfg.name = "fingerprintd";
|
|
cfg.outputName = "fingerprintd";
|
|
ApplyStandardArgs(cfg, args);
|
|
cfg.type = ConfigurationType::Executable;
|
|
cfg.dependencies = { Core.get() };
|
|
{
|
|
std::array<fs::path, 0> ifaces = {};
|
|
std::array<fs::path, 1> impls = { "implementations/main" };
|
|
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
|
}
|
|
|
|
cfg.AddTest("Sfs").Dependencies({ Core.get() });
|
|
cfg.AddTest("Rpmb").Dependencies({ Core.get() });
|
|
cfg.AddTest("Ta").Dependencies({ Core.get() });
|
|
cfg.AddTest("Engine").Dependencies({ Core.get() });
|
|
|
|
ProjectLint::AddProjectLintRules(cfg);
|
|
|
|
return cfg;
|
|
}
|