diff options
author | Paul Selkirk <paul@psgd.org> | 2019-02-05 13:11:19 -0500 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2019-04-09 18:08:45 -0400 |
commit | 1376b16e3bead769e56e531b1c121ea68b60f49f (patch) | |
tree | d82db424fb43708baae51210f9ec7afb47d991a3 /ks.c | |
parent | 411b5a9ee7d28d2bce9b297a865132e39712d93b (diff) |
Track Joachim's latest keywrap core - KEK remains in the AES core until it times out or is explicitly zeroed out.
Diffstat (limited to 'ks.c')
-rw-r--r-- | ks.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -536,9 +536,6 @@ static hal_error_t construct_key_block(hal_ks_block_t *block, return HAL_ERROR_IMPOSSIBLE; hal_ks_key_block_t *k = &block->key; - hal_error_t err = HAL_OK; - uint8_t kek[KEK_LENGTH]; - size_t kek_len; memset(block, 0xFF, sizeof(*block)); @@ -552,12 +549,7 @@ static hal_error_t construct_key_block(hal_ks_block_t *block, k->der_len = SIZEOF_KS_KEY_BLOCK_DER; k->attributes_len = 0; - if ((err = hal_mkm_get_kek(kek, &kek_len, sizeof(kek))) == HAL_OK) - err = hal_aes_keywrap(NULL, kek, kek_len, der, der_len, k->der, &k->der_len); - - memset(kek, 0, sizeof(kek)); - - return err; + return hal_aes_keywrap(NULL, NULL, 0, der, der_len, k->der, &k->der_len); } /* @@ -658,19 +650,14 @@ hal_error_t hal_ks_fetch(hal_ks_t *ks, if (der != NULL) { - uint8_t kek[KEK_LENGTH]; - size_t kek_len, der_len_; - hal_error_t err; + size_t der_len_; if (der_len == NULL) der_len = &der_len_; *der_len = der_max; - if ((err = hal_mkm_get_kek(kek, &kek_len, sizeof(kek))) == HAL_OK) - err = hal_aes_keyunwrap(NULL, kek, kek_len, der, k_der_len, der, der_len); - - memset(kek, 0, sizeof(kek)); + err = hal_aes_keyunwrap(NULL, NULL, 0, der, k_der_len, der, der_len); } return err; |