aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ash: code clean upRon Yorston2018-12-031-6/+1
|
* ash: improvements to forkshell debugRon Yorston2018-12-031-5/+23
| | | | | | | | If forkshell_print is passed a NULL file pointer it opens and closes a local one. Add the pid to the output file name so forkshell_print can be called from both parent and child.
* ash: annotate pointers in forkshell debugRon Yorston2018-12-021-42/+130
| | | | | | | Add some text to indicate the purpose of each pointer in the forkshell data block. The code isn't very efficient but it's only used for debug.
* ash: redefine SAVE_PTR macros to remove testRon Yorston2018-12-021-2/+10
| | | | | | | | | | | The SAVE_PTR macros are used to identify pointers that need to be fixed after forkshell. They're initially used in contexts where the nodeptr variable may be NULL, so have a test for this condition. Later uses are in places where nodeptr is known to have a non-NULL value so the macros can be redefined to remove the test. Saves over 100 bytes.
* ash: consolidate tests for variables not to convertRon Yorston2018-11-291-8/+5
| | | | | | | We usually convert backslashes to slashes when importing environment variables into the shell. Exceptions are if the user has set the -X option, SYSTEMROOT and COMSPEC. Perform these tests all at once rather than separately.
* ash: fixes to spawn_forkshellRon Yorston2018-11-291-16/+10
| | | | | | | If spawn fails: - raise an error in spawn_forkshell, not at each call site; - free the job by calling freejob, not free.
* nologin: change defaultRon Yorston2018-11-291-1/+1
|
* Merge branch 'busybox' into mergeRon Yorston2018-11-2869-641/+2946
|\
| * testsuite: check CONFIG_DESKTOP before using 'od -t'Chen Qi2018-11-277-5/+7
| | | | | | | | | | | | | | | | The '-t' option for od is enabled by CONFIG_DESKTOP. So check this config before using 'od -t' in test cases. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: allow hush to run embedded scriptsRon Yorston2018-11-2710-32/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | Embedded scripts require a shell to be present in the BusyBox binary. Allow either ash or hush to be used for this purpose. If both are enabled ash takes precedence. The size of the binary is unchanged in the default configuration: both ash and hush are present but support for embedded scripts isn't compiled into hush. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * free: ensure there is a least one space between numbersDenys Vlasenko2018-11-271-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * docs: add embedded-scripts.txtRon Yorston2018-11-272-1/+117
| | | | | | | | | | Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: skip 'V' headers (GNU volume label), closes 11526Denys Vlasenko2018-11-271-1/+2
| | | | | | | | | | | | | | function old new delta get_header_tar 1696 1690 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * unlzma: fix too-eager corruption checkDenys Vlasenko2018-11-271-7/+13
| | | | | | | | | | | | | | function old new delta unpack_lzma_stream 2686 2674 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: fix too eager autodetection, closes 11531Denys Vlasenko2018-11-273-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta is_suffixed_with - 54 +54 tar_main 1006 1026 +20 open_transformer 92 79 -13 config_file_action 478 458 -20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 74/-33) Total: 41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * build system: prevent duplicate applet namesRon Yorston2018-11-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | The embedded script feature makes it easier to create applets with duplicate names. Currently in such cases the build succeeds but the resulting executable doesn't work as the developer intended. Catch duplicate names when the applet tables are being generated and make the build fail. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Tweaks to build process for embedded scriptsRon Yorston2018-11-275-23/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Force a rebuild if a script in applets_sh is changed. - Move the dummy usage messages for custom applets to usage.h and change the name from 'dummy' to 'scripted'. - Hide an error from gen_build_files.sh if an embed directory exists but is empty. - Tidy up embedded_scripts script. v2: Remove a couple of unnecessary tests in embedded_scripts, as pointed out by Xabier Oneca. Drop the stripping of comments. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add ECDHE_PSK and remove ARIA cipher idsDenys Vlasenko2018-11-271-8/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add _anon_ cipher definitionsDenys Vlasenko2018-11-261-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: enable TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 cipherDenys Vlasenko2018-11-261-29/+29
| | | | | | | | | | | | | | function old new delta static.ciphers 30 32 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: cipher 009D is not yet supported, don't test for itDenys Vlasenko2018-11-261-4/+3
| | | | | | | | | | | | | | function old new delta tls_handshake 2116 2108 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: speed up prf_hmac_sha256()Denys Vlasenko2018-11-261-40/+39
| | | | | | | | | | | | | | | | | | | | | | function old new delta hmac_sha_precomputed - 58 +58 prf_hmac_sha256 181 222 +41 hmac_sha256 68 - -68 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 99/-68) Total: 31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add comment on sha384Denys Vlasenko2018-11-261-0/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: simplify hmac_begin()Denys Vlasenko2018-11-261-11/+27
| | | | | | | | | | | | | | function old new delta hmac_begin 196 158 -38 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add support for 8 more cipher ids - all tested to workDenys Vlasenko2018-11-261-87/+117
| | | | | | | | | | | | | | | | | | | | function old new delta tls_handshake 2059 2116 +57 static.ciphers - 30 +30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 87/0) Total: 87 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix commentsDenys Vlasenko2018-11-251-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add a comment on expanding list of supported ciphersDenys Vlasenko2018-11-251-7/+30
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: do not leak RSA keyDenys Vlasenko2018-11-252-0/+13
| | | | | | | | | | | | | | function old new delta tls_handshake 1957 2059 +102 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-252-16/+12
| | | | | | | | | | | | | | | | function old new delta xwrite_and_update_handshake_hash 81 80 -1 tls_handshake 1987 1957 -30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-251-15/+16
| | | | | | | | | | | | | | function old new delta tls_handshake 1993 1987 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-252-6/+14
| | | | | | | | | | | | | | function old new delta aesgcm_GHASH 223 196 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: on x86, use xorbuf_aligned_AES_BLOCK_SIZE() even with non-aligned sourceDenys Vlasenko2018-11-251-2/+4
| | | | | | | | | | | | | | function old new delta aesgcm_GHASH 228 223 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: actually fill in CIPHER_ID3 value in hello messageDenys Vlasenko2018-11-251-5/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: do not SEGV on "-p keyno:192.168.1.1", show --help insteadDenys Vlasenko2018-11-251-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: code shrinkDenys Vlasenko2018-11-241-8/+6
| | | | | | | | | | | | | | function old new delta base64enc 53 46 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix is.gd again, fix AES-CBC using decrypt key instead of encryptDenys Vlasenko2018-11-241-5/+7
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: speed up xor'ing of aligned 16-byte buffersDenys Vlasenko2018-11-243-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta xorbuf_aligned_AES_BLOCK_SIZE - 23 +23 xwrite_encrypted 585 580 -5 aesgcm_GHASH 233 228 -5 GMULT 192 187 -5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 23/-15) Total: 8 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: in AES-GCM decoding, avoid memmoveDenys Vlasenko2018-11-244-15/+17
| | | | | | | | | | | | | | | | | | | | | | function old new delta xorbuf3 - 36 +36 xorbuf 24 12 -12 tls_xread_record 656 634 -22 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 36/-34) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix a thinko in GHASH optimizationDenys Vlasenko2018-11-241-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: make tls_get_random() FAST_FUNCDenys Vlasenko2018-11-232-2/+2
| | | | | | | | | | | | | | | | | | | | function old new delta tls_handshake 1977 1985 +8 tls_get_random 32 28 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-4) Total: 4 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: print the final newline only for non-tty outputDenys Vlasenko2018-11-233-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ busybox wget URL 2>&1 | cat Connecting to .... install.iso 0% | | 2629k 0:02:05 ETA install.iso 7% |** | 25.7M 0:00:23 ETA install.iso 16% |***** | 54.1M 0:00:14 ETA install.iso 20% |****** | 67.4M 0:00:15 ETA install.iso 25% |******** | 81.0M 0:00:14 ETA install.iso 30% |********* | 97.3M 0:00:13 ETA install.iso 36% |*********** | 117M 0:00:12 ETA install.iso 41% |************* | 134M 0:00:11 ETA install.iso 47% |*************** | 152M 0:00:10 ETA install.iso 54% |***************** | 176M 0:00:08 ETA install.iso 61% |******************* | 200M 0:00:06 ETA install.iso 66% |********************* | 215M 0:00:06 ETA install.iso 71% |********************** | 231M 0:00:05 ETA install.iso 75% |************************ | 244M 0:00:04 ETA install.iso 79% |************************* | 257M 0:00:03 ETA install.iso 84% |*************************** | 275M 0:00:02 ETA install.iso 91% |***************************** | 297M 0:00:01 ETA install.iso 99% |******************************* | 321M 0:00:00 ETA install.iso 100% |********************************| 323M 0:00:00 ETA <-- no empty line here $ function old new delta bb_progress_update 622 632 +10 progress_meter 152 158 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 16/0) Total: 16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-231-3/+4
| | | | | | | | | | | | | | function old new delta aesgcm_GHASH 262 233 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: typo fix in commentDenys Vlasenko2018-11-231-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: make local buffers in aesgcm_GHASH() explicitly 32-bit alignedDenys Vlasenko2018-11-231-9/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-232-15/+21
| | | | | | | | | | | | | | function old new delta xwrite_encrypted 599 585 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: simplify aesgcm_GHASH()Denys Vlasenko2018-11-233-47/+60
| | | | | | | | | | | | | | | | | | | | | | function old new delta xwrite_encrypted 604 599 -5 FlattenSzInBits 52 - -52 aesgcm_GHASH 395 262 -133 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-190) Total: -190 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: in AES-CBC code, do not set key for every record - do it onceDenys Vlasenko2018-11-235-32/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta aes_setkey 16 212 +196 tls_handshake 1941 1977 +36 aes_encrypt_1 382 396 +14 xwrite_encrypted 605 604 -1 tls_xread_record 659 656 -3 aes_encrypt_one_block 65 59 -6 aes_cbc_encrypt 172 121 -51 aesgcm_setkey 58 - -58 aes_cbc_decrypt 958 881 -77 KeyExpansion 188 - -188 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/5 up/down: 246/-384) Total: -138 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add support for TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipherDenys Vlasenko2018-11-2311-94/+480
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta xwrite_encrypted 209 605 +396 GHASH - 395 +395 aes_encrypt_1 - 382 +382 GMULT - 192 +192 tls_xread_record 489 659 +170 aes_encrypt_one_block - 65 +65 aesgcm_setkey - 58 +58 FlattenSzInBits - 52 +52 tls_handshake 1890 1941 +51 xwrite_and_update_handshake_hash 46 81 +35 xorbuf - 24 +24 aes_setkey - 16 +16 psRsaEncryptPub 413 421 +8 stty_main 1221 1227 +6 ssl_client_main 138 143 +5 next_token 841 845 +4 spawn_ssl_client 218 219 +1 volume_id_probe_hfs_hfsplus 564 563 -1 read_package_field 232 230 -2 i2cdetect_main 674 672 -2 fail_hunk 139 136 -3 parse_expr 891 883 -8 curve25519 802 793 -9 aes_cbc_decrypt 971 958 -13 xwrite_handshake_record 43 - -43 aes_cbc_encrypt 644 172 -472 ------------------------------------------------------------------------------ (add/remove: 9/1 grow/shrink: 9/8 up/down: 1860/-553) Total: 1307 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: reset tokpushback before prompting while parsing heredocChristoph Schulz2018-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser reads from an already freed memory location, thereby causing unpredictable results, in the following situation: - ENABLE_ASH_EXPAND_PRMT is enabled - heredoc is being parsed - command substitution is used within heredoc Examples where this bug crops up are (PS2 is set to "> "): $ cat <<EOF > `echo abc` > EOF -sh: O: not found $ cat <<EOF > $(echo abc) > EOF -sh: {garbage}: not found The presumable reason is that setprompt_if() causes a nested expansion when ENABLE_ASH_EXPAND_PRMT is enabled, therefore leaving "wordtext" in an unusable state. However, when parseheredoc() is called, "tokpushback" is non-zero, which causes the next call to xxreadtoken() to return TWORD, causing the caller to use the invalid "wordtoken" instead of reading the next valid token. The call chain is: list() -> peektoken() [sets tokpushback to 1] -> parseheredoc() -> setprompt_if() -> pushstackmark() -> expandstr() -> readtoken1() [sets lasttoken to TWORD, wordtoken points to expanded prompt] -> popstackmark() [invalidates wordtoken, leaves lasttoken as is] -> readtoken1() -> ...parsebackq -> list() -> andor() -> pipeline() -> readtoken() -> xxreadtoken() [tokpushback non-zero, reuse lasttoken and wordtext] Note that in almost all other contexts, each call to setprompt_if() is preceded by setting "tokpushback" to zero. One exception is "oldstyle" backquote parsing in readtoken1(), but there "tokpushback" is reset afterwards. The other exception is nlprompt(), but this function is only used within readtoken1() (but in contexts where no nested calls to xxreadtoken() occur) and xxreadtoken() (where "tokpushback" is guaranteed to be zero). function old new delta parseheredoc 124 131 +7 Signed-off-by: Christoph Schulz <develop@kristov.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * scripts/trylink: be more clever when deciding that "lib elimination" has ↵Denys Vlasenko2018-11-191-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | finished: Before: Trying libraries: crypt m resolv Library crypt is not needed, excluding it Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Final link with: m resolv After: Trying libraries: crypt m resolv Library crypt is not needed, excluding it Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Final link with: m resolv Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>