Commit Graph

12 Commits

Author SHA1 Message Date
Denys Vlasenko
73d93d9f83 libbb: make pw_encrypt() die if supplied salt is bad (e.g. emply)
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>
2020-12-15 23:19:22 +01:00
Denys Vlasenko
965b795b87 decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
text	   data	    bss	    dec	    hex	filename
1021988	    559	   5052	1027599	  fae0f	busybox_old
1021236	    559	   5052	1026847	  fab1f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 13:03:03 +01:00
Denys Vlasenko
95f7953f2c do not use `a' quoting style in comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-02 14:26:33 +02:00
Denys Vlasenko
44d1989997 des encrypt: fix goof with NUL byte added at the end as '.' 2009-05-01 03:41:25 +02:00
Denis Vlasenko
d1a84a2880 libbb: move crypt_make_salt() to pw_encrypt.c, reuse
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
2008-12-07 01:16:34 +00:00
Denis Vlasenko
d324e1b808 libbb/crypt: code shrink
function                                             old     new   delta
to64_msb_first                                         -      63     +63
des_crypt                                           1509    1338    -171
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 63/-171)          Total: -108 bytes
2008-12-04 15:29:35 +00:00
Denis Vlasenko
f45c4f41b7 whitespace and comment fixes, no code changes 2008-06-16 04:09:25 +00:00
Denis Vlasenko
5cdc247ba4 further encrypt_des optimizations
function                                             old     new   delta
pw_encrypt                                           943     964     +21
des_crypt                                           1512    1509      -3
u_sbox                                               512     256    -256
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 21/-259)          Total: -238 bytes
2008-06-15 09:48:18 +00:00
Denis Vlasenko
04087c6bbd cryptpw: fix "cryptpw -a des -- TEXT" case
libbb/pw_encrypt_des.c: optimize

function                                             old     new   delta
cryptpw_main                                         177     157     -20
des_crypt                                           1682    1512    -170
pw_encrypt                                          1036     842    -194
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-384)           Total: -384 bytes

Run tested.
2008-06-15 08:12:00 +00:00
Denis Vlasenko
e235285c3a crypt: code shrink
function                                             old     new   delta
des_crypt                                              -    1682   +1682
md5_crypt                                              -     627    +627
pw_encrypt                                          3608    1036   -2572
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 2309/-2572)       Total: -263 bytes
2008-06-14 22:11:29 +00:00
Denis Vlasenko
76f812803b trivial crypt shrinkage
function                                             old     new   delta
__md5_to64                                            27      29      +2
pw_encrypt                                          3631    3608     -23
2008-06-13 15:13:41 +00:00
Denis Vlasenko
4ea83bf562 uclibc insists on having 70k static buffer for crypt.
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.
2008-06-12 16:55:59 +00:00