]> www.vanbest.org Git - sasc-ng.git/commitdiff
add left out part of map3b fix
authoranisota <unknown>
Tue, 15 Jan 2008 18:10:35 +0000 (19:10 +0100)
committeranisota <unknown>
Tue, 15 Jan 2008 18:10:35 +0000 (19:10 +0100)
systems/nagra/nagra2-0101.c
systems/nagra/nagra2.c
systems/nagra/nagra2.h

index c0ef8e7ee123ba532e1ca98d8876d7f96a9a5686..e0c085b2d6f4aa4ea002fd73b89fad799f5e3aef 100644 (file)
@@ -439,7 +439,7 @@ void cMap0101::DoMap(int f, unsigned char *data, int l)
       if(!l) l=wordsize;
       MonInit(wordsize*60+4*l);
       I.GetLE(data,l<<3);
-      MonMul(B,I,B);
+      MonMul(B,I,B,l);
       break;
     case 0x3e:
       {
index 61180c44bd285611cd47016e9baa44209b1d6aa4..84c2212c9ad2a3261a214e21903855d7fa0c3d0b 100644 (file)
@@ -266,9 +266,9 @@ void cMapCore::MakeJ0(BIGNUM *j, BIGNUM *d)
   BN_mod_inverse(j,j,x,ctx);
 }
 
-void cMapCore::MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j)
+void cMapCore::MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int words)
 {
-  int words=(BN_num_bytes(a)+7)>>3;
+  if(!words) words=wordsize;
   BN_zero(s);
   for(int i=0; i<words;) {
     BN_rshift(x,a,(i++)<<6);
index d4de24d89adf0dfd55eb0e3452c09d744cac63cc..be5ce3082f23df78b0c82b7d0075af2ce6183843 100644 (file)
@@ -165,10 +165,11 @@ protected:
   void MakeJ0(BIGNUM *j, BIGNUM *d);
   void ModAdd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *d);
   void ModSub(BIGNUM *r, BIGNUM *d, BIGNUM *b);
-  void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j);
+  void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int words);
   // statefull
   void MonInit(int bits=0);
-  void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b) { MonMul(o,a,b,C,D,J); }
+  void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b) { MonMul(o,a,b,C,D,J,0); }
+  void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, int words) { MonMul(o,a,b,C,D,J,words); }
   void MonExpNeg(void);
   // ECC
   void DoubleP(int temp);