Skip to content

Commit

Permalink
Refactor tr31_export() to use processing state object
Browse files Browse the repository at this point in the history
* Copy export flags to processing state object. Eventually this will be
  removed from the context object.
* Remove internal processing fields from context object and let context
  object parameter for tr31_export() be const
* Let tr31_state_prepare_export() update final key block length in key
  block header

At a high level, tr31_state_prepare_export() will populate a buffer
containing the key block header and wrapped key, including key length
obfuscation and padding. For format version A and C, the encrypted
payload can easily be copied in such that the buffer can then be used
for CBC-MAC generation. For format version B and D, the buffer can be
used as-is for CMAC generation.

This change is part of a wider effort to move the fields intended for
internal use out of the context object where they are visible to the
caller. Instead a new internal processing state object will hold these
fields and ensure that they are properly cleansed.
  • Loading branch information
leonlynch committed Oct 22, 2023
1 parent ab7d669 commit ae4608d
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 248 deletions.
Loading

0 comments on commit ae4608d

Please sign in to comment.