;/*## (c) SECURITY EXPLORATIONS    2011-2018 poland                           #*/
;/*##     http://www.security-explorations.com                                #*/
;
;/* RESEARCH MATERIAL:	SRP-2018-02                                            */
;/* [Exploitation Framework for STMicroelectronics DVB chipsets]               */
;
;SlimCORE sample illustrating 0xffff0000 TKD command (TDES mode)
;INPUT:  ARG0-ARG3 - input vector for TKD command
;OUTPUT: RES0-RES3 - the result of executing TKD command

.data 0x4140

.def ARG0
.def ARG1
.def ARG2
.def ARG3

.def RES0
.def RES1
.def RES2
.def RES3
.def tkdcmd
.word 0xffff0000
.code 0x05b7
  mov r0,#0000
  copTDES
  ld r15,[r0+tkdcmd]
l1:
  wait1 l1
  ld r15,[r0+ARG0]
  ld r15,[r0+ARG1]
  ld r15,[r0+ARG2]
  ld r15,[r0+ARG3]
l2:
  wait1 l2
  st r15,[r0+RES0]
  st r15,[r0+RES1]
  st r15,[r0+RES2]
  st r15,[r0+RES3]
