summaryrefslogtreecommitdiffstats
path: root/core/crypto
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2023-09-09 16:11:33 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2023-09-11 19:45:49 +0200
commit893f889d74b35bb7330c3ff3d0187042770a4490 (patch)
treeb1435faf6380670ffc4a878d0cdcb29a0527f5a7 /core/crypto
parent221884e6bc260c38f16422081b7d4efd49a71375 (diff)
downloadredot-engine-893f889d74b35bb7330c3ff3d0187042770a4490.tar.gz
[Core] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
Diffstat (limited to 'core/crypto')
-rw-r--r--core/crypto/crypto_core.cpp2
-rw-r--r--core/crypto/hashing_context.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/core/crypto/crypto_core.cpp b/core/crypto/crypto_core.cpp
index 3ca2ec282f..17b34c08e2 100644
--- a/core/crypto/crypto_core.cpp
+++ b/core/crypto/crypto_core.cpp
@@ -73,7 +73,7 @@ Error CryptoCore::RandomGenerator::init() {
}
Error CryptoCore::RandomGenerator::get_random_bytes(uint8_t *r_buffer, size_t p_bytes) {
- ERR_FAIL_COND_V(!ctx, ERR_UNCONFIGURED);
+ ERR_FAIL_NULL_V(ctx, ERR_UNCONFIGURED);
int ret = mbedtls_ctr_drbg_random((mbedtls_ctr_drbg_context *)ctx, r_buffer, p_bytes);
ERR_FAIL_COND_V_MSG(ret, FAILED, " failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
return OK;
diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp
index 35f491cd0c..157a0c091b 100644
--- a/core/crypto/hashing_context.cpp
+++ b/core/crypto/hashing_context.cpp
@@ -35,7 +35,7 @@
Error HashingContext::start(HashType p_type) {
ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
_create_ctx(p_type);
- ERR_FAIL_COND_V(ctx == nullptr, ERR_UNAVAILABLE);
+ ERR_FAIL_NULL_V(ctx, ERR_UNAVAILABLE);
switch (type) {
case HASH_MD5:
return ((CryptoCore::MD5Context *)ctx)->start();
@@ -48,7 +48,7 @@ Error HashingContext::start(HashType p_type) {
}
Error HashingContext::update(PackedByteArray p_chunk) {
- ERR_FAIL_COND_V(ctx == nullptr, ERR_UNCONFIGURED);
+ ERR_FAIL_NULL_V(ctx, ERR_UNCONFIGURED);
size_t len = p_chunk.size();
ERR_FAIL_COND_V(len == 0, FAILED);
const uint8_t *r = p_chunk.ptr();
@@ -64,7 +64,7 @@ Error HashingContext::update(PackedByteArray p_chunk) {
}
PackedByteArray HashingContext::finish() {
- ERR_FAIL_COND_V(ctx == nullptr, PackedByteArray());
+ ERR_FAIL_NULL_V(ctx, PackedByteArray());
PackedByteArray out;
Error err = FAILED;
switch (type) {