Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
cfe2653d
Commit
cfe2653d
authored
3 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Update password hash method"
This reverts commit
b4acef6e
.
parent
b4acef6e
No related branches found
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llsechandler_basic.cpp
+6
-111
6 additions, 111 deletions
indra/newview/llsechandler_basic.cpp
with
6 additions
and
111 deletions
indra/newview/llsechandler_basic.cpp
+
6
−
111
View file @
cfe2653d
...
@@ -52,15 +52,7 @@
...
@@ -52,15 +52,7 @@
#include
<iomanip>
#include
<iomanip>
#include
<time.h>
#include
<time.h>
#include
"llmachineid.h"
#include
"llmachineid.h"
#include
"llmd5.h"
#include
"lldiriterator.h"
#if LL_WINDOWS
#include
"llwin32headerslean.h"
#elif LL_DARWIN
#include
<CoreFoundation/CoreFoundation.h>
#include
<IOKit/IOKitLib.h>
#endif
static
const
std
::
string
DEFAULT_CREDENTIAL_STORAGE
=
"credential"
;
static
const
std
::
string
DEFAULT_CREDENTIAL_STORAGE
=
"credential"
;
...
@@ -1356,103 +1348,6 @@ LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
...
@@ -1356,103 +1348,6 @@ LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
_writeProtectedData
();
_writeProtectedData
();
}
}
// Get system platform key
std
::
string
genPasswordKey
()
{
char
serial_md5
[
MD5HEX_STR_SIZE
];
// Flawfinder: ignore
serial_md5
[
0
]
=
0
;
#if LL_WINDOWS
DWORD
serial
=
0
;
DWORD
flags
=
0
;
BOOL
success
=
GetVolumeInformation
(
L"C:
\\
"
,
NULL
,
// volume name buffer
0
,
// volume name buffer size
&
serial
,
// volume serial
NULL
,
// max component length
&
flags
,
// file system flags
NULL
,
// file system name buffer
0
);
// file system name buffer size
if
(
success
)
{
LLMD5
md5
;
md5
.
update
(
(
unsigned
char
*
)
&
serial
,
sizeof
(
DWORD
));
md5
.
finalize
();
md5
.
hex_digest
(
serial_md5
);
}
else
{
LL_WARNS
()
<<
"GetVolumeInformation failed"
<<
LL_ENDL
;
}
#elif LL_DARWIN
// JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
CFStringRef
serialNumber
=
NULL
;
io_service_t
platformExpert
=
IOServiceGetMatchingService
(
kIOMasterPortDefault
,
IOServiceMatching
(
"IOPlatformExpertDevice"
));
if
(
platformExpert
)
{
serialNumber
=
(
CFStringRef
)
IORegistryEntryCreateCFProperty
(
platformExpert
,
CFSTR
(
kIOPlatformSerialNumberKey
),
kCFAllocatorDefault
,
0
);
IOObjectRelease
(
platformExpert
);
}
if
(
serialNumber
)
{
char
buffer
[
MAX_STRING
];
// Flawfinder: ignore
if
(
CFStringGetCString
(
serialNumber
,
buffer
,
MAX_STRING
,
kCFStringEncodingASCII
))
{
LLMD5
md5
(
(
unsigned
char
*
)
buffer
);
md5
.
hex_digest
(
serial_md5
);
}
CFRelease
(
serialNumber
);
}
#elif LL_LINUX
std
::
string
best
;
std
::
string
uuiddir
(
"/dev/disk/by-uuid/"
);
// trawl /dev/disk/by-uuid looking for a good-looking UUID to grab
std
::
string
this_name
;
LLDirIterator
iter
(
uuiddir
,
"*"
);
while
(
iter
.
next
(
this_name
))
{
if
(
this_name
.
length
()
>
best
.
length
()
||
(
this_name
.
length
()
==
best
.
length
()
&&
this_name
>
best
))
{
// longest (and secondarily alphabetically last) so far
best
=
this_name
;
}
}
{
// we don't return the actual serial number, just a hash of it.
LLMD5
md5
(
reinterpret_cast
<
const
unsigned
char
*>
(
best
.
c_str
())
);
md5
.
hex_digest
(
serial_md5
);
}
#else
#error "Unsupported platform"
#endif
std
::
string
out
=
serial_md5
;
if
(
out
.
empty
())
{
// Fall back to mac address in case of catastrophic failure
unsigned
char
unique_id
[
MAC_ADDRESS_BYTES
];
LLMachineID
::
getUniqueID
(
unique_id
,
sizeof
(
unique_id
));
LLMD5
md5
;
md5
.
update
(
unique_id
,
sizeof
(
unique_id
));
md5
.
finalize
();
md5
.
hex_digest
(
serial_md5
);
out
=
serial_md5
;
}
LL_INFOS
()
<<
"PLATFORM KEY: "
<<
out
<<
LL_ENDL
;
return
serial_md5
;
}
// compat_rc4 reads old rc4 encrypted files
// compat_rc4 reads old rc4 encrypted files
void
compat_rc4
(
llifstream
&
protected_data_stream
,
std
::
string
&
decrypted_data
)
void
compat_rc4
(
llifstream
&
protected_data_stream
,
std
::
string
&
decrypted_data
)
{
{
...
@@ -1504,9 +1399,9 @@ void LLSecAPIBasicHandler::_readProtectedData()
...
@@ -1504,9 +1399,9 @@ void LLSecAPIBasicHandler::_readProtectedData()
U8
buffer
[
BUFFER_READ_SIZE
];
U8
buffer
[
BUFFER_READ_SIZE
];
U8
decrypted_buffer
[
BUFFER_READ_SIZE
];
U8
decrypted_buffer
[
BUFFER_READ_SIZE
];
int
decrypted_length
;
int
decrypted_length
;
unsigned
char
unique_id
[
MAC_ADDRESS_BYTES
];
std
::
string
serial
=
genPasswordKey
(
);
LLMachineID
::
getUniqueID
(
unique_id
,
sizeof
(
unique_id
)
);
LLXORCipher
cipher
(
(
U8
*
)
serial
.
data
(),
serial
.
size
(
));
LLXORCipher
cipher
(
unique_id
,
sizeof
(
unique_id
));
// read in the salt and key
// read in the salt and key
protected_data_stream
.
read
((
char
*
)
salt
,
STORE_SALT_SIZE
);
protected_data_stream
.
read
((
char
*
)
salt
,
STORE_SALT_SIZE
);
...
@@ -1599,9 +1494,9 @@ void LLSecAPIBasicHandler::_writeProtectedData()
...
@@ -1599,9 +1494,9 @@ void LLSecAPIBasicHandler::_writeProtectedData()
EVP_CIPHER_CTX
*
ctx
=
EVP_CIPHER_CTX_new
();
EVP_CIPHER_CTX
*
ctx
=
EVP_CIPHER_CTX_new
();
EVP_EncryptInit_ex
(
ctx
,
EVP_chacha20
(),
NULL
,
salt
,
NULL
);
// 1 is encrypt
EVP_EncryptInit_ex
(
ctx
,
EVP_chacha20
(),
NULL
,
salt
,
NULL
);
// 1 is encrypt
unsigned
char
unique_id
[
MAC_ADDRESS_BYTES
];
std
::
string
serial
=
genPasswordKey
(
);
LLMachineID
::
getUniqueID
(
unique_id
,
sizeof
(
unique_id
)
);
LLXORCipher
cipher
(
(
U8
*
)
serial
.
data
(),
serial
.
size
(
));
LLXORCipher
cipher
(
unique_id
,
sizeof
(
unique_id
));
cipher
.
encrypt
(
salt
,
STORE_SALT_SIZE
);
cipher
.
encrypt
(
salt
,
STORE_SALT_SIZE
);
protected_data_stream
.
write
((
const
char
*
)
salt
,
STORE_SALT_SIZE
);
protected_data_stream
.
write
((
const
char
*
)
salt
,
STORE_SALT_SIZE
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment