rendered paste bodyIn Nagra2.c edit cSystemNagra2::ProcessECM and replace the first //rev 248 morph code with the following:
int cmdLen=data[4]-5;
//if (data[4]==101) {
//Rev 248/10C Morph
printf("ECM CAID %04x\n", ecm->caId);
if (ecm->caId==0x1234)
data[0x05] = 9;
else
data[0x05] = 1;
data[0x06] = data[0x06] & 0x1F;
data[0x07] = data[0x07] & 0x10 | 0x86;
// data[0x07] ^=data[0x03];
data[0x08] = 0;
data[0x09] = data[0x09] & 0x80 | 0x08;
//}
int id=(data[5]*256)+data[6];
In Nagra2-0101.c Change the cN2Prov0101::Algo function so that it is as follows:
bool cN2Prov0101::Algo(int algo, const unsigned char *hd, unsigned char *hw)
{
if(algo==0x40) {
//if (id>>8 == 0x09)
memcpy(hw,hd,5);
//else
// memcpy(hw,hd,3);
ExpandInput(hw);
hw[0x18]|=1; hw[0x40]|=1;
SetWordSize(2);
ImportReg(IMPORT_A,hw,3);
ImportReg(IMPORT_D,hw+24);
DoMap(0x3b);
ExportReg(EXPORT_C,hw);
ImportReg(IMPORT_A,hw+40,3);
ImportReg(IMPORT_D,hw+64);
DoMap(0x3b);
ExportReg(EXPORT_C,hw+40);
DoMap(0x43);
DoMap(0x44,hw);
DoMap(0x44,hw+64);
//if (id>>8 == 0x09) {
hw[0]=hw[64+4]; // ctx.h3&0xFF
hw[1]=hw[64+5]; //(ctx.h3>>8)&0xFF
hw[2]=hw[64+6];
hw[3]=hw[64+7];
memset(&hw[4],0,128-4);
//}
//else {
// hw[0]=hw[64+4]; // ctx.h3&0xFF
// hw[1]=hw[64+5]; //(ctx.h3>>8)&0xFF
// memset(&hw[2],0,128-2);
//}
return true;
}
else if(algo==0x60) { // map 4D/4E/57
memcpy(hw,hd,5);
ExpandInput(hw);
hw[127]|=0x80; hw[0]|=0x01;
SetWordSize(16);
ImportReg(IMPORT_A,hw);
DoMap(0x4d);
DoMap(0x4e);
ExportReg(EXPORT_A,hw,16,true);
ImportReg(IMPORT_A,hw);
DoMap(0x4e);
ExportReg(EXPORT_A,hw);
DoMap(0x57,hw,128);
return true;
}
PRINTF(L_SYS_ECM,"%04X: unknown MECM algo %02x",id,algo);
return false;
}