summaryrefslogtreecommitdiff
path: root/common/fpsensor
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-055-1515/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Propagate no match auth code when finger outside rangePatryk Duda2021-09-071-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When fp_finger_match() function returns code which indicates that match failed it also sets number of matched template to -1. Until now, in fp_process_match() we set internal error code when finger number was invalid (fgr variable was set to -1). This resulted in overwriting MATCH_NO, MATCH_LOW_QUALITY, MATCH_LOW_COVERAGE with MATCH_NO_INTERNAL error code when match failed. As a result, biod was receiving only internal errors always when match failed. Now we overwrite error code with internal error only when fp_finger_match() returns negative value or when it returns success, but finger template number is outside range. In other cases we pass unchanged error code to biod. BUG=b:184843581 BRANCH=none TEST=Flash FPMCU firmware on Chromebook. Reboot Chromebook, make sure your firmware is running. Cover up part of sensor with paper and try to unlock device. Compare biod and cros_fp logs, make sure that biod reports the same reason on failed attempts. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I64e6cb2850c0bf4700482c35899f23b8102a480b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3135425 Tested-by: Patryk Duda <patrykd@google.com> Commit-Queue: Patryk Duda <patrykd@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "fpsensor: Support building firmware that works for both sensors"Tom Hughes2021-04-072-78/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac08c9d1dbc9f587df3ee6b15d58c0203f7e356e. Reason for revert: Breaks public build Original change's description: > fpsensor: Support building firmware that works for both sensors > > This is a refactoring to allow building FPMCU firmware that works for > one FPC sensor and one ELAN sensor. > > 1. When both drivers implement our common functions, e.g. fp_sensor_init(), > rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). > 2. There are a few functions implemented not in FPC driver but in FPC > private library, e.g. fp_sensor_finger_status(). I kept this as-is for > FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() > 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c > because the sensor type GPIO always says FPC. > > BRANCH=none > BUG=b:175158241 > TEST=make run-fpsensor; make run-fpsensor_status; > make run-fpsensor_crypto > TEST=make -j BOARD=dartmonkey > TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; > make -j BOARD=bloonchipper > Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) > TEST=run device tests with http://crrev/c/2750547 and > http://crrev/i/3654297 on Dragonclaw, all pass > > Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > Commit-Queue: Tom Hughes <tomhughes@chromium.org> Bug: b:175158241, b:184616069 Change-Id: I2a02a6eefc316e7e13aa188f1ae16672dce2babd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809521 Auto-Submit: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* fpsensor: Support building firmware that works for both sensorsYicheng Li2021-04-022-49/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring to allow building FPMCU firmware that works for one FPC sensor and one ELAN sensor. 1. When both drivers implement our common functions, e.g. fp_sensor_init(), rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). 2. There are a few functions implemented not in FPC driver but in FPC private library, e.g. fp_sensor_finger_status(). I kept this as-is for FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c because the sensor type GPIO always says FPC. BRANCH=none BUG=b:175158241 TEST=make run-fpsensor; make run-fpsensor_status; make run-fpsensor_crypto TEST=make -j BOARD=dartmonkey TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; make -j BOARD=bloonchipper Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) TEST=run device tests with http://crrev/c/2750547 and http://crrev/i/3654297 on Dragonclaw, all pass Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Enable -WvlaTom Hughes2021-03-301-4/+17
| | | | | | | | | | | | | | | | Ideally this should be enabled for all the EC code, but that requires making more changes. For now enable it for the fingerprint sensor code to make sure we don't accidentally introduce variable length arrays. BRANCH=none BUG=b:172020413 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I80fe4acade2c84886142ef795e54be004d1663be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792699 Commit-Queue: Yicheng Li <yichengli@chromium.org> Reviewed-by: Yicheng Li <yichengli@chromium.org>
* fpsensor: Add FP sensor SPI detection logicTom Hughes2021-01-291-0/+12
| | | | | | | | | | | | BRANCH=none BUG=b:177908650 TEST=Flash icetower v0.2, observed FP_SPI_SEL on console TEST=Flash nocturne, observed FP_SPI_SEL on console Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I2b221139fed817de4c58db3b6c8198942ab86e7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648731 Reviewed-by: Craig Hesling <hesling@chromium.org>
* common/fpsensor: Remove adlr from OWNERSCraig Hesling2020-12-171-1/+0
| | | | | | | | | | | | | | | | BRANCH=none BUG=b:175431356 TEST=cat OWNERS # Visually inspected each character with my eyes. # Confirmed that each character looked like it contributed to a # word that could be the Gerrit email of a SWE on the Chrome OS # Fingerprint team. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ieba1f54c9c88ed438bb44d4d4f1bfd2c0d9a5ac2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2596047 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* common/fpsensor: Add other Cros Fingerprint SWE to OWNERSCraig Hesling2020-12-161-1/+5
| | | | | | | | | | | | | | | | | Emails have been sorted. BRANCH=none BUG=b:175431356 TEST=cat OWNERS # Visually inspected each character with my eyes. # Confirmed that each character looked like it contributed to a # word that could be the Gerrit email of a SWE on the Chrome OS # Fingerprint team. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I73764cfb6d7a797f9b4cb59d01d446a583097465 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594429 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-142-4/+4
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* atomic: rename atomic_read_clear to atomic_clearDawid Niedzwiecki2020-11-022-4/+4
| | | | | | | | | | | | | | | | | Rename atomic_read_clear to atomic_clear to be consistent with the rest of the atomic functions, which return the previous value of the variable. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I2588971bd7687879a28ec637cf5f6c3d27d393f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505143 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* include/config.h: Replace CONFIG_FP_SENSOR with CONFIG_FINGERPRINT_MCUTom Hughes2020-10-301-0/+4
| | | | | | | | | | | | | | | | CONFIG_FP_SENSOR was only enabled for RW, but we need a way to know whether the board is a fingerprint MCU when in RO as well. "FINGERPRINT_MCU" is a bit more generic than FP_SENSOR. We still only build the matching-related code for RW. BRANCH=none BUG=b:171370392 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I808faa7a16522791cfb4eb9cc2e163d9eb994804 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2508860 Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
* tree: Use new atomic_* implementationDawid Niedzwiecki2020-10-272-5/+5
| | | | | | | | | | | | | | | | | | | | | | | It is done as a part of porting to Zephyr. Since the implementation of atomic functions is done for all architectures use atomic_* instead of deprecated_atomic_*. Sometimes there was a compilation error "discards 'volatile' qualifier" due to dropping "volatile" in the argument of the functions, thus some pointers casts need to be made. It shouldn't cause any issues, because we are sure about generated asm (store operation will be performed). BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I98f590c323c3af52035e62825e8acfa358e0805a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2478949 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* tree: rename atomic_* functions to deprecated_atomic_*Jack Rosenthal2020-09-292-5/+5
| | | | | | | | | | | | | | | | We will move to an API compatible with Zephyr's API. See the bug for complete rationale and plan. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id611f663446abf00b24298a669f2ae47fef7f632 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427507 Tested-by: Dawid Niedźwiecki <dn@semihalf.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* fpsensor: Fix buffer check to account for overflowTom Hughes2020-09-252-4/+15
| | | | | | | | | | | BRANCH=none BUG=b:144957935 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I1b4fa0a715869ccc37e48d75316ef52c367aa64a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2417529 Reviewed-by: Craig Hesling <hesling@chromium.org>
* fpsensor: Run maintenance when in maintenance modeTom Hughes2020-08-311-0/+3
| | | | | | | | | | | | BRANCH=none BUG=b:76037094 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibe8649c3cf77ef4542b5fc46d7df5eee03293b56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2364755 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* fingerprint: Stopgap to repair public buildsCraig Hesling2020-08-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This repairs building bloonchipper and dartmonkey builds when private lib is unavailable. There are two issues this remedies: 1) Redefinition of sensor info macros, like FP_SENSOR_RES_X 2) Undefined reference to fp_sensor_maintenance when building bloonchipper/dartmonkey non-private image. All of these issues stem from the way we handle code when HAVE_FP_PRIVATE_DRIVER is set or faked by a test. This is a fundamental issues that needs some thought and refactoring. BRANCH=none BUG=b:164174822,b:163109916, b:163411883 TEST=# With private time make buildall -j TEST=# Without private time make buildall -j TEST=# With private libs # Cherry-pick https://crrev.com/c/2357870 first, then # this patch. ./util/compare_build.sh -b all -o # This confirms that the all output binaries with private-lib # did not change at all Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: If71e3376fb7a904b77f2fc9fc56c8e0daf54db3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357430 Reviewed-by: Andrew de los Reyes <adlr@chromium.org> Reviewed-by: YH Lin <yueherngl@chromium.org>
* driver/fingerprint: Add a common sensor maintenance functionTom Hughes2020-08-061-0/+8
| | | | | | | | | | | | | | | | Add a new console command "fpmaintenance" for testing. BRANCH=none BUG=b:76037094 TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro: ./util/flash_jlink.py On FP console: > fpmaintenance Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7125f8783d3dd7e815612d20742c9d949d00ba71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2323709 Reviewed-by: Yicheng Li <yichengli@chromium.org>
* Bloonchipper: USART based transport layer for host commandBhanu Prakash Maiya2020-06-052-1/+1
| | | | | | | | | | | | | | | | | | | | 1. USART host command layer in chip/stm32 2. Fix usart implementation in stm32 BUG=b:147849609 BRANCH=none TEST=1. make BOARD=bloonchipper -j 2. usart request and response works on dragonclaw Change-Id: Idd89d3e490f23aa528ecaf6510c13d16b405de13 Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190531 Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@chromium.org>
* fpsensor: cleanup multiple fp spi enableBhanu Prakash Maiya2020-06-052-7/+1
| | | | | | | | | | | | | | BUG=b:147849609 BRANCH=none TEST=1. make buildall -j Change-Id: I35146070ec20a3605588792fc19595dc1c1ea3cf Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191733 Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@chromium.org>
* bloonchipper: Add transport and sensor detectionTom Hughes2020-01-083-0/+39
| | | | | | | | | | | | | | | | | | | | | | | bloonchipper (aka hatch_fp aka dragonclaw) has a voltage divider that can be used to select the sensor and the transport type. Supported designs: * Dragonclaw rev 0.2 (green with Google logo): go/dragonclaw-schematic-rev-0.2 * Hatch reference v3.0: go/hatch-schematic-rev-3.0 The selection lines are connected to ADC inputs, so a future change will use the ADC to allow more than two transports or sensors. BRANCH=none BUG=b:147113851 TEST=flash dragonclaw rev 0.2 and view console output Change-Id: If2e4b150d34cfe41477be528c70e1645043d4d82 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1986322 Reviewed-by: Craig Hesling <hesling@chromium.org>
* fpsensor: update OWNERSTom Hughes2019-12-191-1/+1
| | | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: I6259eec96f96f1108df150d4d4e875a5ee96f241 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1976002 Commit-Queue: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Make fpcapture and fpenroll restrictedCraig Hesling2019-11-181-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There should be no functional difference to fpcapture or fpenroll, since the restricted console command feature is implemented in a similar manor. The only noticeable difference is that the list of commands provided by the "help" command should denote when these commands are restricted. Note, each board requires a configuration, similar to crrev.com/c/1867388, in order to activate restricted console commands. Otherwise, this restricted flag has no restricting effect. BRANCH=nocturne BRANCH=hatch BUG=b:142559996, b:142505927 TEST=# Test on nocturne_fp make BOARD=nocturne_fp scp build/nocturne_fp/ec.bin dut1:~/ ssh dut1 flash_fp_mcu ./ec.bin # From FPMCU UART console version # Ensure that version is custom based on workstation help # Ensure that fpcapture and fpenroll are not prefixed # with "-" help list # Ensure that a "Flags" column exists and that # fpcapture and fpenroll both have a 1 in the column. fpcapture fpenroll # Ensure that both commands above succeed in their # own operations syslock fpcapture fpenroll # Ensure that both commands above fail with "Access Denied" help # Ensure that fpcapture and fpenroll are now prefixed # with "-" in the help message Change-Id: Icbb74a1afece66db9ebd071de0770650d42bd553 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869400 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Copy BEP and libfp source files from private repoTom Hughes2019-10-282-34/+0
| | | | | | | | | | | | | | | | | | These source files have been approved to be released publicly (see http://b/137848573#comment20). There were no source changes in the move, except for small changes to the Makefiles to adjust for the move. For future "git blame"s refer to the history of the files in the private repo if you need to access the full history. BRANCH=none BUG=b:137848573 TEST=make buildall -j Cq-Depend: chrome-internal:2005127 Change-Id: I1a809ac5a4d95637840ee47712e9c80a40a445c5 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869531
* fuzz_host_cmd: Add fpsensor task + fp host cmdsCraig Hesling2019-10-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL enables the fpsensor task and adds the following remaining fingerprint host commands to the fuzzer: * EC_CMD_FP_PASSTHRU * EC_CMD_FP_INFO * EC_CMD_FP_FRAME * EC_CMD_FP_STATS * EC_CMD_FP_TEMPLATE BRANCH=none BUG=b:116065496 TEST=make buildall -j TEST=make run-host_command_fuzz TEST=# Pull in TEST_COVERAGE fix git fetch "https://chromium.googlesource.com/chromiumos/platform/ec" \ refs/changes/86/1725186/1 && git cherry-pick FETCH_HEAD make host-host_command_fuzz TEST_COVERAGE=1 timeout 5m ./build/host/host_command_fuzz/host_command_fuzz.exe llvm-profdata merge -sparse default.profraw -o default.profdata llvm-cov show build/host/host_command_fuzz/host_command_fuzz.exe \ --instr-profile=default.profdata --format=html --output-dir=cov # Inspect cov/.../common/fpsensor/fpsensor_state.c.html to verify Change-Id: Icad9493ba41cd4daa61a30246d01afd1dbe16c56 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682945 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* mock: Add fp_sensor and mkbp_events mocksCraig Hesling2019-10-251-1/+1
| | | | | | | | | | | | BRANCH=none BUG=b:116065496 TEST=make buildall -j Change-Id: Ia723d98354ca027f41f1b3c00d6a2dac500edbf8 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715633 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* fpsensor: Add support for migration to positive match secret.Yicheng Li2019-10-101-4/+34
| | | | | | | | | | | | | | | | | | | | On receiving an template, if the template has format version 3 and has empty positive match salt, then generate positive match salt for this template so that it has positive match secret on the next match. BRANCH=nocturne BUG=chromium:927095 TEST=make -j buildall TEST=tested enrollment, matching, deletion, multifinger on DUT nocturne TEST=tested migration on DUT nocturne, specifically, enrolled template with old FPMCU firmware, then updated firmware, verified that templates are migrated and continue to work. Change-Id: If8020acfb60a03269af9ddb41023796920116fca Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1769395 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Enable positive match secret and positive match salt on enrollment.Yicheng Li2019-10-093-16/+76
| | | | | | | | | | | | | | | | | | | | | | On enrollment success, generate new positive_match_salt and send it as part of the encrypted blob. Also enable positive match secret to be read. The positive_match_salt is used to derive positive_match_secret and is different from the encryption salt for encrypting the templates. The positive_match_salt needs to be sent to biod and stored with templates because it needs to be re-uploaded to FPMCU the next time the user logs in. The positive match secret needs to be sent to biod so that it knows what to compare against at a match. BRANCH=nocturne BUG=chromium:927095 TEST=make -j buildall TEST=tested enrollment, matching and multifinger on DUT nocturne Change-Id: I3e44a972ee17c5a93bddd52340f8f2249836463a Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828058 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Implement command to read positive_match_secret.Yicheng Li2019-10-092-7/+88
| | | | | | | | | | | | | | | | | | | | | Add EC command to read positive_match_secret on match success. If the attempt to read is 5 seconds after the match, the read is not allowed (the readable bit for positive match secret is cleared). Test that the command can read the data correctly and can read for each finger only once. Test that attempt to read secret after deadline will be rejected. BRANCH=nocturne BUG=chromium:927095 TEST=make buildall TEST=tested enrollment, matching and multifinger on DUT nocturne TEST=tested that if biod requests to download template and secret for a finger that's not currently matched, reading secret will fail. Change-Id: Idc734c6392d271e2aaee1cddf7c2c5b81b727b4a Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679372 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Prepare derivation of positive match secret.Yicheng Li2019-10-081-0/+44
| | | | | | | | | | | | | | | | | Implement derivation of positive match secret for a template. This derivation will be used when biod sends a command to ask for positive match secret and the secret readable bit is set. Also add unit tests for this derivation. BRANCH=nocturne BUG=chromium:927095 TEST=make -j buildall TEST=tested enrollment, matching and multifinger on DUT nocturne Change-Id: Ife477a98573284f69c5fb07e814d9a3d09f92127 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1639440 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Prepare positive match salt.Yicheng Li2019-10-042-2/+12
| | | | | | | | | | | | | | | | On enrollment success, generate random positive match salt. This will be used in the derivation of positive match secret. BRANCH=nocturne BUG=chromium:927095 TEST=make -j buildall TEST=tested enrollment, matching, deletion and multifinger on DUT nocturne. Change-Id: I4ad55a0221c4aa1f6e3cc56b66c2165ad9455ba0 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719385 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Add hkdf-expand implementation for arbitrary output size.Yicheng Li2019-10-031-1/+57
| | | | | | | | | | | | | | This can be used to replace hkdf_expand_one_step in more general cases of HKDF. Also add unit tests for this. BRANCH=nocturne BUG=none TEST=make -j buildall Change-Id: Ie116b13ee33d171298eccabb8a37b59e702d0218 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719871 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Fix public buildTom Hughes2019-10-032-0/+33
| | | | | | | | | | | | | | Add stubs for fp_sensor_init and fp_sensor_deinit when building without the private FP sensor files. BRANCH=none BUG=b:124773209,b:141924178 TEST=make buildall -j Change-Id: Ie85a4bb0e568b205ada0d378ae658e8fe478c0a9 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834274 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Add async FP_CMD_CONTEXTTom Hughes2019-10-021-7/+25
| | | | | | | | | | | | | | | | | | | | Setting the context now triggers a reset of the sensor library (see I3e25bdf7eaaf99f3801547e11a6c524f924f4726), which in turn will end up calling fp_sensor_open to re-initialize the sensor. Since some calibration is performed in that command, it takes ~173 ms, which is close enough to the EC command timeout (200 ms) that it often fails. This change makes the command "asynchronous" so that userspace can poll for the result and avoid the command timeout. BRANCH=nocturne BUG=b:137288498 TEST=make buildall -j TEST=ectool --name=cros_fp fpcontext 01234567890123456789012345678901 Change-Id: I997bf9c5b9e90eceb5375dccffcb535529a86e47 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819115 Reviewed-by: Yicheng Li <yichengli@chromium.org>
* host_command: Change host command return value to enum ec_statusTom Hughes2019-10-022-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* fpsensor: Deinit the sensor before clearing the contextTom Hughes2019-09-282-8/+31
| | | | | | | | | | | | | | | | | | | | The opaque context contains sensor state that we can't nuke from underneath the sensor library. Calling fp_sensor_deinit will release this context and allow us to safely clear the context. BRANCH=none BUG=b:124773209 TEST="fpenroll" followed by "fpclear" in the FP console TEST=On nocturne, in the UI, enroll finger, log out, and log in => then lock and unlock with finger TEST=make buildall -j Change-Id: I3e25bdf7eaaf99f3801547e11a6c524f924f4726 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1647294 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org>
* fpsensor: replace memset() with always_memset()Yicheng Li2019-09-043-7/+12
| | | | | | | | | | | | | | In fpsensor code, use always_memset() in place of memset(). BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall TEST=tested enrollment, matching and multifinger on nocturne DUT Change-Id: I29e32bd2838c1f240607799e61f29759aaee7600 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1737206 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Change crypto functions to return error code instead of result codeYicheng Li2019-07-262-21/+21
| | | | | | | | | | | | | | | | | EC_RES_SUCCESS and EC_RES_ERROR are meant to be returned in EC command handler to represent command result, so change crypto functions to return EC_SUCCESS and EC error codes instead. BRANCH=nocturne BUG=none TEST=make -j buildall TEST=tested enrollment, matching, deletion and multifinger on nocturne DUT Change-Id: Ia98fa7469ab4e5dba00ede19dd34c5007d17b054 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715512 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Add help descriptions for console commandsstabilize-12301.BTom Hughes2019-06-261-4/+8
| | | | | | | | | | | | | | All the other console commands have help descriptions except for the fingerprint sensor commands. BRANCH=none BUG=none TEST="help list" in hatch_fp console Change-Id: I601c7e49a28693f4b7f4344a6030febb87c2ae20 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1674808 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* fpsensor: Return correct error code for console commandTom Hughes2019-06-241-2/+2
| | | | | | | | | | | | | | | | | | Console commands return different error code types than host commands. When the host command return value is returned for a console command, the error message that is printed on the console is wrong, which is confusing. BRANCH=none BUG=chromium:978078 TEST="syslock" in hatch FP console so system_is_locked returns true "fpcapture" in hatch FP console => Access Denied "fpenroll" in hatch FP console => Access Denied Change-Id: I18dbc093011743d4a9469eb5843c1464496bdd53 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1674049 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Don't allow enrolling more than the max number of fingersTom Hughes2019-06-241-0/+7
| | | | | | | | | | | | | | | | | | This fix applies to both the console command and the host (when switching to FP_MODE_ENROLL_SESSION). BRANCH=nocturne BUG=b:124773209 TEST="fpenroll" multiple times in FP console => verify we get error after 5 attempts TEST=ectool --name=cros_fp fpmode enroll => verify we get error after 5 attempts TEST=make buildall -j Change-Id: I4e1d50f5e72d65d707e1889dee3036334f07f1eb Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1650036 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Refactor fp_command_modeTom Hughes2019-06-242-16/+40
| | | | | | | | | | | | | | | | | | | | This refactoring allows us to call fp_command_mode from the debug console commands and ensure that we're testing the same underlying code path that the host commands use. BRANCH=nocturne BUG=b:124773209 TEST="fpenroll" in hatch FP console "fpmatch" in hatch FP console "fpclear" in hatch FP console TEST=On nocturne: flash_fp_mcu ec.bin Enroll fingerprint via UI, lock/unlock, Remove fingerprint via UI Change-Id: I5e1e314c7f1d67dc663795cafe751545516e9f89 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1652285 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Move HKDF code to helper functionsYicheng Li2019-06-211-18/+60
| | | | | | | | | | | | | | | | | Move HKDF extract and HKDF expand code to two helper functions. This is in preparation for future change to implement positive match secret. BRANCH=nocturne BUG=chromium:927095 TEST=ran unittests, including unit test for derive_encryption_key() TEST=tested enrollment, matching and multifinger on DUT nocturne Change-Id: Ia7c67ef8339a3617b0177334ba824b4c805047c8 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1641962 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: delete extra slash in build pathYicheng Li2019-06-151-3/+3
| | | | | | | | | | | | | | | | | | | | Delete extra slashes in build.mk so that the build target names are correct. BRANCH=nocturne BUG=chromium:973618 TEST=make -j buildall TEST=no more extra slashes: CC RW/common/fpsensor/fpsensor.o CC RW/common/fpsensor/fpsensor_state.o CC RW/common/fpsensor/fpsensor.o CC RW/common/fpsensor/fpsensor_state.o CC RO/common/fpsensor/fpsensor_state.o Change-Id: Ibb8a975462242487c9dfbf84558cbbc97d31e87f Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1658516 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Change new files' year to 2019Yicheng Li2019-06-151-1/+1
| | | | | | | | | | | | | | Although the code is moved from files created in 2017, these are new files, so change the year to 2019. BRANCH=nocturne BUG=none TEST=make -j buildall Change-Id: I15015c7ad1a713437b04395fd09e6641019f5ff7 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660092 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* fpsensor: Add unit test for derive_encryption_key().Yicheng Li2019-06-142-2/+2
| | | | | | | | | | | | | | | | | Mock rollback_get_secret() and use it to test derive_encryption_key(). BRANCH=nocturne BUG=chromium:927095 TEST=make -j buildall TEST=tested enrollment, matching and multifinger on nocturne DUT TEST=verified test key vectors by running boringSSL's HKDF (https://boringssl.googlesource.com/boringssl/+/c0b4c72b6d4c6f4828a373ec454bd646390017d4/crypto/hkdf/) locally Change-Id: Ie2f51e4f64788d938e43d0c5c18685d1cfdd001c Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1652495 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Move crypto-related code to fpsensor_crypto.cYicheng Li2019-06-135-138/+162
| | | | | | | | | | | | | | | | | | Move crypto-related code to common/fpsensor/fpsensor_state.c. This facilitates unittesting because we can control whether to link in crypto-related code, and also facilitates mocking the encryption engine. BRANCH=nocturne BUG=chromium:927095 TEST=ran unittests TEST=tested enrollment, matching and multifinger on DUT nocturne Change-Id: I5bffc1460cbe2c9e3d6294ea5fff41f14019f0eb Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1648922 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fpsensor: Add API to check FP sensor encryption status.Yicheng Li2019-06-072-8/+30
| | | | | | | | | | | | | | | | | | Add EC command for the host to query FP sensor encryption status. Currently it's just FP TPM seed has been set or not. Add unit test for this command. Also add ectool command for querying encryption status. BRANCH=nocturne BUG=chromium:952275 TEST=ran unittests TEST=tested enrollment, matching and multifinger on DUT nocturne. TEST=tested querying sensor encryption status using ectool. Change-Id: I07d1e471ead85a517105b38d1ddd793c3046ce8f Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633272 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Replace ccprintf/s with CCPRINTF/STom Hughes2019-06-071-11/+11
| | | | | | | | | | | | | | | The CCPRINTF/S macro provides more control over the logging output and we already use it everywhere else in the file. BRANCH=none BUG=b:124773209 TEST=make buildall -j TEST=view log messages in FP console Change-Id: Idbdbfe7a5fdb590288e9926aabf21412cfe50549 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1646883 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* fpsensor: Add instructions for using screen instead of minicomTom Hughes2019-06-061-1/+18
| | | | | | | | | | | | | | Also increase timeout to provide enough time to hit enter when download prompt pops up. BRANCH=none BUG=b:124996507 TEST=fpcapture from fingerprint console Change-Id: I1e608161aceae4431dedcaffd648d20549b97a8b Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1593956 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* Add OWNERS files for fingerprintTom Hughes2019-06-051-0/+7
| | | | | | | | | | | | BRANCH=none BUG=chromium:967924 TEST=none Change-Id: Ief50a64d45cc6862fab3417e3f8350d3c581209e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633909 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>