summaryrefslogtreecommitdiffstats
path: root/core/crypto/crypto.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-15 15:44:43 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-15 15:44:43 +0100
commitef5d6ccfb7bf155a238ada79db12ea41ca993116 (patch)
treebc1acc6c5b0df70661293de0f8d0586ce0808982 /core/crypto/crypto.cpp
parent4859f8090f1e21d42bc81313f15367dcb1c4220c (diff)
parenta8bc9f3e78788bdf0be7348fcbfac15c127f1f48 (diff)
downloadredot-engine-ef5d6ccfb7bf155a238ada79db12ea41ca993116.tar.gz
Merge pull request #86966 from Muller-Castro/value2ref-core
Add const lvalue ref to `core/*` container parameters
Diffstat (limited to 'core/crypto/crypto.cpp')
-rw-r--r--core/crypto/crypto.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 6b1c2a9cb2..7fef819159 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -124,7 +124,7 @@ HMACContext *HMACContext::create() {
/// Crypto
-void (*Crypto::_load_default_certificates)(String p_path) = nullptr;
+void (*Crypto::_load_default_certificates)(const String &p_path) = nullptr;
Crypto *(*Crypto::_create)() = nullptr;
Crypto *Crypto::create() {
if (_create) {
@@ -133,13 +133,13 @@ Crypto *Crypto::create() {
ERR_FAIL_V_MSG(nullptr, "Crypto is not available when the mbedtls module is disabled.");
}
-void Crypto::load_default_certificates(String p_path) {
+void Crypto::load_default_certificates(const String &p_path) {
if (_load_default_certificates) {
_load_default_certificates(p_path);
}
}
-PackedByteArray Crypto::hmac_digest(HashingContext::HashType p_hash_type, PackedByteArray p_key, PackedByteArray p_msg) {
+PackedByteArray Crypto::hmac_digest(HashingContext::HashType p_hash_type, const PackedByteArray &p_key, const PackedByteArray &p_msg) {
Ref<HMACContext> ctx = Ref<HMACContext>(HMACContext::create());
ERR_FAIL_COND_V_MSG(ctx.is_null(), PackedByteArray(), "HMAC is not available without mbedtls module.");
Error err = ctx->start(p_hash_type, p_key);
@@ -151,7 +151,7 @@ PackedByteArray Crypto::hmac_digest(HashingContext::HashType p_hash_type, Packed
// Compares two HMACS for equality without leaking timing information in order to prevent timing attacks.
// @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy
-bool Crypto::constant_time_compare(PackedByteArray p_trusted, PackedByteArray p_received) {
+bool Crypto::constant_time_compare(const PackedByteArray &p_trusted, const PackedByteArray &p_received) {
const uint8_t *t = p_trusted.ptr();
const uint8_t *r = p_received.ptr();
int tlen = p_trusted.size();