Ticket #13280: bug13280_comparison.diff

File bug13280_comparison.diff, 15.2 KB (added by teor, 5 years ago)

Not to be applied! A diff of the old and new-unsafe sources. Behaviour is identical apart from cast to unsigned char in ed25519_ref10_select

  • fe_mul.i

    diff --git a/bug13280/old/fe_mul.i b/bug13280/unsafe/fe_mul.i
    index 2a680d6..9965d49 100644
    old new  
    11// Preprocessed output for fe_mul.c
    2 // Generated at 2:31:55 am on Monday, September 29, 2014
     2// Generated at 2:23:23 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_mul.c"
     
    3438
    3539
    3640@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    37 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     41# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     42# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h"
     43# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
     44# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
    3845# 5 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe.h" 2
    3946
    4047typedef int32_t fe[10];
    extern void crypto_sign_ed25519_ref10_fe_invert(fe,const fe); 
    6168extern void crypto_sign_ed25519_ref10_fe_pow22523(fe,const fe);
    6269# 2 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_mul.c" 2
    6370# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 1
     71# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h"
     72# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint64.h" 1
     73# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
    6474# 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_mul.c" 2
    6575# 36 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_mul.c"
    6676void crypto_sign_ed25519_ref10_fe_mul(fe h,const fe f,const fe g)
  • fe_sq.i

    diff --git a/bug13280/old/fe_sq.i b/bug13280/unsafe/fe_sq.i
    index 532030b..42f1c34 100644
    old new  
    11// Preprocessed output for fe_sq.c
    2 // Generated at 2:32:24 am on Monday, September 29, 2014
     2// Generated at 2:24:23 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq.c"
     
    3438
    3539
    3640@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    37 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     41# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     42# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h"
     43# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
     44# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
    3845# 5 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe.h" 2
    3946
    4047typedef int32_t fe[10];
    extern void crypto_sign_ed25519_ref10_fe_invert(fe,const fe); 
    6168extern void crypto_sign_ed25519_ref10_fe_pow22523(fe,const fe);
    6269# 2 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq.c" 2
    6370# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 1
     71# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h"
     72# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint64.h" 1
     73# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
    6474# 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq.c" 2
    6575# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq.c"
    6676void crypto_sign_ed25519_ref10_fe_sq(fe h,const fe f)
  • fe_sq2.i

    diff --git a/bug13280/old/fe_sq2.i b/bug13280/unsafe/fe_sq2.i
    index a74b620..e60d029 100644
    old new  
    11// Preprocessed output for fe_sq2.c
    2 // Generated at 2:32:54 am on Monday, September 29, 2014
     2// Generated at 2:26:20 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq2.c"
     
    3438
    3539
    3640@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    37 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     41# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     42# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h"
     43# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
     44# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
    3845# 5 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe.h" 2
    3946
    4047typedef int32_t fe[10];
    extern void crypto_sign_ed25519_ref10_fe_invert(fe,const fe); 
    6168extern void crypto_sign_ed25519_ref10_fe_pow22523(fe,const fe);
    6269# 2 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq2.c" 2
    6370# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 1
     71# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h"
     72# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint64.h" 1
     73# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
    6474# 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq2.c" 2
    6575# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_sq2.c"
    6676void crypto_sign_ed25519_ref10_fe_sq2(fe h,const fe f)
  • fe_tobytes.i

    diff --git a/bug13280/old/fe_tobytes.i b/bug13280/unsafe/fe_tobytes.i
    index 64e94f9..29c760e 100644
    old new  
    11// Preprocessed output for fe_tobytes.c
    2 // Generated at 2:33:15 am on Monday, September 29, 2014
     2// Generated at 2:26:55 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe_tobytes.c"
     
    3438
    3539
    3640@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    37 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     41# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     42# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h"
     43# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
     44# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
    3845# 5 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe.h" 2
    3946
    4047typedef int32_t fe[10];
    void crypto_sign_ed25519_ref10_fe_tobytes(unsigned char *s,const fe h) 
    115122  s[0] = h0 >> 0;
    116123  s[1] = h0 >> 8;
    117124  s[2] = h0 >> 16;
    118   s[3] = (h0 >> 24) | (h1 << 2);
     125  s[3] = (h0 >> 24) | h1 << 2;
    119126  s[4] = h1 >> 6;
    120127  s[5] = h1 >> 14;
    121   s[6] = (h1 >> 22) | (h2 << 3);
     128  s[6] = (h1 >> 22) | h2 << 3;
    122129  s[7] = h2 >> 5;
    123130  s[8] = h2 >> 13;
    124   s[9] = (h2 >> 21) | (h3 << 5);
     131  s[9] = (h2 >> 21) | h3 << 5;
    125132  s[10] = h3 >> 3;
    126133  s[11] = h3 >> 11;
    127   s[12] = (h3 >> 19) | (h4 << 6);
     134  s[12] = (h3 >> 19) | h4 << 6;
    128135  s[13] = h4 >> 2;
    129136  s[14] = h4 >> 10;
    130137  s[15] = h4 >> 18;
    131138  s[16] = h5 >> 0;
    132139  s[17] = h5 >> 8;
    133140  s[18] = h5 >> 16;
    134   s[19] = (h5 >> 24) | (h6 << 1);
     141  s[19] = (h5 >> 24) | h6 << 1;
    135142  s[20] = h6 >> 7;
    136143  s[21] = h6 >> 15;
    137   s[22] = (h6 >> 23) | (h7 << 3);
     144  s[22] = (h6 >> 23) | h7 << 3;
    138145  s[23] = h7 >> 5;
    139146  s[24] = h7 >> 13;
    140   s[25] = (h7 >> 21) | (h8 << 4);
     147  s[25] = (h7 >> 21) | h8 << 4;
    141148  s[26] = h8 >> 4;
    142149  s[27] = h8 >> 12;
    143   s[28] = (h8 >> 20) | (h9 << 6);
     150  s[28] = (h8 >> 20) | h9 << 6;
    144151  s[29] = h9 >> 2;
    145152  s[30] = h9 >> 10;
    146153  s[31] = h9 >> 18;
  • ge_scalarmult_base.i

    diff --git a/bug13280/old/ge_scalarmult_base.i b/bug13280/unsafe/ge_scalarmult_base.i
    index 1e6626a..1b4b0bc 100644
    old new  
    11// Preprocessed output for ge_scalarmult_base.c
    2 // Generated at 2:33:47 am on Monday, September 29, 2014
     2// Generated at 2:27:22 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/ge_scalarmult_base.c"
     
    3640
    3741
    3842@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    39 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     43# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
     44# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h"
     45# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
     46# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int32.h" 2
    4047# 5 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/fe.h" 2
    4148
    4249typedef int32_t fe[10];
    static void ed25519_ref10_select(ge_precomp *t,int pos,signed char b) 
    15041511{
    15051512  ge_precomp minust;
    15061513  unsigned char bnegative = negative(b);
    1507   unsigned char babs = b - (((-bnegative) & b) << 1);
     1514  unsigned char babs = b - (((-bnegative) & (unsigned char)b) << 1);
    15081515
    15091516  crypto_sign_ed25519_ref10_ge_precomp_0(t);
    15101517  cmov(t,&base[pos][0],equal(babs,1));
  • sc_muladd.i

    diff --git a/bug13280/old/sc_muladd.i b/bug13280/unsafe/sc_muladd.i
    index d4969f0..7e08cf2 100644
    old new  
    11// Preprocessed output for sc_muladd.c
    2 // Generated at 2:34:03 am on Monday, September 29, 2014
     2// Generated at 2:27:50 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_muladd.c"
    extern void crypto_sign_ed25519_ref10_sc_muladd(unsigned char *,const unsigned c 
    3539
    3640
    3741@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    38 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
     42# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
     43# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h"
     44# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint64.h" 1
     45# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
    3946# 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_muladd.c" 2
    4047# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
    4148# 4 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_muladd.c" 2
    void crypto_sign_ed25519_ref10_sc_muladd(unsigned char *s,const unsigned char *a 
    363370
    364371  s[0] = s0 >> 0;
    365372  s[1] = s0 >> 8;
    366   s[2] = (s0 >> 16) | (s1 << 5);
     373  s[2] = (s0 >> 16) | s1 << 5;
    367374  s[3] = s1 >> 3;
    368375  s[4] = s1 >> 11;
    369   s[5] = (s1 >> 19) | (s2 << 2);
     376  s[5] = (s1 >> 19) | s2 << 2;
    370377  s[6] = s2 >> 6;
    371   s[7] = (s2 >> 14) | (s3 << 7);
     378  s[7] = (s2 >> 14) | s3 << 7;
    372379  s[8] = s3 >> 1;
    373380  s[9] = s3 >> 9;
    374   s[10] = (s3 >> 17) | (s4 << 4);
     381  s[10] = (s3 >> 17) | s4 << 4;
    375382  s[11] = s4 >> 4;
    376383  s[12] = s4 >> 12;
    377   s[13] = (s4 >> 20) | (s5 << 1);
     384  s[13] = (s4 >> 20) | s5 << 1;
    378385  s[14] = s5 >> 7;
    379   s[15] = (s5 >> 15) | (s6 << 6);
     386  s[15] = (s5 >> 15) | s6 << 6;
    380387  s[16] = s6 >> 2;
    381388  s[17] = s6 >> 10;
    382   s[18] = (s6 >> 18) | (s7 << 3);
     389  s[18] = (s6 >> 18) | s7 << 3;
    383390  s[19] = s7 >> 5;
    384391  s[20] = s7 >> 13;
    385392  s[21] = s8 >> 0;
    386393  s[22] = s8 >> 8;
    387   s[23] = (s8 >> 16) | (s9 << 5);
     394  s[23] = (s8 >> 16) | s9 << 5;
    388395  s[24] = s9 >> 3;
    389396  s[25] = s9 >> 11;
    390   s[26] = (s9 >> 19) | (s10 << 2);
     397  s[26] = (s9 >> 19) | s10 << 2;
    391398  s[27] = s10 >> 6;
    392   s[28] = (s10 >> 14) | (s11 << 7);
     399  s[28] = (s10 >> 14) | s11 << 7;
    393400  s[29] = s11 >> 1;
    394401  s[30] = s11 >> 9;
    395402  s[31] = s11 >> 17;
  • sc_reduce.i

    diff --git a/bug13280/old/sc_reduce.i b/bug13280/unsafe/sc_reduce.i
    index d5f204b..0737cd8 100644
    old new  
    11// Preprocessed output for sc_reduce.c
    2 // Generated at 2:34:32 am on Monday, September 29, 2014
     2// Generated at 2:28:39 am on Monday, September 29, 2014
    33// Using Debug configuration, x86_64 architecture for test target of tor project
    44
    55# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_reduce.c"
    extern void crypto_sign_ed25519_ref10_sc_muladd(unsigned char *,const unsigned c 
    3539
    3640
    3741@import Darwin.C.inttypes; /* clang -E: implicit import for "/Applications/Xcode61-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/inttypes.h" */
    38 # 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
     42# 7 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
     43# 19 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h"
     44# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint64.h" 1
     45# 20 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_int64.h" 2
    3946# 3 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_reduce.c" 2
    4047# 1 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/crypto_uint32.h" 1
    4148# 4 "/Users/twilsonb/Documents/Tor/tor-target/src/ext/ed25519/ref10/sc_reduce.c" 2
    void crypto_sign_ed25519_ref10_sc_reduce(unsigned char *s) 
    271278
    272279  s[0] = s0 >> 0;
    273280  s[1] = s0 >> 8;
    274   s[2] = (s0 >> 16) | (s1 << 5);
     281  s[2] = (s0 >> 16) | s1 << 5;
    275282  s[3] = s1 >> 3;
    276283  s[4] = s1 >> 11;
    277   s[5] = (s1 >> 19) | (s2 << 2);
     284  s[5] = (s1 >> 19) | s2 << 2;
    278285  s[6] = s2 >> 6;
    279   s[7] = (s2 >> 14) | (s3 << 7);
     286  s[7] = (s2 >> 14) | s3 << 7;
    280287  s[8] = s3 >> 1;
    281288  s[9] = s3 >> 9;
    282   s[10] = (s3 >> 17) | (s4 << 4);
     289  s[10] = (s3 >> 17) | s4 << 4;
    283290  s[11] = s4 >> 4;
    284291  s[12] = s4 >> 12;
    285   s[13] = (s4 >> 20) | (s5 << 1);
     292  s[13] = (s4 >> 20) | s5 << 1;
    286293  s[14] = s5 >> 7;
    287   s[15] = (s5 >> 15) | (s6 << 6);
     294  s[15] = (s5 >> 15) | s6 << 6;
    288295  s[16] = s6 >> 2;
    289296  s[17] = s6 >> 10;
    290   s[18] = (s6 >> 18) | (s7 << 3);
     297  s[18] = (s6 >> 18) | s7 << 3;
    291298  s[19] = s7 >> 5;
    292299  s[20] = s7 >> 13;
    293300  s[21] = s8 >> 0;
    294301  s[22] = s8 >> 8;
    295   s[23] = (s8 >> 16) | (s9 << 5);
     302  s[23] = (s8 >> 16) | s9 << 5;
    296303  s[24] = s9 >> 3;
    297304  s[25] = s9 >> 11;
    298   s[26] = (s9 >> 19) | (s10 << 2);
     305  s[26] = (s9 >> 19) | s10 << 2;
    299306  s[27] = s10 >> 6;
    300   s[28] = (s10 >> 14) | (s11 << 7);
     307  s[28] = (s10 >> 14) | s11 << 7;
    301308  s[29] = s11 >> 1;
    302309  s[30] = s11 >> 9;
    303310  s[31] = s11 >> 17;