aboutsummaryrefslogtreecommitdiff
path: root/secure/lib/libcrypt
Commit message (Collapse)AuthorAgeFilesLines
* secure: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-163-6/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* crypt_r(3): fix reentrancy problems with DESEdward Tomasz Napierala2021-06-151-29/+29
| | | | | | | | | | | | | | | | | | | This code was originally written for non-reentrant crypt(3). In 5f521d7ba72, a thread-safe crypt_r(3) was introduced. However, it looks like the DES implementation is still not re-entrant; routines like setup_salt() or des_setkey() still use global variables. Instead of something drastic, eg removing DES support altogether, just mark those variables as thread-local. This adds about 30kB of data per thread. Given that this only applies to DES, I think the impact is minimal. Reviewed By: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30674
* Make libcrypt thread-safe. Add crypt_r(3).Ed Schouten2016-08-102-59/+42
| | | | | | | | | | | | | | | | | | | | | | glibc has a pretty nice function called crypt_r(3), which is nothing more than crypt(3), but thread-safe. It accomplishes this by introducing a 'struct crypt_data' structure that contains a buffer that is large enough to hold the resulting string. Let's go ahead and also add this function. It would be a shame if a useful function like this wouldn't be usable in multithreaded apps. Refactor crypt.c and all of the backends to no longer declare static arrays, but write their output in a provided buffer. There is no need to do any buffer length computation here, as we'll just need to ensure that 'struct crypt_data' is large enough, which it is. _PASSWORD_LEN is defined to 128 bytes, but in this case I'm picking 256, as this is going to be part of the actual ABI. Differential Revision: https://reviews.freebsd.org/D7306 Notes: svn path=/head/; revision=303920
* Add compatibility with $2y$ bcrypt hashesAllan Jude2015-06-161-0/+3
| | | | | | | | | | | | | | | | | | crypt_blowfish and many implementations based on it (Apache, PHP, PostgreSQL) implemented $2y$ before OpenBSD went with $2b$. This changes marks them as equivalent. http://www.openwall.com/lists/announce/2011/07/17/1 This change is required for applications that use the base crypt() implementation (including nginx) to be able to validate $2y$ hashes Reviewed by: eadler Approved by: delphij MFC after: 1 week Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D2742 Notes: svn path=/head/; revision=284483
* Switch using the new $2b$ format by default, when bcrypt is used.Xin LI2014-05-141-1/+1
| | | | | | | | MFC after: 2 weeks Relnotes: default Blowfish crypt(3) format have been changed to $2b$. Notes: svn path=/head/; revision=265995
* Refresh our implementation of OpenBSD's Blowfish password format.Xin LI2014-02-251-33/+52
| | | | | | | | | | | | | | | | | | | | | Notable changes: - Support of $2b$ password format to address a problem where very long passwords (more than 256 characters, when an integer overflow would happen and cause the length to wrap at 256). - Updated pseudo code in comments to reflect the reality. - Removed our local shortcut of processing magic string and rely on the centralized and tigntened validation. - Diff reduction from upstream. For now we are still generating the older $02a$ format of password but we will migrate to the new format once the format is formally finalized. MFC after: 1 month Notes: svn path=/head/; revision=262501
* Update the previous openssl fix. [12:01]Bjoern A. Zeeb2012-05-301-1/+1
| | | | | | | | | | | Fix a bug in crypt(3) ignoring characters of a passphrase. [12:02] Security: FreeBSD-SA-12:01.openssl (revised) Security: FreeBSD-SA-12:02.crypt Approved by: so (bz, simon) Notes: svn path=/head/; revision=236304
* Return NULL on error rather than ":", per the crypt(3) man page.Kevin Lo2012-02-221-6/+5
| | | | | | | Discussed in: http://www.openwall.com/lists/oss-security/2011/11/15/3 Notes: svn path=/head/; revision=231986
* Strip the private blowfish code down to only that which isMark Murray2003-06-023-263/+4
| | | | | | | | required to make crypt(3) blowfish "$2a$..." hashes. Lint and warnsify. Notes: svn path=/head/; revision=115719
* No functional change, but big code cleanup. WARNS, lint(1) and style(9).Mark Murray2002-03-064-216/+92
| | | | Notes: svn path=/head/; revision=91754
* o Move NTOHL() and associated macros into <sys/param.h>. These areMike Barcroft2002-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm Notes: svn path=/head/; revision=90868
* __FBSDID() (second half of src/lib/libcrypt changes)Peter Wemm2001-10-233-6/+10
| | | | Notes: svn path=/head/; revision=85358
* Add OpenBSD-style blowfish password hashing. This makes one lessMark Murray2001-03-113-0/+1249
| | | | | | | | | | | | | gratuitous difference between us and our sister project. This was given to me _ages_ ago. May apologies to Paul for the length of time its taken me to commit. Obtained from: Niels Provos <provos@physnet.uni-hamburg.de>/OpenBSD Submitted by: Paul Herman <pherman@frenchfries.net> Notes: svn path=/head/; revision=74106
* Merge into a single US-exportable libcrypt, which only providesPeter Wemm2000-12-281-73/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one-way hash functions for authentication purposes. There is no more "set the libcrypt->libXXXcrypt" nightmare. - Undo the libmd.so hack, use -D to hide the md5c.c internals. - Remove the symlink hacks in release/Makefile - the algorthm is set by set_crypt_format() as before. If this is not called, it tries to heuristically figure out the hash format, and if all else fails, it uses the optional auth.conf entry to chose the overall default hash. - Since source has non-hidden crypto in it there may be some issues with having the source it in some countries, so preserve the "secure/*" division. You can still build a des-free libcrypt library if you want to badly enough. This should not be a problem in the US or exporting from the US as freebsd.org had notified BXA some time ago. That makes this stuff re-exportable by anyone. - For consistancy, the default in absence of any other clues is md5. This is to try and minimize POLA across buildworld where folk may suddenly be activating des-crypt()-hash support. Since the des hash may not always be present, it seemed sensible to make the stronger md5 algorithm the default. All things being equal, no functionality is lost. Reviewed-by: jkh (flame-proof suit on) Notes: svn path=/head/; revision=70419
* Add working and easy crypt(3)-switching. Yes, we need a whole new APIBrian Feldman2000-08-221-0/+1
| | | | | | | | | | | | | | | | | for crypt(3) by now. In any case: Add crypt_set_format(3) + documentation to -lcrypt. Add login_setcryptfmt(3) + documentation to -lutil. Support for switching crypt formats in passwd(8). Support for switching crypt formats in pw(8). The simple synopsis is: edit login.conf; add a passwd_format field set to "des" or "md5"; go nuts :) Reviewed by: peter Notes: svn path=/head/; revision=64918
* Add NODESCRYPTLINKS knob to prevent spamming of libcrypt -> libscryptKris Kennaway2000-02-291-0/+2
| | | | | | | | | | symlinks. The name is against my better judgement, but I defer to ancient tradition here because I'm a nice guy. Reviewed by: -current Notes: svn path=/head/; revision=57582
* Really really remove SHA-1 support.Kris Kennaway2000-01-091-1/+1
| | | | Notes: svn path=/head/; revision=55688
* Remove the SHA stuff properly.Jordan K. Hubbard2000-01-081-1/+1
| | | | Notes: svn path=/head/; revision=55585
* I missed the LDADD/DPADD for -lmd in the secure cases. :-(Peter Wemm1999-12-191-3/+0
| | | | | | | Pointed out by: marcel Notes: svn path=/head/; revision=54829
* Colour me stupid. This is a better way of using the macros.Mark Murray1999-09-211-1/+1
| | | | Notes: svn path=/head/; revision=51524
* Do this the same way as Internat to reduce diffs.Mark Murray1999-09-211-1/+1
| | | | Notes: svn path=/head/; revision=51511
* Someone changed major numbers of the libraries from 2 to 3 for 0 (zero) reasons.Dmitrij Tejblum1999-09-211-1/+1
| | | | | | | | | | | | Revert the major number back to 2. libcrypt only export one function, before the recent changes and now: char *crypt(const char *key, const char *salt); The prototype didn't changed. Internal representation of `char' and `char *' didn't changed. Therefore, there is no reason to change the version number. Notes: svn path=/head/; revision=51510
* Restore SONAME setting, otherwise libdescrypt.so.3 doesn't end up withPeter Wemm1999-09-211-0/+4
| | | | | | | a special SONAME of libcrypt.so.3 and the runtime symlink doesn't work. Notes: svn path=/head/; revision=51507
* Make this completely dependant on the exportable libcrypt, to avoidMark Murray1999-09-2012-1737/+95
| | | | | | | | duplication of effort. Also a large cleanup of the code, inspired by Brandon Gillespie. Notes: svn path=/head/; revision=51461
* $Header$ -> $FreeBSD$Peter Wemm1999-08-281-1/+2
| | | | Notes: svn path=/head/; revision=50488
* $Id$ -> $FreeBSD$Peter Wemm1999-08-2810-11/+11
| | | | Notes: svn path=/head/; revision=50479
* Various man page cleanup:Mike Pritchard1999-08-151-3/+3
| | | | | | | | - Be consistent with section names as outlined in mdoc(7). - Other misc mdoc cleanup. Notes: svn path=/head/; revision=49830
* Fix symlinking. Without the -f "force" option, the wrong versionMark Murray1999-01-241-5/+5
| | | | | | | | can be found. Submitted by: Bruce Notes: svn path=/head/; revision=43152
* The new crypt code breaks "make world". Back it out.Mark Murray1999-01-2310-1/+951
| | | | Notes: svn path=/head/; revision=43091
* Removed from the secure/lib/libcrypt area, because of the rewrite to howBrandon Gillespie1999-01-219-950/+0
| | | | | | | | | the Makefile handles des support by just including the single .c file. Reviewed by: Mark Murray Notes: svn path=/head/; revision=42983
* BINFORMAT -> OBJFORMAT ready for E-day. Untested 'cause I'm outsideJohn Birrell1998-08-311-4/+4
| | | | | | | the US and not allowed to see this. I kept my eyes closed. 8-) Notes: svn path=/head/; revision=38664
* Teach libdescrypt about elf builds.Peter Wemm1997-09-051-3/+19
| | | | Notes: svn path=/head/; revision=29147
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-2210-11/+11
| | | | Notes: svn path=/head/; revision=22990
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-1410-11/+11
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Bring in my changes for removing the pestilent obj links (unless youJordan K. Hubbard1996-06-241-8/+2
| | | | | | | | really want them) from /usr/src. This is the final version of the patches, incorporating the feedback I've received from -current. Notes: svn path=/head/; revision=16663
* Split libcrypt and libcipher man pages.Mark Murray1996-04-132-91/+6
| | | | Notes: svn path=/head/; revision=15228
* Add back missing crypt.3 man page.Jordan K. Hubbard1996-02-211-1/+2
| | | | Notes: svn path=/head/; revision=14168
* Dual personality crypt(3). This crypt will choose its encryption algorithmMark Murray1995-12-165-34/+191
| | | | | | | | (DES or MD5) based on the type of salt used. Salt beginning with "$1$" indicates MD5. Notes: svn path=/head/; revision=12884
* Remove trailing whitespace.Rodney W. Grimes1995-05-304-13/+13
| | | | Notes: svn path=/head/; revision=8871
* More elegant fix for short settings.Geoff Rehmet1994-09-192-22/+38
| | | | | | | | (Our existing fixes already plugged the security holes involved.) Submitted by: Geoff Rehmet after consultation with David Burren Notes: svn path=/head/; revision=2900
* Back out static hacks & build of usr.bin until Geoff informs thePaul Traina1994-09-072-6/+6
| | | | | | | | | world of his master plan. Submitted by: pst Notes: svn path=/head/; revision=2539
* Remove static in front of declarations for des_setkey and des_cipherPaul Traina1994-09-072-6/+6
| | | | | | | | | | | | | | so that linking against -lcrypt (-ldescrypt) will give us the good versions instead of the stubs in libc. (These changes need to be made to the non-US version of libdescrypt too!) Allow building and support for bdes program. A bit more work still needs to be done on secure telnet. Submitted by: pst Notes: svn path=/head/; revision=2536
* Hopefully fix bogus permissions.Garrett Wollman1994-08-261-1/+2
| | | | Notes: svn path=/head/; revision=2306
* Install libdescrypt.so immutable.Garrett Wollman1994-08-261-1/+2
| | | | Notes: svn path=/head/; revision=2300
* Fix afterinstall rule for generating links to the real libcryptGeoff Rehmet1994-08-201-8/+16
| | | | | | | Submitted by: Geoff Notes: svn path=/head/; revision=2156
* when making test programs, look for libdescrypt, not libcryptGeoff Rehmet1994-08-121-2/+2
| | | | | | | Submitted by: Geoff Rehmet Notes: svn path=/head/; revision=2046
* 1) don't make bdes yetGeoff Rehmet1994-08-121-1/+6
| | | | | | | | | 2) fix .include in secure/lib/Makefile.inc 3) fix afterinstall rule in libcrypt/Makefile Submitted by: Geoff Rehmet Notes: svn path=/head/; revision=2044
* Install secure/lib/libcrypt as libdescrypt, and symlink it toGeoff Rehmet1994-08-091-3/+23
| | | | | | | | | libcrypt. There may be a little modification neede to this makefile once we start working on tidy make world's. Submitted by: geoff. Notes: svn path=/head/; revision=1990