libpayload: find source of input characters

This change makes it possible for vboot to avoid an
exploit that could cause involuntary switch to dev mode.
It gives depthcharge/vboot some information on the
type of input device that generated a key.

BUG=chrome-os-partner:21729
TEST=manually tested for panther
BRANCH=none
CQ-DEPEND=CL:182420,CL:182241,CL:182946

Change-Id: I87bdac34bfc50f3adb0b35a2c57a8f95f4fbc35b
Reviewed-on: https://chromium-review.googlesource.com/182357
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
This commit is contained in:
Luigi Semenzato 2014-01-13 17:45:54 -08:00 committed by chrome-internal-fetch
commit bdb76c8bbc
5 changed files with 21 additions and 3 deletions

View file

@ -249,12 +249,18 @@ int set_option_from_string(const struct nvram_accessor *nvram, struct cb_cmos_op
* @defgroup console Console functions
* @{
*/
typedef enum {
CONSOLE_INPUT_TYPE_UNKNOWN = 0,
CONSOLE_INPUT_TYPE_USB,
} console_input_type;
void console_init(void);
int putchar(unsigned int c);
int puts(const char *s);
int havekey(void);
int getchar(void);
int getchar_timeout(int *ms);
console_input_type last_key_input_type(void);
extern int last_putchar;
@ -263,6 +269,7 @@ struct console_input_driver {
struct console_input_driver *next;
int (*havekey) (void);
int (*getchar) (void);
console_input_type input_type;
};
struct console_output_driver;