{
onEnter: function(log, args, state) {
this.op
=
args[
0
]
this.alg
=
args[
1
]
this.options
=
args[
2
]
this.key
=
args[
3
]
this.keyLength
=
args[
4
]
this.iv
=
args[
5
]
this.dataIn
=
args[
6
]
this.dataInLength
=
args[
7
]
this.dataOut
=
args[
8
]
this.dataOutAvailable
=
args[
9
]
this.dataOutMoved
=
args[
10
]
log(
'CCCrypt('
+
'op: '
+
this.op
+
'[0:加密,1:解密]'
+
', '
+
'alg: '
+
this.alg
+
'[0:AES128,1:DES,2:3DES]'
+
', '
+
'options: '
+
this.options
+
'[1:ECB,2:CBC,3:CFB]'
+
', '
+
'key: '
+
this.key
+
', '
+
'keyLength: '
+
this.keyLength
+
', '
+
'iv: '
+
this.iv
+
', '
+
'dataIn: '
+
this.dataIn
+
', '
+
'inLength: '
+
this.inLength
+
', '
+
'dataOut: '
+
this.dataOut
+
', '
+
'dataOutAvailable: '
+
this.dataOutAvailable
+
', '
+
'dataOutMoved: '
+
this.dataOutMoved
+
')'
)
if
(this.op
=
=
0
) {
log(
"dataIn:"
)
log(hexdump(ptr(this.dataIn), {
length: this.dataInLength.toInt32(),
header: true,
ansi: true
}))
log(
"key: "
)
log(hexdump(ptr(this.key), {
length: this.keyLength.toInt32(),
header: true,
ansi: true
}))
log(
"iv: "
)
log(hexdump(ptr(this.iv), {
length: this.keyLength.toInt32(),
header: true,
ansi: true
}))
}
},
onLeave: function(log, retval, state) {
if
(this.op
=
=
1
) {
log(
"dataOut:"
)
log(hexdump(ptr(this.dataOut), {
length: Memory.readUInt(this.dataOutMoved),
header: true,
ansi: true
}))
log(
"key: "
)
log(hexdump(ptr(this.key), {
length: this.keyLength.toInt32(),
header: true,
ansi: true
}))
log(
"iv: "
)
log(hexdump(ptr(this.iv), {
length: this.keyLength.toInt32(),
header: true,
ansi: true
}))
}
else
{
log(
"dataOut:"
)
log(hexdump(ptr(this.dataOut), {
length: Memory.readUInt(this.dataOutMoved),
header: true,
ansi: true
}))
}
log(
"CCCrypt did finish"
)
}
}