summaryrefslogtreecommitdiff
path: root/secure/lib/libcrypt
AgeCommit message (Collapse)Author
2023-11-26secure: Automated cleanup of cdefs and other formattingWarner Losh
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
2023-08-16Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2021-06-15crypt_r(3): fix reentrancy problems with DESEdward Tomasz Napierala
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
2016-08-10Make libcrypt thread-safe. Add crypt_r(3).Ed Schouten
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
2015-06-16Add compatibility with $2y$ bcrypt hashesAllan Jude
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
2014-05-14Switch using the new $2b$ format by default, when bcrypt is used.Xin LI
MFC after: 2 weeks Relnotes: default Blowfish crypt(3) format have been changed to $2b$. Notes: svn path=/head/; revision=265995
2014-02-25Refresh our implementation of OpenBSD's Blowfish password format.Xin LI
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
2012-05-30Update the previous openssl fix. [12:01]Bjoern A. Zeeb
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
2012-02-22Return NULL on error rather than ":", per the crypt(3) man page.Kevin Lo
Discussed in: http://www.openwall.com/lists/oss-security/2011/11/15/3 Notes: svn path=/head/; revision=231986
2003-06-02Strip the private blowfish code down to only that which isMark Murray
required to make crypt(3) blowfish "$2a$..." hashes. Lint and warnsify. Notes: svn path=/head/; revision=115719
2002-03-06No functional change, but big code cleanup. WARNS, lint(1) and style(9).Mark Murray
Notes: svn path=/head/; revision=91754
2002-02-18o Move NTOHL() and associated macros into <sys/param.h>. These areMike Barcroft
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
2001-10-23__FBSDID() (second half of src/lib/libcrypt changes)Peter Wemm
Notes: svn path=/head/; revision=85358
2001-03-11Add OpenBSD-style blowfish password hashing. This makes one lessMark Murray
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
2000-12-28Merge into a single US-exportable libcrypt, which only providesPeter Wemm
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
2000-08-22Add working and easy crypt(3)-switching. Yes, we need a whole new APIBrian Feldman
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
2000-02-29Add NODESCRYPTLINKS knob to prevent spamming of libcrypt -> libscryptKris Kennaway
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
2000-01-09Really really remove SHA-1 support.Kris Kennaway
Notes: svn path=/head/; revision=55688
2000-01-08Remove the SHA stuff properly.Jordan K. Hubbard
Notes: svn path=/head/; revision=55585
1999-12-19I missed the LDADD/DPADD for -lmd in the secure cases. :-(Peter Wemm
Pointed out by: marcel Notes: svn path=/head/; revision=54829
1999-09-21Colour me stupid. This is a better way of using the macros.Mark Murray
Notes: svn path=/head/; revision=51524
1999-09-21Do this the same way as Internat to reduce diffs.Mark Murray
Notes: svn path=/head/; revision=51511
1999-09-21Someone changed major numbers of the libraries from 2 to 3 for 0 (zero) reasons.Dmitrij Tejblum
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
1999-09-21Restore SONAME setting, otherwise libdescrypt.so.3 doesn't end up withPeter Wemm
a special SONAME of libcrypt.so.3 and the runtime symlink doesn't work. Notes: svn path=/head/; revision=51507
1999-09-20Make this completely dependant on the exportable libcrypt, to avoidMark Murray
duplication of effort. Also a large cleanup of the code, inspired by Brandon Gillespie. Notes: svn path=/head/; revision=51461
1999-08-28$Header$ -> $FreeBSD$Peter Wemm
Notes: svn path=/head/; revision=50488
1999-08-28$Id$ -> $FreeBSD$Peter Wemm
Notes: svn path=/head/; revision=50479
1999-08-15Various man page cleanup:Mike Pritchard
- Be consistent with section names as outlined in mdoc(7). - Other misc mdoc cleanup. Notes: svn path=/head/; revision=49830
1999-01-24Fix symlinking. Without the -f "force" option, the wrong versionMark Murray
can be found. Submitted by: Bruce Notes: svn path=/head/; revision=43152
1999-01-23The new crypt code breaks "make world". Back it out.Mark Murray
Notes: svn path=/head/; revision=43091
1999-01-21Removed from the secure/lib/libcrypt area, because of the rewrite to howBrandon Gillespie
the Makefile handles des support by just including the single .c file. Reviewed by: Mark Murray Notes: svn path=/head/; revision=42983
1998-08-31BINFORMAT -> OBJFORMAT ready for E-day. Untested 'cause I'm outsideJohn Birrell
the US and not allowed to see this. I kept my eyes closed. 8-) Notes: svn path=/head/; revision=38664
1997-09-05Teach libdescrypt about elf builds.Peter Wemm
Notes: svn path=/head/; revision=29147
1997-02-22Revert $FreeBSD$ to $Id$Peter Wemm
Notes: svn path=/head/; revision=22990
1997-01-14Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard
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
1996-06-24Bring in my changes for removing the pestilent obj links (unless youJordan K. Hubbard
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
1996-04-13Split libcrypt and libcipher man pages.Mark Murray
Notes: svn path=/head/; revision=15228
1996-02-21Add back missing crypt.3 man page.Jordan K. Hubbard
Notes: svn path=/head/; revision=14168
1995-12-16Dual personality crypt(3). This crypt will choose its encryption algorithmMark Murray
(DES or MD5) based on the type of salt used. Salt beginning with "$1$" indicates MD5. Notes: svn path=/head/; revision=12884
1995-05-30Remove trailing whitespace.Rodney W. Grimes
Notes: svn path=/head/; revision=8871
1994-09-19More elegant fix for short settings.Geoff Rehmet
(Our existing fixes already plugged the security holes involved.) Submitted by: Geoff Rehmet after consultation with David Burren Notes: svn path=/head/; revision=2900
1994-09-07Back out static hacks & build of usr.bin until Geoff informs thePaul Traina
world of his master plan. Submitted by: pst Notes: svn path=/head/; revision=2539
1994-09-07Remove static in front of declarations for des_setkey and des_cipherPaul Traina
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
1994-08-26Hopefully fix bogus permissions.Garrett Wollman
Notes: svn path=/head/; revision=2306
1994-08-26Install libdescrypt.so immutable.Garrett Wollman
Notes: svn path=/head/; revision=2300
1994-08-20Fix afterinstall rule for generating links to the real libcryptGeoff Rehmet
Submitted by: Geoff Notes: svn path=/head/; revision=2156
1994-08-12when making test programs, look for libdescrypt, not libcryptGeoff Rehmet
Submitted by: Geoff Rehmet Notes: svn path=/head/; revision=2046
1994-08-121) don't make bdes yetGeoff Rehmet
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
1994-08-09Install secure/lib/libcrypt as libdescrypt, and symlink it toGeoff Rehmet
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