aboutsummaryrefslogtreecommitdiff
path: root/zencore/crypto.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-02-03 10:10:32 +0100
committerPer Larsson <[email protected]>2022-02-03 10:10:32 +0100
commit02046f9bb44b16b7ce457f5b564cbf9d9cee4a91 (patch)
tree3b3a443d4a04308944f648406a87511fab8b5f8a /zencore/crypto.cpp
parentOverwrite existing refresh token. (diff)
downloadzen-02046f9bb44b16b7ce457f5b564cbf9d9cee4a91.tar.xz
zen-02046f9bb44b16b7ce457f5b564cbf9d9cee4a91.zip
Encrypt serialized auth state.
Diffstat (limited to 'zencore/crypto.cpp')
-rw-r--r--zencore/crypto.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/zencore/crypto.cpp b/zencore/crypto.cpp
index 880d7b495..7fc524bf1 100644
--- a/zencore/crypto.cpp
+++ b/zencore/crypto.cpp
@@ -147,7 +147,8 @@ public:
int TotalSize = 0;
int DecryptedSize = 0;
- int ErrorCode = EVP_DecryptUpdate(m_DecryptionCtx,
+
+ int ErrorCode = EVP_DecryptUpdate(m_DecryptionCtx,
reinterpret_cast<unsigned char*>(DecryptionBuffer.GetData()),
&DecryptedSize,
reinterpret_cast<const unsigned char*>(Data.GetData()),
@@ -163,6 +164,11 @@ public:
ErrorCode = EVP_DecryptFinal_ex(m_DecryptionCtx, reinterpret_cast<unsigned char*>(Remaining.GetData()), &DecryptedSize);
+ if (ErrorCode != 1)
+ {
+ return MemoryView();
+ }
+
TotalSize += DecryptedSize;
return DecryptionBuffer.Left(uint64_t(TotalSize));