name: Test TPM Configs

on:
  push:
    branches: [ 'master', 'main', 'release/**' ]
  pull_request:
    branches: [ '*' ]

jobs:

  sim_tpm_debug:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm.config
      make-args: DEBUG=1

  sim_tpm_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm.config
      make-args: SIGN=ECC256 HASH=SHA256

  sim_tpm_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm.config
      make-args: SIGN=ECC384 HASH=SHA384

  sim_tpm_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm.config
      make-args: SIGN=RSA2048ENC HASH=SHA256


  sim_tpm_measured_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-measured.config
      make-args: SIGN=ECC256 HASH=SHA256

  sim_tpm_measured_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-measured.config
      make-args: SIGN=ECC384 HASH=SHA384

  sim_tpm_measured_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-measured.config
      make-args: SIGN=RSA2048 HASH=SHA256


  sim_tpm_keystore_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=ECC256 HASH=SHA256
      keyauthstr: TestAuth

  sim_tpm_keystore_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=ECC384 HASH=SHA384
      rot-args: -sha384
      keyauthstr: TestAuth

  sim_tpm_keystore_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=RSA2048 HASH=SHA256
      keyauthstr: TestAuth


  sim_tpm_keystore_noauth_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=ECC256 HASH=SHA256

  sim_tpm_keystore_noauth_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=ECC384 HASH=SHA384
      rot-args: -sha384

  sim_tpm_keystore_noauth_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-keystore.config
      make-args: SIGN=RSA2048 HASH=SHA256


  sim_tpm_seal_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      make-args: SIGN=ECC256 HASH=SHA256 POLICY_FILE=policy.bin
      keyauthstr: TestAuth
      sealauthstr: SealAuth

  sim_tpm_seal_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      make-args: SIGN=ECC384 HASH=SHA384 POLICY_FILE=policy.bin
      rot-args: -sha384
      keyauthstr: TestAuth
      sealauthstr: SealAuth

  sim_tpm_seal_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      # use larger image header size for two 2048-bit signatures
      make-args: SIGN=RSA2048ENC HASH=SHA256 POLICY_FILE=policy.bin IMAGE_HEADER_SIZE=1024
      keyauthstr: TestAuth
      sealauthstr: SealAuth


  sim_tpm_seal_noauth_ecc256:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      make-args: SIGN=ECC256 HASH=SHA256 POLICY_FILE=policy.bin
      keyauthstr: TestAuth

  sim_tpm_seal_noauth_ecc384:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      make-args: SIGN=ECC384 HASH=SHA384 POLICY_FILE=policy.bin
      rot-args: -sha384
      keyauthstr: TestAuth

  sim_tpm_seal_noauth_rsa2048:
    uses: ./.github/workflows/test-build-sim-tpm.yml
    with:
      arch: host
      config-file: ./config/examples/sim-tpm-seal.config
      # use larger image header size for two 2048-bit signatures
      make-args: SIGN=RSA2048ENC HASH=SHA256 POLICY_FILE=policy.bin IMAGE_HEADER_SIZE=1024
      keyauthstr: TestAuth
