3939class CryptoMbedTLS ;
4040class TLSContextMbedTLS ;
4141class CryptoKeyMbedTLS : public CryptoKey {
42+ GDSOFTCLASS (CryptoKeyMbedTLS, CryptoKey);
43+
4244private:
4345 mbedtls_pk_context pkey;
4446 int locks = 0 ;
@@ -51,17 +53,17 @@ class CryptoKeyMbedTLS : public CryptoKey {
5153 static void make_default () { CryptoKey::_create = create; }
5254 static void finalize () { CryptoKey::_create = nullptr ; }
5355
54- virtual Error load (const String &p_path, bool p_public_only);
55- virtual Error save (const String &p_path, bool p_public_only);
56- virtual String save_to_string (bool p_public_only);
57- virtual Error load_from_string (const String &p_string_key, bool p_public_only);
58- virtual bool is_public_only () const { return public_only; }
56+ Error load (const String &p_path, bool p_public_only) override ;
57+ Error save (const String &p_path, bool p_public_only) override ;
58+ String save_to_string (bool p_public_only) override ;
59+ Error load_from_string (const String &p_string_key, bool p_public_only) override ;
60+ bool is_public_only () const override { return public_only; }
5961
6062 CryptoKeyMbedTLS () {
6163 mbedtls_pk_init (&pkey);
6264 locks = 0 ;
6365 }
64- ~CryptoKeyMbedTLS () {
66+ ~CryptoKeyMbedTLS () override {
6567 mbedtls_pk_free (&pkey);
6668 }
6769
@@ -73,6 +75,8 @@ class CryptoKeyMbedTLS : public CryptoKey {
7375};
7476
7577class X509CertificateMbedTLS : public X509Certificate {
78+ GDSOFTCLASS (X509CertificateMbedTLS, X509Certificate);
79+
7680private:
7781 mbedtls_x509_crt cert;
7882 int locks;
@@ -82,17 +86,17 @@ class X509CertificateMbedTLS : public X509Certificate {
8286 static void make_default () { X509Certificate::_create = create; }
8387 static void finalize () { X509Certificate::_create = nullptr ; }
8488
85- virtual Error load (const String &p_path);
86- virtual Error load_from_memory (const uint8_t *p_buffer, int p_len);
87- virtual Error save (const String &p_path);
88- virtual String save_to_string ();
89- virtual Error load_from_string (const String &p_string_key);
89+ Error load (const String &p_path) override ;
90+ Error load_from_memory (const uint8_t *p_buffer, int p_len) override ;
91+ Error save (const String &p_path) override ;
92+ String save_to_string () override ;
93+ Error load_from_string (const String &p_string_key) override ;
9094
9195 X509CertificateMbedTLS () {
9296 mbedtls_x509_crt_init (&cert);
9397 locks = 0 ;
9498 }
95- ~X509CertificateMbedTLS () {
99+ ~X509CertificateMbedTLS () override {
96100 mbedtls_x509_crt_free (&cert);
97101 }
98102
@@ -116,12 +120,12 @@ class HMACContextMbedTLS : public HMACContext {
116120
117121 static bool is_md_type_allowed (mbedtls_md_type_t p_md_type);
118122
119- virtual Error start (HashingContext::HashType p_hash_type, const PackedByteArray &p_key);
120- virtual Error update (const PackedByteArray &p_data);
121- virtual PackedByteArray finish ();
123+ Error start (HashingContext::HashType p_hash_type, const PackedByteArray &p_key) override ;
124+ Error update (const PackedByteArray &p_data) override ;
125+ PackedByteArray finish () override ;
122126
123127 HMACContextMbedTLS () {}
124- ~HMACContextMbedTLS ();
128+ ~HMACContextMbedTLS () override ;
125129};
126130
127131class CryptoMbedTLS : public Crypto {
@@ -138,14 +142,14 @@ class CryptoMbedTLS : public Crypto {
138142 static void load_default_certificates (const String &p_path);
139143 static mbedtls_md_type_t md_type_from_hashtype (HashingContext::HashType p_hash_type, int &r_size);
140144
141- virtual PackedByteArray generate_random_bytes (int p_bytes);
142- virtual Ref<CryptoKey> generate_rsa (int p_bytes);
143- virtual Ref<X509Certificate> generate_self_signed_certificate (Ref<CryptoKey> p_key, const String &p_issuer_name, const String &p_not_before, const String &p_not_after);
144- virtual Vector<uint8_t > sign (HashingContext::HashType p_hash_type, const Vector<uint8_t > &p_hash, Ref<CryptoKey> p_key);
145- virtual bool verify (HashingContext::HashType p_hash_type, const Vector<uint8_t > &p_hash, const Vector<uint8_t > &p_signature, Ref<CryptoKey> p_key);
146- virtual Vector<uint8_t > encrypt (Ref<CryptoKey> p_key, const Vector<uint8_t > &p_plaintext);
147- virtual Vector<uint8_t > decrypt (Ref<CryptoKey> p_key, const Vector<uint8_t > &p_ciphertext);
145+ PackedByteArray generate_random_bytes (int p_bytes) override ;
146+ Ref<CryptoKey> generate_rsa (int p_bytes) override ;
147+ Ref<X509Certificate> generate_self_signed_certificate (Ref<CryptoKey> p_key, const String &p_issuer_name, const String &p_not_before, const String &p_not_after) override ;
148+ Vector<uint8_t > sign (HashingContext::HashType p_hash_type, const Vector<uint8_t > &p_hash, Ref<CryptoKey> p_key) override ;
149+ bool verify (HashingContext::HashType p_hash_type, const Vector<uint8_t > &p_hash, const Vector<uint8_t > &p_signature, Ref<CryptoKey> p_key) override ;
150+ Vector<uint8_t > encrypt (Ref<CryptoKey> p_key, const Vector<uint8_t > &p_plaintext) override ;
151+ Vector<uint8_t > decrypt (Ref<CryptoKey> p_key, const Vector<uint8_t > &p_ciphertext) override ;
148152
149153 CryptoMbedTLS ();
150- ~CryptoMbedTLS ();
154+ ~CryptoMbedTLS () override ;
151155};
0 commit comments