On 8/6/26 17:12, Harald Freudenberger wrote:
Add base support for cpacf protected key handling.
Add support for the pckmo subfunctions PCKMO-Encrypt-AES-128-Key,
PCKMO-Encrypt-AES-192-Key and PCKMO-Encrypt-AES-256-Key which deal
with protected keys. These pckmo subfunctions derive a protected key
from an AES clear key by encrypting it with an internal AES wrapping
key. More details about protected keys can be found in the
"z/Architecture Prinziples of Operation" document.

The qemu version provided here is only a fake intended to make
protected key available for developing and testing purpose:
* The protected key is 'derived' from the clear key by xoring
   the fixed pattern 0xAAAA... onto the key value.
* The AES Wrapping Key Verification Pattern is a fixed
   value of 32 bytes 0xFACEFACE...

Add preprocessor defines for the xor pattern and wkvp used to
construct ('encrypt') a protected key from a clear key value with
this implementation. Also add some static functions to 'encrypt'
from clear key to protected key and 'decrypt' back to cpacf_aes.c.

The preprocessor defines shall be used later in testcases to
construct and decode protected keys.

Signed-off-by: Harald Freudenberger <[email protected]>
Tested-by: Holger Dengler <[email protected]>
---
  target/s390x/gen-features.c      |  3 ++
  target/s390x/tcg/cpacf.h         | 29 +++++++++++++++
  target/s390x/tcg/cpacf_aes.c     | 64 ++++++++++++++++++++++++++++++++
  target/s390x/tcg/crypto_helper.c | 21 +++++++++++
  target/s390x/tcg/translate.c     |  9 ++++-
  5 files changed, 124 insertions(+), 2 deletions(-)

Reviewed-by: Ilya Leoshkevich <[email protected]>



Reply via email to