* more of the same

This commit is contained in:
giantpune 2011-05-17 18:36:33 +00:00
parent 15d6ba4344
commit 4f74cc3968
2 changed files with 13 additions and 13 deletions

View File

@ -4,7 +4,7 @@
NandSpare::NandSpare()
{
}
void NandSpare::SetHMacKey( const QByteArray key )
void NandSpare::SetHMacKey( const QByteArray &key )
{
hmacKey = key;
}
@ -20,7 +20,7 @@ quint8 NandSpare::Parity( quint8 x )
return y;
}
QByteArray NandSpare::CalcEcc( QByteArray in )
QByteArray NandSpare::CalcEcc( const QByteArray &in )
{
if( in.size() != 0x800 )
return QByteArray();
@ -31,7 +31,7 @@ QByteArray NandSpare::CalcEcc( QByteArray in )
QByteArray ret( 16, '\0' );
char* ecc = ret.data();
char* data = in.data();
const char* data = in.data();
for( int k = 0; k < 4; k++ )
{
@ -183,7 +183,7 @@ void fs_hmac_data( const unsigned char *data, quint32 uid, const unsigned char *
fs_hmac_generic( data, 0x4000, extra, 0x40, hmac );
}
QByteArray NandSpare::Get_hmac_data( const QByteArray cluster, quint32 uid, const unsigned char *name, quint32 entry_n, quint32 x3, quint16 blk )
QByteArray NandSpare::Get_hmac_data( const QByteArray &cluster, quint32 uid, const unsigned char *name, quint32 entry_n, quint32 x3, quint16 blk )
{
//qDebug() << "NandSpare::Get_hmac_data" << hex << cluster.size() << uid << QString( QByteArray( (const char*)name, 12 ) ) << entry_n << x3 << blk;
if( hmacKey.size() != 0x14 || cluster.size() != 0x4000 )
@ -197,7 +197,7 @@ QByteArray NandSpare::Get_hmac_data( const QByteArray cluster, quint32 uid, cons
return ret;
}
QByteArray NandSpare::Get_hmac_meta( const QByteArray cluster, quint16 super_blk )
QByteArray NandSpare::Get_hmac_meta( const QByteArray &cluster, quint16 super_blk )
{
//qDebug() << "NandSpare::Get_hmac_meta" << hex << super_blk;
if( hmacKey.size() != 0x14 || cluster.size() != 0x40000 )

View File

@ -11,11 +11,11 @@ class NandSpare
{
public:
NandSpare();
void SetHMacKey( const QByteArray key );
QByteArray Get_hmac_data( const QByteArray cluster, quint32 uid, const unsigned char *name, quint32 entry_n, quint32 x3, quint16 blk );
QByteArray Get_hmac_meta( const QByteArray cluster, quint16 super_blk );
void SetHMacKey( const QByteArray &key );
QByteArray Get_hmac_data( const QByteArray &cluster, quint32 uid, const unsigned char *name, quint32 entry_n, quint32 x3, quint16 blk );
QByteArray Get_hmac_meta( const QByteArray &cluster, quint16 super_blk );
static QByteArray CalcEcc( QByteArray in );
static QByteArray CalcEcc( const QByteArray &in );
static quint8 Parity( quint8 x );
private:
QByteArray hmacKey;