X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fpw_encrypt.c;h=469e71f6ccdc9606a8f895d9db2d07127a17419f;hb=08ea11ab0749a7977e6d47cd0fa7b3c9cc10af32;hp=762cbab27ab001ea498b8d5792242beebe31ecac;hpb=fdddab0c61c55c25d4218d4370e2b16a7936a794;p=oweals%2Fbusybox.git diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c index 762cbab27..469e71f6c 100644 --- a/libbb/pw_encrypt.c +++ b/libbb/pw_encrypt.c @@ -9,13 +9,11 @@ #include "libbb.h" +#if ENABLE_USE_BB_CRYPT + /* * DES and MD5 crypt implementations are taken from uclibc. * They were modified to not use static buffers. - * Comparison with uclibc (before uclibc had 70k staic buffers reinstated): - * text data bss dec hex filename - * 759909 604 6684 767197 bb4dd busybox_old - * 759579 604 6684 766867 bb393 busybox_unstripped */ /* Common for them */ static const uint8_t ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -52,7 +50,7 @@ static void my_crypt_cleanup(void) des_ctx = NULL; } -char *pw_encrypt(const char *clear, const char *salt, int cleanup) +char* FAST_FUNC pw_encrypt(const char *clear, const char *salt, int cleanup) { char *encrypted; @@ -69,3 +67,18 @@ char *pw_encrypt(const char *clear, const char *salt, int cleanup) return encrypted; } + +#else /* if !ENABLE_USE_BB_CRYPT */ + +char* FAST_FUNC pw_encrypt(const char *clear, const char *salt, int cleanup) +{ +#if 0 /* was CONFIG_FEATURE_SHA1_PASSWORDS, but there is no such thing??? */ + if (strncmp(salt, "$2$", 3) == 0) { + return xstrdup(sha1_crypt(clear)); + } +#endif + + return xstrdup(crypt(clear, salt)); +} + +#endif