components/pwgen/patches/02-use_libmd_sha1.patch
changeset 1600 936fff797203
child 5841 97e8c4dc6a82
equal deleted inserted replaced
1599:3587e9951696 1600:936fff797203
       
     1 Developed in-house, not fed back - can't submit new issue
       
     2  - community seems dead.
       
     3 Solaris specific: uses internal implementation of SHA1
       
     4 
       
     5 --- pwgen-2.06/sha1num.c	2013-11-25 12:09:31.359377740 -0800
       
     6 +++ pwgen-2.06/sha1num.c	2013-11-25 12:09:26.489379943 -0800
       
     7 @@ -11,7 +11,16 @@
       
     8  #include <stdio.h>
       
     9  #include <stdlib.h>
       
    10  #include "pwgen.h"
       
    11 +#ifdef SHA_INTERNAL
       
    12  #include "sha1.h"
       
    13 +#endif
       
    14 +#ifdef SHA_SOLARIS
       
    15 +#include <sha1.h>
       
    16 +#define sha1_context SHA1_CTX
       
    17 +#define sha1_starts SHA1Init
       
    18 +#define sha1_update SHA1Update
       
    19 +#define sha1_finish(a,b) SHA1Final(b,a)
       
    20 +#endif
       
    21  
       
    22  sha1_context sha1_ctx;
       
    23  char *sha1_seed;
       
    24 --- pwgen-2.06/configure.in	2013-12-02 02:57:12.022589524 -0800
       
    25 +++ pwgen-2.06/configure.in	2013-12-02 02:56:10.404769485 -0800
       
    26 @@ -8,4 +8,23 @@
       
    27  AC_PATH_PROG(PERL, perl, perl)
       
    28  AC_CHECK_FUNCS(drand48 getopt_long)
       
    29  AC_CHECK_HEADERS(getopt.h)
       
    30 +pwgen_sha="internal"
       
    31 +SHA_OBJ=""
       
    32 +SHA_SRC=""
       
    33 +SHA_LIB=""
       
    34 +SHA_HEAD=""
       
    35 +AC_CHECK_LIB(md, SHA1Init, [pwgen_sha="solaris"])
       
    36 +if test x"$pwgen_sha" = x"internal" ; then
       
    37 +	CFLAGS="${CFLAGS} -DSHA_INTERNAL"
       
    38 +	SHA_OBJ="sha1.o"
       
    39 +	SHA_SRC="sha1.c"
       
    40 +	SHA_HEAD="sha1.h"
       
    41 +elif test x"$pwgen_sha" = x"solaris" ; then
       
    42 +	SHA_LIB="-lmd"
       
    43 +	CFLAGS="${CFLAGS} -DSHA_SOLARIS"
       
    44 +fi
       
    45 +AC_SUBST(SHA_OBJ)
       
    46 +AC_SUBST(SHA_SRC)
       
    47 +AC_SUBST(SHA_LIB)
       
    48 +AC_SUBST(SHA_HEAD)
       
    49  AC_OUTPUT(Makefile)
       
    50 --- pwgen-2.06/Makefile.in	2013-12-02 03:52:49.960581781 -0800
       
    51 +++ pwgen-2.06/Makefile.in	2013-12-02 03:52:25.323489891 -0800
       
    52 @@ -19,7 +19,7 @@
       
    53  CFLAGS = @CFLAGS@ $(WALL_OPTS)
       
    54  CPPFLAGS = @CPPFLAGS@
       
    55  ALL_CFLAGS = $(CPPFLAGS) $(DEFS) $(USE_WFLAGS) $(CFLAGS) $(XTRA_CFLAGS) 
       
    56 -LDFLAGS = @LDFLAGS@
       
    57 +LDFLAGS = @LDFLAGS@ @SHA_LIB@
       
    58  RM = @RM@
       
    59  MV = @MV@
       
    60  SED = @SED@
       
    61 @@ -31,9 +31,9 @@
       
    62  .c.o:
       
    63  	$(CC) -c $(ALL_CFLAGS) $< -o $@
       
    64  
       
    65 -OBJS= pwgen.o pw_phonemes.o pw_rand.o randnum.o sha1.o sha1num.o
       
    66 +OBJS= pwgen.o pw_phonemes.o pw_rand.o randnum.o @SHA_OBJ@ sha1num.o
       
    67  
       
    68 -SRCS= pwgen.c pw_phonemes.c pw_rand.c randnum.c sha1.c sha1num.c
       
    69 +SRCS= pwgen.c pw_phonemes.c pw_rand.c randnum.c @SHA_SRC@ sha1num.c
       
    70  
       
    71  
       
    72  pwgen: $(OBJS)
       
    73 @@ -127,4 +127,4 @@
       
    74  pw_rand.o: pw_rand.c pwgen.h
       
    75  randnum.o: randnum.c pwgen.h
       
    76  sha1.o: sha1.c sha1.h 
       
    77 -sha1num.o: sha1num.c sha1.h pwgen.h
       
    78 +sha1num.o: sha1num.c @SHA_HEAD@ pwgen.h