]> www.vanbest.org Git - sasc-ng.git/commitdiff
nagra-0101: INT map38
authoranon <unknown>
Sat, 14 Jun 2008 13:23:55 +0000 (21:23 +0800)
committeranon <unknown>
Sat, 14 Jun 2008 13:23:55 +0000 (21:23 +0800)
systems/nagra/nagra2-0101.c
systems/nagra/nagra2.c
systems/nagra/nagra2.h

index 670b593eb007f233f783ebc0e3fd0ae561b6b98a..0ae84ce0e1b6c72d1d2ac469c9b1cf60ae1ad6e2 100644 (file)
@@ -222,6 +222,12 @@ bool cMap0101::Map(int f, unsigned char *data, int l)
         }
       BN_zero(J);
       break;
+    case 0x38:
+      AddMapCycles(232);
+      MonMul0(B,B,B,C,D,J,wordsize);
+      AddMapCycles(90);
+      MonFin(B,D);
+      break;
     case 0x3b:
       MonInit(wordsize*60+4*l);
       I.GetLE(data,l<<3);
@@ -607,6 +613,7 @@ bool cN2Prov0101::ProcessMap(int f)
     case 0x21:
     case 0x30:
     case 0x31:
+    case 0x38:
     case 0x3a:
     case 0x43:
       DoMap(f);
index e68e6d0de6e20d52bdf95e85eb42166dbd0e46fc..ba4f79ece14331be45a50d1c476af2c3e2278c0b 100644 (file)
@@ -422,6 +422,12 @@ void cMapMath::MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, int w)
 }
 
 void cMapMath::MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int w)
+{
+  MonMul0(o,a,b,c,d,j,w);
+  MonFin(o,d);
+}
+
+void cMapMath::MonMul0(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int w)
 {
   if(!w) w=wordsize;
   MonStart(w);
@@ -472,14 +478,16 @@ void cMapMath::MonLoop(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BI
     }
 
   BN_rshift(s,s,64);
-  if(BN_cmp(s,d)==1) {
-    BN_copy(x,s);
-    BN_sub(s,x,d);
-    }
-
+  if(words) MonFin(s,d);
   if(!words) BN_copy(o,s);
 }
 
+void cMapMath::MonFin(BIGNUM *s, BIGNUM *d)
+{
+  if(BN_cmp(s,d)>=0)
+    BN_sub(s,s,d);
+}
+
 // -- cMapCore -----------------------------------------------------------------
 
 cMapCore::cMapCore(void)
index 673605dc16eb71de97beca400dd04e2535d4db24..e58db97c7e002cdd90ca212c432cd0f578eb4c57 100644 (file)
@@ -99,8 +99,10 @@ protected:
   bool ModAdd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *d);
   bool ModSub(BIGNUM *r, BIGNUM *d, BIGNUM *b);
   void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int w);
+  void MonMul0(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j, int w);
   void MonStart(int w);
   void MonLoop(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j);
+  void MonFin(BIGNUM *s, BIGNUM *d);
   // statefull
   void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b);
   void MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, int w);