summaryrefslogtreecommitdiff
path: root/core/crypto
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-02-17 18:06:54 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-18 10:10:36 +0100
commit3205a92ad872f918c8322cdcd1434c231a1fd251 (patch)
treedb44242ca27432eb8ea849679752d0835d2ae41a /core/crypto
parentfb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff)
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
Diffstat (limited to 'core/crypto')
-rw-r--r--core/crypto/crypto.cpp4
-rw-r--r--core/crypto/crypto.h2
-rw-r--r--core/crypto/crypto_core.cpp4
-rw-r--r--core/crypto/hashing_context.cpp18
-rw-r--r--core/crypto/hashing_context.h4
5 files changed, 16 insertions, 16 deletions
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 3bee34f8e4..3711b26e47 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -82,8 +82,8 @@ void Crypto::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_self_signed_certificate", "key", "issuer_name", "not_before", "not_after"), &Crypto::generate_self_signed_certificate, DEFVAL("CN=myserver,O=myorganisation,C=IT"), DEFVAL("20140101000000"), DEFVAL("20340101000000"));
}
-PoolByteArray Crypto::generate_random_bytes(int p_bytes) {
- ERR_FAIL_V_MSG(PoolByteArray(), "generate_random_bytes is not available when mbedtls module is disabled.");
+PackedByteArray Crypto::generate_random_bytes(int p_bytes) {
+ ERR_FAIL_V_MSG(PackedByteArray(), "generate_random_bytes is not available when mbedtls module is disabled.");
}
Ref<CryptoKey> Crypto::generate_rsa(int p_bytes) {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index adc36255b6..babd0bc4eb 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -76,7 +76,7 @@ public:
static Crypto *create();
static void load_default_certificates(String p_path);
- virtual PoolByteArray generate_random_bytes(int p_bytes);
+ virtual PackedByteArray generate_random_bytes(int p_bytes);
virtual Ref<CryptoKey> generate_rsa(int p_bytes);
virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after);
diff --git a/core/crypto/crypto_core.cpp b/core/crypto/crypto_core.cpp
index dec52d8ca4..ec25ee0d38 100644
--- a/core/crypto/crypto_core.cpp
+++ b/core/crypto/crypto_core.cpp
@@ -148,9 +148,9 @@ Error CryptoCore::AESContext::decrypt_ecb(const uint8_t p_src[16], uint8_t r_dst
// CryptoCore
String CryptoCore::b64_encode_str(const uint8_t *p_src, int p_src_len) {
int b64len = p_src_len / 3 * 4 + 4 + 1;
- PoolVector<uint8_t> b64buff;
+ Vector<uint8_t> b64buff;
b64buff.resize(b64len);
- PoolVector<uint8_t>::Write w64 = b64buff.write();
+ uint8_t *w64 = b64buff.ptrw();
size_t strlen = 0;
int ret = b64_encode(&w64[0], b64len, &strlen, p_src, p_src_len);
w64[strlen] = 0;
diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp
index 7bee8f1200..a4d8a93c8a 100644
--- a/core/crypto/hashing_context.cpp
+++ b/core/crypto/hashing_context.cpp
@@ -47,11 +47,11 @@ Error HashingContext::start(HashType p_type) {
return ERR_UNAVAILABLE;
}
-Error HashingContext::update(PoolByteArray p_chunk) {
+Error HashingContext::update(PackedByteArray p_chunk) {
ERR_FAIL_COND_V(ctx == NULL, ERR_UNCONFIGURED);
size_t len = p_chunk.size();
ERR_FAIL_COND_V(len == 0, FAILED);
- PoolByteArray::Read r = p_chunk.read();
+ const uint8_t *r = p_chunk.ptr();
switch (type) {
case HASH_MD5:
return ((CryptoCore::MD5Context *)ctx)->update(&r[0], len);
@@ -63,26 +63,26 @@ Error HashingContext::update(PoolByteArray p_chunk) {
return ERR_UNAVAILABLE;
}
-PoolByteArray HashingContext::finish() {
- ERR_FAIL_COND_V(ctx == NULL, PoolByteArray());
- PoolByteArray out;
+PackedByteArray HashingContext::finish() {
+ ERR_FAIL_COND_V(ctx == NULL, PackedByteArray());
+ PackedByteArray out;
Error err = FAILED;
switch (type) {
case HASH_MD5:
out.resize(16);
- err = ((CryptoCore::MD5Context *)ctx)->finish(out.write().ptr());
+ err = ((CryptoCore::MD5Context *)ctx)->finish(out.ptrw());
break;
case HASH_SHA1:
out.resize(20);
- err = ((CryptoCore::SHA1Context *)ctx)->finish(out.write().ptr());
+ err = ((CryptoCore::SHA1Context *)ctx)->finish(out.ptrw());
break;
case HASH_SHA256:
out.resize(32);
- err = ((CryptoCore::SHA256Context *)ctx)->finish(out.write().ptr());
+ err = ((CryptoCore::SHA256Context *)ctx)->finish(out.ptrw());
break;
}
_delete_ctx();
- ERR_FAIL_COND_V(err != OK, PoolByteArray());
+ ERR_FAIL_COND_V(err != OK, PackedByteArray());
return out;
}
diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h
index af6ed3aa0b..230ba7ee85 100644
--- a/core/crypto/hashing_context.h
+++ b/core/crypto/hashing_context.h
@@ -54,8 +54,8 @@ protected:
public:
Error start(HashType p_type);
- Error update(PoolByteArray p_chunk);
- PoolByteArray finish();
+ Error update(PackedByteArray p_chunk);
+ PackedByteArray finish();
HashingContext();
~HashingContext();