rc4-586.pl revision 7c478bd95313f5f23a4c958a745db2134aa03244
# define for pentium pro friendly version
require "x86asm.pl";
$tx="eax";
$ty="ebx";
$x="ecx";
$y="edx";
$in="esi";
$out="edi";
$d="ebp";
&RC4("RC4");
&asm_finish();
sub RC4_loop
{
local($n,$p,$char)=@_;
&comment("Round $n");
if ($char)
{
if ($p >= 0)
{
}
else
{
}
}
# Moved out
# &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0;
&and( $y, 0xff);
&inc( $x); # NEXT ROUND
# XXX
&nop();
# XXX
if (!$char)
{
#moved up into last round
if ($p >= 1)
{
}
}
else
{
# Note in+=8 has occured
# XXX
# XXX
}
}
sub RC4
{
local($name)=@_;
&comment("");
&push("ebp");
&push("ebx");
&push("esi");
&push("edi");
&inc( $x);
&add( $d, 8);
&and( $x, 0xff);
# check for 0 length input
&set_label("start");
# filling DELAY SLOT
&comment("apply the cipher text");
# xor the cipher data with input
#&add( $out, 8); #moved up into last round
&set_label("end");
# There is quite a bit of extra crap in RC4_loop() for this
# first round
&set_label("finished");
&dec( $x);
&stack_pop(3);
&function_end($name);
}