wiiqt6/WiiQt/tools.cpp

452 lines
25 KiB
C++
Raw Normal View History

#include "tools.h"
#include "includes.h"
#include "aes.h"
#include "sha1.h"
char ascii( char s ) {
if ( s < 0x20 ) return '.';
if ( s > 0x7E ) return '.';
return s;
}
//using stderr just because qtcreator stows it correctly when mixed with qDebug(), qWarning(), etc
//otherwise it may not be shown in the correct spot in the output due to stdout/stderr caches
void hexdump( const void *d, int len ) {
unsigned char *data;
int i, off;
data = (unsigned char*)d;
fprintf( stderr, "\n");
for ( off = 0; off < len; off += 16 ) {
fprintf( stderr, "%08x ", off );
for ( i=0; i<16; i++ )
{
if( ( i + 1 ) % 4 )
{
if ( ( i + off ) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%02x",data[ off + i ]);
}
else
{
if ( ( i + off ) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%02x ",data[ off + i ]);
}
}
fprintf( stderr, " " );
for ( i = 0; i < 16; i++ )
if ( ( i + off) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%c", ascii( data[ off + i ]));
fprintf( stderr,"\n");
}
fflush( stderr );
}
void hexdump( const QByteArray &d, int from, int len )
{
hexdump( d.data() + from, len == -1 ? d.size() : len );
}
void hexdump12( const void *d, int len ) {
unsigned char *data;
int i, off;
data = (unsigned char*)d;
fprintf( stderr, "\n");
for ( off = 0; off < len; off += 12 ) {
fprintf( stderr, "%08x ", off );
for ( i=0; i<12; i++ )
{
if( ( i + 1 ) % 4 )
{
if ( ( i + off ) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%02x",data[ off + i ]);
}
else
{
if ( ( i + off ) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%02x ",data[ off + i ]);
}
}
fprintf( stderr, " " );
for ( i = 0; i < 12; i++ )
if ( ( i + off) >= len ) fprintf( stderr," ");
else fprintf( stderr,"%c", ascii( data[ off + i ]));
fprintf( stderr,"\n");
}
fflush( stderr );
}
void hexdump12( const QByteArray &d, int from, int len )
{
hexdump12( d.data() + from, len == -1 ? d.size() : len );
}
QByteArray PaddedByteArray( const QByteArray &orig, quint32 padTo )
{
//qDebug() << "need to pad from" << hex << orig.size() << "to nearest" << padTo;
QByteArray padding( RU( orig.size(), padTo ) - orig.size(), '\0' );
return orig + padding;
}
QByteArray AesDecrypt( quint16 index, const QByteArray &source )
{
//qDebug() << "AesDecrypt" << hex << index << source.size();
quint8 iv[ 16 ];
quint16 beidx = qFromBigEndian( index );
memset( &iv, 0, 16 );
memcpy( &iv, &beidx, 2 );
QByteArray ret( source.size(), '\0' );
aes_decrypt( (quint8*)&iv, (const quint8*)source.data(), (quint8*)ret.data(), source.size() );
return ret;
}
QByteArray AesEncrypt( quint16 index, const QByteArray &source )
{
static quint8 iv[ 16 ];
quint16 beidx = qFromBigEndian( index );
memset( iv, 0, 16 );
memcpy( iv, &beidx, 2 );
QByteArray ret( source.size(), '\0' );
aes_encrypt( iv, (const quint8*)source.data(), (quint8*)ret.data(), source.size() );
return ret;
}
void AesSetKey( const QByteArray &key )
{
// qDebug() << "AesSetKey()" << key.toHex();
aes_set_key( (const quint8*)key.data() );
}
QByteArray GetSha1( const QByteArray &stuff )
{
return QCryptographicHash::hash( stuff, QCryptographicHash::Sha1 );
}
QByteArray GetMd5( const QByteArray &stuff )
{
return QCryptographicHash::hash( stuff, QCryptographicHash::Md5 );
}
QByteArray ReadFile( const QString &path )
{
QFile file( path );
if( !file.exists() || !file.open( QIODevice::ReadOnly ) )
{
qWarning() << "ReadFile -> can't open" << path;
return QByteArray();
}
QByteArray ret = file.readAll();
file.close();
return ret;
}
bool WriteFile( const QString &path, const QByteArray &ba )
{
QFile file( path );
if( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
{
qWarning() << "WriteFile -> can't open" << path;
return false;
}
if( file.write( ba ) != ba.size() )
{
file.close();
qWarning() << "WriteFile -> can't write all the data to" << path;
return false;
}
file.close();
return true;
}
bool IsValidSave( const SaveGame &save )
{
if( !save.tid || save.entries.size() != save.attr.size() )
{
qWarning() << "IsValidSave :bad sizes";
return false;
}
if( !save.entries.contains( "/banner.bin" ) )
{
qWarning() << "IsValidSave :save doesnt contain a banner.bin" << save.entries;
return false;
}
quint16 files = 0;
quint16 cnt = save.entries.size();
for( quint16 i = 0; i < cnt; i++ )
{
if( save.entries.at( i ).size() > 52 )
{
qWarning() << "IsValidSave :name is too long" << i << save.entries.at( i );
return false;
}
quint8 attr = save.attr.at( i );
if( NAND_ATTR_TYPE( attr ) == NAND_FILE )
{
files++;
}
else if( NAND_ATTR_TYPE( attr ) == NAND_DIR )
{
}
else //unknown attribute
{
qWarning() << "IsValidSave :unknown attribute" << i << hex << attr << NAND_ATTR_TYPE( attr );
return false;
}
}
if( files != save.data.size() )
{
qWarning() << "IsValidSave :files != data.size()";
return false;
}
return true;
}
const QByteArray DataFromSave( const SaveGame &save, const QString &name )
{
if( !save.tid || save.entries.size() != save.attr.size() )
return QByteArray();
quint16 idx = 0;
quint16 cnt = save.entries.size();
for( quint16 i = 0; i < cnt; i++ )
{
quint8 attr = save.attr.at( i );
if( NAND_ATTR_TYPE( attr ) == NAND_FILE )
{
if( save.entries.at( i ) == name )
return save.data.at( idx );
idx++;
}
}
return QByteArray();
}
quint32 SaveItemSize( const SaveGame &save )
{
quint32 ret = 0;
foreach( QByteArray ba, save.data )
ret += ba.size();
return ret;
}
quint8 AttrFromSave( const SaveGame &save, const QString &name )
{
if( !save.tid || save.entries.size() != save.attr.size() )
return 0;
quint16 cnt = save.entries.size();
for( quint16 i = 0; i < cnt; i++ )
{
if( save.entries.at( i ) == name )
return save.attr.at( i );
}
return 0;
}
#define CERTS_DAT_SIZE 2560
const quint8 certs_dat[ CERTS_DAT_SIZE ] = {
0x00, 0x01, 0x00, 0x01, 0x7D, 0x9D, 0x5E, 0xBA, 0x52, 0x81, 0xDC, 0xA7, 0x06, 0x5D, 0x2F, 0x08,
0x68, 0xDB, 0x8A, 0xC7, 0x3A, 0xCE, 0x7E, 0xA9, 0x91, 0xF1, 0x96, 0x9F, 0xE1, 0xD0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, 0xAC, 0x29, 0x16, 0x88, 0x6D, 0x2A, 0x0E, 0x59, 0x4E, 0xED, 0x5C, 0xC8, 0x35,
0x69, 0x8B, 0x4D, 0x62, 0x38, 0xDF, 0x05, 0x72, 0x4D, 0xCC, 0xF6, 0x81, 0x80, 0x8A, 0x70, 0x74,
0x06, 0x59, 0x30, 0xBF, 0xF8, 0x51, 0x41, 0x37, 0xE8, 0x15, 0xFA, 0xBA, 0xA1, 0x72, 0xB8, 0xE0,
0x69, 0x6C, 0x61, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x52, 0x6F, 0x6F, 0x74, 0x2D, 0x43, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x58, 0x53, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 0x8E, 0x57, 0xDD, 0xBD, 0x5F, 0x46, 0xEB, 0x27, 0xD6, 0x19, 0x52, 0xF6, 0xAE,
0xF8, 0x62, 0xB7, 0xEE, 0x9A, 0xC6, 0x82, 0xA2, 0xB1, 0x9A, 0xA9, 0xB5, 0x58, 0xFB, 0xEB, 0xB3,
0x89, 0x2F, 0xBD, 0x50, 0xC9, 0xF5, 0xDC, 0x4A, 0x6E, 0x9C, 0x9B, 0xFE, 0x45, 0x80, 0x34, 0xA9,
0x42, 0x18, 0x2D, 0xDE, 0xB7, 0x5F, 0xE0, 0xD1, 0xB3, 0xDF, 0x0E, 0x97, 0xE3, 0x99, 0x80, 0x87,
0x70, 0x18, 0xC2, 0xB2, 0x83, 0xF1, 0x35, 0x75, 0x7C, 0x5A, 0x30, 0xFC, 0x3F, 0x30, 0x84, 0xA4,
0x9A, 0xAA, 0xC0, 0x1E, 0xE7, 0x06, 0x69, 0x4F, 0x8E, 0x14, 0x48, 0xDA, 0x12, 0x3A, 0xCC, 0x4F,
0xFA, 0x26, 0xAA, 0x38, 0xF7, 0xEF, 0xBF, 0x27, 0x8F, 0x36, 0x97, 0x79, 0x77, 0x5D, 0xB7, 0xC5,
0xAD, 0xC7, 0x89, 0x91, 0xDC, 0xF8, 0x43, 0x8D, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0xB3, 0xAD, 0xB3, 0x22, 0x6B, 0x3C, 0x3D, 0xFF, 0x1B, 0x4B, 0x40,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x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x52, 0x6F, 0x6F, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x43, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5B, 0xFA, 0x7D, 0x5C, 0xB2, 0x79, 0xC9, 0xE2, 0xEE, 0xE1, 0x21, 0xC6,
0xEA, 0xF4, 0x4F, 0xF6, 0x39, 0xF8, 0x8F, 0x07, 0x8B, 0x4B, 0x77, 0xED, 0x9F, 0x95, 0x60, 0xB0,
0x35, 0x82, 0x81, 0xB5, 0x0E, 0x55, 0xAB, 0x72, 0x11, 0x15, 0xA1, 0x77, 0x70, 0x3C, 0x7A, 0x30,
0xFE, 0x3A, 0xE9, 0xEF, 0x1C, 0x60, 0xBC, 0x1D, 0x97, 0x46, 0x76, 0xB2, 0x3A, 0x68, 0xC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0x64, 0xCE, 0x44, 0xEF, 0x58, 0x6D, 0x14, 0xBA, 0xAA, 0x88,
0x34, 0x01, 0x9B, 0x3E, 0xEB, 0xEE, 0xD3, 0x79, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x01, 0x4E, 0x00, 0x5F, 0xF1, 0x3F, 0x86, 0x75, 0x8D, 0xB6, 0x9C, 0x45, 0x63,
0x0F, 0xD4, 0x9B, 0xF4, 0xCC, 0x5D, 0x54, 0xCF, 0xCC, 0x22, 0x34, 0x72, 0x57, 0xAB, 0xA4, 0xBA,
0x53, 0xD2, 0xB3, 0x3D, 0xE6, 0xEC, 0x9E, 0xA1, 0x57, 0x54, 0x53, 0xAE, 0x5F, 0x93, 0x3D, 0x96,
0xBF, 0xF7, 0xCC, 0x7A, 0x79, 0x56, 0x6E, 0x84, 0x7B, 0x1B, 0x60, 0x77, 0xC2, 0xA9, 0x38, 0x71,
0x30, 0x1A, 0x8C, 0xD3, 0xC9, 0x3D, 0x4D, 0xB3, 0x26, 0xE9, 0x87, 0x92, 0x66, 0xE9, 0xD3, 0xBA,
0x9F, 0x79, 0xBC, 0x46, 0x38, 0xFA, 0x2D, 0x20, 0xA0, 0x3A, 0x70, 0x67, 0xA4, 0x11, 0xA7, 0xA0,
0xB7, 0xD9, 0x12, 0xAD, 0x11, 0x6A, 0x3A, 0xC4, 0x6E, 0x32, 0x42, 0x47, 0xC2, 0x08, 0xBA, 0xB4,
0x94, 0x9C, 0xC5, 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 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x52, 0x6F, 0x6F, 0x74, 0x2D, 0x43, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x43, 0x50, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x34, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF1, 0xB8, 0xA0, 0x64, 0xC1, 0x6D, 0xF3, 0x83, 0x29, 0x55, 0xC3, 0x29,
0x5B, 0x72, 0xF0, 0x33, 0x2E, 0x97, 0xEF, 0x14, 0x84, 0x8A, 0x68, 0x04, 0x9C, 0xA6, 0x8E, 0xAC,
0xDE, 0x14, 0x50, 0x33, 0xB8, 0x6C, 0x10, 0x8D, 0x48, 0x33, 0x5C, 0x5D, 0x0C, 0xAB, 0x77, 0x04,
0x62, 0x54, 0x47, 0x55, 0x45, 0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x44, 0xDC, 0x78, 0xE7,
0x19, 0x9A, 0x3D, 0xDD, 0x57, 0x22, 0x7E, 0x9E, 0x77, 0xDE, 0x32, 0x63, 0x86, 0x93, 0x6C, 0x11,
0xAC, 0xA7, 0x0F, 0x81, 0x19, 0xD3, 0x3A, 0x99, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
// public root cert
const quint8 root_dat[] = {
0xF8, 0x24, 0x6C, 0x58, 0xBA, 0xE7, 0x50, 0x03, 0x01, 0xFB, 0xB7, 0xC2, 0xEB, 0xE0, 0x01, 0x05,
0x71, 0xDA, 0x92, 0x23, 0x78, 0xF0, 0x51, 0x4E, 0xC0, 0x03, 0x1D, 0xD0, 0xD2, 0x1E, 0xD3, 0xD0,
0x7E, 0xFC, 0x85, 0x20, 0x69, 0xB5, 0xDE, 0x9B, 0xB9, 0x51, 0xA8, 0xBC, 0x90, 0xA2, 0x44, 0x92,
0x6D, 0x37, 0x92, 0x95, 0xAE, 0x94, 0x36, 0xAA, 0xA6, 0xA3, 0x02, 0x51, 0x0C, 0x7B, 0x1D, 0xED,
0xD5, 0xFB, 0x20, 0x86, 0x9D, 0x7F, 0x30, 0x16, 0xF6, 0xBE, 0x65, 0xD3, 0x83, 0xA1, 0x6D, 0xB3,
0x32, 0x1B, 0x95, 0x35, 0x18, 0x90, 0xB1, 0x70, 0x02, 0x93, 0x7E, 0xE1, 0x93, 0xF5, 0x7E, 0x99,
0xA2, 0x47, 0x4E, 0x9D, 0x38, 0x24, 0xC7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