diff options
Diffstat (limited to 'moon-abe/cpabe-0.11')
93 files changed, 13969 insertions, 0 deletions
diff --git a/moon-abe/cpabe-0.11/COPYING b/moon-abe/cpabe-0.11/COPYING new file mode 100644 index 00000000..5a965fbc --- /dev/null +++ b/moon-abe/cpabe-0.11/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/moon-abe/cpabe-0.11/INSTALL b/moon-abe/cpabe-0.11/INSTALL new file mode 100644 index 00000000..b282039e --- /dev/null +++ b/moon-abe/cpabe-0.11/INSTALL @@ -0,0 +1,222 @@ +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PREFIX', the package will +use PREFIX as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/moon-abe/cpabe-0.11/Makefile b/moon-abe/cpabe-0.11/Makefile new file mode 100644 index 00000000..d62f6df5 --- /dev/null +++ b/moon-abe/cpabe-0.11/Makefile @@ -0,0 +1,134 @@ +top_srcdir = . +prefix = /usr/local +exec_prefix = ${prefix} +bindir = ${exec_prefix}/bin +mandir = ${prefix}/share/man + +CC = gcc +CFLAGS = -O3 -Wall \ + -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include \ + \ + -I/usr/include/pbc -I/usr/local/include/pbc \ + \ + -DPACKAGE_NAME=\"cpabe\" -DPACKAGE_TARNAME=\"cpabe\" -DPACKAGE_VERSION=\"0.11\" -DPACKAGE_STRING=\"cpabe\ 0.11\" -DPACKAGE_BUGREPORT=\"bethenco@cs.berkeley.edu\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_VPRINTF=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBCRYPTO=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_MEMSET=1 -DHAVE_GMP=1 -DHAVE_PBC=1 -DHAVE_BSWABE=1 +LDFLAGS = -O3 -Wall \ + -L/usr/local/lib -lglib-2.0 \ + -Wl,-rpath /usr/local/lib -lpbc \ + -lbswabe \ + -Wl,-rpath /usr/local/lib -lgmp \ + -lcrypto -lcrypto + +DISTNAME = cpabe-0.11 + +TARGETS = cpabe-setup cpabe-enc cpabe-keygen cpabe-dec cpabe-policyList cpabe-attrList peks-ind peks-test peks-trap +DEVTARGS = test-lang TAGS + +MANUALS = $(TARGETS:=.1) +HTMLMANS = $(MANUALS:.1=.html) + +all: $(TARGETS) $(DEVTARGS) + +# user-level compilation + +cpabe-setup: setup.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-enc: enc.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-keygen: keygen.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-dec: dec.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-policyList: policyList.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-attrList: attrList.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-ind: ind.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-test: indTest.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-trap: trap.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +test-lang: test-lang.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +%.o: %.c *.h Makefile + $(CC) -c -o $@ $< $(CFLAGS) + +# installation + +dist: *.y policy_lang.c *.c *.h *.more-man \ + AUTHORS COPYING INSTALL NEWS README $(MANUALS) \ + aclocal.m4 acinclude.m4 configure configure.ac install-sh Makefile.in \ + missing mkinstalldirs + rm -rf $(DISTNAME) + mkdir $(DISTNAME) + cp $^ $(DISTNAME) + tar zc $(DISTNAME) > $(DISTNAME).tar.gz + rm -rf $(DISTNAME) + +install: $(TARGETS) $(MANUALS) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(bindir) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(mandir) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(mandir)/man1 + for PROG in $(TARGETS); \ + do \ + $(top_srcdir)/install-sh -m 755 $$PROG $(DESTDIR)$(bindir); \ + $(top_srcdir)/install-sh -m 644 $$PROG.1 $(DESTDIR)$(mandir)/man1; \ + done + +uninstall: + for PROG in $(TARGETS); \ + do \ + /bin/rm -f $(DESTDIR)$(bindir)/$$PROG; \ + /bin/rm -f $(DESTDIR)$(mandir)/man1/$$PROG.1; \ + done + +# developer-level processing and meta stuff + +%.c: %.y *.h Makefile + if which bison 2> /dev/null; then \ + bison -o $@ $<; \ + fi + +%.1: % %.more-man + if which help2man 2> /dev/null; then \ + help2man --section=1 --source="SRI International" --no-info \ + -I $<.more-man -o $@ ./$<; \ + fi + +%.html: %.1 + groff -man -Thtml $< > $@ + +html: $(HTMLMANS) + +TAGS: *.c *.h *.y + @(etags $^ || true) 2> /dev/null + +Makefile: Makefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck + +configure: configure.ac aclocal.m4 acinclude.m4 + autoconf + +# cleanup + +# remove everything an installing user can rebuild +clean: + rm -f *.o $(TARGETS) $(DEVTARGS) *.tar.gz pub_key master_key priv_key enc_ind *~ + +# remove everything a package developer can rebuild +distclean: clean + rm -rf policy_lang.c autom4te.cache Makefile config.status config.log config.cache \ + configure configure.scan autoscan*.log *.1 *.html *.lineno diff --git a/moon-abe/cpabe-0.11/Makefile.in b/moon-abe/cpabe-0.11/Makefile.in new file mode 100644 index 00000000..84161f59 --- /dev/null +++ b/moon-abe/cpabe-0.11/Makefile.in @@ -0,0 +1,134 @@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ + +CC = @CC@ +CFLAGS = @CFLAGS@ \ + @GLIB_CFLAGS@ \ + @GMP_CFLAGS@ \ + @PBC_CFLAGS@ \ + @BSWABE_CFLAGS@ \ + @DEFS@ +LDFLAGS = @LDFLAGS@ \ + @GLIB_LIBS@ \ + @PBC_LIBS@ \ + @BSWABE_LIBS@ \ + @GMP_LIBS@ \ + @LIBS@ + +DISTNAME = @PACKAGE_TARNAME@-@PACKAGE_VERSION@ + +TARGETS = cpabe-setup cpabe-enc cpabe-keygen cpabe-dec cpabe-policyList cpabe-attrList peks-ind peks-test peks-trap +DEVTARGS = test-lang TAGS + +MANUALS = $(TARGETS:=.1) +HTMLMANS = $(MANUALS:.1=.html) + +all: $(TARGETS) $(DEVTARGS) + +# user-level compilation + +cpabe-setup: setup.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-enc: enc.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-keygen: keygen.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-dec: dec.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-policyList: policyList.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +cpabe-attrList: attrList.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-ind: ind.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-test: indTest.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +peks-trap: trap.o common.o + $(CC) -o $@ $^ $(LDFLAGS) + +test-lang: test-lang.o common.o policy_lang.o + $(CC) -o $@ $^ $(LDFLAGS) + +%.o: %.c *.h Makefile + $(CC) -c -o $@ $< $(CFLAGS) + +# installation + +dist: *.y policy_lang.c *.c *.h *.more-man \ + AUTHORS COPYING INSTALL NEWS README $(MANUALS) \ + aclocal.m4 acinclude.m4 configure configure.ac install-sh Makefile.in \ + missing mkinstalldirs + rm -rf $(DISTNAME) + mkdir $(DISTNAME) + cp $^ $(DISTNAME) + tar zc $(DISTNAME) > $(DISTNAME).tar.gz + rm -rf $(DISTNAME) + +install: $(TARGETS) $(MANUALS) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(bindir) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(mandir) + $(top_srcdir)/mkinstalldirs -m 755 $(DESTDIR)$(mandir)/man1 + for PROG in $(TARGETS); \ + do \ + $(top_srcdir)/install-sh -m 755 $$PROG $(DESTDIR)$(bindir); \ + $(top_srcdir)/install-sh -m 644 $$PROG.1 $(DESTDIR)$(mandir)/man1; \ + done + +uninstall: + for PROG in $(TARGETS); \ + do \ + /bin/rm -f $(DESTDIR)$(bindir)/$$PROG; \ + /bin/rm -f $(DESTDIR)$(mandir)/man1/$$PROG.1; \ + done + +# developer-level processing and meta stuff + +%.c: %.y *.h Makefile + if which bison 2> /dev/null; then \ + bison -o $@ $<; \ + fi + +%.1: % %.more-man + if which help2man 2> /dev/null; then \ + help2man --section=1 --source="SRI International" --no-info \ + -I $<.more-man -o $@ ./$<; \ + fi + +%.html: %.1 + groff -man -Thtml $< > $@ + +html: $(HTMLMANS) + +TAGS: *.c *.h *.y + @(etags $^ || true) 2> /dev/null + +Makefile: Makefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck + +configure: configure.ac aclocal.m4 acinclude.m4 + autoconf + +# cleanup + +# remove everything an installing user can rebuild +clean: + rm -f *.o $(TARGETS) $(DEVTARGS) *.tar.gz pub_key master_key priv_key enc_ind *~ + +# remove everything a package developer can rebuild +distclean: clean + rm -rf policy_lang.c autom4te.cache Makefile config.status config.log config.cache \ + configure configure.scan autoscan*.log *.1 *.html *.lineno diff --git a/moon-abe/cpabe-0.11/README b/moon-abe/cpabe-0.11/README new file mode 100644 index 00000000..39bc4b5a --- /dev/null +++ b/moon-abe/cpabe-0.11/README @@ -0,0 +1,15 @@ +This software provides several tools implementing a scheme for +"ciphertext-policy attribute based encryption" (CP-ABE). + +To install this software, you will need to have the Pairing-Based +Cryptography (PBC) library installed. You can get it from the +following page: + + http://crypto.stanford.edu/pbc/ + +For more information on CP-ABE and a tutorial on using the tools, see +the project homepage: + + http://acsc.csl.sri.com/cpabe/ + +make LDFLAGS=" -lpbc -lcrypto -L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lbswabe -lgmp" diff --git a/moon-abe/cpabe-0.11/acinclude.m4 b/moon-abe/cpabe-0.11/acinclude.m4 new file mode 100644 index 00000000..13ed28d4 --- /dev/null +++ b/moon-abe/cpabe-0.11/acinclude.m4 @@ -0,0 +1,235 @@ +dnl Check for GNU MP (at least version 4.0) and set GMP_CFLAGS and +dnl GMP_LIBS appropriately. + +AC_DEFUN([GMP_4_0_CHECK], +[ + +AC_MSG_CHECKING(for GMP version >= 4.0.0 or later) + +AC_ARG_WITH( + gmp-include, + AC_HELP_STRING( + [--with-gmp-include=DIR], + [look for the header gmp.h in DIR rather than the default search path]), + [GMP_CFLAGS="-I$withval"], [GMP_CFLAGS=""]) + +AC_ARG_WITH( + gmp-lib, + AC_HELP_STRING([--with-gmp-lib=DIR], + [look for libgmp.so in DIR rather than the default search path]), + [ + case $withval in + /* ) true;; + * ) AC_MSG_ERROR([ + +You must specify an absolute path for --with-gmp-lib. +]) ;; + esac + GMP_LIBS="-L$withval -Wl,-rpath $withval -Wl,-rpath /usr/local/lib -lgmp" + ], [GMP_LIBS="-Wl,-rpath /usr/local/lib -lgmp"]) + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${GMP_CFLAGS}" +LIBS="${LIBS} ${GMP_LIBS}" + +AC_TRY_LINK( + [#include <gmp.h>], + [mpz_t a; mpz_init (a);], + [ + AC_TRY_RUN( + [ +#include <gmp.h> +int main() { if (__GNU_MP_VERSION < 4) return -1; else return 0; } +], + [ + AC_MSG_RESULT(found) + AC_SUBST(GMP_CFLAGS) + AC_SUBST(GMP_LIBS) + AC_DEFINE(HAVE_GMP,1,[Defined if GMP is installed]) + ], + [ + AC_MSG_RESULT(old version) + AC_MSG_ERROR([ + +Your version of the GNU Multiple Precision library (libgmp) is too +old! Please install a more recent version from http://gmplib.org/ and +try again. If more than one version is installed, try specifying a +particular version with + + ./configure --with-gmp-include=DIR --with-gmp-lib=DIR + +See ./configure --help for more information. +]) + ]) + ], + [ + AC_MSG_RESULT(not found) + AC_MSG_ERROR([ + +The GNU Multiple Precision library (libgmp) was not found on your +system! Please obtain it from http://gmplib.org/ and install it before +trying again. If libgmp is already installed in a non-standard +location, try again with + + ./configure --with-gmp-include=DIR --with-gmp-lib=DIR + +If you already specified those arguments, double check that gmp.h can +be found in the first path and libgmp.a can be found in the second. + +See ./configure --help for more information. +]) + ]) + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + +]) + +dnl Check for libpbc and set PBC_CFLAGS and PBC_LIBS +dnl appropriately. + +AC_DEFUN([PBC_CHECK], +[ + +AC_MSG_CHECKING(for the PBC library) + +AC_ARG_WITH( + pbc-include, + AC_HELP_STRING( + [--with-pbc-include=DIR], + [look for the header pbc.h in DIR rather than the default search path]), + [PBC_CFLAGS="-I$withval"], [PBC_CFLAGS="-I/usr/include/pbc -I/usr/local/include/pbc"]) + +AC_ARG_WITH( + pbc-lib, + AC_HELP_STRING( + [--with-pbc-lib=DIR], + [look for libpbc.so in DIR rather than the default search path]), + [ + case $withval in + /* ) true;; + * ) AC_MSG_ERROR([ + +You must specify an absolute path for --with-pbc-lib. +]) ;; + esac + PBC_LIBS="-L$withval -Wl,-rpath $withval -Wl,-rpath /usr/local/lib -lpbc" + ], [PBC_LIBS="-Wl,-rpath /usr/local/lib -lpbc"]) + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${PBC_CFLAGS} ${GMP_CFLAGS}" +LIBS="${LIBS} ${PBC_LIBS} ${GMP_LIBS}" + +AC_TRY_LINK( + [#include <pbc.h>], + [pairing_t p; pairing_init_set_buf(p, "", 0);], + [ + AC_MSG_RESULT(found) + AC_SUBST(PBC_CFLAGS) + AC_SUBST(PBC_LIBS) + AC_DEFINE(HAVE_PBC,1,[Defined if PBC is installed]) + ], + [ + AC_MSG_RESULT(not found) + AC_MSG_ERROR([ + +The PBC library was not found on your system! Please obtain it from + + http://crypto.stanford.edu/pbc/ + +and install it before trying again. If libpbc is already +installed in a non-standard location, try again with + + ./configure --with-pbc-include=DIR --with-pbc-lib=DIR + +If you already specified those arguments, double check that pbc.h can +be found in the first path and libpbc.a can be found in the second. + +See ./configure --help for more information. +]) + ]) + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + +]) + +dnl Check for libbswabe and set BSWABE_CFLAGS and BSWABE_LIBS +dnl appropriately. + +AC_DEFUN([BSWABE_CHECK], +[ + +AC_MSG_CHECKING(for libbswabe) + +AC_ARG_WITH( + bswabe-include, + AC_HELP_STRING( + [--with-bswabe-include=DIR], + [look for the header bswabe.h in DIR rather than the default search path]), + [BSWABE_CFLAGS="-I$withval"], [BSWABE_CFLAGS=""]) + +AC_ARG_WITH( + bswabe-lib, + AC_HELP_STRING( + [--with-bswabe-lib=DIR], + [look for libbswabe.a in DIR rather than the default search path]), + [ + case $withval in + /* ) true;; + * ) AC_MSG_ERROR([ + +You must specify an absolute path for --with-bswabe-lib. +]) ;; + esac + BSWABE_LIBS="-L$withval -lbswabe" + ], [BSWABE_LIBS="-lbswabe"]) + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${BSWABE_CFLAGS} ${PBC_CFLAGS} ${GMP_CFLAGS} ${GLIB_CFLAGS}" +LIBS="${LIBS} ${BSWABE_LIBS} ${PBC_LIBS} ${GMP_LIBS} ${GLIB_LIBS}" + +AC_TRY_LINK( + [#include <glib.h> + #include <pbc.h> + #include <bswabe.h>], + [bswabe_pub_t* p; + bswabe_pub_free(p);], + [ + AC_MSG_RESULT(found) + AC_SUBST(BSWABE_CFLAGS) + AC_SUBST(BSWABE_LIBS) + AC_DEFINE(HAVE_BSWABE,1,[Defined if libbswabe is installed]) + ], + [ + AC_MSG_RESULT(not found) + AC_MSG_ERROR([ + +The library libbswabe was not found on your system! Please obtain it +from + + http://acsc.csl.sri.com/cpabe/ + +and install it before trying again. If libbswabe is already +installed in a non-standard location, try again with + + ./configure --with-bswabe-include=<path> --with-bswabe-lib=<path> + +If you already specified those arguments, double check that bswabe.h +can be found in the first path and libbswabe.a can be found in the +second. + +See ./configure --help for more information. +]) + ]) + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + +]) diff --git a/moon-abe/cpabe-0.11/aclocal.m4 b/moon-abe/cpabe-0.11/aclocal.m4 new file mode 100644 index 00000000..b4c5ec12 --- /dev/null +++ b/moon-abe/cpabe-0.11/aclocal.m4 @@ -0,0 +1,230 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Configure paths for GLIB +# Owen Taylor 1997-2001 + +dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +dnl gthread is specified in MODULES, pass to pkg-config +dnl +AC_DEFUN([AM_PATH_GLIB_2_0], +[dnl +dnl Get the cflags and libraries from pkg-config +dnl +AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], + , enable_glibtest=yes) + + pkg_config_args=glib-2.0 + for module in . $4 + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + no_glib="" + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + else + no_glib=yes + fi + + min_glib_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" +dnl +dnl Now check if the installed GLIB is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent) +dnl + rm -f conf.glibtest + AC_TRY_RUN([ +#include <glib.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + AC_TRY_LINK([ +#include <glib.h> +#include <stdio.h> +], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_GENMARSHAL) + AC_SUBST(GOBJECT_QUERY) + AC_SUBST(GLIB_MKENUMS) + rm -f conf.glibtest +]) + +m4_include([acinclude.m4]) diff --git a/moon-abe/cpabe-0.11/attrList.c b/moon-abe/cpabe-0.11/attrList.c new file mode 100644 index 00000000..1d514493 --- /dev/null +++ b/moon-abe/cpabe-0.11/attrList.c @@ -0,0 +1,82 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" + +char* usage = +"Usage: cpabe-attrList [OPTION ...] PUB_KEY PRV_KEY\n" +"\n" +"Print the attributes of a private key PRV_KEY\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n"; + +char* pub_file = 0; +char* prv_file = 0; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-setup"); + exit(0); + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !prv_file ) + { + prv_file = argv[i]; + } + else + die(usage); +} + +int +main( int argc, char** argv ) +{ + + bswabe_prv_t* prv; + bswabe_pub_t* pub; + char** attrList; + int i; + + parse_args(argc, argv); + + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + prv = bswabe_prv_unserialize(pub, suck_file(prv_file), 1); + + attrList = bswabe_attrList(prv); + + i = 0; + + while(attrList[i]) + { + printf("%s ",attrList[i]); + i++; + } + printf("\n"); + return 0; +} diff --git a/moon-abe/cpabe-0.11/attrList.o b/moon-abe/cpabe-0.11/attrList.o Binary files differnew file mode 100644 index 00000000..e52cd850 --- /dev/null +++ b/moon-abe/cpabe-0.11/attrList.o diff --git a/moon-abe/cpabe-0.11/benchmark.c.old b/moon-abe/cpabe-0.11/benchmark.c.old new file mode 100644 index 00000000..e9f04630 --- /dev/null +++ b/moon-abe/cpabe-0.11/benchmark.c.old @@ -0,0 +1,112 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> +#include "bswabe.h" +#include "common.h" +#include <sys/time.h> +#include <sys/resource.h> + +char* usage = +"Usage: cpabe-setup [OPTION ...]\n" +"\n" +"Generate system parameters, a public key, and a master secret key\n" +"for use with cpabe-keygen, cpabe-enc, and cpabe-dec.\n" +"\n" +"Output will be written to the files \"pub_key\" and \"master_key\"\n" +"unless the --output-public-key or --output-master-key options are\n" +"used.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -p, --output-public-key FILE write public key to FILE\n\n" +" -m, --output-master-key FILE write master secret key to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n" +""; + +char* pub_file = "pub_key"; +char* msk_file = "master_key"; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-setup"); + exit(0); + } + else if( !strcmp(argv[i], "-p") || !strcmp(argv[i], "--output-public-key") ) + { + if( ++i >= argc ) + die(usage); + else + pub_file = argv[i]; + } + else if( !strcmp(argv[i], "-m") || !strcmp(argv[i], "--output-master-key") ) + { + if( ++i >= argc ) + die(usage); + else + msk_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else + die(usage); +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_msk_t* msk; + + parse_args(argc, argv); + + bswabe_setup(&pub, &msk); + spit_file(pub_file, bswabe_pub_serialize(pub), 1); + spit_file(msk_file, bswabe_msk_serialize(msk), 1); + +// Benchmark +/* +{ + double get_time() + { + struct timeval t; + struct timezone tzp; + gettimeofday(&t, &tzp); + return t.tv_sec + t.tv_usec*1e-6; + } + + int i; + int n = 100; + double ttotal = 0.0; + for (i = 0; i < n; i++) { + + double t0 = get_time(); + bswabe_setup(&pub, &msk); + double t1 = get_time(); + ttotal += t1 - t0; + } + + printf("average setup time (pub key and master key generation) = %f s\n", ttotal / n); + +} +*/ + return 0; +} diff --git a/moon-abe/cpabe-0.11/common.c b/moon-abe/cpabe-0.11/common.c new file mode 100644 index 00000000..ee40c809 --- /dev/null +++ b/moon-abe/cpabe-0.11/common.c @@ -0,0 +1,257 @@ +#include <stdio.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <assert.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <glib.h> +#include <openssl/aes.h> +#include <openssl/sha.h> +#include <pbc.h> + +#include "common.h" + +void +init_aes( element_t k, int enc, AES_KEY* key, unsigned char* iv ) +{ + int key_len; + unsigned char* key_buf; + + key_len = element_length_in_bytes(k) < 17 ? 17 : element_length_in_bytes(k); + key_buf = (unsigned char*) malloc(key_len); + element_to_bytes(key_buf, k); + + if( enc ) + AES_set_encrypt_key(key_buf + 1, 128, key); + else + AES_set_decrypt_key(key_buf + 1, 128, key); + free(key_buf); + + memset(iv, 0, 16); +} + +GByteArray* +aes_128_cbc_encrypt( GByteArray* pt, element_t k ) +{ + AES_KEY key; + unsigned char iv[16]; + GByteArray* ct; + guint8 len[4]; + guint8 zero; + + init_aes(k, 1, &key, iv); + + /* TODO make less crufty */ + + /* stuff in real length (big endian) before padding */ + len[0] = (pt->len & 0xff000000)>>24; + len[1] = (pt->len & 0xff0000)>>16; + len[2] = (pt->len & 0xff00)>>8; + len[3] = (pt->len & 0xff)>>0; + g_byte_array_prepend(pt, len, 4); + + /* pad out to multiple of 128 bit (16 byte) blocks */ + zero = 0; + while( pt->len % 16 ) + g_byte_array_append(pt, &zero, 1); + + ct = g_byte_array_new(); + g_byte_array_set_size(ct, pt->len); + + AES_cbc_encrypt(pt->data, ct->data, pt->len, &key, iv, AES_ENCRYPT); + + return ct; +} + +GByteArray* +aes_128_cbc_decrypt( GByteArray* ct, element_t k ) +{ + AES_KEY key; + unsigned char iv[16]; + GByteArray* pt; + unsigned int len; + + init_aes(k, 0, &key, iv); + + pt = g_byte_array_new(); + g_byte_array_set_size(pt, ct->len); + + AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT); + + /* TODO make less crufty */ + + /* get real length */ + len = 0; + len = len + | ((pt->data[0])<<24) | ((pt->data[1])<<16) + | ((pt->data[2])<<8) | ((pt->data[3])<<0); + g_byte_array_remove_index(pt, 0); + g_byte_array_remove_index(pt, 0); + g_byte_array_remove_index(pt, 0); + g_byte_array_remove_index(pt, 0); + + /* truncate any garbage from the padding */ + g_byte_array_set_size(pt, len); + + return pt; +} + +FILE* +fopen_read_or_die( char* file ) +{ + FILE* f; + + if( !(f = fopen(file, "r")) ) + die("can't read file: %s\n", file); + + return f; +} + +FILE* +fopen_write_or_die( char* file ) +{ + FILE* f; + + if( !(f = fopen(file, "w")) ) + die("can't write file: %s\n", file); + + return f; +} + +GByteArray* +suck_file( char* file ) +{ + FILE* f; + GByteArray* a; + struct stat s; + + a = g_byte_array_new(); + stat(file, &s); + g_byte_array_set_size(a, s.st_size); + + f = fopen_read_or_die(file); + fread(a->data, 1, s.st_size, f); + fclose(f); + + return a; +} + +char* +suck_file_str( char* file ) +{ + GByteArray* a; + char* s; + unsigned char zero; + + a = suck_file(file); + zero = 0; + g_byte_array_append(a, &zero, 1); + s = (char*) a->data; + g_byte_array_free(a, 0); + + return s; +} + +char* +suck_stdin() +{ + GString* s; + char* r; + int c; + + s = g_string_new(""); + while( (c = fgetc(stdin)) != EOF ) + g_string_append_c(s, c); + + r = s->str; + g_string_free(s, 0); + + return r; +} + +void +spit_file( char* file, GByteArray* b, int free ) +{ + FILE* f; + + f = fopen_write_or_die(file); + fwrite(b->data, 1, b->len, f); + fclose(f); + + if( free ) + g_byte_array_free(b, 1); +} + +void read_cpabe_file( char* file, GByteArray** cph_buf, + int* file_len, GByteArray** aes_buf ) +{ + FILE* f; + int i; + int len; + + *cph_buf = g_byte_array_new(); + *aes_buf = g_byte_array_new(); + + f = fopen_read_or_die(file); + + /* read real file len as 32-bit big endian int */ + *file_len = 0; + for( i = 3; i >= 0; i-- ) + *file_len |= fgetc(f)<<(i*8); + + /* read aes buf */ + len = 0; + for( i = 3; i >= 0; i-- ) + len |= fgetc(f)<<(i*8); + g_byte_array_set_size(*aes_buf, len); + fread((*aes_buf)->data, 1, len, f); + + /* read cph buf */ + len = 0; + for( i = 3; i >= 0; i-- ) + len |= fgetc(f)<<(i*8); + g_byte_array_set_size(*cph_buf, len); + fread((*cph_buf)->data, 1, len, f); + + fclose(f); +} + +void +write_cpabe_file( char* file, GByteArray* cph_buf, + int file_len, GByteArray* aes_buf ) +{ + FILE* f; + int i; + + f = fopen_write_or_die(file); + + /* write real file len as 32-bit big endian int */ + for( i = 3; i >= 0; i-- ) + fputc((file_len & 0xff<<(i*8))>>(i*8), f); + + /* write aes_buf */ + for( i = 3; i >= 0; i-- ) + fputc((aes_buf->len & 0xff<<(i*8))>>(i*8), f); + fwrite(aes_buf->data, 1, aes_buf->len, f); + + /* write cph_buf */ + for( i = 3; i >= 0; i-- ) + fputc((cph_buf->len & 0xff<<(i*8))>>(i*8), f); + fwrite(cph_buf->data, 1, cph_buf->len, f); + + fclose(f); +} + +void +die(char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + exit(1); +} diff --git a/moon-abe/cpabe-0.11/common.h b/moon-abe/cpabe-0.11/common.h new file mode 100644 index 00000000..246b65f7 --- /dev/null +++ b/moon-abe/cpabe-0.11/common.h @@ -0,0 +1,36 @@ +/* + Include glib.h and pbc.h before including this file. + + This contains data structures and procedures common throughout the + tools. +*/ + +/* + TODO if ssl sha1 not available, use built in one (sha1.c) +*/ + +char* suck_file_str( char* file ); +char* suck_stdin(); +GByteArray* suck_file( char* file ); + +void spit_file( char* file, GByteArray* b, int free ); + +void read_cpabe_file( char* file, GByteArray** cph_buf, + int* file_len, GByteArray** aes_buf ); + +void write_cpabe_file( char* file, GByteArray* cph_buf, + int file_len, GByteArray* aes_buf ); + +void die(char* fmt, ...); + +GByteArray* aes_128_cbc_encrypt( GByteArray* pt, element_t k ); +GByteArray* aes_128_cbc_decrypt( GByteArray* ct, element_t k ); + +#define CPABE_VERSION PACKAGE_NAME "%s " PACKAGE_VERSION "\n" \ +"\n" \ +"Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International.\n" \ +"This is free software released under the GPL, see the source for copying\n" \ +"conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS\n" \ +"FOR A PARTICULAR PURPOSE.\n" \ +"\n" \ +"Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>.\n" diff --git a/moon-abe/cpabe-0.11/common.o b/moon-abe/cpabe-0.11/common.o Binary files differnew file mode 100644 index 00000000..4ab2ac11 --- /dev/null +++ b/moon-abe/cpabe-0.11/common.o diff --git a/moon-abe/cpabe-0.11/config.status b/moon-abe/cpabe-0.11/config.status new file mode 100644 index 00000000..bf9fa81f --- /dev/null +++ b/moon-abe/cpabe-0.11/config.status @@ -0,0 +1,914 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=${CONFIG_SHELL-/bin/bash} +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cpabe $as_me 0.11, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile" + +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bethenco@cs.berkeley.edu>." + +ac_cs_config="" +ac_cs_version="\ +cpabe config.status 0.11 +configured by ./configure, generated by GNU Autoconf 2.67, + with options \"$ac_cs_config\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/michel/Documents/Pro/POC/cpabe-0.11' +srcdir='.' +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + set X '/bin/bash' './configure' $ac_configure_extra_args --no-create --no-recursion + shift + $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 + CONFIG_SHELL='/bin/bash' + export CONFIG_SHELL + exec "$@" +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +cat >>"$tmp/subs1.awk" <<\_ACAWK && +S["LTLIBOBJS"]="" +S["BSWABE_LIBS"]="-lbswabe" +S["BSWABE_CFLAGS"]="" +S["PBC_LIBS"]="-Wl,-rpath /usr/local/lib -lpbc" +S["PBC_CFLAGS"]="-I/usr/include/pbc -I/usr/local/include/pbc" +S["GMP_LIBS"]="-Wl,-rpath /usr/local/lib -lgmp" +S["GMP_CFLAGS"]="" +S["GLIB_MKENUMS"]="glib-mkenums" +S["GOBJECT_QUERY"]="gobject-query" +S["GLIB_GENMARSHAL"]="glib-genmarshal" +S["GLIB_LIBS"]="-L/usr/local/lib -lglib-2.0 " +S["GLIB_CFLAGS"]="-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include " +S["PKG_CONFIG"]="/usr/bin/pkg-config" +S["LIBOBJS"]="" +S["EGREP"]="/bin/grep -E" +S["GREP"]="/bin/grep" +S["CPP"]="gcc -E" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="-O3 -Wall" +S["CFLAGS"]="-O3 -Wall" +S["CC"]="gcc" +S["YFLAGS"]="" +S["YACC"]="bison -y" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="-lcrypto -lcrypto " +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DPACKAGE_NAME=\\\"cpabe\\\" -DPACKAGE_TARNAME=\\\"cpabe\\\" -DPACKAGE_VERSION=\\\"0.11\\\" -DPACKAGE_STRING=\\\"cpabe\\ 0.11\\\" -DPACKAGE_BUGREPORT=\\\"bethenco@cs.b"\ +"erkeley.edu\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DH"\ +"AVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STRING_H=1 -DHAVE"\ +"_STDLIB_H=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_VPRINTF=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBCRYPTO=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1"\ +" -DHAVE_MEMSET=1 -DHAVE_GMP=1 -DHAVE_PBC=1 -DHAVE_BSWABE=1" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="" +S["PACKAGE_BUGREPORT"]="bethenco@cs.berkeley.edu" +S["PACKAGE_STRING"]="cpabe 0.11" +S["PACKAGE_VERSION"]="0.11" +S["PACKAGE_TARNAME"]="cpabe" +S["PACKAGE_NAME"]="cpabe" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/bash" +_ACAWK +cat >>"$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 diff --git a/moon-abe/cpabe-0.11/configure b/moon-abe/cpabe-0.11/configure new file mode 100644 index 00000000..747f4beb --- /dev/null +++ b/moon-abe/cpabe-0.11/configure @@ -0,0 +1,5769 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67 for cpabe 0.11. +# +# Report bugs to <bethenco@cs.berkeley.edu>. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: bethenco@cs.berkeley.edu about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='cpabe' +PACKAGE_TARNAME='cpabe' +PACKAGE_VERSION='0.11' +PACKAGE_STRING='cpabe 0.11' +PACKAGE_BUGREPORT='bethenco@cs.berkeley.edu' +PACKAGE_URL='' + +ac_unique_file="common.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='LTLIBOBJS +BSWABE_LIBS +BSWABE_CFLAGS +PBC_LIBS +PBC_CFLAGS +GMP_LIBS +GMP_CFLAGS +GLIB_MKENUMS +GOBJECT_QUERY +GLIB_GENMARSHAL +GLIB_LIBS +GLIB_CFLAGS +PKG_CONFIG +LIBOBJS +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +YFLAGS +YACC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_debug +enable_glibtest +with_gmp_include +with_gmp_lib +with_pbc_include +with_pbc_lib +with_bswabe_include +with_bswabe_lib +' + ac_precious_vars='build_alias +host_alias +target_alias +YACC +YFLAGS +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures cpabe 0.11 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/cpabe] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cpabe 0.11:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-debug=no/yes turn on debugging + default=$debug_default + --disable-glibtest do not try to compile and run a test GLIB program + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gmp-include=DIR look for the header gmp.h in DIR rather than the + default search path + --with-gmp-lib=DIR look for libgmp.so in DIR rather than the default + search path + --with-pbc-include=DIR look for the header pbc.h in DIR rather than the + default search path + --with-pbc-lib=DIR look for libpbc.so in DIR rather than the default + search path + --with-bswabe-include=DIR + look for the header bswabe.h in DIR rather than the + default search path + --with-bswabe-lib=DIR look for libbswabe.a in DIR rather than the default + search path + +Some influential environment variables: + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <bethenco@cs.berkeley.edu>. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +cpabe configure 0.11 +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_find_uintX_t + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------------- ## +## Report this to bethenco@cs.berkeley.edu ## +## --------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cpabe $as_me 0.11, which was +generated by GNU Autoconf 2.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debugging" >&5 +$as_echo_n "checking whether to enable debugging... " >&6; } +debug_default="no" +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +else + enable_debug=$debug_default +fi + +if test "x$enable_debug" = "xyes"; then + CFLAGS="-g -Wall" + LDFLAGS="-g -Wall" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + CFLAGS="-O3 -Wall" + LDFLAGS="-O3 -Wall" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_YACC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_YACC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +$as_echo "$YACC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT32_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT64_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +for ac_header in fcntl.h stddef.h string.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "could not find all required headers fcntl.h, stddef.h, string.h" "$LINENO" 5 +fi + +done + + +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_malloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include <stdlib.h> +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +$as_echo "#define malloc rpl_malloc" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 +$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + if test "$cross_compiling" = yes; then : + ac_cv_func_lstat_dereferences_slashed_symlink=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + /* Linux will dereference the symlink and fail, as required by POSIX. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_lstat_dereferences_slashed_symlink=yes +else + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + +if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then + case " $LIBOBJS " in + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" + ;; +esac + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 +$as_echo_n "checking whether stat accepts an empty string... " >&6; } +if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_stat_empty_string_bug=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + return stat ("", &sbuf) == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_stat_empty_string_bug=no +else + ac_cv_func_stat_empty_string_bug=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 +$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } +if test $ac_cv_func_stat_empty_string_bug = yes; then + case " $LIBOBJS " in + *" stat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS stat.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define HAVE_STAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + +for ac_func in vprintf +do : + ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" +if test "x$ac_cv_func_vprintf" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VPRINTF 1 +_ACEOF + +ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = x""yes; then : + +$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h + +fi + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA1 in -lcrypto" >&5 +$as_echo_n "checking for SHA1 in -lcrypto... " >&6; } +if test "${ac_cv_lib_crypto_SHA1+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char SHA1 (); +int +main () +{ +return SHA1 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_SHA1=yes +else + ac_cv_lib_crypto_SHA1=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_SHA1" >&5 +$as_echo "$ac_cv_lib_crypto_SHA1" >&6; } +if test "x$ac_cv_lib_crypto_SHA1" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +else + as_fn_error $? "please install the OpenSSL crypto library, libcrypto." "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_aes_128_cbc in -lcrypto" >&5 +$as_echo_n "checking for EVP_aes_128_cbc in -lcrypto... " >&6; } +if test "${ac_cv_lib_crypto_EVP_aes_128_cbc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char EVP_aes_128_cbc (); +int +main () +{ +return EVP_aes_128_cbc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_EVP_aes_128_cbc=yes +else + ac_cv_lib_crypto_EVP_aes_128_cbc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_aes_128_cbc" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_aes_128_cbc" >&6; } +if test "x$ac_cv_lib_crypto_EVP_aes_128_cbc" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +else + as_fn_error $? "please install the OpenSSL crypto library, libcrypto." "$LINENO" 5 +fi + +for ac_func in strchr strdup memset +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "could not link to required functions strchr, strdup, memset" "$LINENO" 5 +fi +done + + +# Check whether --enable-glibtest was given. +if test "${enable_glibtest+set}" = set; then : + enableval=$enable_glibtest; +else + enable_glibtest=yes +fi + + + pkg_config_args=glib-2.0 + for module in . + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + no_glib="" + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + else + no_glib=yes + fi + + min_glib_version=2.0.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 +$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" + rm -f conf.glibtest + if test "$cross_compiling" = yes; then : + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <glib.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + no_glib=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; } + : + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <glib.h> +#include <stdio.h> + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed." +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + : + fi + + + + + + rm -f conf.glibtest + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP version >= 4.0.0 or later" >&5 +$as_echo_n "checking for GMP version >= 4.0.0 or later... " >&6; } + + +# Check whether --with-gmp-include was given. +if test "${with_gmp_include+set}" = set; then : + withval=$with_gmp_include; GMP_CFLAGS="-I$withval" +else + GMP_CFLAGS="" +fi + + + +# Check whether --with-gmp-lib was given. +if test "${with_gmp_lib+set}" = set; then : + withval=$with_gmp_lib; + case $withval in + /* ) true;; + * ) as_fn_error $? " + +You must specify an absolute path for --with-gmp-lib. +" "$LINENO" 5 ;; + esac + GMP_LIBS="-L$withval -Wl,-rpath $withval -Wl,-rpath /usr/local/lib -lgmp" + +else + GMP_LIBS="-Wl,-rpath /usr/local/lib -lgmp" +fi + + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${GMP_CFLAGS}" +LIBS="${LIBS} ${GMP_LIBS}" + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <gmp.h> +int +main () +{ +mpz_t a; mpz_init (a); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <gmp.h> +int main() { if (__GNU_MP_VERSION < 4) return -1; else return 0; } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + + + +$as_echo "#define HAVE_GMP 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: old version" >&5 +$as_echo "old version" >&6; } + as_fn_error $? " + +Your version of the GNU Multiple Precision library (libgmp) is too +old! Please install a more recent version from http://gmplib.org/ and +try again. If more than one version is installed, try specifying a +particular version with + + ./configure --with-gmp-include=DIR --with-gmp-lib=DIR + +See ./configure --help for more information. +" "$LINENO" 5 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? " + +The GNU Multiple Precision library (libgmp) was not found on your +system! Please obtain it from http://gmplib.org/ and install it before +trying again. If libgmp is already installed in a non-standard +location, try again with + + ./configure --with-gmp-include=DIR --with-gmp-lib=DIR + +If you already specified those arguments, double check that gmp.h can +be found in the first path and libgmp.a can be found in the second. + +See ./configure --help for more information. +" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the PBC library" >&5 +$as_echo_n "checking for the PBC library... " >&6; } + + +# Check whether --with-pbc-include was given. +if test "${with_pbc_include+set}" = set; then : + withval=$with_pbc_include; PBC_CFLAGS="-I$withval" +else + PBC_CFLAGS="-I/usr/include/pbc -I/usr/local/include/pbc" +fi + + + +# Check whether --with-pbc-lib was given. +if test "${with_pbc_lib+set}" = set; then : + withval=$with_pbc_lib; + case $withval in + /* ) true;; + * ) as_fn_error $? " + +You must specify an absolute path for --with-pbc-lib. +" "$LINENO" 5 ;; + esac + PBC_LIBS="-L$withval -Wl,-rpath $withval -Wl,-rpath /usr/local/lib -lpbc" + +else + PBC_LIBS="-Wl,-rpath /usr/local/lib -lpbc" +fi + + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${PBC_CFLAGS} ${GMP_CFLAGS}" +LIBS="${LIBS} ${PBC_LIBS} ${GMP_LIBS}" + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pbc.h> +int +main () +{ +pairing_t p; pairing_init_set_buf(p, "", 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + + + +$as_echo "#define HAVE_PBC 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? " + +The PBC library was not found on your system! Please obtain it from + + http://crypto.stanford.edu/pbc/ + +and install it before trying again. If libpbc is already +installed in a non-standard location, try again with + + ./configure --with-pbc-include=DIR --with-pbc-lib=DIR + +If you already specified those arguments, double check that pbc.h can +be found in the first path and libpbc.a can be found in the second. + +See ./configure --help for more information. +" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libbswabe" >&5 +$as_echo_n "checking for libbswabe... " >&6; } + + +# Check whether --with-bswabe-include was given. +if test "${with_bswabe_include+set}" = set; then : + withval=$with_bswabe_include; BSWABE_CFLAGS="-I$withval" +else + BSWABE_CFLAGS="" +fi + + + +# Check whether --with-bswabe-lib was given. +if test "${with_bswabe_lib+set}" = set; then : + withval=$with_bswabe_lib; + case $withval in + /* ) true;; + * ) as_fn_error $? " + +You must specify an absolute path for --with-bswabe-lib. +" "$LINENO" 5 ;; + esac + BSWABE_LIBS="-L$withval -lbswabe" + +else + BSWABE_LIBS="-lbswabe" +fi + + +BACKUP_CFLAGS=${CFLAGS} +BACKUP_LIBS=${LIBS} + +CFLAGS="${CFLAGS} ${BSWABE_CFLAGS} ${PBC_CFLAGS} ${GMP_CFLAGS} ${GLIB_CFLAGS}" +LIBS="${LIBS} ${BSWABE_LIBS} ${PBC_LIBS} ${GMP_LIBS} ${GLIB_LIBS}" + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <glib.h> + #include <pbc.h> + #include <bswabe.h> +int +main () +{ +bswabe_pub_t* p; + bswabe_pub_free(p); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + + + +$as_echo "#define HAVE_BSWABE 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? " + +The library libbswabe was not found on your system! Please obtain it +from + + http://acsc.csl.sri.com/cpabe/ + +and install it before trying again. If libbswabe is already +installed in a non-standard location, try again with + + ./configure --with-bswabe-include=<path> --with-bswabe-lib=<path> + +If you already specified those arguments, double check that bswabe.h +can be found in the first path and libbswabe.a can be found in the +second. + +See ./configure --help for more information. +" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=${BACKUP_CFLAGS} +LIBS=${BACKUP_LIBS} + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cpabe $as_me 0.11, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bethenco@cs.berkeley.edu>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +cpabe config.status 0.11 +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/moon-abe/cpabe-0.11/configure.ac b/moon-abe/cpabe-0.11/configure.ac new file mode 100644 index 00000000..53ff8ba0 --- /dev/null +++ b/moon-abe/cpabe-0.11/configure.ac @@ -0,0 +1,54 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.61) +AC_INIT([cpabe], [0.11], [bethenco@cs.berkeley.edu]) +AC_CONFIG_SRCDIR([common.h]) + +dnl First, standard system stuff. + +dnl language and compiler support +AC_MSG_CHECKING(whether to enable debugging) +debug_default="no" +AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging + [default=$debug_default]],, enable_debug=$debug_default) +if test "x$enable_debug" = "xyes"; then + CFLAGS="-g -Wall" + LDFLAGS="-g -Wall" + AC_MSG_RESULT(yes) +else + CFLAGS="-O3 -Wall" + LDFLAGS="-O3 -Wall" + AC_MSG_RESULT(no) +fi +AC_PROG_YACC +AC_PROG_CC +AC_LANG(C) +AC_C_CONST +AC_TYPE_SIZE_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T + +dnl standard headers +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h stddef.h string.h],, + [AC_MSG_ERROR([could not find all required headers fcntl.h, stddef.h, string.h])]) + +dnl specific library functions +AC_FUNC_MALLOC +AC_FUNC_STAT +AC_FUNC_VPRINTF +AC_CHECK_LIB(crypto, SHA1,, + [AC_MSG_ERROR([please install the OpenSSL crypto library, libcrypto.])]) +AC_CHECK_LIB(crypto, EVP_aes_128_cbc,, + [AC_MSG_ERROR([please install the OpenSSL crypto library, libcrypto.])]) +AC_CHECK_FUNCS([strchr strdup memset],, + [AC_MSG_ERROR([could not link to required functions strchr, strdup, memset])]) + +dnl Now, we check for specific packages we need. +AM_PATH_GLIB_2_0([2.0.0]) +GMP_4_0_CHECK +PBC_CHECK +BSWABE_CHECK + +dnl Specify the output. +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/moon-abe/cpabe-0.11/cpabe-attrList b/moon-abe/cpabe-0.11/cpabe-attrList Binary files differnew file mode 100644 index 00000000..f7b2de62 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-attrList diff --git a/moon-abe/cpabe-0.11/cpabe-attrList.1 b/moon-abe/cpabe-0.11/cpabe-attrList.1 new file mode 100644 index 00000000..0d860994 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-attrList.1 @@ -0,0 +1,30 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-ATTRLIST "1" "JULY 2015" "User Commands" +.SH NAME +cpabe-attrList \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B cpabe-attrList +[\fIOPTION \fR...] +.SH DESCRIPTION +Show the attributes of a private key +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2015 Michel Kheirallah. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to Michel Kheirallah. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-attrList.py b/moon-abe/cpabe-0.11/cpabe-attrList.py new file mode 100644 index 00000000..4cc98c28 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-attrList.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-attrList" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe-dec b/moon-abe/cpabe-0.11/cpabe-dec Binary files differnew file mode 100644 index 00000000..6c09dd69 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-dec diff --git a/moon-abe/cpabe-0.11/cpabe-dec.1 b/moon-abe/cpabe-0.11/cpabe-dec.1 new file mode 100644 index 00000000..0ee3cc0d --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-dec.1 @@ -0,0 +1,42 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-DEC "1" "March 2011" "SRI International" "User Commands" +.SH NAME +cpabe-dec \- manual page for cpabe-dec 0.11 +.SH SYNOPSIS +.B cpabe-dec +[\fIOPTION \fR...] \fIPUB_KEY PRIV_KEY FILE\fR +.SH DESCRIPTION +Decrypt FILE using private key PRIV_KEY and assuming public key +PUB_KEY. If the name of FILE is X.cpabe, the decrypted file will +be written as X and FILE will be removed. Otherwise the file will be +decrypted in place. Use of the \fB\-o\fR option overrides this +behavior. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-k\fR, \fB\-\-keep\-input\-file\fR +don't delete original file +.TP +\fB\-o\fR, \fB\-\-output\fR FILE +write output to FILE +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>. +.SH "SEE ALSO" +.BR cpabe-setup (1), +.BR cpabe-keygen (1), +.BR cpabe-enc (1) diff --git a/moon-abe/cpabe-0.11/cpabe-dec.more-man b/moon-abe/cpabe-0.11/cpabe-dec.more-man new file mode 100644 index 00000000..56ccb3fb --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-dec.more-man @@ -0,0 +1,4 @@ +[see also] +.BR cpabe-setup (1), +.BR cpabe-keygen (1), +.BR cpabe-enc (1) diff --git a/moon-abe/cpabe-0.11/cpabe-dec.py b/moon-abe/cpabe-0.11/cpabe-dec.py new file mode 100644 index 00000000..3e120578 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-dec.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-dec" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe-enc b/moon-abe/cpabe-0.11/cpabe-enc Binary files differnew file mode 100644 index 00000000..12d6fbe0 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-enc diff --git a/moon-abe/cpabe-0.11/cpabe-enc.1 b/moon-abe/cpabe-0.11/cpabe-enc.1 new file mode 100644 index 00000000..079deece --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-enc.1 @@ -0,0 +1,88 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-ENC "1" "March 2011" "SRI International" "User Commands" +.SH NAME +cpabe-enc \- manual page for cpabe-enc 0.11 +.SH SYNOPSIS +.B cpabe-enc +[\fIOPTION \fR...] \fIPUB_KEY FILE \fR[\fIPOLICY\fR] +.SH DESCRIPTION +Encrypt FILE under the decryption policy POLICY using public key +PUB_KEY. The encrypted file will be written to FILE.cpabe unless +the \fB\-o\fR option is used. The original file will be removed. If POLICY +is not specified, the policy will be read from stdin. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-k\fR, \fB\-\-keep\-input\-file\fR +don't delete original file +.TP +\fB\-o\fR, \fB\-\-output\fR FILE +write resulting key to FILE +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH EXAMPLES + +A simple policy: + + $ cpabe-enc pub_key security_report.pdf 'foo and (bar or bif)' + +A complex policy specified on stdin: + + $ cpabe-enc pub_key security_report.pdf +.br + (sysadmin and (hire_date < 946702800 or security_team)) or +.br + (business_staff and 2 of (exec_level >= 5#4, audit_group, strat_team)) +.br + ^D +.SH "POLICY LANGUAGE" + +Policies are specified using simple expressions of the attributes +given to cpabe-keygen (1). The most basic policy consists of a single +such attribute. It will only match keys produced by giving that +attribute (possibly among others) to cpabe-keygen (1). + +Another type of policy consists of a comparison between an attribute +name and a non-negative integer. The following comparisons are +allowed: `<', `>', `<=', `>=', and `='. In this case, the attribute +used must be a numerical attribute and specified appropriately to +cpabe-keygen (1) (see its man page for details). Note that a +comparison with an explicit length integer (e.g., "exec_level >= 5#4") +can only match an attribute with the same length (so "exec_level = +8#4" will match but "exec_level = 8#5" will not). + +Policies of these two basic types may be combined using the the +keywords `and' and `or' (which may not be used as attributes), as +shown in the first example above. The `and' operator has higher +precedence than `or', and parenthesis may be used to specify other +groupings. + +Policies may also be combined using a threshold gate operator, written +as `K of (P1, P2, ... PN)', where K is a positive integer less than or +equal to N, and P1, ... PN are policies. Such a policy will only be +satisfied by a key that satisfies at least K of the policies P1, ... +PN. An example of the threshold gate operator is included as part of +the policy in the second example above. + +Note that attribute names are case sensitive and must begin with a +letter, and the keywords `and', `or', and `of' may not be used. Also, +`&' and `|' are synonyms for `and' and `or'. +.SH "REPORTING BUGS" +Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>. +.SH "SEE ALSO" +.BR cpabe-setup (1), +.BR cpabe-keygen (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-enc.more-man b/moon-abe/cpabe-0.11/cpabe-enc.more-man new file mode 100644 index 00000000..db492415 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-enc.more-man @@ -0,0 +1,53 @@ +[examples] + +A simple policy: + + $ cpabe-enc pub_key security_report.pdf 'foo and (bar or bif)' + +A complex policy specified on stdin: + + $ cpabe-enc pub_key security_report.pdf +.br + (sysadmin and (hire_date < 946702800 or security_team)) or +.br + (business_staff and 2 of (exec_level >= 5#4, audit_group, strat_team)) +.br + ^D + +[policy language] + +Policies are specified using simple expressions of the attributes +given to cpabe-keygen (1). The most basic policy consists of a single +such attribute. It will only match keys produced by giving that +attribute (possibly among others) to cpabe-keygen (1). + +Another type of policy consists of a comparison between an attribute +name and a non-negative integer. The following comparisons are +allowed: `<', `>', `<=', `>=', and `='. In this case, the attribute +used must be a numerical attribute and specified appropriately to +cpabe-keygen (1) (see its man page for details). Note that a +comparison with an explicit length integer (e.g., "exec_level >= 5#4") +can only match an attribute with the same length (so "exec_level = +8#4" will match but "exec_level = 8#5" will not). + +Policies of these two basic types may be combined using the the +keywords `and' and `or' (which may not be used as attributes), as +shown in the first example above. The `and' operator has higher +precedence than `or', and parenthesis may be used to specify other +groupings. + +Policies may also be combined using a threshold gate operator, written +as `K of (P1, P2, ... PN)', where K is a positive integer less than or +equal to N, and P1, ... PN are policies. Such a policy will only be +satisfied by a key that satisfies at least K of the policies P1, ... +PN. An example of the threshold gate operator is included as part of +the policy in the second example above. + +Note that attribute names are case sensitive and must begin with a +letter, and the keywords `and', `or', and `of' may not be used. Also, +`&' and `|' are synonyms for `and' and `or'. + +[see also] +.BR cpabe-setup (1), +.BR cpabe-keygen (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-enc.py b/moon-abe/cpabe-0.11/cpabe-enc.py new file mode 100644 index 00000000..cff9a6f6 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-enc.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-enc" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe-keygen b/moon-abe/cpabe-0.11/cpabe-keygen Binary files differnew file mode 100644 index 00000000..95e8dfff --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-keygen diff --git a/moon-abe/cpabe-0.11/cpabe-keygen.1 b/moon-abe/cpabe-0.11/cpabe-keygen.1 new file mode 100644 index 00000000..6bdba258 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-keygen.1 @@ -0,0 +1,69 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-KEYGEN "1" "March 2011" "SRI International" "User Commands" +.SH NAME +cpabe-keygen \- manual page for cpabe-keygen 0.11 +.SH SYNOPSIS +.B cpabe-keygen +[\fIOPTION \fR...] \fIPUB_KEY MASTER_KEY ATTR \fR[\fIATTR \fR...] +.SH DESCRIPTION +Generate a key with the listed attributes using public key PUB_KEY and +master secret key MASTER_KEY. Output will be written to the file +"priv_key" unless the \fB\-o\fR option is specified. +.PP +Attributes come in two forms: non\-numerical and numerical. Non\-numerical +attributes are simply any string of letters, digits, and underscores +beginning with a letter. +.PP +Numerical attributes are specified as `attr = N', where N is a non\-negative +integer less than 2^64 and `attr' is another string. The whitespace around +the `=' is optional. One may specify an explicit length of k bits for the +integer by giving `attr = N#k'. Note that any comparisons in a policy given +to cpabe\-enc(1) must then specify the same number of bits, e.g., +`attr > 5#12'. +.PP +The keywords `and', `or', and `of', are reserved for the policy language +of cpabe\-enc (1) and may not be used for either type of attribute. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-o\fR, \fB\-\-output\fR FILE +write resulting key to FILE +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH EXAMPLES + +Generating a key for a new employee Sara: + + $ cpabe-keygen -o sara_priv_key pub_key master_key \\ +.br + sysadmin it_department + +Generating a key with more complicated attributes: + + $ cpabe-keygen -o kevin_priv_key pub_key master_key \\ +.br + business_staff strategy_team 'executive_level = 7#4' \\ +.br + office=2362 'hire_date = '`date +%s` + +Note the usage of date (1) as a convenient way of storing a time in a +numerical attribute. +.SH "REPORTING BUGS" +Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>. +.SH "SEE ALSO" +.BR cpabe-setup (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-keygen.more-man b/moon-abe/cpabe-0.11/cpabe-keygen.more-man new file mode 100644 index 00000000..7ef94309 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-keygen.more-man @@ -0,0 +1,23 @@ +[examples] + +Generating a key for a new employee Sara: + + $ cpabe-keygen -o sara_priv_key pub_key master_key \\ +.br + sysadmin it_department + +Generating a key with more complicated attributes: + + $ cpabe-keygen -o kevin_priv_key pub_key master_key \\ +.br + business_staff strategy_team 'executive_level = 7#4' \\ +.br + office=2362 'hire_date = '`date +%s` + +Note the usage of date (1) as a convenient way of storing a time in a +numerical attribute. + +[see also] +.BR cpabe-setup (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-keygen.py b/moon-abe/cpabe-0.11/cpabe-keygen.py new file mode 100644 index 00000000..21e1306b --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-keygen.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-keygen" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe-policyList b/moon-abe/cpabe-0.11/cpabe-policyList Binary files differnew file mode 100644 index 00000000..d3ec6c6c --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-policyList diff --git a/moon-abe/cpabe-0.11/cpabe-policyList.1 b/moon-abe/cpabe-0.11/cpabe-policyList.1 new file mode 100644 index 00000000..cfa02285 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-policyList.1 @@ -0,0 +1,30 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-POLICYLIST "1" "JULY 2015" "User Commands" +.SH NAME +cpabe-policyList \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B cpabe-policyList +[\fIOPTION \fR...] +.SH DESCRIPTION +Show the policy of a ciphertext +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2015 Michel Kheirallah. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to Michel Kheirallah. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-policyList.py b/moon-abe/cpabe-0.11/cpabe-policyList.py new file mode 100644 index 00000000..3b33c653 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-policyList.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-policyList" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe-setup b/moon-abe/cpabe-0.11/cpabe-setup Binary files differnew file mode 100644 index 00000000..8fd7bc70 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-setup diff --git a/moon-abe/cpabe-0.11/cpabe-setup.1 b/moon-abe/cpabe-0.11/cpabe-setup.1 new file mode 100644 index 00000000..fed3c751 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-setup.1 @@ -0,0 +1,43 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH CPABE-SETUP "1" "March 2011" "SRI International" "User Commands" +.SH NAME +cpabe-setup \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B cpabe-setup +[\fIOPTION \fR...] +.SH DESCRIPTION +Generate system parameters, a public key, and a master secret key +for use with cpabe\-keygen, cpabe\-enc, and cpabe\-dec. +.PP +Output will be written to the files "pub_key" and "master_key" +unless the \fB\-\-output\-public\-key\fR or \fB\-\-output\-master\-key\fR options are +used. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-p\fR, \fB\-\-output\-public\-key\fR FILE +write public key to FILE +.TP +\fB\-m\fR, \fB\-\-output\-master\-key\fR FILE +write master secret key to FILE +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-setup.more-man b/moon-abe/cpabe-0.11/cpabe-setup.more-man new file mode 100644 index 00000000..23df57d9 --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-setup.more-man @@ -0,0 +1,4 @@ +[see also] +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/cpabe-setup.py b/moon-abe/cpabe-0.11/cpabe-setup.py new file mode 100644 index 00000000..a1d82c9f --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe-setup.py @@ -0,0 +1,17 @@ +#!/usr/bin/python +import os.path +import sys +from subprocess import call + +c_prog = "cpabe-setup" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + call([c_prog]) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + call(["./" + c_prog]) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/cpabe.h b/moon-abe/cpabe-0.11/cpabe.h new file mode 100644 index 00000000..6ce4c31f --- /dev/null +++ b/moon-abe/cpabe-0.11/cpabe.h @@ -0,0 +1,34 @@ +/* + Include glib.h and pbc.h before including this file. + + This contains data structures and procedures common throughout the + tools. +*/ + +/* + TODO if ssl sha1 not available, use built in one (sha1.c) +*/ + +#define NUM_ATTR_BITS 32 + +GByteArray* suck_file( char* file ); +void spit_file( char* file, GByteArray* b ); +void element_from_string( element_t h, char* s ); +FILE* fopen_read_or_die( char* file ); +FILE* fopen_write_or_die( char* file ); +char* suck_file_str( char* file ); +char* suck_stdin(); +void die(char* fmt, ...); + +GByteArray* aes_128_cbc_encrypt( GByteArray* pt, element_t k ); +GByteArray* aes_128_cbc_decrypt( GByteArray* ct, element_t k ); + + +#define CPABE_VERSION PACKAGE_NAME "%s " PACKAGE_VERSION "\n" \ +"\n" \ +"Parts Copyright (C) 2006, 2007 John Bethencourt and SRI International.\n" \ +"This is free software released under the GPL, see the source for copying\n" \ +"conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS\n" \ +"FOR A PARTICULAR PURPOSE.\n" \ +"\n" \ +"Report bugs to John Bethencourt <bethenco@cs.berkeley.edu>.\n" diff --git a/moon-abe/cpabe-0.11/dec.c b/moon-abe/cpabe-0.11/dec.c new file mode 100644 index 00000000..218be2aa --- /dev/null +++ b/moon-abe/cpabe-0.11/dec.c @@ -0,0 +1,173 @@ +#include <assert.h> +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" + + +char* usage = +"Usage: cpabe-dec [OPTION ...] PUB_KEY PRIV_KEY FILE\n" +"\n" +"Decrypt FILE using private key PRIV_KEY and assuming public key\n" +"PUB_KEY. If the name of FILE is X.cpabe, the decrypted file will\n" +"be written as X and FILE will be removed. Otherwise the file will be\n" +"decrypted in place. Use of the -o option overrides this\n" +"behavior.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -k, --keep-input-file don't delete original file\n\n" +" -o, --output FILE write output to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n" +/* " -s, --no-opt-sat pick an arbitrary way of satisfying the policy\n" */ +/* " (only for performance comparison)\n\n" */ +/* " -n, --naive-dec use slower decryption algorithm\n" */ +/* " (only for performance comparison)\n\n" */ +/* " -f, --flatten use slightly different decryption algorithm\n" */ +/* " (may result in higher or lower performance)\n\n" */ +/* " -r, --report-ops report numbers of group operations\n" */ +/* " (only for performance evaluation)\n\n" */ +""; + +/* enum { */ +/* DEC_NAIVE, */ +/* DEC_FLATTEN, */ +/* DEC_MERGE, */ +/* } dec_strategy = DEC_MERGE; */ + +char* pub_file = 0; +char* prv_file = 0; +char* in_file = 0; +char* out_file = 0; +/* int no_opt_sat = 0; */ +/* int report_ops = 0; */ +int keep = 0; + +/* int num_pairings = 0; */ +/* int num_exps = 0; */ +/* int num_muls = 0; */ + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-dec"); + exit(0); + } + else if( !strcmp(argv[i], "-k") || !strcmp(argv[i], "--keep-input-file") ) + { + keep = 1; + } + else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } +/* else if( !strcmp(argv[i], "-s") || !strcmp(argv[i], "--no-opt-sat") ) */ +/* { */ +/* no_opt_sat = 1; */ +/* } */ +/* else if( !strcmp(argv[i], "-n") || !strcmp(argv[i], "--naive-dec") ) */ +/* { */ +/* dec_strategy = DEC_NAIVE; */ +/* } */ +/* else if( !strcmp(argv[i], "-f") || !strcmp(argv[i], "--flatten") ) */ +/* { */ +/* dec_strategy = DEC_FLATTEN; */ +/* } */ +/* else if( !strcmp(argv[i], "-r") || !strcmp(argv[i], "--report-ops") ) */ +/* { */ +/* report_ops = 1; */ +/* } */ + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !prv_file ) + { + prv_file = argv[i]; + } + else if( !in_file ) + { + in_file = argv[i]; + } + else + die(usage); + + if( !pub_file || !prv_file || !in_file ) + die(usage); + + if( !out_file ) + { + if( strlen(in_file) > 6 && + !strcmp(in_file + strlen(in_file) - 6, ".cpabe") ) + out_file = g_strndup(in_file, strlen(in_file) - 6); + else + out_file = strdup(in_file); + } + + if( keep && !strcmp(in_file, out_file) ) + die("cannot keep input file when decrypting file in place (try -o)\n"); +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_prv_t* prv; + int file_len; + GByteArray* aes_buf; + GByteArray* plt; + GByteArray* cph_buf; + bswabe_cph_t* cph; + element_t m; + + parse_args(argc, argv); + + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + prv = bswabe_prv_unserialize(pub, suck_file(prv_file), 1); + + read_cpabe_file(in_file, &cph_buf, &file_len, &aes_buf); + + cph = bswabe_cph_unserialize(pub, cph_buf, 1); + if( !bswabe_dec(pub, prv, cph, m) ) + die("%s", bswabe_error()); + bswabe_cph_free(cph); + plt = aes_128_cbc_decrypt(aes_buf, m); + g_byte_array_set_size(plt, file_len); + g_byte_array_free(aes_buf, 1); + + spit_file(out_file, plt, 1); + + if( !keep ) + unlink(in_file); + + /* report ops if necessary */ +/* if( report_ops ) */ +/* printf("pairings: %5d\n" */ +/* "exponentiations: %5d\n" */ +/* "multiplications: %5d\n", num_pairings, num_exps, num_muls); */ + + return 0; +} diff --git a/moon-abe/cpabe-0.11/dec.o b/moon-abe/cpabe-0.11/dec.o Binary files differnew file mode 100644 index 00000000..15f3ea49 --- /dev/null +++ b/moon-abe/cpabe-0.11/dec.o diff --git a/moon-abe/cpabe-0.11/enc.c b/moon-abe/cpabe-0.11/enc.c new file mode 100644 index 00000000..8e605255 --- /dev/null +++ b/moon-abe/cpabe-0.11/enc.c @@ -0,0 +1,131 @@ +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" +#include "policy_lang.h" +#include <sys/time.h> +#include <sys/resource.h> + +char* usage = +"Usage: cpabe-enc [OPTION ...] PUB_KEY FILE [POLICY]\n" +"\n" +"Encrypt FILE under the decryption policy POLICY using public key\n" +"PUB_KEY. The encrypted file will be written to FILE.cpabe unless\n" +"the -o option is used. The original file will be removed. If POLICY\n" +"is not specified, the policy will be read from stdin.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -k, --keep-input-file don't delete original file\n\n" +" -o, --output FILE write resulting key to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n" +""; + +char* pub_file = 0; +char* in_file = 0; +char* out_file = 0; +int keep = 0; + +char* policy = 0; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-enc"); + exit(0); + } + else if( !strcmp(argv[i], "-k") || !strcmp(argv[i], "--keep-input-file") ) + { + keep = 1; + } + else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !in_file ) + { + in_file = argv[i]; + } + else if( !policy ) + { + policy = parse_policy_lang(argv[i]); + } + else + die(usage); + + if( !pub_file || !in_file ) + die(usage); + + if( !out_file ) + out_file = g_strdup_printf("%s.cpabe", in_file); + + if( !policy ) + policy = parse_policy_lang(suck_stdin()); +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_cph_t* cph; + int file_len; + GByteArray* plt; + GByteArray* cph_buf; + GByteArray* aes_buf; + element_t m; + + parse_args(argc, argv); + + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + + if( !(cph = bswabe_enc(pub, m, policy)) ) + die("%s", bswabe_error()); + + cph_buf = bswabe_cph_serialize(cph); + + free(policy); + bswabe_cph_free(cph); + + plt = suck_file(in_file); + file_len = plt->len; + aes_buf = aes_128_cbc_encrypt(plt, m); + g_byte_array_free(plt, 1); + element_clear(m); + + write_cpabe_file(out_file, cph_buf, file_len, aes_buf); + + g_byte_array_free(cph_buf, 1); + g_byte_array_free(aes_buf, 1); + + if( !keep ) + unlink(in_file); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/enc.o b/moon-abe/cpabe-0.11/enc.o Binary files differnew file mode 100644 index 00000000..dfd8d905 --- /dev/null +++ b/moon-abe/cpabe-0.11/enc.o diff --git a/moon-abe/cpabe-0.11/ind.c b/moon-abe/cpabe-0.11/ind.c new file mode 100644 index 00000000..027e269b --- /dev/null +++ b/moon-abe/cpabe-0.11/ind.c @@ -0,0 +1,120 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" +#include "policy_lang.h" + +char* usage = +"Usage: peks-index [OPTION ...] PUB_KEY IND\n" +"\n" +"Generate an encrypted index given a clear index IND.\n" +"The clear index should be of the form:\n" +"keyword_1\n" +"keyword_2\n" +"...\n" +"It uses the public key PUB_KEY and a clear index IND.\n" +"The encrypted index will be written to the file \"enc_ind\"\n" +"unless the --output is used.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -o, --output FILE write index to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +""; + + +char* pub_file = 0; +// char* msk_file = 0; +char* ind_file = 0; + +char* out_file = "enc_ind"; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-keygen"); + exit(0); + } + else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } +/* else if( !msk_file ) + { + msk_file = argv[i]; + }*/ + else if( !ind_file ) + { + ind_file = argv[i]; + } + + +// if( !pub_file || !msk_file || !ind_file) + if( !pub_file || !ind_file) + die(usage); + +} + +int +main( int argc, char** argv ) +{ + + bswabe_pub_t* pub; + peks_ind_t* ind; + + + parse_args(argc, argv); + + /* Retrieve public key */ + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + + ind = peks_enc_ind( pub, ind_file ); + + spit_file(out_file, peks_ind_serialize(ind), 1); + +// For testing (requires the master key) +/* + + bswabe_msk_t* msk; + peks_ind_t* ind2; + + peks_trap_t* trap; + + msk = bswabe_msk_unserialize(pub, suck_file(msk_file), 1); + ind2 = peks_ind_unserialize(pub, suck_file(out_file), 1); + + trap = peks_trap( pub, msk, "test\n" ); + + if( !peks_test_ind( pub, ind2, trap )) + printf("The encrypted index contains the word test\n"); +*/ + return 0; +} diff --git a/moon-abe/cpabe-0.11/ind.c.old b/moon-abe/cpabe-0.11/ind.c.old new file mode 100644 index 00000000..e4002184 --- /dev/null +++ b/moon-abe/cpabe-0.11/ind.c.old @@ -0,0 +1,98 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" + +char* usage = +"Usage: peks-index [OPTION ...] PUB_KEY MSK_KEY IND\n" +"\n" +"Generate an encrypted index given a clear index IND.\n" +"The clear index should be of the form:\n" +"keyword_1\n" +"keyword_2\n" +"...\n" +"It uses the public key PUB_KEY. The encrypted index will be written to the file \"encIndex\"\n" +"unless the --output-index is used.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -i, --output-index FILE write index to FILE\n\n" +""; + +char* msk_file = 0; +char* pub_file = 0; +char* ind_file = 0; +char* out_file = 0; + + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-setup"); + exit(0); + } + else if( !strcmp(argv[i], "-i") || !strcmp(argv[i], "--output-index") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !msk_file ) + { + msk_file = argv[i]; + } + + else if( !ind_file ) + { + ind_file = argv[i]; + } + + else + die(usage); +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_msk_t* msk; + peks_ind_t* ind; + peks_trap_t* trap; + + + parse_args(argc, argv); + + /* Retrieve public key */ + pub = bswabe_pub_unserialize(suck_file(pub_file), 1);/* + msk = bswabe_msk_unserialize(pub, suck_file(msk_file), 1); + + ind = peks_enc_ind( pub, ind_file ); + trap = peks_trap( pub, msk, "test" ); + + if( !peks_test_ind( pub, ind, trap )) + printf("The encrypted index contains the word test"); +*/ + return 0; +} diff --git a/moon-abe/cpabe-0.11/ind.ind b/moon-abe/cpabe-0.11/ind.ind new file mode 100644 index 00000000..ec096f68 --- /dev/null +++ b/moon-abe/cpabe-0.11/ind.ind @@ -0,0 +1,3 @@ +qsdqsdqsd +est +test diff --git a/moon-abe/cpabe-0.11/ind.o b/moon-abe/cpabe-0.11/ind.o Binary files differnew file mode 100644 index 00000000..6e40f8f9 --- /dev/null +++ b/moon-abe/cpabe-0.11/ind.o diff --git a/moon-abe/cpabe-0.11/indTest.c b/moon-abe/cpabe-0.11/indTest.c new file mode 100644 index 00000000..33942511 --- /dev/null +++ b/moon-abe/cpabe-0.11/indTest.c @@ -0,0 +1,94 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" +#include "policy_lang.h" + +char* usage = +"Usage: peks-index [OPTION ...] PUB_KEY IND TRAP\n" +"\n" +"Test a trapdoor over an encrypted index IND.\n" +"It uses the public key PUB_KEY,\n" +"an encrypted index IND and an encrypted trapdoor TRAP.\n" +"returns 1 if there is a match, 0 if not\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +""; + + +char* pub_file = 0; +char* ind_file = 0; +char* trap_file = 0; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-keygen"); + exit(0); + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !ind_file ) + { + ind_file = argv[i]; + } + else if( !trap_file ) + { + trap_file = argv[i]; + } + + + + if( !pub_file || !ind_file || !trap_file) + die(usage); + +} + +int +main( int argc, char** argv ) +{ + + bswabe_pub_t* pub; + peks_ind_t* ind; + peks_trap_t* trap; + + + parse_args(argc, argv); + + /* Retrieve public key */ + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + + ind = peks_ind_unserialize(pub, suck_file(ind_file), 1); + + trap = peks_trap_unserialize( pub, suck_file(trap_file), 1 ); + + if( !peks_test_ind( pub, ind, trap )) + return 1; + else + return 0; +} diff --git a/moon-abe/cpabe-0.11/indTest.o b/moon-abe/cpabe-0.11/indTest.o Binary files differnew file mode 100644 index 00000000..0816b9c8 --- /dev/null +++ b/moon-abe/cpabe-0.11/indTest.o diff --git a/moon-abe/cpabe-0.11/install-sh b/moon-abe/cpabe-0.11/install-sh new file mode 100644 index 00000000..dd97db7a --- /dev/null +++ b/moon-abe/cpabe-0.11/install-sh @@ -0,0 +1,322 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-09-10.20 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/moon-abe/cpabe-0.11/keygen.c b/moon-abe/cpabe-0.11/keygen.c new file mode 100644 index 00000000..eb26ad3e --- /dev/null +++ b/moon-abe/cpabe-0.11/keygen.c @@ -0,0 +1,133 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" +#include "policy_lang.h" + +char* usage = +"Usage: cpabe-keygen [OPTION ...] PUB_KEY MASTER_KEY ATTR [ATTR ...]\n" +"\n" +"Generate a key with the listed attributes using public key PUB_KEY and\n" +"master secret key MASTER_KEY. Output will be written to the file\n" +"\"priv_key\" unless the -o option is specified.\n" +"\n" +"Attributes come in two forms: non-numerical and numerical. Non-numerical\n" +"attributes are simply any string of letters, digits, and underscores\n" +"beginning with a letter.\n" +"\n" +"Numerical attributes are specified as `attr = N', where N is a non-negative\n" +"integer less than 2^64 and `attr' is another string. The whitespace around\n" +"the `=' is optional. One may specify an explicit length of k bits for the\n" +"integer by giving `attr = N#k'. Note that any comparisons in a policy given\n" +"to cpabe-enc(1) must then specify the same number of bits, e.g.,\n" +"`attr > 5#12'.\n" +"\n" +"The keywords `and', `or', and `of', are reserved for the policy language\n" +"of cpabe-enc (1) and may not be used for either type of attribute.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -o, --output FILE write resulting key to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n" +""; + +/* + TODO ensure we don't give out the same attribute more than once (esp + as different numerical values) +*/ + +char* pub_file = 0; +char* msk_file = 0; +char** attrs = 0; + +char* out_file = "priv_key"; + +gint +comp_string( gconstpointer a, gconstpointer b) +{ + return strcmp(a, b); +} + +void +parse_args( int argc, char** argv ) +{ + int i; + GSList* alist; + GSList* ap; + int n; + + alist = 0; + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-keygen"); + exit(0); + } + else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !msk_file ) + { + msk_file = argv[i]; + } + else + { + parse_attribute(&alist, argv[i]); + } + + if( !pub_file || !msk_file || !alist ) + die(usage); + + alist = g_slist_sort(alist, comp_string); + n = g_slist_length(alist); + + attrs = malloc((n + 1) * sizeof(char*)); + + i = 0; + for( ap = alist; ap; ap = ap->next ) + attrs[i++] = ap->data; + attrs[i] = 0; +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_msk_t* msk; + bswabe_prv_t* prv; + + parse_args(argc, argv); + + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + msk = bswabe_msk_unserialize(pub, suck_file(msk_file), 1); + + prv = bswabe_keygen(pub, msk, attrs); + spit_file(out_file, bswabe_prv_serialize(prv), 1); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/keygen.o b/moon-abe/cpabe-0.11/keygen.o Binary files differnew file mode 100644 index 00000000..8b3ed514 --- /dev/null +++ b/moon-abe/cpabe-0.11/keygen.o diff --git a/moon-abe/cpabe-0.11/missing b/moon-abe/cpabe-0.11/missing new file mode 100644 index 00000000..64b5f901 --- /dev/null +++ b/moon-abe/cpabe-0.11/missing @@ -0,0 +1,353 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2004-09-07.08 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit 0 + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit 0 + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/moon-abe/cpabe-0.11/mkinstalldirs b/moon-abe/cpabe-0.11/mkinstalldirs new file mode 100644 index 00000000..6fbe5e11 --- /dev/null +++ b/moon-abe/cpabe-0.11/mkinstalldirs @@ -0,0 +1,150 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to <bug-automake@gnu.org>." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/moon-abe/cpabe-0.11/peks-ind b/moon-abe/cpabe-0.11/peks-ind Binary files differnew file mode 100644 index 00000000..9ffac675 --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-ind diff --git a/moon-abe/cpabe-0.11/peks-ind.1 b/moon-abe/cpabe-0.11/peks-ind.1 new file mode 100644 index 00000000..440b3581 --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-ind.1 @@ -0,0 +1,41 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH PEKS-IND "1" "JULY 2015" "User Commands" +.SH NAME +peks-ind \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B peks-ind +[\fIOPTION \fR...] +.SH DESCRIPTION +Generate an encrypted index based on a clear one +.PP +Output will be written to the files "enc_ind" +unless the \fB\-\-output\fR options are used. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-p\fR, \fB\-\-output\-public\-key\fR FILE +write public key to FILE +.TP +\fB\-m\fR, \fB\-\-output\-master\-key\fR FILE +write master secret key to FILE +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2015 Michel Kheirallah. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to Michel Kheirallah. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/peks-ind.more-man b/moon-abe/cpabe-0.11/peks-ind.more-man new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-ind.more-man diff --git a/moon-abe/cpabe-0.11/peks-ind.py b/moon-abe/cpabe-0.11/peks-ind.py new file mode 100644 index 00000000..ca7c5ad5 --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-ind.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-ind" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/peks-test b/moon-abe/cpabe-0.11/peks-test Binary files differnew file mode 100644 index 00000000..2cc28f5f --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-test diff --git a/moon-abe/cpabe-0.11/peks-test.1 b/moon-abe/cpabe-0.11/peks-test.1 new file mode 100644 index 00000000..90d99e41 --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-test.1 @@ -0,0 +1,32 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH PEKS-TEST "1" "JULY 2015" "User Commands" +.SH NAME +peks-test \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B peks-ind +[\fIOPTION \fR...] +.SH DESCRIPTION +Test an encrypted index based with an encrypted trapdoor +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2015 Michel Kheirallah. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to Michel Kheirallah. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/peks-test.py b/moon-abe/cpabe-0.11/peks-test.py new file mode 100644 index 00000000..a1d607aa --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-test.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-test" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/peks-trap b/moon-abe/cpabe-0.11/peks-trap Binary files differnew file mode 100644 index 00000000..377bcc1e --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-trap diff --git a/moon-abe/cpabe-0.11/peks-trap.1 b/moon-abe/cpabe-0.11/peks-trap.1 new file mode 100644 index 00000000..0399fcef --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-trap.1 @@ -0,0 +1,35 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +TRAP.TH PEKS- "1" "JULY 2015" "User Commands" +.SH NAME +peks-trap \- manual page for cpabe-setup 0.11 +.SH SYNOPSIS +.B peks-trap +[\fIOPTION \fR...] +.SH DESCRIPTION +Generate an encrypted trapdoor based on a clear word +.PP +Output will be written to the files "enc_trap" +unless the \fB\-\-output\fR options are used. +.PP +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message +.TP +\fB\-v\fR, \fB\-\-version\fR +print version information +.TP +\fB\-d\fR, \fB\-\-deterministic\fR +use deterministic "random" numbers +(only for debugging) +.PP +Parts Copyright (C) 2015 Michel Kheirallah. +This is free software released under the GPL, see the source for copying +conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. +.SH "REPORTING BUGS" +Report bugs to Michel Kheirallah. +.SH "SEE ALSO" +.BR cpabe-keygen (1), +.BR cpabe-enc (1), +.BR cpabe-dec (1) diff --git a/moon-abe/cpabe-0.11/peks-trap.py b/moon-abe/cpabe-0.11/peks-trap.py new file mode 100644 index 00000000..02e88cee --- /dev/null +++ b/moon-abe/cpabe-0.11/peks-trap.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-trap" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/policyList.c b/moon-abe/cpabe-0.11/policyList.c new file mode 100644 index 00000000..644e3282 --- /dev/null +++ b/moon-abe/cpabe-0.11/policyList.c @@ -0,0 +1,79 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" + +char* usage = +"Usage: cpabe-policyList [OPTION ...] PUB_KEY CIPHERTEXT \n" +"\n" +"Print the access policy of a ciphertext CIPHERTEXT\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n"; + +char* in_file = 0; +char* pub_file = 0; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-setup"); + exit(0); + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + + else if( !in_file ) + { + in_file = argv[i]; + } + + else + die(usage); +} + +int +main( int argc, char** argv ) +{ + + bswabe_cph_t* cph; + bswabe_pub_t* pub; + int file_len; + GByteArray* cph_buf; + GByteArray* aes_buf; + + parse_args(argc, argv); + + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + read_cpabe_file(in_file, &cph_buf, &file_len, &aes_buf); + + cph = bswabe_cph_unserialize(pub, cph_buf, 1); + + printf("%s\n",bswabe_policyList(cph)); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/policyList.o b/moon-abe/cpabe-0.11/policyList.o Binary files differnew file mode 100644 index 00000000..33c202c9 --- /dev/null +++ b/moon-abe/cpabe-0.11/policyList.o diff --git a/moon-abe/cpabe-0.11/policy_lang.c b/moon-abe/cpabe-0.11/policy_lang.c new file mode 100644 index 00000000..9bc646d8 --- /dev/null +++ b/moon-abe/cpabe-0.11/policy_lang.c @@ -0,0 +1,2164 @@ +/* A Bison parser, made by GNU Bison 3.0.2. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.2" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 1 "policy_lang.y" /* yacc.c:339 */ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> +#include <glib.h> +#include <pbc.h> + +#include "common.h" +#include "policy_lang.h" + +typedef struct +{ + uint64_t value; + int bits; /* zero if this is a flexint */ +} +sized_integer_t; + +typedef struct +{ + int k; /* one if leaf, otherwise threshold */ + char* attr; /* attribute string if leaf, otherwise null */ + GPtrArray* children; /* pointers to bswabe_policy_t's, len == 0 for leaves */ +} +cpabe_policy_t; + +cpabe_policy_t* final_policy = 0; + +int yylex(); +void yyerror( const char* s ); +sized_integer_t* expint( uint64_t value, uint64_t bits ); +sized_integer_t* flexint( uint64_t value ); +cpabe_policy_t* leaf_policy( char* attr ); +cpabe_policy_t* kof2_policy( int k, cpabe_policy_t* l, cpabe_policy_t* r ); +cpabe_policy_t* kof_policy( int k, GPtrArray* list ); +cpabe_policy_t* eq_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* lt_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* gt_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* le_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* ge_policy( sized_integer_t* n, char* attr ); + +#line 109 "policy_lang.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + TAG = 258, + INTLIT = 259, + OR = 260, + AND = 261, + OF = 262, + LEQ = 263, + GEQ = 264 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE YYSTYPE; +union YYSTYPE +{ +#line 45 "policy_lang.y" /* yacc.c:355 */ + + char* str; + uint64_t nat; + sized_integer_t* sint; + cpabe_policy_t* tree; + GPtrArray* list; + +#line 164 "policy_lang.c" /* yacc.c:355 */ +}; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ + +#line 179 "policy_lang.c" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 15 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 45 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 17 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 5 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 21 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 44 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 264 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 10, 2, 2, 2, 2, + 11, 12, 2, 2, 16, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 14, 13, 15, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 67, 67, 69, 70, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 88, 90 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "TAG", "INTLIT", "OR", "AND", "OF", + "LEQ", "GEQ", "'#'", "'('", "')'", "'='", "'<'", "'>'", "','", "$accept", + "result", "number", "policy", "arg_list", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 35, 40, 41, 61, 60, 62, 44 +}; +# endif + +#define YYPACT_NINF -5 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-5))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = +{ + -2, -1, -4, -2, 4, 2, 17, 1, 1, 1, + 1, 1, 13, 29, 15, -5, 32, 33, 34, 37, + 38, -2, -2, 35, -5, -5, -5, -5, -5, -2, + -5, -5, -5, -5, -5, -5, -5, 19, -5, 17, + 22, -5, -2, 17 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 5, 4, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 4, 12, 13, 9, 10, 11, 0, + 3, 19, 17, 18, 14, 15, 16, 6, 7, 20, + 0, 8, 0, 21 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -5, -5, 21, -3, -5 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 4, 5, 6, 40 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 14, 1, 2, 12, 15, 23, 13, 7, 8, 3, + 16, 17, 9, 10, 11, 18, 19, 20, 37, 38, + 21, 22, 21, 22, 29, 22, 39, 31, 24, 25, + 26, 27, 28, 30, 41, 32, 33, 34, 42, 43, + 35, 36, 0, 0, 0, 13 +}; + +static const yytype_int8 yycheck[] = +{ + 3, 3, 4, 7, 0, 4, 10, 8, 9, 11, + 8, 9, 13, 14, 15, 13, 14, 15, 21, 22, + 5, 6, 5, 6, 11, 6, 29, 12, 7, 8, + 9, 10, 11, 4, 12, 3, 3, 3, 16, 42, + 3, 3, -1, -1, -1, 10 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 11, 18, 19, 20, 8, 9, 13, + 14, 15, 7, 10, 20, 0, 8, 9, 13, 14, + 15, 5, 6, 4, 19, 19, 19, 19, 19, 11, + 4, 12, 3, 3, 3, 3, 3, 20, 20, 20, + 21, 12, 16, 20 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 17, 18, 19, 19, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 21, 21 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 3, 1, 1, 3, 3, 5, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 1, 3 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 67 "policy_lang.y" /* yacc.c:1646 */ + { final_policy = (yyvsp[0].tree); } +#line 1273 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 3: +#line 69 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.sint) = expint((yyvsp[-2].nat), (yyvsp[0].nat)); } +#line 1279 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 4: +#line 70 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.sint) = flexint((yyvsp[0].nat)); } +#line 1285 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 5: +#line 72 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = leaf_policy((yyvsp[0].str)); } +#line 1291 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 6: +#line 73 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = kof2_policy(1, (yyvsp[-2].tree), (yyvsp[0].tree)); } +#line 1297 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 7: +#line 74 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = kof2_policy(2, (yyvsp[-2].tree), (yyvsp[0].tree)); } +#line 1303 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 8: +#line 75 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = kof_policy((yyvsp[-4].nat), (yyvsp[-1].list)); } +#line 1309 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 9: +#line 76 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = eq_policy((yyvsp[0].sint), (yyvsp[-2].str)); } +#line 1315 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 10: +#line 77 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = lt_policy((yyvsp[0].sint), (yyvsp[-2].str)); } +#line 1321 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 11: +#line 78 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = gt_policy((yyvsp[0].sint), (yyvsp[-2].str)); } +#line 1327 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 12: +#line 79 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = le_policy((yyvsp[0].sint), (yyvsp[-2].str)); } +#line 1333 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 13: +#line 80 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = ge_policy((yyvsp[0].sint), (yyvsp[-2].str)); } +#line 1339 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 14: +#line 81 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = eq_policy((yyvsp[-2].sint), (yyvsp[0].str)); } +#line 1345 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 15: +#line 82 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = gt_policy((yyvsp[-2].sint), (yyvsp[0].str)); } +#line 1351 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 16: +#line 83 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = lt_policy((yyvsp[-2].sint), (yyvsp[0].str)); } +#line 1357 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 17: +#line 84 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = ge_policy((yyvsp[-2].sint), (yyvsp[0].str)); } +#line 1363 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 18: +#line 85 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = le_policy((yyvsp[-2].sint), (yyvsp[0].str)); } +#line 1369 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 19: +#line 86 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.tree) = (yyvsp[-1].tree); } +#line 1375 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 20: +#line 88 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.list) = g_ptr_array_new(); + g_ptr_array_add((yyval.list), (yyvsp[0].tree)); } +#line 1382 "policy_lang.c" /* yacc.c:1646 */ + break; + + case 21: +#line 90 "policy_lang.y" /* yacc.c:1646 */ + { (yyval.list) = (yyvsp[-2].list); + g_ptr_array_add((yyval.list), (yyvsp[0].tree)); } +#line 1389 "policy_lang.c" /* yacc.c:1646 */ + break; + + +#line 1393 "policy_lang.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 94 "policy_lang.y" /* yacc.c:1906 */ + + +sized_integer_t* +expint( uint64_t value, uint64_t bits ) +{ + sized_integer_t* s; + + if( bits == 0 ) + die("error parsing policy: zero-length integer \"%llub%llu\"\n", + value, bits); + else if( bits > 64 ) + die("error parsing policy: no more than 64 bits allowed \"%llub%llu\"\n", + value, bits); + + s = malloc(sizeof(sized_integer_t)); + s->value = value; + s->bits = bits; + + return s; +} + +sized_integer_t* +flexint( uint64_t value ) +{ + sized_integer_t* s; + + s = malloc(sizeof(sized_integer_t)); + s->value = value; + s->bits = 0; + + return s; +} + +void +policy_free( cpabe_policy_t* p ) +{ + int i; + + if( p->attr ) + free(p->attr); + + for( i = 0; i < p->children->len; i++ ) + policy_free(g_ptr_array_index(p->children, i)); + g_ptr_array_free(p->children, 1); + + free(p); +} + +cpabe_policy_t* +leaf_policy( char* attr ) +{ + cpabe_policy_t* p; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = 1; + p->attr = attr; + p->children = g_ptr_array_new(); + + return p; +} + +cpabe_policy_t* +kof2_policy( int k, cpabe_policy_t* l, cpabe_policy_t* r ) +{ + cpabe_policy_t* p; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = k; + p->attr = 0; + p->children = g_ptr_array_new(); + g_ptr_array_add(p->children, l); + g_ptr_array_add(p->children, r); + + return p; +} + +cpabe_policy_t* +kof_policy( int k, GPtrArray* list ) +{ + cpabe_policy_t* p; + + if( k < 1 ) + die("error parsing policy: trivially satisfied operator \"%dof\"\n", k); + else if( k > list->len ) + die("error parsing policy: unsatisfiable operator \"%dof\" (only %d operands)\n", + k, list->len); + else if( list->len == 1 ) + die("error parsing policy: identity operator \"%dof\" (only one operand)\n", k); + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = k; + p->attr = 0; + p->children = list; + + return p; +} + +char* +bit_marker( char* base, char* tplate, int bit, char val ) +{ + char* lx; + char* rx; + char* s; + + lx = g_strnfill(64 - bit - 1, 'x'); + rx = g_strnfill(bit, 'x'); + s = g_strdup_printf(tplate, base, lx, !!val, rx); + free(lx); + free(rx); + + return s; +} + +cpabe_policy_t* +eq_policy( sized_integer_t* n, char* attr ) +{ + if( n->bits == 0 ) + return leaf_policy + (g_strdup_printf("%s_flexint_%llu", attr, n->value)); + else + return leaf_policy + (g_strdup_printf("%s_expint%02d_%llu", attr, n->bits, n->value)); + + return 0; +} + +cpabe_policy_t* +bit_marker_list( int gt, char* attr, char* tplate, int bits, uint64_t value ) +{ + cpabe_policy_t* p; + int i; + + i = 0; + while( gt ? (((uint64_t)1)<<i & value) : !(((uint64_t)1)<<i & value) ) + i++; + + p = leaf_policy(bit_marker(attr, tplate, i, gt)); + for( i = i + 1; i < bits; i++ ) + if( gt ) + p = kof2_policy(((uint64_t)1<<i & value) ? 2 : 1, p, + leaf_policy(bit_marker(attr, tplate, i, gt))); + else + p = kof2_policy(((uint64_t)1<<i & value) ? 1 : 2, p, + leaf_policy(bit_marker(attr, tplate, i, gt))); + + return p; +} + +cpabe_policy_t* +flexint_leader( int gt, char* attr, uint64_t value ) +{ + cpabe_policy_t* p; + int k; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->attr = 0; + p->children = g_ptr_array_new(); + + for( k = 2; k <= 32; k *= 2 ) + if( ( gt && ((uint64_t)1<<k) > value) || + (!gt && ((uint64_t)1<<k) >= value) ) + g_ptr_array_add + (p->children, leaf_policy + (g_strdup_printf(gt ? "%s_ge_2^%02d" : "%s_lt_2^%02d", attr, k))); + + p->k = gt ? 1 : p->children->len; + + if( p->children->len == 0 ) + { + policy_free(p); + p = 0; + } + else if( p->children->len == 1 ) + { + cpabe_policy_t* t; + + t = g_ptr_array_remove_index(p->children, 0); + policy_free(p); + p = t; + } + + return p; +} + +cpabe_policy_t* +cmp_policy( sized_integer_t* n, int gt, char* attr ) +{ + cpabe_policy_t* p; + char* tplate; + + /* some error checking */ + + if( gt && n->value >= ((uint64_t)1<<(n->bits ? n->bits : 64)) - 1 ) + die("error parsing policy: unsatisfiable integer comparison %s > %llu\n" + "(%d-bits are insufficient to satisfy)\n", attr, n->value, + n->bits ? n->bits : 64); + else if( !gt && n->value == 0 ) + die("error parsing policy: unsatisfiable integer comparison %s < 0\n" + "(all numerical attributes are unsigned)\n", attr); + else if( !gt && n->value > ((uint64_t)1<<(n->bits ? n->bits : 64)) - 1 ) + die("error parsing policy: trivially satisfied integer comparison %s < %llu\n" + "(any %d-bit number will satisfy)\n", attr, n->value, + n->bits ? n->bits : 64); + + /* create it */ + + /* horrible */ + tplate = n->bits ? + g_strdup_printf("%%s_expint%02d_%%s%%d%%s", n->bits) : + strdup("%s_flexint_%s%d%s"); + p = bit_marker_list(gt, attr, tplate, n->bits ? n->bits : + (n->value >= ((uint64_t)1<<32) ? 64 : + n->value >= ((uint64_t)1<<16) ? 32 : + n->value >= ((uint64_t)1<< 8) ? 16 : + n->value >= ((uint64_t)1<< 4) ? 8 : + n->value >= ((uint64_t)1<< 2) ? 4 : 2), n->value); + free(tplate); + + if( !n->bits ) + { + cpabe_policy_t* l; + + l = flexint_leader(gt, attr, n->value); + if( l ) + p = kof2_policy(gt ? 1 : 2, l, p); + } + + return p; +} + +cpabe_policy_t* +lt_policy( sized_integer_t* n, char* attr ) +{ + return cmp_policy(n, 0, attr); +} + +cpabe_policy_t* +gt_policy( sized_integer_t* n, char* attr ) +{ + return cmp_policy(n, 1, attr); +} + +cpabe_policy_t* +le_policy( sized_integer_t* n, char* attr ) +{ + n->value++; + return cmp_policy(n, 0, attr); +} + +cpabe_policy_t* +ge_policy( sized_integer_t* n, char* attr ) +{ + n->value--; + return cmp_policy(n, 1, attr); +} + +char* cur_string = 0; + +#define PEEK_CHAR ( *cur_string ? *cur_string : EOF ) +#define NEXT_CHAR ( *cur_string ? *(cur_string++) : EOF ) + +int +yylex() +{ + int c; + int r; + + while( isspace(c = NEXT_CHAR) ); + + r = 0; + if( c == EOF ) + r = 0; + else if( c == '&' ) + r = AND; + else if( c == '|' ) + r = OR; + else if( strchr("(),=#", c) || (strchr("<>", c) && PEEK_CHAR != '=') ) + r = c; + else if( c == '<' && PEEK_CHAR == '=' ) + { + NEXT_CHAR; + r = LEQ; + } + else if( c == '>' && PEEK_CHAR == '=' ) + { + NEXT_CHAR; + r = GEQ; + } + else if( isdigit(c) ) + { + GString* s; + + s = g_string_new(""); + g_string_append_c(s, c); + while( isdigit(PEEK_CHAR) ) + g_string_append_c(s, NEXT_CHAR); + + sscanf(s->str, "%llu", &(yylval.nat)); + + g_string_free(s, 1); + r = INTLIT; + } + else if( isalpha(c) ) + { + GString* s; + + s = g_string_new(""); + g_string_append_c(s, c); + + while( isalnum(PEEK_CHAR) || PEEK_CHAR == '_' ) + g_string_append_c(s, NEXT_CHAR); + + if( !strcmp(s->str, "and") ) + { + g_string_free(s, 1); + r = AND; + } + else if( !strcmp(s->str, "or") ) + { + g_string_free(s, 1); + r = OR; + } + else if( !strcmp(s->str, "of") ) + { + g_string_free(s, 1); + r = OF; + } + else + { + yylval.str = s->str; + g_string_free(s, 0); + r = TAG; + } + } + else + die("syntax error at \"%c%s\"\n", c, cur_string); + + return r; +} + +void +yyerror( const char* s ) +{ + die("error parsing policy: %s\n", s); +} + +#define POLICY_IS_OR(p) (((cpabe_policy_t*)(p))->k == 1 && ((cpabe_policy_t*)(p))->children->len) +#define POLICY_IS_AND(p) (((cpabe_policy_t*)(p))->k == ((cpabe_policy_t*)(p))->children->len) + +void +merge_child( cpabe_policy_t* p, int i ) +{ + int j; + cpabe_policy_t* c; + + c = g_ptr_array_index(p->children, i); + if( POLICY_IS_AND(p) ) + { + p->k += c->k; + p->k--; + } + + g_ptr_array_remove_index_fast(p->children, i); + for( j = 0; j < c->children->len; j++ ) + g_ptr_array_add(p->children, g_ptr_array_index(c->children, j)); + + g_ptr_array_free(c->children, 0); + free(c); +} + +void +simplify( cpabe_policy_t* p ) +{ + int i; + + for( i = 0; i < p->children->len; i++ ) + simplify(g_ptr_array_index(p->children, i)); + + if( POLICY_IS_OR(p) ) + for( i = 0; i < p->children->len; i++ ) + if( POLICY_IS_OR(g_ptr_array_index(p->children, i)) ) + merge_child(p, i); + + if( POLICY_IS_AND(p) ) + for( i = 0; i < p->children->len; i++ ) + if( POLICY_IS_AND(g_ptr_array_index(p->children, i)) ) + merge_child(p, i); +} + +int +cmp_tidy( const void* a, const void* b ) +{ + cpabe_policy_t* pa; + cpabe_policy_t* pb; + + pa = *((cpabe_policy_t**) a); + pb = *((cpabe_policy_t**) b); + + if( pa->children->len > 0 && pb->children->len == 0 ) + return -1; + else if( pa->children->len == 0 && pb->children->len > 0 ) + return 1; + else if( pa->children->len == 0 && pb->children->len == 0 ) + return strcmp(pa->attr, pb->attr); + else + return 0; +} + +void +tidy( cpabe_policy_t* p ) +{ + int i; + + for( i = 0; i < p->children->len; i++ ) + tidy(g_ptr_array_index(p->children, i)); + + if( p->children->len > 0 ) + qsort(p->children->pdata, p->children->len, + sizeof(cpabe_policy_t*), cmp_tidy); +} + +char* +format_policy_postfix( cpabe_policy_t* p ) +{ + int i; + char* r; + char* s; + char* t; + + if( p->children->len == 0 ) + return strdup(p->attr); + + r = format_policy_postfix(g_ptr_array_index(p->children, 0)); + for( i = 1; i < p->children->len; i++ ) + { + s = format_policy_postfix(g_ptr_array_index(p->children, i)); + t = g_strjoin(" ", r, s, (char*) 0); + free(r); + free(s); + r = t; + } + + t = g_strdup_printf("%s %dof%d", r, p->k, p->children->len); + free(r); + + return t; +} + +/* + Crufty. +*/ +int +actual_bits( uint64_t value ) +{ + int i; + + for( i = 32; i >= 1; i /= 2 ) + if( value >= ((uint64_t)1<<i) ) + return i * 2; + + return 1; +} + +/* + It is pretty crufty having this here since it is only used in + keygen. Maybe eventually there will be a separate .c file with the + policy_lang module. +*/ +void +parse_attribute( GSList** l, char* a ) +{ + if( !strchr(a, '=') ) + *l = g_slist_append(*l, a); + else + { + int i; + char* s; + char* tplate; + uint64_t value; + int bits; + + s = malloc(sizeof(char) * strlen(a)); + + if( sscanf(a, " %s = %llu # %u ", s, &value, &bits) == 3 ) + { + /* expint */ + + if( bits > 64 ) + die("error parsing attribute \"%s\": 64 bits is the maximum allowed\n", + a, value, bits); + + if( value >= ((uint64_t)1<<bits) ) + die("error parsing attribute \"%s\": value %llu too big for %d bits\n", + a, value, bits); + + tplate = g_strdup_printf("%%s_expint%02d_%%s%%d%%s", bits); + for( i = 0; i < bits; i++ ) + *l = g_slist_append + (*l, bit_marker(s, tplate, i, !!((uint64_t)1<<i & value))); + free(tplate); + + *l = g_slist_append + (*l, g_strdup_printf("%s_expint%02d_%llu", s, bits, value)); + } + else if( sscanf(a, " %s = %llu ", s, &value) == 2 ) + { + /* flexint */ + + for( i = 2; i <= 32; i *= 2 ) + *l = g_slist_append + (*l, g_strdup_printf + (value < ((uint64_t)1<<i) ? "%s_lt_2^%02d" : "%s_ge_2^%02d", s, i)); + + for( i = 0; i < 64; i++ ) + *l = g_slist_append + (*l, bit_marker(s, "%s_flexint_%s%d%s", i, !!((uint64_t)1<<i & value))); + + *l = g_slist_append + (*l, g_strdup_printf("%s_flexint_%llu", s, value)); + } + else + die("error parsing attribute \"%s\"\n" + "(note that numerical attributes are unsigned integers)\n", a); + + free(s); + } +} + +char* +parse_policy_lang( char* s ) +{ + char* parsed_policy; + + cur_string = s; + + yyparse(); + simplify(final_policy); + tidy(final_policy); + parsed_policy = format_policy_postfix(final_policy); + + policy_free(final_policy); + + return parsed_policy; +} diff --git a/moon-abe/cpabe-0.11/policy_lang.h b/moon-abe/cpabe-0.11/policy_lang.h new file mode 100644 index 00000000..705444fd --- /dev/null +++ b/moon-abe/cpabe-0.11/policy_lang.h @@ -0,0 +1,6 @@ +/* + Include common.h before including this file. +*/ + +char* parse_policy_lang( char* s ); +void parse_attribute( GSList** l, char* a ); diff --git a/moon-abe/cpabe-0.11/policy_lang.o b/moon-abe/cpabe-0.11/policy_lang.o Binary files differnew file mode 100644 index 00000000..2e3dc769 --- /dev/null +++ b/moon-abe/cpabe-0.11/policy_lang.o diff --git a/moon-abe/cpabe-0.11/policy_lang.y b/moon-abe/cpabe-0.11/policy_lang.y new file mode 100644 index 00000000..5528033b --- /dev/null +++ b/moon-abe/cpabe-0.11/policy_lang.y @@ -0,0 +1,637 @@ +%{ +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> +#include <glib.h> +#include <pbc.h> + +#include "common.h" +#include "policy_lang.h" + +typedef struct +{ + uint64_t value; + int bits; /* zero if this is a flexint */ +} +sized_integer_t; + +typedef struct +{ + int k; /* one if leaf, otherwise threshold */ + char* attr; /* attribute string if leaf, otherwise null */ + GPtrArray* children; /* pointers to bswabe_policy_t's, len == 0 for leaves */ +} +cpabe_policy_t; + +cpabe_policy_t* final_policy = 0; + +int yylex(); +void yyerror( const char* s ); +sized_integer_t* expint( uint64_t value, uint64_t bits ); +sized_integer_t* flexint( uint64_t value ); +cpabe_policy_t* leaf_policy( char* attr ); +cpabe_policy_t* kof2_policy( int k, cpabe_policy_t* l, cpabe_policy_t* r ); +cpabe_policy_t* kof_policy( int k, GPtrArray* list ); +cpabe_policy_t* eq_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* lt_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* gt_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* le_policy( sized_integer_t* n, char* attr ); +cpabe_policy_t* ge_policy( sized_integer_t* n, char* attr ); +%} + +%union +{ + char* str; + uint64_t nat; + sized_integer_t* sint; + cpabe_policy_t* tree; + GPtrArray* list; +} + +%token <str> TAG +%token <nat> INTLIT +%type <sint> number +%type <tree> policy +%type <list> arg_list + +%left OR +%left AND +%token OF +%token LEQ +%token GEQ + +%% + +result: policy { final_policy = $1; } + +number: INTLIT '#' INTLIT { $$ = expint($1, $3); } + | INTLIT { $$ = flexint($1); } + +policy: TAG { $$ = leaf_policy($1); } + | policy OR policy { $$ = kof2_policy(1, $1, $3); } + | policy AND policy { $$ = kof2_policy(2, $1, $3); } + | INTLIT OF '(' arg_list ')' { $$ = kof_policy($1, $4); } + | TAG '=' number { $$ = eq_policy($3, $1); } + | TAG '<' number { $$ = lt_policy($3, $1); } + | TAG '>' number { $$ = gt_policy($3, $1); } + | TAG LEQ number { $$ = le_policy($3, $1); } + | TAG GEQ number { $$ = ge_policy($3, $1); } + | number '=' TAG { $$ = eq_policy($1, $3); } + | number '<' TAG { $$ = gt_policy($1, $3); } + | number '>' TAG { $$ = lt_policy($1, $3); } + | number LEQ TAG { $$ = ge_policy($1, $3); } + | number GEQ TAG { $$ = le_policy($1, $3); } + | '(' policy ')' { $$ = $2; } + +arg_list: policy { $$ = g_ptr_array_new(); + g_ptr_array_add($$, $1); } + | arg_list ',' policy { $$ = $1; + g_ptr_array_add($$, $3); } +; + +%% + +sized_integer_t* +expint( uint64_t value, uint64_t bits ) +{ + sized_integer_t* s; + + if( bits == 0 ) + die("error parsing policy: zero-length integer \"%llub%llu\"\n", + value, bits); + else if( bits > 64 ) + die("error parsing policy: no more than 64 bits allowed \"%llub%llu\"\n", + value, bits); + + s = malloc(sizeof(sized_integer_t)); + s->value = value; + s->bits = bits; + + return s; +} + +sized_integer_t* +flexint( uint64_t value ) +{ + sized_integer_t* s; + + s = malloc(sizeof(sized_integer_t)); + s->value = value; + s->bits = 0; + + return s; +} + +void +policy_free( cpabe_policy_t* p ) +{ + int i; + + if( p->attr ) + free(p->attr); + + for( i = 0; i < p->children->len; i++ ) + policy_free(g_ptr_array_index(p->children, i)); + g_ptr_array_free(p->children, 1); + + free(p); +} + +cpabe_policy_t* +leaf_policy( char* attr ) +{ + cpabe_policy_t* p; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = 1; + p->attr = attr; + p->children = g_ptr_array_new(); + + return p; +} + +cpabe_policy_t* +kof2_policy( int k, cpabe_policy_t* l, cpabe_policy_t* r ) +{ + cpabe_policy_t* p; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = k; + p->attr = 0; + p->children = g_ptr_array_new(); + g_ptr_array_add(p->children, l); + g_ptr_array_add(p->children, r); + + return p; +} + +cpabe_policy_t* +kof_policy( int k, GPtrArray* list ) +{ + cpabe_policy_t* p; + + if( k < 1 ) + die("error parsing policy: trivially satisfied operator \"%dof\"\n", k); + else if( k > list->len ) + die("error parsing policy: unsatisfiable operator \"%dof\" (only %d operands)\n", + k, list->len); + else if( list->len == 1 ) + die("error parsing policy: identity operator \"%dof\" (only one operand)\n", k); + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->k = k; + p->attr = 0; + p->children = list; + + return p; +} + +char* +bit_marker( char* base, char* tplate, int bit, char val ) +{ + char* lx; + char* rx; + char* s; + + lx = g_strnfill(64 - bit - 1, 'x'); + rx = g_strnfill(bit, 'x'); + s = g_strdup_printf(tplate, base, lx, !!val, rx); + free(lx); + free(rx); + + return s; +} + +cpabe_policy_t* +eq_policy( sized_integer_t* n, char* attr ) +{ + if( n->bits == 0 ) + return leaf_policy + (g_strdup_printf("%s_flexint_%llu", attr, n->value)); + else + return leaf_policy + (g_strdup_printf("%s_expint%02d_%llu", attr, n->bits, n->value)); + + return 0; +} + +cpabe_policy_t* +bit_marker_list( int gt, char* attr, char* tplate, int bits, uint64_t value ) +{ + cpabe_policy_t* p; + int i; + + i = 0; + while( gt ? (((uint64_t)1)<<i & value) : !(((uint64_t)1)<<i & value) ) + i++; + + p = leaf_policy(bit_marker(attr, tplate, i, gt)); + for( i = i + 1; i < bits; i++ ) + if( gt ) + p = kof2_policy(((uint64_t)1<<i & value) ? 2 : 1, p, + leaf_policy(bit_marker(attr, tplate, i, gt))); + else + p = kof2_policy(((uint64_t)1<<i & value) ? 1 : 2, p, + leaf_policy(bit_marker(attr, tplate, i, gt))); + + return p; +} + +cpabe_policy_t* +flexint_leader( int gt, char* attr, uint64_t value ) +{ + cpabe_policy_t* p; + int k; + + p = (cpabe_policy_t*) malloc(sizeof(cpabe_policy_t)); + p->attr = 0; + p->children = g_ptr_array_new(); + + for( k = 2; k <= 32; k *= 2 ) + if( ( gt && ((uint64_t)1<<k) > value) || + (!gt && ((uint64_t)1<<k) >= value) ) + g_ptr_array_add + (p->children, leaf_policy + (g_strdup_printf(gt ? "%s_ge_2^%02d" : "%s_lt_2^%02d", attr, k))); + + p->k = gt ? 1 : p->children->len; + + if( p->children->len == 0 ) + { + policy_free(p); + p = 0; + } + else if( p->children->len == 1 ) + { + cpabe_policy_t* t; + + t = g_ptr_array_remove_index(p->children, 0); + policy_free(p); + p = t; + } + + return p; +} + +cpabe_policy_t* +cmp_policy( sized_integer_t* n, int gt, char* attr ) +{ + cpabe_policy_t* p; + char* tplate; + + /* some error checking */ + + if( gt && n->value >= ((uint64_t)1<<(n->bits ? n->bits : 64)) - 1 ) + die("error parsing policy: unsatisfiable integer comparison %s > %llu\n" + "(%d-bits are insufficient to satisfy)\n", attr, n->value, + n->bits ? n->bits : 64); + else if( !gt && n->value == 0 ) + die("error parsing policy: unsatisfiable integer comparison %s < 0\n" + "(all numerical attributes are unsigned)\n", attr); + else if( !gt && n->value > ((uint64_t)1<<(n->bits ? n->bits : 64)) - 1 ) + die("error parsing policy: trivially satisfied integer comparison %s < %llu\n" + "(any %d-bit number will satisfy)\n", attr, n->value, + n->bits ? n->bits : 64); + + /* create it */ + + /* horrible */ + tplate = n->bits ? + g_strdup_printf("%%s_expint%02d_%%s%%d%%s", n->bits) : + strdup("%s_flexint_%s%d%s"); + p = bit_marker_list(gt, attr, tplate, n->bits ? n->bits : + (n->value >= ((uint64_t)1<<32) ? 64 : + n->value >= ((uint64_t)1<<16) ? 32 : + n->value >= ((uint64_t)1<< 8) ? 16 : + n->value >= ((uint64_t)1<< 4) ? 8 : + n->value >= ((uint64_t)1<< 2) ? 4 : 2), n->value); + free(tplate); + + if( !n->bits ) + { + cpabe_policy_t* l; + + l = flexint_leader(gt, attr, n->value); + if( l ) + p = kof2_policy(gt ? 1 : 2, l, p); + } + + return p; +} + +cpabe_policy_t* +lt_policy( sized_integer_t* n, char* attr ) +{ + return cmp_policy(n, 0, attr); +} + +cpabe_policy_t* +gt_policy( sized_integer_t* n, char* attr ) +{ + return cmp_policy(n, 1, attr); +} + +cpabe_policy_t* +le_policy( sized_integer_t* n, char* attr ) +{ + n->value++; + return cmp_policy(n, 0, attr); +} + +cpabe_policy_t* +ge_policy( sized_integer_t* n, char* attr ) +{ + n->value--; + return cmp_policy(n, 1, attr); +} + +char* cur_string = 0; + +#define PEEK_CHAR ( *cur_string ? *cur_string : EOF ) +#define NEXT_CHAR ( *cur_string ? *(cur_string++) : EOF ) + +int +yylex() +{ + int c; + int r; + + while( isspace(c = NEXT_CHAR) ); + + r = 0; + if( c == EOF ) + r = 0; + else if( c == '&' ) + r = AND; + else if( c == '|' ) + r = OR; + else if( strchr("(),=#", c) || (strchr("<>", c) && PEEK_CHAR != '=') ) + r = c; + else if( c == '<' && PEEK_CHAR == '=' ) + { + NEXT_CHAR; + r = LEQ; + } + else if( c == '>' && PEEK_CHAR == '=' ) + { + NEXT_CHAR; + r = GEQ; + } + else if( isdigit(c) ) + { + GString* s; + + s = g_string_new(""); + g_string_append_c(s, c); + while( isdigit(PEEK_CHAR) ) + g_string_append_c(s, NEXT_CHAR); + + sscanf(s->str, "%llu", &(yylval.nat)); + + g_string_free(s, 1); + r = INTLIT; + } + else if( isalpha(c) ) + { + GString* s; + + s = g_string_new(""); + g_string_append_c(s, c); + + while( isalnum(PEEK_CHAR) || PEEK_CHAR == '_' ) + g_string_append_c(s, NEXT_CHAR); + + if( !strcmp(s->str, "and") ) + { + g_string_free(s, 1); + r = AND; + } + else if( !strcmp(s->str, "or") ) + { + g_string_free(s, 1); + r = OR; + } + else if( !strcmp(s->str, "of") ) + { + g_string_free(s, 1); + r = OF; + } + else + { + yylval.str = s->str; + g_string_free(s, 0); + r = TAG; + } + } + else + die("syntax error at \"%c%s\"\n", c, cur_string); + + return r; +} + +void +yyerror( const char* s ) +{ + die("error parsing policy: %s\n", s); +} + +#define POLICY_IS_OR(p) (((cpabe_policy_t*)(p))->k == 1 && ((cpabe_policy_t*)(p))->children->len) +#define POLICY_IS_AND(p) (((cpabe_policy_t*)(p))->k == ((cpabe_policy_t*)(p))->children->len) + +void +merge_child( cpabe_policy_t* p, int i ) +{ + int j; + cpabe_policy_t* c; + + c = g_ptr_array_index(p->children, i); + if( POLICY_IS_AND(p) ) + { + p->k += c->k; + p->k--; + } + + g_ptr_array_remove_index_fast(p->children, i); + for( j = 0; j < c->children->len; j++ ) + g_ptr_array_add(p->children, g_ptr_array_index(c->children, j)); + + g_ptr_array_free(c->children, 0); + free(c); +} + +void +simplify( cpabe_policy_t* p ) +{ + int i; + + for( i = 0; i < p->children->len; i++ ) + simplify(g_ptr_array_index(p->children, i)); + + if( POLICY_IS_OR(p) ) + for( i = 0; i < p->children->len; i++ ) + if( POLICY_IS_OR(g_ptr_array_index(p->children, i)) ) + merge_child(p, i); + + if( POLICY_IS_AND(p) ) + for( i = 0; i < p->children->len; i++ ) + if( POLICY_IS_AND(g_ptr_array_index(p->children, i)) ) + merge_child(p, i); +} + +int +cmp_tidy( const void* a, const void* b ) +{ + cpabe_policy_t* pa; + cpabe_policy_t* pb; + + pa = *((cpabe_policy_t**) a); + pb = *((cpabe_policy_t**) b); + + if( pa->children->len > 0 && pb->children->len == 0 ) + return -1; + else if( pa->children->len == 0 && pb->children->len > 0 ) + return 1; + else if( pa->children->len == 0 && pb->children->len == 0 ) + return strcmp(pa->attr, pb->attr); + else + return 0; +} + +void +tidy( cpabe_policy_t* p ) +{ + int i; + + for( i = 0; i < p->children->len; i++ ) + tidy(g_ptr_array_index(p->children, i)); + + if( p->children->len > 0 ) + qsort(p->children->pdata, p->children->len, + sizeof(cpabe_policy_t*), cmp_tidy); +} + +char* +format_policy_postfix( cpabe_policy_t* p ) +{ + int i; + char* r; + char* s; + char* t; + + if( p->children->len == 0 ) + return strdup(p->attr); + + r = format_policy_postfix(g_ptr_array_index(p->children, 0)); + for( i = 1; i < p->children->len; i++ ) + { + s = format_policy_postfix(g_ptr_array_index(p->children, i)); + t = g_strjoin(" ", r, s, (char*) 0); + free(r); + free(s); + r = t; + } + + t = g_strdup_printf("%s %dof%d", r, p->k, p->children->len); + free(r); + + return t; +} + +/* + Crufty. +*/ +int +actual_bits( uint64_t value ) +{ + int i; + + for( i = 32; i >= 1; i /= 2 ) + if( value >= ((uint64_t)1<<i) ) + return i * 2; + + return 1; +} + +/* + It is pretty crufty having this here since it is only used in + keygen. Maybe eventually there will be a separate .c file with the + policy_lang module. +*/ +void +parse_attribute( GSList** l, char* a ) +{ + if( !strchr(a, '=') ) + *l = g_slist_append(*l, a); + else + { + int i; + char* s; + char* tplate; + uint64_t value; + int bits; + + s = malloc(sizeof(char) * strlen(a)); + + if( sscanf(a, " %s = %llu # %u ", s, &value, &bits) == 3 ) + { + /* expint */ + + if( bits > 64 ) + die("error parsing attribute \"%s\": 64 bits is the maximum allowed\n", + a, value, bits); + + if( value >= ((uint64_t)1<<bits) ) + die("error parsing attribute \"%s\": value %llu too big for %d bits\n", + a, value, bits); + + tplate = g_strdup_printf("%%s_expint%02d_%%s%%d%%s", bits); + for( i = 0; i < bits; i++ ) + *l = g_slist_append + (*l, bit_marker(s, tplate, i, !!((uint64_t)1<<i & value))); + free(tplate); + + *l = g_slist_append + (*l, g_strdup_printf("%s_expint%02d_%llu", s, bits, value)); + } + else if( sscanf(a, " %s = %llu ", s, &value) == 2 ) + { + /* flexint */ + + for( i = 2; i <= 32; i *= 2 ) + *l = g_slist_append + (*l, g_strdup_printf + (value < ((uint64_t)1<<i) ? "%s_lt_2^%02d" : "%s_ge_2^%02d", s, i)); + + for( i = 0; i < 64; i++ ) + *l = g_slist_append + (*l, bit_marker(s, "%s_flexint_%s%d%s", i, !!((uint64_t)1<<i & value))); + + *l = g_slist_append + (*l, g_strdup_printf("%s_flexint_%llu", s, value)); + } + else + die("error parsing attribute \"%s\"\n" + "(note that numerical attributes are unsigned integers)\n", a); + + free(s); + } +} + +char* +parse_policy_lang( char* s ) +{ + char* parsed_policy; + + cur_string = s; + + yyparse(); + simplify(final_policy); + tidy(final_policy); + parsed_policy = format_policy_postfix(final_policy); + + policy_free(final_policy); + + return parsed_policy; +} diff --git a/moon-abe/cpabe-0.11/setup.c b/moon-abe/cpabe-0.11/setup.c new file mode 100644 index 00000000..9750d6d5 --- /dev/null +++ b/moon-abe/cpabe-0.11/setup.c @@ -0,0 +1,86 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> +#include "bswabe.h" +#include "common.h" +#include <sys/time.h> +#include <sys/resource.h> + +char* usage = +"Usage: cpabe-setup [OPTION ...]\n" +"\n" +"Generate system parameters, a public key, and a master secret key\n" +"for use with cpabe-keygen, cpabe-enc, and cpabe-dec.\n" +"\n" +"Output will be written to the files \"pub_key\" and \"master_key\"\n" +"unless the --output-public-key or --output-master-key options are\n" +"used.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -p, --output-public-key FILE write public key to FILE\n\n" +" -m, --output-master-key FILE write master secret key to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +" (only for debugging)\n\n" +""; + +char* pub_file = "pub_key"; +char* msk_file = "master_key"; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-setup"); + exit(0); + } + else if( !strcmp(argv[i], "-p") || !strcmp(argv[i], "--output-public-key") ) + { + if( ++i >= argc ) + die(usage); + else + pub_file = argv[i]; + } + else if( !strcmp(argv[i], "-m") || !strcmp(argv[i], "--output-master-key") ) + { + if( ++i >= argc ) + die(usage); + else + msk_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else + die(usage); +} + +int +main( int argc, char** argv ) +{ + bswabe_pub_t* pub; + bswabe_msk_t* msk; + + parse_args(argc, argv); + + bswabe_setup(&pub, &msk); + spit_file(pub_file, bswabe_pub_serialize(pub), 1); + spit_file(msk_file, bswabe_msk_serialize(msk), 1); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/setup.o b/moon-abe/cpabe-0.11/setup.o Binary files differnew file mode 100644 index 00000000..ffd6ce89 --- /dev/null +++ b/moon-abe/cpabe-0.11/setup.o diff --git a/moon-abe/cpabe-0.11/test-lang b/moon-abe/cpabe-0.11/test-lang Binary files differnew file mode 100644 index 00000000..72a452da --- /dev/null +++ b/moon-abe/cpabe-0.11/test-lang diff --git a/moon-abe/cpabe-0.11/test-lang.c b/moon-abe/cpabe-0.11/test-lang.c new file mode 100644 index 00000000..8ae619dc --- /dev/null +++ b/moon-abe/cpabe-0.11/test-lang.c @@ -0,0 +1,20 @@ +#include <glib.h> +#include <pbc.h> + +#include "common.h" +#include "policy_lang.h" + +int +main( int argc, char** argv ) +{ + char* p; + + if( argc < 2 ) + die("specify policy\n"); + + p = parse_policy_lang(argv[1]); + + printf("parsed to: %s\n", p); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/test-lang.o b/moon-abe/cpabe-0.11/test-lang.o Binary files differnew file mode 100644 index 00000000..63643853 --- /dev/null +++ b/moon-abe/cpabe-0.11/test-lang.o diff --git a/moon-abe/cpabe-0.11/test/cpabe-dec.py b/moon-abe/cpabe-0.11/test/cpabe-dec.py new file mode 100644 index 00000000..3e120578 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/cpabe-dec.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-dec" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/cpabe-enc.py b/moon-abe/cpabe-0.11/test/cpabe-enc.py new file mode 100644 index 00000000..cff9a6f6 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/cpabe-enc.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-enc" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/cpabe-keygen.py b/moon-abe/cpabe-0.11/test/cpabe-keygen.py new file mode 100644 index 00000000..21e1306b --- /dev/null +++ b/moon-abe/cpabe-0.11/test/cpabe-keygen.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "cpabe-keygen" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/cpabe-setup.py b/moon-abe/cpabe-0.11/test/cpabe-setup.py new file mode 100644 index 00000000..a1d82c9f --- /dev/null +++ b/moon-abe/cpabe-0.11/test/cpabe-setup.py @@ -0,0 +1,17 @@ +#!/usr/bin/python +import os.path +import sys +from subprocess import call + +c_prog = "cpabe-setup" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + call([c_prog]) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + call(["./" + c_prog]) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/enc_ind b/moon-abe/cpabe-0.11/test/enc_ind Binary files differnew file mode 100644 index 00000000..01aeabaf --- /dev/null +++ b/moon-abe/cpabe-0.11/test/enc_ind diff --git a/moon-abe/cpabe-0.11/test/enc_trap b/moon-abe/cpabe-0.11/test/enc_trap Binary files differnew file mode 100644 index 00000000..200de618 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/enc_trap diff --git a/moon-abe/cpabe-0.11/test/indexClear b/moon-abe/cpabe-0.11/test/indexClear new file mode 100644 index 00000000..6f6894cd --- /dev/null +++ b/moon-abe/cpabe-0.11/test/indexClear @@ -0,0 +1,2 @@ +Keyword1 +Keyword2 diff --git a/moon-abe/cpabe-0.11/test/master_key b/moon-abe/cpabe-0.11/test/master_key Binary files differnew file mode 100644 index 00000000..63e4dec5 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/master_key diff --git a/moon-abe/cpabe-0.11/test/peks-ind.py b/moon-abe/cpabe-0.11/test/peks-ind.py new file mode 100644 index 00000000..ca7c5ad5 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/peks-ind.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-ind" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/peks-test.py b/moon-abe/cpabe-0.11/test/peks-test.py new file mode 100644 index 00000000..2cb59713 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/peks-test.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-test" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + sys.exit(call(args)) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + sys.exit(call(args)) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/peks-trap.py b/moon-abe/cpabe-0.11/test/peks-trap.py new file mode 100644 index 00000000..02e88cee --- /dev/null +++ b/moon-abe/cpabe-0.11/test/peks-trap.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os, sys +from subprocess import call + +c_prog = "peks-trap" +c_file = "/usr/local/bin/" + c_prog + +if(os.path.isfile(c_file)): + args = [c_prog] + sys.argv[1::] + call(args) + +elif(os.path.isfile("./" + c_prog)): + print "Warning: missing file %s using binary in local repository" % c_file + args = ["./" + c_prog] + sys.argv[1::] + call(args) + +else: + sys.exit(c_prog + " was not found. Be sure that the C library cpabe is installed before running this program") diff --git a/moon-abe/cpabe-0.11/test/priv_key b/moon-abe/cpabe-0.11/test/priv_key Binary files differnew file mode 100644 index 00000000..9e882734 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/priv_key diff --git a/moon-abe/cpabe-0.11/test/pub_key b/moon-abe/cpabe-0.11/test/pub_key Binary files differnew file mode 100644 index 00000000..24be30ad --- /dev/null +++ b/moon-abe/cpabe-0.11/test/pub_key diff --git a/moon-abe/cpabe-0.11/test/testFile.txt b/moon-abe/cpabe-0.11/test/testFile.txt new file mode 100644 index 00000000..98a1cfb8 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/testFile.txt @@ -0,0 +1 @@ +I am a test File!!! diff --git a/moon-abe/cpabe-0.11/test/testFile.txt.dec b/moon-abe/cpabe-0.11/test/testFile.txt.dec new file mode 100644 index 00000000..98a1cfb8 --- /dev/null +++ b/moon-abe/cpabe-0.11/test/testFile.txt.dec @@ -0,0 +1 @@ +I am a test File!!! diff --git a/moon-abe/cpabe-0.11/testindex b/moon-abe/cpabe-0.11/testindex new file mode 100644 index 00000000..d4e3a065 --- /dev/null +++ b/moon-abe/cpabe-0.11/testindex @@ -0,0 +1,2 @@ +kkeyword +kkeyworpd diff --git a/moon-abe/cpabe-0.11/trap.c b/moon-abe/cpabe-0.11/trap.c new file mode 100644 index 00000000..c1d780f8 --- /dev/null +++ b/moon-abe/cpabe-0.11/trap.c @@ -0,0 +1,106 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <glib.h> +#include <pbc.h> +#include <pbc_random.h> + +#include "bswabe.h" +#include "common.h" +#include "policy_lang.h" + +char* usage = +"Usage: peks-trap [OPTION ...] PUB_KEY MSK_KEY KEYWORD\n" +"\n" +"Generate an encrypted trapdoor given a clear keyword KEYWORD.\n" +"It uses the public key PUB_KEY and the master key MSK_KEY.\n" +"The encrypted trapdoor will be written to the file \"enc_trap\"\n" +"unless the --output is used.\n" +"\n" +"Mandatory arguments to long options are mandatory for short options too.\n\n" +" -h, --help print this message\n\n" +" -v, --version print version information\n\n" +" -o, --output FILE write index to FILE\n\n" +" -d, --deterministic use deterministic \"random\" numbers\n" +""; + + +char* pub_file = 0; +char* msk_file = 0; +char* keyword = 0; +char* out_file = "enc_trap"; + +void +parse_args( int argc, char** argv ) +{ + int i; + + for( i = 1; i < argc; i++ ) + if( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) + { + printf("%s", usage); + exit(0); + } + else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ) + { + printf(CPABE_VERSION, "-keygen"); + exit(0); + } + else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") ) + { + if( ++i >= argc ) + die(usage); + else + out_file = argv[i]; + } + else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") ) + { + pbc_random_set_deterministic(0); + } + else if( !pub_file ) + { + pub_file = argv[i]; + } + else if( !msk_file ) + { + msk_file = argv[i]; + } + else if( !keyword ) + { + keyword = argv[i]; + } + + + if( !pub_file || !msk_file || !keyword) +// if( !pub_file || !ind_file) + die(usage); + +} + +int +main( int argc, char** argv ) +{ + + bswabe_msk_t* msk; + bswabe_pub_t* pub; + peks_trap_t* trap; + char bufKeyword[256]; + + + parse_args(argc, argv); + + /* Retrieve public key */ + pub = bswabe_pub_unserialize(suck_file(pub_file), 1); + msk = bswabe_msk_unserialize(pub, suck_file(msk_file), 1); + + /* It is necessary to add \n at the end of the keyword */ + strcpy(bufKeyword, keyword); + strcat(bufKeyword, "\n"); + + trap = peks_trap( pub, msk, bufKeyword ); + + spit_file(out_file, peks_trap_serialize(trap), 1); + + return 0; +} diff --git a/moon-abe/cpabe-0.11/trap.o b/moon-abe/cpabe-0.11/trap.o Binary files differnew file mode 100644 index 00000000..ec680748 --- /dev/null +++ b/moon-abe/cpabe-0.11/trap.o |