aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* crond: build tweaksRon Yorston2026-05-031-1/+1
| | | | | | | | | | | | | | | Using 'depends on FEATURE_SYSLOG' is unreliable because FEATURE_SYSLOG can't be set directly. A POSIX build with all applets that need syslog disabled *except* crond may fail. Revert to using 'select FEATURE_SYSLOG' in crond and exclude the unused syslog code on Windows. If crond is unable to run sendmail report this in the error message. Update all default Windows configurations. (GitHub PR #561)
* wget: allow HTTPS certificate check to be skippedRon Yorston2026-04-241-0/+2
| | | | | | | | | | | The Microsoft Windows Schannel implementation of TLS validates the server certificate. Enable the --no-check-certificate option to wget to allow these checks to be skipped. This may be useful to connect to badly configured websites. Adds 202 bytes to the x86_64 build with Schannel enabled. (GitHub issue #581)
* ash: allow 'times' built-in to report process timingRon Yorston2026-04-121-0/+3
| | | | | | | | | | | | | | Move existing code which obtains process execution times into a separate function. Use it to allow times(2) to report execution times for the current process, though not child execution times. Change TICKS_PER_SECOND from 100 to 1000 to increase the displayed resolution of process times (though the measured resolution may well be less than this). Adds 48-80 bytes. (GitHub issue #574)
* Merge branch 'busybox' into mergeRon Yorston2026-03-111-27/+104
|\
| * *: don't use getservbyname, it links in a static bufferDenys Vlasenko2026-02-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servport_by_name - 348 +348 bb_lookup_port 83 111 +28 reread_config_file 886 907 +21 static.se 16 - -16 getservbyname 53 - -53 getservbyname_r 284 - -284 ------------------------------------------------------------------------------ (add/remove: 2/5 grow/shrink: 2/0 up/down: 397/-353) Total: 44 bytes text data bss dec hex filename 1080084 555 5024 1085663 1090df busybox_old 1080144 555 4992 1085691 1090fb busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * netstat: fix breakage due to last commitDenys Vlasenko2026-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servname_by_port 182 195 +13 ip_port_str 121 120 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 13/-1) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * netstat,pscan: don't use getservbyport(), it links in a static bufferDenys Vlasenko2026-02-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_get_servname_by_port - 182 +182 ip_port_str 112 121 +9 pscan_main 594 591 -3 getservbyport 53 - -53 getservbyport_r 430 - -430 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 1/1 up/down: 191/-486) Total: -295 bytes text data bss dec hex filename 1080362 555 5056 1085973 109215 busybox_old 1080067 555 5024 1085646 1090ce busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * telnet: rewrite to use ioloop()Denys Vlasenko2026-02-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now should never block on network I/O. Also, window resizing is dynamic now. function old new delta write_to_net - 596 +596 read_from_net - 543 +543 read_from_stdin - 227 +227 show_menu - 212 +212 write_to_stdout - 105 +105 have_data_to_write_to_net - 72 +72 have_data_to_write_to_stdout - 38 +38 put_iac_byte_escaped - 32 +32 ioloop_run 411 438 +27 have_buffer_to_read_from_stdin - 25 +25 have_buffer_to_read_from_net - 25 +25 .rodata 107125 107141 +16 handle_SIGWINCH - 15 +15 put_iac 36 28 -8 put_iac4_msb_lsb 19 - -19 iac_flush 36 - -36 setConMode 87 - -87 handle_net_output 110 - -110 con_escape 271 - -271 telnet_main 1232 476 -756 ------------------------------------------------------------------------------ (add/remove: 11/5 grow/shrink: 2/2 up/down: 1933/-1287) Total: 646 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add generic "fd polling and I/O" loop, use it in telnetdDenys Vlasenko2026-02-211-13/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do it, badly, in many places. Better to use one robust implementation. Can be buggy yet. Initial use is in a rather old, rarely used tech: telnet. The I/O in telnetd should be fully non-blocking now, including pty delays handling. Several bugs in telnetd handling of IACs are fixed. function old new delta ioloop_run - 411 +411 net_to_pty__have_data_to_write - 368 +368 pty_to_net__write - 318 +318 net_to_pty__write - 180 +180 pty_to_net__read - 171 +171 net_to_pty__have_buffer_to_read_into - 164 +164 pty_to_net__have_buffer_to_read_into - 90 +90 net_to_pty__read - 87 +87 pty_to_net__have_data_to_write - 59 +59 make_new_session 491 550 +59 conn_close_fds - 52 +52 accept_conn__accept - 49 +49 conn_close_fds_remove_and_free - 27 +27 ioloop_remove_conn - 22 +22 remove_and_free_to_pty - 19 +19 ioloop_insert_conn - 10 +10 accept_conn__can_accept - 6 +6 accept_conn__return_zero - 3 +3 static.ayt_response - 2 +2 handle_sigchld 59 61 +2 free_session 130 - -130 telnetd_main 1797 367 -1430 ------------------------------------------------------------------------------ (add/remove: 19/1 grow/shrink: 2/1 up/down: 2099/-1560) Total: 539 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: server: fix incorrect key_block assignments - now works against openssl ↵Denys Vlasenko2026-02-151-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | s_client function old new delta privRsaEncryptSignedElement - 236 +236 tls_handshake_as_server 2033 2264 +231 .rodata 108079 108301 +222 initialize_aes_keys - 77 +77 xwrite_encrypted 507 506 -1 tls_handshake 1519 1500 -19 derive_master_secret_and_keys 154 123 -31 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/3 up/down: 766/-51) Total: 715 bytes Totoal growth compared to code before TLS server code: function old new delta tls_handshake_as_server - 2264 +2264 .rodata 107074 108301 +1227 psRsaCrypt - 577 +577 load_rsa_priv_key - 282 +282 ssl_server_main - 279 +279 privRsaEncryptSignedElement - 236 +236 ssl_client_main 137 363 +226 psRsaDecryptPriv - 171 +171 set_cipher_parameters - 161 +161 derive_master_secret_and_keys - 123 +123 packed_usage 36034 36146 +112 sp_ecc_make_key_256 - 103 +103 send_finished - 94 +94 get_change_cipher_spec - 88 +88 initialize_aes_keys - 77 +77 static.BLOCK_NAMES - 70 +70 curve_P256_compute_premaster - 65 +65 der_binary_to_pstm - 50 +50 curve_x25519_generate_keypair - 44 +44 get_finished - 42 +42 get_outbuf_fill_handshake_record - 37 +37 client_hello_ciphers - 32 +32 curve_P256_generate_keypair - 27 +27 sp_256_from_bin_8 - 26 +26 tls_xread_record 681 704 +23 curve_x25519_compute_premaster - 15 +15 applet_names 2870 2881 +11 applet_main 1652 1656 +4 xwrite_encrypted 507 506 -1 xwrite_and_update_handshake_hash 76 59 -17 sp_256_point_from_bin2x32 70 43 -27 curve_x25519_compute_pubkey_and_premaster 71 39 -32 curve_P256_compute_pubkey_and_premaster 167 65 -102 psRsaEncryptPub 395 199 -196 tls_handshake 2069 1500 -569 ------------------------------------------------------------------------------ (add/remove: 23/0 grow/shrink: 6/7 up/down: 6466/-944) Total: 5522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix cipher-id selection in server modeDenys Vlasenko2026-02-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ECDSA keys still don't work, and currently will be ignored function old new delta tls_handshake_as_server 824 1601 +777 .rodata 107764 108007 +243 set_cipher_parameters - 161 +161 packed_usage 36072 36146 +74 static.BLOCK_NAMES - 70 +70 client_hello_ciphers - 32 +32 ssl_server_main 288 279 -9 load_rsa_priv_key 329 282 -47 tls_handshake 1676 1530 -146 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 3/3 up/down: 1357/-202) Total: 1155 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: implement server codeDenys Vlasenko2026-02-151-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta tls_handshake_as_server 7 852 +845 .rodata 107103 107764 +661 psRsaCrypt - 577 +577 load_rsa_priv_key - 329 +329 psRsaDecryptPriv - 200 +200 derive_master_secret_and_keys - 154 +154 send_finished - 95 +95 get_change_cipher_spec - 88 +88 der_binary_to_pstm - 50 +50 get_finished - 42 +42 tls_xread_record 681 708 +27 ssl_server_main 285 288 +3 psRsaEncryptPub 395 199 -196 tls_handshake 2069 1690 -379 ------------------------------------------------------------------------------ (add/remove: 8/0 grow/shrink: 4/2 up/down: 3071/-575) Total: 2496 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ssl_server: new applet, not functional yetDenys Vlasenko2026-02-151-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta ssl_server_main - 285 +285 ssl_client_main 137 363 +226 packed_usage 36034 36072 +38 .rodata 107074 107103 +29 applet_names 2870 2881 +11 tls_handshake_as_server - 7 +7 applet_main 1652 1656 +4 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 5/0 up/down: 600/0) Total: 600 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2026-02-121-1/+10
|\|
| * vi: fix "s /find/repl" with whitespace before /Denys Vlasenko2026-02-061-0/+2
| | | | | | | | | | | | | | function old new delta colon 3977 4005 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: introduce and use xasprintf_inplace()Denys Vlasenko2026-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta xasprintf_and_free - 49 +49 watch_main 269 282 +13 singlemount 1313 1315 +2 append_mount_options 157 149 -8 ip_port_str 122 112 -10 lsblk_main 869 858 -11 add_cmd 1178 1167 -11 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/4 up/down: 64/-40) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: use narrow isqrt() when 64-bit one is not needed (only "factor" uses it)Denys Vlasenko2026-02-041-1/+6
| | | | | | | | | | | | | | | | | | | | | | function old new delta isqrt_ull - 84 +84 create_J 1809 1808 -1 isqrt 106 38 -68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 84/-69) Total: 15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2026-02-101-0/+1
|\|
| * uuidgen: move UUID formatting to libbbDenys Vlasenko2026-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta format_uuid_DCE_37_chars - 94 +94 uuidgen_main 71 53 -18 .rodata 107089 107066 -23 mkswap_main 278 253 -25 volume_id_set_uuid 258 178 -80 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/4 up/down: 94/-146) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2026-02-021-0/+15
|\|
| * httpd: code shrink via "split-globals" trickDenys Vlasenko2026-01-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta httpd_main 957 968 +11 log_and_exit 25 26 +1 send_headers 712 708 -4 handle_incoming_and_exit 2292 2285 -7 sigalrm_handler 102 93 -9 parse_conf 1332 1323 -9 send_cgi_and_exit 803 790 -13 cgi_io_loop_and_exit 656 635 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/6 up/down: 12/-63) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | libbb: refactor CNG hashing implementationrfl8902026-01-271-21/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing CNG implementation relied on multiple features only implemented in "newer" Windows versions. This new implementation does not use the aforementioned features and is therefore compatible with systems running Windows Vista or higher. function old new delta .rdata 87112 87288 +176 hmac_peek_hash 80 208 +128 get_alg_handle - 96 +96 algorithm_provider_hmac_cache - 48 +48 algorithm_provider_cache - 48 +48 alg_id_mappings - 48 +48 sha512_begin 16 48 +32 sha384_begin 16 48 +32 sha256_begin 16 48 +32 sha1_begin 16 48 +32 md5_begin 16 32 +16 hmac_hash_v 48 64 +16 hmac_end 48 64 +16 hmac_blocks.constprop.0 96 112 +16 __imp_BCryptOpenAlgorithmProvider - 8 +8 __imp_BCryptDuplicateHash - 8 +8 BCryptOpenAlgorithmProvider - 8 +8 BCryptDuplicateHash - 8 +8 ------------------------------------------------------------------------------ (add/remove: 8/0 grow/shrink: 10/0 up/down: 768/0) Total: 768 bytes
* | Merge branch 'busybox' into mergeRon Yorston2025-11-111-0/+4
|\|
| * dd: fix overflow for very large count/seek/skip valuesDenys Vlasenko2025-11-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta xatoull_range_sfx - 49 +49 dd_main 1607 1640 +33 bb_banner 47 46 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 82/-1) Total: 81 bytes Signed-off-by: Sertonix <sertonix@posteo.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: eval: Add vfork supportDenys Vlasenko2025-08-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: Date: Sat, 19 May 2018 02:39:56 +0800 eval: Add vfork support This patch adds basic vfork support for the case of a simple command. Upstream commit: Date: Tue, 12 Jan 2021 17:11:19 +1100 jobs: Always reset SIGINT/SIGQUIT handlers On Fri, Jan 08, 2021 at 08:55:41PM +0000, Harald van Dijk wrote: > On 18/05/2018 19:39, Herbert Xu wrote: > > This patch adds basic vfork support for the case of a simple command. > > ... @@ -879,17 +892,30 @@ forkchild(struct job *jp, union node *n, int > > mode) > > } > > } > > if (!oldlvl && iflag) { > > - setsignal(SIGINT); > > - setsignal(SIGQUIT); > > + if (mode != FORK_BG) { > > + setsignal(SIGINT); > > + setsignal(SIGQUIT); > > + } > > setsignal(SIGTERM); > > } > > + > > + if (lvforked) > > + return; > > + > > for (jp = curjob; jp; jp = jp->prev_job) > > freejob(jp); > > } > > This leaves SIGQUIT ignored in background jobs in interactive shells. > > ENV= dash -ic 'dash -c "kill -QUIT \$\$; echo huh" & wait' > > As of dash 0.5.11, this prints "huh". Before, the subprocess process killed > itself before it could print anything. Other shells do not leave SIGQUIT > ignored. > > (In a few other shells, this also prints "huh", but in those other shells, > that is because the inner shell chooses to ignore SIGQUIT, not because the > outer shell leaves it ignored.) Thanks for catching this. I have no idea how that got in there and it makes no sense whatsoever. This patch removes the if conditional. Fixes: e94a964e7dd0 ("eval: Add vfork support") Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: eval: Add vfork supportRon Yorston2025-09-071-0/+2
| | | | | | | | | | | | | | Merge upstream commit df154028d. Since we don't have vfork() on Windows we continue to use the spawn_forkshell() mechanism. Although there is some rearrangement of the code it's functionally the same.
* | tls: rewrite Schannel codeRFL8902025-08-281-20/+20
| | | | | | | | | | The previous code had issues with buffer management, resulting in failures.
* | Merge branch 'busybox' into mergeRon Yorston2025-08-151-30/+38
|\|
| * top,pmap: do not use common code for reading /proc/PID/smapsDenys Vlasenko2025-08-051-29/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic is in fact quite far from common. While at it, stop accounting "---p" mappings as mapped (e.g. VSZ in top). Nothing is mapped there (why would kernel waste RAM to map pages which can't be accessed?). function old new delta read_smaps - 562 +562 read_cmdline 315 326 +11 print_smaprec 97 101 +4 procps_scan 1219 1211 -8 .rodata 115541 115533 -8 skip_whitespace_if_prefixed_with 25 - -25 procps_read_smaps 864 577 -287 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/3 up/down: 577/-328) Total: 249 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ftpd: code shrink, move replace_char() to libbbDenys Vlasenko2025-08-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | function old new delta modprobe_main 803 804 +1 escape_text 127 122 -5 replace 18 - -18 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 1/-23) Total: -22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: fix -Q to match GNUDenys Vlasenko2025-08-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta print_name 137 229 +92 display_files 375 402 +27 c_escape_conv_str00 - 24 +24 display 1476 1485 +9 conv_str 33 - -33 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 152/-33) Total: 119 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sha384sum: new appletAndy Knowles2025-07-301-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sha512384_end - 198 +198 packed_usage 35021 35134 +113 init384 - 80 +80 sha384_begin - 19 +19 sha384_end - 10 +10 applet_names 2823 2833 +10 md5_sha1_sum_main 501 507 +6 sha3_end 54 59 +5 applet_main 1628 1632 +4 show_usage_if_dash_dash_help 79 72 -7 hash_file 358 344 -14 sha512_end 197 10 -187 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 5/3 up/down: 445/-208) Total: 237 bytes Signed-off-by: Andy Knowles <aknowles@galleonec.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Post-merge fixesRon Yorston2025-08-121-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream has moved some functions from networking/tls.c to a new file, libbb/hash_hmac.c. The merge didn't adjust this code to allow it to work with the native Windows checksum API. This only matters if FEATURE_USE_CNG_API is enabled and CONFIG_FEATURE_TLS_SCHANNEL isn't. In that case the wget applet fails to handle https. None of the default configurations has this combination, but it should work. Make it so. The Windows code doesn't implement hmac_block(), as that's only used for password encryption which isn't currently supported. The variadic function hmac_peek_hash() isn't declared FAST_FUNC, as that causes clang to issue many warnings.
* | Merge branch 'busybox' into mergeRon Yorston2025-08-121-15/+70
|\|
| * libbb.h: increase MAX_PW_SALT_LENDenys Vlasenko2025-07-171-6/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: introduce and use block-XOR functionsDenys Vlasenko2025-07-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On x86_64, they can be done in 16-byte blocks 64-bit: function old new delta xorbuf_3 - 84 +84 xorbuf64_3_aligned64 - 58 +58 smix1 687 712 +25 xwrite_encrypted 520 534 +14 xorbuf16_aligned_long - 13 +13 tls_xread_record 733 742 +9 xorbuf 21 13 -8 xorbuf_aligned_AES_BLOCK_SIZE 15 - -15 blockmix 814 762 -52 blockmix_salsa8 317 198 -119 blockmix_xor_save 1620 1499 -121 blockmix_xor 1543 1322 -221 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 3/5 up/down: 203/-536) Total: -333 bytes 32-bit: function old new delta xorbuf_3 - 76 +76 xorbuf64_3_aligned64 - 36 +36 xorbuf16_aligned_long - 23 +23 xwrite_encrypted 499 507 +8 tls_xread_record 646 650 +4 xorbuf 22 11 -11 xorbuf_aligned_AES_BLOCK_SIZE 23 - -23 blockmix 1083 938 -145 blockmix_salsa8 415 210 -205 blockmix_salsa8_xor 601 163 -438 blockmix_xor 2103 1533 -570 blockmix_xor_save 2614 1859 -755 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 2/6 up/down: 147/-2147) Total: -2000 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: accept longer salts (up to 84 chars)Denys Vlasenko2025-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta cryptpw_main 214 223 +9 chpasswd_main 347 356 +9 passwd_main 931 934 +3 yescrypt_r 1084 1056 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 21/-28) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: remove redundant SHA256 HMAC implementationDenys Vlasenko2025-07-071-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta hmac_blocks - 88 +88 static.PBKDF2_SHA256 176 213 +37 yescrypt_kdf32_body 1046 1052 +6 static.smix 759 762 +3 hmac_block 88 64 -24 HMAC_SHA256_Final 53 - -53 HMAC_SHA256_Buf 58 - -58 HMAC_SHA256_Init 159 - -159 ------------------------------------------------------------------------------ (add/remove: 1/3 grow/shrink: 3/1 up/down: 134/-294) Total: -160 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: factor out HMAC code from TLSDenys Vlasenko2025-07-071-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta hmac_block - 88 +88 hmac_peek_hash - 61 +61 hmac_end - 50 +50 hmac_begin 140 177 +37 hmac_hash_v - 30 +30 .rodata 105799 105787 -12 hmac_sha_precomputed 54 - -54 hmac_sha_precomputed_v 69 - -69 hmac 83 - -83 ------------------------------------------------------------------------------ (add/remove: 5/3 grow/shrink: 1/1 up/down: 266/-218) Total: 48 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: use common ascii64 encoding routineDenys Vlasenko2025-07-061-0/+1
| | | | | | | | | | | | | | | | | | | | function old new delta num2str64_lsb_first 33 46 +13 yescrypt_r 1235 1133 -102 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 13/-102) Total: -89 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: use common ACSII char-to-64 conversion codeDenys Vlasenko2025-07-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * libbb/yescrypt: code shrinkDenys Vlasenko2025-07-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Move "sha256-hash a memory array and produce the digest" helper to libbbDenys Vlasenko2025-07-061-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add yescrypt password hashing supportDenys Vlasenko2025-07-061-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2025-08-101-25/+8
|\|
| * shell: update HISTFILESIZE code to be actually usefulDenys Vlasenko2025-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "HISTFILESIZE=0" in profile wasn't working as intended, "unset HISTFILE" wasn't preventing creation of history files Now: HISTSIZE=n allows to reduce in-memory history buffer HISTFILESIZE=n allows to reduce history file size (0: truncate it) unset HISTFILE allows to not save history file at all function old new delta exitshell 138 194 +56 hush_exit 97 143 +46 save_history 266 296 +30 hush_main 1170 1186 +16 .rodata 105762 105771 +9 load_history 246 254 +8 size_from_HISTFILESIZE 44 41 -3 read_line_input 2746 2712 -34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/2 up/down: 165/-37) Total: 128 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: fix race between signal handlers setting bb_got_signal and poll()Denys Vlasenko2025-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta __ppoll_time64 - 211 +211 check_got_signal_and_poll - 164 +164 read_key 607 601 -6 shell_builtin_read 1328 1318 -10 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 0/2 up/down: 375/-16) Total: 359 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: Prevent clang from reading the G pointer before it is assignedBin Meng2025-07-011-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was observed that getty crashes on RISC-V 64-bit target, with the busybox binary compiled by clang/LLVM 17 with -O2. Not only getty, but also some other applets like syslogd/vi are broken too. Commit 5156b245 ("Make const ptr assign as function call in clang") introduced XZALLOC_CONST_PTR() to defeat the compiler optimization, however it only fixed a small number of broken places when compiling busybox with clang/LLVM. A large number of places remain broken. This commit treats ASSIGN_CONST_PTR() the same way as XZALLOC_CONST_PTR(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | tls: whitespace fixesRon Yorston2025-08-081-1/+1
| | | | | | | | No functional changes.
* | tls: add Schannel implementationrfl8902025-08-071-0/+37
| | | | | | | | | | | | | | Not enabled by default. When enabled without TLS 1.3 support, saves 16784-18776 bytes. (GitHub PR #510)