[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r9264 - in /trunk/libc: ChangeLog.eglibc crypt/Makefile crypt/crypt-entry.c option-groups.def option-groups.defaults
- To: commits@xxxxxxxxxx
- Subject: [commits] r9264 - in /trunk/libc: ChangeLog.eglibc crypt/Makefile crypt/crypt-entry.c option-groups.def option-groups.defaults
- From: maxim@xxxxxxxxxx
- Date: Mon, 16 Nov 2009 09:22:44 -0000
Author: maxim
Date: Mon Nov 16 01:22:44 2009
New Revision: 9264
Log:
OPTION_EGLIBC_CRYPT and OPTION_EGLIBC_CRYPT_UFC.
* option-groups.def: Describe new option groups.
* option-groups.defaults: Set defaults.
* crypt/Makefile: Don't build libcrypt if OPTION_EGLIBC_CRYPT is not
selected, don't compile UFC implementation if OPTION_EGLIBC_CRYPT_UFC
is not selected; adjust tests accordingly.
* crypt/crypt-entry.c: Include <gnu/option-groups.h> and <errno.h>.
(__crypt_r, crypt): Handle OPTION_EGLIBC_CRYPT_UFC, fail if DES
is not available.
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/crypt/Makefile
trunk/libc/crypt/crypt-entry.c
trunk/libc/option-groups.def
trunk/libc/option-groups.defaults
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Mon Nov 16 01:22:44 2009
@@ -1,3 +1,16 @@
+2009-11-16 Maxim Kuvyrkov <maxim@xxxxxxxxxxxxxxxx>
+
+ OPTION_EGLIBC_CRYPT and OPTION_EGLIBC_CRYPT_UFC.
+
+ * option-groups.def: Describe new option groups.
+ * option-groups.defaults: Set defaults.
+ * crypt/Makefile: Don't build libcrypt if OPTION_EGLIBC_CRYPT is not
+ selected, don't compile UFC implementation if OPTION_EGLIBC_CRYPT_UFC
+ is not selected; adjust tests accordingly.
+ * crypt/crypt-entry.c: Include <gnu/option-groups.h> and <errno.h>.
+ (__crypt_r, crypt): Handle OPTION_EGLIBC_CRYPT_UFC, fail if DES
+ is not available.
+
2009-11-16 Maxim Kuvyrkov <maxim@xxxxxxxxxxxxxxxx>
OPTION_EGLIBC_INET_ANL
Modified: trunk/libc/crypt/Makefile
==============================================================================
--- trunk/libc/crypt/Makefile (original)
+++ trunk/libc/crypt/Makefile Mon Nov 16 01:22:44 2009
@@ -19,24 +19,28 @@
#
# Sub-makefile for crypt() portion of the library.
#
+include ../option-groups.mak
+
subdir := crypt
headers := crypt.h
-extra-libs := libcrypt
-extra-libs-others := $(extra-libs)
+extra-libs-$(OPTION_EGLIBC_CRYPT) := libcrypt
+extra-libs-others-y := $(extra-libs-y)
-libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
- crypt_util
+libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt
+libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt_util crypt
+libcrypt-routines += $(libcrypt-routines-y)
-tests := cert md5c-test sha256c-test sha512c-test
+tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test
+tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
distribute := ufc-crypt.h crypt-private.h ufc.c speeds.c README.ufc-crypt \
Banner md5.h sha256.h sha512.h
include ../Makeconfig
-ifeq ($(crypt-in-libc),yes)
+ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy)
routines += $(libcrypt-routines)
endif
@@ -48,7 +52,7 @@
else
libcrypt-routines += md5 sha256 sha512
-tests += md5test sha256test sha512test
+tests-$(OPTION_EGLIBC_CRYPT) += md5test sha256test sha512test
$(objpfx)md5test: $(objpfx)md5.o
$(objpfx)sha256test: $(objpfx)sha256.o
@@ -57,6 +61,7 @@
include ../Rules
+ifeq ($(OPTION_EGLIBC_CRYPT),y)
ifeq (yes,$(build-shared))
$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
else
@@ -65,6 +70,7 @@
ifeq (yes,$(build-bounded))
$(tests:%=$(objpfx)%-bp): $(objpfx)libcrypt_b.a
endif
+endif # eglibc: OPTION_EGLIBC_CRYPT
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This ensures they will load libc.so for needed symbols if loaded by
Modified: trunk/libc/crypt/crypt-entry.c
==============================================================================
--- trunk/libc/crypt/crypt-entry.c (original)
+++ trunk/libc/crypt/crypt-entry.c Mon Nov 16 01:22:44 2009
@@ -28,6 +28,8 @@
#include <stdio.h>
#endif
#include <string.h>
+#include <gnu/option-groups.h>
+#include <errno.h>
#ifndef STATIC
#define STATIC static
@@ -87,9 +89,11 @@
const char *salt;
struct crypt_data * __restrict data;
{
+#if __OPTION_EGLIBC_CRYPT_UFC
ufc_long res[4];
char ktab[9];
ufc_long xx = 25; /* to cope with GCC long long compiler bugs */
+#endif /*__OPTION_EGLIBC_CRYPT_UFC*/
#ifdef _LIBC
/* Try to find out whether we have to use MD5 encryption replacement. */
@@ -108,6 +112,7 @@
sizeof (struct crypt_data));
#endif
+#if __OPTION_EGLIBC_CRYPT_UFC
/*
* Hack DES tables according to salt
*/
@@ -136,6 +141,10 @@
*/
_ufc_output_conversion_r (res[0], res[1], salt, data);
return data->crypt_3_buf;
+#else /* __OPTION_EGLIBC_CRYPT_UFC */
+ __set_errno (ENOSYS);
+ return NULL;
+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
}
weak_alias (__crypt_r, crypt_r)
@@ -158,7 +167,12 @@
return __sha512_crypt (key, salt);
#endif
+#if __OPTION_EGLIBC_CRYPT_UFC
return __crypt_r (key, salt, &_ufc_foobar);
+#else /* __OPTION_EGLIBC_CRYPT_UFC */
+ __set_errno (ENOSYS);
+ return NULL;
+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
}
Modified: trunk/libc/option-groups.def
==============================================================================
--- trunk/libc/option-groups.def (original)
+++ trunk/libc/option-groups.def Mon Nov 16 01:22:44 2009
@@ -197,6 +197,24 @@
WCHAR_T - EGLIBC's internal form (target-endian,
32-bit ISO 10646)
+
+config OPTION_EGLIBC_CRYPT
+ bool "Encryption library"
+ help
+ This option group includes the `libcrypt' library which
+ provides functions for one-way encryption. Supported
+ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
+
+config OPTION_EGLIBC_CRYPT_UFC
+ bool "Ultra fast `crypt' implementation"
+ depends OPTION_EGLIBC_CRYPT
+ help
+ This option group provides ultra fast DES-based implementation of
+ the `crypt' function. When this option group is disabled,
+ (a) the library will not provide the setkey[_r] and encrypt[_r]
+ functions and (b) the crypt[_r] function will return NULL and set the
+ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
+ SHA-256 or SHA-512 algorithm.
config OPTION_EGLIBC_DB_ALIASES
bool "Functions for accessing the mail aliases database"
Modified: trunk/libc/option-groups.defaults
==============================================================================
--- trunk/libc/option-groups.defaults (original)
+++ trunk/libc/option-groups.defaults Mon Nov 16 01:22:44 2009
@@ -15,6 +15,8 @@
OPTION_EGLIBC_CXX_TESTS = y
OPTION_EGLIBC_CATGETS = y
OPTION_EGLIBC_CHARSETS = y
+OPTION_EGLIBC_CRYPT = y
+OPTION_EGLIBC_CRYPT_UFC = y
OPTION_EGLIBC_DB_ALIASES = y
OPTION_EGLIBC_ENVZ = y
OPTION_EGLIBC_FCVT = y