]> git.lizzy.rs Git - minetest.git/blobdiff - src/util/srp.cpp
Fix Mapgen Valleys getSpawnLevelAtPoint() (#7756)
[minetest.git] / src / util / srp.cpp
index aa8dcb4a7e604b4ed38921d263005d409081d06b..d825f0ebc24e65494045f3ac99568dea27e96023 100644 (file)
@@ -27,6 +27,9 @@
  */
 
 // clang-format off
+
+#include <cstddef>
+
 #ifdef WIN32
        #include <windows.h>
        #include <wincrypt.h>
@@ -39,6 +42,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <cstdio>
+#include <cstdint>
 
 #include <config.h>
 
@@ -418,7 +422,7 @@ static SRP_Result H_nn(
 }
 
 static SRP_Result H_ns(mpz_t result, SRP_HashAlgorithm alg, const unsigned char *n,
-       size_t len_n, const unsigned char *bytes, size_t len_bytes)
+       size_t len_n, const unsigned char *bytes, uint32_t len_bytes)
 {
        unsigned char buff[SHA512_DIGEST_LENGTH];
        size_t nbytes = len_n + len_bytes;
@@ -612,7 +616,7 @@ SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
                        if (fill_buff() != SRP_OK) goto error_and_exit;
                *bytes_s = (unsigned char *)srp_alloc(size_to_fill);
                if (!*bytes_s) goto error_and_exit;
-               memcpy(*bytes_s, &g_rand_buff + g_rand_idx, size_to_fill);
+               memcpy(*bytes_s, &g_rand_buff[g_rand_idx], size_to_fill);
                g_rand_idx += size_to_fill;
        }
 
@@ -697,7 +701,7 @@ struct SRPVerifier *srp_verifier_new(SRP_HashAlgorithm alg,
                goto cleanup_and_exit;
        }
 
-       memcpy((char *)ver->username, username, ulen);
+       memcpy(ver->username, username, ulen);
 
        ver->authenticated = 0;