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.
This commit is contained in:
Denis Vlasenko
2008-06-12 16:55:59 +00:00
parent 9de4622055
commit 4ea83bf562
10 changed files with 1458 additions and 26 deletions

View File

@ -1032,8 +1032,19 @@ extern int restricted_shell(const char *shell);
extern void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw);
extern int correct_password(const struct passwd *pw);
/* Returns a ptr to static storage */
extern char *pw_encrypt(const char *clear, const char *salt);
extern char *pw_encrypt(const char *clear, const char *salt, int cleanup);
extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
/* rnd is additional random input. New one is returned.
* Useful if you call crypt_make_salt many times in a row:
* rnd = crypt_make_salt(buf1, 4, 0);
* rnd = crypt_make_salt(buf2, 4, rnd);
* rnd = crypt_make_salt(buf3, 4, rnd);
* (otherwise we risk having same salt generated)
*/
extern int crypt_make_salt(char *p, int cnt, int rnd);
/* Returns number of lines changed, or -1 on error */
extern int update_passwd(const char *filename, const char *username,
const char *new_pw);
int index_in_str_array(const char *const string_array[], const char *key);
int index_in_strings(const char *strings, const char *key);
@ -1044,19 +1055,6 @@ const char *nth_string(const char *strings, int n);
extern void print_login_issue(const char *issue_file, const char *tty);
extern void print_login_prompt(void);
/* rnd is additional random input. New one is returned.
* Useful if you call crypt_make_salt many times in a row:
* rnd = crypt_make_salt(buf1, 4, 0);
* rnd = crypt_make_salt(buf2, 4, rnd);
* rnd = crypt_make_salt(buf3, 4, rnd);
* (otherwise we risk having same salt generated)
*/
extern int crypt_make_salt(char *p, int cnt, int rnd);
/* Returns number of lines changed, or -1 on error */
extern int update_passwd(const char *filename, const char *username,
const char *new_pw);
/* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */
int get_terminal_width_height(int fd, unsigned *width, unsigned *height);