Remove LTCG and platform toolset, fix code style.

This commit is contained in:
Matthew Parlane 2013-08-15 21:43:43 +12:00
parent fede38985e
commit b93d62dcb8
3 changed files with 393 additions and 400 deletions

View File

@ -63,7 +63,6 @@
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>Windows7.1SDK</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -212,9 +211,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\polarssl\aes.h" /> <ClInclude Include="..\..\include\polarssl\aes.h" />

View File

@ -151,7 +151,6 @@
<Lib> <Lib>
<AdditionalLibraryDirectories> <AdditionalLibraryDirectories>
</AdditionalLibraryDirectories> </AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">
@ -181,7 +180,6 @@
<Lib> <Lib>
<AdditionalLibraryDirectories> <AdditionalLibraryDirectories>
</AdditionalLibraryDirectories> </AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">

View File

@ -27,7 +27,7 @@
CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{ {
for(int i = 0; i < NET_SSL_MAXINSTANCES; ++i) for (int i = 0; i < NET_SSL_MAXINSTANCES; ++i)
{ {
memset(&_SSL[i], 0, sizeof(struct _SSL)); memset(&_SSL[i], 0, sizeof(struct _SSL));
} }
@ -38,7 +38,7 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
// Cleanup sessions // Cleanup sessions
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++) for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
{ {
if(_SSL[i].active) if (_SSL[i].active)
{ {
ssl_close_notify(&_SSL[i].ctx); ssl_close_notify(&_SSL[i].ctx);
ssl_session_free(&_SSL[i].session); ssl_session_free(&_SSL[i].session);
@ -62,8 +62,10 @@ int CWII_IPC_HLE_Device_net_ssl::getSSLFreeID()
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++) for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
{ {
if (!_SSL[i].active) if (!_SSL[i].active)
{
return i + 1; return i + 1;
} }
}
return 0; return 0;
} }
@ -77,7 +79,9 @@ bool CWII_IPC_HLE_Device_net_ssl::Open(u32 _CommandAddress, u32 _Mode)
bool CWII_IPC_HLE_Device_net_ssl::Close(u32 _CommandAddress, bool _bForce) bool CWII_IPC_HLE_Device_net_ssl::Close(u32 _CommandAddress, bool _bForce)
{ {
if (!_bForce) if (!_bForce)
{
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, _CommandAddress + 4);
}
m_Active = false; m_Active = false;
return true; return true;
} }
@ -111,33 +115,30 @@ _verify_certificate_callback (void *data, x509_cert *crt, int depth, int *flags)
{ {
char buf[1024]; char buf[1024];
((void) data); ((void) data);
std::string verify_info = "Verify requested for (Depth "; std::string verify_info = StringFromFormat("Verify requested for (Depth %d):\n");
sprintf(buf, "%d", depth);
verify_info += buf;
verify_info += "):\n";
x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt ); x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt );
verify_info += buf; verify_info += buf;
if( ( (*flags) & BADCERT_EXPIRED ) != 0 ) if ( ( (*flags) & BADCERT_EXPIRED ) != 0 )
verify_info += " ! server certificate has expired"; verify_info += " ! server certificate has expired";
if( ( (*flags) & BADCERT_REVOKED ) != 0 ) if ( ( (*flags) & BADCERT_REVOKED ) != 0 )
verify_info += " ! server certificate has been revoked"; verify_info += " ! server certificate has been revoked";
if( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 ) if ( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
verify_info += " ! CN mismatch\n"; verify_info += " ! CN mismatch\n";
if( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 ) if ( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
verify_info += " ! self-signed or not signed by a trusted CA\n"; verify_info += " ! self-signed or not signed by a trusted CA\n";
if( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 ) if ( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
verify_info += " ! CRL not trusted\n"; verify_info += " ! CRL not trusted\n";
if( ( (*flags) & BADCRL_EXPIRED ) != 0 ) if ( ( (*flags) & BADCRL_EXPIRED ) != 0 )
verify_info += " ! CRL expired\n"; verify_info += " ! CRL expired\n";
if( ( (*flags) & BADCERT_OTHER ) != 0 ) if ( ( (*flags) & BADCERT_OTHER ) != 0 )
verify_info += " ! other (unknown) flag\n"; verify_info += " ! other (unknown) flag\n";
if ( ( *flags ) == 0 ) if ( ( *flags ) == 0 )
@ -202,7 +203,7 @@ u32 CWII_IPC_HLE_Device_net_ssl::ExecuteCommandV(u32 _Parameter, SIOCtlVBuffer C
{ {
int sslID = freeSSL - 1; int sslID = freeSSL - 1;
int ret = ssl_init(&_SSL[sslID].ctx); int ret = ssl_init(&_SSL[sslID].ctx);
if(ret) if (ret)
{ {
// Cleanup possibly dirty ctx // Cleanup possibly dirty ctx
memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context)); memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
@ -300,7 +301,7 @@ _SSL_NEW_ERROR:
Memory::GetPointer(_BufferOut2), Memory::GetPointer(_BufferOut2),
BufferOutSize2); BufferOutSize2);
if(ret) if (ret)
{ {
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn); Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
} }
@ -334,7 +335,7 @@ _SSL_NEW_ERROR:
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX)); std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
int ret = x509parse_crtfile(&_SSL[sslID].clicert, (cert_base_path + "clientca.pem").c_str()); int ret = x509parse_crtfile(&_SSL[sslID].clicert, (cert_base_path + "clientca.pem").c_str());
int rsa_ret = x509parse_keyfile(&_SSL[sslID].rsa, (cert_base_path + "clientcakey.pem").c_str(), NULL); int rsa_ret = x509parse_keyfile(&_SSL[sslID].rsa, (cert_base_path + "clientcakey.pem").c_str(), NULL);
if(ret || rsa_ret) if (ret || rsa_ret)
{ {
x509_free(&_SSL[sslID].clicert); x509_free(&_SSL[sslID].clicert);
rsa_free(&_SSL[sslID].rsa); rsa_free(&_SSL[sslID].rsa);
@ -393,7 +394,7 @@ _SSL_NEW_ERROR:
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX)); std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
int ret = x509parse_crtfile(&_SSL[sslID].cacert, (cert_base_path + "rootca.pem").c_str()); int ret = x509parse_crtfile(&_SSL[sslID].cacert, (cert_base_path + "rootca.pem").c_str());
if(ret) if (ret)
{ {
x509_free(&_SSL[sslID].clicert); x509_free(&_SSL[sslID].clicert);
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn); Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
@ -486,7 +487,7 @@ _SSL_NEW_ERROR:
int ret = ssl_write( &_SSL[sslID].ctx, Memory::GetPointer(_BufferOut2), BufferOutSize2); int ret = ssl_write( &_SSL[sslID].ctx, Memory::GetPointer(_BufferOut2), BufferOutSize2);
File::IOFile("ssl_write.bin", "ab").WriteBytes(Memory::GetPointer(_BufferOut2), BufferOutSize2); File::IOFile("ssl_write.bin", "ab").WriteBytes(Memory::GetPointer(_BufferOut2), BufferOutSize2);
if(ret >= 0) if (ret >= 0)
{ {
// Return bytes written or SSL_ERR_ZERO if none // Return bytes written or SSL_ERR_ZERO if none
Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, _BufferIn); Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, _BufferIn);
@ -534,7 +535,7 @@ _SSL_NEW_ERROR:
File::IOFile("ssl_read.bin", "ab").WriteBytes(Memory::GetPointer(_BufferIn2), ret); File::IOFile("ssl_read.bin", "ab").WriteBytes(Memory::GetPointer(_BufferIn2), ret);
} }
if(ret >= 0) if (ret >= 0)
{ {
// Return bytes read or SSL_ERR_ZERO if none // Return bytes read or SSL_ERR_ZERO if none
Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, _BufferIn); Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, _BufferIn);
@ -612,7 +613,6 @@ _SSL_NEW_ERROR:
break; break;
} }
default: default:
{
ERROR_LOG(WII_IPC_SSL, "%i " ERROR_LOG(WII_IPC_SSL, "%i "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), " "BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), " "BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
@ -623,7 +623,6 @@ _SSL_NEW_ERROR:
_BufferOut2, BufferOutSize2, _BufferOut3, BufferOutSize3); _BufferOut2, BufferOutSize2, _BufferOut3, BufferOutSize3);
break; break;
} }
}
return returnValue; return returnValue;
} }