summaryrefslogtreecommitdiffstats
path: root/common/passwd.c
Commit message (Collapse)AuthorAgeFilesLines
* Updated copyright datesDavid Sommerseth2012-10-081-1/+1
| | | | Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Look for endian.h in include/sys as well.David Sommerseth2010-12-311-1/+5
| | | | | | On FreeBSD the endian.h file is located in sys/endian.h. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Make use of more cross-platform friendly libc functionsDavid Sommerseth2010-12-311-3/+5
| | | | | | | | The initial implementation of the SHA512 hashing functions was tightly connected to glibc. This patch changes those few functions which is glibc to more portable functions. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Discovered a failing loop checkDavid Sommerseth2010-09-271-1/+1
| | | | | | This could cause eurephia to use a faulty hashing rounds value. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Harden memory management in passwd.cDavid Sommerseth2010-09-271-0/+18
| | | | | | | Do a mlock() call on all buffers used by the password hashing algorithms, to make sure these data segments never will be written to swap. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Updated Copyright dates to include 2010David Sommerseth2010-07-301-1/+1
|
* Removed not needed memset()'sDavid Sommerseth2009-10-021-2/+0
|
* Fixed some memory issues and a memory leak in passwd.cDavid Sommerseth2009-10-021-2/+5
|
* BUGFIX: saltlen was set to 0 when a buffer for a new salt was generatedDavid Sommerseth2009-09-151-12/+12
| | | | | | This error caused eurephia_pwd_crypt() to fail, especially when salt length was requested to be longer. The solution was to retrieve the salt length before allocating memory for it.
* Added debug logging of free_nullsafe() calls as wellDavid Sommerseth2009-09-071-2/+2
|
* Moved all malloc() operations over to a calloc wrapper, malloc_nullsafe()David Sommerseth2009-09-071-8/+4
| | | | This also improves debugging as well, if debug logging is enabled and log level is >= 40.
* More comments in common/David Sommerseth2009-09-041-22/+30
|
* Added more comments to the common filesDavid Sommerseth2009-09-021-6/+88
|
* Rewritten common/passwd.c and utils/benchmark.cDavid Sommerseth2009-04-101-42/+1
| | | | Make them work without the need of defining BENCHMARK during compilation
* Fixed a "hang" when wrong password was usedDavid Sommerseth2009-03-281-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the current implementation of SHA512 salts, it could be experienced as if the application hung on wrong passwords. This is because the rounds count for the passwords are scrambled, with values based on the given password. When a wrong password is given, this will also result in getting a wrong salt length and hash rounds for the following hash calculation. Due to this, the extracted rounds value from the salt string could return some really high number of rounds on wrong passwords (possibly the max value if integer). And this is why the "hang" is experienced. To avoid this, a check is added to make sure the rounds is not unreasonably much higher than the configured max rounds values. If the descrambled rounds number from the salt exceeds max rounds * 1.5, the password (most probaly) is wrong. In this case we do a sleep() to slow down bruteforce attacks and return NULL. The drawback is if the maxrounds later on is changed to a value which hits this scenario: passwordsalt_rounds > maxrounds_cfg * 1.5 In this case these old passwords will be invalidated by that configuration change. This is considered to be a feature and not a bug. The reason for mulitiplying by 1.5, is to allow a little room for a degrading the max rounds setting. By adjusting the max rounds up again, these passwords will be valid again. Added also a sleep() when wrong username is attempted.
* Made the licence explicit GPLv2 onlyDavid Sommerseth2009-03-261-1/+1
|
* Cleaned up the code a little bitDavid Sommerseth2009-03-261-2/+2
| | | | | Made sure we only include needed include files and checked that the copyright headers are equal and correct
* Added benchmarking to suggest minimum and maximum rounds for hashesDavid Sommerseth2009-03-221-0/+41
|
* Renamed passwdhash(...) function to eurephia_quick_hash(...)David Sommerseth2009-03-211-33/+30
| | | | | | | | | | This to make it clearer that passwdhash(...) is not good for password hashing, but suitable when you need a quick hashing algorithm. The eurephia_quick_hash(...) are now used for password caching hashing, and is still suitable here since the salt used for the passwords are in memory only and never written to disk, as they are supposed to be temporary hashes.
* Added new password hashing function with proper SHA512 hashingDavid Sommerseth2009-03-211-0/+400
| | | | | | | | | | | | | | | | | | | | | This new function, eurephia_pwd_crypt(...) implements a modified SHA512 hashing algorithm based on the SHA512 crypt implementation proposed by Ulrich Drepper for glibc. The original implementation adds support for variable hashing rounds. The eurephia version implements dynamic hashing rounds, controlled by minimum and maximum rounds set in the configuration. If not set, it will minimum use 5000 rounds and maximum 7500 rounds. The amount of rounds is supposed to be random. In addition to this, the salt information is now encoded into a hex value. In this value the salt length and the hash rounds are defined. This hex value is then encoded (quasi crypt) based on a modulus of the sum of the characters in the password + the password length. So if you give the wrong password, you will also get the wrong salt length and the wrong number of hashing rounds used. The default salt length is also increased to 32 bytes (256 bit)
* Prepared passwdhash function to allow salting and be prepared for other ↵David Sommerseth2009-01-021-25/+34
| | | | hashing algorithms
* Reorganised the source codeDavid Sommerseth2008-10-151-0/+67
Moved all OpenVPN plug-in related things into ./plugins, including firewall Moved all shared code into ./common and moved the generic part of the database files into ./database Updated all CMakeLists.txt files and created a new one for the root directory