summaryrefslogtreecommitdiffstats
path: root/src/dedicated_room/yuzu_room.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-10-01 23:53:36 +0200
committerGitHub <noreply@github.com>2022-10-01 23:53:36 +0200
commit2a752bbd646aefaedd5b2aa334710a48bb6fe907 (patch)
tree4513e36fa60db1ec1cdcef500088194030e61c83 /src/dedicated_room/yuzu_room.cpp
parentMerge pull request #9009 from yuzu-emu/bunnei-move-deploy-linux.sh (diff)
parentAddress some review comments (diff)
downloadyuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.gz
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.bz2
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.lz
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.xz
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.zst
yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.zip
Diffstat (limited to 'src/dedicated_room/yuzu_room.cpp')
-rw-r--r--src/dedicated_room/yuzu_room.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp
index 7b6deba41..359891883 100644
--- a/src/dedicated_room/yuzu_room.cpp
+++ b/src/dedicated_room/yuzu_room.cpp
@@ -76,7 +76,18 @@ static constexpr char BanListMagic[] = "YuzuRoom-BanList-1";
static constexpr char token_delimiter{':'};
static void PadToken(std::string& token) {
- while (token.size() % 4 != 0) {
+ std::size_t outlen = 0;
+
+ std::array<unsigned char, 512> output{};
+ std::array<unsigned char, 2048> roundtrip{};
+ for (size_t i = 0; i < 3; i++) {
+ mbedtls_base64_decode(output.data(), output.size(), &outlen,
+ reinterpret_cast<const unsigned char*>(token.c_str()),
+ token.length());
+ mbedtls_base64_encode(roundtrip.data(), roundtrip.size(), &outlen, output.data(), outlen);
+ if (memcmp(roundtrip.data(), token.data(), token.size()) == 0) {
+ break;
+ }
token.push_back('=');
}
}