svc_chains:
  - svc_chain:
      idx: 1
      #description: "Compress+Encrypt chaining"
      input:
        pattern: ababababababababababababababababababababababababababababababababababababab1234
        len: '$2block'
      ops:
        - compress:
            flags: 'zero_pad,insert_header'
            hdr_fmt_idx: 1
            threshold_delta: 8
            output_file: '%chain_id%_compressed.bin'
        - encrypt:
            key_idx: 1
            iv_data: 000102030405060708090a0b0c0d0e0f
            output_file: '%chain_id%_encrypted.bin'
  - svc_chain:
      idx: 2
      #description: "Decrypt+Decompress chaining"
      input:
        file: '1_encrypted.bin'
      ops:
        - decrypt:
            key_idx: 1
            iv_data: 000102030405060708090a0b0c0d0e0f
            output_file: '%chain_id%_decrypted.bin'
        - decompress:
            flags: 'header_present'
            hdr_fmt_idx: 1
            output_file: '%chain_id%_decompressed.bin'
tests:
  - test:
      idx: 1
      svc_chains: 1
      repeat: 64
      mode: 'async'
      validations:
        - retcode_compare:
            idx: 1
            retcode: 0
            svc_retcodes: 0
        - size_compare:
            idx: 2
            type: lt
            file1: '1_compressed.bin'
            val: '$2block'
        - data_compare:
            idx: 3
            file1: '1_compressed.bin'
            pattern: 0x00
            offset: eof
            len: eob
        - size_compare:
            idx: 1
            file1: '1_encrypted.bin'
            val: '$1block'
  - test:
      idx: 2
      svc_chains: 2
      repeat: 64
      mode: 'async'
      validations:
        - retcode_compare:
            idx: 1
            retcode: 0
            svc_retcodes: 0
        - size_compare:
            idx: 2
            file1: '2_decrypted.bin'
            val: '$1block'
        - size_compare:
            idx: 1
            file1: '2_decompressed.bin'
            val: '$2block'
