[*] Increase IPCHandle checksum bitlength

This commit is contained in:
Reece Wilson 2022-07-21 07:30:25 +01:00
parent e24c35d2d0
commit ec4b47c15d

View File

@ -105,45 +105,50 @@ namespace Aurora::IO::IPC
}
AuUInt32 magic {0x811c9dc5};
for (int i = 0; i < in.size() - 1; i++)
for (int i = 0; i < in.size() - 2; i++)
{
magic ^= (in[i] * 0x01000193);
}
if (AuUInt8(AuUInt8(in[in.size() - 1] - 'A') & 15) != AuUInt8(magic & 15))
if (AuUInt8(AuUInt8(in[in.size() - 2] - 'A') & 15) != AuUInt8(magic & 15))
{
return false;
}
#define READ_NEXT_TOKEN \
{ \
nextToken.clear(); \
\
if (((in.size() - stringOffset) < 2)) \
{ \
return false; \
} \
\
char cur; \
while (((stringOffset) < in.size()) && \
((cur = in[stringOffset]) != ':')) \
{ \
nextToken.push_back(cur); \
stringOffset++; \
} \
stringOffset++; \
if (AuUInt8(AuUInt8(in[in.size() - 1] - 'A') & 15) != AuUInt8((magic >> 4) & 15))
{
return false;
}
#define READ_NEXT_TOKEN \
{ \
nextToken.clear(); \
\
if (((in.size() - stringOffset) < 2)) \
{ \
return false; \
} \
\
char cur; \
while (((stringOffset) < in.size()) && \
((cur = in[stringOffset]) != ':')) \
{ \
nextToken.push_back(cur); \
stringOffset++; \
} \
stringOffset++; \
}
#define READ_NEXT_INT \
{ \
char cur; \
auto startOffset = stringOffset; \
while (((stringOffset) < in.size()) && \
((cur = in[stringOffset]) != ':')) \
auto startOffset = stringOffset; \
while (((stringOffset) < in.size()) && \
((cur = in[stringOffset]) != ':')) \
{ \
stringOffset++; \
} \
const char *endPtr = &in[stringOffset]; \
const char *endPtr = &in[stringOffset]; \
const char *startPtr = &in[startOffset]; \
stringOffset++; \
auto nextIntOpt = AuParse::ParseUInt(startPtr, endPtr); \
@ -285,13 +290,14 @@ namespace Aurora::IO::IPC
}
AuUInt32 magic {0x811c9dc5};
AuUInt32 magic {0x811c9dc5};
for (int i = 0; i < ret.size(); i++)
{
magic ^= (ret[i] * 0x01000193);
}
ret.push_back(((magic & 15) + 'A'));
ret.push_back((((magic >> 4) & 15) + 'A'));
return ret;
}