[dolphin-emu] 21/33: Switch to patches from upstream
James Cowgill
jcowgill-guest at moszumanska.debian.org
Sun Jan 11 22:39:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
jcowgill-guest pushed a commit to branch master
in repository dolphin-emu.
commit c609b7c176fe7097253fa75f70563f67e15bf9bd
Author: James Cowgill <james410 at cowgill.org.uk>
Date: Mon Nov 10 20:34:37 2014 +0000
Switch to patches from upstream
- GCC 4.9 Compilation Fix
- Fixes for libav 10
- Update to polarssl 1.3
- Remove all OpenSSL code
---
debian/patches/01_fixes-for-gcc-4.9.patch | 31 +++
debian/patches/02_fixes-for-libav-10.patch | 181 +++++++++++++
debian/patches/03_fixes-for-polarssl-1.3.patch | 251 ++++++++++++++++++
debian/patches/04_use-polarssl-aes.patch | 339 +++++++++++++++++++++++++
debian/patches/08_polarssl-use-1.3.patch | 130 ----------
debian/patches/11_polarssl-replace-aes.patch | 160 ------------
debian/patches/90_g++-use-4.9.patch | 23 --
debian/patches/910_av-use-555553.patch | 51 ----
debian/patches/series | 8 +-
9 files changed, 806 insertions(+), 368 deletions(-)
diff --git a/debian/patches/01_fixes-for-gcc-4.9.patch b/debian/patches/01_fixes-for-gcc-4.9.patch
new file mode 100644
index 0000000..3a75eee
--- /dev/null
+++ b/debian/patches/01_fixes-for-gcc-4.9.patch
@@ -0,0 +1,31 @@
+From 7c1ac441f633220365d0feef3871f891e7ed7a43 Mon Sep 17 00:00:00 2001
+From: Ryan Houdek <Sonicadvance1 at gmail.com>
+Date: Tue, 12 Nov 2013 16:34:32 -0600
+Subject: [PATCH] Redo 'Fixes GCC 4.9 compilation. It now supplies its own
+ _mm_shuffle_epi8 intrinsic.' This time with support for Windows.
+
+---
+ Source/Core/Common/Src/CommonFuncs.h | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/Source/Core/Common/Src/CommonFuncs.h b/Source/Core/Common/Src/CommonFuncs.h
+index bf50a17..63bdc04 100644
+--- a/Source/Core/Common/Src/CommonFuncs.h
++++ b/Source/Core/Common/Src/CommonFuncs.h
+@@ -31,7 +31,12 @@ struct ArraySizeImpl : public std::extent<T>
+ #define b32(x) (b16(x) | (b16(x) >>16) )
+ #define ROUND_UP_POW2(x) (b32(x - 1) + 1)
+
+-#if defined __GNUC__ && !defined __SSSE3__ && !defined _M_GENERIC
++#ifndef __GNUC_PREREQ
++ #define __GNUC_PREREQ(a, b) 0
++#endif
++
++#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) \
++ && !defined __SSSE3__ && !defined _M_GENERIC
+ #include <emmintrin.h>
+ static __inline __m128i __attribute__((__always_inline__))
+ _mm_shuffle_epi8(__m128i a, __m128i mask)
+--
+2.1.3
+
diff --git a/debian/patches/02_fixes-for-libav-10.patch b/debian/patches/02_fixes-for-libav-10.patch
new file mode 100644
index 0000000..e2c50c2
--- /dev/null
+++ b/debian/patches/02_fixes-for-libav-10.patch
@@ -0,0 +1,181 @@
+From c2c46d75738624b7afa4a522db8d2b029a95acb5 Mon Sep 17 00:00:00 2001
+From: Tillmann Karras <tilkax at gmail.com>
+Date: Sun, 15 Jun 2014 05:16:58 +0200
+Subject: [PATCH] AVIDump: update ffmpeg/libav API usage
+
+libav 10 was released on May 10th, 2014 and it drops support for some
+long-deprecated stuff like avcodec_encode_video().
+---
+ Source/Core/VideoCommon/AVIDump.cpp | 93 +++++++++++++++++++------------------
+ 1 file changed, 49 insertions(+), 44 deletions(-)
+
+diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp
+index b53340f..a287056 100644
+--- a/Source/Core/VideoCommon/AVIDump.cpp
++++ b/Source/Core/VideoCommon/AVIDump.cpp
+@@ -220,7 +220,7 @@ static AVStream* s_stream = nullptr;
+ static AVFrame* s_bgr_frame = nullptr;
+ static AVFrame* s_yuv_frame = nullptr;
+ static uint8_t* s_yuv_buffer = nullptr;
+-static uint8_t* s_out_buffer = nullptr;
++static SwsContext* s_sws_context = nullptr;
+ static int s_width;
+ static int s_height;
+ static int s_size;
+@@ -262,14 +262,15 @@ bool AVIDump::CreateFile()
+ return false;
+ }
+
+- s_stream->codec->codec_id = g_Config.bUseFFV1 ? CODEC_ID_FFV1 : s_format_context->oformat->video_codec;
++ s_stream->codec->codec_id = g_Config.bUseFFV1 ? AV_CODEC_ID_FFV1
++ : s_format_context->oformat->video_codec;
+ s_stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ s_stream->codec->bit_rate = 400000;
+ s_stream->codec->width = s_width;
+ s_stream->codec->height = s_height;
+ s_stream->codec->time_base = (AVRational){1, static_cast<int>(VideoInterface::TargetRefreshRate)};
+ s_stream->codec->gop_size = 12;
+- s_stream->codec->pix_fmt = g_Config.bUseFFV1 ? PIX_FMT_BGRA : PIX_FMT_YUV420P;
++ s_stream->codec->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGRA : AV_PIX_FMT_YUV420P;
+
+ if (!(codec = avcodec_find_encoder(s_stream->codec->codec_id)) ||
+ (avcodec_open2(s_stream->codec, codec, nullptr) < 0))
+@@ -277,16 +278,14 @@ bool AVIDump::CreateFile()
+ return false;
+ }
+
+- s_bgr_frame = avcodec_alloc_frame();
+- s_yuv_frame = avcodec_alloc_frame();
++ s_bgr_frame = av_frame_alloc();
++ s_yuv_frame = av_frame_alloc();
+
+ s_size = avpicture_get_size(s_stream->codec->pix_fmt, s_width, s_height);
+
+ s_yuv_buffer = new uint8_t[s_size];
+ avpicture_fill((AVPicture*)s_yuv_frame, s_yuv_buffer, s_stream->codec->pix_fmt, s_width, s_height);
+
+- s_out_buffer = new uint8_t[s_size];
+-
+ NOTICE_LOG(VIDEO, "Opening file %s for dumping", s_format_context->filename);
+ if (avio_open(&s_format_context->pb, s_format_context->filename, AVIO_FLAG_WRITE) < 0)
+ {
+@@ -299,45 +298,52 @@ bool AVIDump::CreateFile()
+ return true;
+ }
+
++static void PreparePacket(AVPacket* pkt)
++{
++ av_init_packet(pkt);
++ pkt->data = nullptr;
++ pkt->size = 0;
++ if (s_stream->codec->coded_frame->pts != AV_NOPTS_VALUE)
++ {
++ pkt->pts = av_rescale_q(s_stream->codec->coded_frame->pts,
++ s_stream->codec->time_base, s_stream->time_base);
++ }
++ if (s_stream->codec->coded_frame->key_frame)
++ pkt->flags |= AV_PKT_FLAG_KEY;
++ pkt->stream_index = s_stream->index;
++}
++
+ void AVIDump::AddFrame(const u8* data, int width, int height)
+ {
+- avpicture_fill((AVPicture*)s_bgr_frame, const_cast<u8*>(data), PIX_FMT_BGR24, width, height);
++ avpicture_fill((AVPicture*)s_bgr_frame, const_cast<u8*>(data), AV_PIX_FMT_BGR24, width, height);
+
+ // Convert image from BGR24 to desired pixel format, and scale to initial
+ // width and height
+- struct SwsContext* s_sws_context;
+- if ((s_sws_context = sws_getContext(width, height, PIX_FMT_BGR24, s_width, s_height,
+- s_stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr)))
++ if ((s_sws_context = sws_getCachedContext(s_sws_context,
++ width, height, AV_PIX_FMT_BGR24,
++ s_width, s_height, s_stream->codec->pix_fmt,
++ SWS_BICUBIC, nullptr, nullptr, nullptr)))
+ {
+ sws_scale(s_sws_context, s_bgr_frame->data, s_bgr_frame->linesize, 0,
+ height, s_yuv_frame->data, s_yuv_frame->linesize);
+- sws_freeContext(s_sws_context);
+ }
+
+- // Encode and write the image
+- int outsize = avcodec_encode_video(s_stream->codec, s_out_buffer, s_size, s_yuv_frame);
+- while (outsize > 0)
++ // Encode and write the image.
++ AVPacket pkt;
++ PreparePacket(&pkt);
++ int got_packet;
++ int error = avcodec_encode_video2(s_stream->codec, &pkt, s_yuv_frame, &got_packet);
++ while (!error && got_packet)
+ {
+- AVPacket pkt;
+- av_init_packet(&pkt);
+-
+- if (s_stream->codec->coded_frame->pts != (unsigned int)AV_NOPTS_VALUE)
+- {
+- pkt.pts = av_rescale_q(s_stream->codec->coded_frame->pts,
+- s_stream->codec->time_base, s_stream->time_base);
+- }
+- if (s_stream->codec->coded_frame->key_frame)
+- pkt.flags |= AV_PKT_FLAG_KEY;
+- pkt.stream_index = s_stream->index;
+- pkt.data = s_out_buffer;
+- pkt.size = outsize;
+-
+- // Write the compressed frame in the media file
++ // Write the compressed frame in the media file.
+ av_interleaved_write_frame(s_format_context, &pkt);
+
+- // Encode delayed frames
+- outsize = avcodec_encode_video(s_stream->codec, s_out_buffer, s_size, nullptr);
++ // Handle delayed frames.
++ PreparePacket(&pkt);
++ error = avcodec_encode_video2(s_stream->codec, &pkt, nullptr, &got_packet);
+ }
++ if (error)
++ ERROR_LOG(VIDEO, "Error while encoding video: %d", error);
+ }
+
+ void AVIDump::Stop()
+@@ -358,20 +364,13 @@ void AVIDump::CloseFile()
+ }
+
+ if (s_yuv_buffer)
++ {
+ delete[] s_yuv_buffer;
+- s_yuv_buffer = nullptr;
+-
+- if (s_out_buffer)
+- delete[] s_out_buffer;
+- s_out_buffer = nullptr;
+-
+- if (s_bgr_frame)
+- av_free(s_bgr_frame);
+- s_bgr_frame = nullptr;
++ s_yuv_buffer = nullptr;
++ }
+
+- if (s_yuv_frame)
+- av_free(s_yuv_frame);
+- s_yuv_frame = nullptr;
++ av_frame_free(&s_bgr_frame);
++ av_frame_free(&s_yuv_frame);
+
+ if (s_format_context)
+ {
+@@ -380,6 +379,12 @@ void AVIDump::CloseFile()
+ av_free(s_format_context);
+ s_format_context = nullptr;
+ }
++
++ if (s_sws_context)
++ {
++ sws_freeContext(s_sws_context);
++ s_sws_context = nullptr;
++ }
+ }
+
+ #endif
+--
+2.1.3
+
diff --git a/debian/patches/03_fixes-for-polarssl-1.3.patch b/debian/patches/03_fixes-for-polarssl-1.3.patch
new file mode 100644
index 0000000..d76c12a
--- /dev/null
+++ b/debian/patches/03_fixes-for-polarssl-1.3.patch
@@ -0,0 +1,251 @@
+From 33beaf20f3c511bf2c6b751366b38b3eb023aad7 Mon Sep 17 00:00:00 2001
+From: Tillmann Karras <tilkax at gmail.com>
+Date: Mon, 24 Feb 2014 16:08:43 +0100
+Subject: [PATCH] PolarSSL: adapt Dolphin to new version
+
+- strip down PolarSSL's CMakeLists.txt
+- switch to the PolarSSL 1.3 API
+- use entropy interface instead of havege (PolarSSL 1.3 has disabled
+ havege by default because it is "considered unsafe for primary usage")
+
+ James Cowgill: Don't bother with vcxproj file
+
+---
+ CMakeTests/FindPolarSSL.cmake | 24 ++---
+ Externals/polarssl/CMakeLists.txt | 22 ----
+ Externals/polarssl/visualc/PolarSSL.vcxproj | 117 +++++++++++++++++++++
+ .../Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp | 49 +++++----
+ .../Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h | 10 +-
+ 5 files changed, 158 insertions(+), 64 deletions(-)
+ create mode 100644 Externals/polarssl/visualc/PolarSSL.vcxproj
+
+diff --git a/CMakeTests/FindPolarSSL.cmake b/CMakeTests/FindPolarSSL.cmake
+index be67c56..c55b2bb 100644
+--- a/CMakeTests/FindPolarSSL.cmake
++++ b/CMakeTests/FindPolarSSL.cmake
+@@ -31,23 +31,23 @@ if (POLARSSL_FOUND)
+ check_cxx_source_compiles("
+ #include <polarssl/net.h>
+ #include <polarssl/ssl.h>
+- #include <polarssl/havege.h>
++ #include <polarssl/entropy.h>
+ int main()
+ {
+- ssl_context ctx;
+- ssl_session session;
+- havege_state hs;
++ ssl_context ctx;
++ ssl_session session;
++ entropy_context entropy;
+
+- ssl_init(&ctx);
+- havege_init(&hs);
+- ssl_set_rng(&ctx, havege_random, &hs);
+- ssl_set_session(&ctx, &session);
++ ssl_init(&ctx);
++ entropy_init(&entropy);
++ ssl_set_rng(&ctx, entropy_func, &entropy);
++ ssl_set_session(&ctx, &session);
+
+- ssl_close_notify(&ctx);
+- ssl_session_free(&session);
+- ssl_free(&ctx);
++ ssl_close_notify(&ctx);
++ ssl_session_free(&session);
++ ssl_free(&ctx);
+
+- return 0;
++ return 0;
+ }"
+ POLARSSL_WORKS)
+
+diff --git a/Externals/polarssl/CMakeLists.txt b/Externals/polarssl/CMakeLists.txt
+index 558aedf..198db72 100644
+--- a/Externals/polarssl/CMakeLists.txt
++++ b/Externals/polarssl/CMakeLists.txt
+@@ -1,8 +1,6 @@
+ cmake_minimum_required(VERSION 2.6)
+ project(POLARSSL C)
+
+-enable_testing()
+-
+ string(REGEX MATCH "clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER}")
+
+ if(CMAKE_COMPILER_IS_GNUCC)
+@@ -48,23 +46,3 @@ if(ENABLE_ZLIB_SUPPORT)
+ endif(ENABLE_ZLIB_SUPPORT)
+
+ add_subdirectory(library)
+-add_subdirectory(include)
+-
+-if(CMAKE_COMPILER_IS_GNUCC)
+- add_subdirectory(tests)
+-endif(CMAKE_COMPILER_IS_GNUCC)
+-if(CMAKE_COMPILER_IS_CLANG)
+- add_subdirectory(tests)
+-endif(CMAKE_COMPILER_IS_CLANG)
+-
+-add_subdirectory(programs)
+-
+-ADD_CUSTOM_TARGET(apidoc
+- COMMAND doxygen doxygen/polarssl.doxyfile
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+-
+-ADD_CUSTOM_TARGET(memcheck
+- COMMAND ctest -O memcheck.log -D ExperimentalMemCheck
+- COMMAND tail -n1 memcheck.log | grep 'Memory checking results:' > /dev/null
+- COMMAND rm -f memcheck.log
+- )
+diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+index ba92259..f25972b 100644
+--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
++++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+@@ -28,12 +28,12 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
+ ssl_session_free(&_SSL[i].session);
+ ssl_free(&_SSL[i].ctx);
+
+- x509_free(&_SSL[i].cacert);
+- x509_free(&_SSL[i].clicert);
++ x509_crt_free(&_SSL[i].cacert);
++ x509_crt_free(&_SSL[i].clicert);
+
+ memset(&_SSL[i].ctx, 0, sizeof(ssl_context));
+ memset(&_SSL[i].session, 0, sizeof(ssl_session));
+- memset(&_SSL[i].hs, 0, sizeof(havege_state));
++ memset(&_SSL[i].entropy, 0, sizeof(entropy_context));
+ memset(_SSL[i].hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
+
+ _SSL[i].active = false;
+@@ -147,13 +147,12 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
+ goto _SSL_NEW_ERROR;
+ }
+
+- havege_init(&_SSL[sslID].hs);
+- ssl_set_rng(&_SSL[sslID].ctx, havege_random, &_SSL[sslID].hs);
++ entropy_init(&_SSL[sslID].entropy);
++ ssl_set_rng(&_SSL[sslID].ctx, entropy_func, &_SSL[sslID].entropy);
+
+ // For some reason we can't use TLSv1.2, v1.1 and below are fine!
+ ssl_set_max_version(&_SSL[sslID].ctx, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_2);
+
+- ssl_set_ciphersuites(&_SSL[sslID].ctx, ssl_default_ciphersuites);
+ ssl_set_session(&_SSL[sslID].ctx, &_SSL[sslID].session);
+
+ ssl_set_endpoint(&_SSL[sslID].ctx, SSL_IS_CLIENT);
+@@ -192,12 +191,12 @@ _SSL_NEW_ERROR:
+ ssl_session_free(&_SSL[sslID].session);
+ ssl_free(&_SSL[sslID].ctx);
+
+- x509_free(&_SSL[sslID].cacert);
+- x509_free(&_SSL[sslID].clicert);
++ x509_crt_free(&_SSL[sslID].cacert);
++ x509_crt_free(&_SSL[sslID].clicert);
+
+ memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
+ memset(&_SSL[sslID].session, 0, sizeof(ssl_session));
+- memset(&_SSL[sslID].hs, 0, sizeof(havege_state));
++ memset(&_SSL[sslID].entropy, 0, sizeof(entropy_context));
+ memset(_SSL[sslID].hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
+
+ _SSL[sslID].active = false;
+@@ -231,7 +230,7 @@ _SSL_NEW_ERROR:
+ int sslID = Memory::Read_U32(BufferOut) - 1;
+ if (SSLID_VALID(sslID))
+ {
+- int ret = x509parse_crt_der(
++ int ret = x509_crt_parse_der(
+ &_SSL[sslID].cacert,
+ Memory::GetPointer(BufferOut2),
+ BufferOutSize2);
+@@ -268,23 +267,23 @@ _SSL_NEW_ERROR:
+ if (SSLID_VALID(sslID))
+ {
+ 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 rsa_ret = x509parse_keyfile(&_SSL[sslID].rsa, (cert_base_path + "clientcakey.pem").c_str(), NULL);
+- if (ret || rsa_ret)
++ int ret = x509_crt_parse_file(&_SSL[sslID].clicert, (cert_base_path + "clientca.pem").c_str());
++ int pk_ret = pk_parse_keyfile(&_SSL[sslID].pk, (cert_base_path + "clientcakey.pem").c_str(), NULL);
++ if (ret || pk_ret)
+ {
+- x509_free(&_SSL[sslID].clicert);
+- rsa_free(&_SSL[sslID].rsa);
+- memset(&_SSL[sslID].clicert, 0, sizeof(x509_cert));
+- memset(&_SSL[sslID].rsa, 0, sizeof(rsa_context));
++ x509_crt_free(&_SSL[sslID].clicert);
++ pk_free(&_SSL[sslID].pk);
++ memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
++ memset(&_SSL[sslID].pk, 0, sizeof(pk_context));
+ Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
+ }
+ else
+ {
+- ssl_set_own_cert(&_SSL[sslID].ctx, &_SSL[sslID].clicert, &_SSL[sslID].rsa);
++ ssl_set_own_cert(&_SSL[sslID].ctx, &_SSL[sslID].clicert, &_SSL[sslID].pk);
+ Memory::Write_U32(SSL_OK, _BufferIn);
+ }
+
+- INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = (%d, %d)", ret, rsa_ret);
++ INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = (%d, %d)", ret, pk_ret);
+ }
+ else
+ {
+@@ -306,10 +305,10 @@ _SSL_NEW_ERROR:
+ int sslID = Memory::Read_U32(BufferOut) - 1;
+ if (SSLID_VALID(sslID))
+ {
+- x509_free(&_SSL[sslID].clicert);
+- rsa_free(&_SSL[sslID].rsa);
+- memset(&_SSL[sslID].clicert, 0, sizeof(x509_cert));
+- memset(&_SSL[sslID].rsa, 0, sizeof(rsa_context));
++ x509_crt_free(&_SSL[sslID].clicert);
++ pk_free(&_SSL[sslID].pk);
++ memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
++ memset(&_SSL[sslID].pk, 0, sizeof(pk_context));
+
+ ssl_set_own_cert(&_SSL[sslID].ctx, NULL, NULL);
+ Memory::Write_U32(SSL_OK, _BufferIn);
+@@ -328,10 +327,10 @@ _SSL_NEW_ERROR:
+ {
+ 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 = x509_crt_parse_file(&_SSL[sslID].cacert, (cert_base_path + "rootca.pem").c_str());
+ if (ret)
+ {
+- x509_free(&_SSL[sslID].clicert);
++ x509_crt_free(&_SSL[sslID].clicert);
+ Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
+ }
+ else
+diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
+index 80e87ea..145a49e 100644
+--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
++++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
+@@ -4,7 +4,7 @@
+
+ #pragma once
+
+-#include <polarssl/havege.h>
++#include <polarssl/entropy.h>
+ #include <polarssl/net.h>
+ #include <polarssl/ssl.h>
+
+@@ -57,10 +57,10 @@ typedef struct
+ {
+ ssl_context ctx;
+ ssl_session session;
+- havege_state hs;
+- x509_cert cacert;
+- x509_cert clicert;
+- rsa_context rsa;
++ entropy_context entropy;
++ x509_crt cacert;
++ x509_crt clicert;
++ pk_context pk;
+ int sockfd;
+ char hostname[NET_SSL_MAX_HOSTNAME_LEN];
+ bool active;
+--
+2.1.3
+
diff --git a/debian/patches/04_use-polarssl-aes.patch b/debian/patches/04_use-polarssl-aes.patch
new file mode 100644
index 0000000..b6dfc0d
--- /dev/null
+++ b/debian/patches/04_use-polarssl-aes.patch
@@ -0,0 +1,339 @@
+From 8e73e8ae5fad7f1f893832fcaf14b04e5e052795 Mon Sep 17 00:00:00 2001
+From: Ryan Houdek <Sonicadvance1 at Gmail.com>
+Date: Sun, 27 Oct 2013 18:27:07 +0000
+Subject: [PATCH] Wipe all traces of OpenSSL's AES implementation. Use polarssl
+ instead.
+
+ James Cowgill: Crypto/aes_* files already removed
+
+---
+ Source/Core/Common/CMakeLists.txt | 2 -
+ Source/Core/Common/Common.vcxproj | 4 -
+ Source/Core/Common/Common.vcxproj.filters | 12 -
+ Source/Core/Common/Src/Crypto/aes.h | 143 ---
+ Source/Core/Common/Src/Crypto/aes_cbc.cpp | 131 ---
+ Source/Core/Common/Src/Crypto/aes_core.cpp | 1159 --------------------
+ Source/Core/Common/Src/Crypto/aes_locl.h | 88 --
+ .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 14 +-
+ Source/Core/DiscIO/Src/NANDContentLoader.cpp | 8 +-
+ Source/Core/DiscIO/Src/VolumeCreator.cpp | 8 +-
+ Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp | 10 +-
+ Source/Core/DiscIO/Src/VolumeWiiCrypted.h | 4 +-
+ .../DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp | 12 +-
+ .../DolphinWX/Src/MemoryCards/WiiSaveCrypted.h | 5 +-
+ 14 files changed, 32 insertions(+), 1568 deletions(-)
+ delete mode 100644 Source/Core/Common/Src/Crypto/aes.h
+ delete mode 100644 Source/Core/Common/Src/Crypto/aes_cbc.cpp
+ delete mode 100644 Source/Core/Common/Src/Crypto/aes_core.cpp
+ delete mode 100644 Source/Core/Common/Src/Crypto/aes_locl.h
+
+diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt
+index ce76f00..e670106 100644
+--- a/Source/Core/Common/CMakeLists.txt
++++ b/Source/Core/Common/CMakeLists.txt
+@@ -24,8 +24,6 @@ set(SRCS Src/BreakPoints.cpp
+ Src/x64ABI.cpp
+ Src/x64Analyzer.cpp
+ Src/x64Emitter.cpp
+- Src/Crypto/aes_cbc.cpp
+- Src/Crypto/aes_core.cpp
+ Src/Crypto/bn.cpp
+ Src/Crypto/ec.cpp)
+
+diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj
+index 20cf92d..aa91ad9 100644
+--- a/Source/Core/Common/Common.vcxproj
++++ b/Source/Core/Common/Common.vcxproj
+@@ -180,8 +180,6 @@
+ <ClCompile Include="Src\CDUtils.cpp" />
+ <ClCompile Include="Src\ColorUtil.cpp" />
+ <ClCompile Include="Src\ConsoleListener.cpp" />
+- <ClCompile Include="Src\Crypto\aes_cbc.cpp" />
+- <ClCompile Include="Src\Crypto\aes_core.cpp" />
+ <ClCompile Include="Src\Crypto\bn.cpp" />
+ <ClCompile Include="Src\Crypto\ec.cpp" />
+ <ClCompile Include="Src\ExtendedTrace.cpp" />
+@@ -232,8 +230,6 @@
+ <ClInclude Include="Src\CommonTypes.h" />
+ <ClInclude Include="Src\ConsoleListener.h" />
+ <ClInclude Include="Src\CPUDetect.h" />
+- <ClInclude Include="Src\Crypto\aes.h" />
+- <ClInclude Include="Src\Crypto\aes_locl.h" />
+ <ClInclude Include="Src\Crypto\tools.h" />
+ <ClInclude Include="Src\DebugInterface.h" />
+ <ClInclude Include="Src\ExtendedTrace.h" />
+diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters
+index 05b9edc..fabd8f1 100644
+--- a/Source/Core/Common/Common.vcxproj.filters
++++ b/Source/Core/Common/Common.vcxproj.filters
+@@ -31,12 +31,6 @@
+ <ClCompile Include="Src\ConsoleListener.cpp">
+ <Filter>Logging</Filter>
+ </ClCompile>
+- <ClCompile Include="Src\Crypto\aes_cbc.cpp">
+- <Filter>Crypto</Filter>
+- </ClCompile>
+- <ClCompile Include="Src\Crypto\aes_core.cpp">
+- <Filter>Crypto</Filter>
+- </ClCompile>
+ <ClCompile Include="Src\Crypto\bn.cpp">
+ <Filter>Crypto</Filter>
+ </ClCompile>
+@@ -95,12 +89,6 @@
+ <ClInclude Include="Src\ConsoleListener.h">
+ <Filter>Logging</Filter>
+ </ClInclude>
+- <ClInclude Include="Src\Crypto\aes.h">
+- <Filter>Crypto</Filter>
+- </ClInclude>
+- <ClInclude Include="Src\Crypto\aes_locl.h">
+- <Filter>Crypto</Filter>
+- </ClInclude>
+ <ClInclude Include="Src\Crypto\tools.h">
+ <Filter>Crypto</Filter>
+ </ClInclude>
+diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
+index f0ea0d5..8c214a3 100644
+--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
++++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
+@@ -38,7 +38,7 @@
+ #include "../PowerPC/PowerPC.h"
+ #include "../VolumeHandler.h"
+ #include "FileUtil.h"
+-#include "Crypto/aes.h"
++#include <polarssl/aes.h>
+ #include "ConfigManager.h"
+
+ #include "../Boot/Boot_DOL.h"
+@@ -860,10 +860,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
+ u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
+ u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
+
+- AES_KEY AESKey;
+- AES_set_encrypt_key(keyTable[keyIndex], 128, &AESKey);
++ aes_context AES_ctx;
++ aes_setkey_enc(&AES_ctx, keyTable[keyIndex], 128);
+ memcpy(newIV, IV, 16);
+- AES_cbc_encrypt(source, destination, size, &AESKey, newIV, AES_ENCRYPT);
++ aes_crypt_cbc(&AES_ctx, AES_ENCRYPT, size, newIV, source, destination);
+
+ _dbg_assert_msg_(WII_IPC_ES, keyIndex == 6, "IOCTL_ES_ENCRYPT: Key type is not SD, data will be crap");
+ }
+@@ -878,10 +878,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
+ u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
+ u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
+
+- AES_KEY AESKey;
+- AES_set_decrypt_key(keyTable[keyIndex], 128, &AESKey);
++ aes_context AES_ctx;
++ aes_setkey_dec(&AES_ctx, keyTable[keyIndex], 128);
+ memcpy(newIV, IV, 16);
+- AES_cbc_encrypt(source, destination, size, &AESKey, newIV, AES_DECRYPT);
++ aes_crypt_cbc(&AES_ctx, AES_DECRYPT, size, newIV, source, destination);
+
+ _dbg_assert_msg_(WII_IPC_ES, keyIndex == 6, "IOCTL_ES_DECRYPT: Key type is not SD, data will be crap");
+ }
+diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+index 974f8a9..4e722d1 100644
+--- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp
++++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+@@ -6,7 +6,7 @@
+
+ #include <algorithm>
+ #include <cctype>
+-#include "Crypto/aes.h"
++#include <polarssl/aes.h>
+ #include "MathUtil.h"
+ #include "FileUtil.h"
+ #include "Log.h"
+@@ -286,10 +286,10 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
+ }
+ void CNANDContentLoader::AESDecode(u8* _pKey, u8* _IV, u8* _pSrc, u32 _Size, u8* _pDest)
+ {
+- AES_KEY AESKey;
++ aes_context AES_ctx;
+
+- AES_set_decrypt_key(_pKey, 128, &AESKey);
+- AES_cbc_encrypt(_pSrc, _pDest, _Size, &AESKey, _IV, AES_DECRYPT);
++ aes_setkey_dec(&AES_ctx, _pKey, 128);
++ aes_crypt_cbc(&AES_ctx, AES_DECRYPT, _Size, _IV, _pSrc, _pDest);
+ }
+
+ void CNANDContentLoader::GetKeyFromTicket(u8* pTicket, u8* pTicketKey)
+diff --git a/Source/Core/DiscIO/Src/VolumeCreator.cpp b/Source/Core/DiscIO/Src/VolumeCreator.cpp
+index 6cf5ea8..20cf868 100644
+--- a/Source/Core/DiscIO/Src/VolumeCreator.cpp
++++ b/Source/Core/DiscIO/Src/VolumeCreator.cpp
+@@ -4,7 +4,7 @@
+
+ #include <vector>
+
+-#include "Crypto/aes.h"
++#include <polarssl/aes.h>
+
+ #include "VolumeCreator.h"
+
+@@ -183,11 +183,11 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part
+ memset(IV, 0, 16);
+ _rReader.Read(rPartition.Offset + 0x44c, 8, IV);
+
+- AES_KEY AES_KEY;
+- AES_set_decrypt_key((Korean ? g_MasterKeyK : g_MasterKey), 128, &AES_KEY);
++ aes_context AES_ctx;
++ aes_setkey_dec(&AES_ctx, (Korean ? g_MasterKeyK : g_MasterKey), 128);
+
+ u8 VolumeKey[16];
+- AES_cbc_encrypt(SubKey, VolumeKey, 16, &AES_KEY, IV, AES_DECRYPT);
++ aes_crypt_cbc(&AES_ctx, AES_DECRYPT, 16, IV, SubKey, VolumeKey);
+
+ // -1 means the caller just wanted the partition with matching type
+ if ((int)_VolumeNum == -1 || i == _VolumeNum)
+diff --git a/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp
+index 51ee3d5..c20ccf4 100644
+--- a/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp
++++ b/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp
+@@ -18,7 +18,8 @@ CVolumeWiiCrypted::CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset,
+ dataOffset(0x20000),
+ m_LastDecryptedBlockOffset(-1)
+ {
+- AES_set_decrypt_key(_pVolumeKey, 128, &m_AES_KEY);
++ m_AES_ctx = new aes_context;
++ aes_setkey_dec(m_AES_ctx, _pVolumeKey, 128);
+ m_pBuffer = new u8[0x8000];
+ }
+
+@@ -29,6 +30,8 @@ CVolumeWiiCrypted::~CVolumeWiiCrypted()
+ m_pReader = NULL;
+ delete[] m_pBuffer;
+ m_pBuffer = NULL;
++ delete m_AES_ctx;
++ m_AES_ctx = NULL;
+ }
+
+ bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
+@@ -67,7 +70,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
+ if (m_LastDecryptedBlockOffset != Block)
+ {
+ memcpy(IV, m_pBuffer + 0x3d0, 16);
+- AES_cbc_encrypt(m_pBuffer + 0x400, m_LastDecryptedBlock, 0x7C00, &m_AES_KEY, IV, AES_DECRYPT);
++ aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock);
+
+ m_LastDecryptedBlockOffset = Block;
+ }
+@@ -250,7 +253,8 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
+ NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
+ return false;
+ }
+- AES_cbc_encrypt(clusterMDCrypted, clusterMD, 0x400, &m_AES_KEY, IV, AES_DECRYPT);
++ aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
++
+
+ // Some clusters have invalid data and metadata because they aren't
+ // meant to be read by the game (for example, holes between files). To
+diff --git a/Source/Core/DiscIO/Src/VolumeWiiCrypted.h b/Source/Core/DiscIO/Src/VolumeWiiCrypted.h
+index 4577746..4756a88 100644
+--- a/Source/Core/DiscIO/Src/VolumeWiiCrypted.h
++++ b/Source/Core/DiscIO/Src/VolumeWiiCrypted.h
+@@ -7,7 +7,7 @@
+
+ #include "Volume.h"
+ #include "Blob.h"
+-#include "Crypto/aes.h"
++#include <polarssl/aes.h>
+
+ // --- this volume type is used for encrypted Wii images ---
+
+@@ -38,7 +38,7 @@ private:
+ IBlobReader* m_pReader;
+
+ u8* m_pBuffer;
+- AES_KEY m_AES_KEY;
++ aes_context* m_AES_ctx;
+
+ u64 m_VolumeOffset;
+ u64 dataOffset;
+diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp
+index 091804e..99cea98 100644
+--- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp
++++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp
+@@ -78,7 +78,7 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
+
+ if (!TitleID) // Import
+ {
+- AES_set_decrypt_key(SDKey, 128, &m_AES_KEY);
++ aes_setkey_dec(&m_AES_ctx, SDKey, 128);
+ b_valid = true;
+ ReadHDR();
+ ReadBKHDR();
+@@ -95,7 +95,7 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
+ }
+ else
+ {
+- AES_set_encrypt_key(SDKey, 128, &m_AES_KEY);
++ aes_setkey_enc(&m_AES_ctx, SDKey, 128);
+
+ if (getPaths(true))
+ {
+@@ -133,7 +133,7 @@ void CWiiSaveCrypted::ReadHDR()
+ }
+ fpData_bin.Close();
+
+- AES_cbc_encrypt((const u8*)&_encryptedHeader, (u8*)&_header, HEADER_SZ, &m_AES_KEY, SD_IV, AES_DECRYPT);
++ aes_crypt_cbc(&m_AES_ctx, AES_DECRYPT, HEADER_SZ, SD_IV, (const u8*)&_encryptedHeader, (u8*)&_header);
+ u32 bannerSize = Common::swap32(_header.hdr.BannerSize);
+ if ((bannerSize < FULL_BNR_MIN) || (bannerSize > FULL_BNR_MAX) ||
+ (((bannerSize - BNR_SZ) % ICON_SZ) != 0))
+@@ -197,7 +197,7 @@ void CWiiSaveCrypted::WriteHDR()
+ md5((u8*)&_header, HEADER_SZ, md5_calc);
+ memcpy(_header.hdr.Md5, md5_calc, 0x10);
+
+- AES_cbc_encrypt((const unsigned char *)&_header, (u8*)&_encryptedHeader, HEADER_SZ, &m_AES_KEY, SD_IV, AES_ENCRYPT);
++ aes_crypt_cbc(&m_AES_ctx, AES_ENCRYPT, HEADER_SZ, SD_IV, (const u8*)&_header, (u8*)&_encryptedHeader);
+
+ File::IOFile fpData_bin(encryptedSavePath, "wb");
+ if (!fpData_bin.WriteBytes(&_encryptedHeader, HEADER_SZ))
+@@ -332,7 +332,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
+
+
+ memcpy(IV, _tmpFileHDR.IV, 0x10);
+- AES_cbc_encrypt((const unsigned char *)&_encryptedData[0], &_data[0], RoundedFileSize, &m_AES_KEY, IV, AES_DECRYPT);
++ aes_crypt_cbc(&m_AES_ctx, AES_DECRYPT, RoundedFileSize, IV, (const u8*)&_encryptedData[0], &_data[0]);
+
+ if (!File::Exists(fullFilePath) || AskYesNoT("%s already exists, overwrite?", fullFilePath.c_str()))
+ {
+@@ -421,7 +421,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
+ b_valid = false;
+ }
+
+- AES_cbc_encrypt((const u8*)&_data[0], &_encryptedData[0], _roundedfileSize, &m_AES_KEY, tmpFileHDR.IV, AES_ENCRYPT);
++ aes_crypt_cbc(&m_AES_ctx, AES_ENCRYPT, _roundedfileSize, tmpFileHDR.IV, (const u8*)&_data[0], &_encryptedData[0]);
+
+ File::IOFile fpData_bin(encryptedSavePath, "ab");
+ if (!fpData_bin.WriteBytes(&_encryptedData[0], _roundedfileSize))
+diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h
+index 29a3e1f..6ec4194 100644
+--- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h
++++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h
+@@ -6,8 +6,8 @@
+ #define _WII_SAVE_CRYPTED
+
+ #include "StringUtil.h"
+-#include "Crypto/aes.h"
+ #include "Crypto/tools.h"
++#include <polarssl/aes.h>
+ #include "polarssl/md5.h"
+
+ // --- this is used for encrypted Wii save files
+@@ -35,8 +35,7 @@ private:
+ bool getPaths(bool forExport = false);
+ void ScanForFiles(std::string savDir, std::vector<std::string>&FilesList, u32 *_numFiles, u32 *_sizeFiles);
+
+-
+- AES_KEY m_AES_KEY;
++ aes_context m_AES_ctx;
+ u8 SD_IV[0x10];
+ std::vector<std::string> FilesList;
+
+--
+2.1.3
+
diff --git a/debian/patches/08_polarssl-use-1.3.patch b/debian/patches/08_polarssl-use-1.3.patch
deleted file mode 100644
index d08a6fe..0000000
--- a/debian/patches/08_polarssl-use-1.3.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-Upgrade PolarSSL to version 1.3+
-Index: dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h 2013-11-30 22:06:23.703137735 -0800
-@@ -10,6 +10,7 @@
- #include <polarssl/net.h>
- #include <polarssl/ssl.h>
- #include <polarssl/havege.h>
-+#include <polarssl/x509.h>
-
- #define NET_SSL_MAX_HOSTNAME_LEN 256
- #define NET_SSL_MAXINSTANCES 4
-@@ -58,8 +59,8 @@
- ssl_context ctx;
- ssl_session session;
- havege_state hs;
-- x509_cert cacert;
-- x509_cert clicert;
-+ x509_crt cacert;
-+ x509_crt clicert;
- rsa_context rsa;
- int sockfd;
- char hostname[NET_SSL_MAX_HOSTNAME_LEN];
-Index: dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp 2013-11-30 22:06:23.703137735 -0800
-@@ -2,6 +2,8 @@
- // Licensed under GPLv2
- // Refer to the license.txt file included.
-
-+#include <polarssl/compat-1.2.h>
-+
- #include "FileUtil.h"
- #include "WII_IPC_HLE_Device_net_ssl.h"
- #include "WII_Socket.h"
-@@ -28,8 +30,8 @@
- ssl_session_free(&_SSL[i].session);
- ssl_free(&_SSL[i].ctx);
-
-- x509_free(&_SSL[i].cacert);
-- x509_free(&_SSL[i].clicert);
-+ x509_crt_free(&_SSL[i].cacert);
-+ x509_crt_free(&_SSL[i].clicert);
-
- memset(&_SSL[i].ctx, 0, sizeof(ssl_context));
- memset(&_SSL[i].session, 0, sizeof(ssl_session));
-@@ -153,7 +155,7 @@
- // For some reason we can't use TLSv1.2, v1.1 and below are fine!
- ssl_set_max_version(&_SSL[sslID].ctx, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_2);
-
-- ssl_set_ciphersuites(&_SSL[sslID].ctx, ssl_default_ciphersuites);
-+ ssl_set_ciphersuites(&_SSL[sslID].ctx, ssl_list_ciphersuites());
- ssl_set_session(&_SSL[sslID].ctx, &_SSL[sslID].session);
-
- ssl_set_endpoint(&_SSL[sslID].ctx, SSL_IS_CLIENT);
-@@ -192,8 +194,8 @@
- ssl_session_free(&_SSL[sslID].session);
- ssl_free(&_SSL[sslID].ctx);
-
-- x509_free(&_SSL[sslID].cacert);
-- x509_free(&_SSL[sslID].clicert);
-+ x509_crt_free(&_SSL[sslID].cacert);
-+ x509_crt_free(&_SSL[sslID].clicert);
-
- memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
- memset(&_SSL[sslID].session, 0, sizeof(ssl_session));
-@@ -231,7 +233,7 @@
- int sslID = Memory::Read_U32(BufferOut) - 1;
- if (SSLID_VALID(sslID))
- {
-- int ret = x509parse_crt_der(
-+ int ret = x509_crt_parse_der(
- &_SSL[sslID].cacert,
- Memory::GetPointer(BufferOut2),
- BufferOutSize2);
-@@ -268,19 +270,19 @@
- if (SSLID_VALID(sslID))
- {
- 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 = x509_crt_parse_file(&_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);
- if (ret || rsa_ret)
- {
-- x509_free(&_SSL[sslID].clicert);
-+ x509_crt_free(&_SSL[sslID].clicert);
- rsa_free(&_SSL[sslID].rsa);
-- memset(&_SSL[sslID].clicert, 0, sizeof(x509_cert));
-+ memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
- memset(&_SSL[sslID].rsa, 0, sizeof(rsa_context));
- Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
- }
- else
- {
-- ssl_set_own_cert(&_SSL[sslID].ctx, &_SSL[sslID].clicert, &_SSL[sslID].rsa);
-+ ssl_set_own_cert_rsa(&_SSL[sslID].ctx, &_SSL[sslID].clicert, &_SSL[sslID].rsa);
- Memory::Write_U32(SSL_OK, _BufferIn);
- }
-
-@@ -306,12 +308,12 @@
- int sslID = Memory::Read_U32(BufferOut) - 1;
- if (SSLID_VALID(sslID))
- {
-- x509_free(&_SSL[sslID].clicert);
-+ x509_crt_free(&_SSL[sslID].clicert);
- rsa_free(&_SSL[sslID].rsa);
-- memset(&_SSL[sslID].clicert, 0, sizeof(x509_cert));
-+ memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
- memset(&_SSL[sslID].rsa, 0, sizeof(rsa_context));
-
-- ssl_set_own_cert(&_SSL[sslID].ctx, NULL, NULL);
-+ ssl_set_own_cert_rsa(&_SSL[sslID].ctx, NULL, NULL);
- Memory::Write_U32(SSL_OK, _BufferIn);
- }
- else
-@@ -328,10 +330,10 @@
- {
- 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 = x509_crt_parse_file(&_SSL[sslID].cacert, (cert_base_path + "rootca.pem").c_str());
- if (ret)
- {
-- x509_free(&_SSL[sslID].clicert);
-+ x509_crt_free(&_SSL[sslID].clicert);
- Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
- }
- else
diff --git a/debian/patches/11_polarssl-replace-aes.patch b/debian/patches/11_polarssl-replace-aes.patch
deleted file mode 100644
index ad522cf..0000000
--- a/debian/patches/11_polarssl-replace-aes.patch
+++ /dev/null
@@ -1,160 +0,0 @@
-Use PolarSSL instead of non-GPL compatible OpenSSL for AES functions
-Index: dolphin-emu-4.0.2/Source/Core/Common/CMakeLists.txt
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Common/CMakeLists.txt 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/Common/CMakeLists.txt 2013-11-30 22:06:32.119137368 -0800
-@@ -24,8 +24,6 @@
- Src/x64ABI.cpp
- Src/x64Analyzer.cpp
- Src/x64Emitter.cpp
-- Src/Crypto/aes_cbc.cpp
-- Src/Crypto/aes_core.cpp
- Src/Crypto/bn.cpp
- Src/Crypto/ec.cpp)
-
-Index: dolphin-emu-4.0.2/Source/Core/Common/Src/Crypto/openssl-wrapper.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ dolphin-emu-4.0.2/Source/Core/Common/Src/Crypto/openssl-wrapper.h 2013-11-30 22:06:32.119137368 -0800
-@@ -0,0 +1,41 @@
-+/**
-+ * \file openssl.h
-+ *
-+ * \brief OpenSSL wrapper (definitions, inline functions).
-+ *
-+ * Copyright (C) 2013, Brandon Barnes
-+ * Copyright (C) 2006-2010, Brainspark B.V.
-+ * originally contributed by David Barett
-+ *
-+ * This is a fork of openssl.h, a part of PolarSSL
-+ *
-+ * This program 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 program 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.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#ifndef POLARSSL_OPENSSL_H
-+#define POLARSSL_OPENSSL_H
-+
-+#include <polarssl/aes.h>
-+
-+#define AES_KEY aes_context
-+
-+#define AES_set_encrypt_key( KEY, KEYSIZE, CTX ) \
-+ aes_setkey_enc( (CTX), (KEY), (KEYSIZE) )
-+#define AES_set_decrypt_key( KEY, KEYSIZE, CTX ) \
-+ aes_setkey_dec( (CTX), (KEY), (KEYSIZE) )
-+#define AES_cbc_encrypt( INPUT, OUTPUT, LEN, CTX, IV, MODE ) \
-+ aes_crypt_cbc( (CTX), (MODE), (LEN), (IV), (INPUT), (OUTPUT) )
-+
-+#endif /* openssl.h */
-Index: dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp 2013-11-30 22:06:32.119137368 -0800
-@@ -38,7 +38,7 @@
- #include "../PowerPC/PowerPC.h"
- #include "../VolumeHandler.h"
- #include "FileUtil.h"
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
- #include "ConfigManager.h"
-
- #include "../Boot/Boot_DOL.h"
-Index: dolphin-emu-4.0.2/Source/Core/DiscIO/Src/NANDContentLoader.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/DiscIO/Src/NANDContentLoader.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/DiscIO/Src/NANDContentLoader.cpp 2013-11-30 22:06:32.119137368 -0800
-@@ -6,7 +6,7 @@
-
- #include <algorithm>
- #include <cctype>
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
- #include "MathUtil.h"
- #include "FileUtil.h"
- #include "Log.h"
-Index: dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeCreator.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/DiscIO/Src/VolumeCreator.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeCreator.cpp 2013-11-30 22:06:32.119137368 -0800
-@@ -4,7 +4,7 @@
-
- #include <vector>
-
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
-
- #include "VolumeCreator.h"
-
-Index: dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeWiiCrypted.h
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/DiscIO/Src/VolumeWiiCrypted.h 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeWiiCrypted.h 2013-11-30 22:06:32.119137368 -0800
-@@ -7,7 +7,7 @@
-
- #include "Volume.h"
- #include "Blob.h"
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
-
- // --- this volume type is used for encrypted Wii images ---
-
-Index: dolphin-emu-4.0.2/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h 2013-11-30 22:06:32.123137366 -0800
-@@ -6,7 +6,7 @@
- #define _WII_SAVE_CRYPTED
-
- #include "StringUtil.h"
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
- #include "Crypto/tools.h"
- #include "polarssl/md5.h"
-
-Index: dolphin-emu-4.0.2/Source/Core/Core/Src/ec_wii.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Core/Src/ec_wii.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/Core/Src/ec_wii.cpp 2013-11-30 22:06:32.123137366 -0800
-@@ -10,7 +10,7 @@
- #include <stdio.h>
- #include <string.h>
- #include "Common.h"
--#include "Crypto/aes.h"
-+#include "Crypto/openssl-wrapper.h"
- #include "polarssl/sha1.h"
- #include "Crypto/tools.h"
- #include "FileUtil.h"
-Index: dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp 2013-11-29 13:05:19.000000000 -0800
-+++ dolphin-emu-4.0.2/Source/Core/DiscIO/Src/VolumeWiiCrypted.cpp 2013-11-30 22:06:32.123137366 -0800
-@@ -67,7 +67,7 @@
- if (m_LastDecryptedBlockOffset != Block)
- {
- memcpy(IV, m_pBuffer + 0x3d0, 16);
-- AES_cbc_encrypt(m_pBuffer + 0x400, m_LastDecryptedBlock, 0x7C00, &m_AES_KEY, IV, AES_DECRYPT);
-+ AES_cbc_encrypt(m_pBuffer + 0x400, m_LastDecryptedBlock, 0x7C00, (AES_KEY *) &m_AES_KEY, IV, AES_DECRYPT);
-
- m_LastDecryptedBlockOffset = Block;
- }
-@@ -250,7 +250,7 @@
- NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
- return false;
- }
-- AES_cbc_encrypt(clusterMDCrypted, clusterMD, 0x400, &m_AES_KEY, IV, AES_DECRYPT);
-+ AES_cbc_encrypt(clusterMDCrypted, clusterMD, 0x400, (AES_KEY *) &m_AES_KEY, IV, AES_DECRYPT);
-
- // Some clusters have invalid data and metadata because they aren't
- // meant to be read by the game (for example, holes between files). To
diff --git a/debian/patches/90_g++-use-4.9.patch b/debian/patches/90_g++-use-4.9.patch
deleted file mode 100644
index 29b623f..0000000
--- a/debian/patches/90_g++-use-4.9.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Update code to compile with g++ 4.9.
-Index: dolphin-emu-4.0.2/Source/Core/Common/Src/CommonFuncs.h
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/Common/Src/CommonFuncs.h 2014-07-04 15:42:18.635514892 -0700
-+++ dolphin-emu-4.0.2/Source/Core/Common/Src/CommonFuncs.h 2014-07-04 16:15:32.195428710 -0700
-@@ -32,6 +32,7 @@
-
- #if defined __GNUC__ && !defined __SSSE3__ && !defined _M_GENERIC
- #include <emmintrin.h>
-+#if (__GNUC__ * 1000 + __GNUC_MINOR__ < 4009)
- static __inline __m128i __attribute__((__always_inline__))
- _mm_shuffle_epi8(__m128i a, __m128i mask)
- {
-@@ -41,6 +42,9 @@
- : "xm" (mask), "0" (a));
- return result;
- }
-+#else
-+#include <tmmintrin.h>
-+#endif
- #endif
-
- #ifndef _WIN32
diff --git a/debian/patches/910_av-use-555553.patch b/debian/patches/910_av-use-555553.patch
deleted file mode 100644
index 0c4957f..0000000
--- a/debian/patches/910_av-use-555553.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-Update code to compile with libav 55/55/53.
-Index: dolphin-emu-4.0.2/Source/Core/VideoCommon/Src/AVIDump.cpp
-===================================================================
---- dolphin-emu-4.0.2.orig/Source/Core/VideoCommon/Src/AVIDump.cpp
-+++ dolphin-emu-4.0.2/Source/Core/VideoCommon/Src/AVIDump.cpp
-@@ -243,6 +243,45 @@ bool AVIDump::Start(int w, int h)
- return CreateFile();
- }
-
-+#if (LIBAVCODEC_VERSION_MAJOR >= 55)
-+
-+#define CODEC_ID_FFV1 AV_CODEC_ID_FFV1
-+
-+// Shamelessly copied from libav-9.13 utils.c
-+int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-+ const AVFrame *pict)
-+{
-+ AVPacket pkt;
-+ int ret, got_packet = 0;
-+
-+ if (buf_size < FF_MIN_BUFFER_SIZE) {
-+ av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
-+ return -1;
-+ }
-+
-+ av_init_packet(&pkt);
-+ pkt.data = buf;
-+ pkt.size = buf_size;
-+
-+ ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet);
-+ if (!ret && got_packet && avctx->coded_frame) {
-+ avctx->coded_frame->pts = pkt.pts;
-+ avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
-+ }
-+
-+ /* free any side data since we cannot return it */
-+ if (pkt.side_data_elems > 0) {
-+ int i;
-+ for (i = 0; i < pkt.side_data_elems; i++)
-+ av_free(pkt.side_data[i].data);
-+ av_freep(&pkt.side_data);
-+ pkt.side_data_elems = 0;
-+ }
-+
-+ return ret ? ret : pkt.size;
-+}
-+#endif
-+
- bool AVIDump::CreateFile()
- {
- AVCodec *codec = NULL;
diff --git a/debian/patches/series b/debian/patches/series
index 251c285..79108e3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,9 +1,9 @@
-08_polarssl-use-1.3.patch
-11_polarssl-replace-aes.patch
+01_fixes-for-gcc-4.9.patch
+02_fixes-for-libav-10.patch
+03_fixes-for-polarssl-1.3.patch
+04_use-polarssl-aes.patch
20_remove-powerpcdisasm.patch
30_play-pause-keyboard-shortcut.patch
35_cmake-miniupnpc-fixes.patch
37_cmake-sfml-fixes.patch
80_sfml-use-2.1.patch
-90_g++-use-4.9.patch
-910_av-use-555553.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/dolphin-emu.git
More information about the Pkg-games-commits
mailing list