unify line endings to shut up VS

This commit is contained in:
Peter Tissen 2014-04-12 11:42:20 +02:00
parent c8d8428275
commit d65968b41d
6 changed files with 1963 additions and 1963 deletions

View file

@ -1,12 +1,12 @@
#include "stdafx.h"
#include "utils.h"
// Endian swap auxiliary functions.
#include "stdafx.h"
#include "utils.h"
// Endian swap auxiliary functions.
u16 swap16(u16 i)
{
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
}
{
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
}
u32 swap32(u32 i)
{
return ((i & 0xFF000000) >> 24) | ((i & 0xFF0000) >> 8) | ((i & 0xFF00) << 8) | ((i & 0xFF) << 24);
@ -28,32 +28,32 @@ void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int siz
dest[i] = src1[i] ^ src2[i];
}
}
// Hex string conversion auxiliary functions.
u64 hex_to_u64(const char* hex_str)
{
u32 length = strlen(hex_str);
u64 tmp = 0;
u64 result = 0;
char c;
while (length--)
{
c = *hex_str++;
if((c >= '0') && (c <= '9'))
tmp = c - '0';
else if((c >= 'a') && (c <= 'f'))
tmp = c - 'a' + 10;
else if((c >= 'A') && (c <= 'F'))
tmp = c - 'A' + 10;
else
tmp = 0;
result |= (tmp << (length * 4));
}
return result;
}
// Hex string conversion auxiliary functions.
u64 hex_to_u64(const char* hex_str)
{
u32 length = strlen(hex_str);
u64 tmp = 0;
u64 result = 0;
char c;
while (length--)
{
c = *hex_str++;
if((c >= '0') && (c <= '9'))
tmp = c - '0';
else if((c >= 'a') && (c <= 'f'))
tmp = c - 'a' + 10;
else if((c >= 'A') && (c <= 'F'))
tmp = c - 'A' + 10;
else
tmp = 0;
result |= (tmp << (length * 4));
}
return result;
}
void hex_to_bytes(unsigned char *data, const char *hex_str)
{
u32 str_length = strlen(hex_str);
@ -101,19 +101,19 @@ bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i
{
unsigned char *out = new unsigned char[key_len];
sha1_hmac(key, key_len, in, in_len, out);
for (int i = 0; i < 0x10; i++)
{
if (out[i] != hash[i])
sha1_hmac(key, key_len, in, in_len, out);
for (int i = 0; i < 0x10; i++)
{
if (out[i] != hash[i])
{
delete[] out;
return false;
}
}
delete[] out;
delete[] out;
return false;
}
}
delete[] out;
return true;
}
@ -123,19 +123,19 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i
aes_context ctx;
aes_setkey_enc(&ctx, key, 128);
aes_cmac(&ctx, in_len, in, out);
for (int i = 0; i < key_len; i++)
{
if (out[i] != hash[i])
aes_cmac(&ctx, in_len, in, out);
for (int i = 0; i < key_len; i++)
{
if (out[i] != hash[i])
{
delete[] out;
return false;
}
}
delete[] out;
delete[] out;
return false;
}
}
delete[] out;
return true;
}
@ -744,4 +744,4 @@ int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size)
delete[] tmp;
return result;
}
}