1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Delete clang-format files and comments (#14079)

This commit is contained in:
Gary Miguel 2023-12-15 01:23:44 -08:00 committed by GitHub
parent 64b59184d1
commit da832a295e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 0 additions and 702 deletions

View file

@ -32,7 +32,6 @@
// float, return the float.
f32 u32Tof32Slow(u32 i)
{
// clang-format off
int exp = (i >> 23) & 0xFF;
u32 sign = i & 0x80000000UL;
u32 imant = i & 0x7FFFFFUL;
@ -56,7 +55,6 @@ f32 u32Tof32Slow(u32 i)
return sign ? -ldexpf((f32)(imant | 0x800000UL), exp - 150) :
ldexpf((f32)(imant | 0x800000UL), exp - 150);
// clang-format on
}
// Given a float, return an unsigned 32-bit integer representing the f32
@ -94,7 +92,6 @@ u32 f32Tou32Slow(f32 f)
// - The endianness of f32s and integers must match.
FloatType getFloatSerializationType()
{
// clang-format off
const f32 cf = -22220490.f;
const u32 cu = 0xCBA98765UL;
if (std::numeric_limits<f32>::is_iec559 && sizeof(cf) == 4 &&
@ -132,5 +129,4 @@ FloatType getFloatSerializationType()
}
return FLOATTYPE_SLOW;
// clang-format on
}

View file

@ -26,7 +26,6 @@
*
*/
// clang-format off
#include <cstddef>
@ -37,7 +36,6 @@
#include <ctime>
#endif
// clang-format on
#include <cstdlib>
#include <cstring>
@ -80,7 +78,6 @@ void *(*srp_alloc)(size_t) = &malloc;
void *(*srp_realloc)(void *, size_t) = &realloc;
void (*srp_free)(void *) = &free;
// clang-format off
void srp_set_memory_functions(
void *(*new_srp_alloc)(size_t),
void *(*new_srp_realloc)(void *, size_t),
@ -90,7 +87,6 @@ void srp_set_memory_functions(
srp_realloc = new_srp_realloc;
srp_free = new_srp_free;
}
// clang-format on
typedef struct {
mpz_t N;
@ -261,7 +257,6 @@ struct SRPUser {
unsigned char session_key[SHA512_DIGEST_LENGTH];
};
// clang-format off
static int hash_init(SRP_HashAlgorithm alg, HashCTX *c)
{
switch (alg) {
@ -357,7 +352,6 @@ static size_t hash_length(SRP_HashAlgorithm alg)
default: return 0;
};
}
// clang-format on
inline static int mpz_num_bytes(const mpz_t op)
{
@ -588,7 +582,6 @@ static SRP_Result init_random()
*
***********************************************************************************************************/
// clang-format off
SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
SRP_NGType ng_type, const char *username_for_verifier,
const unsigned char *password, size_t len_password,
@ -600,7 +593,6 @@ SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
mpz_t v; mpz_init(v);
mpz_t x; mpz_init(x);
// clang-format on
NGConstant *ng = new_ng(ng_type, n_hex, g_hex);
@ -646,7 +638,6 @@ error_and_exit:
goto cleanup_and_exit;
}
// clang-format off
/* Out: bytes_B, len_B.
*
@ -671,7 +662,6 @@ struct SRPVerifier *srp_verifier_new(SRP_HashAlgorithm alg,
mpz_t tmp1; mpz_init(tmp1);
mpz_t tmp2; mpz_init(tmp2);
mpz_t tmp3; mpz_init(tmp3);
// clang-format on
size_t ulen = strlen(username) + 1;
NGConstant *ng = new_ng(ng_type, n_hex, g_hex);
struct SRPVerifier *ver = 0;
@ -922,13 +912,11 @@ size_t srp_user_get_session_key_length(struct SRPUser *usr)
return hash_length(usr->hash_alg);
}
// clang-format off
/* Output: username, bytes_A, len_A */
SRP_Result srp_user_start_authentication(struct SRPUser *usr, char **username,
const unsigned char *bytes_a, size_t len_a,
unsigned char **bytes_A, size_t *len_A)
{
// clang-format on
if (bytes_a) {
mpz_from_bin(bytes_a, len_a, usr->a);
} else {
@ -956,7 +944,6 @@ error_and_exit:
return SRP_ERR;
}
// clang-format off
/* Output: bytes_M. Buffer length is SHA512_DIGEST_LENGTH */
void srp_user_process_challenge(struct SRPUser *usr,
const unsigned char *bytes_s, size_t len_s,
@ -972,7 +959,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
mpz_t tmp2; mpz_init(tmp2);
mpz_t tmp3; mpz_init(tmp3);
mpz_t tmp4; mpz_init(tmp4);
// clang-format on
*len_M = 0;
*bytes_M = 0;
@ -996,7 +982,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
srp_dbg_num(v, "Client calculated v: ");
// clang-format off
/* S = (B - k*(g^x)) ^ (a + ux) */
mpz_mul(tmp1, u, x);
mpz_add(tmp2, usr->a, tmp1); /* tmp2 = (a + ux) */
@ -1004,7 +989,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
mpz_mulm(tmp3, k, tmp1, usr->ng->N, tmp4); /* tmp3 = k*(g^x) */
mpz_subm(tmp1, B, tmp3, usr->ng->N, tmp4); /* tmp1 = (B - K*(g^x)) */
mpz_powm(usr->S, tmp1, tmp2, usr->ng->N);
// clang-format on
if (!hash_num(usr->hash_alg, usr->S, usr->session_key)) goto cleanup_and_exit;

View file

@ -79,8 +79,6 @@ typedef enum {
SRP_OK,
} SRP_Result;
// clang-format off
/* Sets the memory functions used by srp.
* Note: this doesn't set the memory functions used by gmp,
* but it is supported to have different functions for srp and gmp.
@ -130,8 +128,6 @@ struct SRPVerifier* srp_verifier_new(SRP_HashAlgorithm alg, SRP_NGType ng_type,
unsigned char** bytes_B, size_t *len_B,
const char* n_hex, const char* g_hex);
// clang-format on
void srp_verifier_delete(struct SRPVerifier *ver);
// srp_verifier_verify_session must have been called before
@ -170,8 +166,6 @@ const unsigned char *srp_user_get_session_key(struct SRPUser *usr, size_t *key_l
size_t srp_user_get_session_key_length(struct SRPUser *usr);
// clang-format off
/* Output: username, bytes_A, len_A.
* If you don't want it get written, set username to NULL.
* If bytes_a == NULL, random data is used for a. */
@ -185,7 +179,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
const unsigned char *bytes_s, size_t len_s,
const unsigned char *bytes_B, size_t len_B,
unsigned char **bytes_M, size_t *len_M);
// clang-format on
/* bytes_HAMK must be exactly srp_user_get_session_key_length() bytes in size */
void srp_user_verify_session(struct SRPUser *usr, const unsigned char *bytes_HAMK);