aboutsummaryrefslogtreecommitdiff
path: root/zencore/crypto.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-02-07 15:46:51 +0100
committerPer Larsson <[email protected]>2022-02-07 15:46:51 +0100
commit4b3d9873def5e974fd47a5360a3eff4095aab88b (patch)
tree23196dba05475cbec6bb6141e08390fcd44d6961 /zencore/crypto.cpp
parentReplaced crypto transform abstraction with a concrete API. (diff)
downloadzen-4b3d9873def5e974fd47a5360a3eff4095aab88b.tar.xz
zen-4b3d9873def5e974fd47a5360a3eff4095aab88b.zip
Refactored auth manager to use simplified encryption API.
Diffstat (limited to 'zencore/crypto.cpp')
-rw-r--r--zencore/crypto.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/zencore/crypto.cpp b/zencore/crypto.cpp
index 0ad368f3f..448fd36fa 100644
--- a/zencore/crypto.cpp
+++ b/zencore/crypto.cpp
@@ -64,10 +64,7 @@ namespace crypto {
if (Err != 1)
{
- if (Reason)
- {
- Reason = fmt::format("failed to initialize cipher, error code '{}'", Err);
- }
+ Reason = fmt::format("failed to initialize cipher, error code '{}'", Err);
return MemoryView();
}
@@ -83,10 +80,7 @@ namespace crypto {
if (Err != 1)
{
- if (Reason)
- {
- Reason = fmt::format("update crypto transform failed, error code '{}'", Err);
- }
+ Reason = fmt::format("update crypto transform failed, error code '{}'", Err);
return MemoryView();
}
@@ -100,10 +94,7 @@ namespace crypto {
if (Err != 1)
{
- if (Reason)
- {
- Reason = fmt::format("finalize crypto transform failed, error code '{}'", Err);
- }
+ Reason = fmt::format("finalize crypto transform failed, error code '{}'", Err);
return MemoryView();
}
@@ -117,20 +108,14 @@ namespace crypto {
{
if (Key.IsValid() == false)
{
- if (Reason)
- {
- Reason = "Invalid key"sv;
- }
+ Reason = "invalid key"sv;
return false;
}
if (IV.IsValid() == false)
{
- if (Reason)
- {
- Reason = "Invalid initialization vector"sv;
- }
+ Reason = "invalid initialization vector"sv;
return false;
}