From 8e1596d3fbf974413f67b67e12ea7bd3d76649fc Mon Sep 17 00:00:00 2001 From: anisota Date: Sun, 13 Jan 2008 20:48:21 +0100 Subject: [PATCH] nagra 0101: fixup map3b implementation --- systems/nagra/nagra2-0101.c | 11 +++++++++-- systems/nagra/nagra2.c | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/systems/nagra/nagra2-0101.c b/systems/nagra/nagra2-0101.c index ac4842a..c0ef8e7 100644 --- a/systems/nagra/nagra2-0101.c +++ b/systems/nagra/nagra2-0101.c @@ -436,8 +436,10 @@ void cMap0101::DoMap(int f, unsigned char *data, int l) break; } case 0x3b: - MonInit(132); // or 66*wordsize ? - MonMul(B,A,B); + if(!l) l=wordsize; + MonInit(wordsize*60+4*l); + I.GetLE(data,l<<3); + MonMul(B,I,B); break; case 0x3e: { @@ -749,6 +751,11 @@ bool cN2Prov0101::ProcessMap(int f) DoMap(f,tmp,-((Get(0x48)<<16)|(Get(0x49)<<8)|Get(0x4a))); AddCycles(MapCycles()); break; + case 0x3b: + size=Get(0x48); if(!size) size=wordsize; + GetMem(HILO(0x44),tmp,size<<3,0); + DoMap(f,tmp,size); + break; case 0x3e: GetMem(HILO(0x44),tmp,size,0); DoMap(f,tmp,Get(0x48)); diff --git a/systems/nagra/nagra2.c b/systems/nagra/nagra2.c index 425da39..61180c4 100644 --- a/systems/nagra/nagra2.c +++ b/systems/nagra/nagra2.c @@ -268,7 +268,7 @@ void cMapCore::MakeJ0(BIGNUM *j, BIGNUM *d) void cMapCore::MonMul(BIGNUM *o, BIGNUM *a, BIGNUM *b, BIGNUM *c, BIGNUM *d, BIGNUM *j) { - int words=(BN_num_bytes(d)+7)>>3; + int words=(BN_num_bytes(a)+7)>>3; BN_zero(s); for(int i=0; i