]> Git Repo - uclibc-ng.git/commitdiff
- make libcrypt optional. Untested.
authorBernhard Reutner-Fischer <[email protected]>
Thu, 5 Jun 2008 13:46:47 +0000 (13:46 -0000)
committerBernhard Reutner-Fischer <[email protected]>
Thu, 5 Jun 2008 13:46:47 +0000 (13:46 -0000)
Makefile.in
extra/Configs/Config.in
include/crypt.h
include/stdlib.h
include/unistd.h
libcrypt/Makefile.in
libcrypt/crypt_stub.c [new file with mode: 0644]

index 820d8fb687491ccd51c583873508955cace25501..8520186270a746cda0c577b5b46f961f9a2ee3ef 100644 (file)
@@ -278,6 +278,10 @@ ifneq ($(UCLIBC_HAS_SOCKET),y)
        $(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
index 006124eb2ed3d1ec8018f4194075d3a5230bd5c6..db2483e5f40383720d80d187c2ec705a158988ff 100644 (file)
@@ -910,6 +910,26 @@ config UCLIBC_HAS_PROFILING
          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
index f3fed7ca74b4f70b6b4e32fcb46b7851f60cba13..f62a030563a58d8827ad99a619363c6ab786c5ad 100644 (file)
@@ -27,14 +27,15 @@ __BEGIN_DECLS
 
 /* 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
 
index 354134906f0cf578292bca80d18327f6d0708951..0b44474803573d059b8e7d4e4de42b431a512574 100644 (file)
@@ -802,8 +802,10 @@ extern int getsubopt (char **__restrict __optionp,
 
 
 #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
 
 
index e0219e77019b5e3b7dbd80a3fdcfaca4da8376d4..58021a5e2af13b5ffdd9c115c3fb0a3ea3c318d6 100644 (file)
@@ -1077,6 +1077,7 @@ extern int fdatasync (int __fildes) __THROW;
 /* 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));
@@ -1084,6 +1085,7 @@ extern char *crypt (__const char *__key, __const char *__salt)
 /* 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
index 40a73d1c836dabd76be99eac38cd775740649b81..d93e6ababc0801988eaea47a66167cb5a79b39a2 100644 (file)
@@ -16,7 +16,14 @@ libcrypt_FULL_NAME := libcrypt-$(VERSION).so
 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)
@@ -26,8 +33,10 @@ libcrypt-a-y := $(libcrypt_OBJ)
 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)
diff --git a/libcrypt/crypt_stub.c b/libcrypt/crypt_stub.c
new file mode 100644 (file)
index 0000000..76645a0
--- /dev/null
@@ -0,0 +1,30 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * crypt() for uClibc
+ * Copyright (C) 2008 by Erik Andersen <[email protected]>
+ * 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);
+}
This page took 0.040484 seconds and 4 git commands to generate.