$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/socket.h
$(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/socketvar.h
endif
+ifneq ($(UCLIBC_HAS_CRYPT),y)
+ # Remove crypt.h since libcrypt was disabled upon request
+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/crypt.h
+endif
# Installs development library links.
install_dev: install_headers
gcc's -finstrument-functions needs these.
Most people can safely answer N.
+
+config UCLIBC_HAS_CRYPT_IMPL
+ bool "libcrypt support"
+ default y
+ help
+ libcrypt contains crypt(), setkey() and encrypt()
+
+config UCLIBC_HAS_CRYPT_STUB
+ bool "libcrypt stubs"
+ default y
+ depends on !UCLIBC_HAS_CRYPT_IMPL
+ help
+ Standards mandate that crypt(3) provides a stub if it is unavailable.
+ If you enable this option then stubs for
+ crypt(), setkey() and encrypt()
+ will be provided in a small libcrypt.
+
+config UCLIBC_HAS_CRYPT
+ def_bool y
+ depends on UCLIBC_HAS_CRYPT_IMPL || UCLIBC_HAS_CRYPT_STUB
endmenu
menuconfig UCLIBC_HAS_NETWORK_SUPPORT
/* Encrypt characters from KEY using salt to perturb the encryption method.
* If salt begins with "$1$", MD5 hashing is used instead of DES. */
-extern char *crypt (const char *__key, const char *__salt);
+extern char *crypt (const char *__key, const char *__salt)
+ __THROW __nonnull ((1, 2));
/* Setup DES tables according KEY. */
-extern void setkey (const char *__key);
+extern void setkey (const char *__key) __THROW __nonnull ((1));
/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
block in place. */
-extern void encrypt (char *__block, int __edflag);
+extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
__END_DECLS
#ifdef __USE_XOPEN
+# if defined __UCLIBC_HAS_CRYPT__
/* Setup DES tables according KEY. */
extern void setkey (__const char *__key) __THROW __nonnull ((1));
+# endif /* __UCLIBC_HAS_CRYPT__ */
#endif
/* XPG4.2 specifies that prototypes for the encryption functions must
be defined here. */
#ifdef __USE_XOPEN
+# if defined __UCLIBC_HAS_CRYPT__
/* Encrypt at most 8 characters from KEY using salt to perturb DES. */
extern char *crypt (__const char *__key, __const char *__salt)
__THROW __nonnull ((1, 2));
/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
block in place. */
extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
+# endif /* __UCLIBC_HAS_CRYPT__ */
/* Swab pairs bytes in the first N bytes of the area pointed to by
libcrypt_DIR := $(top_srcdir)libcrypt
libcrypt_OUT := $(top_builddir)libcrypt
-libcrypt_SRC := $(wildcard $(libcrypt_DIR)/*.c)
+ifeq ($(UCLIBC_HAS_CRYPT_IMPL),y)
+CSRC := crypt.c des.c md5.c
+endif
+ifeq ($(UCLIBC_HAS_CRYPT_STUB),y)
+CSRC := crypt_stub.c
+endif
+
+libcrypt_SRC := $(addprefix $(libcrypt_DIR)/,$(CSRC))
libcrypt_OBJ := $(patsubst $(libcrypt_DIR)/%.c,$(libcrypt_OUT)/%.o,$(libcrypt_SRC))
ifeq ($(DOPIC),y)
endif
libcrypt-so-y := $(libcrypt_OBJ:.o=.os)
+ifeq ($(UCLIBC_HAS_CRYPT),y)
lib-a-y += $(top_builddir)lib/libcrypt.a
lib-so-y += $(top_builddir)lib/libcrypt.so
+endif
objclean-y += libcrypt_clean
ifeq ($(DOMULTI),n)
--- /dev/null
+/* vi: set sw=4 ts=4: */
+/*
+ * crypt() for uClibc
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define __FORCE_GLIBC
+#include <crypt.h>
+#include <unistd.h>
+#include "libcrypt.h"
+#include <syscall.h>
+
+char *crypt(const char *key attribute_unused, const char *salt attribute_unused)
+{
+ __set_errno(ENOSYS);
+ return NULL;
+}
+
+void
+setkey(const char *key attribute_unused)
+{
+ __set_errno(ENOSYS);
+}
+
+void
+encrypt(char *block attribute_unused, int flag attribute_unused)
+{
+ __set_errno(ENOSYS);
+}