📄 nagra2-1101.cpp
字号:
/* * Softcam plugin to VDR (C++) * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */// -- cMap1101 -----------------------------------------------------------------
class cMap1101 : public cMapCore {
private:
protected:
void DoMap(int f, unsigned char *data=0, int l=0);
public:
cMap1101(void);
};
cMap1101::cMap1101(void)
{
}
void cMap1101::DoMap(int f, unsigned char *data, int l)
{
// d(printf("1101: calling function %02X",f));
switch(f) {
case 0x37:
l=(l?l:wordsize)<<3;
H.GetLE(data,l);
MonMul(B,H,A);
break;
case 0x3a:
MakeJ();
BN_zero(R);
BN_set_bit(R,68*wordsize);
BN_mod(H,R,D,ctx);
for(int i=0; i<4; i++) MonMul(H,H,H);
MonMul(B,A,H);
MonMul(B,A,B);
break;
default:
if(!cMapCore::DoMap(f,data,l))
d(printf("1101: unsupported call %02x",f));
break;
}
}// -- cN2Prov1101 ----------------------------------------------------------------class cN2Prov1101 : public cN2Prov, private cMap1101 {
protected:
virtual bool Algo(int algo, const unsigned char *hd, unsigned char *hw);
virtual bool NeedsCwSwap(void) { return true; }public: cN2Prov1101(int Id, int Flags):cN2Prov(Id,Flags) {} };static cN2ProvLinkReg<cN2Prov1101,0x1101,N2FLAG_MECM|N2FLAG_INV> staticPL1101;bool cN2Prov1101::Algo(int algo, const unsigned char *hd, unsigned char *hw)
{
if(algo==0x60) {
hw[0]=hd[0];
hw[1]=hd[1];
hw[2]=hd[2]&0xF8;
ExpandInput(hw);
hw[63]|=0x80;
hw[95]=hw[127]=hw[95]&0x7F;
SetWordSize(4);
ImportReg(IMPORT_J,hw+0x18);
ImportReg(IMPORT_D,hw+0x20);
ImportReg(IMPORT_A,hw+0x60);
DoMap(0x37,hw+0x40);
ExportReg(EXPORT_C,hw);
DoMap(0x3a);
ExportReg(EXPORT_C,hw+0x20);
DoMap(0x43);
DoMap(0x44,hw);
hw[0]&=7;
ExportReg(EXPORT_B,hw+3);
memset(hw+3+0x20,0,128-(3+0x20));
return true;
}
d(printf("1101: unknown MECM algo %02x",algo));
return false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -