diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2019-08-22 13:19:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-04 20:10:45 +0000 |
commit | 24f7511e41c1f8140b19d69d9440a3ea6f91bd89 (patch) | |
tree | aac309487ef2e8832da36bca3e10bb03d1186088 /chip | |
parent | 7e672869de0142a0af9c90875a732600e9fb5d87 (diff) | |
download | chrome-ec-24f7511e41c1f8140b19d69d9440a3ea6f91bd89.tar.gz |
g: Add support for 192 and 256 bit AES-GCM in DCRYPTO_gcm_init
DCRYPTO_gcm_init hardcoded key length to 128 bit causing preventing
testing of 192 and 256 bit functionality for AES-GCM.
BUG=b:135623371
BRANCH=cr50
TEST=compile, specific test for issue as described in bug
Change-Id: I4fc41f6155661709115c57aa944c8976e17bffac
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1766098
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/dcrypto/dcrypto.h | 4 | ||||
-rw-r--r-- | chip/g/dcrypto/gcm.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/chip/g/dcrypto/dcrypto.h b/chip/g/dcrypto/dcrypto.h index 7bab4b864b..1de0d63b03 100644 --- a/chip/g/dcrypto/dcrypto.h +++ b/chip/g/dcrypto/dcrypto.h @@ -80,8 +80,8 @@ struct GCM_CTX { }; /* Initialize the GCM context structure. */ -void DCRYPTO_gcm_init(struct GCM_CTX *ctx, const uint8_t *key, - const uint8_t *iv, size_t iv_len); +void DCRYPTO_gcm_init(struct GCM_CTX *ctx, uint32_t key_bits, + const uint8_t *key, const uint8_t *iv, size_t iv_len); /* Additional authentication data to include in the tag calculation. */ void DCRYPTO_gcm_aad(struct GCM_CTX *ctx, const uint8_t *aad_data, size_t len); /* Encrypt & decrypt return the number of bytes written to out diff --git a/chip/g/dcrypto/gcm.c b/chip/g/dcrypto/gcm.c index 2caddf4741..cd035bbd54 100644 --- a/chip/g/dcrypto/gcm.c +++ b/chip/g/dcrypto/gcm.c @@ -82,8 +82,8 @@ static void gcm_init_iv( } } -void DCRYPTO_gcm_init(struct GCM_CTX *ctx, const uint8_t *key, - const uint8_t *iv, size_t iv_len) +void DCRYPTO_gcm_init(struct GCM_CTX *ctx, uint32_t key_bits, + const uint8_t *key, const uint8_t *iv, size_t iv_len) { int i; const uint32_t zero[4] = {0, 0, 0, 0}; @@ -93,7 +93,7 @@ void DCRYPTO_gcm_init(struct GCM_CTX *ctx, const uint8_t *key, memset(ctx, 0, sizeof(struct GCM_CTX)); /* Initialize AES engine in CTR mode, and set the counter to 0. */ - DCRYPTO_aes_init(key, 128, (const uint8_t *) zero, + DCRYPTO_aes_init(key, key_bits, (const uint8_t *) zero, CIPHER_MODE_CTR, ENCRYPT_MODE); /* Set H to AES(ZERO). */ DCRYPTO_aes_block((const uint8_t *) zero, (uint8_t *) H); |