SideChannelMarvels / Daredevil

A tool to perform (higher-order) correlation power analysis attacks (CPA).
GNU General Public License v3.0
155 stars 37 forks source link

Buggy rankings in config bitnum=all #1

Open doegox opened 8 years ago

doegox commented 8 years ago

There is one single PriorityQueue no matter which bit is used, so in the configuration bitnum=all, ranking for the last target bits contain previous results.

E.g. testing wbs_aes_hacklu2009/DCA/addr8_r_20_5888.config in attack mode with:

bitnum=7
bytenum=0
#correct_key=0x14 2b be 0e 2d 22 e4 80 97 49 7d 5f ac 5b 59 26

gives

[INFO]<>Global top 20 correlations.

        0.904534    0x4f      1101
       -0.904534    0x29       430
        0.904534    0x4f      1133
       -0.904534    0x95      4420
       -0.904534    0x29       438
       -0.904534    0x29       470
       -0.904534    0x29       502
       -0.904534    0xea      1301
       -0.904534    0x98      5799
        0.904534    0x4f      1061
       -0.904534    0x95      4372
       -0.904534    0x95      4452
        0.904534    0x4f      1053
       -0.904534    0x95      4364
       -0.902671    0xaf      3731
       -0.902671    0xaf      3811
       -0.902671    0xc6      4419
       -0.902671    0x4a      3062
       -0.902671    0x80      1538
       -0.902671    0x4a      2998

Rank   Correlation    Key       Sample(s)
0.       -0.904534    0x95      4420
1.       -0.904534    0xea      1301
2.       -0.904534    0x98      5799
3.        0.904534    0x4f      1053
4.       -0.904534    0x29       430
5.       -0.902671    0x1a      4638
etc

While with:

bitnum=all
bytenum=0
#correct_key=0x14 2b be 0e 2d 22 e4 80 97 49 7d 5f ac 5b 59 26

the results for bit 7 become:

[INFO]<>Global top 20 correlations.

              -1    0x3f      4604
               1    0x14       221
               1    0x14       253
               1    0xa       1941
               1    0x14       133
               1    0x14       250
               1    0x14       187
               1    0x14       130
               1    0x14       186
               1    0x14       135
               1    0x14       134
               1    0x14       131
               1    0x14       251
               1    0x14       189
               1    0x14       219
              -1    0x54      1957
               1    0x14       254
               1    0x14       222
               1    0x14       190
               1    0x14       218

Rank   Correlation    Key       Sample(s)
0.       -0.904534    0x95      4420
1.       -0.904534    0xea      1301
2.       -0.904534    0x98      5799
3.        0.904534    0x4f      1053
4.       -0.904534    0x29       430
5.       -0.902671    0x1a      4638

I assigned to @jwbos but feel free to check with @pbottine