CR50: configure AES rand stalls

This change configures the AES engine to
a) enable rand stalls at 25% during regular
operation through AES API's, and b) disable
rand stalls when doing fixed-key bulk-encryption
(e.g. NVRAM ciphering).

TCG tests continue to complete in ~20 minutes
(i.e. no noticable slowdown).

BRANCH=none
BUG=b:38315169
TEST=TCG tests pass

Change-Id: I2d26d232491a27bffbbe0b5aedfebaf04e0ad509
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/502717
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
nagendra modadugu
2017-05-11 10:54:53 -07:00
committed by chrome-bot
parent ed1532bf81
commit bbdb9fb321
2 changed files with 13 additions and 0 deletions

View File

@@ -16,6 +16,13 @@ static void set_control_register(
GWRITE_FIELD(KEYMGR, AES_CTRL, ENC_MODE, encrypt);
GWRITE_FIELD(KEYMGR, AES_CTRL, CTR_ENDIAN, CTRL_CTR_BIG_ENDIAN);
GWRITE_FIELD(KEYMGR, AES_CTRL, ENABLE, CTRL_ENABLE);
/* Turn off random nops (which are enabled by default). */
GWRITE_FIELD(KEYMGR, AES_RAND_STALL_CTL, STALL_EN, 0);
/* Configure random nop percentage at 25%. */
GWRITE_FIELD(KEYMGR, AES_RAND_STALL_CTL, FREQ, 1);
/* Now turn on random nops. */
GWRITE_FIELD(KEYMGR, AES_RAND_STALL_CTL, STALL_EN, 1);
}
static int wait_read_data(volatile uint32_t *addr)

View File

@@ -94,6 +94,12 @@ static int aes_init(struct APPKEY_CTX *ctx, enum dcrypto_appid appid,
GWRITE_FIELD(KEYMGR, AES_CTRL, ENC_MODE, ENCRYPT_MODE);
GWRITE_FIELD(KEYMGR, AES_CTRL, CTR_ENDIAN, CTRL_CTR_BIG_ENDIAN);
/*
* For fixed-key, bulk ciphering, turn off random nops (which
* are enabled by default).
*/
GWRITE_FIELD(KEYMGR, AES_RAND_STALL_CTL, STALL_EN, 0);
/* Enable hidden key usage, each appid gets its own
* USR, with USR0 starting at 0x2a0.
*/