chrome-ec/common
Vincent Palatin 5a6cef6a93 u2f: accept short APDU
The ISO7816-4 standard for APDU format says the APDU header minimum size
is 4 bytes (CLA, INS, P1, P2). The Lc field is absent if the command has
no data.
Update the size check to accept short APDU (the actual APDU
len was already computed properly for this case).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=cr50
BUG=b:72788497
TEST=adhoc

Change-Id: Ic60fa51bd4746b04016c488a38fe3ae7585e9942
Reviewed-on: https://chromium-review.googlesource.com/1005345
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit 209f47b692)
Reviewed-on: https://chromium-review.googlesource.com/1015617
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
2018-04-17 18:44:37 +00:00
..
acpi.c common: Add tablet_mode API 2016-11-08 17:11:28 -08:00
adc.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
als.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
ap_hang_detect.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
backlight_lid.c Support backlight control via lid only 2013-09-27 23:07:21 +00:00
base32.c common: Substitute modified CRC8 with CRC-5-USB 2018-02-01 00:48:00 +00:00
battery.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
bluetooth_le.c btle: Cleanup: Moved constants, renamed functions 2016-08-11 14:46:33 -07:00
btle_hci_controller.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
btle_ll.c btle_ll.c: Initialize variables to fix GCC warnings 2016-11-16 19:04:31 -08:00
build.mk cr50: use run time generated public RMA key definition 2018-04-17 18:44:33 +00:00
button.c console: Add non-verbose print config option 2017-02-11 13:06:38 -08:00
capsense.c Deferred: Use deferred_data instead of function pointer 2016-04-18 17:32:40 -07:00
case_closed_debug.c chip/g: use ccd_ext_is_enabled() instead of ccd_get_mode() 2017-09-07 22:34:42 +00:00
ccd_config.c cr50: add vendor CCD subcommand to report CCD information 2018-04-17 18:44:35 +00:00
charge_manager.c charge_ramp: Specify port number in board_is_vbus_too_low() 2017-02-02 19:09:52 -08:00
charge_ramp.c charge_ramp: Specify port number in board_is_vbus_too_low() 2017-02-02 19:09:52 -08:00
charge_state_v2.c cleanup: Remove charge_state_v1 2017-02-06 14:50:32 -08:00
charger.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
charger_profile_override.c charger_profile: support multiple battery voltage range thresholds 2017-02-10 19:02:55 -08:00
chipset.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
clz.c Add option to enable GCC LTO 2015-05-19 02:46:27 +00:00
console.c task: Wait for HOOK_INIT completion before scheduling tasks 2017-06-30 17:36:43 +00:00
console_output.c Cr50: The chan command is not safe. 2016-10-01 03:13:43 +00:00
crc.c ec: add crc32_ctx..() to take context parameter. 2018-03-01 02:06:18 +00:00
crc8.c crc8: Support crc calculation across non-contiguous data 2016-03-18 22:16:53 -07:00
curve25519-generic.c core/cortex-m0/curve25519: Integrate fast curve25519 implementation 2017-10-24 01:54:09 +00:00
curve25519.c core/cortex-m0/curve25519: Integrate fast curve25519 implementation 2017-10-24 01:54:09 +00:00
device_state.c cr50: Clean up device state code 2017-08-18 23:35:42 +00:00
dptf.c eve: Move DPTF tablet mode support to common code 2017-02-14 14:50:36 -08:00
ec.libsharedobjs.ld build-infr: Add support for shared RO library. 2015-07-17 03:17:50 +00:00
event_log.c pd_log: Make PD logging more generic for general purpose logging 2017-08-04 17:02:08 +00:00
extension.c cr50: Allow spihash extension command over USB 2018-03-01 02:06:13 +00:00
extpower_gpio.c extpower: Allow board to override signal debounce time 2016-09-02 07:11:33 -07:00
fan.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
firmware_image.S rwsig: Add support for rwsig image types 2017-02-17 04:09:37 -08:00
firmware_image.lds.S Define load addresses using macros 2017-08-04 16:33:01 +00:00
flash.c flash: add flash selection support 2017-08-04 16:59:05 +00:00
fmap.c common: Split rwsig parts from rsa.h header 2017-06-30 17:24:28 +00:00
gesture.c Fix various misspellings in comments 2016-11-15 17:41:53 -08:00
gpio.c gpio: Move gpio_get_ternary to common gpio functions 2017-06-30 17:33:28 +00:00
gpio_commands.c Cr50: Mark several console commands as safe 2016-08-31 17:20:26 +00:00
hooks.c Clean up CONFIG_CASE_CLOSED_DEBUG usage 2017-09-07 22:34:40 +00:00
host_command.c cleanup: Remove big and pit boards 2017-09-11 21:34:10 +00:00
host_command_master.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
host_command_pd.c charge_state_v2: Limit i/p current to meet allowed MAX i/p system power 2016-12-05 16:43:00 -08:00
host_event_commands.c mkbp: Always keep memmap host event mask up-to-date 2016-12-01 19:59:04 -08:00
i2c_master.c i2c: separate slave and master code 2017-06-30 17:24:41 +00:00
i2c_slave.c i2c: separate slave and master code 2017-06-30 17:24:41 +00:00
i2c_wedge.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
i2cs_tpm.c tpm: provide means of shutting down comms layer while in reset 2017-11-13 18:58:44 +00:00
inductive_charging.c Deferred: Use deferred_data instead of function pointer 2016-04-18 17:32:40 -07:00
keyboard_8042.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
keyboard_8042_sharedlib.c libsharedobjs: Add 8042 scancodes to shared lib. 2015-07-17 03:18:03 +00:00
keyboard_mkbp.c mkbp: Support devices having buttons but no keyboard 2017-02-21 16:07:40 -08:00
keyboard_scan.c keyboard: Always call keyboard_state_changed 2016-11-17 07:08:25 -08:00
keyboard_test.c Move keyboard dimension and key constants to keyboard_config.h 2013-03-22 11:24:29 -07:00
lb_common.c cleanup: Remove 'ryu' board 2017-09-11 21:34:27 +00:00
led_common.c rambi: fix led command 2014-01-14 09:19:45 +00:00
led_policy_std.c led_policy_std: Blink LED in S0iX 2016-07-19 12:03:27 -07:00
lid_angle.c oak: enable lid angle update 2016-03-02 13:39:47 -08:00
lid_switch.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
lightbar.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
mag_cal.c common: Add magnetometer online calibration. 2015-10-13 05:28:54 -07:00
main.c cleanup: Remove 'ryu' board 2017-09-11 21:34:27 +00:00
mat33.c common: Add magnetometer online calibration. 2015-10-13 05:28:54 -07:00
mat44.c common: Add magnetometer online calibration. 2015-10-13 05:28:54 -07:00
math_util.c math_util: Fix rotation by identity. 2016-08-24 17:40:27 -07:00
memory_commands.c Add more CONFIG_CMD_* options for console commands 2016-10-01 00:02:01 -07:00
mkbp_event.c mkbp_event: Properly queue events during host sleep 2016-11-04 18:31:37 -07:00
motion_lid.c motion_lid: Fix merge of cl/430344 2017-02-10 12:11:47 -08:00
motion_sense.c motion: Add opt3001 as a motion sensor 2017-02-16 18:03:59 -08:00
nvcounter.c Add non-volatile flash counter 2017-06-06 23:40:30 +00:00
nvmem.c cr50: Make sure TPM wipe only clears TPM data. 2017-03-02 17:11:22 +00:00
nvmem_vars.c cr50: Store console lock state in NvMem vars. 2017-03-02 18:15:19 +00:00
onewire.c Move onewire bus support from chip/lm4 to common 2013-08-02 18:22:57 -07:00
panic_output.c Cr50: The panicinfo command is not safe 2016-10-01 03:14:07 +00:00
pd_log.c pd_log: Make PD logging more generic for general purpose logging 2017-08-04 17:02:08 +00:00
physical_presence.c pp: add API to show when press is expected 2018-02-01 00:48:16 +00:00
port80.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
power_button.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
power_button_x86.c cleanup: Remove charge_state_v1 2017-02-06 14:50:32 -08:00
printf.c console: Add non-verbose print config option 2017-02-11 13:06:38 -08:00
pstore_commands.c pstore: Fix issue with block calculation for pstore blocks 2017-01-03 15:13:58 -08:00
pwm.c pwm: PWM is disabled when duty is set to max value 2016-09-08 17:57:51 -07:00
pwm_kblight.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
queue.c Queue: Add ability to modify contiguous units inplace 2015-07-15 21:57:36 +00:00
queue_policies.c consumer: Remove flush operation 2018-02-01 00:48:04 +00:00
rma_auth.c rma: mark key ID volatile so that it can be replaced post compilation 2018-04-17 18:44:34 +00:00
rsa.c common/rsa: Add support for exponent 3 RSA keys 2016-11-10 21:28:28 -08:00
rwsig.c common: Split rwsig parts from rsa.h header 2017-06-30 17:24:28 +00:00
sensor_common.c console: Add non-verbose print config option 2017-02-11 13:06:38 -08:00
sha1.c Add SHA-1 hash 2014-05-17 20:14:17 +00:00
sha256.c sha256: add support for hmac_sha256, and add test for sha256 2017-06-30 17:35:57 +00:00
shared_mem.c Cr50: Mark several console commands as safe 2016-08-31 17:20:26 +00:00
shmalloc.c fix shmem console command 2018-03-19 22:04:02 +00:00
smbus.c smbus: Re-write smbus driver 2016-03-21 16:35:33 -07:00
spi_commands.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
spi_flash.c Enable spi_flash_read to read > SPI_FLASH_MAX_READ_SIZE 2016-10-05 20:58:37 -07:00
spi_flash_reg.c spi_flash_reg: Correct lengths for W25Q40/GD25LQ40 2016-10-20 01:55:59 -07:00
spi_nor.c common/spi_nor: Differential erase support 2017-02-09 05:04:56 +00:00
switch.c switch: Initialize switch state earlier during HOOK_INIT 2017-06-30 16:51:41 +00:00
system.c g: show RW headers' Board ID fields in 'version' output 2017-06-30 17:33:36 +00:00
tablet_mode.c motion: Disable tablet mode if one accel is broken 2017-01-04 18:07:12 -08:00
temp_sensor.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
test_util.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
thermal.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
throttle_ap.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
timer.c common: add decimal real number seconds value to timeirnfo output 2017-02-03 20:01:45 -08:00
tpm_log.c tpm: Add optional event logging 2017-08-18 23:35:58 +00:00
tpm_registers.c tpm: ccd: allow alternative commands when ap is held in reset 2018-02-20 23:24:35 +00:00
u2f.c u2f: accept short APDU 2018-04-17 18:44:37 +00:00
uart_buffering.c uart: fix compile warning when !defined CONFIG_CONSOLE_ENABLE_READ_V1 2017-06-30 17:27:37 +00:00
update_fw.c servo_v4: copypasta usb updater code into common 2016-07-21 13:13:35 -07:00
usb_charger.c bd99955: Improve interrupt / USB charger task wake scheme 2016-06-16 12:27:42 -07:00
usb_i2c.c consumer: Remove flush operation 2018-02-01 00:48:04 +00:00
usb_pd_policy.c version: Store image size data in version struct 2017-06-06 23:40:00 +00:00
usb_pd_protocol.c pdchipinfo: Add option to force renewal 2017-02-14 17:28:16 -08:00
usb_pd_tcpc.c servo_v4: pd: Added Device Test System support 2017-01-26 23:16:40 -08:00
usb_port_power_dumb.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00
usb_port_power_smart.c usb: power_smart: Allow CONFIG_USB_PORT_POWER_SMART_PORT_COUNT < 2 2016-09-22 19:12:36 -07:00
usb_update.c consumer: Remove flush operation 2018-02-01 00:48:04 +00:00
util.c util: add constant-time memcmp 2017-06-30 16:51:23 +00:00
vboot_hash.c console: Add non-verbose print config option 2017-02-11 13:06:38 -08:00
vec3.c common: Add magnetometer online calibration. 2015-10-13 05:28:54 -07:00
version.c version: Store image size data in version struct 2017-06-06 23:40:00 +00:00
virtual_battery.c i2c_passthru: fix virtual battery operation 2016-12-14 06:03:14 -08:00
vstore.c ec: Add temporary secure storage for the host during boot 2016-01-25 21:46:48 -08:00
webusb_desc.c Add WebUSB descriptor support 2017-10-24 01:52:58 +00:00
wireless.c cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args 2016-08-24 16:30:10 +00:00