Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 24 Jul 2011 03:01:25 -0500
From: "JFoug" <jfoug@....net>
To: <john-dev@...ts.openwall.com>
Subject: Re: Plugin formats "released"

----- Original Message ----- 
From: "Solar Designer" <solar@...nwall.com>


> I did not understand the rationale behind some of:
>
> # Should work on Solaris and gmake
> PLUGFORMATS_SRCS: sh =if [ -f *_plug.c ]; then ls *_plug.c; fi
> PLUGFORMATS_SRCS += $(shell ls *_plug.c)
> PLUGFORMATS_OBJS = $(PLUGFORMATS_SRCS:.c=.o)
>
> So I simplified it to:
>
> # Requires GNU make (under Solaris, use "gmake")
> PLUGFORMATS_SRCS = $(wildcard *_plug.c)
> PLUGFORMATS_OBJS = $(PLUGFORMATS_SRCS:.c=.o)

As magnum has pointed out, you have gone back to his original gmake 
compatible version.

the line:
PLUGFORMATS_SRCS: sh =if [ -f *_plug.c ]; then ls *_plug.c; fi
is a no-op on gmake.  However, on solaris make, it builds a list of all 
*_plug.c files
PLUGFORMATS_SRCS += $(shell ls *_plug.c)
is a no-op on solaris make, but fills in the *_plug.c files on gmake (it is 
older syntax for gmake, but works fine).

The PLUGFORMATS_SRCS = $(wildcard *_plug.c)   simply fails to run at all on 
solaris, the make process dies here.

The $(shell ls *_plug.c) appears like it was 'supposed' to work for solaris, 
and some documentation magnum found listed it also, however, it did not 
work.  I found the sh =if.....fi on  a solaris forum, and that was the only 
way we were able to get it to work, for that make.

That was our reasoning behind it.  It had been working flawlessly on Linux 
(or apparently any gmake), openbsd, freebsd, solaris, etc.


> Then, I did not like the grep|sed|awk commands, which I simplified to
> single invocations of sed:
>
> fmt_externs.h: $(PLUGFORMATS_SRCS) Makefile
> $(SED) -n 's/^\(struct fmt_main [^ ]\+\) =.*/extern \1;/p' *_fmt_plug.c > 
> fmt_externs.h
>
> fmt_registers.h: $(PLUGFORMATS_SRCS) Makefile
> $(SED) -n 's/^struct fmt_main \([^ ]\+\) =.*/john_register_one(\&\1);/p' 
> *_fmt_plug.c > fmt_registers.h
>
> john.o: john.c fmt_externs.h fmt_registers.h
> $(CC) $(CFLAGS) $(OPT_NORMAL) john.c

Simpiler, but the older method also put a comment on each line, listing what 
file contained the format structure.  That was nice for editors which have 
click/open capability.  Those were nice files to have open, you could get to 
any plugin format .C file easily.

Here is old, here is new:

/* BFEgg_fmt_plug.c       */ extern struct fmt_main fmt_BFEgg;
/* DMD5_fmt_plug.c        */ extern struct fmt_main fmt_DMD5;
/* DOMINOSEC_fmt_plug.c   */ extern struct fmt_main fmt_DOMINOSEC;
/* EPI_fmt_plug.c         */ extern struct fmt_main fmt_EPI;
/* HDAA_fmt_plug.c        */ extern struct fmt_main fmt_HDAA;
/* IPB2_fmt_plug.c        */ extern struct fmt_main fmt_IPB2;
/* KRB4_fmt_plug.c        */ extern struct fmt_main fmt_KRB4;

here is new:

extern struct fmt_main fmt_BFEgg;
extern struct fmt_main fmt_DMD5;
extern struct fmt_main fmt_DOMINOSEC;
extern struct fmt_main fmt_EPI;
extern struct fmt_main fmt_HDAA;
extern struct fmt_main fmt_IPB2;
extern struct fmt_main fmt_KRB4; 

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.