| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
display 1485 1481 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
"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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| | |
No functional changes.
|
| |
| |
| |
| |
| |
| |
| | |
Not enabled by default.
When enabled without TLS 1.3 support, saves 16784-18776 bytes.
(GitHub PR #510)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implement a minimal stty applet for Windows.
- Display and set terminal rows and columns
- Enable/disable raw/cooked mode
- Enable/disable echo mode
- Implement 'stty sane' to reset raw/cooked/echo
Adds 2120-2304 bytes.
(GitHub issue #58)
|
| |
| |
| |
| |
| |
| |
| | |
There were two copies of the static function die_if_error().
Replace these with a single external function.
Saves 16 bytes.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a new feature to libbb, FEATURE_USE_CNG_API, which enables the
use of the Cryptography API: Next Generation library to calculate
checksums. It is disabled by default except in the mingw64u default
config, as the API requires Windows 10+ to function. Usage of this
API provides a size benefit and delegates hardware optimizations to
the operating system cryptography library.
Based on GitHub PR #498 by rfl890.
Saves 4064 bytes in the mingw64u case.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
setup_unzip_on_fd() does not return the transformer structure, so the user
does not know how much to seek back (or alternatively what the signature was)
when compressor signature is not detected.
Currently not needed (the only user is tar which dies anyway).
However, rpm2cpio may need this if we extend it to extract the internal .cpio
even if cpio's compressions algo is not known.
function old new delta
setup_unzip_on_fd 53 59 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some installer programs have an entry in their manifest to indicate
that they need elevated privileges. The shell in busybox-w32 was
unable to run such programs.
When a program fails to run with ERROR_ELEVATION_REQUIRED, try
again using ShellExecuteEx() with the 'runas' verb to give it
elevated privileges.
Adds 272-288 bytes.
(GitHub issue #481)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Windows API strips trailing dots and spaces from the last
component of a path. cmd.exe handles this quirk when changing
directory by adjusting its idea of the current directory to match
reality. The shell in busybox-w32 didn't do this, leading to some
confusion.
Fix the shell's cd builtin so it works more like cmd.exe.
Adds 64-80 bytes.
(GitHub issue #478)
|
| |
| |
| |
| |
| |
| |
| |
| | |
Since we don't use is_in_supplementary_groups() there's no need for
the cached_groupinfo structure to include the members required for
its support or for them to be initialised.
Saves 32 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This allows to simplify "which" applet code
function old new delta
find_executable 93 111 +18
which_main 191 177 -14
builtin_source 316 294 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-36) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Recent upstream changes to file permission tests added a function
to check and cache values in the supplementary group list.
The implementation of getgroups() in the Windows port adds no
useful information beyond what can be obtained by checking the
current effective gid, which all callers of the new function
already do. The function can be replaced with a simple 'FALSE'.
Saves 232-288 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Testcase:
setuidgid 1:1 strace ash -c 'test -x TODO; test -x TODO; echo $?'
should show that second "test -x" does not query ids again.
function old new delta
ash_main 1236 1256 +20
get_cached_euid - 19 +19
get_cached_egid - 19 +19
test_main 56 72 +16
test_exec 119 135 +16
is_in_supplementary_groups 52 57 +5
nexpr 718 702 -16
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
test_main2 - 407 +407
testcmd 10 23 +13
test_main 418 56 -362
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 420/-362) Total: 58 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
is_in_supplementary_groups 54 52 -2
nexpr 721 718 -3
test_exec 125 119 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-11) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
is_in_supplementary_groups - 54 +54
nexpr 766 721 -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 54/-45) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
save_history 267 266 -1
hush_exit 98 97 -1
exitshell 140 138 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
With CONFIG_DEBUG_PESSIMIZE=y (-O0) the ffs intrinsic is left as a
function call, resulting in a linker error. The prefixed builtin is
generally part of the "GNU C" dialect and is usable in any "GNU C"
implementation, i.e. any compiler that defines __GNUC__. That includes
Clang, GCC, and more.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 4b7b4a960 (ash: optimise running of scripts) avoided creation
of a process when running a script. There's another case where we
can do the same: if the script is being run from a FS_SHELLEXEC
shell.
- Check the necessary conditions for this to happen.
- Allocate two extra slots in the argv array for FS_SHELLEXEC.
- Set the index of the script file in the argv array. Without this
the test 'pidof this' failed because the command name hadn't been
correctly set.
Adds 80-96 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The BusyBox shell detects certain cases where forking a command is
unnecessary (last command in a script or subshell, for example) and
calls execve(2) instead. This doesn't help in the Windows port
because execve(2) is implemented by creating a process.
There is one case where it is possible to apply this optimisation:
if the command is a script and the script interpreter is an applet.
- Have evalcommand() pass a flag to indicate this situation to
shellexec(). Also, allocate two spare elements before the start
of the argv array.
- If the flag is TRUE shellexec() passes the shell's PATH variable
down to tryexec() so it can perform a test for applet override.
- If tryexec() finds that all the necessary conditions apply it
can run a script by directly invoking the interpreter's main().
Adds 192-224 bytes.
|
| |
| |
| |
| |
| | |
Add the FAST_FUNC qualifier to several Windows-specific functions.
This has no effect in 64-bit builds but saves 336 bytes for 32-bit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid problems with dates in 2038 and beyond use 64-bit time
values on 32-bit platforms.
- Mostly this just requires a few preprocessor macros to choose
the appropriate functions, structs and typedefs.
- We have our own implementations of nanosleep(), clock_gettime()
and clock_settime(). Omit the Windows include file that declares
them.
- Apply the hack for struct timeval in the 'ts' applet on 32-bit.
Adds 1624 bytes on 32-bit, none on 64-bit.
(GitHub issue #446)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When privilege has been dropped by the 'drop' applet, the 'su'
applet is unable to raise it again because ShellExecuteEx()
thinks it unnecessary.
Detect this situation, report an error and return exit code 2.
Costs 72-112 bytes.
(GitHub issue #437)
|