svn commit: trunk/uClibc: extra/Configs include libcrypt
aldot at uclibc.org
aldot at uclibc.org
Thu Jun 5 13:46:48 UTC 2008
Author: aldot
Date: 2008-06-05 06:46:47 -0700 (Thu, 05 Jun 2008)
New Revision: 22235
Log:
- make libcrypt optional. Untested.
Added:
trunk/uClibc/libcrypt/crypt_stub.c
Modified:
trunk/uClibc/Makefile.in
trunk/uClibc/extra/Configs/Config.in
trunk/uClibc/include/crypt.h
trunk/uClibc/include/stdlib.h
trunk/uClibc/include/unistd.h
trunk/uClibc/libcrypt/Makefile.in
Changeset:
Modified: trunk/uClibc/Makefile.in
===================================================================
--- trunk/uClibc/Makefile.in 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/Makefile.in 2008-06-05 13:46:47 UTC (rev 22235)
@@ -278,6 +278,10 @@
$(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
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/extra/Configs/Config.in 2008-06-05 13:46:47 UTC (rev 22235)
@@ -910,6 +910,26 @@
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
Modified: trunk/uClibc/include/crypt.h
===================================================================
--- trunk/uClibc/include/crypt.h 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/include/crypt.h 2008-06-05 13:46:47 UTC (rev 22235)
@@ -27,14 +27,15 @@
/* 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
Modified: trunk/uClibc/include/stdlib.h
===================================================================
--- trunk/uClibc/include/stdlib.h 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/include/stdlib.h 2008-06-05 13:46:47 UTC (rev 22235)
@@ -802,8 +802,10 @@
#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
Modified: trunk/uClibc/include/unistd.h
===================================================================
--- trunk/uClibc/include/unistd.h 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/include/unistd.h 2008-06-05 13:46:47 UTC (rev 22235)
@@ -1077,6 +1077,7 @@
/* 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 @@
/* 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
Modified: trunk/uClibc/libcrypt/Makefile.in
===================================================================
--- trunk/uClibc/libcrypt/Makefile.in 2008-06-05 13:33:59 UTC (rev 22234)
+++ trunk/uClibc/libcrypt/Makefile.in 2008-06-05 13:46:47 UTC (rev 22235)
@@ -16,7 +16,14 @@
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 @@
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)
Added: trunk/uClibc/libcrypt/crypt_stub.c
===================================================================
--- trunk/uClibc/libcrypt/crypt_stub.c (rev 0)
+++ trunk/uClibc/libcrypt/crypt_stub.c 2008-06-05 13:46:47 UTC (rev 22235)
@@ -0,0 +1,30 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * crypt() for uClibc
+ * Copyright (C) 2008 by Erik Andersen <andersen at uclibc.org>
+ * 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);
+}
More information about the uClibc-cvs
mailing list