summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt/bcrypt.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add support for timeconting in userland.pirofti2020-07-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Pull in <time.h> for clock_gettime()guenther2016-08-261-1/+2
| | | | ok deraadt@
* increase the minimum for auto rounds to 6. that was the previous low boundtedu2016-06-261-2/+2
| | | | for login.conf, and we don't want to go lower.
* Wrap <pwd.h> so that calls go direct and the symbols are all weak.guenther2015-09-131-2/+5
| | | | Hide bcrypt_autorounds(), prefixing with an underbar for static builds.
* The number of rounds is just two digits in the salt. We've alreadymillert2015-09-131-2/+2
| | | | | verified that they are there via isdigit() so we can convert from ASCII to an int without using atoi(). OK guenther@ deraadt@
* standards compliant error return (null). will make ruby happier, at least.tedu2015-07-181-5/+2
| | | | ok deraadt jeremy
* dial the time back to about 0.1s, closer to the original targets andtedu2015-01-281-4/+4
| | | | friendlier for users. requested by deraadt
* rename blocks to words. bcrypt "blocks" are unrelated to blowfish blocks,tedu2015-01-121-9/+9
| | | | nor are they the same size.
* stupid me. need errno.htedu2015-01-071-1/+2
|
* set errno = EINVAL for invalid salts and hashes in most functions.tedu2015-01-071-12/+20
| | | | | | | remember to set EACCES in bcrypt_checkpass for hash differences. the higher level crypt_checkpass function will reset errno to EACCES in all cases, which is probably the right behavior, but this change gives code working with the lower level functions the correct errno if they care.
* convert clock() to clock_gettime() for improved precision (and accuracy?)tedu2015-01-051-7/+9
| | | | | guenther suggested using thread time, which actually may improve accuracy if somebody puts this in a threaded program.
* copy bcrypt autotune from encrypt(1) and expose via crypt_newhashtedu2014-12-301-1/+33
| | | | ok deraadt miod
* introduce a hashspace define and check that there's enough space totedu2014-11-241-15/+10
| | | | write out a hash. also simplify writing out the hash.
* From ISO/IEC 9899:1999 and 9899:201x,guenther2014-07-201-3/+3
| | | | | | | | | 6.11.5 - Storage-class specifiers: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Diff from Jean-Philippe Ouellet (jean-philippe (at) ouellet.biz)
* Add missing header needed by isdigit().chl2014-05-171-4/+5
| | | | | | While there, sort headers. ok tedu@
* fix stupid committedu2014-05-061-5/+5
|
* use explicit_bzerotedu2014-05-061-5/+5
|
* now that 5.5 has been released with compatibility for 2b hashes,tedu2014-05-031-2/+2
| | | | switch to generating them by default. prodded by deraadt and sthen
* 1. Drop support for no minor. This variant doesn't exist anymore.tedu2014-05-031-44/+30
| | | | | | | | | | 2. Pull up the actual minor processing code into the switch that parses it. 3. atoi is actually simpler than strtonum in this case, but check the input beforehand so we don't get unexpected results. 4. Slightly more consistent style between various parse and check and increment operations on salt. ok deraadt
* one small tweak to avoid ever going off the end of a string.tedu2014-04-191-4/+6
|
* improved checking for invalid hashes. from solar designertedu2014-04-191-6/+10
|
* use char * for strings, saving casts. add return codes to base64 functionstedu2014-04-081-15/+26
|
* oops, merge errortedu2014-03-241-2/+2
|
* clear stack variables, suggested by djmtedu2014-03-231-1/+4
|
* some improvements suggested by djm.tedu2014-03-231-4/+6
| | | | | | use better constant for salt size. always copy ":" to gerror, in case somebody is dumb enough to overwrite it timingsafe_bcmp before somebody whines about strcmp
* two functions don't need to be exportedtedu2014-03-231-3/+3
|
* minimal change to implementation of bcrypt to not require static globals.tedu2014-03-231-39/+88
| | | | | | add some friendlier functions. move the classic static data api into wrapper functions. a few more changes to come...
* switch to shorter ISC license. this was ok with Niels Provos.tedu2014-03-221-27/+12
|
* consolidate the base64 code in one place, and remove inadequate test codetedu2014-03-191-86/+56
|
* solar's testsuite revealed insufficient validation of invalid input hashes.tedu2014-02-241-8/+10
| | | | add a more complete check for the rounds parameter. ok deraadt
* remove redundant testtedu2014-02-171-3/+2
|
* sticking strlen into a char leads to wraparound at 256. fix this andtedu2014-02-171-5/+18
| | | | | | introduce a new 'b' hash minor. still generate 'a' minors for now. reported by solar designer. diff by some combination of solar and jca. ok deraadt
* pseudo-code corrections from Solar Designer <solar@openwall.com>deraadt2013-12-191-4/+4
|
* arc4random_buf is the easy way to fill a buffer now. ok deraadttedu2012-09-041-10/+3
|
* Zero state buffers on return. OK deraadt@millert2008-04-021-1/+5
|
* Get rid of useless #if 0 block, especially since the code is includedray2007-03-191-5/+1
| | | | | | immediately after. OK millert@.
* Change hard coded numbers to sizeof(buf). Also change someray2007-02-201-3/+3
| | | | | | | | sizeof(buf) - 1 to sizeof(buf), since fgets takes the whole buffer size. Based on diff from Charles Longeau <chl at tuxfamily dot org> long ago. OK millert@.
* allocate gsalt large enough; from Matthew R. Dempsky <mrd at alkemiootto2006-07-041-2/+2
| | | | dot org>; ok djm@ deraadt@
* be more careful with atoi() result; ok ottoderaadt2006-04-031-3/+5
|
* Test the upper limit for the max # of rounds to, to avoid wrapping and endingotto2004-12-221-2/+7
| | | | up with a low number of rounds. Spotted by mpech@; ok mpech@ millert@
* ansideraadt2003-08-071-8/+3
|
* protosderaadt2003-06-251-1/+3
|
* We live in an ANSI C world. Remove lots of gratuitous #ifdef __STDC__ cruft.millert2002-02-191-32/+1
|
* Part one of userland __P removal. Done with a simple regexp with some minor ↵millert2002-02-161-5/+5
| | | | hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
* grammer/spellingtodd2001-01-041-2/+2
|
* return error if salt is too small; pr 1336provos2000-08-021-1/+4
|
* fix base64 encoding, this problem was reported byprovos1998-08-101-6/+6
| | | | Solar Designer <solar@false.com> some time ago.
* #if __STDC__ -> #ifdef __STDC__, now all of them.provos1998-02-181-4/+4
|
* indentation cleanupderaadt1997-09-101-2/+2
|
* #if __STDC__ --> #ifdef __STDC__mickey1997-07-251-2/+2
|