Commit Graph

398 Commits

Author SHA1 Message Date
Daisuke Nojiri
ff87bfac4e EFS: Add error codes
This patch defines more error codes to make the consle more
descriptive.

BUG=none
BRANCH=none
TEST=Boot Fizz.

Change-Id: I84cc6cd7f309bb2f2e1f36dea6cf5a7f0f862f50
Reviewed-on: https://chromium-review.googlesource.com/639160
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-08-29 19:37:04 -07:00
Daisuke Nojiri
4ec4975d90 vboot: Move common code under common/vboot
This patch moves the code which can be shared with other data
verification schemes (e.g. RWSIG) under common/vboot. It also
adds unit tests for it.

BUG=b:38462249
BRANCH=none
TEST=make run-vboot. Verify verification succeeds on Fizz.

Change-Id: Icab4d96dd2c154a12b01c41ebe9b46286b4b590e
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/563463
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-07-13 19:45:57 -07:00
Nicolas Boichat
136a80e113 test/x25519: Optionally test 1 million iterations of x25519
BRANCH=none
BUG=b:62813194
TEST=#define TEST_X25519_1M_ITERATIONS in test/x25519.c
     Increase timeout in util/run_host_test to 1000 seconds
     make run-x25519 -j

Change-Id: I8157d756df3e1a6573791ff6aab458acffae0f0c
Reviewed-on: https://chromium-review.googlesource.com/554439
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-07-03 19:19:09 -07:00
Randall Spangler
282765fdd4 common: Add RMA reset auth challenge-response crypto
RMA auth uses X25519 to generate a relatively small challenge and
response.

Currently, nothing calls the rma_auth code.  We'll need console and
TPM vendor commands to do so.

BUG=b:37952913
BRANCH=none
TEST=make buildall

Change-Id: Iec7f2d0e3dc8243f79b009ead16bb3ba9f1bef9d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/544184
2017-06-30 16:02:50 -07:00
Nicolas Boichat
f7c89fc709 test/x25519: First test speed, then test implementation
Makes it easier to tune implementation speed.

BRANCH=none
BUG=b:62813194
TEST=- Increase CONFIG_RO_SIZE to 60kb
     - Increase console stack size to 2048
     - Define CONFIG_CURVE25519_CORTEXM0 (next patch)
     make BOARD=hammer PROJECT=x25519 TEST_BUILD=y
     ./util/flash_ec --board=hammer --image=build/hammer/x25519.bin
     EC console: runtest

Change-Id: I9097e326a3772b2e05f9b90a68ac715ed467c442
Reviewed-on: https://chromium-review.googlesource.com/542636
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-29 01:16:19 -07:00
Randall Spangler
2e3b42610b common: Add base32 encoding
Base32 encoding is used to turn the RMA reset binary
challenge/response into less-typo-prone text, at 5 bits per character.

BUG=b:37952913
BRANCH=none
TEST=make runtests

Change-Id: I474750a20204ba353cea1e91982aa03e8071c0c2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/544177
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-06-28 23:23:41 -07:00
Shawn Nematbakhsh
b0dd82b39c cleanup: Remove big and pit boards
Remove big and pit boards along with several now-obsolete CONFIGs /
source files.

BUG=chromium:735109
TEST=`make buildall -j`
BRANCH=None
CQ-DEPEND=CL:544681

Change-Id: Ieb784bd36157fd1f6240cd19de6e6d12191a8097
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/540667
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-22 17:03:52 -07:00
Nicolas Boichat
c5b31e3868 sha256: add support for hmac_sha256, and add test for sha256
BRANCH=none
BUG=b:38486828
TEST=make run-sha256
TEST=make buildall -j

Change-Id: I4c5b5d81ae5650ebfbdc989a0d860eeb0a60f68b
Reviewed-on: https://chromium-review.googlesource.com/530207
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-14 05:59:37 -07:00
Nicolas Boichat
9ebcc894be test/entropy: Add host test and compute entropy
Check that added entropy is at least somewhat acceptable.

BRANCH=none
BUG=b:38486828
TEST=make BOARD=hammer -j tests
     ./util/flash_ec --board=hammer --image=build/hammer/test-entropy.bin
     EC console: runtest, get around 4000/1000 (=4) bits of entropy, value
     matches (roughly) the value obtained using the awk script.
TEST=make run-entropy

Change-Id: I88d0e9ec0e38ab3ec70d3e8163b8ac1556df978d
Reviewed-on: https://chromium-review.googlesource.com/523482
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-13 05:23:33 -07:00
Nicolas Boichat
39db721f9a hammer: Add board_get_entropy function (and test)
This function will be used to generate some entropy using the
Clock Recovery System.

BRANCH=none
BUG=b:38486828
TEST=make BOARD=hammer -j tests
     ./util/flash_ec --board=hammer --image=build/hammer/test-entropy.bin
     EC console: runtest
TEST=Test fails when no USB connection is active
TEST=Test passes when USB connection is active
TEST=Pasting the values into:
     tr ';' '\n' | awk 'BEGIN { e = 0; tot=16384.0 }
                  { p = $1/tot; if (p > 0) { e -= p*log(p)/log(2) } }
                  END { print e }'
     shows an entropy > 4 bits per sample.

Change-Id: I2363c7bce42c72c33ef0bf3f099d709ee9c13d13
Reviewed-on: https://chromium-review.googlesource.com/518608
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-06 08:52:16 -07:00
Thiemo Nagel
6b170d85e7 Remove references to individual genders
Remove references to individual genders in comments/examples.  No
functional change.  For the rationale, cf.
https://chromium.googlesource.com/chromium/src/+/master/styleguide/gender_neutral_code.md

BUG=none
TEST=none

Change-Id: I756d22c617fe1a8fde2e967796e112e2c6159bf9
Reviewed-on: https://chromium-review.googlesource.com/517123
Commit-Ready: Thiemo Nagel <tnagel@chromium.org>
Tested-by: Thiemo Nagel <tnagel@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2017-05-29 03:28:25 -07:00
Nicolas Boichat
661259ebff tests: Split utils in 2 subtests
utils test is a little too large for hammer's small RO, so we split
it in 2 test: utils and utils_str. Instead of one test that requires
about 8kb extra flash, we have 2 tests that take respectively
3.4kb (utils_str) and 4.6kb (utils) of extra flash.

BRANCH=none
BUG=chromium:726113
TEST=make BOARD=hammer tests -j
     util/flash_ec --board=hammer --image=build/hammer/test-utils.bin
     runtest => pass
     Repeat with test-utils_str.bin
TEST=Before this change:
       make runtests -j
       ./util/run_host_test utils | grep Running | sort > old
     Apply this change:
       make runtests -j
       (./util/run_host_test utils; ./util/run_host_test utils_str) \
               | grep Running | sort > new
       diff old new => No difference (except timing)

Change-Id: I917d572e671d6ce0a8799508761f55de7bd83133
Reviewed-on: https://chromium-review.googlesource.com/514604
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-05-25 02:33:04 -07:00
Aseda Aboagye
1cf94fd052 chg_ramp: Don't change ICL until vals are init'd.
When the charge ramp task starts, it starts up in the DISCONNECTED
state.  From this state, it's possible to set the input current limit to
0 mA.  However, upon task start, we shouldn't take any action until we
have valid values from a new charge supplier or a supplier leaving.

This commit changes the charge ramp task to not touch the input current
limit until the charge ramp state changes or the desired input current
changes at least once.

BUG=b:36468002
BRANCH=gru,master
TEST=Flash kevin EC RW or build AP FW that contains the fix that will by
sync'd by EC SW sync.  Make sure WP is asserted to prevent PD
communications in RO.  Unplug battery.  Plug in AC, verify that system
can boot up to UI on AC alone.
TEST=make -j buildall

Change-Id: I351917bce7902c49d1bb842a0cc83dd161d75b6f
Reviewed-on: https://chromium-review.googlesource.com/461382
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/463927
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-03-30 17:35:44 -07:00
philipchen
7814f3319e motion_lid: no angle correction when lid close
BUG=b:36107214
BRANCH=gru
TEST=manually on kevin:
(1) make DUT in tablet mode
(2) swiftly close the lid
(3) check ec log and confirm DUT can read small angle
    and turn into clamshell mode when lid is closed.
TEST=make runtests

Change-Id: I7ebf10d38a8b300960ebf46be717d48522c6fd0b
Reviewed-on: https://chromium-review.googlesource.com/455458
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 75ba9147c392367037c21e79899f463c32c1f92f)
Reviewed-on: https://chromium-review.googlesource.com/457137
Commit-Ready: Philip Chen <philipchen@chromium.org>
2017-03-17 20:12:23 -07:00
Scott
a990e4e832 pd: Add tcpc_select_rp_value to stub tcpm driver
The function tcpm_select_rp_value() is used to set a given Rp
value. This function was not supported for boards that use the config
option CONFIG_USB_PD_TCPC. This CL adds a weak board_ function which
can be overloaded for boards that have the requirement to set Rp to
different values.

BUG=chrome-os-partner:61878
BRANCH=servo
TEST=run 'make buildall'. On plankton added a console command to trigger
a call to tcpm_select_rp_value(0, 0), verified that it returned
2 (EC_ERROR_NOT_IMPLEMENTED). Then added board_select_rp_value() to
plankton's board.c and verified that it returned 0.

Change-Id: I1cd6f0ed51717736d30575c58025bd9a1c5d6fc4
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/446685
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-02 11:29:06 -08:00
Aseda Aboagye
2a7683af41 cr50: Store console lock state in NvMem vars.
This commit enables the use of the nvmem vars module.  The console lock
state is migrated from using the long life scratch register, to nvmem
vars instead which will persist across power on reboots.

BUG=b:35586145
BRANCH=None
TEST=Flash a dev image. Lock the console. Remove all power from the
system.  Power on system and verify that console is still locked.
Unlock the console, remove power from the system, power on the system,
verify that the console is now unlocked.
TEST=Repeat the above test, but using the nvtestvar console command
instead.

Change-Id: I03a2098bb0017cfca59889457a332eafb0e95db6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/445804
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-02-27 18:50:12 -08:00
Vincent Palatin
0d858f1544 curve25519: strip-down, build and test
Keep only the most compact version of the curve25519 code
and remove the remaining unused code for easier compilation.
Do the minimal changes to make it compile in the EC code base,
there should be no real functional changes.

Re-use the wording from BoringSSL include/openssl/curve25519.h for the
header.

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

BRANCH=none
BUG=chrome-os-partner:62991
TEST=run x25519 on host (ie 'make run-x25519')
and the STM32L4 target:
make BOARD=eve_fp PROJECT=x25519 TEST_BUILD=y
./util/flash_ec --board=eve_fp --image=build/eve_fp/x25519.bin
execute 'runtest' in the console.

Change-Id: I13dbe453eff39b461effb1b3ffa549afc1749fef
Reviewed-on: https://chromium-review.googlesource.com/444187
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Adam Langley <agl@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-23 16:02:03 -08:00
Vincent Palatin
b8c4f23f75 import curve25519 code from BoringSSL
Import the implementation of the curve25519 public key cryptography
from BoringSSL.
It's the unmodified crypto/curve25519/curve25519.c file from the
repository at sha c034e2d3ce16df5f89134515bc113eb4f3a28e0e.
(current HEAD of chromium-stable branch)
It will be used as a primitive to implement a Diffie-Hellman exchange.

The test code in test/x25519.c is also imported unmodified
from BoringSSL crypto/curve25519/x25519_test.cc.

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

BRANCH=none
BUG=chrome-os-partner:62991
TEST=with follow-up CLs, run curve25519 test vectors
on host, MEC1322 and STM32 targets.

Change-Id: Ie497f78249f505e32d8e025b0537e82bf4476298
Reviewed-on: https://chromium-review.googlesource.com/444186
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-02-23 16:02:02 -08:00
Aseda Aboagye
d7303404a5 cr50: Make sure TPM wipe only clears TPM data.
Previously, wiping the TPM would wipe all of NvMem, however, it really
should only clear the TPM's NvMem space.  This commit adds a function to
clear a given NvMem user's space and makes the TPM only clear its space.

BUG=chrome-os-partner:61597
BRANCH=None
TEST=Add code for using nvmem vars, create a test variable, add a user
to snappy, unlock the console, verify that the user is no longer present
on the system and the test nvmem var still exists.
TEST=make -j buildall

Change-Id: Ic98baa5166a1ef9ae76e910b1b9ab100300e947f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/445803
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-02-23 01:19:07 -08:00
Nicolas Boichat
07eccbb414 rwsig: Add support for rwsig image types
usbpd1 futility image type is deprecated and should not be used for
new designs. This adds proper support for rwsig image type.

Key and signatures are added at linker stage step (futility cannot
directly create such signed images). Thanks to VB21 header, rwsig.c
can now tell how many bytes of the RW image need to be
cryptographically verified, and ensure that the rest is blank (0xff).

BRANCH=none
BUG=chromium:690773
TEST=make BOARD=hammer; flash, RW image is verified correctly.
TEST=make runtests -j
TEST=For the rest of the tests:
     Change config option to CONFIG_RWSIG_TYPE_RWSIG
TEST=make BOARD=hammer; flash, hammer still verifies correctly.
TEST=cp build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig;
     futility sign --type rwsig --prikey build/hammer/key.vbprik2 \
        build/hammer/ec.RW.bin
     diff build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig
     => Same file
TEST=Add CONFIG_CMD_FLASH, flashwrite 0x1e000, reboot, EC does
     not verify anymore.
TEST=dump_fmap build/hammer/ec.bin shows KEY_RO and SIG_RW at
     correct locations.

Change-Id: I50ec828284c2d1eca67fa8cbddaf6f3b06606c82
Reviewed-on: https://chromium-review.googlesource.com/441546
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-17 04:09:37 -08:00
Nadim Taha
69c3fc2378 builtin: Expands string.h / stdint.h
Declares UINT8_MAX, INT8_MAX and defines strnlen(), strncpy(), strncmp() &
memchr(). Needed by a module I'm integrating into cr51.

BRANCH=none
BUG=none
TEST=make buildall -j

Change-Id: I894b0297216df1b945b36fc77cd3bc5c4ef8aa2b
Signed-off-by: Nadim Taha <ntaha@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/436786
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-02-17 01:46:31 +00:00
Sam Hurst
edf46467b9 cleanup: Remove charge_state_v1
All boards have been transitioned to charge_state_v2.c
So charge_state_v1.c, HOOK_CHARGE_STATE_CHANGE, and
CONFIG_CHARGER_TIMEOUT_HOURS can be removed

BUG=chrome-os-partner:36272
TEST=make -j buildall
BRANCH=none

Change-Id: I3f20c5198ea75185f9894deb792575a1be31432a
Reviewed-on: https://chromium-review.googlesource.com/435467
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-06 14:50:32 -08:00
nagendra modadugu
ae41381a72 tpm_test: test counter rollover for AES-CTR mode
This change adds test vectors that test counter
word-wise rollover.

BRANCH=none
BUG=none
TEST=AES test in tpmtest.py pass

Change-Id: Ie1c4f6a0ebf7f7934ae0b28bb02af459374170f2
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/431114
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
2017-02-03 10:51:15 -08:00
Shawn Nematbakhsh
f08109522d charge_ramp: Specify port number in board_is_vbus_too_low()
charge_ramp needs to make a decision based upon the VBUS level on one
specific port - the port that is ramping. The VBUS level on any other
charge ports (if present) is not relevant.

BUG=chrome-os-partner:54099
BRANCH=reef, gru
TEST=With subsequent patches, verify charge_ramp success with a variety
of BC1.2 chargers.

Change-Id: Ie0a51a577e2b7491222560cd08dd5321ff3b7975
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/435561
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-02 19:09:52 -08:00
nagendra modadugu
25d3f259db CR50: add support for 4k RSA verify
Add support for verifying messages signed
with 4096-bit RSA keys.  Such messages may
be generated by host side applications.

Also update tpmtest.py to test 4k verification.

BRANCH=none
BUG=none
TEST=added new tests to tpmtest.py; TCG tests pass

Change-Id: I7450bd710c154c68c030ce176bfe7becbfbcb729
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/428220
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Marius Schilder <mschilder@chromium.org>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-01-28 04:11:08 -08:00
Vadim Bendebury
79a1e2072d nvmem: do not use malloc for cached buffer
With introduction of encryption it is becoming impossible to read
NVMEM contents directly from flash. Decrypting the contents each time
there is a read request creates a significant performance hit. NVMEM
needs to be rearchitecture such that there is no need to run
decryption each time NVMEM read is performed.

This patch does just that, implementation details are described in the
header comment in common/nvmem.c.

To reduce memory impact the size of NVMEM is being decreased from 16K
to 12K. This is acceptable because eviction objects stored in NVMEM
serialized now, which dramatically reduces NVMEM size requirements.
The TPM2 NVMEM size definition must be kept in sync.

Another optimization this change introduces is bypassing writing into
the flash if NVMEM contents did not change, which is verified by
examining the hash of the cached storage.

A test is added to verify that the new commit scheme works as
expected, and the nvmem test is re-introduced to the list of test ran
on each 'make buildall'.

CQ-DEPEND=CL:433839
BRANCH=none
BUG=chrome-os-partner:62260,chrome-os-partner:62421
BUG=chrome-os-partner:62437
TEST=ran the following tests, all succeeded
     make buildall -j
     TEST_LIST_HOST=nvmem make runtests
     tcg test suite
     corp enroll on reef, reboot a few times, verify that enrollment sticks

Change-Id: I177daa3ceb4fd7aac299ca26b4506b863e31b946
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/433184
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-28 01:52:09 -08:00
nagendra modadugu
bb55470b0e CR50: add a hardware backed GCM implementation
This change adds hardware support for AES128-GCM
along with a subset of NIST test vectors.

BRANCH=none
BUG=chrome-os-partner:60833
CQ-DEPEND=CL:411535
TEST=tpmtest.py passes

Change-Id: I93445684f6a910c35a9117eac6cb19d28067a021
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/425002
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Marius Schilder <mschilder@chromium.org>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-01-27 03:50:47 -08:00
nagendra modadugu
f102027b10 CR50: update tpmtest.py to handle a success command code
Update tpmtest.py to handle a success command code
(i.e. return value of 0) as per change
12da6c23fb

This change makes the test suite runnable (not all
tests pass though - sha and upgrade tests are broken).

Also rename local variable subcmd to avoid a name collision.

BUG=none
BRANCH=none
TEST=tpmtest.py passes, except for sha & upgrade

Change-Id: I927ead775a1e41b9abf9f905b9f191e8bd5e108b
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/411535
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-01-27 05:52:19 +00:00
Sam Hurst
17515de32c pd: support gotoMin and giveBack
In Sink mode, on the receipt of a GotoMin message,
reduce the current consumption to some minimum level.

BUG=chrome-os-partner:33688
TEST=Manual testing
	Used a Kevin, with test routine, to test GotoMin feature
	on another Kevin unit.

	Test routine:
		 if (!strcasecmp(argv[2], "gm")) {
		    ccprintf("send goto min\n");
		    send_control(port, PD_CTRL_GOTO_MIN);
		    send_control(port, PD_CTRL_PS_RDY);
		}

	Kevin with GotoMin feature:
		# ectool usbpdpower 0
		Port 0: SNK DRP PD 4277mV / 3000mA, max 5000mV / 3000mA / 15000mW
		Port 1: Disconnected

		After Test routine is executed:

		# ectool usbpdpower 0
		Port 0: SNK DRP PD 4906mV / 500mA, max 5000mV / 500mA / 2500mW
		Port 1: Disconnected
BRANCH=none

Change-Id: Iaac6e19706ceb10ccaff4d602d63fc086c808c8f
Reviewed-on: https://chromium-review.googlesource.com/425728
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-01-26 18:43:52 -08:00
Vadim Bendebury
7a8d505ce3 nvmem: encrypt contents using crypto api
This patch makes incompatible changes to the nvmem layout: the header
is increased to accommodate a 16 byte sha ans a 16 byte padding for
future extensions.

The layout version field is also introduced to make it easier to track
changes in the future. When calculating SHA the entire partition above
the SHA field is processed. Encryption covers everything above the
header.

Introducing encryption makes it impossible to use flash contents
directly for read and compare operations.

The nvmem_setup function is modified to use the nvnem_save() instead
of writing into the flash directly.

BRANCH=none
BUG=chrome-os-partner:62260
TEST=ran the following tests, all succeeded
     make buildall -j
     TEST_LIST_HOST=nvmem make runtests
     tcg test suite
     corp enroll on reef, reboot a few times, verify that enrollment sticks

Change-Id: I50b148ac0dc6bc924f4d65c67bc6610100d9dfc0
Reviewed-on: https://chromium-review.googlesource.com/428691
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-25 22:12:28 -08:00
Vadim Bendebury
7d2e4fbf5b g: common: introduce generic crypto API
On boards based on the g chip cryptographic functions come from
hardware, they should be implemented in chip/g as opposed to a
particular board.

The common modules (like nvmem) should be using some generic API,
which hopefully will be implemented by other chips, or could be
replaced by a purely software implementation where crypto hardware
support is not available.

Crypto API definition is being added in include/ and the g chip
implementation (a wrapper around dcrypto functions) is being added in
chip/g.

test/nvmem_vars.h needed to be edited to avoid conflict with
<string.h>.

BRANCH=none
BUG=chrome-os-partner:62260
TEST=make buildall -j still passes. Booting reef with the new image
     works fine too.

Change-Id: Ifef281215f89239966882ecbe3e90c8351b9b91a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431313
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2017-01-25 22:12:28 -08:00
Vadim Bendebury
46ab85e60f nvmem: rename version to generation
With upcoming versioning of NVMEM contents let's replace term
'version' with term 'generation' in the existing nvmem implementation.

Generation would allow to tell between two instances of NVMEM stored
in flash memory. The upcoming version field in the header will be used
to tell between different nvmem layouts.

This patch was created by invoking the following command:

sed -i 's/VERSION/GENERATION/g;s/version/generation/g' \
    common/nvmem.c include/nvmem.h test/nvmem.c

and then editing a few remaining capitalized instances.

This also fixes nvmem test broken by an earlier patch.

BRANCH=none
BUG=chrome-os-partner:62260
TEST=the following tests succeed:
   make buildall -j
   TEST_LIST_HOST=nvmem make runtests
   booitng reef with cr50

Change-Id: I96e52dc93ca7c52c55794ba3e8c2774571212de0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431312
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-01-24 13:22:09 -08:00
Aseda Aboagye
2b54aa9a9b CHERRY-PICK: motion_lid: Add more reliability measurements.
Previously in motion lid, we only considered the lid angle as unreliable
when the hinge is too closely aligned with the direction of gravity.
However, there are other cases where the lid angle can be unreliable.
For example, when the device is being shaken and is under acceleration
that's not solely due to gravity.

This commit adds some more checks for a reliable lid angle measurement.

 - Checking if the device is significant motion by checking the
   deviation of the magnitudes of the base and lid vectors.

 - Making sure that the calculated angles agree with the current state
   of the lid switch.

BUG=chrome-os-partner:59480
BUG=chrome-os-partner:59203
BRANCH=gru,cyan,glados,oak
TEST=Flash kevin; use ectool motionsense lid_angle and monitor the
instantaneous lid angle.  Verify that unreliable is reported for cases
where the device is under significant motion.
TEST=Flash kevin; use evtest to monitor the tablet mode switch.  Verify
that tablet mode switch is much more robust.

Change-Id: I4bd9e818e617b056364cce2e46385e743a7522d4
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/430344
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-01-20 22:40:32 -08:00
Nicolas Boichat
90ae18655c button: Check volume up/down status and set recovery mode
Add support for entering recovery mode using volume up/down keys.

BRANCH=none
BUG=chrome-os-partner:61930
TEST=Press Power+Volume Up+Volume Down, poppy enters recovery

Change-Id: Id40a144e9b430cfb9dfd47048e9e96d598bc3db8
Reviewed-on: https://chromium-review.googlesource.com/428530
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-20 00:05:06 -08:00
Vijay Hiremath
5909f4ee26 Revert "charge_ramp: Adjust minimum ramp current"
From the USBC spec 1.2 "Table 4-14 Precedence of power source usage"
USB Type-C 3.0 A & 1.5 A takes precedence over BC1.2. Hence reverting
this patch.

This reverts commit 6a7e4a7b35.

BUG=chrome-os-partner:61420
BRANCH=none
TEST=make buildall -j

Change-Id: I2ed3f767973ff9c47fa7d2a2cca1aca15d13aa65
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/430152
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2017-01-18 19:18:31 -08:00
Vijay Hiremath
6a7e4a7b35 charge_ramp: Adjust minimum ramp current
A valid charge port is always detected as VBUS supplier type, 'USB charger'
can detect the same port as BC1.2 DCP supplier type & also 'TCPC' can
detect the same port as TYPEC supplier type. Thus a valid port is detected
as 2 or 3 supplier types. Depending on the supplier's priority and the
power that the supplier can provide, charge manager choses the charge
supplier type of the port.

If the USB charger detected supplier is BC1.2 DCP and the TCPC detected
supplier is TYPEC then the supplier can provide stable current from TYPEC
supplier's advertised current hence start ramping from TYPEC supplier's
advertised current.

BUG=chrome-os-partner:61420
BRANCH=none
TEST=Manually tested on reef. Donette bottom port can switch
     from 1.5A to 3A upon high load.

Change-Id: I871eca3ae4041f00bb3fd50e6aa939643f30a1f2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/427961
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-01-13 15:22:35 -08:00
Simon Glass
9fd2736d90 Makefile: Suppress unwanted tpm output
Use the 'echo' command to suppress unwanted build output when V=0.

Signed-off-by: Simon Glass <sjg@chromium.org>
BUG=chromium:680243
BRANCH=none
TEST=V=0 emerge-reef chromeos-ec; See that the tpm output is gone

Change-Id: Ia742b0b5270b969ec4f51967810e616348e39dbd
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/427365
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-13 15:22:30 -08:00
Vadim Bendebury
618b127c49 nvmem_vars: use dynamic memory allocation
To avoid SRAM footprint, let's use dynamic memory allocation in
nvram_vars. No one is using this module yet, but the cr50 use case is
coming up.

BRANCH=none
BUG=chrome-os-partner:61107
TEST=make buildall -j passes

Change-Id: I21534430217ad387a3787fcc127da596a1b48e03
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426088
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2017-01-09 23:47:07 -08:00
Vadim Bendebury
8734b70ff5 test: nvmem_vars: drop redundant erase_flash() invocations
There is no need to invoke erase_flash() before load_flash(), as
load_flash() invokes that function itself.

BRANCH=none
BUG=none
TEST=make buildall -j still passes

Change-Id: Ic4aba9f680402418ec6268d6ed5800065a09110b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426087
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-01-09 23:47:05 -08:00
Sam Hurst
a7bf207add iec: Improve efficiency of host command dispatcher
Use binary search in host command lookup dispatcher

BUG=chromium:570895
TEST=manual testing on kevin
      - Kevin boots
      - ectool hello
      make buildall -j
      Verify *.smap hcmds section is sorted:

      BOARD with host commands and private host commands
      0004d0ec R __hcmds
      0004d0ec R __host_cmd_0x00000x0000
      0004d0f8 R __host_cmd_0x00000x0001
      0004d104 R __host_cmd_0x00000x0002
      0004d110 R __host_cmd_0x00000x0003
      0004d11c R __host_cmd_0x00000x0004
      0004d128 R __host_cmd_0x00000x0005
      0004d134 R __host_cmd_0x00000x0007
      0004d140 R __host_cmd_0x00000x0008
      0004d14c R __host_cmd_0x00000x000a
      0004d158 R __host_cmd_0x00000x000d
      0004d164 R __host_cmd_0x00000x0010
      0004d170 R __host_cmd_0x00000x0011
      0004d17c R __host_cmd_0x00000x0012
      0004d188 R __host_cmd_0x00000x0013
      0004d194 R __host_cmd_0x00000x0015
      0004d1a0 R __host_cmd_0x00000x0016
      0004d1ac R __host_cmd_0x00000x0017
      0004d1b8 R __host_cmd_0x00000x0087
      0004d1c4 R __host_cmd_0x00000x008c
      0004d1d0 R __host_cmd_0x00000x008f
      0004d1dc R __host_cmd_0x00000x0092
      0004d1e8 R __host_cmd_0x00000x0093
      0004d1f4 R __host_cmd_0x00000x0097
      0004d200 R __host_cmd_0x00000x0098
      0004d20c R __host_cmd_0x00000x00b6
      0004d218 R __host_cmd_0x00000x00d2
      0004d224 R __host_cmd_0x00000x00d3
      0004d230 R __host_cmd_0x3E000x0000
      0004d23c R __host_cmd_0x3E000x0002
      0004d248 R __evt_src_EC_MKBP_EVENT_HOST_EVENT
      0004d248 R __hcmds_end

      BOARD with host commands only
      100bc888 R __hcmds
      100bc888 R __host_cmd_0x00000x0000
      100bc894 R __host_cmd_0x00000x0001
      100bc8a0 R __host_cmd_0x00000x0002
      100bc8ac R __host_cmd_0x00000x0003
      100bc8b8 R __host_cmd_0x00000x0004
      100bc8c4 R __host_cmd_0x00000x0005
      100bc8d0 R __host_cmd_0x00000x0006
      100bc8dc R __host_cmd_0x00000x0007
      100bc8e8 R __host_cmd_0x00000x0008
      100bc8f4 R __host_cmd_0x00000x0009
      100bc900 R __host_cmd_0x00000x000a
      100bc90c R __host_cmd_0x00000x000b
      100bc918 R __host_cmd_0x00000x000d
      100bc924 R __host_cmd_0x00000x0010
      100bc930 R __host_cmd_0x00000x0011
      100bc93c R __host_cmd_0x00000x0012
      100bc948 R __host_cmd_0x00000x0013
      100bc954 R __host_cmd_0x00000x0015
      100bc960 R __host_cmd_0x00000x0016
      100bc96c R __host_cmd_0x00000x0017
      100bc978 R __host_cmd_0x00000x0025
      100bc984 R __host_cmd_0x00000x0026
      100bc990 R __host_cmd_0x00000x0029
      100bc99c R __host_cmd_0x00000x002a
      100bc9a8 R __host_cmd_0x00000x002b
      100bc9b4 R __host_cmd_0x00000x002c
      100bc9c0 R __host_cmd_0x00000x0044
      100bc9cc R __host_cmd_0x00000x0045
      100bc9d8 R __host_cmd_0x00000x0046
      100bc9e4 R __host_cmd_0x00000x0047
      100bc9f0 R __host_cmd_0x00000x0061
      100bc9fc R __host_cmd_0x00000x0062
      100bca08 R __host_cmd_0x00000x0064
      100bca14 R __host_cmd_0x00000x0065
      100bca20 R __host_cmd_0x00000x0067
      100bca2c R __host_cmd_0x00000x0087
      100bca38 R __host_cmd_0x00000x008c
      100bca44 R __host_cmd_0x00000x008d
      100bca50 R __host_cmd_0x00000x008f
      100bca5c R __host_cmd_0x00000x0092
      100bca68 R __host_cmd_0x00000x0093
      100bca74 R __host_cmd_0x00000x0096
      100bca80 R __host_cmd_0x00000x0097
      100bca8c R __host_cmd_0x00000x0098
      100bca98 R __host_cmd_0x00000x0099
      100bcaa4 R __host_cmd_0x00000x009e
      100bcab0 R __host_cmd_0x00000x00a0
      100bcabc R __host_cmd_0x00000x00a1
      100bcac8 R __host_cmd_0x00000x00a8
      100bcad4 R __host_cmd_0x00000x00a9
      100bcae0 R __host_cmd_0x00000x00b6
      100bcaec R __host_cmd_0x00000x00b7
      100bcaf8 R __host_cmd_0x00000x00d2
      100bcb04 R __host_cmd_0x00000x00d3
      100bcb10 R __host_cmd_0x00000x00db
      100bcb1c R __host_cmd_0x00000x0101
      100bcb28 R __host_cmd_0x00000x0102
      100bcb34 R __host_cmd_0x00000x0103
      100bcb40 R __host_cmd_0x00000x0104
      100bcb4c R __host_cmd_0x00000x0110
      100bcb58 R __host_cmd_0x00000x0111
      100bcb64 R __host_cmd_0x00000x0112
      100bcb70 R __host_cmd_0x00000x0113
      100bcb7c R __host_cmd_0x00000x0114
      100bcb88 R __host_cmd_0x00000x0115
      100bcb94 R __host_cmd_0x00000x0116
      100bcba0 R __host_cmd_0x00000x0117
      100bcbac R __host_cmd_0x00000x0118
      100bcbb8 R __host_cmd_0x00000x011a
      100bcbc4 R __evt_src_EC_MKBP_EVENT_KEY_MATRIX
      100bcbc4 R __hcmds_end
BRANCH=none

Change-Id: I5d13d2a7fe7fa9a0fbeed43177cc612f572a58bb
Reviewed-on: https://chromium-review.googlesource.com/419702
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-01-06 11:10:03 -08:00
Vadim Bendebury
32b064108a common: introduce malloc/free implementation
The new code allows to replace the existing one buffer at a time
shared memory facility with a malloc/free implementation. A new
configuration option is being provided (CONFIG_MALLOC).

The names of functions allocating and freeing memory are not being
changed to allow to switch between the two implementations seamlessly.

A double linked list of buffers is used to keep track of free and
allocated memory. During initialization the entire free memory block
is considered a single free buffer. No allocations/frees are allowed
from within interrupts. The control structures are protected by a
semaphore, so allocate and free invocation could be blocking.

A test is added which randomly allocates and frees memory, continuing
until all branches in the allocate and free functions are taken.

BUG=chrome-os-partner:
TEST=make buildall -j succeeds, which includes testing the new
     malloc/free implementation.

Change-Id: I5e71c0190c6c247ec73bb459f66a6d7a06e3d248
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/420466
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-05 21:13:09 -08:00
Vadim Bendebury
6731584e15 test: sort test names in build.mk
This is a purely cosmetic patch making it easier to maintain the list
of test in the ec tree.

BRANCH=none
BUG=none
TEST=make buildall -j succeeds

Change-Id: I2f0407c99776ad9d66445ea177a707bdfaa9b815
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424175
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-12-29 00:58:15 -08:00
Bill Richardson
971e758dde Add nvmem-backed key=value variable storage
The CONFIG_FLASH_NVMEM option implements persistent, reliable storage
regions in flash. This adds CONFIG_FLASH_NVMEM_VARS, which uses one of
those storage regions for free-form variables.

Refer to the comments in include/nvmem_vars.h and common/nvmem_vars.c
for usage and implementation details.

BUG=chrome-os-partner:61107
BRANCH=none
TEST=make runtests

This CL includes a number of new tests, specifically for this feature.

No target boards use this feature yet so there's nothing to test on
actual hardware, but the test/nvmem_vars executable includes console
commands ("get", "set", "print") to try it out.

Change-Id: I8597415dc3b00a1462f5b164eeb5073129030525
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/414194
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-12-21 19:42:37 -08:00
Vijay Hiremath
f66113247a charge_state_v2: Limit i/p current to meet allowed MAX i/p system power
If battery is not present, input current is set to PD_MAX_CURRENT_MA.
If the input power set is greater than the maximum allowed system power,
system might get damaged. Hence, limit the input current to meet maximum
allowed input system power.

BUG=chrome-os-partner:58498
BRANCH=none
TEST=Manually tested on Reef. Removed the battery & using 'charger'
     console command observed the following.
     With Zinger charger at 20V - Input current is set to 2.25A
     With Type-C & other chargers - Input current is set to 3A

Change-Id: Ife8686f322e095aa74b740a7c469bfe87107fb9a
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/397865
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-12-05 16:43:00 -08:00
Shawn Nematbakhsh
64414f92b3 pd: Limit input current to 500mA on PD voltage transition
Upon requesting a PD power contract at a new voltage, keep the input
current limit at 500mA until PD_RDY is received.

BUG=b:30744563,chrome-os-partner:59311,chrome-os-partner:44340
BRANCH=ryu, gru, glados
TEST=Manual on kevin, set ilim to 5V through `chglim` console command,
attach zinger. Set ilim to 20V through `chglim`, verify that ilim goes
from 3A to 500mA to 3A.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I452f183cfb958780e336a9f99dc6398356de17a0
Reviewed-on: https://chromium-review.googlesource.com/399918
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-12-05 16:42:58 -08:00
Sam Hurst
22858a07a5 usb pd: Resend request after receiving a WAIT in response to a request
When a WAIT is received in response to a request, wait SinkRequestTime
before resending the request.

BUG=chrome-os-partner:34984
TEST=make -j buildall
BRANCH=none

Change-Id: I5c8429c4a7b9cf06609996f924b8d9d535ab6b5f
Reviewed-on: https://chromium-review.googlesource.com/414533
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-12-02 16:52:52 -08:00
Nicolas Boichat
d7178e9b5f test/rsa: Add test for RSA with public exponent 3
This tests RSA 2048 with public exponent 3.

BRANCH=none
BUG=chromium:663631
TEST=make run-rsa3

Change-Id: I979ad4a23de6baba63aba037d2713b74fed4737f
Reviewed-on: https://chromium-review.googlesource.com/408130
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-10 21:28:29 -08:00
Nicolas Boichat
f44bc36982 test/rsa: Add test for RSA signature checking
This tests RSA 2048 with public exponent F4 (65537).

BRANCH=none
BUG=chromium:663631
TEST=make run-rsa3

Change-Id: I195a349bb9a862606971054adc9ac3b56a817fe7
Reviewed-on: https://chromium-review.googlesource.com/408129
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2016-11-09 21:14:17 -08:00
Furquan Shaikh
2fc7ba9df1 common: Add new recovery mode button combination
This adds new key combination (Left_Shift+Esc+Refresh+Power) that triggers
recovery mode by setting a new host event
EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT. This host event can be used
whenever user wants to request entry into recovery mode by
reinitializing all the hardware state (e.g. memory retraining).

BUG=chrome-os-partner:56643,chrome-os-partner:59352
BRANCH=None
TEST=Verified that device retrains memory in recovery mode
with (Left_Shift+Esc+Refresh+Power) on reef.

Change-Id: I2e08997acfd9e22270b8ce7a5b589cd5630645f8
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407827
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-08 20:30:07 -08:00
Gwendal Grignou
9b67ffcd52 common: Add tablet_mode API
Simple API to set/get the tablet mode. It can be set via lid angle
calculation or if a board has a dedicated HAL sensor/GPIO.

Merged from glados branch, add MKBP switch support.

BUG=chromium:606718
BRANCH=gru
TEST=Check with Cave that both mode works.

Reviewed-on: https://chromium-review.googlesource.com/402089
Reviewed-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit c940f36ceabcf2425284001298f03ebdb4c3079e)
Change-Id: I2ee5130f3e0a1307ec3ea543f7a32d66bc32b31d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404915
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 17:11:28 -08:00