aboutsummaryrefslogtreecommitdiff
path: root/libbb/pw_encrypt.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libbb: crypt_make_pw_salt(): fix yescrypt's random salt last charDenys Vlasenko2025-07-191-3/+11
| | | | | | | function old new delta crypt_make_pw_salt 128 146 +18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cryptpw: fix detection of crypt algo from salt (was broken if default isn't DES)Denys Vlasenko2025-07-191-6/+5
| | | | | | | | | | | | | The symptom is: "cryptpw ... implicit" testsuite tests were failing if CONFIG_FEATURE_DEFAULT_PASSWD_ALGO is not "des". function old new delta cryptpw_main 223 283 +60 pw_encrypt 974 975 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cryptpw: -m sha512crypt must also be acceptedDenys Vlasenko2025-07-071-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: shuffle ascii64 code around, shrink i2a64()Denys Vlasenko2025-07-061-73/+1
| | | | | | | | | | | | | function old new delta num2str64_4chars_msb_first - 55 +55 num2str64_lsb_first - 33 +33 i2a64 42 25 -17 to64 33 - -33 to64_msb_first 55 - -55 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 88/-105) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/yescrypt: use common ACSII char-to-64 conversion codeDenys Vlasenko2025-07-061-0/+25
| | | | | | | | | | | | | | function old new delta a2i64 - 46 +46 yescrypt_r 1215 1235 +20 decode64_uint32 167 177 +10 atoi64 25 - -25 ascii_to_bin 53 - -53 static.atoi64_partial 77 - -77 ------------------------------------------------------------------------------ (add/remove: 1/3 grow/shrink: 2/0 up/down: 76/-155) Total: -79 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* restore mangled commentDenys Vlasenko2025-07-061-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/yescrypt: code shrinkDenys Vlasenko2025-07-061-7/+5
| | | | | | | | | | | | | | | | | | | | static.PBKDF2_SHA256 - 189 +189 HMAC_SHA256_Init - 159 +159 HMAC_SHA256_Buf - 58 +58 HMAC_SHA256_Final - 53 +53 i2a64 - 42 +42 yescrypt_r 1221 1215 -6 yescrypt_kdf32_body 1064 1046 -18 i64c 42 - -42 libcperciva_HMAC_SHA256_Final 53 - -53 libcperciva_HMAC_SHA256_Buf 58 - -58 ascii64 65 - -65 libcperciva_HMAC_SHA256_Init 159 - -159 PBKDF2_SHA256 386 - -386 ------------------------------------------------------------------------------ (add/remove: 5/6 grow/shrink: 0/2 up/down: 501/-787) Total: -286 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add yescrypt password hashing supportDenys Vlasenko2025-07-061-4/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems to work, but not at all optimized for size. The extra copy of sha256 code need to be removed. The yescrypt code in libbb/yescrypt/* is adapted from libxcrypt-4.4.38 with minimal edits, hopefully making it easier to track backports by resetting the tree to this commit, then comparing changes in upstream libxcrypt to the tree. function old new delta blockmix_xor_save - 7050 +7050 static.blockmix_xor - 6475 +6475 blockmix - 3390 +3390 SHA256_Transform - 3083 +3083 yescrypt_kdf_body - 1724 +1724 PBKDF2_SHA256 - 1003 +1003 smix1 - 960 +960 yescrypt_r - 890 +890 salsa20 - 804 +804 smix - 790 +790 smix2 - 659 +659 blockmix_salsa8_xor - 601 +601 yescrypt_kdf - 479 +479 blockmix_salsa8 - 415 +415 Krnd - 256 +256 _HMAC_SHA256_Init - 213 +213 _SHA256_Update - 198 +198 _SHA256_Final - 195 +195 decode64_uint32 - 166 +166 encode64 - 153 +153 decode64 - 136 +136 libcperciva_HMAC_SHA256_Buf - 132 +132 SHA256_Pad_Almost - 131 +131 salsa20_simd_unshuffle - 101 +101 salsa20_simd_shuffle - 101 +101 yes_crypt - 90 +90 libcperciva_SHA256_Buf - 86 +86 crypt_make_rand64encoded - 85 +85 static.atoi64_partial - 77 +77 alloc_region - 72 +72 ascii64 - 65 +65 PAD - 64 +64 _HMAC_SHA256_Final - 55 +55 static.cpu_to_be32_vect - 51 +51 free_region - 47 +47 libcperciva_SHA256_Init - 37 +37 yescrypt_init_local - 34 +34 crypt_make_pw_salt 92 125 +33 initial_state - 32 +32 .rodata 105771 105803 +32 atoi64 - 25 +25 explicit_bzero - 22 +22 pw_encrypt 920 941 +21 yescrypt_free_local - 9 +9 crypt_make_salt 85 - -85 ------------------------------------------------------------------------------ (add/remove: 43/1 grow/shrink: 3/0 up/down: 31042/-85) Total: 30957 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix missing "crypt.h" compilation error on the FreeBSDAlex Samorukov2021-01-041-1/+3
| | | | | | | FreeBSD does not use crypt.h, but unistd.h which is already included Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make pw_encrypt() die if supplied salt is bad (e.g. emply)Denys Vlasenko2020-12-151-3/+8
| | | | | | | | | | | | Fished from 520-loginutils-handle-crypt-failures.patch in openwrt function old new delta pw_encrypt 913 927 +14 des_crypt 1327 1318 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-9) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: include <crypt.h> only if necessaryDenys Vlasenko2019-07-161-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: crypt() in newer glibc requires include <crypt.h>Denys Vlasenko2018-06-271-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace and comment format fixes, no code changesDenys Vlasenko2017-10-051-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Replace int -> uint to avoid signed integer overflowRostislav Skudnov2017-02-041-1/+1
| | | | | | | | | | An example of such an error (should be compiled with DEBUG_SANITIZE): runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: slap on a few ALIGN1/2s where appropriateDenys Vlasenko2016-04-221-1/+1
| | | | | | | | | | The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" text data bss dec hex filename 829901 4086 1904 835891 cc133 busybox_before 829665 4086 1904 835655 cc047 busybox Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* chpasswd: support -c argument and respect DEFAULT_PASSWD_ALGOPascal Bach2015-12-181-3/+7
| | | | | Signed-off-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: don't die if crypt() returns NULLDenys Vlasenko2014-02-091-1/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* adduser: safe username passing to passwd/addgroupDenys Vlasenko2011-05-131-2/+23
| | | | | | | | | | | | | | | | | | | passwd: support creating SHA passwords random code shrink function old new delta crypt_make_pw_salt - 87 +87 adduser_main 883 904 +21 ... crypt_make_salt 99 89 -10 chpasswd_main 329 312 -17 packed_usage 28731 28691 -40 passwd_main 1070 1000 -70 cryptpw_main 310 224 -86 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/12 up/down: 154/-288) Total: -134 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: move crypt_make_salt() to pw_encrypt.c, reuseDenis Vlasenko2008-12-071-9/+46
| | | | | | | | | | bin-to-ascii64 conversion which does not require an array. function old new delta to64 29 33 +4 to64_msb_first 63 62 -1 ascii64 65 - -65
* libbb: add optionl support for SHA256/512 encrypted passwordsDenis Vlasenko2008-11-101-15/+28
| | | | | | | | | | | | | | | function old new delta sha_crypt - 2423 +2423 cryptpw_main 128 183 +55 to64 - 29 +29 pw_encrypt 974 1000 +26 str_rounds - 11 +11 login_main 1532 1541 +9 packed_usage 25215 25200 -15 __md5_to64 29 - -29 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 3/1 up/down: 2553/-44) Total: 2509 bytes
* libbb: add a TODO to support new SHA-based encrypted passwordsDenis Vlasenko2008-11-071-12/+5
|
* *: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko2008-06-271-2/+2
| | | | | | | text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
* whitespace and comment fixes, no code changesDenis Vlasenko2008-06-161-4/+0
|
* Specially for Bernhard Fischer introduce USE_BB_CRYPTDenis Vlasenko2008-06-151-0/+17
| | | | | which selects between libc/custom crypt routines.
* make pw_encrypt() return malloc'ed string.Denis Vlasenko2008-06-121-4/+3
| | | | | | | text data bss dec hex filename 759802 604 6684 767090 bb472 busybox_old 759804 604 6676 767084 bb46c busybox_unstripped
* uclibc insists on having 70k static buffer for crypt.Denis Vlasenko2008-06-121-4/+49
| | | | | | | | | | | | For bbox it's not acceptable. Roll our own des and md5 crypt implementation. Against older uclibc: text data bss dec hex filename 759945 604 6684 767233 bb501 busybox_old 759766 604 6684 767054 bb44e busybox_unstripped so, we still save on code size.
* libbb: random hunt for staticsDenis Vlasenko2007-06-181-7/+5
| | | | | | | | | | | | | | | | function old new delta bb_askpass 306 321 +15 pw_encrypt 38 39 +1 static.passwd 64 4 -60 static.cipher 128 4 -124 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 16/-184) Total: -168 bytes # size busybox_old busybox_unstripped text data bss dec hex filename 683705 2704 14240 700649 ab0e9 busybox_old 683721 2704 14064 700489 ab049 busybox_unstripped
* passwd: small size optimization. salt generation improvedDenis Vlasenko2006-11-301-1/+0
| | | | (really generated different salts even if called back-to-back).
* usage.h: fix compile-time bugs exposed by previous changeDenis Vlasenko2006-09-271-3/+1
|
* Replace current verbose GPL stuff in libbb/*.c with one-line GPL boilerplate."Robert P. J. Day"2006-07-101-14/+1
|
* skip_whitespace() shouldn't claim its return value is const, it doesn't knowRob Landley2006-06-181-1/+1
| | | | that and callers wind up typecasting it back.
* Robert P. Day removed 8 gazillion occurrences of "extern" on functionRob Landley2006-03-061-1/+1
| | | | definitions. (That should only be on prototypes.)
* Remove trailing whitespace. Update copyright to include 2004.Eric Andersen2004-03-151-1/+1
|
* Update a bunch of docs. Run a script to update my email addr.Eric Andersen2003-07-141-1/+1
|
* Vodz, last_patch_86Glenn L McGrath2003-05-261-4/+1
|
* Port over the last of the tinylogin appletsEric Andersen2002-06-231-0/+48
-Erik