On 17.06.26 11:48, Harald Freudenberger wrote:
Support CPACF pcc subfunctions PCC-Compute-XTS-Parameter-Encrypted-AES-128
and PCC-Compute-XTS-Parameter-Encrypted-AES-128 but only for the special
case block sequential number is 0. However, this covers the s390 PAES XTS
implementation in the Linux kernel.

Signed-off-by: Harald Freudenberger <[email protected]>
Tested-by: Holger Dengler <[email protected]>

With the suggestions:

Reviewed-by: Finn Callies <[email protected]>

---
  target/s390x/gen-features.c      |  2 +
  target/s390x/tcg/cpacf.h         |  2 +
  target/s390x/tcg/cpacf_aes.c     | 80 ++++++++++++++++++++++++++++++++
  target/s390x/tcg/crypto_helper.c |  4 ++
  4 files changed, 88 insertions(+)

diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
index 4a131dc191..126bacb281 100644
--- a/target/s390x/gen-features.c
+++ b/target/s390x/gen-features.c
@@ -943,6 +943,8 @@ static uint16_t qemu_MAX[] = {
      S390_FEAT_KMCTR_EAES_256,
      S390_FEAT_PCC_XTS_AES_128,
      S390_FEAT_PCC_XTS_AES_256,
+    S390_FEAT_PCC_XTS_EAES_128,
+    S390_FEAT_PCC_XTS_EAES_256,

EAES -> PAES or EAES -> ENCRYPTED_AES

      S390_FEAT_PCKMO_AES_128,
      S390_FEAT_PCKMO_AES_192,
      S390_FEAT_PCKMO_AES_256,

[ snip ]

diff --git a/target/s390x/tcg/crypto_helper.c b/target/s390x/tcg/crypto_helper.c
index 60c3ebd79e..38f7d900fa 100644
--- a/target/s390x/tcg/crypto_helper.c
+++ b/target/s390x/tcg/crypto_helper.c
@@ -206,6 +206,10 @@ static int cpacf_pcc(CPUS390XState *env, const int 
mmu_idx, uintptr_t ra,
      case 0x34: /* CPACF PCC compute XTS param AES-256 */
              rc = cpacf_aes_pcc(env, mmu_idx, ra, env->regs[1], fc);
              break;
+    case 0x3a: /* CPACF_PCC compute XTS param Encrypted AES-128 */
+    case 0x3c: /* CPACF PCC compute XTS param Encrypted AES-256 */
+            rc = cpacf_paes_pcc(env, mmu_idx, ra, env->regs[1], fc);
+            break;

Funny enough that you got the ordering here correct xD

      default:
          g_assert_not_reached();
      }


Reply via email to