#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";
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;
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