Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
libxcrypt
libxcrypt-3.0.4-blowfish-xcrypt.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxcrypt-3.0.4-blowfish-xcrypt.diff of Package libxcrypt
Index: crypt_blowfish-1.2/crypt_blowfish.c =================================================================== --- crypt_blowfish-1.2/crypt_blowfish.c.orig +++ crypt_blowfish-1.2/crypt_blowfish.c @@ -44,6 +44,7 @@ */ #include <string.h> +#include <stdio.h> #include <errno.h> #ifndef __set_errno @@ -64,6 +65,10 @@ #define BF_SCALE 0 #endif +#include "xcrypt-plugin.h" +#define _crypt_blowfish_rn __crypt_r +#include <dlfcn.h> + typedef unsigned int BF_word; typedef signed int BF_word_signed; @@ -900,3 +905,23 @@ char *_crypt_gensalt_blowfish_rn(const c return output; } + +/* dirty hack */ +static const char* _find_prefix(const char* prefix) +{ + Dl_info info; + if (dladdr(_find_prefix, &info) && strlen(info.dli_fname) > 8) + { + const char* sfx = info.dli_fname+strlen(info.dli_fname)-8; + if (!strncmp(sfx, "_2y.", 4)) + prefix = "$2y$"; + else if (!strncmp(sfx, "_2x.", 4)) + prefix = "$2x$"; + } + return prefix; +} + +char *__crypt_gensalt_r (unsigned long count, __const char *input, int size, char *output, int output_size) +{ + return _crypt_gensalt_blowfish_rn(_find_prefix("$2a$"), count, input, size, output, output_size); +} Index: crypt_blowfish-1.2/wrapper.c =================================================================== --- crypt_blowfish-1.2/wrapper.c.orig +++ crypt_blowfish-1.2/wrapper.c @@ -37,13 +37,19 @@ #define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1) #define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1) -#if defined(__GLIBC__) && defined(_LIBC) #define __SKIP_GNU -#endif +#include "xcrypt.h" +#include "xcrypt-plugin.h" #include "ow-crypt.h" #include "crypt_blowfish.h" +#ifndef XCRYPT #include "crypt_gensalt.h" +#else +#define _crypt_blowfish_rn __crypt_r +#undef crypt_r +char *crypt_r(const char *key, const char *setting, void *data); +#endif #if defined(__GLIBC__) && defined(_LIBC) /* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */ @@ -197,6 +203,7 @@ char *crypt(const char *key, const char #define __crypt_gensalt crypt_gensalt #endif +#ifndef XCRYPT char *__crypt_gensalt_rn(const char *prefix, unsigned long count, const char *input, int size, char *output, int output_size) { @@ -231,6 +238,13 @@ char *__crypt_gensalt_rn(const char *pre return use(prefix, count, input, size, output, output_size); } +#else +char *__crypt_gensalt_rn(const char *prefix __attribute__((unused)), unsigned long count, + const char *input, int size, char *output, int output_size) +{ + return __crypt_gensalt_r(count, input, size, output, output_size); +} +#endif char *__crypt_gensalt_ra(const char *prefix, unsigned long count, const char *input, int size) @@ -542,4 +556,21 @@ int main(void) return 0; } +#endif + +#ifdef XCRYPT +int _crypt_output_magic(const char *setting, char *output, int size) +{ + if (size < 3) + return -1; + + output[0] = '*'; + output[1] = '0'; + output[2] = '\0'; + + if (setting[0] == '*' && setting[1] == '0') + output[1] = '1'; + + return 0; +} #endif Index: plugins/blowfish/Makefile.am =================================================================== --- plugins/blowfish/Makefile.am.orig +++ plugins/blowfish/Makefile.am @@ -25,5 +25,5 @@ libxcrypt_2a_la_SOURCES = crypt_blowfish noinst_PROGRAMS = blowfish-test -blowfish_test_CFLAGS = $(AM_CFLAGS) -DTEST_THREADS=10 -blowfish_test_LDADD = libxcrypt_2a.la -lpthread +blowfish_test_CFLAGS = $(AM_CFLAGS) -DTEST -DTEST_THREADS=4 -DXCRYPT +blowfish_test_LDADD = libxcrypt_2a.la -ldl -lpthread
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor