AESsource

Embed Size (px)

Citation preview

  • 7/25/2019 AESsource

    1/4

    #include#include#include"magic_instruction.h"#defneMY_MAGIC(n) !

    asm olatile("mol $% ea&"' no out*uts

    ' "g"(n) ' "ea&")+ MAGIC($)+

    ,unsignedshortintstate-/-/+unsignedshortint0ound1e2-345/+unsignedshortint0con-33/ 6 ! $&$% $&$3% $&$7% $&$% $&$8% $&3$% $&7$%$&$% $&8$% $&39% $&:5 ,+unsignedshortints9o&-7;5/ 6 !

    $ 3 7 : ; 5 4 8 A = C ? @$&5:% $&4c% $&44% $&49% $&7% $&59% $&5% $&c;% $&:$% $&$3% $&54%$&79% $&e% $&d4% $&a9% $&45% $$&ca% $&87% $&c% $&4d% $&a% $&;% $&4% $&$% $&ad% $&d% $&a7%$&a% $&c% $&a% $&47% $&c$% 3$&94% $&d% $&:% $&75% $&:5% $&:% $&4% $&cc% $&:% $&a;% $&e;%$&3% $&43% $&d8% $&:3% $&3;% 7$&$% $&c4% $&7:% $&c:% $&38% $&5% $&$;% $&a% $&$4% $&37% $&8$%$&e7% $&e9% $&74% $&97% $&4;% :$&$% $&8:% $&7c% $&3a% $&39% $&5e% $&;a% $&a$% $&;7% $&:9% $&d5%$&9:% $&7% $&e:% $&7% $&8% $&;:% $&d3% $&$$% $&ed% $&7$% $&c% $&93% $&;9% $&5a% $&c9% $&9e%$&:% $&a% $&c% $&;8% $&c% ;$&d$% $&e% $&aa% $&9% $&:% $&d% $&::% $&8;% $&;% $&% $&$7%$&4% $&;$% $&:c% $&% $&a8% 5$&;3% $&a:% $&$% $&8% $&7% $&d% $&:8% $&;% $&9c% $&95% $&da%$&73% $&3$% $&B% $&:% $&d7% 4$&cd% $&$c% $&3:% $&ec% $&;% $&4% $&% $&34% $&c% $&a4% $&4e%

    $&:d% $&5% $&;d% $&3% $&4:% 8$&5$% $&83% $&% $&dc% $&77% $&7a% $&$% $&88% $&5% $&ee% $&98%$&3% $&de% $&;e% $&$9% $&d9% $&e$% $&:7% $&:a% $&$a% $&% $&$5% $&7% $&;c% $&c7% $&d:% $&ac%$&57% $&3% $&;% $&e% $&4% A$&e4% $&c8% $&:4% $&5d% $&8d% $&d;% $&e% $&a% $&5c% $&;5% $&%$&ea% $&5;% $&4a% $&ae% $&$8% =$&9a% $&48% $&7;% $&7e% $&3c% $&a5% $&9% $&c5% $&e8% $&dd% $&4%$&3% $&9% $&9d% $&89% $&8a% C$&4$% $&:e% $&9;% $&55% $&8% $&$:% $&5% $&$e% $&53% $&:;% $&;4%$&9% $&85% $&c3% $&3d% $&e% $&e3% $&8% $&8% $&33% $&5% $&d% $&8e% $&% $&9% $&3e% $&84%$&e% $&ce% $&;;% $&78% $&d% ?$&8c% $&a3% $&8% $&$d% $&9% $&e5% $&7% $&58% $&3% $&% $&7d%

    $&$% $&9$% $&;% $&99% $&35 @,+unsignedchartimes7(unsignedshortint9)!

    i((9>> 4)) return((9

  • 7/25/2019 AESsource

    2/4

    ,oidaes378_Dhit0oFs()!

    unsignedshortinttem*+tem* 6 state-3/-$/+state-3/-$/ 6 state-3/-3/+state-3/-3/ 6 state-3/-7/+

    state-3/-7/ 6 state-3/-:/+state-3/-:/ 6 tem*+tem* 6 state-7/-$/+state-7/-$/ 6 state-7/-7/+state-7/-7/ 6 tem*+tem* 6 state-7/-3/+state-7/-3/ 6 state-7/-:/+state-7/-:/ 6 tem*+tem* 6 state-:/-$/+state-:/-$/ 6 state-:/-:/+state-:/-:/ 6 state-:/-7/+

    state-:/-7/ 6 state-:/-3/+state-:/-3/ 6 tem*+

    ,oidaes378_Add0ound1e2(unsignedshortintround)!

    inti% +or(i 6 $+ i

  • 7/25/2019 AESsource

    3/4

    ,oidaes378_1e2?&*ansion(unsignedshortintci*her_e2-35/)!

    inti% +unsignedshortinttem*-/% +or(i 6 $+ i

  • 7/25/2019 AESsource

    4/4

    aes378_Add0ound1e2(round)+,aes378_Du9=2tes()+aes378_Dhit0oFs()+

    aes378_Add0ound1e2(3$)+MY_MAGIC(7)+ Collect simulation data on K?

    *rint("nCi*herLe&t'n")+or(i 6 $+ i