|
SASC
DVBSoftCAM
|
#include <crypto-bn.h>
Public Member Functions | |
| cBN (void) | |
| ~cBN () | |
| operator BIGNUM * () | |
| BIGNUM * | operator-> () |
| BIGNUM * | BN (void) |
| bool | Get (const unsigned char *in, int n) |
| bool | GetLE (const unsigned char *in, int n) |
| int | Put (unsigned char *out, int n) const |
| int | PutLE (unsigned char *out, int n) const |
| cBN (void) | |
| ~cBN () | |
| operator BIGNUM * () | |
| BIGNUM * | operator-> () |
| BIGNUM * | BN (void) |
| bool | Get (const unsigned char *in, int n) |
| bool | GetLE (const unsigned char *in, int n) |
| int | Put (unsigned char *out, int n) const |
| int | PutLE (unsigned char *out, int n) const |
Definition at line 32 of file crypto-bn.h.
| cBN::cBN | ( | void | ) | [inline] |
Definition at line 36 of file crypto-bn.h.
{ BN_init(&big); }
| cBN::~cBN | ( | ) | [inline] |
Definition at line 37 of file crypto-bn.h.
{ BN_free(&big); }
| cBN::cBN | ( | void | ) | [inline] |
Definition at line 36 of file crypto-bn.h.
{ BN_init(&big); }
| cBN::~cBN | ( | ) | [inline] |
Definition at line 37 of file crypto-bn.h.
{ BN_free(&big); }
| BIGNUM* cBN::BN | ( | void | ) | [inline] |
Definition at line 40 of file crypto-bn.h.
{ return &big; }
| BIGNUM* cBN::BN | ( | void | ) | [inline] |
Definition at line 40 of file crypto-bn.h.
{ return &big; }
| bool cBN::Get | ( | const unsigned char * | in, |
| int | n | ||
| ) |
Definition at line 52 of file crypto.c.
Referenced by cSmartCardDataNagra::Parse(), and cBNKey::SetBinKey().
{
return BN_bin2bn(in,n,&big)!=0;
}
| bool cBN::Get | ( | const unsigned char * | in, |
| int | n | ||
| ) |
| bool cBN::GetLE | ( | const unsigned char * | in, |
| int | n | ||
| ) |
Definition at line 74 of file crypto.c.
References AUTOMEM, and RotateBytes().
Referenced by cMapReg::GetLE(), cMap4101::Map(), cMap0101::Map(), cSystemNagra2::ProcessEMM(), and cBNKey::SetBinKey().
{
unsigned char *tmp=AUTOMEM(n);
RotateBytes(tmp,in,n);
return BN_bin2bn(tmp,n,&big)!=0;
}
| bool cBN::GetLE | ( | const unsigned char * | in, |
| int | n | ||
| ) |
| cBN::operator BIGNUM * | ( | ) | [inline] |
Definition at line 38 of file crypto-bn.h.
{ return &big; }
| cBN::operator BIGNUM * | ( | ) | [inline] |
Definition at line 38 of file crypto-bn.h.
{ return &big; }
| BIGNUM* cBN::operator-> | ( | ) | [inline] |
Definition at line 39 of file crypto-bn.h.
{ return &big; }
| BIGNUM* cBN::operator-> | ( | ) | [inline] |
Definition at line 39 of file crypto-bn.h.
{ return &big; }
| int cBN::Put | ( | unsigned char * | out, |
| int | n | ||
| ) | const |
Definition at line 57 of file crypto.c.
References AUTOMEM.
Referenced by cCamCryptNagra::DecryptDT08(), cCamCryptNagra::MakeSessionKey(), cBNKey::Print(), PutLE(), and cCamCryptNagra::SetCardData().
{
int s=BN_num_bytes(&big);
if(s>n) {
unsigned char *buff=AUTOMEM(s);
BN_bn2bin(&big,buff);
memcpy(out,buff+s-n,n);
}
else if(s<n) {
int l=n-s;
memset(out,0,l);
BN_bn2bin(&big,out+l);
}
else BN_bn2bin(&big,out);
return s;
}
| int cBN::Put | ( | unsigned char * | out, |
| int | n | ||
| ) | const |
| int cBN::PutLE | ( | unsigned char * | out, |
| int | n | ||
| ) | const |
Definition at line 81 of file crypto.c.
References Put(), and RotateBytes().
Referenced by cMap4101::Map(), cMap0101::Map(), cBNKey::Print(), cSystemNagra2::ProcessEMM(), and cMapReg::PutLE().
{
int s=Put(out,n);
RotateBytes(out,n);
return s;
}
| int cBN::PutLE | ( | unsigned char * | out, |
| int | n | ||
| ) | const |