summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2016-02-02 16:37:16 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-03 14:59:36 -0800
commitdfb7901709e846a5b99a33155f27af803e5881a5 (patch)
tree0847274e1cacd8cc9518cc202c8dbc0cd9366818
parent1ca95368356607024289887297612dd3c1de589e (diff)
downloadchrome-ec-dfb7901709e846a5b99a33155f27af803e5881a5.tar.gz
CR50: fix unaligned memory accesses in dcrypto/aes.
BRANCH=none TEST=new tests under test/tpm2/ pass. BUG=chrome-os-partner:43025,chrome-os-partner:47524 Change-Id: Ibfc92eae8238954a861a8e91432f90db6d174ead Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/325495 Commit-Ready: Vadim Bendebury <vbendeb@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Vadim Bendebury <vbendeb@google.com>
-rw-r--r--chip/g/dcrypto/aes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/chip/g/dcrypto/aes.c b/chip/g/dcrypto/aes.c
index ac0fd32f93..1fb445feec 100644
--- a/chip/g/dcrypto/aes.c
+++ b/chip/g/dcrypto/aes.c
@@ -102,17 +102,17 @@ int DCRYPTO_aes_block(const uint8_t *in, uint8_t *out)
void DCRYPTO_aes_write_iv(const uint8_t *iv)
{
int i;
- const uint32_t *p = (const uint32_t *) iv;
+ const struct access_helper *p = (const struct access_helper *) iv;
for (i = 0; i < 4; i++)
- GR_KEYMGR_AES_CTR(i) = p[i];
+ GR_KEYMGR_AES_CTR(i) = p[i].udata;
}
void DCRYPTO_aes_read_iv(uint8_t *iv)
{
int i;
- uint32_t *p = (uint32_t *) iv;
+ struct access_helper *p = (struct access_helper *) iv;
for (i = 0; i < 4; i++)
- p[i] = GR_KEYMGR_AES_CTR(i);
+ p[i].udata = GR_KEYMGR_AES_CTR(i);
}