rabbitsign-2.1+dmca1/0000700000175000017500000000000011267670671012236 5ustar kbkbrabbitsign-2.1+dmca1/configure.ac0000600000175000017500000000370211232722113014505 0ustar kbkb# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([RabbitSign], [2.1], [floppusmaximus@users.sf.net]) AC_CONFIG_SRCDIR([src/rabbitsign.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_CHECK_TOOL([AR], [ar], [false]) AC_PROG_RANLIB AC_PROG_MAKE_SET if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -W -Wall -Wwrite-strings" fi # Checks for header files. AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS([limits.h sys/time.h assert.h]) AC_ARG_VAR(GMP_CFLAGS, [Extra C compiler flags required for GMP (default empty)]) AC_ARG_VAR(GMP_LIBS, [Extra libraries required for GMP (default -lgmp)]) AC_ARG_WITH(gmp, AC_HELP_STRING([--with-gmp], [use the GNU MP library if found]), [ check_gmp=$withval ], [ check_gmp=yes ]) if test "x$check_gmp" = "xyes" ; then save_cflags="$CFLAGS" CFLAGS="$CFLAGS $GMP_CFLAGS" AC_CHECK_HEADER([gmp.h], [ have_gmp=yes ], [ have_gmp=no ]) CFLAGS="$save_cflags" else have_gmp=no fi if test "x$have_gmp" = "xyes" ; then AC_DEFINE(HAVE_GMP_H, 1, [Define to 1 if you have gmp.h.]) if test "x$GMP_LIBS" = "x" ; then GMP_LIBS="-lgmp" fi mpzobjs="" opt_build_rskeygen=rskeygen$EXEEXT opt_install_rskeygen=install-rskeygen else mpzobjs=mpz.$OBJEXT AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) fi AC_DEFINE(USE_MPZ_GCDEXT, 1, [Define to 1 to enable the use of mpz_gcdext().]) AC_SUBST([mpzobjs]) AC_SUBST([opt_build_rskeygen]) AC_SUBST([opt_install_rskeygen]) # Checks for typedefs, structures, and compiler characteristics. AC_C_PROTOTYPES AC_C_BIGENDIAN AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_STRUCT_TM # Checks for library functions. AC_CHECK_FUNCS([strcasecmp stricmp strrchr rindex strchr index memcpy random rand]) AC_CONFIG_FILES([Makefile man/Makefile src/Makefile test/Makefile]) AC_OUTPUT rabbitsign-2.1+dmca1/test/0000700000175000017500000000000011232723713013201 5ustar kbkbrabbitsign-2.1+dmca1/test/sample-a.app0000600000175000017500000000536510563171007015414 0ustar kbkb:020000020000FC :20400000800F0000042980120104802101803101804854657374204170708081010326091C :204020000400000000020D04DEADBEEF807F00000000BC8EE4415ED431263065BF98CFEC93 :2040400098EE59BE385F23F295FB146DAF52F67A2BB3080FF467E3258D138A4DAB59394346 :2040600047920180F12572862086F3CFD8EA49039D521291B9F5B646084093B399CCF7E15B :204080005EF861501DD3D63D59CA0D31B4563551A847E2613D98A845D83BF97108F0526604 :2040A000E8B3B606868D43DF5750110BA7465C4F8D3EB1CAD65910AE94091F9CF97203E13F :2040C00025B9E7AC462B8B9D7B9CA822E204727042233A187C4AC61053E6AD4C58B02E7DF5 :2040E000691529B040B54DBC51F6DE34FA50A43D73DE55EF291C007C02ADC95A5DF7D7C6CE :204100000C01764DB6C40907BAE73BB438DFF1ABBE479BE7639B6365482CBFA523966B3089 :2041200097E27D4DA68655606D9014A57006512E4DEC15B0877815CFA5D474C86ADFF802D7 :20414000C1754F67FBA4C76935DC0EA5E25FD32F4BE8DFD260F4A105C815CE32F5C634B63D :204160003C841E3728E5A05DC1AF02A30ED5D25ABDB12C1EA5CE236DE3F1A0D8B8D48FF4E6 :2041800058AD2B8192CCDE547BE1F789B6CAE3747B109221DEB58EC1A72E9A5F0329535B63 :2041A000D67EDC684ABBBCC59CB44F527E32C6F942581A200EA9E2B5D77C14DAA567367B61 :2041C000E512E330CDA0F5695444BCD27782CBB9DBE6DAE98FBC9E6638B241DD197758FEA6 :2041E000893B2E57DB24C02F687C01DFFFCD99DAB373C3422F61A86713E9442C609C2AEA3F :20420000D75941B37D01E2E57EE4C57DB15E5764D11AA6007B4E678E38ABBA9847E4821E78 :204220003DC3D1BAC5B4A0439865C049C317AD94315394ACA1FB3AD9A6F472EDD8F40B161D :20424000B8DDD07D9170C029D5807298971F2CC872C07413BBAEED61A25F4E7A535A900B08 :20426000376188C8D148F1A7C8633F5F826C27F42C9B07E849F449EB539866A7F2F6B229F1 :20428000573BF12983E2D04C450FABC77BD3BBA86EC290B8B7D9A30A7109B16300648C57F0 :2042A0009F7D80225F506EA4601A6BDBED26835BE91313A0EDB7AA5EC05CC2C0C04E185F50 :2042C000CC98812BE9F0D0490A3B24F762A8524BBB66EBA81D9507DDF1C99EB117B610E3C2 :2042E0004E920F3782DF808C1AA5837C4DD5C7083BB2B15848B8363981D4EB988AFB7CD866 :204300008D8B100F6A909B84351E0182F4C88B2F7B3C88C3F4BEFC7592E70D1CE389F4706A :204320001404807E951B03CA3A044D2ECCD85D4714E50A08A3077D35EE8A51D11446422824 :204340004AC2A7DFDDAAAA17AEF7457ACFA3C2E388CCEB2CD36861C2F2B39306F9D52F43C1 :2043600097D6237580CD8C2EC4D2A893756A76FD3761290AC98BCCBB3E60C23735F17ACD64 :20438000C79D42476ACE752EA01DC115883713BF983CC961C7961D05F6DF3C2BD0B7F89762 :2043A000543ADEBF0953EDA970AFBFF8E6D2B77F0E81E0D617FDDB0DDC1838ACCF3143239D :2043C0006B21E27474D01EE57FDDDD65AF95E4BD16C5932DC26F3A9F87724B56A38F790F38 :2043E000B05C83252CA10AAB7EE7022D40102D7CF5EB92BA7EBF7CEDF91B746C67CA0FF6FE :20440000441EA6A0A2CBCC43D577C2BD87EF397CDACC36598BB34685CEBBF13585002BC91C :204420001FD269C19D350473ACC63034B60101022D40EC3A3EC14B13973CD349BC1EEE825F :204440000097AF4D8E1C4C9B7E0341799A4741023C70F73EC00CD6E51A2491C446F9F407A4 :2044600088F977E16236E67655038086C820B528AE680103FFFFFFFFFFFFFFFFFFFFFFFF3E :0F448000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3C :00000001FFrabbitsign-2.1+dmca1/test/randapp.c0000600000175000017500000001031311173267072014777 0ustar kbkb/* * Generate a random app * * Copyright (C) 2004-2005 Benjamin Moody * * 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 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, * USA. * */ #ifdef HAVE_CONFIG_H # include #endif #include #if HAVE_STDLIB_H # include #endif #include #if HAVE_UNISTD_H # include #else # define getpid() 0 #endif #if PROTOTYPES # define proto(x) x #else # define proto(x) () #endif #if !HAVE_RANDOM # if HAVE_RAND # undef random # undef srandom # define random rand # define srandom srand # endif #endif struct hexinfo { int last_r, last_w, last_a; int rec_addr, rec_pos; unsigned char currec[256]; }; void write_file_hex_byte proto((FILE* f, struct hexinfo *inf, int rectype, int width, int addr, int x)); void write_file_hex proto((FILE* f, const unsigned char *data, size_t length)); static const unsigned char appstart[]={0x80,0x0f, 0x00,0x00,0x00,0x00, 0x80,0x12, 0x42, 0x04, 0x80,0x21, 0x01, 0x80,0x31, 0x01, 0x80,0x48, 'T','e','s','t',' ','A','p','p', 0x80,0x81, 0x01, 0x03,0x26, 0x09,0x04, 0x00,0x00,0x00,0x00, 0x02,0x0d, 0x04,0xde,0xad,0xbe,0xef, 0x80,0x7F, 0x00,0x00,0x00,0x00}; int main(argc, argv) int argc; char** argv; { unsigned char data[2000]; size_t size, i; unsigned int z; srandom(time(NULL) + (100 * getpid())); size = sizeof(appstart) + (random() % 1000); for (i=0; i>8; data[3] = (size-6)>>16; data[2] = (size-6)>>24; if (argc > 1) { sscanf(argv[1], "%X", &z); data[8] = (z>>8)&0xff; data[9] = z&0xff; } for (; ilast_r || width != inf->last_w || addr != (inf->last_a+1) || inf->rec_pos >= inf->last_w) { /* then we must flush the last record */ if (inf->last_r != -1 && (inf->last_w==0 || inf->rec_pos!=0)) { fprintf(f,":%02X%02X%02X%02X",inf->rec_pos,(inf->rec_addr>>8)&0xff, inf->rec_addr&0xff,inf->last_r); c = inf->rec_pos + inf->last_r + inf->rec_addr + (inf->rec_addr>>8); for (i=0;i<(inf->rec_pos);i++) { fprintf(f,"%02X",(int)inf->currec[i]); c += inf->currec[i]; } fprintf(f,"%02X\r\n",(-c)&0xff); } /* we're starting a new record now */ inf->last_r = rectype; inf->last_w = width; inf->rec_addr = addr; inf->rec_pos = 0; } if (width) { inf->currec[inf->rec_pos]=x; inf->rec_pos++; } inf->last_a = addr; } /* Write an output file */ void write_file_hex(f, data, length) FILE* f; const unsigned char *data; size_t length; { int pagenum=0; size_t i; struct hexinfo inf; inf.last_r = inf.last_w = inf.last_a = -1; inf.rec_addr = -1; inf.rec_pos = 0; for (i=0;i1234.key $(srcdir)/test-rabbitsign.sh 1234 $(TEST_EXEC) ../src/rskeygen --ti >1234.key $(srcdir)/test-rabbitsign.sh 1234 $(TEST_EXEC) ../src/rskeygen >1201.key $(srcdir)/test-rabbitsign.sh 1201 $(TEST_EXEC) ../src/rskeygen >1202.key $(srcdir)/test-rabbitsign.sh 1202 $(TEST_EXEC) ../src/rskeygen >1203.key $(srcdir)/test-rabbitsign.sh 1203 $(TEST_EXEC) ../src/rskeygen >1204.key $(srcdir)/test-rabbitsign.sh 1204 rm -f 1234.key 1201.key 1202.key 1203.key 1204.key # cp $(srcdir)/../keys/0104.key . $(srcdir)/test-rabbitsign.sh 0104 $(srcdir)/test-rabbitsign.sh 0104 @echo "Testing the sample app..." $(TEST_EXEC) ../src/rabbitsign -a $(srcdir)/sample.hex -o sample.app $(TEST_EXEC) ../src/rabbitsign -c sample.app diff sample.app $(srcdir)/sample-a.app # rm -f 0104.key # Rabbitsign with appsign tests # # (obviously, these require a system compatible with appsign) # # 1 - Generate a random key (named 0104 because appsign is broken) and # random app, sign with appsign, check with rabbitsign, sign and # check with rabbitsign, and check that one of rabbitsign's four # signatures matches appsign's. # # 2 - Unpack official 0104 key, generate a random app, sign with # appsign, check with rabbitsign, sign and check with rabbitsign, # and check that one of rabbitsign's four signatures matches # appsign's. # check-appsign: randapp@EXEEXT@ cd ../src && $(MAKE) rabbitsign@EXEEXT@ rskeygen@EXEEXT@ ../src/rskeygen --ti >0104.key $(srcdir)/test-appsign.sh ../src/rskeygen --ti >0104.key $(srcdir)/test-appsign.sh cp $(srcdir)/../keys/0104.key . $(srcdir)/test-appsign.sh $(srcdir)/test-appsign.sh rm -f 0104.key appsign.tmp testing.txt randapp@EXEEXT@: randapp.c $(CC) -I.. $(CFLAGS) $(CPPFLAGS) $(DEFS) $(LDFLAGS) $(srcdir)/randapp.c -o randapp@EXEEXT@ clean: rm -f 12*.key 0104.key appsign.tmp testing.txt rm -f test.8xk test.sig test.app test.hex testas.app rm -f testr0.app testr1.app testr2.app testr3.app rm -f sample.app rm -f randapp@EXEEXT@ .PHONY: check check-rabbitsign check-appsign clean rabbitsign-2.1+dmca1/test/time.sh0000700000175000017500000000101310423271276014474 0ustar kbkb#!/bin/sh [ -f 0104.key ] || ../src/rskeygen --ti > 0104.key echo "Testing: $1 iterations of randapp" time sh<test.hex done EOF echo "Testing: $1 iterations of rabbitsign" time sh<test.hex ../src/rabbitsign test.hex -vv >&/dev/null done EOF echo "Testing: $1 iterations of appsign" time sh<test.hex ./appsign -a test >&/dev/null done EOF rabbitsign-2.1+dmca1/test/sample.hex0000600000175000017500000000506610563171002015173 0ustar kbkb:020000020000FC :20400000800F000003E4801201048021018031018048546573742041707080810103260962 :204020000400000000020D04DEADBEEF807F00000000BC8EE4415ED431263065BF98CFEC93 :2040400098EE59BE385F23F295FB146DAF52F67A2BB3080FF467E3258D138A4DAB59394346 :2040600047920180F12572862086F3CFD8EA49039D521291B9F5B646084093B399CCF7E15B :204080005EF861501DD3D63D59CA0D31B4563551A847E2613D98A845D83BF97108F0526604 :2040A000E8B3B606868D43DF5750110BA7465C4F8D3EB1CAD65910AE94091F9CF97203E13F :2040C00025B9E7AC462B8B9D7B9CA822E204727042233A187C4AC61053E6AD4C58B02E7DF5 :2040E000691529B040B54DBC51F6DE34FA50A43D73DE55EF291C007C02ADC95A5DF7D7C6CE :204100000C01764DB6C40907BAE73BB438DFF1ABBE479BE7639B6365482CBFA523966B3089 :2041200097E27D4DA68655606D9014A57006512E4DEC15B0877815CFA5D474C86ADFF802D7 :20414000C1754F67FBA4C76935DC0EA5E25FD32F4BE8DFD260F4A105C815CE32F5C634B63D :204160003C841E3728E5A05DC1AF02A30ED5D25ABDB12C1EA5CE236DE3F1A0D8B8D48FF4E6 :2041800058AD2B8192CCDE547BE1F789B6CAE3747B109221DEB58EC1A72E9A5F0329535B63 :2041A000D67EDC684ABBBCC59CB44F527E32C6F942581A200EA9E2B5D77C14DAA567367B61 :2041C000E512E330CDA0F5695444BCD27782CBB9DBE6DAE98FBC9E6638B241DD197758FEA6 :2041E000893B2E57DB24C02F687C01DFFFCD99DAB373C3422F61A86713E9442C609C2AEA3F :20420000D75941B37D01E2E57EE4C57DB15E5764D11AA6007B4E678E38ABBA9847E4821E78 :204220003DC3D1BAC5B4A0439865C049C317AD94315394ACA1FB3AD9A6F472EDD8F40B161D :20424000B8DDD07D9170C029D5807298971F2CC872C07413BBAEED61A25F4E7A535A900B08 :20426000376188C8D148F1A7C8633F5F826C27F42C9B07E849F449EB539866A7F2F6B229F1 :20428000573BF12983E2D04C450FABC77BD3BBA86EC290B8B7D9A30A7109B16300648C57F0 :2042A0009F7D80225F506EA4601A6BDBED26835BE91313A0EDB7AA5EC05CC2C0C04E185F50 :2042C000CC98812BE9F0D0490A3B24F762A8524BBB66EBA81D9507DDF1C99EB117B610E3C2 :2042E0004E920F3782DF808C1AA5837C4DD5C7083BB2B15848B8363981D4EB988AFB7CD866 :204300008D8B100F6A909B84351E0182F4C88B2F7B3C88C3F4BEFC7592E70D1CE389F4706A :204320001404807E951B03CA3A044D2ECCD85D4714E50A08A3077D35EE8A51D11446422824 :204340004AC2A7DFDDAAAA17AEF7457ACFA3C2E388CCEB2CD36861C2F2B39306F9D52F43C1 :2043600097D6237580CD8C2EC4D2A893756A76FD3761290AC98BCCBB3E60C23735F17ACD64 :20438000C79D42476ACE752EA01DC115883713BF983CC961C7961D05F6DF3C2BD0B7F89762 :2043A000543ADEBF0953EDA970AFBFF8E6D2B77F0E81E0D617FDDB0DDC1838ACCF3143239D :2043C0006B21E27474D01EE57FDDDD65AF95E4BD16C5932DC26F3A9F87724B56A38F790F38 :2043E000B05C83252CA10AAB7EE7022D40102D7CF5EB92BA7EBF7CEDF91B746C67CA0FF6FE :20440000441EA6A0A2CBCC43D577C2BD87EF397CDACC36598BB34685CEBBF13585002BC91C :0F4420001FD269C19D350473ACC63034B601019B :00000001FF rabbitsign-2.1+dmca1/test/test-appsign.sh0000700000175000017500000000674511211103001016145 0ustar kbkb#! /bin/sh echo " Generating a random application..." echo " ./randapp 0104 >test.hex" ./randapp 0104 >test.hex || { echo "error generating app ($?)" ; exit 1 ; } echo " Signing the app with appsign..." echo " appsign test" appsign test >/dev/null || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 4 ; } echo " mv test.app testas.app" mv test.app testas.app || { echo "error renaming app ($?)" ; exit 1 ; } echo " Testing the signature..." echo " ../src/rabbitsign -c testas.app -k 0104.key" ../src/rabbitsign -c testas.app -k 0104.key || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 5 ; } echo " Signing the app (all four ways) with rabbitsign and testing" echo " each signature..." echo " ../src/rabbitsign -a -R0 -o testr0.app test.hex -k 0104.key" ../src/rabbitsign -a -R0 -o testr0.app test.hex -k 0104.key || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 2 ; } echo " ../src/rabbitsign -c testr0.app -k 0104.key" ../src/rabbitsign -c testr0.app -k 0104.key || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 3 ; } echo " ../src/rabbitsign -a -R1 -o testr1.app test.hex -k 0104.key" ../src/rabbitsign -a -R1 -o testr1.app test.hex -k 0104.key || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 2 ; } echo " ../src/rabbitsign -c testr1.app -k 0104.key" ../src/rabbitsign -c testr1.app -k 0104.key || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 3 ; } echo " ../src/rabbitsign -a -R2 -o testr2.app test.hex -k 0104.key" ../src/rabbitsign -a -R2 -o testr2.app test.hex -k 0104.key || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 2 ; } echo " ../src/rabbitsign -c testr2.app -k 0104.key" ../src/rabbitsign -c testr2.app -k 0104.key || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 3 ; } echo " ../src/rabbitsign -a -R3 -o testr3.app test.hex -k 0104.key" ../src/rabbitsign -a -R3 -o testr3.app test.hex -k 0104.key || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 2 ; } echo " ../src/rabbitsign -c testr3.app -k 0104.key" ../src/rabbitsign -c testr3.app -k 0104.key || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 3 ; } echo " Testing that exactly one of the signatures matches the" echo " appsign signature..." echo " diff testr0.app testas.app" diff testr0.app testas.app >/dev/null ; STAT0=$? echo " diff testr1.app testas.app" diff testr1.app testas.app >/dev/null ; STAT1=$? echo " diff testr2.app testas.app" diff testr2.app testas.app >/dev/null ; STAT2=$? echo " diff testr3.app testas.app" diff testr3.app testas.app >/dev/null ; STAT3=$? if test $STAT0 = 0 -a $STAT1 != 0 -a $STAT2 != 0 -a $STAT3 != 0 ; then echo " OK, root 0 matches" elif test $STAT0 != 0 -a $STAT1 = 0 -a $STAT2 != 0 -a $STAT3 != 0 ; then echo " OK, root 1 matches" elif test $STAT0 != 0 -a $STAT1 != 0 -a $STAT2 = 0 -a $STAT3 != 0 ; then echo " OK, root 2 matches" elif test $STAT0 != 0 -a $STAT1 != 0 -a $STAT2 != 0 -a $STAT3 = 0 ; then echo " OK, root 3 matches" elif test $STAT0 != 0 -a $STAT1 != 0 -a $STAT2 != 0 -a $STAT3 != 0 ; then echo " No signature matches!" cp test.hex failed.hex diff testas.app testr0.app exit 6 else echo " Multiple signatures match!" cp test.hex failed.hex exit 7 fi rabbitsign-2.1+dmca1/test/test-rabbitsign.sh0000700000175000017500000000163511230723023016636 0ustar kbkb#! /bin/sh if test $# = "0" ; then echo "usage: $0 keynum" exit 99 fi echo " Generating a random application..." echo " ./randapp $1 >test.hex" $TEST_EXEC ./randapp $1 >test.hex || { echo "error generating app ($?)" ; cp test.hex failed.hex ; exit 1 ; } echo " Testing that the unsigned app fails validation..." echo " ../src/rabbitsign -c test.hex" $TEST_EXEC ../src/rabbitsign -c test.hex 2>/dev/null && { echo "success validating unsigned app" ; cp test.hex failed.hex ; exit 3 ; } echo " Signing the app with rabbitsign..." echo " ../src/rabbitsign -r test.hex -o test.sig" $TEST_EXEC ../src/rabbitsign -r test.hex -o test.sig || { echo "error signing app ($?)" ; cp test.hex failed.hex ; exit 2 ; } echo " Testing the signature..." echo " ../src/rabbitsign -c test.sig" $TEST_EXEC ../src/rabbitsign -c test.sig || { echo "error validating app ($?)" ; cp test.hex failed.hex ; exit 3 ; } rabbitsign-2.1+dmca1/config.h.in0000600000175000017500000000707211230733636014260 0ustar kbkb/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the header file. */ #undef HAVE_ASSERT_H /* Define to 1 if you have gmp.h. */ #undef HAVE_GMP_H /* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `rand' function. */ #undef HAVE_RAND /* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM /* Define to 1 if you have the `rindex' function. */ #undef HAVE_RINDEX /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `stricmp' function. */ #undef HAVE_STRICMP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Define to 1 to enable the use of mpz_gcdext(). */ #undef USE_MPZ_GCDEXT /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if does not define. */ #undef size_t rabbitsign-2.1+dmca1/Makefile.in0000600000175000017500000000300111230227062014255 0ustar kbkbprefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ bindir = @bindir@ datadir = @datadir@ mandir = @mandir@ app_key_dir = ${datadir}/rabbitsign AR = @AR@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ GMP_CFLAGS = @GMP_CFLAGS@ GMP_LIBS = @GMP_LIBS@ INSTALL = @INSTALL@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ RANLIB = @RANLIB@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ VPATH = @srcdir@ distname = @PACKAGE_TARNAME@-@PACKAGE_VERSION@ all: cd src && $(MAKE) clean: cd src && $(MAKE) clean cd test && $(MAKE) clean distclean: clean rm -f test/failed.hex rm -f config.h config.status config.log rm -rf autom4te.cache rm -rf $(distname) rm -f $(distname).tar.gz rm -f man/Makefile src/Makefile test/Makefile rm -f Makefile install: cd src && $(MAKE) install cd man && $(MAKE) install uninstall: cd src && $(MAKE) uninstall cd man && $(MAKE) uninstall docs: cd man && $(MAKE) check: cd test && $(MAKE) check dist: rm -rf $(distname) mkdir $(distname) mkdir $(distname)/src mkdir $(distname)/man mkdir $(distname)/keys mkdir $(distname)/test for i in COPYING Makefile.in README config.h.in \ configure configure.ac install-sh \ src/*.c src/*.h src/Makefile.in \ man/*.1 man/*.pdf man/Makefile.in \ keys/README keys/*.key keys/*.pub \ test/*.c test/*.sh test/sample.hex \ test/sample-a.app test/Makefile.in ; \ do cp -p $(srcdir)/$$i $(distname)/$$i ; done tar cfvz $(distname).tar.gz $(distname) .PHONY: all clean distclean install uninstall docs check dist rabbitsign-2.1+dmca1/install-sh0000700000175000017500000002176610126442331014235 0ustar kbkb#!/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: rabbitsign-2.1+dmca1/src/0000700000175000017500000000000011267671205013017 5ustar kbkbrabbitsign-2.1+dmca1/src/input.c0000600000175000017500000002775111224730744014335 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Determine the type of an unknown program, if possible. */ static void guess_type(RSProgram* prgm, int is_hex) { const unsigned char* hdr; unsigned long hdrstart, hdrsize, keyid, fieldstart, fieldsize; /* Z80 OSes have a detached program header */ if (prgm->header_length > 2 && prgm->header[0] == 0x80) { rs_get_field_size(prgm->header, &hdrstart, NULL); hdr = prgm->header + hdrstart; hdrsize = prgm->header_length - hdrstart; keyid = rs_get_numeric_field(0x8010, hdr, hdrsize); prgm->datatype = RS_DATA_OS; if ((keyid & 0xff) == 0x02) { prgm->calctype = RS_CALC_TI73; } else { prgm->calctype = RS_CALC_TI83P; } } else if (prgm->length > 2) { rs_get_field_size(prgm->data, &hdrstart, NULL); hdr = prgm->data + hdrstart; hdrsize = prgm->length - hdrstart; if (hdrsize > 128) hdrsize = 128; /* Z80 apps and 68k OSes have field type 0x8000 */ if (prgm->data[0] == 0x80 && (prgm->data[1] & 0xf0) == 0x00) { keyid = rs_get_numeric_field(0x8010, hdr, hdrsize); switch (keyid & 0xff) { case 0x02: prgm->calctype = RS_CALC_TI73; prgm->datatype = RS_DATA_APP; break; case 0x04: case 0x0A: prgm->calctype = RS_CALC_TI83P; prgm->datatype = RS_DATA_APP; break; case 0x03: case 0x09: prgm->calctype = RS_CALC_TI89; prgm->datatype = RS_DATA_OS; break; case 0x01: case 0x08: prgm->calctype = RS_CALC_TI92P; prgm->datatype = RS_DATA_OS; break; default: if (is_hex) { prgm->calctype = RS_CALC_TI83P; prgm->datatype = RS_DATA_APP; } break; } } /* 68k apps have field type 0x8100 */ else if (prgm->data[0] == 0x81 && (prgm->data[1] & 0xf0) == 0x00) { keyid = rs_get_numeric_field(0x8110, hdr, hdrsize); prgm->datatype = RS_DATA_APP; switch (keyid & 0xff) { case 0x03: case 0x09: prgm->calctype = RS_CALC_TI89; break; case 0x01: case 0x08: prgm->calctype = RS_CALC_TI92P; break; } } /* Certificates have field type 0x0300 */ else if (prgm->data[0] == 0x03 && (prgm->data[1] & 0xf0) == 0x00) { prgm->datatype = RS_DATA_CERT; if (!rs_find_app_field(0x0400, hdr, hdrsize, NULL, &fieldstart, &fieldsize) && fieldsize >= 1) { switch (hdr[fieldstart]) { case 0x02: prgm->calctype = RS_CALC_TI73; break; case 0x04: case 0x0A: prgm->calctype = RS_CALC_TI83P; break; case 0x03: case 0x09: prgm->calctype = RS_CALC_TI89; break; case 0x01: case 0x08: prgm->calctype = RS_CALC_TI92P; break; } } } } } /* * Read the contents of a binary file into an RSProgram. */ static int read_file_binary(RSProgram* prgm, FILE* f, unsigned long filesize) { unsigned char buf[1024]; size_t count; if (filesize) { while (filesize > 0) { if (filesize > 1024) count = fread(buf, 1, 1024, f); else count = fread(buf, 1, filesize, f); if (count > 0) rs_program_append_data(prgm, buf, count); else break; filesize -= count; } } else { do { count = fread(buf, 1, 1024, f); if (count > 0) { rs_program_append_data(prgm, buf, count); } } while (count > 0); } if (!prgm->calctype || !prgm->datatype) guess_type(prgm, 0); return RS_SUCCESS; } /* * Find a given page in the list of page numbers (or add it to the * end.) */ static int getpageidx(RSProgram* prgm, /* program */ unsigned int pagenum) /* page number */ { int i; unsigned int* array; for (i = 0; i < prgm->npagenums; i++) if (prgm->pagenums[i] == pagenum) return i; if (!(array = rs_realloc(prgm->pagenums, (i + 1) * sizeof(unsigned int)))) return 0; prgm->pagenums = array; prgm->npagenums = i + 1; prgm->pagenums[i] = pagenum; return i; } /* * Read an Intel/TI hex file into an RSProgram. * * Note that the first ':' is assumed to have been read already. */ static int read_file_hex(RSProgram* prgm, FILE* f, unsigned int flags) { int c; unsigned int nbytes, addr, rectype, sum, i, b, value; unsigned int pagenum = 0, pageidx = 0, lastaddr = 0; unsigned long offset; unsigned char data[256]; unsigned char* sigp; int nparts = 0; int possibly_os_header = 1; rs_free(prgm->pagenums); if (!(prgm->pagenums = rs_malloc(sizeof(unsigned int)))) return RS_ERR_OUT_OF_MEMORY; prgm->pagenums[0] = 0; prgm->npagenums = 1; while (!feof(f) && !ferror(f)) { if (3 > fscanf(f, "%2X%4X%2X", &nbytes, &addr, &rectype)) { rs_error(NULL, prgm, "invalid hex data (following %X:%X)", pagenum, lastaddr); return RS_ERR_HEX_SYNTAX; } /* Read data bytes */ sum = nbytes + addr + (addr >> 8) + rectype; value = 0; for (i = 0; i < nbytes; i++) { if (1 > fscanf(f, "%2X", &b)) { rs_error(NULL, prgm, "invalid hex data (at %X:%X)", pagenum, addr); return RS_ERR_HEX_SYNTAX; } data[i] = b; sum += b; value = (value << 8) + b; } /* Read checksum */ c = fgetc(f); if (c == 'X') { c = fgetc(f); if (c != 'X') { rs_error(NULL, prgm, "invalid hex data (at %X:%X)", pagenum, addr); return RS_ERR_HEX_SYNTAX; } } else { ungetc(c, f); if (1 > fscanf(f, "%2X", &b)) { rs_error(NULL, prgm, "invalid hex data (at %X:%X)", pagenum, addr); return RS_ERR_HEX_SYNTAX; } sum += b; if (sum & 0xff) rs_warning(NULL, prgm, "incorrect checksum (at %X:%X)", pagenum, addr); } if (rectype == 0 && nbytes > 0) { /* Record type 0: program data */ if (addr & 0xff00) possibly_os_header = 0; addr &= 0x3fff; /* if program does not start at addr 0000 (or 4000), assume unsorted */ if (addr && prgm->length == 0) flags &= ~RS_INPUT_SORTED; if ((flags & RS_INPUT_SORTED) && !addr && lastaddr) { /* automatically switch to next page */ pagenum++; pageidx = getpageidx(prgm, pagenum); if (!pageidx) return RS_ERR_OUT_OF_MEMORY; } else if (addr < lastaddr) flags &= ~RS_INPUT_SORTED; if (nparts == 2 && prgm->header_length) { /* Reading an OS signature */ if (addr + nbytes > prgm->signature_length) { if (!(sigp = rs_realloc(prgm->signature, addr + nbytes))) return RS_ERR_OUT_OF_MEMORY; prgm->signature = sigp; if (addr > prgm->signature_length) { memset(prgm->signature + prgm->signature_length, 0xff, addr - prgm->signature_length); } prgm->signature_length = addr + nbytes; } memcpy(prgm->signature + addr, data, nbytes); } else { /* Reading normal program data */ offset = ((unsigned long) pageidx << 14) | addr; if (offset + nbytes <= prgm->length) { memcpy(prgm->data + offset, data, nbytes); } else { rs_program_set_length(prgm, offset); rs_program_append_data(prgm, data, nbytes); } } lastaddr = addr; } else if (rectype == 1) { /* Record type 1: "end of file" */ nparts++; if (nparts == 3 && prgm->header_length) break; } else if (rectype == 2 || rectype == 4) { /* Record type 2 or 4: extended address */ possibly_os_header = 0; flags &= ~RS_INPUT_SORTED; if (nparts < 2) { pagenum = value; pageidx = getpageidx(prgm, pagenum); if (pagenum && !pageidx) return RS_ERR_OUT_OF_MEMORY; } } do { c = fgetc(f); } while (c == '\n' || c == '\r' || c == ' '); if (c == EOF) break; else if (c != ':') { if (rectype == 1) break; else { rs_error(NULL, prgm, "invalid hex data (following %X:%X)", pagenum, lastaddr); return RS_ERR_HEX_SYNTAX; } } if (rectype == 1 && nparts == 1 && prgm->length > 0 && possibly_os_header) { /* Just finished reading OS header */ flags &= ~RS_INPUT_SORTED; pagenum = pageidx = 0; rs_free(prgm->header); if (!(prgm->header = rs_malloc(prgm->length))) return RS_ERR_OUT_OF_MEMORY; memcpy(prgm->header, prgm->data, prgm->length); prgm->header_length = prgm->length; prgm->length = 0; possibly_os_header = 0; } } if (!prgm->calctype || !prgm->datatype) guess_type(prgm, 1); return RS_SUCCESS; } /* * Check if calc/data type matches expected type (or any recognized * type, if none was specified.) */ static int check_tifl_type(int calctype, int datatype, int calctype_expected, int datatype_expected) { if (calctype_expected) { if (calctype_expected != calctype) return 0; } else { if (calctype != RS_CALC_TI73 && calctype != RS_CALC_TI83P && calctype != RS_CALC_TI89 && calctype != RS_CALC_TI92P) return 0; } if (datatype_expected) { if (datatype_expected != datatype) return 0; } else { if (datatype != RS_DATA_APP && datatype != RS_DATA_OS) return 0; } return 1; } /* * Read program contents from a file. * * Various file formats are supported: * * - Raw binary (must begin with the value 0x80 or 0x81) * - Plain Intel/TI hex * - Binary TIFL (89k, 89u, ...) * - Hex TIFL (8xk, 8xu, ...) * * Note: on platforms where it matters, all input files must be opened * in "binary" mode. */ int rs_read_program_file(RSProgram* prgm, /* program */ FILE* f, /* file */ const char* fname, /* file name */ unsigned int flags) /* option flags */ { int c; unsigned char tiflbuf[78]; unsigned long tiflsize, i; int e; rs_program_set_length(prgm, 0); prgm->header_length = 0; prgm->signature_length = 0; prgm->npagenums = 0; rs_free(prgm->filename); prgm->filename = rs_strdup(fname); if (fname && !prgm->filename) return RS_ERR_OUT_OF_MEMORY; if (flags & RS_INPUT_BINARY) return read_file_binary(prgm, f, 0); c = fgetc(f); if (c == 0x80 || c == 0x81) { tiflbuf[0] = c; if ((e = rs_program_append_data(prgm, tiflbuf, 1))) return e; return read_file_binary(prgm, f, 0); } while (!feof(f) && !ferror(f)) { if (c == ':') { return read_file_hex(prgm, f, flags); } else if (c == '*') { if (fread(tiflbuf, 1, 78, f) < 78 || strncmp((char*) tiflbuf, "*TIFL**", 7)) { rs_error(NULL, prgm, "unknown input file format"); return RS_ERR_UNKNOWN_FILE_FORMAT; } tiflsize = ((unsigned long) tiflbuf[73] | ((unsigned long) tiflbuf[74] << 8) | ((unsigned long) tiflbuf[75] << 16) | ((unsigned long) tiflbuf[76] << 24)); if (check_tifl_type(tiflbuf[47], tiflbuf[48], prgm->calctype, prgm->datatype)) { prgm->calctype = tiflbuf[47]; prgm->datatype = tiflbuf[48]; if (tiflbuf[77] == ':') return read_file_hex(prgm, f, 0); else { if ((e = rs_program_append_data(prgm, tiflbuf + 77, 1))) return e; return read_file_binary(prgm, f, tiflsize ? tiflsize - 1 : 0); } } else { /* extra data (license, certificate, etc.) -- ignore */ if (fseek(f, tiflsize - 1, SEEK_CUR)) { for (i = 0; i < tiflsize - 1; i++) { if (fgetc(f) == EOF) { rs_error(NULL, prgm, "unexpected EOF"); return RS_ERR_UNKNOWN_FILE_FORMAT; } } } } } c = fgetc(f); } rs_error(NULL, prgm, "unknown input file format"); return RS_ERR_UNKNOWN_FILE_FORMAT; } rabbitsign-2.1+dmca1/src/os8x.c0000600000175000017500000002065011224736051014063 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" #include "md5.h" /* * Check/fix OS header fields and data. * * The OS header is much simpler than an application header, and its * correctness is not as crucial to validation. The most important * parts of the OS header are the key ID and (for newer calculators) * the hardware compatibility level. There is no date stamp required. * The page count is not required, and if present, is used only to * display the transfer percentage (when using the 84+ boot code.) * * TI only sets the OS and program image size fields in their TI-73 OS * headers. (Bizarrely, they are set in the true OS header, but not * in the fake OS header that is transferred to page 1A. Furthermore, * the OS size field is incorrect.) In any case, these fields appear * to be ignored by all versions of the boot code. */ int rs_repair_ti8x_os(RSProgram* os, /* OS */ unsigned int flags) /* flags */ { unsigned long hdrstart, hdrsize, fieldhead, fieldstart, fieldsize, ossize; unsigned char* hdr; int i; /* Pad the OS to a multiple of 16384. (While strictly speaking we could get away with only padding each page to a multiple of 256, such "partial OSes" are not supported by most linking software.) */ rs_program_set_length(os, ((os->length + 0x3fff) & ~0x3fff)); /* If no OS header was provided in the input, try to get a header from page 1A instead */ if (os->header_length < 6 || os->header[0] != 0x80 || os->header[1] != 0x0f) { for (i = 0; i < os->npagenums; i++) { if (os->pagenums[i] == 0x1a) { rs_free(os->header); if (!(os->header = rs_malloc(256))) return RS_ERR_OUT_OF_MEMORY; memcpy(os->header, os->data + ((unsigned long) i << 14), 256); os->header_length = 256; break; } } } /* Clear old header/signature (not done on the TI-73 because official TI-73 OSes contain a fake header; I don't recommend doing this for third-party OSes) */ if (os->calctype != RS_CALC_TI73) for (i = 0; i < os->npagenums; i++) if (os->pagenums[i] == 0x1a) memset(os->data + ((unsigned long) i << 14), 0xff, 512); /* Fix header size. OS headers must always begin with an 800x field and end with an 807x field (TI always uses 800F and 807F, as for apps; I'm not sure whether it's required.) */ if (os->header_length < 6 || os->header[0] != 0x80 || (os->header[1] & 0xf0) != 0) { rs_error(NULL, os, "no OS header found"); return RS_ERR_MISSING_HEADER; } rs_get_field_size(os->header, &hdrstart, NULL); hdr = os->header + hdrstart; hdrsize = os->header_length - hdrstart; if (rs_find_app_field(0x8070, hdr, hdrsize, &fieldhead, &fieldstart, &fieldsize)) { rs_error(NULL, os, "OS header has no program image field"); return RS_ERR_MISSING_PROGRAM_IMAGE; } hdrsize = fieldstart; os->header_length = hdrstart + hdrsize; if ((os->header_length % 64) == 55) { if (flags & RS_IGNORE_ALL_WARNINGS) { rs_warning(NULL, os, "OS header has length 55 mod 64"); rs_warning(NULL, os, "(this will fail to validate on TI-83+ BE)"); } else { rs_error(NULL, os, "OS header has length 55 mod 64"); rs_error(NULL, os, "(this will fail to validate on TI-83+ BE)"); return RS_ERR_INVALID_PROGRAM_SIZE; } } /* Fix OS / OS image sizes if requested */ if (flags & RS_FIX_OS_SIZE) { ossize = os->length + hdrsize; if (rs_set_field_size(os->header, ossize)) { rs_error(NULL, os, "cannot set OS length"); return RS_ERR_FIELD_TOO_SMALL; } if (rs_set_field_size(hdr + fieldhead, os->length)) { rs_error(NULL, os, "cannot set OS image length"); return RS_ERR_FIELD_TOO_SMALL; } } /* Check for key ID */ if (rs_find_app_field(0x8010, hdr, hdrsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, os, "OS header has no key ID field"); else { rs_error(NULL, os, "OS header has no key ID field"); return RS_ERR_MISSING_KEY_ID; } } /* Check/fix page count */ if (rs_find_app_field(0x8080, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (os->length != 14 * 0x4000L) { rs_warning(NULL, os, "OS header has no page count field"); } } else if (fieldsize != 1) { rs_warning(NULL, os, "OS header has an invalid page count field"); } else if (flags & RS_FIX_PAGE_COUNT) { hdr[fieldstart] = os->length >> 14; } else if (hdr[fieldstart] != (os->length >> 14)) { rs_warning(NULL, os, "OS header has an incorrect page count field"); } /* Check and reset validation flag bytes */ if (os->data[0x56] != 0xff && os->data[0x56] != 0x5a) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, os, "OS has invalid data at 0056h"); else { rs_error(NULL, os, "OS has invalid data at 0056h"); return RS_ERR_INVALID_PROGRAM_DATA; } } if (os->data[0x56] == 0x5a) os->data[0x56] = 0xff; if (os->data[0x57] != 0xff && os->data[0x57] != 0xa5) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, os, "OS has invalid data at 0057h"); else { rs_error(NULL, os, "OS has invalid data at 0057h"); return RS_ERR_INVALID_PROGRAM_DATA; } } if (os->data[0x57] == 0xff) os->data[0x57] = 0xa5; return RS_SUCCESS; } /* * Compute signature for an OS. */ int rs_sign_ti8x_os(RSProgram* os, /* OS */ RSKey* key) /* signing key */ { struct md5_ctx ctx; md5_uint32 hash[4]; mpz_t hashv, sigv; unsigned char sigdata[512]; size_t siglength; int e; md5_init_ctx(&ctx); md5_process_bytes(os->header, os->header_length, &ctx); md5_process_bytes(os->data, os->length, &ctx); md5_finish_ctx(&ctx, hash); mpz_init(hashv); mpz_init(sigv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, os, "hash = %ZX", hashv); if ((e = rs_sign_rsa(sigv, hashv, key))) { mpz_clear(hashv); mpz_clear(sigv); return e; } rs_message(2, NULL, os, "sig = %ZX", sigv); sigdata[0] = 0x02; sigdata[1] = 0x0d; mpz_export(sigdata + 3, &siglength, -1, 1, 0, 0, sigv); sigdata[2] = siglength & 0xff; siglength += 3; while (siglength < 96) sigdata[siglength++] = 0xff; rs_free(os->signature); if (!(os->signature = rs_malloc(siglength))) return RS_ERR_OUT_OF_MEMORY; memcpy(os->signature, sigdata, siglength); os->signature_length = siglength; return RS_SUCCESS; } /* * Validate OS signature. */ int rs_validate_ti8x_os(const RSProgram* os, const RSKey* key) { unsigned long fieldstart, fieldsize; struct md5_ctx ctx; md5_uint32 hash[4]; mpz_t hashv, sigv; int e; if (os->signature_length < 3) { rs_error(NULL, os, "OS does not have a signature"); return RS_ERR_MISSING_RSA_SIGNATURE; } if (os->signature[0] != 0x02 || (os->signature[1] & 0xf0) != 0x00) { rs_error(NULL, os, "OS does not have an RSA signature"); return RS_ERR_MISSING_RSA_SIGNATURE; } rs_get_field_size(os->signature, &fieldstart, &fieldsize); md5_init_ctx(&ctx); md5_process_bytes(os->header, os->header_length, &ctx); md5_process_bytes(os->data, os->length, &ctx); md5_finish_ctx(&ctx, hash); mpz_init(hashv); mpz_init(sigv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, os, "hash = %ZX", hashv); mpz_import(sigv, fieldsize, -1, 1, 0, 0, os->signature + fieldstart); rs_message(2, NULL, os, "sig = %ZX", sigv); e = rs_validate_rsa(sigv, hashv, key); if (e == RS_SIGNATURE_INCORRECT) rs_message(0, NULL, os, "OS signature incorrect"); mpz_clear(hashv); mpz_clear(sigv); return e; } rabbitsign-2.1+dmca1/src/md5.c0000600000175000017500000003101711127554513013651 0ustar kbkb/* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ /* Written by Ulrich Drepper , 1995. */ #ifdef HAVE_CONFIG_H # include #endif #include #if STDC_HEADERS || defined _LIBC # include # include #else # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #include "md5.h" #ifdef _LIBC # include # if __BYTE_ORDER == __BIG_ENDIAN # define WORDS_BIGENDIAN 1 # endif #endif #ifdef WORDS_BIGENDIAN # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void md5_init_ctx (ctx) struct md5_ctx *ctx; { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (ctx, resbuf) const struct md5_ctx *ctx; void *resbuf; { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (ctx, resbuf) struct md5_ctx *ctx; void *resbuf; { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (stream, resblock) FILE *stream; void *resblock; { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 struct md5_ctx ctx; char buffer[BLOCKSIZE + 72]; size_t sum; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Iterate over full file contents. */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do { n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); sum += n; } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) break; /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } /* Add the last bytes if necessary. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); return 0; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md5_buffer (buffer, len, resblock) const char *buffer; size_t len; void *resblock; { struct md5_ctx ctx; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md5_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md5_finish_ctx (&ctx, resblock); } void md5_process_bytes (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (left_over + add > 64) { md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], (left_over + add) & 63); ctx->buflen = (left_over + add) & 63; } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len > 64) { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } rabbitsign-2.1+dmca1/src/typestr.c0000600000175000017500000000755411207676262014714 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Get default file suffix for a given calc/data type. */ const char* rs_type_to_suffix(RSCalcType calctype, /* calculator type */ RSDataType datatype, /* program data type */ int hexonly) /* 1 = plain hex output */ { if (calctype == RS_CALC_TI73) { if (datatype == RS_DATA_APP) return (hexonly ? "app" : "73k"); else if (datatype == RS_DATA_OS) return (hexonly ? "hex" : "73u"); else if (datatype == RS_DATA_CERT) return "73q"; } else if (calctype == RS_CALC_TI83P) { if (datatype == RS_DATA_APP) return (hexonly ? "app" : "8xk"); else if (datatype == RS_DATA_OS) return (hexonly ? "hex" : "8xu"); else if (datatype == RS_DATA_CERT) return "8xq"; } else if (calctype == RS_CALC_TI89) { if (datatype == RS_DATA_APP) return "89k"; else if (datatype == RS_DATA_OS) return "89u"; else if (datatype == RS_DATA_CERT) return "89q"; } else if (calctype == RS_CALC_TI92P) { if (datatype == RS_DATA_APP) return "9xk"; else if (datatype == RS_DATA_OS) return "9xu"; else if (datatype == RS_DATA_CERT) return "9xq"; } return "sig"; } /* * Get implied calc/data type for a given file suffix. */ int rs_suffix_to_type(const char* suff, /* file suffix (not including .) */ RSCalcType* calctype, /* implied calculator type */ RSDataType* datatype) /* implied program type */ { int calc, data; if (strlen(suff) != 3) return -1; if (suff[0] == '7' && suff[1] == '3') calc = RS_CALC_TI73; else if (suff[0] == '8' && (suff[1] == 'x' || suff[1] == 'X')) calc = RS_CALC_TI83P; else if (suff[0] == '8' && suff[1] == '9') calc = RS_CALC_TI89; else if (suff[0] == '9' && (suff[1] == 'x' || suff[1] == 'X')) calc = RS_CALC_TI92P; else if ((suff[0] == 'v' || suff[0] == 'V') && suff[1] == '2') calc = RS_CALC_TI92P; else return -1; if (suff[2] == 'k' || suff[2] == 'K') data = RS_DATA_APP; else if (suff[2] == 'u' || suff[2] == 'U') data = RS_DATA_OS; else if (suff[2] == 'q' || suff[2] == 'Q') data = RS_DATA_CERT; else return -1; if (calctype) *calctype = calc; if (datatype) *datatype = data; return 0; } /* * Get a human-readable description of a calculator type. */ const char* rs_calc_type_to_string(RSCalcType calctype) { switch (calctype) { case RS_CALC_TI73: return "TI-73"; case RS_CALC_TI83P: return "TI-83/84 Plus"; case RS_CALC_TI89: return "TI-89"; case RS_CALC_TI92P: return "TI-92 Plus/Voyage 200"; default: return "unknown"; } } /* * Get a human-readable description of a data type. */ const char* rs_data_type_to_string(RSDataType datatype) { switch (datatype) { case RS_DATA_OS: return "OS"; case RS_DATA_APP: return "application"; case RS_DATA_CERT: return "certificate"; default: return "program"; } } rabbitsign-2.1+dmca1/src/mem.c0000600000175000017500000000275711224414470013746 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" void* rs_realloc(void* ptr, unsigned long count) { void* p; if (!count) { if (ptr) { free(ptr); } return NULL; } if (ptr) p = realloc(ptr, count); else p = malloc(count); if (!p) rs_error(NULL, NULL, "out of memory (need %lu bytes)", count); return p; } char* rs_strdup(const char* str) { int n; char* p; if (!str) return NULL; n = strlen(str); p = rs_malloc(n + 1); if (p) memcpy(p, str, n + 1); return p; } rabbitsign-2.1+dmca1/src/mpz.c0000600000175000017500000004674611230733537014011 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_ASSERT_H # include #else # define assert(xxx) if (!(xxx)) { \ fprintf(stderr, "mpz: assertion \"%s\" failed\n", #xxx); \ abort(); \ } #endif #include "mpz.h" /* * This file contains multiple-precision arithmetic functions. These * are equivalent to the corresponding GMP functions in the ways they * are used by RabbitSign. * * HOWEVER, they are not by any means complete. They do not meet the * specifications of the GMP functions; for the sake of portability * and compactness they are vastly less efficient; and they may even * have bugs. */ /* #define DBG(args...) if (1) \ do { \ gmp_fprintf(stderr, "mpz: " args); \ fputc('\n', stderr); \ } while (0) */ #define IDX(nnn, iii) (nnn)->m[iii] /* \ (*(__extension__ ({ \ int _ii = (iii); \ const struct _mpz* _nn = (nnn); \ assert(_nn->size <= _nn->size_alloc); \ assert(_ii >= 0); \ assert(((unsigned) _ii) < (_nn->size)); \ &(_nn->m[_ii]); }))) */ static void* xrealloc(p, n) void* p; size_t n; { void* res; if (n <= 0) n = 1; if (p) res = realloc(p, n); else res = malloc(n); if (!res) { fprintf(stderr,"mpz: out of memory (need %lu bytes)\n", (unsigned long) n); abort(); } return res; } static inline void allocate_mpz(x) mpz_t x; { if (x->size_alloc < x->size) { x->size_alloc = x->size; x->m = (limb_t*) xrealloc(x->m, x->size_alloc * sizeof(limb_t)); } } static inline void zero_mpz(x) mpz_t x; { size_t i; for (i = 0; i < x->size; i++) IDX(x, i) = 0; } static inline void copyref_mpz(dest, src) mpz_t dest; const mpz_t src; { dest->size = src->size; dest->size_alloc = src->size_alloc; dest->m = src->m; dest->sign = src->sign; } static inline void reduce_mpz(x) mpz_t x; { while (x->size > 0 && IDX(x, (x->size) - 1) == 0) x->size--; } /**************** Init / Clear ****************/ void mpz_init(x) mpz_t x; { x->size = 0; x->size_alloc = 0; x->m = (limb_t*)0; x->sign = 1; } void mpz_clear(x) mpz_t x; { if (x->m) free(x->m); mpz_init(x); } /**************** Setting ****************/ void mpz_set(dest, src) mpz_t dest; const mpz_t src; { size_t i; dest->size = src->size; allocate_mpz(dest); dest->sign = src->sign; for (i = 0; i < src->size; i++) IDX(dest, i) = IDX(src, i); } void mpz_set_ui(dest, a) mpz_t dest; unsigned int a; { if (a) { dest->size = 1; allocate_mpz(dest); IDX(dest, 0) = a; } else dest->size = 0; dest->sign = 1; } unsigned int mpz_get_ui(a) const mpz_t a; { return IDX(a, 0); } static void mpz_swap(a, b) mpz_t a; mpz_t b; { mpz_t temp; copyref_mpz(temp, a); copyref_mpz(a, b); copyref_mpz(b, temp); } /**************** Import / Export ****************/ void mpz_import(dest, count, order, size, endian, nails, op) mpz_t dest; size_t count; int order; /* must be -1 (little endian structure) */ int size; /* must be 1 (bytes) */ int endian; /* must be 0 (native endian words, doesn't matter for bytes) */ size_t nails; /* must be 0 (no nails) */ const void* op; { size_t i, j; assert(order == -1); assert(size == 1); assert(endian == 0); assert(nails == 0); dest->size = (count + LIMB_BYTES - 1) / LIMB_BYTES; allocate_mpz(dest); dest->sign = 1; for (i = 0; i < dest->size; i++) { IDX(dest, i) = 0; for (j = 0; j < LIMB_BYTES && ((i * LIMB_BYTES) + j) < count; j++) { IDX(dest, i) |= ((unsigned char*)op)[(i * LIMB_BYTES) + j] << 8 * j; } } } void mpz_export(dest, count, order, size, endian, nails, op) void* dest; size_t* count; int order; /* must be -1 (little endian structure) */ int size; /* must be 1 (bytes) */ int endian; /* must be 0 (native endian words, doesn't matter for bytes) */ size_t nails; /* must be 0 (no nails) */ const mpz_t op; { size_t i, j; assert(order == -1); assert(size == 1); assert(endian == 0); assert(nails == 0); for (i = 0; i < op->size; i++) { for (j = 0; j < LIMB_BYTES; j++) { ((unsigned char*)dest)[(i * LIMB_BYTES) + j] = IDX(op, i) >> 8 * j; } } *count = op->size * LIMB_BYTES; } /**************** Comparison ****************/ int mpz_sgn(a) const mpz_t a; { size_t i = a->size; while (i > 0 && IDX(a, i - 1) == 0) i--; if (i == 0) return 0; else return a->sign; } static int mpz_cmpabs(a, b) const mpz_t a; const mpz_t b; { size_t sa = a->size; size_t sb = b->size; while (sa > 0 && IDX(a, sa - 1) == 0) sa--; while (sb > 0 && IDX(b, sb - 1) == 0) sb--; if (sa > sb) return 1; else if (sb > sa) return -1; while (sa > 0) { if (IDX(a, sa - 1) > IDX(b, sa - 1)) return 1; else if (IDX(a, sa - 1) < IDX(b, sa - 1)) return -1; sa--; } return 0; } int mpz_cmp(a, b) const mpz_t a; const mpz_t b; { size_t sa = a->size; size_t sb = b->size; while (sa > 0 && IDX(a, sa - 1) == 0) sa--; while (sb > 0 && IDX(b, sb - 1) == 0) sb--; if (sa == 0 && sb == 0) return 0; else if (sa == 0) return -(b->sign); else if (sb == 0) return a->sign; else if (a->sign != b->sign) return a->sign; return a->sign * mpz_cmpabs(a, b); } int mpz_cmp_ui(a, b) const mpz_t a; unsigned int b; { size_t sa = a->size; while (sa > 0 && IDX(a, sa - 1) == 0) sa--; if (sa == 0 && b == 0) return 0; if (sa == 1 && a->sign == 1) { if (IDX(a, 0) > b) return 1; else if (IDX(a, 0) < b) return -1; else return 0; } return (a->sign); } /**************** Addition / Subtraction ****************/ static void mpz_addabs(dest, a, b) mpz_t dest; /* != a, b */ const mpz_t a; const mpz_t b; { size_t i; double_limb_t carry = 0; if (a->size > b->size) dest->size = a->size + 1; else dest->size = b->size + 1; allocate_mpz(dest); assert(dest != a); assert(dest != b); for (i = 0; i < a->size && i < b->size; i++) { carry += IDX(a, i); carry += IDX(b, i); IDX(dest, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } for (; i < a->size; i++) { carry += IDX(a, i); IDX(dest, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } for (; i < b->size; i++) { carry += IDX(b, i); IDX(dest, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } IDX(dest, i) = carry; } static void mpz_subabs(dest, a, b) mpz_t dest; /* != b */ const mpz_t a; const mpz_t b; /* must be <= a */ { size_t i; signed_double_limb_t carry = 0; dest->size = a->size; allocate_mpz(dest); assert(dest != b); for (i = 0; i < a->size && i < b->size; i++) { carry += IDX(a, i); carry -= IDX(b, i); IDX(dest, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } for (; i < a->size; i++) { carry += IDX(a, i); IDX(dest, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } assert(carry == 0); } void mpz_add(dest, a, b) mpz_t dest; const mpz_t a; const mpz_t b; { mpz_t temp; mpz_init(temp); if (a->sign == b->sign) { temp->sign = a->sign; mpz_addabs(temp, a, b); } else if (mpz_cmpabs(a, b) > 0) { temp->sign = a->sign; mpz_subabs(temp, a, b); } else { temp->sign = b->sign; mpz_subabs(temp, b, a); } reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } void mpz_sub(dest, a, b) mpz_t dest; const mpz_t a; const mpz_t b; { mpz_t temp; mpz_init(temp); if (a->sign != b->sign) { temp->sign = a->sign; mpz_addabs(temp, a, b); } else if (mpz_cmpabs(a, b) > 0) { temp->sign = a->sign; mpz_subabs(temp, a, b); } else { temp->sign = -(b->sign); mpz_subabs(temp, b, a); } reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } void mpz_add_ui(dest, a, b) mpz_t dest; const mpz_t a; unsigned int b; { size_t i; mpz_t temp; mpz_init(temp); temp->size = a->size + 1; temp->sign = a->sign; allocate_mpz(temp); for (i = 0; i < a->size; i++) { IDX(temp, i) = IDX(a, i) + b; b = (IDX(temp, i) < IDX(a, i)) ? 1 : 0; } IDX(temp, i) = b; reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } void mpz_sub_ui(dest, a, b) mpz_t dest; const mpz_t a; unsigned int b; { size_t i; mpz_t temp; mpz_init(temp); temp->size = a->size; temp->sign = a->sign; allocate_mpz(temp); for (i = 0; i < a->size; i++) { IDX(temp, i) = IDX(a, i) - b; b = (IDX(temp, i) > IDX(a, i)) ? 1 : 0; } assert(b == 0); reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } /**************** Multiplication ****************/ void mpz_mul(dest, a, b) mpz_t dest; const mpz_t a; const mpz_t b; { double_limb_t carry = 0, newcarry; size_t i, j, k; mpz_t temp; mpz_init(temp); temp->size = a->size + b->size; temp->sign = a->sign * b->sign; allocate_mpz(temp); zero_mpz(temp); for (i = 0; i < a->size; i++) { for (j = 0; j < b->size; j++) { carry = IDX(a, i); carry *= IDX(b, j); for (k = i + j; k < temp->size && carry; k++) { newcarry = carry + IDX(temp, k); if (newcarry < carry) { IDX(temp, k) = newcarry & LIMB_MASK; carry = (newcarry >> LIMB_BITS) + LIMB_MASK + 1; } else { IDX(temp, k) = newcarry & LIMB_MASK; carry = (newcarry >> LIMB_BITS); } } assert(carry == 0); } } reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } void mpz_mul_ui(dest, a, b) mpz_t dest; const mpz_t a; unsigned int b; /* must be fairly small */ { double_limb_t carry = 0; size_t i; mpz_t temp; mpz_init(temp); temp->size = a->size + 1; temp->sign = a->sign; allocate_mpz(temp); for (i = 0; i < a->size; i++) { carry += (double_limb_t) IDX(a, i) * b; IDX(temp, i) = carry & LIMB_MASK; carry >>= LIMB_BITS; } IDX(temp, i) = carry & LIMB_MASK; reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } /**************** Division ****************/ void mpz_fdiv_q_2exp(dest, a, b) mpz_t dest; const mpz_t a; unsigned int b; /* must be <= LIMB_BITS */ { size_t i; mpz_t temp; mpz_init(temp); assert(b <= LIMB_BITS); temp->size = a->size; temp->sign = a->sign; allocate_mpz(temp); if (a->size > 0) { for (i = 0; i < (a->size - 1); i++) { IDX(temp, i) = (((IDX(a, i) >> b) | (IDX(a, i + 1) << (LIMB_BITS - b))) & LIMB_MASK); } IDX(temp, a->size - 1) = IDX(a, a->size - 1) >> b; } reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } /**************** Division / Modulus ****************/ static void mpz_setbit(dest, n) mpz_t dest; unsigned int n; { size_t i, j; i = n / LIMB_BITS + 1; if (dest->size < i) { j = dest->size; dest->size = i; allocate_mpz(dest); while (j < i) { IDX(dest, j) = 0; j++; } } IDX(dest, i - 1) |= (1 << (n % LIMB_BITS)); } static void mpz_fdiv_qr(q, r, num, den) mpz_t q; mpz_t r; const mpz_t num; const mpz_t den; { size_t shiftct = 0; size_t i; mpz_t remainder; mpz_t quotient; mpz_t shifted; /* shifted = mod * 2^(shiftct) */ mpz_init(remainder); mpz_init(shifted); if (q) { mpz_init(quotient); quotient->sign = num->sign * den->sign; } shifted->size = num->size; allocate_mpz(shifted); mpz_set(remainder, num); mpz_set(shifted, den); reduce_mpz(shifted); assert(shifted->size > 0); while (mpz_cmpabs(remainder, shifted) > 0) { shifted->size++; allocate_mpz(shifted); for (i = shifted->size - 1; i > 0; i--) IDX(shifted, i) = IDX(shifted, i - 1); IDX(shifted, 0) = 0; shiftct += LIMB_BITS; } while (shiftct != 0) { if (mpz_cmpabs(remainder, shifted) >= 0) { mpz_subabs(remainder, remainder, shifted); reduce_mpz(remainder); if (q) mpz_setbit(quotient, shiftct); } mpz_fdiv_q_2exp(shifted, shifted, 1); shiftct--; } if (mpz_cmpabs(remainder, den) >= 0) { mpz_subabs(remainder, remainder, den); if (q) mpz_setbit(quotient, 0); } if (mpz_sgn(remainder) == -1) { mpz_add(remainder, remainder, den); if (q) mpz_sub_ui(quotient, quotient, 1); } mpz_clear(shifted); reduce_mpz(remainder); mpz_clear(r); copyref_mpz(r, remainder); if (q) { reduce_mpz(quotient); mpz_clear(q); copyref_mpz(q, quotient); } } void mpz_mod(dest, a, mod) mpz_t dest; const mpz_t a; const mpz_t mod; { mpz_fdiv_qr(NULL, dest, a, mod); } /**************** Modular exponent ****************/ void mpz_powm(dest, base, exp, mod) mpz_t dest; const mpz_t base; const mpz_t exp; const mpz_t mod; { mpz_t exp_bits; mpz_t base_power; mpz_t temp; mpz_init(exp_bits); mpz_init(base_power); mpz_init(temp); mpz_set(exp_bits, exp); mpz_set(base_power, base); mpz_set_ui(temp, 1); reduce_mpz(exp_bits); assert(exp_bits->sign == 1 || exp_bits->size == 0); while (exp_bits->size > 0) { if (IDX(exp_bits, 0) & 1) { mpz_mul(temp, temp, base_power); mpz_mod(temp, temp, mod); } mpz_mul(base_power, base_power, base_power); mpz_mod(base_power, base_power, mod); mpz_fdiv_q_2exp(exp_bits, exp_bits, 1); } mpz_clear(exp_bits); mpz_clear(base_power); reduce_mpz(temp); mpz_clear(dest); copyref_mpz(dest, temp); } /**************** Legendre symbol ****************/ int mpz_legendre(a, p) const mpz_t a; const mpz_t p; { int x; mpz_t exp; mpz_t pow; mpz_init(exp); mpz_init(pow); mpz_set(exp, p); mpz_sub_ui(exp, exp, 1); mpz_fdiv_q_2exp(exp, exp, 1); mpz_powm(pow, a, exp, p); if (pow->size == 1 && IDX(pow, 0) == 1) x = 1; else if (pow->size == 0) x = 0; else x = -1; mpz_clear(exp); mpz_clear(pow); return x; } /**************** GCD ****************/ static void mpz_gcdext_main(g, ai, bi, a, b) mpz_t g; mpz_t ai; mpz_t bi; const mpz_t a; const mpz_t b; { mpz_t rem_last, rem_cur; mpz_t ai_last, ai_cur; mpz_t bi_last, bi_cur; mpz_t q, temp; mpz_init(rem_last); mpz_init(rem_cur); mpz_init(q); mpz_set(rem_last, a); mpz_set(rem_cur, b); if (ai) { mpz_init(ai_last); mpz_init(ai_cur); mpz_set_ui(ai_last, 1); } if (bi) { mpz_init(bi_last); mpz_init(bi_cur); mpz_set_ui(bi_cur, 1); } assert(a->sign == 1 && a->size > 0); assert(b->sign == 1 && b->size > 0); while (1) { mpz_fdiv_qr(q, rem_last, rem_last, rem_cur); mpz_swap(rem_last, rem_cur); if (!mpz_sgn(rem_cur)) break; if (ai) { mpz_init(temp); mpz_mul(temp, q, ai_cur); mpz_sub(temp, ai_last, temp); mpz_clear(ai_last); copyref_mpz(ai_last, ai_cur); copyref_mpz(ai_cur, temp); } if (bi) { mpz_init(temp); mpz_mul(temp, q, bi_cur); mpz_sub(temp, bi_last, temp); mpz_clear(bi_last); copyref_mpz(bi_last, bi_cur); copyref_mpz(bi_cur, temp); } } mpz_clear(g); copyref_mpz(g, rem_last); mpz_clear(rem_cur); mpz_clear(q); if (ai) { mpz_clear(ai); copyref_mpz(ai, ai_cur); mpz_clear(ai_last); } if (bi) { mpz_clear(bi); copyref_mpz(bi, bi_cur); mpz_clear(bi_last); } } void mpz_gcdext(g, ai, bi, a, b) mpz_t g; mpz_t ai; mpz_t bi; const mpz_t a; const mpz_t b; { if (mpz_cmpabs(a, b) > 0) mpz_gcdext_main(g, ai, bi, a, b); else mpz_gcdext_main(g, bi, ai, b, a); } /**************** Output ****************/ #define PUTCH(bbb, sss, nnn, ccc) do { \ if ((sss) > 1) { \ *(bbb) = (ccc); \ (bbb)++; \ (sss)--; \ } \ (nnn)++; \ } while (0) static int putnum(char** buf, size_t* size, unsigned long value, unsigned int base) { unsigned long s; unsigned int d; int count = 0; if (value == 0) { PUTCH(*buf, *size, count, '0'); } else { s = value / base; if (s) count = putnum(buf, size, value / base, base); d = value % base; if (d < 10) PUTCH(*buf, *size, count, d + '0'); else PUTCH(*buf, *size, count, d + 'A' - 10); } return count; } /* Supported conversions: %% %s %c %d %i %o %u %X %ld %li %lo %lu %lX %ZX */ int rs_vsnprintf(char* buf, size_t size, const char* fmt, va_list ap) { int count = 0; int argtype, convtype; const char* strval; long longval; struct _mpz *mpval; limb_t v, d; size_t i; int j; while (fmt[0]) { if (fmt[0] != '%') { PUTCH(buf, size, count, fmt[0]); fmt++; } else if (fmt[1] == '%') { PUTCH(buf, size, count, '%'); fmt += 2; } else { if (fmt[1] == 'l' || fmt[1] == 'Z') { argtype = fmt[1]; convtype = fmt[2]; fmt += 3; } else { argtype = 0; convtype = fmt[1]; fmt += 2; } if (!convtype) break; if (convtype == 's') { /* string argument */ strval = va_arg(ap, const char *); if (!strval) strval = "(NULL)"; while (*strval) { PUTCH(buf, size, count, *strval); strval++; } } else if (convtype == 'c' || convtype == 'd' || convtype == 'i' || convtype == 'u' || convtype == 'x' || convtype == 'X') { if (argtype == 'Z') { /* mpz argument -- always print in hexadecimal */ mpval = va_arg(ap, struct _mpz *); if (mpval->sign < 0) PUTCH(buf, size, count, '-'); v = IDX(mpval, mpval->size - 1); count += putnum(&buf, &size, v, 16); for (i = mpval->size - 1; i > 0; i--) { v = IDX(mpval, i - 1); for (j = LIMB_BITS - 4; j >= 0; j -= 4) { d = ((v >> j) & 0x0f); if (d < 10) PUTCH(buf, size, count, d + '0'); else PUTCH(buf, size, count, d + 'A' - 10); } } } else { /* int or long argument */ if (argtype == 'l') longval = va_arg(ap, long); else longval = va_arg(ap, int); if (convtype == 'c') { PUTCH(buf, size, count, (char) (unsigned char) longval); } else if (convtype == 'x' || convtype == 'X') { count += putnum(&buf, &size, longval, 16); } else if (convtype == 'o') { count += putnum(&buf, &size, longval, 8); } else if (convtype == 'u' || longval >= 0) { count += putnum(&buf, &size, longval, 10); } else { PUTCH(buf, size, count, '-'); count += putnum(&buf, &size, -longval, 10); } } } else { fprintf(stderr, "*** ERROR: mpz: unsupported conversion '%%%c'", convtype); if (argtype) PUTCH(buf, size, count, argtype); PUTCH(buf, size, count, convtype); } } } if (size != 0) *buf = 0; return count; } int rs_snprintf(char* buf, size_t size, const char* fmt, ...) { va_list ap; int count; va_start(ap, fmt); count = rs_vsnprintf(buf, size, fmt, ap); va_end(ap); return count; } rabbitsign-2.1+dmca1/src/error.c0000600000175000017500000000562411211054615014312 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" static const char* progname; static int verbose; static RSMessageFunc errorfunc, messagefunc; static void *errorfuncdata, *messagefuncdata; void rs_set_progname(s) const char* s; { progname = s; } void rs_set_verbose(v) int v; { verbose = v; } void rs_set_error_func(RSMessageFunc func, void* data) { errorfunc = func; errorfuncdata = data; } void rs_set_message_func(RSMessageFunc func, void* data) { messagefunc = func; messagefuncdata = data; } static void print_message(const RSKey* key, const RSProgram* prgm, const char* msg) { if (prgm && prgm->filename) fprintf(stderr, "%s: ", prgm->filename); else if (key && key->filename) fprintf(stderr, "%s: ", key->filename); else if (progname) fprintf(stderr, "%s: ", progname); fputs(msg, stderr); fputc('\n', stderr); } /* Display a critical error */ void rs_error(const RSKey* key, const RSProgram* prgm, const char* fmt, ...) { char msg[512]; va_list ap; va_start(ap, fmt); strcpy(msg, "error: "); rs_vsnprintf(msg + 7, sizeof(msg) - 7, fmt, ap); va_end(ap); if (errorfunc) (*errorfunc)(key, prgm, msg, errorfuncdata); else print_message(key, prgm, msg); } /* Display a warning message */ void rs_warning(const RSKey* key, const RSProgram* prgm, const char* fmt, ...) { char msg[512]; va_list ap; va_start(ap, fmt); strcpy(msg, "warning: "); rs_vsnprintf(msg + 9, sizeof(msg) - 9, fmt, ap); va_end(ap); if (errorfunc) (*errorfunc)(key, prgm, msg, errorfuncdata); else print_message(key, prgm, msg); } /* Display an informative message */ void rs_message(int level, const RSKey* key, const RSProgram* prgm, const char* fmt, ...) { char msg[512]; va_list ap; if (level > verbose) return; va_start(ap, fmt); rs_vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); if (messagefunc) (*messagefunc)(key, prgm, msg, messagefuncdata); else print_message(key, prgm, msg); } rabbitsign-2.1+dmca1/src/mpz.h0000600000175000017500000000663311202700316013771 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifndef __RABBITSIGN_MPZ_H__ #define __RABBITSIGN_MPZ_H__ #ifdef __cplusplus extern "C" { #endif #if (SIZEOF_INT != 0) && (SIZEOF_LONG >= 2 * SIZEOF_INT) typedef unsigned int limb_t; typedef unsigned long double_limb_t; typedef signed long signed_double_limb_t; #else # if (SIZEOF_SHORT != 0) && (SIZEOF_INT >= 2 * SIZEOF_SHORT) typedef unsigned short limb_t; typedef unsigned int double_limb_t; typedef signed int signed_double_limb_t; # else typedef unsigned short limb_t; typedef unsigned long double_limb_t; typedef signed long signed_double_limb_t; # endif #endif #define LIMB_BITS (sizeof(limb_t)*8) #define LIMB_BYTES (sizeof(limb_t)) #define LIMB_MASK ((((double_limb_t) 1) << LIMB_BITS) - 1) struct _mpz { size_t size; size_t size_alloc; limb_t* m; int sign; }; typedef struct _mpz mpz_t[1]; #undef __P #ifdef PROTOTYPES # define __P(x) x #else # define __P(x) () #endif void mpz_init __P((mpz_t x)); void mpz_clear __P((mpz_t x)); /* Set */ void mpz_set __P((mpz_t dest, const mpz_t src)); void mpz_set_ui __P((mpz_t dest, unsigned int a)); unsigned int mpz_get_ui __P((const mpz_t a)); /* Import/export: assume order=-1, size=1, endian=0, nails=0 */ void mpz_import __P((mpz_t dest, size_t count, int order, int size, int endian, size_t nails, const void* op)); void mpz_export __P((void* dest, size_t* count, int order, int size, int endian, size_t nails, const mpz_t op)); /* Check sign */ int mpz_sgn __P((const mpz_t a)); /* Compare */ int mpz_cmp __P((const mpz_t a, const mpz_t b)); int mpz_cmp_ui __P((const mpz_t a, unsigned int b)); /* Add */ void mpz_add __P((mpz_t dest, const mpz_t a, const mpz_t b)); void mpz_add_ui __P((mpz_t dest, const mpz_t a, unsigned int b)); /* Subtract */ void mpz_sub __P((mpz_t dest, const mpz_t a, const mpz_t b)); void mpz_sub_ui __P((mpz_t dest, const mpz_t a, unsigned int b)); /* Multiply */ void mpz_mul __P((mpz_t dest, const mpz_t a, const mpz_t b)); void mpz_mul_ui __P((mpz_t dest, const mpz_t a, unsigned int b)); /* Divide: requires b <= LIMB_BITS */ void mpz_fdiv_q_2exp __P((mpz_t dest, const mpz_t a, unsigned int b)); /* Modulus */ void mpz_mod __P((mpz_t dest, const mpz_t a, const mpz_t mod)); /* Modular exponent */ void mpz_powm __P((mpz_t dest, const mpz_t base, const mpz_t exp, const mpz_t mod)); /* Legendre symbol */ int mpz_legendre __P((const mpz_t a, const mpz_t p)); /* Extended GCD */ void mpz_gcdext __P((mpz_t g, mpz_t ai, mpz_t bi, const mpz_t a, const mpz_t b)); /* Output */ int rs_snprintf __P((char* buf, size_t size, const char* fmt, ...)); #ifdef va_start int rs_vsnprintf __P((char* buf, size_t size, const char* fmt, va_list ap)); #endif #ifdef __cplusplus } #endif #endif rabbitsign-2.1+dmca1/src/rskeygen.c0000600000175000017500000001044011201210527014773 0ustar kbkb/* * Generate a random key file * * Copyright (C) 2009 Benjamin Moody * * 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 . */ /* * NOTE: This program does not generate secure keys by default. You * should use the --secure option if you actually want to use the key * for anything important. * * Secure key generation uses /dev/random, so it will only work on * systems which provide /dev/random, such as recent versions of * Linux, *BSD, Mac OS X, and Solaris. * * The security is thus obviously dependent on the implementation of * /dev/random. Use at your own risk, as always. * */ #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #ifdef HAVE_UNISTD_H # include #else # define getpid() 0 #endif #include #define RANDOM_FILE "/dev/random" void printnum(n) const mpz_t n; { unsigned char buffer[256]; size_t size, i; mpz_export(buffer, &size, -1, 1, 0, 0, n); printf("%02X", (int)(size&0xff)); for (i=0; i length*2); printnum(n); printnum(p); printnum(q); mpz_clear(p); mpz_clear(q); mpz_clear(n); return 0; } rabbitsign-2.1+dmca1/src/Makefile.in0000600000175000017500000001346311211073441015060 0ustar kbkbprefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ bindir = @bindir@ datadir = @datadir@ mandir = @mandir@ app_key_dir = ${datadir}/rabbitsign AR = @AR@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ GMP_CFLAGS = @GMP_CFLAGS@ GMP_LIBS = @GMP_LIBS@ INSTALL = @INSTALL@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ RANLIB = @RANLIB@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ VPATH = @srcdir@ rabbitsign_objects = rabbitsign.@OBJEXT@ packxxk_objects = packxxk.@OBJEXT@ rskeygen_objects = rskeygen.@OBJEXT@ librabbitsign_objects = app8x.@OBJEXT@ app9x.@OBJEXT@ apps.@OBJEXT@ autokey.@OBJEXT@ cmdline.@OBJEXT@ error.@OBJEXT@ graphlink.@OBJEXT@ header.@OBJEXT@ input.@OBJEXT@ keys.@OBJEXT@ mem.@OBJEXT@ os8x.@OBJEXT@ output.@OBJEXT@ output8x.@OBJEXT@ output9x.@OBJEXT@ program.@OBJEXT@ rabin.@OBJEXT@ rsa.@OBJEXT@ typestr.@OBJEXT@ md5.@OBJEXT@ @mpzobjs@ all: rabbitsign@EXEEXT@ packxxk@EXEEXT@ @opt_build_rskeygen@ .PHONY: all clean install install-rskeygen uninstall rabbitsign@EXEEXT@: $(rabbitsign_objects) librabbitsign.a $(CC) $(CFLAGS) $(LDFLAGS) $(rabbitsign_objects) -L. -lrabbitsign $(GMP_LIBS) $(LIBS) -o rabbitsign@EXEEXT@ packxxk@EXEEXT@: $(packxxk_objects) librabbitsign.a $(CC) $(CFLAGS) $(LDFLAGS) $(packxxk_objects) -L. -lrabbitsign $(GMP_LIBS) $(LIBS) -o packxxk@EXEEXT@ rskeygen@EXEEXT@: $(rskeygen_objects) $(CC) $(CFLAGS) $(LDFLAGS) $(rskeygen_objects) $(GMP_LIBS) $(LIBS) -o rskeygen@EXEEXT@ librabbitsign.a: $(librabbitsign_objects) $(AR) cru librabbitsign.a $(librabbitsign_objects) $(RANLIB) librabbitsign.a rabbitsign.@OBJEXT@: rabbitsign.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/rabbitsign.c packxxk.@OBJEXT@: packxxk.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/packxxk.c rskeygen.@OBJEXT@: rskeygen.c ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/rskeygen.c app8x.@OBJEXT@: app8x.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/app8x.c app9x.@OBJEXT@: app9x.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/app9x.c apps.@OBJEXT@: apps.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/apps.c autokey.@OBJEXT@: autokey.c rabbitsign.h internal.h autokeys.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -DSHARE_DIR=\"$(app_key_dir)/\" -c $(srcdir)/autokey.c cmdline.@OBJEXT@: cmdline.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/cmdline.c error.@OBJEXT@: error.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/error.c graphlink.@OBJEXT@: graphlink.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/graphlink.c header.@OBJEXT@: header.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/header.c input.@OBJEXT@: input.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/input.c keys.@OBJEXT@: keys.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/keys.c mem.@OBJEXT@: mem.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/mem.c os8x.@OBJEXT@: os8x.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/os8x.c output.@OBJEXT@: output.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/output.c output8x.@OBJEXT@: output8x.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/output8x.c output9x.@OBJEXT@: output9x.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/output9x.c program.@OBJEXT@: program.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/program.c rabin.@OBJEXT@: rabin.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/rabin.c rsa.@OBJEXT@: rsa.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/rsa.c typestr.@OBJEXT@: typestr.c rabbitsign.h internal.h mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(GMP_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/typestr.c md5.@OBJEXT@: md5.c md5.h ../config.h $(CC) -I.. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/md5.c mpz.@OBJEXT@: mpz.c mpz.h ../config.h $(CC) -I.. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/mpz.c clean: rm -f rabbitsign@EXEEXT@ rm -f packxxk@EXEEXT@ rm -f rskeygen@EXEEXT@ rm -f librabbitsign.a rm -f *.@OBJEXT@ install: rabbitsign@EXEEXT@ packxxk@EXEEXT@ @opt_install_rskeygen@ $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) $(INSTALL) -m 755 rabbitsign@EXEEXT@ $(DESTDIR)$(bindir) $(INSTALL) -m 755 packxxk@EXEEXT@ $(DESTDIR)$(bindir) install-rskeygen: rskeygen@EXEEXT@ $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) $(INSTALL) -m 755 rskeygen@EXEEXT@ $(DESTDIR)$(bindir) uninstall: rm -f $(DESTDIR)$(bindir)/rabbitsign@EXEEXT@ rm -f $(DESTDIR)$(bindir)/packxxk@EXEEXT@ rm -f $(DESTDIR)$(bindir)/rskeygen@EXEEXT@ rabbitsign-2.1+dmca1/src/cmdline.c0000600000175000017500000000466511210617465014607 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" #if !defined(strchr) && !defined(HAVE_STRCHR) && defined(HAVE_INDEX) # define strchr index #endif /* * Parse and return next command line option. */ int rs_parse_cmdline(int argc, char** argv, const char* optstring, int* i, int* j, const char** arg) { char c; char* p; if (*i >= argc) return RS_CMDLINE_FINISHED; if (argv[*i][0] != '-' || argv[*i][1] == 0) { *arg = argv[*i]; (*i)++; *j = 1; return RS_CMDLINE_FILENAME; } if (argv[*i][1] == '-') { if (!strcasecmp(argv[*i], "--help")) { (*i)++; *j = 1; return RS_CMDLINE_HELP; } else if (!strcasecmp(argv[*i], "--version")) { (*i)++; *j = 1; return RS_CMDLINE_VERSION; } else { rs_error(NULL, NULL, "unrecognized option %s (try --help)", argv[*i]); return RS_CMDLINE_ERROR; } } c = argv[*i][*j]; if (c == ':' || !(p = strchr(optstring, c))) { rs_error(NULL, NULL, "unrecognized option -%c (try --help)", c); return RS_CMDLINE_ERROR; } if (p[1] == ':') { if (argv[*i][*j + 1]) { *arg = &argv[*i][*j + 1]; (*i)++; *j = 1; return c; } else { (*i) += 2; *j = 1; if (*i > argc) { rs_error(NULL, NULL, "-%c: requires an argument", c); return RS_CMDLINE_ERROR; } *arg = argv[*i - 1]; return c; } } else { if (argv[*i][*j + 1]) { (*j)++; } else { (*i)++; *j = 1; } *arg = NULL; return c; } } rabbitsign-2.1+dmca1/src/packxxk.c0000600000175000017500000001270011211354531014623 0ustar kbkb/* * XXK Packer * * Copyright (C) 2009 Benjamin Moody * * 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 . * */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" #if !defined(strrchr) && !defined(HAVE_STRRCHR) && defined(HAVE_RINDEX) # define strrchr rindex #endif static const char* getbasename(const char* f) { const char *p; if ((p = strrchr(f, '/'))) f = p + 1; #if defined(__MSDOS__) || defined(__WIN32__) if ((p = strrchr(f, '\\'))) f = p + 1; #endif return f; } static const char* usage[]={ "Usage: %s [options] app-file ...\n", "Where options may include:\n", " -t TYPE set program type (8xk, 73u, etc.)\n", " -d MM/DD/YYYY set application date stamp\n", " -c ID set calculator device ID\n", " -o FILE set output file\n", NULL}; int main(int argc, char** argv) { const char* progname; const char* infilename = NULL; const char* outfilename = NULL; RSCalcType calctype = RS_CALC_UNKNOWN; RSDataType datatype = RS_DATA_UNKNOWN; int month = 0, day = 0, year = 0; FILE *infile, *outfile; RSProgram *prgm; int i, j, c, v; const char* arg; char *ptr; progname = getbasename(argv[0]); rs_set_progname(progname); rs_set_verbose(0); if (argc == 1) { fprintf(stderr, usage[0], progname); for (i = 1; usage[i]; i++) fputs(usage[i], stderr); fprintf(stderr, "Report bugs to %s.\n", PACKAGE_BUGREPORT); return 3; } i = j = 1; while ((c = rs_parse_cmdline(argc, argv, "t:d:c:o:", &i, &j, &arg))) { switch (c) { case RS_CMDLINE_HELP: printf(usage[0], progname); for (i = 1; usage[i]; i++) fputs(usage[i], stdout); printf("Report bugs to %s.\n", PACKAGE_BUGREPORT); return 0; case RS_CMDLINE_VERSION: printf("packxxk (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); fputs("Copyright (C) 2009 Benjamin Moody\n", stdout); fputs("This program is free software. ", stdout); fputs("There is NO WARRANTY of any kind.\n", stdout); return 0; case 't': /* accept '73', '83p' for compatibility with packxxk v1.x */ if (!strcmp(arg, "73")) { calctype = RS_CALC_TI73; datatype = RS_DATA_APP; } else if (!strcmp(arg, "83p")) { calctype = RS_CALC_TI83P; datatype = RS_DATA_APP; } else if (rs_suffix_to_type(arg, &calctype, &datatype)) { fprintf(stderr, "%s: unknown program type %s\n", progname, arg); return 3; } break; case 'd': if (strrchr(arg, '/')) v = sscanf(arg, "%d/%d/%d", &month, &day, &year); else if (strrchr(arg, '-')) v = sscanf(arg, "%d-%d-%d", &day, &month, &year); else v = sscanf(arg, "%2d%2d%d", &month, &day, &year); if (v < 3) { fprintf(stderr, "%s: -d: invalid argument %s\n", progname, arg); return 3; } break; case 'c': if (!sscanf(arg, "%x", &calctype)) { fprintf(stderr, "%s: -c: invalid argument %s\n", progname, arg); return 3; } break; case 'o': outfilename = arg; break; case RS_CMDLINE_FILENAME: break; case RS_CMDLINE_ERROR: return 3; default: fprintf(stderr, "%s: internal error: unknown option -%c\n", progname, c); return 5; } } if (outfilename == NULL || !strcmp(outfilename, "-")) outfile = stdout; else { if (!(outfile = fopen(outfilename, "wb"))) { perror(outfilename); fprintf(stderr, "%s: unable to open output file %s\n", progname, outfilename); return 2; } } i = j = 1; while ((c = rs_parse_cmdline(argc, argv, "t:d:c:o:", &i, &j, &arg))) { if (c != RS_CMDLINE_FILENAME) continue; if (!strcmp(arg, "-")) { infilename = "(standard input)"; infile = stdin; } else { infilename = arg; if (!(infile = fopen(infilename, "rb"))) { perror(infilename); fprintf(stderr, "%s: unable to open hex file %s\n", progname, infilename); return 2; } } prgm = rs_program_new(); if (calctype && datatype) { prgm->calctype = calctype; prgm->datatype = datatype; } else if ((ptr = strrchr(infilename, '.'))) { rs_suffix_to_type(ptr + 1, &prgm->calctype, &prgm->datatype); } if (rs_read_program_file(prgm, infile, infilename, 0)) { rs_program_free(prgm); if (infile != stdin) fclose(infile); if (outfile != stdout) fclose(outfile); return 2; } if (infile != stdin) fclose(infile); if (rs_write_program_file(prgm, outfile, month, day, year, 0)) { rs_program_free(prgm); if (outfile != stdout) fclose(outfile); return 2; } rs_program_free(prgm); } if (outfile != stdout) fclose(outfile); return (i ? 2 : 0); } rabbitsign-2.1+dmca1/src/rabbitsign.h0000600000175000017500000002425111230231221015276 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifndef __RABBITSIGN_H__ #define __RABBITSIGN_H__ #ifdef HAVE_GMP_H # include # define rs_snprintf gmp_snprintf # define rs_vsnprintf gmp_vsnprintf #else # include "mpz.h" #endif #if __GNUC__ >= 3 # define RS_ATTR_PURE __attribute__((pure)) # define RS_ATTR_MALLOC __attribute__((malloc)) # define RS_ATTR_UNUSED __attribute__((unused)) # define RS_ATTR_PRINTF(f,i) __attribute__((format(printf,f,i))) #else # define RS_ATTR_PURE # define RS_ATTR_MALLOC # define RS_ATTR_UNUSED # define RS_ATTR_PRINTF(f,i) #endif #ifdef __cplusplus extern "C" { #endif /* Calculator types */ typedef enum _RSCalcType { RS_CALC_UNKNOWN = 0, RS_CALC_TI73 = 0x74, RS_CALC_TI83P = 0x73, RS_CALC_TI89 = 0x98, RS_CALC_TI92P = 0x88 } RSCalcType; #define rs_calc_is_ti8x(ttt) ((ttt) == RS_CALC_TI73 || (ttt) == RS_CALC_TI83P) #define rs_calc_is_ti9x(ttt) ((ttt) == RS_CALC_TI89 || (ttt) == RS_CALC_TI92P) /* Data types */ typedef enum _RSDataType { RS_DATA_UNKNOWN = 0, RS_DATA_OS = 0x23, RS_DATA_APP = 0x24, RS_DATA_CERT = 0x25 } RSDataType; /* Flags for app signing */ typedef enum _RSRepairFlags { RS_IGNORE_ALL_WARNINGS = 1, RS_REMOVE_OLD_SIGNATURE = 2, /* Remove existing signature */ RS_FIX_PAGE_COUNT = 4, /* Fix page count header field */ RS_FIX_OS_SIZE = 8, /* Fix size in OS header */ RS_ZEALOUSLY_PAD_APP = 16 /* Pad application with an extra page if necessary */ } RSRepairFlags; /* Flags for file input */ typedef enum _RSInputFlags { RS_INPUT_BINARY = 32, /* Assume input is raw binary data */ RS_INPUT_SORTED = 64 /* Assume plain hex input is sorted (implicit page switch) */ } RSInputFlags; /* Flags for file output */ typedef enum _RSOutputFlags { RS_OUTPUT_HEX_ONLY = 128, /* Write plain hex (.app) format */ RS_OUTPUT_APPSIGN = 256 /* Write hex data in appsign-compatible format */ } RSOutputFlags; /* Encryption key structure */ typedef struct _RSKey { char* filename; /* Filename */ unsigned long id; /* Key ID */ mpz_t n; /* Modulus (public key) */ mpz_t p; /* First factor */ mpz_t q; /* Second factor */ mpz_t qinv; /* q^-1 mod p (for Rabin) (rs_sign_rabin() will calculate this based on p and q, if needed) */ mpz_t d; /* Signing exponent (for RSA) (rs_sign_rsa() will calculate this based on p and q, if needed) */ } RSKey; /* Program data structure */ typedef struct _RSProgram { char* filename; /* Filename */ RSCalcType calctype; /* Calculator type */ RSDataType datatype; /* Program data type */ unsigned char* data; /* Program data */ unsigned long length; /* Length of program data */ unsigned long length_a; /* Size of buffer allocated */ /* Additional metadata (only used by TI-8x OS) */ unsigned char* header; /* OS header */ unsigned int header_length; /* Length of OS header */ unsigned char* signature; /* OS signature */ unsigned int signature_length; /* Length of OS signature */ unsigned int* pagenums; /* List of page numbers */ int npagenums; /* Number of page numbers */ } RSProgram; /* Status codes */ typedef enum _RSStatus { RS_SUCCESS = 0, RS_ERR_MISSING_PAGE_COUNT, RS_ERR_MISSING_KEY_ID, RS_ERR_MISSING_DATE_STAMP, RS_ERR_MISSING_PROGRAM_IMAGE, RS_ERR_MISALIGNED_PROGRAM_IMAGE, RS_ERR_INVALID_PROGRAM_DATA, RS_ERR_INVALID_PROGRAM_SIZE, RS_ERR_INCORRECT_PAGE_COUNT, RS_ERR_FINAL_PAGE_TOO_LONG, RS_ERR_FIELD_TOO_SMALL, RS_ERR_CRITICAL = 1000, RS_ERR_OUT_OF_MEMORY, RS_ERR_FILE_IO, RS_ERR_HEX_SYNTAX, RS_ERR_UNKNOWN_FILE_FORMAT, RS_ERR_UNKNOWN_PROGRAM_TYPE, RS_ERR_MISSING_HEADER, RS_ERR_MISSING_RABIN_SIGNATURE, RS_ERR_MISSING_RSA_SIGNATURE, RS_ERR_INCORRECT_PROGRAM_SIZE, RS_ERR_KEY_NOT_FOUND, RS_ERR_KEY_SYNTAX, RS_ERR_INVALID_KEY, RS_ERR_MISSING_PUBLIC_KEY, RS_ERR_MISSING_PRIVATE_KEY, RS_ERR_UNSUITABLE_RABIN_KEY, RS_ERR_UNSUITABLE_RSA_KEY, RS_SIGNATURE_INCORRECT = -1 } RSStatus; /**** Key handling (keys.c) ****/ /* Create a new key. */ RSKey* rs_key_new (void) RS_ATTR_MALLOC; /* Free a key. */ void rs_key_free (RSKey* key); /* Read key from a file. */ RSStatus rs_read_key_file (RSKey* key, FILE* f, const char* fname, int verify); /* Parse a number written in TI's hexadecimal key format. */ RSStatus rs_parse_key_value (mpz_t dest, const char* str); /**** Program data manipulation (program.c) ****/ /* Create a new program. */ RSProgram* rs_program_new (void) RS_ATTR_MALLOC; /* Create a new program from an existing data buffer. */ RSProgram* rs_program_new_with_data (RSCalcType ctype, RSDataType dtype, void* data, unsigned long length, unsigned long buffer_size) RS_ATTR_MALLOC; /* Free program data. */ void rs_program_free (RSProgram* prgm); /* Truncate or extend program. */ RSStatus rs_program_set_length (RSProgram* prgm, unsigned long length); /* Add data to the end of the program. */ RSStatus rs_program_append_data (RSProgram* prgm, const unsigned char* data, unsigned long length); /**** Search for key file (autokey.c) ****/ /* Get key ID for the given program. */ unsigned long rs_program_get_key_id (const RSProgram* prgm) RS_ATTR_PURE; /* Find key file for the given ID. */ RSStatus rs_key_find_for_id (RSKey* key, unsigned long keyid, int publiconly); /**** Program signing and validation (apps.c) ****/ /* Check/fix program header and data. */ RSStatus rs_repair_program (RSProgram* prgm, RSRepairFlags flags); /* Add a signature to the program. */ RSStatus rs_sign_program (RSProgram* prgm, RSKey* key, int rootnum); /* Validate program signature. */ RSStatus rs_validate_program (const RSProgram* prgm, const RSKey* key); /**** TI-73/83+/84+ app signing (app8x.c) ****/ /* Check/fix Flash app header and data. */ RSStatus rs_repair_ti8x_app (RSProgram* app, RSRepairFlags flags); /* Add a signature to a Flash app. */ RSStatus rs_sign_ti8x_app (RSProgram* app, RSKey* key, int rootnum); /* Validate Flash app signature. */ RSStatus rs_validate_ti8x_app (const RSProgram* app, const RSKey* key); /**** TI-73/83+/84+ OS signing (os8x.c) ****/ /* Check/fix OS header and data. */ RSStatus rs_repair_ti8x_os (RSProgram* os, RSRepairFlags flags); /* Add a signature to an OS. */ RSStatus rs_sign_ti8x_os (RSProgram* os, RSKey* key); /* Validate OS signature. */ RSStatus rs_validate_ti8x_os (const RSProgram* os, const RSKey* key); /**** TI-89/92+ app/OS signing (app9x.c) ****/ /* Check/fix Flash app header and data. */ RSStatus rs_repair_ti9x_app (RSProgram* app, RSRepairFlags flags); /* Check/fix OS header and data. */ RSStatus rs_repair_ti9x_os (RSProgram* app, RSRepairFlags flags); /* Add a signature to a 68k app/OS. */ RSStatus rs_sign_ti9x_app (RSProgram* app, RSKey* key); /* Validate app/OS signature. */ RSStatus rs_validate_ti9x_app (const RSProgram* app, const RSKey* key); #define rs_sign_ti9x_os rs_sign_ti9x_app #define rs_validate_ti9x_os rs_validate_ti9x_app /**** File input (input.c) ****/ /* Read program contents from a file. */ RSStatus rs_read_program_file (RSProgram* prgm, FILE* f, const char* fname, RSInputFlags flags); /**** File output (output.c) ****/ /* Write program contents to a file. */ RSStatus rs_write_program_file(const RSProgram* prgm, FILE* f, int month, int day, int year, RSOutputFlags flags); /**** Hex file output (output8x.c) ****/ /* Write program to a .73k/.73u/.8xk/.8xu or .app file. */ RSStatus rs_write_ti8x_file (const RSProgram* prgm, FILE* f, int month, int day, int year, RSOutputFlags flags); /**** Binary file output (output9x.c) ****/ /* Write program to a .89k/.89u/.9xk/.9xu file. */ RSStatus rs_write_ti9x_file (const RSProgram* prgm, FILE* f, int month, int day, int year, RSOutputFlags flags); /**** App header/certificate utility functions (header.c) ****/ /* Get length of a header field. */ void rs_get_field_size (const unsigned char* data, unsigned long* fieldstart, unsigned long* fieldsize); /* Set length of a header field. */ int rs_set_field_size (unsigned char* data, unsigned long fieldsize); /* Find a given header field in the data. */ int rs_find_app_field (unsigned int type, const unsigned char* data, unsigned long length, unsigned long* fieldhead, unsigned long* fieldstart, unsigned long* fieldsize); /* Get value of a numeric header field. */ unsigned long rs_get_numeric_field (unsigned int type, const unsigned char* data, unsigned long length) RS_ATTR_PURE; /**** Error/message logging (error.c) ****/ typedef void (*RSMessageFunc) (const RSKey*, const RSProgram*, const char*, void*); /* Set program name */ void rs_set_progname (const char* s); /* Set verbosity level */ void rs_set_verbose (int v); /* Set error logging function */ void rs_set_error_func (RSMessageFunc func, void* data); /* Set message logging function */ void rs_set_message_func (RSMessageFunc func, void* data); #ifdef __cplusplus } #endif #endif /* __RABBITSIGN_H__ */ rabbitsign-2.1+dmca1/src/graphlink.c0000600000175000017500000000515011202700772015134 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef TM_IN_SYS_TIME # include # else # include # endif #endif #include "rabbitsign.h" #include "internal.h" #define BCD(x) ((x) + 6 * ((x)/10)) /* * Write a TIFL header to a file. */ int rs_write_tifl_header(FILE* outfile, /* file to write to */ int is_hex, /* is file in hex format? */ int major, /* major version # */ int minor, /* minor version # */ int month, /* current month */ int day, /* current day */ int year, /* current year */ const char* name, /* name of program */ int calctype, /* calculator type */ int datatype, /* data type */ unsigned long filesize) /* size of data */ { unsigned char buf[78]; time_t t; struct tm* tm; memset(buf, 0, 78); strcpy((char*) buf, "**TIFL**"); buf[8] = major; buf[9] = minor; if (is_hex) { buf[10] = 0x01; buf[11] = 0x88; } else { buf[10] = 0; buf[11] = 0; } if (!month && !day && !year) { time(&t); tm = localtime(&t); month = tm->tm_mon + 1; day = tm->tm_mday; year = tm->tm_year + 1900; } buf[12] = BCD(month); buf[13] = BCD(day); buf[14] = BCD(year / 100); buf[15] = BCD(year % 100); buf[16] = strlen(name); if (buf[16] > 8) buf[16] = 8; strncpy((char*) buf + 17, name, 8); buf[48] = calctype; buf[49] = datatype; buf[74] = filesize & 0xff; buf[75] = (filesize >> 8) & 0xff; buf[76] = (filesize >> 16) & 0xff; buf[77] = (filesize >> 24) & 0xff; if (fwrite(buf, 1, 78, outfile) != 78) { rs_error(NULL, NULL, "file I/O error"); return RS_ERR_FILE_IO; } return RS_SUCCESS; } rabbitsign-2.1+dmca1/src/app9x.c0000600000175000017500000002072711230707232014224 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" #include "md5.h" /* * Check/fix app/OS header and data. * * (This is something of a work in progress; a lot more * experimentation would be useful to determine what exactly is * required of app and OS headers on the 68k calculators.) */ static int repair_app(RSProgram* app, /* app to repair */ unsigned int flags, /* flags */ unsigned int type) /* field type */ { unsigned long length, hdrstart, hdrsize, fieldhead, fieldstart, fieldsize; unsigned char *hdr; int e; if (app->length < 6 || app->data[0] != type || (app->data[1] & 0xf0) != 0) { rs_error(NULL, app, "no app header found"); return RS_ERR_MISSING_HEADER; } /* Determine application length */ length = app->length; rs_get_field_size(app->data, &hdrstart, &hdrsize); /* If requested, remove the old signature (truncate the application to its stated length.) */ if (flags & RS_REMOVE_OLD_SIGNATURE) { if (length < hdrstart + hdrsize) { rs_warning(NULL, app, "provided app data too short"); } else { if (length > hdrstart + hdrsize + 67) rs_warning(NULL, app, "re-signing discards %lu bytes", length - hdrstart - hdrsize); length = hdrstart + hdrsize; } } else if (hdrsize && hdrstart + hdrsize != length) { rs_warning(NULL, app, "application length incorrect"); rs_warning(NULL, app, "(perhaps you meant to use -r?)"); } if ((e = rs_program_set_length(app, length))) return e; /* Set app size header to the correct value */ hdrsize = length - hdrstart; if (rs_set_field_size(app->data, hdrsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "cannot set application length"); else { rs_error(NULL, app, "cannot set application length"); return RS_ERR_FIELD_TOO_SMALL; } } /* Check for key ID */ hdr = app->data + hdrstart; if (hdrsize > 128) hdrsize = 128; if (rs_find_app_field((type << 8) | 0x10, hdr, hdrsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no key ID"); else { rs_error(NULL, app, "application has no key ID"); return RS_ERR_MISSING_KEY_ID; } } /* Check for date stamp (note: I haven't actually tested whether this is required, but it always seems to be present in both 68k apps and OSes, and it is required for TI-83+ apps) */ if (rs_find_app_field(0x0320, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp"); else { rs_error(NULL, app, "application has no date stamp"); return RS_ERR_MISSING_DATE_STAMP; } } else if (rs_find_app_field(0x0900, hdr + fieldstart, fieldsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp"); else { rs_error(NULL, app, "application has no date stamp"); return RS_ERR_MISSING_DATE_STAMP; } } else if (hdr[fieldstart + fieldsize] != 0x02 || (hdr[fieldstart + fieldsize + 1] & 0xf0) != 0) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp signature"); else { rs_error(NULL, app, "application has no date stamp signature"); return RS_ERR_MISSING_DATE_STAMP; } } /* Check for program image field and fix length */ if (rs_find_app_field((type << 8) | 0x70, hdr, hdrsize, &fieldhead, &fieldstart, &fieldsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no program image field"); else { rs_error(NULL, app, "application has no program image field"); return RS_ERR_MISSING_PROGRAM_IMAGE; } } else { if ((fieldstart + hdrstart) % 2) { /* The OS appears to align apps so the start of the app header is at an even address; if the application code itself is at an odd address, bad stuff will happen. */ if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application header is not a multiple of 2 bytes"); else { rs_error(NULL, app, "application header is not a multiple of 2 bytes"); return RS_ERR_MISALIGNED_PROGRAM_IMAGE; } } if (fieldsize && fieldstart + fieldsize != length - hdrstart) rs_warning(NULL, app, "program image length incorrect"); if (rs_set_field_size(hdr + fieldhead, length - hdrstart - fieldstart)) { rs_error(NULL, app, "cannot set program image length"); return RS_ERR_FIELD_TOO_SMALL; } } return RS_SUCCESS; } /* * Check/fix Flash app header and data. */ int rs_repair_ti9x_app(RSProgram* app, /* app to repair */ unsigned int flags) /* flags */ { return repair_app(app, flags, 0x81); } /* * Check/fix OS header and data. */ int rs_repair_ti9x_os(RSProgram* app, /* app to repair */ unsigned int flags) /* flags */ { return repair_app(app, flags, 0x80); } /* * Compute signature for a 68k app/OS. * * The app header should be checked and/or repaired by * rs_repair_ti9x_app() prior to calling this function. */ int rs_sign_ti9x_app(RSProgram* app, /* app to sign */ RSKey* key) /* signing key */ { md5_uint32 hash[4]; mpz_t hashv, sigv; unsigned char sigdata[512]; size_t siglength; int e; md5_buffer((char*) app->data, app->length, &hash); mpz_init(hashv); mpz_init(sigv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, app, "hash = %ZX", hashv); if ((e = rs_sign_rsa(sigv, hashv, key))) { mpz_clear(hashv); mpz_clear(sigv); return e; } rs_message(2, NULL, app, "sig = %ZX", sigv); sigdata[0] = 0x02; sigdata[1] = 0x0d; mpz_export(sigdata + 3, &siglength, -1, 1, 0, 0, sigv); sigdata[2] = siglength & 0xff; siglength += 3; return rs_program_append_data(app, sigdata, siglength); } /* * Validate app/OS signature. */ int rs_validate_ti9x_app(const RSProgram* app, /* app to validate */ const RSKey* key) /* signing key */ { unsigned long length, hdrstart, hdrsize, fieldstart, fieldsize; const unsigned char *hdr, *sig; md5_uint32 hash[4]; mpz_t hashv, sigv; int e, e2 = RS_SUCCESS; if (app->length < 6) { rs_error(NULL, app, "no app header found"); return RS_ERR_MISSING_HEADER; } rs_get_field_size(app->data, &hdrstart, &hdrsize); length = hdrstart + hdrsize; hdr = app->data + hdrstart; if (hdrsize > 128) hdrsize = 128; if (length + 4 > app->length || length + 67 < app->length) { rs_error(NULL, app, "incorrect application length"); return RS_ERR_INCORRECT_PROGRAM_SIZE; } if (rs_find_app_field((app->data[0] << 8) | 0x70, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { rs_warning(NULL, app, "application has no program image field"); e2 = RS_ERR_MISSING_PROGRAM_IMAGE; } else if ((fieldstart + hdrstart) % 2) { rs_warning(NULL, app, "application header is not a multiple of 2 bytes"); e2 = RS_ERR_MISALIGNED_PROGRAM_IMAGE; } md5_buffer((char*) app->data, length, &hash); sig = app->data + length; if (sig[0] != 0x02 || (sig[1] & 0xf0) != 0x00) { rs_error(NULL, app, "application does not have an RSA signature"); return RS_ERR_MISSING_RSA_SIGNATURE; } rs_get_field_size(sig, &fieldstart, &fieldsize); mpz_init(sigv); mpz_init(hashv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, app, "hash = %ZX", hashv); mpz_import(sigv, fieldsize, -1, 1, 0, 0, sig + fieldstart); rs_message(2, NULL, app, "sig = %ZX", sigv); e = rs_validate_rsa(sigv, hashv, key); if (e == RS_SIGNATURE_INCORRECT) rs_message(0, NULL, app, "application signature incorrect"); mpz_clear(sigv); mpz_clear(hashv); return (e ? e : e2); } rabbitsign-2.1+dmca1/src/rabin.c0000600000175000017500000002471311202677213014261 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" /* * Compute square root of x modulo p, where p === 3 (mod 4). * * (Assume that (x|p) = 1.) * * Notice that: * * p = 4k + 3 * * x^[(p-1)/2] = x^(2k+1) = (x|p) = 1 * * x^(2k+2) = x * * [x^(k+1)]^2 = x * * so x^(k+1) = x^[(p+1)/4] is a square root of x. */ static void mpz_sqrtm_3 (mpz_t res, /* mpz to store result */ const mpz_t x, /* number to get square root of */ const mpz_t p) /* prime modulus === 3 (mod 4) */ { mpz_add_ui(res, p, 1); mpz_fdiv_q_2exp(res, res, 2); /* (p + 1)/4 */ mpz_powm(res, x, res, p); } /* * Compute square root of x modulo p, where p === 5 (mod 8). * * (Assume that (x|p) = 1.) * * Notice that: * * p = 4k + 1 * * x^[(p-1)/2] = x^(2k) = (x|p) = 1 * * x^[(k+1)/2]^2 * x^(4k-1) = x^(5k) = x^k * * Since x^k^2 = 1, x^k = +/- 1. * * CASE 1: * If x^k = 1, x^[(k+1)/2]^2 = x, so x^[(k+1)/2] = x^[(p+3)/8] is * the square root of x. * * CASE 2: * Otherwise, x^[(k+1)/2]^2 = -x; we need to find a square root of * -1. * * Since (2|p) = -1, 2^[(p-1)/2] = 2^(2k) = -1, so (2^k)^2 = -1 * * (x^[(k+1)/2] * 2^k)^2 = -x * -1 = x * * so x^[(k+1)/2] * 2^k = x^[(p+3)/8] * 2^[(p-1)/4] is the square * root of x. */ static void mpz_sqrtm_5 (mpz_t res, /* mpz to store result */ const mpz_t x, /* number to get square root of */ const mpz_t p) /* prime modulus === 5 (mod 8) */ { mpz_t a, b; mpz_init(a); mpz_init(b); mpz_add_ui(a, p, 3); mpz_fdiv_q_2exp(b, a, 3); mpz_powm(res, x, b, p); /* x ^ (p+3)/8 */ /* Check if res^2 = x */ mpz_mul(a, res, res); mpz_sub(b, a, x); mpz_mod(a, b, p); if (0 != mpz_sgn(a)) { mpz_sub_ui(a, p, 1); mpz_fdiv_q_2exp(b, a, 2); mpz_set_ui(a, 2); mpz_powm(a, a, b, p); /* 2 ^ (p-1)/4 */ mpz_mul(res, res, a); } mpz_clear(a); mpz_clear(b); } /* * Compute square root of x modulo p. * * This still won't work with p === 1 mod 8, but then, TI's system * won't work at all for 50% of apps if one of your factors is 1 mod * 8. (See the discussion of f values below.) * */ static void mpz_sqrtm (mpz_t res, /* mpz to store result */ const mpz_t x, /* number to get square root of */ const mpz_t p) /* prime modulus === 3, 5, or 7 (mod 8) */ { if ((mpz_get_ui(p) % 8) == 5) mpz_sqrtm_5(res, x, p); else mpz_sqrtm_3(res, x, p); } /* * Compute x s.t. x === r (mod p) and x === s (mod q). * * We compute this as: * * [(r-s) * q^-1 mod p] * q + s * */ static void mpz_crt(mpz_t res, /* mpz to store result */ const mpz_t r, /* root modulo p */ const mpz_t s, /* root modulo q */ const mpz_t p, /* first modulus */ const mpz_t q, /* second modulus */ const mpz_t qinv) /* q^(p-2) mod p */ { /* ((r - s) */ mpz_sub(res, r, s); /* * q^-1) */ mpz_mul(res, res, qinv); mpz_mod(res, res, p); /* * q + s */ mpz_mul(res, res, q); mpz_add(res, res, s); } /* * Compute the T_f transform modulo n. * * Because only one quarter of the possible hashes can be signed with * a given key, we need to transform the hash. First, we want to * ensure that the result is nonzero, so we shift the hash by 8 bits * and add a 1 to the end. The resulting number is called m'. * * Second, we want to multiply it by a number k whose Legendre symbols * (k|p) and (k|q) are known, so that (km'|p) = (k|p)(m'|p) = 1 and * (km'|q) = (k|q)(km'|q) = 1. Since we need both to be true * simultaneously, regardless of the values of (m'|p) and (m'|q), we * clearly need four possible values of k. * * As it happens, TI's keys all follow a precise format: they all have * p === 3 and q === 7 (mod 8). As a result, we know that * * (-1|p) = (-1|q) = -1 * * (2|p) = -1, (2|q) = 1 * * So TI has defined the following transformation functions: * * T_0(x) = -2x' * T_1(x) = -x' * T_2(x) = x' * T_3(x) = 2x' * * where x' = 256x + 1. * * In the usual case of p === 3 and q === 7 (mod 8), then, two of the * possible (T_f(m)|p) will equal 1: * * If (m'|p) = 1, then (T_0(m)|p) = (T_2(m)|p) = 1. * If (m'|p) = -1, then (T_1(m)|p) = (T_3(m)|p) = 1. * * Two of the possible (T_f(m)|q) will equal 1: * * If (m'|q) = 1, then (T_2(m)|q) = (T_3(m)|q) = 1. * If (m'|q) = -1, then (T_0(m)|q) = (T_1(m)|q) = 1. * * Thus we can choose exactly one f value with * (T_f(m)|p) = (T_f(m)|q) = 1. * * If r === 5 (mod 8) is a prime, (-1|r) = 1, while (2|r) = -1. Thus * a similar logic holds: * * If (m'|r) = 1, then (T_1(m)|r) = (T_2(m)|r) = 1. * If (m'|r) = -1, then (T_0(m)|r) = (T_3(m)|r) = 1. * * So if {p,q} === {3,5}, {5,7}, or {3,7} (mod 8), given any m, we can * pick an f with (T_f(m)|p) = (T_f(m)|q) = 1. * */ static void applyf(mpz_t res, /* mpz to store result */ const mpz_t m, /* MD5 hash */ const mpz_t n, /* public key */ int f) /* f (0, 1, 2, 3) */ { mpz_mul_ui(res, m, 256); mpz_add_ui(res, res, 1); switch (f) { case 0: mpz_add(res, res, res); case 1: mpz_sub(res, n, res); break; case 2: break; case 3: mpz_add(res, res, res); break; } } /* * Compute the Rabin signature with a given f. */ static void rabsigf(mpz_t res, /* mpz to store result */ const mpz_t m, /* MD5 hash */ const mpz_t n, /* public key */ const mpz_t p, /* first factor */ const mpz_t q, /* second factor */ const mpz_t qinv, /* q^(p-2) mod p */ int f, /* f (0, 1, 2, 3) */ int rootnum) /* root number (0, 1, 2, 3) */ { mpz_t mm; mpz_t r,s; mpz_init(r); mpz_init(s); mpz_init(mm); applyf(mm, m, n, f); mpz_sqrtm(r, mm, p); mpz_sqrtm(s, mm, q); if (rootnum & 1) { mpz_sub(r, p, r); } if (rootnum & 2) { mpz_sub(s, q, s); } mpz_crt(res, r, s, p, q, qinv); mpz_clear(r); mpz_clear(s); mpz_clear(mm); } /* * Table of f values. * * Remember that * * f = 0 corresponds to multiplying by -2 * f = 1 corresponds to multiplying by -1 * f = 2 corresponds to multiplying by 1 * f = 3 corresponds to multiplying by 2 */ static const int ftab[36] = { /************* (m'|p) = (m'|q) = 1 */ /********** (m'|p) = -1, (m'|q) = 1 */ /****** (m'|p) = 1, (m'|q) = -1 */ /*** (m'|p) = (m'|q) = -1 */ /* p === 3, q === 3 */ 2, 99, 99,1, /* (-1|p) = (-1|q) = -1 ==> if both -1, multiply by -1 */ /* p === 3, q === 5 */ 2, 1, 0, 3, /* (-1|p) = -1, (-1|q) = 1 ==> if (m'|p) = -1, multiply by -1 */ /* (-2|p) = 1, (-2|q) = -1 ==> if (m'|q) = -1, multiply by -2 */ /* p === 3, q === 7 */ 2, 3, 0, 1, /* (2|p) = -1, (2|q) = 1 ==> if (m'|p) = -1, multiply by 2 */ /* (-2|p) = 1, (-2|q) = -1 ==> if (m'|q) = -1, multiply by -2 */ /* p === 5, q === 3 */ 2, 0, 1, 3, /* p === 5, q === 5 */ 2, 99, 99,3, /* (2|p) = (2|q) = -1 ==> if both -1, multiply by 2 */ /* p === 5, q === 7 */ 2, 3, 1, 0, /* (2|p) = -1, (2|q) = 1 ==> if (m'|p) = -1, multiply by 2 */ /* (-1|p) = 1, (-1|q) = -1 ==> if (m'|q) = -1, multiply by -1 */ /* p === 7, q === 3 */ 2, 0, 3, 1, /* p === 7, q === 5 */ 2, 1, 3, 0, /* p === 7, q === 7 */ 2, 99, 99,1 /* (-1|p) = (-1|q) = -1 ==> if both -1, multiply by -1 */ }; /* * Compute the Rabin signature and the useful value of f. */ int rs_sign_rabin(mpz_t res, /* mpz to store signature */ int* f, /* f value chosen */ const mpz_t hash, /* MD5 hash of app */ int rootnum, /* root number (0, 1, 2, 3) */ RSKey* key) /* key structure */ { mpz_t mm; int mLp, mLq; int pm8, qm8; if (!mpz_sgn(key->n)) { rs_error(key, NULL, "unable to sign: public key missing"); return RS_ERR_MISSING_PUBLIC_KEY; } if (!mpz_sgn(key->p) || !mpz_sgn(key->q)) { rs_error(key, NULL, "unable to sign: private key missing"); return RS_ERR_MISSING_PRIVATE_KEY; } mpz_init(mm); /* Calculate q^-1 if necessary */ if (!mpz_sgn(key->qinv)) { #ifndef USE_MPZ_GCDEXT mpz_sub_ui(mm, key->p, 2); mpz_powm(key->qinv, key->q, mm, key->p); #else mpz_gcdext(mm, key->qinv, NULL, key->q, key->p); if (mpz_cmp_ui(mm, 1)) { mpz_clear(mm); rs_error(key, NULL, "unable to sign: unsuitable key"); return RS_ERR_UNSUITABLE_RABIN_KEY; } #endif } applyf(mm, hash, key->n, 2); mLp = mpz_legendre(mm, key->p); mLq = mpz_legendre(mm, key->q); pm8 = mpz_get_ui(key->p) % 8; qm8 = mpz_get_ui(key->q) % 8; if (pm8 == 1 || qm8 == 1 || (pm8 % 2) == 0 || (qm8 % 2) == 0) { mpz_clear(mm); rs_error(key, NULL, "unable to sign: unsuitable key"); return RS_ERR_UNSUITABLE_RABIN_KEY; } *f = ftab[(mLp == 1 ? 0 : 1) + (mLq == 1 ? 0 : 2) + (((qm8 - 3) / 2) * 4) + (((pm8 - 3) / 2) * 12)]; if (*f == 99) { mpz_clear(mm); rs_error(key, NULL, "unable to sign: unsuitable key"); return RS_ERR_UNSUITABLE_RABIN_KEY; } rabsigf(res, hash, key->n, key->p, key->q, key->qinv, *f, rootnum); mpz_clear(mm); return RS_SUCCESS; } /* Check that the given Rabin signature is valid. */ int rs_validate_rabin (const mpz_t sig, /* purported signature of app */ int f, /* f value */ const mpz_t hash, /* MD5 hash of app */ const RSKey* key) /* key structure */ { mpz_t a, b; int result; if (!mpz_sgn(key->n)) { rs_error(key, NULL, "unable to validate: public key missing"); return RS_ERR_MISSING_PUBLIC_KEY; } if (f < 0 || f > 3) return RS_SIGNATURE_INCORRECT; mpz_init(a); mpz_init(b); mpz_mul(a, sig, sig); mpz_mod(a, a, key->n); applyf(b, hash, key->n, f); result = mpz_cmp(a, b); mpz_clear(a); mpz_clear(b); return (result ? RS_SIGNATURE_INCORRECT : RS_SUCCESS); } rabbitsign-2.1+dmca1/src/output.c0000600000175000017500000000236611207664425014534 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" /* * Write program contents to a file. */ int rs_write_program_file(const RSProgram* prgm, FILE* f, int month, int day, int year, unsigned int flags) { if (rs_calc_is_ti8x(prgm->calctype) && (prgm->datatype == RS_DATA_OS || prgm->datatype == RS_DATA_APP)) return rs_write_ti8x_file(prgm, f, month, day, year, flags); else return rs_write_ti9x_file(prgm, f, month, day, year, flags); } rabbitsign-2.1+dmca1/src/md5.h0000600000175000017500000001165211127554513013661 0ustar kbkb/* md5.h - Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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. */ #ifndef _MD5_H #define _MD5_H 1 #include #if defined HAVE_LIMITS_H || _LIBC # include #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC # include typedef u_int32_t md5_uint32; #else # if defined __STDC__ && __STDC__ # define UINT_MAX_32_BITS 4294967295U # else # define UINT_MAX_32_BITS 0xFFFFFFFF # endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ # ifndef UINT_MAX # define UINT_MAX UINT_MAX_32_BITS # endif # if UINT_MAX == UINT_MAX_32_BITS typedef unsigned int md5_uint32; # else # if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short md5_uint32; # else # if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long md5_uint32; # else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif # endif #endif #undef __P #if defined (__STDC__) && __STDC__ #define __P(x) x #else #define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void md5_init_ctx __P ((struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int md5_stream __P ((FILE *stream, void *resblock)); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); #endif rabbitsign-2.1+dmca1/src/internal.h0000600000175000017500000000664111211052173014777 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifndef __RABBITSIGN_INTERNAL_H__ #define __RABBITSIGN_INTERNAL_H__ #ifdef __cplusplus extern "C" { #endif /**** Memory management (mem.c) ****/ #define rs_malloc(nnn) rs_realloc(0, (nnn)) #define rs_free(ppp) rs_realloc((ppp), 0) void* rs_realloc (void* ptr, unsigned long count) RS_ATTR_MALLOC; char* rs_strdup (const char* str) RS_ATTR_MALLOC; /**** Rabin signature functions (rabin.c) ****/ /* Compute a Rabin signature and the useful value of f. */ RSStatus rs_sign_rabin (mpz_t res, int* f, const mpz_t hash, int rootnum, RSKey* key); /* Check that the given Rabin signature is valid. */ RSStatus rs_validate_rabin (const mpz_t sig, int f, const mpz_t hash, const RSKey* key); /**** RSA signature functions (rsa.c) ****/ /* Compute an RSA signature. */ RSStatus rs_sign_rsa (mpz_t res, const mpz_t hash, RSKey* key); /* Check that the given RSA signature is valid. */ RSStatus rs_validate_rsa (const mpz_t sig, const mpz_t hash, const RSKey* key); /**** TIFL file output (graphlink.c) ****/ /* Write TIFL header to a file. */ RSStatus rs_write_tifl_header (FILE* f, int is_hex, int major, int minor, int month, int day, int year, const char* name, int calctype, int datatype, unsigned long filesize); /**** Type <-> string conversions (typestr.c) ****/ /* Get default file suffix for a given calc/data type. */ const char* rs_type_to_suffix (RSCalcType calctype, RSDataType datatype, int hexonly); /* Get implied calc/data type for a given file suffix. */ int rs_suffix_to_type (const char* suff, RSCalcType* calctype, RSDataType* datatype); /* Get a human-readable description of a calculator type. */ const char* rs_calc_type_to_string (RSCalcType calctype); /* Get a human-readable description of a data type. */ const char* rs_data_type_to_string (RSDataType datatype); /**** Command line option parsing (cmdline.c) ****/ #define RS_CMDLINE_FINISHED 0 #define RS_CMDLINE_FILENAME '#' #define RS_CMDLINE_HELP '!' #define RS_CMDLINE_VERSION '@' #define RS_CMDLINE_ERROR '?' int rs_parse_cmdline(int argc, char** argv, const char* optstring, int* i, int* j, const char** arg); /**** Error/message logging (error.c) ****/ /* Display an error message */ void rs_error (const RSKey* key, const RSProgram* prgm, const char* fmt, ...) RS_ATTR_PRINTF(3,4); /* Display a warning message */ void rs_warning (const RSKey* key, const RSProgram* prgm, const char* fmt, ...) RS_ATTR_PRINTF(3,4); /* Display an informational message */ void rs_message (int level, const RSKey* key, const RSProgram* prgm, const char* fmt, ...) /*RS_ATTR_PRINTF(4,5)*/; #ifdef __cplusplus } #endif #endif /* __RABBITSIGN_INTERNAL_H__ */ rabbitsign-2.1+dmca1/src/program.c0000600000175000017500000001056711224736662014647 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Create a new program. */ RSProgram* rs_program_new() { RSProgram* prgm = rs_malloc(sizeof(RSProgram)); if (!prgm) return NULL; prgm->filename = NULL; prgm->calctype = 0; prgm->datatype = 0; prgm->data = NULL; prgm->length = 0; prgm->length_a = 0; prgm->header = NULL; prgm->header_length = 0; prgm->signature = NULL; prgm->signature_length = 0; prgm->pagenums = NULL; prgm->npagenums = 0; return prgm; } /* * Create a new program by wrapping an existing data buffer. * * If buffer_size is zero, data will be copied from the source buffer * into the new program. * * If buffer_size is nonzero, then the source buffer must have been * allocated using malloc(); buffer_size is the total amount of memory * allocated. The data will not be copied, and the new program object * assumes ownership of the buffer. */ RSProgram* rs_program_new_with_data(RSCalcType ctype, /* calc type */ RSDataType dtype, /* data type */ void* data, /* source buffer */ unsigned long length, /* length of data */ unsigned long buffer_size) /* amount of memory allocated */ { RSProgram* prgm = rs_program_new(); if (!prgm) return NULL; prgm->calctype = ctype; prgm->datatype = dtype; if (data) { if (buffer_size) { prgm->data = data; prgm->length = length; prgm->length_a = buffer_size; } else { if (rs_program_append_data(prgm, data, length)) { rs_program_free(prgm); return NULL; } } } return prgm; } /* * Free program data. */ void rs_program_free(RSProgram* prgm) { if (!prgm) return; rs_free(prgm->filename); rs_free(prgm->data); rs_free(prgm->header); rs_free(prgm->signature); rs_free(prgm->pagenums); rs_free(prgm); } /* * Truncate or extend program. * * If length is less than the program's current length, the program is * truncated. If length is greater than the current size of the * program, additional space is added. The extra space is padded with * 0xFF, with the exception of bytes that fall at the start of a page. */ int rs_program_set_length(RSProgram* prgm, /* program */ unsigned long length) /* new length of program */ { unsigned long length_a, i; unsigned char* dptr; if (length <= prgm->length) { prgm->length = length; return RS_SUCCESS; } else { if (length > prgm->length_a) { length_a = length + 16384; dptr = rs_realloc(prgm->data, length_a); if (!dptr) return RS_ERR_OUT_OF_MEMORY; prgm->data = dptr; prgm->length_a = length_a; } memset(prgm->data + prgm->length, 0xff, length - prgm->length); for (i = ((prgm->length + 0x3fff) & ~0x3fff); i < length; i += 0x4000) prgm->data[i] = 0x42; prgm->length = length; return RS_SUCCESS; } } /* * Add data to the end of the program. */ int rs_program_append_data(RSProgram* prgm, /* program */ const unsigned char* data, /* data */ unsigned long length) /* size of data */ { unsigned long nlength, length_a; unsigned char* dptr; nlength = prgm->length + length; if (nlength > prgm->length_a) { length_a = nlength + 16384; dptr = rs_realloc(prgm->data, length_a); if (!dptr) return RS_ERR_OUT_OF_MEMORY; prgm->data = dptr; prgm->length_a = length_a; } memcpy(prgm->data + prgm->length, data, length); prgm->length = nlength; return RS_SUCCESS; } rabbitsign-2.1+dmca1/src/output9x.c0000600000175000017500000000503111202677127015003 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Write program to a .89k/.89u/.9xk/.9xu file. * * If month = day = year = 0, use the current time. * * Note: on platforms where it matters, all output files must be * opened in "binary" mode. */ int rs_write_ti9x_file(const RSProgram* prgm, /* program */ FILE* outfile, /* output file */ int month, /* timestamp month */ int day, /* timestamp day */ int year, /* timestamp year*/ unsigned int flags RS_ATTR_UNUSED) { const unsigned char *hdr; unsigned long hdrstart, hdrsize, fieldstart, fieldsize; char name[9]; int e; if (prgm->length >= 6) { rs_get_field_size(prgm->data, &hdrstart, &hdrsize); hdr = prgm->data + hdrstart; if (hdrsize > 128) hdrsize = 128; if (prgm->datatype == RS_DATA_OS) { strcpy(name, "basecode"); } else if (!rs_find_app_field(0x8140, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (fieldsize > 8) fieldsize = 8; strncpy(name, (char*) hdr + fieldstart, fieldsize); name[fieldsize] = 0; } else { name[0] = 0; } } else { name[0] = 0; } /* Note: the "version" header fields used in TI's 68k apps and OSes seem to have no relation to the actual version numbers. */ if ((e = rs_write_tifl_header(outfile, 0, 0, 0, month, day, year, name, prgm->calctype, prgm->datatype, prgm->length))) return e; if (fwrite(prgm->data, 1, prgm->length, outfile) != prgm->length) { rs_error(NULL, NULL, "file I/O error"); return RS_ERR_FILE_IO; } return RS_SUCCESS; } rabbitsign-2.1+dmca1/src/header.c0000600000175000017500000001011111203645715014404 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" /* * Get length of a header field. */ void rs_get_field_size (const unsigned char* data, /* Data */ unsigned long* fieldstart, /* Offset to start of field contents */ unsigned long* fieldsize) /* Length of field contents */ { switch (data[1] & 0x0f) { case 0x0D: if (fieldstart) *fieldstart = 3; if (fieldsize) *fieldsize = data[2]; break; case 0x0E: if (fieldstart) *fieldstart = 4; if (fieldsize) *fieldsize = ((data[2] << 8) | data[3]); break; case 0x0F: if (fieldstart) *fieldstart = 6; if (fieldsize) { *fieldsize = (((unsigned long) data[2] << 24) | ((unsigned long) data[3] << 16) | ((unsigned long) data[4] << 8) | (unsigned long) data[5]); } break; default: if (fieldstart) *fieldstart = 2; if (fieldsize) *fieldsize = (data[1] & 0x0f); break; } } /* Set length of a header field. */ int rs_set_field_size (unsigned char* data, unsigned long fieldsize) { switch (data[1] & 0x0f) { case 0x0D: if (fieldsize > 0xff) return -1; data[2] = fieldsize; return 0; case 0x0E: if (fieldsize > 0xfffful) return -1; data[2] = (fieldsize >> 8) & 0xff; data[3] = fieldsize & 0xff; return 0; case 0x0F: if (fieldsize > 0xfffffffful) return -1; data[2] = (fieldsize >> 24) & 0xff; data[3] = (fieldsize >> 16) & 0xff; data[4] = (fieldsize >> 8) & 0xff; data[5] = fieldsize & 0xff; return 0; default: if (fieldsize > 0x0C) return -1; data[1] = (data[1] & 0xf0) | fieldsize; return 0; } } /* * Find a given header field in the data. */ int rs_find_app_field(unsigned int type, /* Type of field to search for (e.g., 0x8040 to search for the name) */ const unsigned char* data, /* Data to search */ unsigned long length, /* Maximum length of data to search */ unsigned long* fieldhead, /* Offset to field type bytes, if found */ unsigned long* fieldstart, /* Offset to start of field contents, if found */ unsigned long* fieldsize) /* Length of field contents, if found */ { unsigned char b1, b2; unsigned long pos = 0; unsigned long fstart, fsize; b1 = ((type >> 8) & 0xff); b2 = (type & 0xf0); while (pos < length) { if (data[pos] == b1 && (data[pos + 1] & 0xf0) == b2) { rs_get_field_size(data + pos, &fstart, fieldsize); if (fieldhead) *fieldhead = pos; if (fieldstart) *fieldstart = pos + fstart; return 0; } rs_get_field_size(data + pos, &fstart, &fsize); pos += fstart + fsize; } return -1; } /* * Get value of a numeric header field. * * Return 0 if field is not found, or if its contents are longer than * 4 bytes. */ unsigned long rs_get_numeric_field (unsigned int type, const unsigned char* data, unsigned long length) { unsigned long fstart, fsize, value; if (rs_find_app_field(type, data, length, NULL, &fstart, &fsize)) return 0; if (fsize > 4) return 0; value = 0; while (fsize > 0) { value <<= 8; value |= data[fstart]; fstart++; fsize--; } return value; } rabbitsign-2.1+dmca1/src/rsa.c0000600000175000017500000000700311210643076013743 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" #define VALIDATION_EXPONENT 17 /* * Calculate the RSA signing exponent. * * The validation exponent, e, is 17 for all TI-related RSA * signatures. The signing exponent, d, depends on n, and is * calculated so that e * d === 1 (mod (p-1)(q-1)). * * (This means that for any number x, * * x^(e * d) = x * x^[k0 * (p-1)] === x * 1 (mod p), * * and likewise * * x^(e * d) = x * x^[k1 * (q-1)] === x * 1 (mod q). * * Therefore (Chinese remainder theorem) x^(e * d) === x (mod n). * * Note that there is no way of calculating d without knowing the * factors of n; this is a key point in the security of RSA.) */ static int get_exponent(mpz_t res, /* mpz to store result */ int e, /* validation exponent */ const mpz_t p, /* first factor */ const mpz_t q) /* second fatctor */ { mpz_t a, b; mpz_init(a); mpz_init(b); mpz_sub_ui(a, p, 1); mpz_sub_ui(b, q, 1); mpz_mul(a, a, b); mpz_set_ui(b, e); mpz_gcdext(b, res, NULL, b, a); if (mpz_cmp_ui(b, 1)) { mpz_clear(a); mpz_clear(b); return RS_ERR_UNSUITABLE_RSA_KEY; } mpz_mod(res, res, a); mpz_clear(a); mpz_clear(b); return RS_SUCCESS; } /* * Compute an RSA signature. * * This is simply the hash raised to the d-th power mod n (where d is * defined above.) */ int rs_sign_rsa(mpz_t res, /* mpz to store signature */ const mpz_t hash, /* MD5 hash of app */ RSKey* key) /* key structure */ { if (!mpz_sgn(key->n)) { rs_error(key, NULL, "unable to sign: public key missing"); return RS_ERR_MISSING_PUBLIC_KEY; } if (!mpz_sgn(key->d)) { if (!mpz_sgn(key->p) || !mpz_sgn(key->q)) { rs_error(key, NULL, "unable to sign: private key missing"); return RS_ERR_MISSING_PRIVATE_KEY; } if (get_exponent(key->d, VALIDATION_EXPONENT, key->p, key->q)) { rs_error(key, NULL, "unable to sign: unsuitable key"); return RS_ERR_UNSUITABLE_RSA_KEY; } } mpz_powm(res, hash, key->d, key->n); return RS_SUCCESS; } /* * Check that the given RSA signature is valid. * * To do this, we raise the signature to the 17th power mod n, and see * if it matches the hash. */ int rs_validate_rsa(const mpz_t sig, /* purported signature of app */ const mpz_t hash, /* MD5 hash of app */ const RSKey* key) /* key structure */ { mpz_t e, m; int result; if (!mpz_sgn(key->n)) { rs_error(key, NULL, "unable to validate: public key missing"); return RS_ERR_MISSING_PUBLIC_KEY; } mpz_init(e); mpz_init(m); mpz_set_ui(e, VALIDATION_EXPONENT); mpz_powm(m, sig, e, key->n); result = mpz_cmp(hash, m); mpz_clear(e); mpz_clear(m); return (result ? RS_SIGNATURE_INCORRECT : RS_SUCCESS); } rabbitsign-2.1+dmca1/src/apps.c0000600000175000017500000000464311207664273014140 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" /* * Check/fix program header and data. */ int rs_repair_program(RSProgram* prgm, /* app to repair */ unsigned int flags) /* flags */ { if (rs_calc_is_ti8x(prgm->calctype)) { if (prgm->datatype == RS_DATA_OS) return rs_repair_ti8x_os(prgm, flags); else if (prgm->datatype == RS_DATA_APP) return rs_repair_ti8x_app(prgm, flags); } if (rs_calc_is_ti9x(prgm->calctype)) { if (prgm->datatype == RS_DATA_OS) return rs_repair_ti9x_os(prgm, flags); else if (prgm->datatype == RS_DATA_APP) return rs_repair_ti9x_app(prgm, flags); } rs_error(NULL, prgm, "calc/data type (%X/%X) unrecognized", prgm->calctype, prgm->datatype); return RS_ERR_UNKNOWN_PROGRAM_TYPE; } /* * Add a signature to the program. */ int rs_sign_program(RSProgram* prgm, /* app to sign */ RSKey* key, /* signing key */ int rootnum) /* signature number */ { if (rs_calc_is_ti8x(prgm->calctype)) { if (prgm->datatype == RS_DATA_OS) return rs_sign_ti8x_os(prgm, key); else if (prgm->datatype == RS_DATA_APP) return rs_sign_ti8x_app(prgm, key, rootnum); } return rs_sign_ti9x_app(prgm, key); } /* * Validate program signature. */ int rs_validate_program(const RSProgram* prgm, /* app to validate */ const RSKey* key) /* signing key */ { if (rs_calc_is_ti8x(prgm->calctype)) { if (prgm->datatype == RS_DATA_OS) return rs_validate_ti8x_os(prgm, key); else if (prgm->datatype == RS_DATA_APP) return rs_validate_ti8x_app(prgm, key); } return rs_validate_ti9x_app(prgm, key); } rabbitsign-2.1+dmca1/src/rabbitsign.c0000600000175000017500000002461011221344737015311 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" #if !defined(strcasecmp) && !defined(HAVE_STRCASECMP) # ifdef HAVE_STRICMP # define strcasecmp stricmp # else # define strcasecmp strcmp # endif #endif #if !defined(strrchr) && !defined(HAVE_STRRCHR) && defined(HAVE_RINDEX) # define strrchr rindex #endif static const char* getbasename(const char* f) { const char *p; if ((p = strrchr(f, '/'))) f = p + 1; #if defined(__MSDOS__) || defined(__WIN32__) if ((p = strrchr(f, '\\'))) f = p + 1; #endif return f; } static const char* usage[]={ "Usage: %s [options] app-file ...\n", "Where options may include:\n", " -a: appsign compatibility mode (Unix-style output)\n", " -b: read raw binary data (default: auto-detect)\n", " -c: check existing app signatures rather than signing\n", " -f: force signing despite errors\n", " -g: write app in GraphLink (XXk) format\n", " -k KEYFILE: use specified key file\n", " -K NUM: use specified key ID (hexadecimal)\n", " -n: do not alter the app header\n", " -o OUTFILE: write to specified output file (default is .app\n", " or .8xk)\n", " -p: fix the pages field if found\n", " -P: add an extra page if necessary\n", " -q: suppress warning messages\n", " -r: re-sign a previously signed app (i.e. strip off all\n", " data beyond that indicated by the size header)\n", " -R R: specify the root to use (0, 1, 2, or 3) (default is 0)\n", " -t TYPE: specify program type (e.g. 8xk, 73u)\n", " -u: assume plain hex input is unsorted (default is sorted)\n", " -v: be verbose (-vv for even more verbosity)\n", " --help: describe options\n", " --version: print version info\n", NULL}; int main(int argc, char** argv) { unsigned int flags = (RS_INPUT_SORTED | RS_OUTPUT_HEX_ONLY); int rootnum = 0; /* which of the four valid signatures to generate 0 = standard (r,s) 1 = (-r,s) 2 = (r,-s) 3 = (-r,-s) */ int rawmode = 0; /* 0 = fix app headers 1 = sign "raw" data */ int valmode = 0; /* 0 = sign apps 1 = validate apps */ const char* infilename; /* file name for input */ const char* outfilename = NULL; /* file name for output */ const char* keyfilename = NULL; /* file name for key */ int verbose = 0; /* -1 = quiet (errors only) 0 = default (warnings + errors) 1 = verbose (print file names / status) 2 = very verbose (details of computation) */ static const char optstring[] = "abcfgk:K:no:pPqrR:t:uv"; const char *progname; int i, j, c, e; const char* arg; char *tempname; FILE* infile; FILE* outfile; RSKey* key; RSProgram* prgm; unsigned long keyid = 0, appkeyid; RSCalcType ctype = RS_CALC_UNKNOWN; RSDataType dtype = RS_DATA_UNKNOWN; char *ptr; const char *ext; int invalidapps = 0; progname = getbasename(argv[0]); rs_set_progname(progname); if (argc == 1) { fprintf(stderr, usage[0], progname); for (i = 1; usage[i]; i++) fputs(usage[i], stderr); fprintf(stderr, "Report bugs to %s.\n", PACKAGE_BUGREPORT); return 5; } i = j = 1; while ((c = rs_parse_cmdline(argc, argv, optstring, &i, &j, &arg))) { switch (c) { case RS_CMDLINE_HELP: printf(usage[0], progname); for (i = 1; usage[i]; i++) fputs(usage[i], stdout); printf("Report bugs to %s.\n", PACKAGE_BUGREPORT); return 0; case RS_CMDLINE_VERSION: printf("%s\n", PACKAGE_STRING); fputs("Copyright (C) 2009 Benjamin Moody\n", stdout); fputs("This program is free software. ", stdout); fputs("There is NO WARRANTY of any kind.\n", stdout); return 0; case 'o': outfilename = arg; break; case 'k': keyfilename = arg; break; case 'K': if (!sscanf(arg, "%lx", &keyid)) { fprintf(stderr, "%s: -K: invalid argument %s\n", progname, arg); return 5; } break; case 'b': flags |= RS_INPUT_BINARY; break; case 'u': flags &= ~RS_INPUT_SORTED; break; case 'f': flags |= RS_IGNORE_ALL_WARNINGS; break; case 'g': flags &= ~RS_OUTPUT_HEX_ONLY; break; case 'a': flags |= RS_OUTPUT_APPSIGN; break; case 'R': if (!sscanf(arg, "%d", &rootnum)) { fprintf(stderr, "%s: -R: invalid argument %s\n", progname, arg); return 5; } break; case 't': if (rs_suffix_to_type(arg, &ctype, &dtype)) { fprintf(stderr, "%s: unrecognized file type %s\n", progname, arg); return 5; } break; case 'n': rawmode = 1; break; case 'r': flags |= RS_REMOVE_OLD_SIGNATURE; break; case 'P': flags |= RS_ZEALOUSLY_PAD_APP; break; case 'p': flags |= RS_FIX_PAGE_COUNT; break; case 'c': valmode = 1; break; case 'v': verbose++; break; case 'q': verbose--; break; case RS_CMDLINE_FILENAME: break; case RS_CMDLINE_ERROR: return 5; default: fprintf(stderr, "%s: internal error: unknown option -%c\n", progname, c); abort(); } } rs_set_verbose(verbose); if (outfilename && (ptr = strrchr(outfilename, '.')) && !rs_suffix_to_type(ptr + 1, NULL, NULL)) flags &= ~RS_OUTPUT_HEX_ONLY; /* Read key file (if manually specified) */ key = rs_key_new(); if (keyfilename) { infile = fopen(keyfilename, "rb"); if (!infile) { perror(keyfilename); rs_key_free(key); return 3; } if (rs_read_key_file(key, infile, keyfilename, 1)) { fclose(infile); rs_key_free(key); return 3; } fclose(infile); } else if (keyid) { if (rs_key_find_for_id(key, keyid, valmode)) { rs_key_free(key); return 3; } } /* Process applications */ i = j = 1; while ((c = rs_parse_cmdline(argc, argv, optstring, &i, &j, &arg))) { if (c != RS_CMDLINE_FILENAME) continue; /* Read input file */ if (strcmp(arg, "-")) { infilename = arg; infile = fopen(arg, "rb"); if (!infile) { perror(arg); rs_key_free(key); return 4; } } else { infilename = "(standard input)"; infile = stdin; } prgm = rs_program_new(); if (ctype && dtype) { prgm->calctype = ctype; prgm->datatype = dtype; } else if ((ptr = strrchr(infilename, '.'))) { rs_suffix_to_type(ptr + 1, &prgm->calctype, &prgm->datatype); } if (rs_read_program_file(prgm, infile, infilename, flags)) { rs_program_free(prgm); rs_key_free(key); if (infile != stdin) fclose(infile); return 4; } if (infile != stdin) fclose(infile); /* Read key file (if automatic) */ if (!keyfilename && !keyid) { appkeyid = rs_program_get_key_id(prgm); if (!appkeyid) { fprintf(stderr, "%s: unable to determine key ID\n", infilename); rs_program_free(prgm); rs_key_free(key); return 3; } if (appkeyid != key->id) { if (rs_key_find_for_id(key, appkeyid, valmode)) { rs_program_free(prgm); rs_key_free(key); return 3; } } } if (valmode) { /* Validate application */ if (verbose > 0) fprintf(stderr, "Validating %s %s %s...\n", rs_calc_type_to_string(prgm->calctype), rs_data_type_to_string(prgm->datatype), infilename); if (rs_validate_program(prgm, key)) invalidapps++; } else { /* Sign application */ if (verbose > 0) fprintf(stderr, "Signing %s %s %s...\n", rs_calc_type_to_string(prgm->calctype), rs_data_type_to_string(prgm->datatype), infilename); if (!rawmode) { if ((e = rs_repair_program(prgm, flags))) { if (!(flags & RS_IGNORE_ALL_WARNINGS) && e < RS_ERR_CRITICAL) fprintf(stderr, "(use -f to override)\n"); rs_program_free(prgm); rs_key_free(key); return 2; } } if (rs_sign_program(prgm, key, rootnum)) { rs_program_free(prgm); rs_key_free(key); return 2; } /* Generate output file name */ if (outfilename) { if (strcmp(outfilename, "-")) { outfile = fopen(outfilename, "wb"); if (!outfile) { perror(outfilename); rs_program_free(prgm); rs_key_free(key); return 4; } } else { outfile = stdout; } } else if (infile == stdin) { outfile = stdout; } else { ext = rs_type_to_suffix(prgm->calctype, prgm->datatype, (flags & RS_OUTPUT_HEX_ONLY)); tempname = rs_malloc(strlen(infilename) + 32); if (!tempname) { rs_program_free(prgm); rs_key_free(key); return 4; } strcpy(tempname, infilename); ptr = strrchr(tempname, '.'); if (!ptr) { strcat(tempname, "."); strcat(tempname, ext); } else if (strcasecmp(ptr + 1, ext)) { strcpy(ptr + 1, ext); } else { strcpy(ptr, "-signed."); strcat(ptr, ext); } outfile = fopen(tempname, "wb"); if (!outfile) { perror(tempname); rs_free(tempname); rs_program_free(prgm); rs_key_free(key); return 4; } rs_free(tempname); } /* Write signed application to output file */ if (rs_write_program_file(prgm, outfile, 0, 0, 0, flags)) { if (outfile != stdout) fclose(outfile); rs_program_free(prgm); rs_key_free(key); return 4; } if (outfile != stdout) fclose(outfile); } rs_program_free(prgm); } rs_key_free(key); if (invalidapps) return 1; else return 0; } rabbitsign-2.1+dmca1/src/autokeys.h0000600000175000017500000000175711267671205015050 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ struct pubkeyinfo { unsigned long id; const char* n; } known_pub_keys[] = {{ 0, 0 }}; struct privkeyinfo { unsigned long id; const char* n; const char* p; const char* q; const char* d; } known_priv_keys[] = {{ 0, 0, 0, 0, 0 }}; rabbitsign-2.1+dmca1/src/keys.c0000600000175000017500000001332711232511003014123 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Create a new key. */ RSKey* rs_key_new() { RSKey* key = rs_malloc(sizeof(RSKey)); if (!key) return NULL; key->filename = NULL; key->id = 0; mpz_init(key->n); mpz_init(key->p); mpz_init(key->q); mpz_init(key->qinv); mpz_init(key->d); return key; } /* * Free a key. */ void rs_key_free(RSKey* key) { if (!key) return; rs_free(key->filename); mpz_clear(key->n); mpz_clear(key->p); mpz_clear(key->q); mpz_clear(key->qinv); mpz_clear(key->d); rs_free(key); } /* * Parse a number written in TI's hexadecimal key format. */ static int parse_value(mpz_t dest, /* mpz to store result */ const char* str) /* string to parse */ { unsigned int count, b, i; int n; unsigned char buf[256]; if (1 > sscanf(str, "%2X%n", &count, &n) || n != 2 || (count * 2 + 2) > strlen(str)) return 1; for (i = 0; i < count; i++) { if (1 > sscanf(str + 2 + 2 * i, "%2X%n", &b, &n) || n != 2) return 1; buf[i] = b; } mpz_import(dest, i, -1, 1, 0, 0, buf); return 0; } /* * Read key from a file. * * Two formats of key file are supported: * * "Rabin" style (the type used by the TI-83 Plus SDK) consists of * three lines: the public key (n) followed by its two factors (p and * q.) * * "RSA" style (the type used by the TI-89/92 Plus SDK) also consists * of three lines: the key ID, the public key (n), and the signing * exponent (d). * * In either case, if we are only interested in validating signatures, * the private key may be omitted. * * Note that "Rabin" style key files can be used to generate RSA * signatures, but not vice versa. */ int rs_read_key_file(RSKey* key, /* key structure */ FILE* f, /* file to read */ const char* fname, /* file name */ int verify) /* 1 = check key validity */ { char buf[1024]; mpz_t tmp; rs_free(key->filename); key->filename = rs_strdup(fname); if (fname && !key->filename) return RS_ERR_OUT_OF_MEMORY; if (!fgets(buf, sizeof(buf), f)) { rs_error(key, NULL, "invalid key file syntax"); return RS_ERR_KEY_SYNTAX; } if (strlen(buf) < 11) { if (1 > sscanf(buf, "%lX", &key->id)) { rs_error(key, NULL, "invalid key file syntax"); return RS_ERR_KEY_SYNTAX; } if (!fgets(buf, sizeof(buf), f) || parse_value(key->n, buf)) { rs_error(key, NULL, "invalid key file syntax"); return RS_ERR_KEY_SYNTAX; } if (!fgets(buf, sizeof(buf), f) || parse_value(key->d, buf)) mpz_set_ui(key->d, 0); else if (verify) { /* We can't truly verify the key without factoring n (which is possible, given d, but would take a bit of work.) Instead, test the key by performing a single RSA encryption and decryption. */ mpz_init(tmp); mpz_set_ui(tmp, 17); mpz_powm(tmp, tmp, tmp, key->n); mpz_powm(tmp, tmp, key->d, key->n); if (mpz_cmp_ui(tmp, 17)) { mpz_clear(tmp); rs_error(key, NULL, "private key incorrect (de != 1 mod phi(n))"); return RS_ERR_INVALID_KEY; } mpz_clear(tmp); } mpz_set_ui(key->p, 0); mpz_set_ui(key->q, 0); mpz_set_ui(key->qinv, 0); } else { if (parse_value(key->n, buf)) { rs_error(key, NULL, "invalid key file"); return RS_ERR_KEY_SYNTAX; } if (!fgets(buf, sizeof(buf), f) || parse_value(key->p, buf) || !fgets(buf, sizeof(buf), f) || parse_value(key->q, buf)) { mpz_set_ui(key->p, 0); mpz_set_ui(key->q, 0); } else if (verify) { /* Verify that p * q = n (of course, that doesn't guarantee that these are the only factors of n.) */ mpz_init(tmp); mpz_mul(tmp, key->p, key->q); if (mpz_cmp(tmp, key->n)) { mpz_clear(tmp); rs_error(key, NULL, "private key incorrect (pq != n)"); return RS_ERR_INVALID_KEY; } mpz_clear(tmp); } mpz_set_ui(key->qinv, 0); mpz_set_ui(key->d, 0); key->id = 0; } if (mpz_sgn(key->p) && mpz_sgn(key->q)) { rs_message(2, key, NULL, "Loaded Rabin/RSA private key:"); rs_message(2, key, NULL, " n = %ZX", key->n); rs_message(2, key, NULL, " p = %ZX", key->p); rs_message(2, key, NULL, " q = %ZX", key->q); } else if (mpz_sgn(key->d)) { rs_message(2, key, NULL, "Loaded RSA private key:"); rs_message(2, key, NULL, " n = %ZX", key->n); rs_message(2, key, NULL, " d = %ZX", key->d); } else { rs_message(2, key, NULL, "Loaded public key:"); rs_message(2, key, NULL, " n = %ZX", key->n); } return RS_SUCCESS; } /* * Parse a number written in TI's hexadecimal key format. */ int rs_parse_key_value(mpz_t dest, /* mpz to store result */ const char* str) /* string to parse */ { if (parse_value(dest, str)) { rs_error(NULL, NULL, "invalid key value syntax"); return RS_ERR_KEY_SYNTAX; } else { return RS_SUCCESS; } } rabbitsign-2.1+dmca1/src/autokey.c0000600000175000017500000001300211211332053014622 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" #include "autokeys.h" /* * Get key ID for the given program. */ unsigned long rs_program_get_key_id(const RSProgram* prgm) { const unsigned char* hdr; unsigned long hdrstart, hdrsize; if (prgm->header_length > 0) { hdr = prgm->header; hdrsize = prgm->header_length; } else if (prgm->length > 0) { hdr = prgm->data; hdrsize = prgm->length; if (hdrsize > 128) hdrsize = 128; } else return 0; rs_get_field_size(hdr, &hdrstart, NULL); hdrsize -= hdrstart; if (hdr[0] == 0x81) return rs_get_numeric_field(0x8110, hdr + hdrstart, hdrsize); else return rs_get_numeric_field(0x8010, hdr + hdrstart, hdrsize); } /* * Try to load key from a file. */ static int try_key_file(RSKey* key, /* key structure to store result */ const char* a, /* first path element */ const char* b, /* second path element */ const char* c) /* third path element */ { char* s; FILE* f; int e; s = rs_malloc(strlen(a) + strlen(b) + strlen(c) + 1); if (!s) return RS_ERR_OUT_OF_MEMORY; strcpy(s, a); strcat(s, b); strcat(s, c); f = fopen(s, "rt"); if (!f) { rs_free(s); return RS_ERR_KEY_NOT_FOUND; } if ((e = rs_read_key_file(key, f, s, 1))) { fclose(f); rs_free(s); return e; } fclose(f); rs_free(s); return RS_SUCCESS; } /* * Try to locate a given key file. */ static int find_key_file(RSKey* key, /* key structure to store result */ const char* filename) /* file name to search for */ { const char* p; int e; e = try_key_file(key, "", "", filename); if (e != RS_ERR_KEY_NOT_FOUND) return e; if ((p = getenv("RABBITSIGN_KEY_DIR"))) { #if defined(__MSDOS__) || defined(__WIN32__) e = try_key_file(key, p, "\\", filename); #else e = try_key_file(key, p, "/", filename); #endif if (e != RS_ERR_KEY_NOT_FOUND) return e; } #if defined(__MSDOS__) || defined(__WIN32__) if ((p = getenv("TI83PLUSDIR"))) { e = try_key_file(key, p, "\\Utils\\", filename); if (e != RS_ERR_KEY_NOT_FOUND) return e; } #endif #ifdef SHARE_DIR e = try_key_file(key, SHARE_DIR, "", filename); if (e != RS_ERR_KEY_NOT_FOUND) return e; #endif return RS_ERR_KEY_NOT_FOUND; } /* * Find key file for the given ID. */ int rs_key_find_for_id(RSKey* key, /* key structure to store result */ unsigned long keyid, /* key ID to search for */ int publiconly) /* 1 = search for public key only */ { static const char* fmts[] = { "%02lx.%s", "%02lX.%s", "%04lx.%s", "%04lX.%s", NULL }; char buf[16]; int i, e; mpz_set_ui(key->p, 0); mpz_set_ui(key->q, 0); mpz_set_ui(key->qinv, 0); mpz_set_ui(key->d, 0); if (keyid > 0xFF) sprintf(buf, "%04lX", keyid); else sprintf(buf, "%02lX", keyid); for (i = 0; known_priv_keys[i].n; i++) { if (keyid == known_priv_keys[i].id) { if ((e = rs_parse_key_value(key->n, known_priv_keys[i].n))) return e; if (known_priv_keys[i].p && (e = rs_parse_key_value(key->p, known_priv_keys[i].p))) return e; if (known_priv_keys[i].q && (e = rs_parse_key_value(key->q, known_priv_keys[i].q))) return e; if (known_priv_keys[i].d && (e = rs_parse_key_value(key->d, known_priv_keys[i].d))) return e; rs_message(2, key, NULL, "Loaded builtin private key %s:", buf); rs_message(2, key, NULL, " n = %ZX", key->n); if (mpz_sgn(key->p)) rs_message(2, key, NULL, " p = %ZX", key->p); if (mpz_sgn(key->q)) rs_message(2, key, NULL, " q = %ZX", key->q); if (mpz_sgn(key->d)) rs_message(2, key, NULL, " d = %ZX", key->d); key->id = keyid; return 0; } } if (publiconly) { for (i = 0; known_pub_keys[i].n; i++) { if (keyid == known_pub_keys[i].id) { if ((e = rs_parse_key_value(key->n, known_pub_keys[i].n))) return e; rs_message(2, key, NULL, "Loaded builtin public key %s:", buf); rs_message(2, key, NULL, " n = %ZX", key->n); key->id = keyid; return 0; } } } for (i = 0; fmts[i]; i++) { sprintf(buf, fmts[i], keyid, "key"); e = find_key_file(key, buf); if (e != RS_ERR_KEY_NOT_FOUND) { if (e == 0 && !key->id) key->id = keyid; return e; } } if (publiconly) { for (i = 0; fmts[i]; i++) { sprintf(buf, fmts[i], keyid, "pub"); e = find_key_file(key, buf); if (e != RS_ERR_KEY_NOT_FOUND) { if (e == 0 && !key->id) key->id = keyid; return e; } } } rs_error(NULL, NULL, "cannot find key file %s", buf); return RS_ERR_KEY_NOT_FOUND; } rabbitsign-2.1+dmca1/src/output8x.c0000600000175000017500000001402311202677117015002 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # ifdef HAVE_STRINGS_H # include # endif #endif #include "rabbitsign.h" #include "internal.h" /* * Write a single record to an Intel hex file. */ static int write_hex_record(FILE* outfile, /* output file */ unsigned int nbytes, /* number of bytes */ unsigned int addr, /* address */ unsigned int type, /* record type */ unsigned char* data, /* data */ unsigned int flags, /* flags */ int final) { char buf[256]; unsigned int i; unsigned int sum; sum = nbytes + addr + (addr >> 8) + type; sprintf(buf, ":%02X%04X%02X", nbytes, addr, type); for (i = 0; i < nbytes; i++) { sprintf(buf + 9 + 2 * i, "%02X", data[i]); sum += data[i]; } sum = ((-sum) & 0xff); sprintf(buf + 9 + 2 * i, "%02X", sum); if (!final) { if (flags & RS_OUTPUT_APPSIGN) strcpy(buf + 11 + 2 * i, "\n"); else strcpy(buf + 11 + 2 * i, "\r\n"); } if (fputs(buf, outfile) == EOF) { rs_error(NULL, NULL, "file I/O error"); return RS_ERR_FILE_IO; } return RS_SUCCESS; } /* * Write a chunk of data to an Intel hex file. */ static int write_hex_data(FILE* outfile, /* output file */ unsigned long length, /* number of bytes */ unsigned long addr, /* starting address */ unsigned char* data, /* data */ unsigned int flags) { unsigned int count; int e; while (length > 0) { if (length < 0x20) count = length; else count = 0x20; if ((e = write_hex_record(outfile, count, addr, 0, data, flags, 0))) return e; length -= count; addr += count; data += count; } return RS_SUCCESS; } /* * Write program to a .73k/.73u/.8xk/.8xu or .app file. * * If month = day = year = 0, use the current time. * * Note: on platforms where it matters, all output files must be * opened in "binary" mode. */ int rs_write_ti8x_file(const RSProgram* prgm, /* program */ FILE* outfile, /* output file */ int month, /* timestamp month */ int day, /* timestamp day */ int year, /* timestamp year*/ unsigned int flags) /* flags */ { const unsigned char *hdr; unsigned long hdrstart, hdrsize, fieldstart, fieldsize; int major, minor, i; unsigned long npages, nrecords, hexsize; char name[9]; unsigned int pagenum, addr; unsigned long count; unsigned char pnbuf[2]; int e; if (!(flags & RS_OUTPUT_HEX_ONLY)) { if (prgm->header_length) { hdr = prgm->header; hdrsize = prgm->header_length; } else { hdr = prgm->data; hdrsize = prgm->length; } if (hdrsize >= 6) { rs_get_field_size(hdr, &hdrstart, NULL); hdr += hdrstart; hdrsize -= hdrstart; if (hdrsize > 128) hdrsize = 128; major = rs_get_numeric_field(0x8020, hdr, hdrsize); minor = rs_get_numeric_field(0x8030, hdr, hdrsize); if (prgm->datatype == RS_DATA_OS) { if (prgm->calctype == RS_CALC_TI73) strcpy(name, "BASECODE"); else strcpy(name, "basecode"); } else if (!rs_find_app_field(0x8040, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (fieldsize > 8) fieldsize = 8; strncpy(name, (char*) hdr + fieldstart, fieldsize); name[fieldsize] = 0; } else { name[0] = 0; } } else { major = minor = 0; name[0] = 0; } npages = ((prgm->length + 0x3fff) >> 14); nrecords = 1 + npages + ((prgm->length + 0x1f) >> 5); if (prgm->header_length) nrecords += 1 + ((prgm->header_length + 0x1f) >> 5); if (prgm->signature_length) nrecords += 1 + ((prgm->signature_length + 0x1f) >> 5); if (flags & RS_OUTPUT_APPSIGN) { hexsize = (npages * 4 + prgm->length * 2 + prgm->header_length * 2 + prgm->signature_length * 2 + nrecords * 12 - 1); } else { hexsize = (npages * 4 + prgm->length * 2 + prgm->header_length * 2 + prgm->signature_length * 2 + nrecords * 13 - 2); } if ((e = rs_write_tifl_header(outfile, 1, major, minor, month, day, year, name, prgm->calctype, prgm->datatype, hexsize))) return e; } if (prgm->header_length) { if ((e = write_hex_data(outfile, prgm->header_length, 0, prgm->header, flags))) return e; if ((e = write_hex_record(outfile, 0, 0, 1, NULL, flags, 0))) return e; } for (i = 0; ((unsigned long) i << 14) < prgm->length; i++) { if (i < prgm->npagenums) pagenum = prgm->pagenums[i]; else pagenum = i; if (pagenum == 0 && prgm->header_length) addr = 0; else addr = 0x4000; pnbuf[0] = (pagenum >> 8) & 0xff; pnbuf[1] = pagenum & 0xff; if ((e = write_hex_record(outfile, 2, 0, 2, pnbuf, flags, 0))) return e; count = prgm->length - i * 0x4000; if (count > 0x4000) count = 0x4000; if ((e = write_hex_data(outfile, count, addr, prgm->data + i * 0x4000, flags))) return e; } if (prgm->signature_length) { if ((e = write_hex_record(outfile, 0, 0, 1, NULL, flags, 0))) return e; if ((e = write_hex_data(outfile, prgm->signature_length, 0, prgm->signature, flags))) return e; } return write_hex_record(outfile, 0, 0, 1, NULL, flags, 1); } rabbitsign-2.1+dmca1/src/app8x.c0000600000175000017500000003325211230145170014215 0ustar kbkb/* * RabbitSign - Tools for signing TI graphing calculator software * Copyright (C) 2009 Benjamin Moody * * 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 . */ #ifdef HAVE_CONFIG_H # include #endif #include #include "rabbitsign.h" #include "internal.h" #include "md5.h" /* * Check/fix Flash app header and data. * * This function checks various parts of the application header which, * if incorrect, are known to cause applications to be rejected by the * calculator. Depending on the flags, this function will also fix * incorrect header fields. * * Note that this function can also add padding to the end of the app. * The entire signature must be stored on one page, so if there is not * enough room on the final page of the app, an extra page needs to be * added to hold the signature. * * In addition, some versions of the boot code have a bug which * results in incorrect MD5 hashes for applications that are 55 bytes * long mod 64; this function will add an extra padding byte to avoid * that case. */ int rs_repair_ti8x_app(RSProgram* app, /* app to repair */ unsigned int flags) /* flags */ { unsigned long length, hdrstart, hdrsize, fieldstart, fieldsize, i; unsigned char* hdr; unsigned char dummy = 0; int e, pagecount, addedpage = 0; /* Various parts of the OS, as well as other software on the calculator and PC, expect that every application begins with the bytes 80 0F -- a "long" field. Some things may work for apps with an 80 0E (or even 80 0D) field, but not everything. Please stick with 80 0F. */ if (app->length < 6 || app->data[0] != 0x80 || app->data[1] != 0x0f) { rs_error(NULL, app, "no app header found"); return RS_ERR_MISSING_HEADER; } /* Determine application length */ length = app->length; rs_get_field_size(app->data, &hdrstart, &hdrsize); /* If requested, remove the old signature (truncate the application to its stated length.) */ if (flags & RS_REMOVE_OLD_SIGNATURE) { if (length < hdrstart + hdrsize) { rs_warning(NULL, app, "provided app data too short"); } else { if (length > hdrstart + hdrsize + 96) rs_warning(NULL, app, "re-signing discards %lu bytes", length - hdrstart - hdrsize); length = hdrstart + hdrsize; } } else if (hdrsize && hdrstart + hdrsize != length) { rs_warning(NULL, app, "application length incorrect"); rs_warning(NULL, app, "(perhaps you meant to use -r?)"); } /* If necessary, add an extra page to ensure that the signature doesn't span a page boundary. */ if (((length + 69 + 0x3fff) >> 14) != ((length + 0x3fff) >> 14)) { if (flags & (RS_ZEALOUSLY_PAD_APP | RS_IGNORE_ALL_WARNINGS)) { rs_warning(NULL, app, "adding an extra page to hold app signature"); length = ((length + 0x4000) & ~0x3fff) + 1; addedpage = 1; } else { rs_error(NULL, app, "application ends too close to a page boundary"); return RS_ERR_FINAL_PAGE_TOO_LONG; } } if ((e = rs_program_set_length(app, length))) return e; /* If the length is 55 mod 64, add an extra byte. (Note that, with 512-bit keys, this can never cause a page overflow.) We use zero for the padding value, rather than FF, so that our output matches that of other tools. */ if ((length % 64) == 55) { length++; rs_message(2, NULL, app, "adding an extra byte due to boot code bugs"); if ((e = rs_program_append_data(app, &dummy, 1))) return e; } /* Set app size header to the correct value */ hdrsize = length - hdrstart; if (rs_set_field_size(app->data, hdrsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application length header too small"); else { rs_error(NULL, app, "application length header too small"); return RS_ERR_FIELD_TOO_SMALL; } } /* Check/fix page count. This field is required to be present and contain the correct number of pages. It must be one byte long (some parts of the OS don't even check the length and assume it is one byte long.) */ hdr = app->data + hdrstart; if (hdrsize > 128) hdrsize = 128; if (rs_find_app_field(0x8080, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no page count field"); else { rs_error(NULL, app, "application has no page count field"); return RS_ERR_MISSING_PAGE_COUNT; } } else if (fieldsize != 1) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has an invalid page count field"); else { rs_error(NULL, app, "application has an invalid page count field"); return RS_ERR_INCORRECT_PAGE_COUNT; } } else { pagecount = ((length + 0x3fff) >> 14); if (flags & RS_FIX_PAGE_COUNT) { hdr[fieldstart] = pagecount; } else if (addedpage && hdr[fieldstart] == pagecount - 1) { hdr[fieldstart] = pagecount; } else if (hdr[fieldstart] != pagecount) { if (flags & RS_IGNORE_ALL_WARNINGS) { rs_warning(NULL, app, "application has an incorrect page count (actual: %lu)", ((length + 0x3fff) >> 14)); hdr[fieldstart] = pagecount; } else { rs_error(NULL, app, "application has an incorrect page count (actual: %lu)", ((length + 0x3fff) >> 14)); return RS_ERR_INCORRECT_PAGE_COUNT; } } } /* Check for key ID. This field is required to be present; it determines which public key is used for validation. (The contents of this field are usually thought of as a big-endian integer, but to be more precise, they're really treated as a binary string.) */ if (rs_find_app_field(0x8010, hdr, hdrsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no key ID"); else { rs_error(NULL, app, "application has no key ID"); return RS_ERR_MISSING_KEY_ID; } } /* Check for date stamp. This seems to be required -- the OS will use it to update its last-known date stamp if necessary -- and should consist of an 032x field containing an 090x field, followed by an 020x field containing the date stamp signature. (The contents of the latter only matter if the date stamp is "new.") */ if (rs_find_app_field(0x0320, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp"); else { rs_error(NULL, app, "application has no date stamp"); return RS_ERR_MISSING_DATE_STAMP; } } else if (rs_find_app_field(0x0900, hdr + fieldstart, fieldsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp"); else { rs_error(NULL, app, "application has no date stamp"); return RS_ERR_MISSING_DATE_STAMP; } } else if (hdr[fieldstart + fieldsize] != 0x02 || (hdr[fieldstart + fieldsize + 1] & 0xf0) != 0) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no date stamp signature"); else { rs_error(NULL, app, "application has no date stamp signature"); return RS_ERR_MISSING_DATE_STAMP; } } /* Check for program image field. This field indicates the end of the header and the start of application code. Note, however, that the OS handles this field in an exceedingly broken way. To be safe, this must always be the last field of the header, and should always be written as 80 7F followed by four length bytes. The length bytes may be anything you like -- they're ignored. */ if (rs_find_app_field(0x8070, hdr, hdrsize, NULL, NULL, NULL)) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "application has no program image field"); else { rs_error(NULL, app, "application has no program image field"); return RS_ERR_MISSING_PROGRAM_IMAGE; } } /* Check for invalid pages (those beginning with FF.) An OS bug means that such pages will end up being erased completely if defragmenting requires the application to be moved in Flash. */ e = RS_SUCCESS; for (i = 0; i < app->length; i += 0x4000) { if (app->data[i] == 0xff) { if (flags & RS_IGNORE_ALL_WARNINGS) rs_warning(NULL, app, "page %ld begins with FFh", (i >> 14)); else { rs_error(NULL, app, "page %ld begins with FFh", (i >> 14)); e = RS_ERR_INVALID_PROGRAM_DATA; } } } return e; } /* * Compute signature for a Flash app. * * The app header should be checked and/or repaired by * rs_repair_ti8x_app() prior to calling this function. * * There are four equally valid Rabin signatures for any application; * rootnum determines which of the four should be used. */ int rs_sign_ti8x_app(RSProgram* app, /* app to sign */ RSKey* key, /* signing key */ int rootnum) /* signature number */ { md5_uint32 hash[4]; mpz_t hashv, sigv; int f; unsigned int lastpagelength; unsigned char sigdata[512]; size_t siglength; int e; /* Check if app length is risky */ if ((app->length % 64) == 55) { rs_warning(NULL, app, "application has length 55 mod 64"); rs_warning(NULL, app, "(this will fail to validate on TI-83+ BE)"); } /* Compute signature */ md5_buffer((char*) app->data, app->length, hash); mpz_init(hashv); mpz_init(sigv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, app, "hash = %ZX", hashv); if ((e = rs_sign_rabin(sigv, &f, hashv, rootnum, key))) { mpz_clear(hashv); mpz_clear(sigv); return e; } rs_message(2, NULL, app, "sig = %ZX", sigv); rs_message(2, NULL, app, "f = %d", f); /* Write the square root value as an 022D field... */ sigdata[0] = 0x02; sigdata[1] = 0x2d; mpz_export(sigdata + 3, &siglength, -1, 1, 0, 0, sigv); sigdata[2] = siglength & 0xff; siglength += 3; mpz_clear(hashv); mpz_clear(sigv); /* ...and append the f value as a big integer */ if (f == 0) { sigdata[siglength++] = 0; } else { sigdata[siglength++] = 1; sigdata[siglength++] = f; } /* Add padding, but not too much (it seems to make some link programs happier) */ lastpagelength = app->length & 0x3fff; while (siglength < 96 && (lastpagelength + siglength) < 0x3fff) sigdata[siglength++] = 0xff; return rs_program_append_data(app, sigdata, siglength); } /* * Validate a Flash app signature. */ int rs_validate_ti8x_app(const RSProgram* app, /* app to validate */ const RSKey* key) /* signing key */ { unsigned long length, hdrstart, hdrsize, fieldstart, fieldsize, i; const unsigned char *hdr, *sig; md5_uint32 hash[4]; mpz_t hashv, sigv; int f, e, e2 = RS_SUCCESS; if (app->length < 6) { rs_error(NULL, app, "no app header found"); return RS_ERR_MISSING_HEADER; } rs_get_field_size(app->data, &hdrstart, &hdrsize); length = hdrstart + hdrsize; hdr = app->data + hdrstart; if (hdrsize > 128) hdrsize = 128; if (((length + 0x3fff) >> 14) != ((app->length + 0x3fff) >> 14) || length + 4 > app->length || length + 96 < app->length) { rs_error(NULL, app, "incorrect application length"); return RS_ERR_INCORRECT_PROGRAM_SIZE; } if (rs_find_app_field(0x8070, hdr, hdrsize, NULL, NULL, NULL)) { rs_warning(NULL, app, "application has no program image field"); e2 = RS_ERR_MISSING_PROGRAM_IMAGE; } if (rs_find_app_field(0x8080, hdr, hdrsize, NULL, &fieldstart, &fieldsize)) { rs_warning(NULL, app, "application has no no page count field"); e2 = RS_ERR_MISSING_PAGE_COUNT; } else if (fieldsize != 1) { rs_warning(NULL, app, "application has an invalid page count field"); e2 = RS_ERR_INCORRECT_PAGE_COUNT; } else if (hdr[fieldstart] != ((length + 0x3fff) >> 14)) { rs_warning(NULL, app, "application has an incorrect page count field"); e2 = RS_ERR_INCORRECT_PAGE_COUNT; } if ((length % 64) == 55) { rs_warning(NULL, app, "application has length 55 mod 64"); rs_warning(NULL, app, "(this will fail to validate on TI-83+ BE)"); e2 = RS_ERR_INVALID_PROGRAM_SIZE; } for (i = 0; i < app->length; i += 0x4000) { if (app->data[i] == 0xff) { rs_warning(NULL, app, "page %ld begins with FFh", (i >> 14)); e2 = RS_ERR_INVALID_PROGRAM_DATA; } } md5_buffer((char*) app->data, length, &hash); sig = app->data + length; if (sig[0] != 0x02 || sig[1] != 0x2d) { rs_error(NULL, app, "application does not have a Rabin signature"); return RS_ERR_MISSING_RABIN_SIGNATURE; } rs_get_field_size(sig, &fieldstart, &fieldsize); mpz_init(sigv); mpz_init(hashv); mpz_import(hashv, 16, -1, 1, 0, 0, hash); rs_message(2, NULL, app, "hash = %ZX", hashv); mpz_import(sigv, fieldsize, -1, 1, 0, 0, sig + fieldstart); rs_message(2, NULL, app, "sig = %ZX", sigv); if (sig[fieldstart + fieldsize] == 0) f = 0; else f = sig[fieldstart + fieldsize + 1]; rs_message(2, NULL, app, "f = %d", f); e = rs_validate_rabin(sigv, f, hashv, key); if (e == RS_SIGNATURE_INCORRECT) rs_message(0, NULL, app, "application signature incorrect"); mpz_clear(sigv); mpz_clear(hashv); return (e ? e : e2); } rabbitsign-2.1+dmca1/README0000600000175000017500000001424511232723703013111 0ustar kbkbRabbitSign 2.1 -------------- RabbitSign is a free implementation of the algorithms used to digitally sign software for the Texas Instruments TI-73, TI-83 Plus, TI-84 Plus, TI-89, TI-92 Plus, and Voyage 200 calculators. RabbitSign can handle a variety of common input file formats, including GraphLink files as well as "plain" hex and binary files. It is quite a lot faster than the official application signing programs from TI, and unlike those programs, does not have any arbitrary limitations on file names or contents. It also has the ability (unique as far as I know) to re-sign applications that have been signed previously. Finally, of course, RabbitSign is free software, and should be able to run on any modern system with an ANSI C compiler. I have NOT received any assistance from TI on this, nor have I attempted to reverse-engineer any of their programs. The details of the application format and signing algorithm were determined purely by my analysis of the output of TI's and Peter-Martijn Kuipers' appsign tools. Installing ---------- RabbitSign makes extensive use of high-precision integer arithmetic, which can be made substantially faster through the use of the GNU MP library (http://gmplib.org/). Installing this library is optional but recommended. (Users of Debian, Ubuntu, and related systems will need the libgmp3-dev package; users of RPM-based distributions will need gmp-devel. GMP version 4.1 or later is required.) To compile, test, and install RabbitSign, from the main package directory, run: ./configure make make check sudo make install This will install RabbitSign in /usr/local/bin. To install in a different location, specify the '--prefix' argument when you run configure. Run './configure --help' for more information. Using ----- In order to sign an application or OS, you need to have an appropriate signing key. The signing key for "shareware" TI-83/84 Plus apps, 0104.key, is included in this package. (The corresponding keys for the TI-73, TI-89, and TI-92 Plus have not been released, so only TI can sign applications for those calculators.) In addition, this package includes an unofficial signing key, 05.key, which can be used for TI-83/84 Plus operating systems. To install an OS that has been signed using this key, you must first install the corresponding certificate, which can be done using Brandon Wilson's Free83P utility. To sign a hex or binary app file, use a command such as rabbitsign -g myapp.hex This will search for the key specified in the app header (using the 801x field.) It will then sign the app and write the result in GraphLink format to myapp.8xk. To use a specific key file, use the -k option: rabbitsign -g -k foo.key myapp.hex Run 'man rabbitsign' for more information. A word of caution ----------------- If you do somehow acquire a valid signing key for the TI-89 or TI-92 Plus, you should be able to use RabbitSign to sign applications for those calculators. However, keep in mind that on those calculators, it is possible (in fact, quite easy) to seriously break the system merely by installing a buggy Flash app. So be sure to test your app in an emulator before trying to install it on a real calculator! (Of course, testing your app before installing it is a good idea on the TI-83 Plus as well!) History ------- version 2.1 -- July 25, 2009 * Added the unofficial "05" key, which can be used in combination with Brandon Wilson's Free83P to sign TI-83/84 Plus OSes. version 2.0 -- July 19, 2009 * Added the RSA algorithm; RabbitSign now allows signing and validating OS upgrades and 68k applications. (You still need, of course, to obtain a valid signing key somehow.) * RabbitSign now checks that no app page begins with FFh. (App pages that begin with FFh will cause problems when defragmenting.) * Added the -P option, which allows you to sign apps that come very close to filling the last page. (This means adding an extra page to hold the signature. It's still not a good idea most of the time.) * Added the -f option, which forces apps to be signed even if they contain problematic data or headers. * The 0104 public and private keys, along with various other known public keys, are now included in the RabbitSign library; key files are no longer required (you can still use your own key files, if necessary.) * Improved performance a little bit when using mpz.c. * mpz.c will now work correctly on 64-bit (and larger) systems. * Major API changes to provide various new features, and generally to make RabbitSign easier to integrate into other software. version 1.2 -- July 24, 2007 * Avoid setting app length to 55 modulo 64. (Such apps do not validate correctly on the TI-73 or 83+ BE, due to a bug in the boot code.) version 1.1 -- May 31, 2007 * OMIT_FINAL_NEWLINE and PAD_OUTPUT are now default, to work around bugs in tifiles2 and TI-Connect respectively. * Padding added won't span a page boundary. * Corrected the warning message when re-signing a too-long app. * Just in case it wasn't fast enough, it now uses mpz_gcdext(). Try it with Niels Möller's subquadratic GCD code... * Just in case it was too fast, a set of simple, slow arithmetic routines is included for people too lazy to get GMP. * Unless suppressed with -q, warnings result in an exit status of 1. * Test code now compiles on old and/or dumb systems that provide rand() and not random(). version 1.0 -- February 3, 2006 * First public release. Legal stuff ----------- RabbitSign is copyright (C) 2004-2009 Benjamin Moody. This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 3 or later. There is no warranty of any kind. See the included 'COPYING' for details. The MD5 calculating code (md5.c and md5.h) comes from GNU md5sum, which was written by Ulrich Drepper and is copyright 1995-96 by the Free Software Foundation. GNU md5sum is part of the GNU Coreutils package; see http://www.gnu.org/software/coreutils/ for more information. Author ------ Benjamin Moody / floppusmaximus@users.sf.net Bug reports, please. rabbitsign-2.1+dmca1/configure0000700000175000017500000061147511232722123014141 0ustar kbkb#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for RabbitSign 2.1. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF 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 : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF 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_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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=: 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 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, 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= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='RabbitSign' PACKAGE_TARNAME='rabbitsign' PACKAGE_VERSION='2.1' PACKAGE_STRING='RabbitSign 2.1' PACKAGE_BUGREPORT='floppusmaximus@users.sf.net' ac_unique_file="src/rabbitsign.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS opt_install_rskeygen opt_build_rskeygen mpzobjs GMP_LIBS GMP_CFLAGS EGREP GREP CPP SET_MAKE RANLIB AR INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_gmp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP GMP_CFLAGS GMP_LIBS' # 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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } 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 RabbitSign 2.1 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/rabbitsign] --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 RabbitSign 2.1:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gmp use the GNU MP library if found Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor GMP_CFLAGS Extra C compiler flags required for GMP (default empty) GMP_LIBS Extra libraries required for GMP (default -lgmp) 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 . _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 RabbitSign configure 2.1 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 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 RabbitSign $as_me 2.1, which was generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$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 ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX 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:$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= ;; #( *) $as_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 cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX 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 cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX 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 cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX 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'; { (exit 1); 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 # 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 # 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 ac_site_file1=$CONFIG_SITE 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 -r "$ac_site_file"; then { $as_echo "$as_me:$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" 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. if test -f "$cache_file"; then { $as_echo "$as_me:$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:$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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$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. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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_config_headers="$ac_config_headers config.h" # Checks for programs. 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:$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$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:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$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:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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 { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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" 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac 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_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:$LINENO: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -W -Wall -Wwrite-strings" fi # Checks for header files. 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:$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 to if __STDC__ is defined, since # 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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:$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 to if __STDC__ is defined, since # 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } 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:$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #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 rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : 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 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF 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` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in limits.h sys/time.h assert.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to floppusmaximus@users.sf.net ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-gmp was given. if test "${with_gmp+set}" = set; then withval=$with_gmp; check_gmp=$withval else check_gmp=yes fi if test "x$check_gmp" = "xyes" ; then save_cflags="$CFLAGS" CFLAGS="$CFLAGS $GMP_CFLAGS" if test "${ac_cv_header_gmp_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for gmp.h" >&5 $as_echo_n "checking for gmp.h... " >&6; } if test "${ac_cv_header_gmp_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_h" >&5 $as_echo "$ac_cv_header_gmp_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking gmp.h usability" >&5 $as_echo_n "checking gmp.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking gmp.h presence" >&5 $as_echo_n "checking gmp.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: gmp.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: gmp.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: gmp.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: gmp.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: gmp.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: gmp.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: gmp.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gmp.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: gmp.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to floppusmaximus@users.sf.net ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for gmp.h" >&5 $as_echo_n "checking for gmp.h... " >&6; } if test "${ac_cv_header_gmp_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_gmp_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_h" >&5 $as_echo "$ac_cv_header_gmp_h" >&6; } fi if test "x$ac_cv_header_gmp_h" = x""yes; then have_gmp=yes else have_gmp=no fi CFLAGS="$save_cflags" else have_gmp=no fi if test "x$have_gmp" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_GMP_H 1 _ACEOF if test "x$GMP_LIBS" = "x" ; then GMP_LIBS="-lgmp" fi mpzobjs="" opt_build_rskeygen=rskeygen$EXEEXT opt_install_rskeygen=install-rskeygen else mpzobjs=mpz.$OBJEXT # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if test "${ac_cv_sizeof_short+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_short=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (short)); } static unsigned long int ulongval () { return (long int) (sizeof (short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (short))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (short)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (short)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_short=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if test "${ac_cv_sizeof_int+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (int)); } static unsigned long int ulongval () { return (long int) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (int))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if test "${ac_cv_sizeof_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (long)); } static unsigned long int ulongval () { return (long int) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF fi cat >>confdefs.h <<\_ACEOF #define USE_MPZ_GCDEXT 1 _ACEOF # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:$LINENO: checking for function prototypes" >&5 $as_echo_n "checking for function prototypes... " >&6; } if test "$ac_cv_prog_cc_c89" != no; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define PROTOTYPES 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define __PROTOTYPES 1 _ACEOF else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Check for potential -arch flags. It is not universal unless # there are some -arch flags. Note that *ppc* also matches # ppc64. This check is also rather less than ideal. case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; esac else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to _BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then # Try to guess by grepping values from an object file. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no 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 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; #( no) ;; #( universal) cat >>confdefs.h <<\_ACEOF #define AC_APPLE_UNIVERSAL_BUILD 1 _ACEOF ;; #( *) { { $as_echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 $as_echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi { $as_echo "$as_me:$LINENO: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_size_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (size_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((size_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if test "${ac_cv_struct_tm+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi # Checks for library functions. for ac_func in strcasecmp stricmp strrchr rindex strchr index memcpy random rand do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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 eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile man/Makefile src/Makefile test/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:$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= ;; #( *) $as_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:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$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}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= 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. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$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:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_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} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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=: 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 # 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 RabbitSign $as_me 2.1, which was generated by GNU Autoconf 2.63. 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 case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, 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 --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ RabbitSign config.status 2.1 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 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' INSTALL='$INSTALL' 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=$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 ;; --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"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --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_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$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 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; 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 test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers 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 '{ (exit 1); 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_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # 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=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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 ' >$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_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " 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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$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:$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_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; 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" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } 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 # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _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:$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 s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } 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:$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_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # 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 || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi rabbitsign-2.1+dmca1/COPYING0000600000175000017500000010437410641206144013265 0ustar kbkb GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . rabbitsign-2.1+dmca1/man/0000700000175000017500000000000011232723713012775 5ustar kbkbrabbitsign-2.1+dmca1/man/packxxk.10000600000175000017500000000345411224737152014543 0ustar kbkb.TH packxxk 1 "July 2009" "RabbitSign 2.0" .SH NAME packxxk \- pack TI graphing calculator software files .SH SYNOPSIS \fBpackxxk\fR [ \fB-t\fR \fItype\fR ] [ \fB-d\fR \fIdate\fR ] [ \fB-o\fR \fIxxkfile\fR ] \fIappfile\fR ... .SH DESCRIPTION \fBpackxxk\fR is a program to generate Flash Application and OS files for the Texas Instruments TI-73, TI-83 Plus, TI-84 Plus, TI-89, and TI-92 Plus graphing calculators. The files generated are in the ``TIFL'' format used by recent versions of TI's GraphLink and TI-Connect software. The input file to \fBpackxxk\fR must be in TI-Hex or TIFL format to begin with, and (in order for the application to be installed) it must have been digitally signed before being packed. \fBpackxxk\fR does not do this, nor does it check for the presence of a signature. You can use \fBrabbitsign\fR(1) to sign applications in several common formats. If multiple input files are specified, \fBpackxxk\fR creates a multi-part TIFL file. .SS OPTIONS .TP \fB-t\fR \fItype\fR Specify the type of program (e.g., `8xk' for a TI-83 Plus application, or `73u' for a TI-73 operating system.) The default behavior is to infer the program type from the name of the input file. (If the input file does not have a recognized suffix, the type is guessed based on the contents of the program header.) .TP \fB-c\fR \fIid\fR Manually specify the calculator device ID (e.g., 0x73 for the TI-83 Plus, or 0x74 for the TI-73.) .TP \fB-d\fR [ \fImonth\fR/\fIday\fR/\fIyear\fR | \fIday\fR-\fImonth\fR-\fIyear\fR ] Manually specify the date stamp for the application. The default is to use the current date in the local time zone. .TP \fB-o\fR \fIxxkfile\fR Specify the output file name (default is to write to standard output.) .SH SEE ALSO \fBrabbitsign\fR(1) .SH AUTHOR Benjamin Moody rabbitsign-2.1+dmca1/man/Makefile.in0000600000175000017500000000174211173765775015072 0ustar kbkbprefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ bindir = @bindir@ datadir = @datadir@ mandir = @mandir@ app_key_dir = ${datadir}/rabbitsign INSTALL = @INSTALL@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ VPATH = @srcdir@ all: rabbitsign.pdf packxxk.pdf rskeygen.pdf rabbitsign.pdf: rabbitsign.1 man -t $(srcdir)/rabbitsign.1 > rabbitsign.ps ps2pdf rabbitsign.ps packxxk.pdf: packxxk.1 man -t $(srcdir)/packxxk.1 > packxxk.ps ps2pdf packxxk.ps rskeygen.pdf: rskeygen.1 man -t $(srcdir)/rskeygen.1 > rskeygen.ps ps2pdf rskeygen.ps install: $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 $(INSTALL) -m 644 $(srcdir)/rabbitsign.1 $(DESTDIR)$(mandir)/man1 $(INSTALL) -m 644 $(srcdir)/packxxk.1 $(DESTDIR)$(mandir)/man1 $(INSTALL) -m 644 $(srcdir)/rskeygen.1 $(DESTDIR)$(mandir)/man1 uninstall: rm -f $(DESTDIR)$(mandir)/man1/rabbitsign.1 rm -f $(DESTDIR)$(mandir)/man1/packxxk.1 rm -f $(DESTDIR)$(mandir)/man1/rskeygen.1 .PHONY: all install uninstall rabbitsign-2.1+dmca1/man/rabbitsign.10000600000175000017500000003241211225017563015210 0ustar kbkb'\" e .TH rabbitsign 1 "July 2009" "RabbitSign 2.0" .if t \{ .EQ delim $$ .EN \} .SH NAME rabbitsign \- sign applications for TI graphing calculators .SH SYNOPSIS \fBrabbitsign\fR [ \fIoptions\fR ] [ \fB-o \fIappfile\fR ] [ \fB-k \fIkeyfile\fR ] \fIhexfile\fR ... \fBrabbitsign\fR [ \fIoptions\fR ] [ \fB-k \fIkeyfile\fR ] \fB-c\fR \fIhexfile\fR ... .SH DESCRIPTION \fBrabbitsign\fR is an implementation of Texas Instruments' Rabin and RSA signing algorithms, as used on the TI-73, TI-83 Plus, TI-84 Plus, TI-89, and TI-92 Plus graphing calculators. These algorithms are used to sign Flash applications and operating systems so that the calculator can recognize them as valid. \fBrabbitsign\fR, like Texas Instruments' official signing programs, needs a private key (a pair of large prime numbers) to sign apps. In order for the app to be accepted, the corresponding public key (their product) must be present on the calculator. As of this writing, the ``shareware'' private key number 0104, used for signing applications for the TI-83 Plus and TI-84 Plus, is available through TI's SDK. Unfortunately, the OS signing keys, as well as the app signing keys for the TI-73, TI-89, and TI-92 Plus, have not been released, which means that only TI can sign apps and OSes for those calculators. .SS OPTIONS .TP \fB-a\fR Attempt to match the output of Peter-Martijn Kuipers' \fBappsign\fR program, for testing purposes. The resulting output file will have Unix-style line termination, and hence will not be compatible with all programs. This option is not recommended for ordinary use. .TP \fB-b\fR Assume input files are raw binary files. If this option is not given, the file type is detected automatically. .TP \fB-c\fR Do not sign apps; instead, check that the signatures of the specified apps are valid. Exit status is 0 if all apps are valid, 1 if one or more apps fail, or 2 if there is a non-mathematical error. .TP \fB-f\fR Ignore non-fatal errors, and force the application to be signed if possible. (All of these messages are there for a reason, though, and chances are that if your app generates any of them, it will also either fail validation or crash the calculator. You have been warned.) .TP \fB-g\fR Write the output file in GraphLink ``TIFL'' format. (By default and for historical reasons, apps and OSes for the TI-73 and TI-83 Plus are written in plain TI Hex format instead; you can use \fBpackxxk\fR(1) to convert these files into TIFL format.) Apps and OSes for the TI-89 and TI-92 Plus are always written in TIFL format. See \fBAPPLICATION FILE FORMATS\fR below for more information. .TP \fB-k\fR \fIkeyfile\fR Read signing and/or validation keys from the given file. This file must be in one of the formats used by TI's SDK tools. (See \fBKEY FILE FORMATS\fR below.) By default, \fBrabbitsign\fR searches for the key named in the app header (for example, 0104.key for ``shareware'' TI-83 Plus apps.) .TP \fB-K\fR \fIid\fR Search for the key with the given \fIid\fR (a small hexadecimal number) rather than the ID specified in the app header. .TP \fB-n\fR Attempt to sign the program as-is, without modifying the header. (This option may not produce a file that the calculator will actually accept; it is intended for testing and special-purpose signatures, not for ordinary app signing.) .TP \fB-o\fR \fIoutfile\fR Specify the output file. By default, output files are named by taking the name of the input file, removing any suffix, and adding a `.app' or `.8xk' suffix depending on whether \fB-g\fR is specified. (If the input file already has a `.app' or `.8xk' suffix, `-signed' is inserted, so `myapp.8xk' becomes `myapp-signed.8xk'.) If `-' is specified as an input file, that indicates the standard input, and the signed result is written by default to the standard output. .TP \fB-p\fR Fix the app pages header. This is not done by default because an incorrect pages header is generally a sign of a much more serious problem. .TP \fB-P\fR If the application ends close to a page boundary, add an additional page to hold the signature. (Application signatures on the TI-73 and TI-83 Plus are not allowed to span a page boundary.) Keep in mind that this is extremely wasteful, as it consumes 16384 bytes of Flash to hold approximately 69 bytes of data; if your application is in this situation, you should consider trying to reduce its size slightly, or alternatively, adding more data to take advantage of the extra Flash page. .TP \fB-q\fR Do not print non-fatal warning messages. .TP \fB-r\fR Re-sign a previously signed app (i.e., discard the previous signature before signing.) .TP \fB-R\fR \fIn\fR For signing TI-73 and TI-83 Plus applications, use root number \fIn\fR .if t ($0 <= n <= 3$) .if !t (0 \(<= \fIn\fR \(<= 3) rather than the default, root number 0. All four roots are valid, though distinct, signatures, so this option is mainly for debugging. Root 0 is computed so as to be congruent to .if t $m sup {left ( {p+1} over 4 right )}$ modulo \fIp\fR and .if t $m sup {left ( {q+1} over 4 right )}$ modulo \fIq\fR. .if !t \fIm\fR^[(\fIp\fR+1)/4] modulo \fIp\fR and .if !t \fIm\fR^[(\fIq\fR+1)/4] modulo \fIq\fR. Root 1 is the negation of root 0 modulo \fIp\fR, root 2 the negation modulo \fIq\fR, and root 3 the negation both modulo \fIp\fR and modulo \fIq\fR. This option has no effect when signing OSes or TI-89/92 Plus applications, which use the RSA algorithm rather than Rabin. .TP \fB-t\fR \fItype\fR Explicitly specify the type of program (e.g., `8xk' for a TI-83 Plus application, or `73u' for a TI-73 operating system.) The default behavior is to infer the program type from the name of the input file. (If the input file does not have a recognized suffix, the type is guessed based on the contents of the program header.) .TP \fB-u\fR Disable automatic page detection, and assume input files are unsorted. This means that page boundaries must be defined explicitly. (See \fBAPPLICATION FILE FORMATS\fR below.) This option has no effect in binary (\fB-b\fR) mode. .TP \fB-v\fR Be verbose; print out the names of apps and their signatures as they are signed. Use \fB-vv\fR for more detailed information about the computation. .TP \fB--help\fR Print out a summary of options. .TP \fB--version\fR Print out version information. .SH APPLICATION FILE FORMATS .SS Intel Hex Intel hex is a standard ASCII file format used by many PROM programmers, and a common assembler output format. Each line (or ``record'') consists of the following: :\fINNAAAATTDDDDDD...CC\fR .TP : The first character of the line is a colon; this is just used to identify the format. .TP \fINN\fR The next two characters are the number of data bytes on this line, written in uppercase ASCII hexadecimal. .TP \fIAAAA\fR The next four digits are the address of the data on this line. \fBrabbitsign\fR only looks at the low 14 bits of this value. .TP \fITT\fR These two digits identify the ``type'' of the record. Intel hex defines several record types for various addressing models; the only types which are meaningful for TI calculators are types 00 (ordinary data) and 01 (end of file.) .TP \fIDD...\fR 2*\fINN\fR hex digits follow, the actual data. .TP \fICC\fR Finally, the inverted checksum is added, so that adding up all the bytes on the line gives a total of zero modulo 256. (As an extension, \fBrabbitsign\fR permits you to use two uppercase `X's in place of a checksum.) .PP Since the address is only 16 bits, this format cannot unambiguously represent applications larger than 64 kilobytes. To enable multi-page applications to be created, \fBrabbitsign\fR attempts to detect page boundaries automatically, starting a new page for each field with a zero address. Thus to create a multi-page app, you can simply concatenate several Intel Hex files, e.g. .IP cat page0.hex page1.hex | rabbitsign - -o complete.app .PP This will only work if the records are correctly sorted within each page. (If the assembler does not generate records in order, you can sort the fields yourself using a command such as `sort -k1.8,1.9 -k1.4,1.7'.) To turn off this automatic page detection, use the \fB-u\fR option. In this case, you must define page boundaries explicitly using the TI Hex format. .SS TI Hex ``TI'' hex is an extension to Intel hex which provides unambiguous representation of multi-page apps. It adds records of the form :0200000200\fINNCC\fR which indicate that subsequent data is placed on relative page number \fINN\fR. (Keep in mind that the TI-83 and 84 Plus install applications ``backwards,'' so if relative page 0 is stored on absolute page 69, relative page 1 will be stored on absolute page 68, and so forth.) Some assemblers can generate multi-page data using type 4 records instead of type 2; \fBrabbitsign\fR treats these as equivalent to type 2. For compatibility with other software which makes certain assumptions about the format, \fBrabbitsign\fR will write 32 bytes per line, and will end lines with a DOS-style carriage return and line feed. .SS GraphLink TIFL The standard (newer) GraphLink format consists of a 78-byte binary header which is added to the start of a hex or binary file. The contents of this header are as follows: .TP 0x00-07 The string `**TIFL**'. .TP 0x08 The major version number (``App ID'') of the application. .TP 0x09 The minor version number (``App Build'') of the application. .TP 0x0A Flags; apparently intended to indicate whether the contents of the file are binary (0) or TI Hex (1). This value is not, however, set consistently by other software. .TP 0x0B ``Object Type'' field; apparently indicates something about the type of data. Set to 0x88 in most TI-73 and TI-83 Plus files; set to 0 in TI-89 and TI-92 Plus files. .TP 0x0C-0F Binary-coded decimal month (one byte), day (one byte), and year (two bytes, big endian) when the app was signed. .TP 0x10 Length of the app's name. .TP 0x11-18 Name of the app. .TP 0x19-2F Reserved, always set to zero. .TP 0x30 Calculator type (0x73 = TI-83 Plus, 0x74 = TI-73, 0x88 = TI-92 Plus, 0x98 = TI-89.) .TP 0x31 Type of data (0x23 = OS upgrade, 0x24 = application, 0x25 = certificate.) .TP 0x32-49 Reserved, always set to zero. .TP 0x4A-4D Little endian length of the following data (the length of the hex file, not the on-calculator size of the application.) .PP There also exist multi-part TIFL files, which simply consist of two or more TIFL files concatentated together. (For instance, a software license agreement or a certificate file can be attached to an application.) \fBrabbitsign\fR handles these files in a limited way: it will read only the first section with a recognized data type, ignoring any other data in the file. \fBrabbitsign\fR cannot create multi-part TIFL files, but they can be created using \fBpackxxk\fR(1) (or simply using \fBcat\fR(1).) .SS Binary \fBrabbitsign\fR can also read binary app files; they are assumed to be contiguous, so when signing a multi-page app, each page except the last must be filled to a full 16k. .SH KEY FILE FORMATS Key files contain the data needed for signing and validating applications. (The portion of the key file used for validating is known as the ``public'' key; the portion used for signing is the ``private'' key. Only the public key is stored on the calculator itself.) Official key files from TI come in two varieties, known as ``Rabin'' and ``RSA'' formats. Note that \fBrabbitsign\fR currently supports using Rabin-type key files to generate RSA signatures, but not the other way around. .SS Rabin key format The Rabin key file format is typically used for TI-73 and TI-83 Plus application signing keys. It consists of three lines, each containing a big integer. The first line is the public key, \fIn\fR; the second and third are its two factors, \fIp\fR and \fIq\fR. Each line begins with two hexadecimal digits, giving the length of the number in bytes, followed by the bytes themselves, written in hexadecimal in little-endian order. .SS RSA key format The RSA key file format is typically used for TI-89 and TI-92 Plus application signing keys. It consists of three lines: the key ID, the public key \fIn\fR, and the signing exponent \fId\fR. (\fId\fR is the inverse of the validation exponent, 17, .if t modulo $phi (n)$, .if !t modulo \(*f(\fIn\fR), and thus calculating \fId\fR is computationally equivalent to factoring \fIn\fR.) The key ID is a short hexadecimal number, which should match the contents of the 811x header field. The numbers \fIn\fR and \fId\fR are written as big integers, as in the Rabin key format. .SH FILES .TP /usr/local/share/rabbitsign/*.key Private key files which will be used if the requested key is not found in the current directory. .SH BUGS Who needs them? \fBrabbitsign\fR accepts keys, applications, and even file names which cause TI's programs to crash or generate invalid signatures. Some apps which come very close to filling the last page may not be usable with TI-Connect. This is a bug in TI-Connect. Try TiLP. \fBrabbitsign\fR does not always generate the same signature as do TI's programs. This is not a bug; it is simply due to the differences in implementation. There are in fact four valid signatures for every application hash; all four are accepted by the calculator. If you encounter a valid app which \fBrabbitsign\fR is unable to sign, or worse, generates an invalid signature, this is a serious bug, and I would like to know about it. .SH SEE ALSO \fBpackxxk\fR(1), \fBrskeygen\fR(1) .SH AUTHOR Benjamin Moody rabbitsign-2.1+dmca1/man/rskeygen.10000600000175000017500000000431711224737171014721 0ustar kbkb.TH rskeygen 1 "July 2009" "RabbitSign 2.0" .SH NAME rskeygen \- generate private key pairs for TI graphing calculators .SH SYNOPSIS \fBrskeygen\fR [ \fB--secure\fR ] [ \fB--ti\fR ] [ \fB--length\fR \fInbytes\fR ] .SH DESCRIPTION \fBrskeygen\fR generates application and OS signing keys for the Texas Instruments TI-73, TI-83 Plus, TI-84 Plus, TI-89, and TI-92 Plus graphing calculators. These keys consist of two prime numbers \fIp\fR and \fIq\fR as well as their product \fIn\fR. Current calculator models impose a limit of 512 bits (64 bytes) on the size of \fIn\fR, so \fIp\fR and \fIq\fR are generally about 256 bits each. As of this writing this means factoring \fIn\fR is beyond the reach of most people, though this will undoubtedly change in the future. The keys generated by \fBrskeygen\fR are not very useful at the moment, because in order for an application or OS to be accepted by the calculator, the key used to sign it must itself be signed using the calculator's own (possibly unique) private key, which is only known to TI. Nevertheless, \fBrskeygen\fR is provided in the hope that it can be useful, both for testing and for devising new signature schemes based on TI's. .SS OPTIONS .TP \fB--secure\fR Attempt to generate a ``secure'' key using the system's entropy pool, /dev/random (see \fBrandom\fR(4).) The actual security is thus dependent on your system's implementation of /dev/random. Without \fB--secure\fR, the keys are generated based on the current time and process ID, which is not secure in the slightest. .TP \fB--ti\fR Generate keys which are palatable to TI's official app signing programs. This forces \fIp\fR to be congruent to 3 and \fIq\fR to 7 modulo 8. This option is not necessary when using \fBrabbitsign\fR(1), nor is it necessary for the calculator to validate signatures properly. .TP \fB--length\fR \fInbytes\fR Specify the length in bytes of the modulus \fIn\fR; \fIp\fR and \fIq\fR are each calculated to be approximately half this length. This should not be greater than 64 for current calculators, and must be less than 256 in any event due to a limitation of the key file format. .SH SEE ALSO \fBrabbitsign\fR(1), \fBpackxxk\fR(1) .SH AUTHOR Benjamin Moody rabbitsign-2.1+dmca1/man/rskeygen.pdf0000600000175000017500000001231511224737202015322 0ustar kbkb%PDF-1.4 %쏢 5 0 obj <> stream xX۸?O1#RZYfҌY`e%Gf}Q=$EIgt M^^{ι)#W?d|=>]1?fE`9 ÕרկWK *b2X\y)IET$dtdే[Q_ z)y?7${oT2K t4T$;"ڢHVmQŮA/f r^2TmG8~B^ՙ b3En*6AVqp$y_v.i+\pR$qezm_Sn < XTpoJQxpks​x&*YTRRWP-}rFty=9qIm$UwXKaBisTj3bm͊<ɲ4>1̀Z'(Hbvv\$h;Unr}OC" ]#4C"X#)Ca"¿u<=xșa-q$͙ GK>^Pa Y~y@AyD>`А!kd_DuݵK{0VF $)ZM*T+ӠА#Xe̯ ijUѮioj-R?fvRw}zQ6unY vmHjR hbō55e>xL}Zf+U x."E9w^D/=O[[-y\isO6')JƇZ5gFn61BVf~P;HhcNhْ e]0?N\l]`  8c 8\AvuYnc,Wg~sQ\rir{q2**\y EX]U|$dg%&]?4hitLfFiZT`Ͼz5 E{nS;yVGBeoR*u=osѡ~ ,";X9Ò3} T : K AP-FB#mUg ,hXXa|/h֙F.(y (GlØ[[=J54v8{7m+Vg}g26|LL>PE=n4%C]C3DNId U'όQcAi8jR Ѐ#\O~,Skk PD()gYIQ?Y¥AygM>/ 9?w!Zzdx@СvYILFnQVLkԧX]NAP oq w@yգ[,M@\Wć>1^.Xb*8eݞ8,>e0LiJ3(Nb| N\(jάgӛD]@HhSf~U=$7]''Ĩ''|g5U&z92fZD{G;ȅ,sӔFG=^E9f(ٺ:7vlnF7uRT@#3 /f2aþ+̣I.糔Hty}QUdl7׎!#THcl3I@.{DQk^`i0i+k3ddW]ˏL(MdZ§l3.`Pw&[{z<@$7 EIVaq}haq0+7`2VVmCeeѐTLMyZD}m(3'=k~|l}}K̋vqMFcMf`0!7Da>0-^QN\D/NgAO3l\YwGsqGY/z 'ecX& ܋)V#$VjDÈё_ >昆~3ݡ٢푮fnrԬE;)/Vզ3J?2 ű*Pr~;SHA~8y} _GvU?8'}(G{ o6}/. DFVfPޜU:dlFQTmi%?YQQI8605rDNŒBkh羟X W6<]]Zwendstream endobj 6 0 obj 2494 endobj 4 0 obj <> /Contents 5 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 7 0 obj <>endobj 11 0 obj <> endobj 12 0 obj <> endobj 10 0 obj <> endobj 9 0 obj <> endobj 8 0 obj <> endobj 13 0 obj <> endobj 14 0 obj <>stream 2009-07-07T17:30:42-04:00 2009-07-07T17:30:42-04:00 groff version 1.18.1 Untitled endstream endobj 2 0 obj <>endobj xref 0 15 0000000000 65535 f 0000002818 00000 n 0000004702 00000 n 0000002759 00000 n 0000002599 00000 n 0000000015 00000 n 0000002579 00000 n 0000002883 00000 n 0000003137 00000 n 0000003072 00000 n 0000003004 00000 n 0000002924 00000 n 0000002954 00000 n 0000003219 00000 n 0000003288 00000 n trailer << /Size 15 /Root 1 0 R /Info 2 0 R /ID [<7770A33028E5AE314DFDD38FF2CFFF30><7770A33028E5AE314DFDD38FF2CFFF30>] >> startxref 4872 %%EOF rabbitsign-2.1+dmca1/man/packxxk.pdf0000600000175000017500000001111111224737201015134 0ustar kbkb%PDF-1.4 %쏢 5 0 obj <> stream xWn8}W-"bE,i"mph[u.]'t?eq(NfAļ̙3g_ Og>Z  PgeEslbv('F S4c}$DQ p]qlb|<J\6TS ;LBŲ%.Y􏴉ZU\ les?qm6]`ob&`BGš' C,1TDĤ[ز{W=1:GG}}:u1?%NdOkPY 5ZW*za&Y9byh lE] ?B(*MA19ڌM 7}X|&v_.zP?mZs{x,=_C*~j-u-Hy1 ZO(4!^Rx:Ym@W#A tUduwm ^Pc MAbdԨXBGR:gSvkCYk/ Yj^yf4o r mqh@Kmt}6z>]ZOO`fmݠ 9x+iO'tCRrFIe #8  Rp _H}c&fHsiEg4{Ɉ<zG ȚU`Ts5G7C/S[`Pxz\&h 1rpendstream endobj 6 0 obj 1758 endobj 4 0 obj <> /Contents 5 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 7 0 obj <>endobj 11 0 obj <> endobj 12 0 obj <> endobj 10 0 obj <> endobj 13 0 obj <> endobj 9 0 obj <> endobj 8 0 obj <> endobj 14 0 obj <> endobj 15 0 obj <>stream 2009-07-07T17:30:41-04:00 2009-07-07T17:30:41-04:00 groff version 1.18.1 Untitled endstream endobj 2 0 obj <>endobj xref 0 16 0000000000 65535 f 0000002082 00000 n 0000004038 00000 n 0000002023 00000 n 0000001863 00000 n 0000000015 00000 n 0000001843 00000 n 0000002147 00000 n 0000002473 00000 n 0000002408 00000 n 0000002268 00000 n 0000002188 00000 n 0000002218 00000 n 0000002352 00000 n 0000002555 00000 n 0000002624 00000 n trailer << /Size 16 /Root 1 0 R /Info 2 0 R /ID [] >> startxref 4208 %%EOF rabbitsign-2.1+dmca1/man/rabbitsign.pdf0000600000175000017500000004431011230230436015611 0ustar kbkb%PDF-1.4 %쏢 5 0 obj <> stream xZnF律_NtI㬭bQLK#5E$[ y}\x\cbVsw;\[v2\SXBf nPt>;"nl:q~zGj ͹_Lv"_fm^ [W5[\:m-b/-{܏ ;"p/.?__\:BWϸg.65\k-{M|K̷NiJgjY!>'_w wȼp7_1 y"1OWOWrORk܃$%nV&K]|A<2r\p.G2r6k7M1_>!&Ps޾ӟ/$2{niP, eЀUkU!^ঝ_SptKԬae{ٜ.+vu}Ї0&+:o7}#W  w:|&D<πVg}?険 S~}ؔ}pM%d#9Аe ^/䞯3&NV+DצǓ_&>Z6ϊA8=63sU_ñ GN2wK_ "OMSZ+ηe] )\M̢n./ .N+Xitȅ-U8ru vyWd1,M?p% 0čtB?Ywn@ ڪk9 O f֔4r)w\dZ6\)8MG[}13s0aY헭-~)2ŀLѾAٔ P'u{͗!H-6+Y22EF_nIbOmm6(a#cMh+ajy:ݷc\@ <;oxf6~e1 }{ĆD%Cg: s?bD\ðe]AWW $? R0Zssݛ+(Kqh~.n/V)[eMK½HrDwa AӽN<EG7GYVqGMH0 1t$:d{Y0HaƁı=#A,=yb2Bf &_nVfe[cUL'vT6 F>C&DRq(5{3DЏz#-z%f-$Vvo ?V֊Qm[>(hdulc #=V*FE{AigȦ՘_틹Q񠴓XX t=iPuLHH$r-e4oyʖ6/ri,Umw8pW*bńl=E@ =FyAD"Nm4V嗀B@8Rv~w<3i@bX^iXggu}=F!lWJ tF=3>s#[_q!u(uK`$+$eAf >z@ƾ/KЕJ pCϑHTq7;̿ JkuȮSP>@DF:@hepbH(d^Vy7TJ _Vrdٶ>%`gs0Vr߂k3Yh!/L^9y4*_ܗ ]fѕXJۀl7OCm KCq o=9t[4ٽlW#ș)T6k*MЎWվV=^4eץ1^BӤC5)t=C$@aZ KYјȧ@$sYۧ14N/]K7`e8aDOd7-%QÞ0ʒ=*UkS0_XvD?1/4vq1(A";A :=e&kpѠQ8.7a%J!&6|ghU:2P `=,<ƄP[yE] 7W$/⦖;O#QdKBG$@+N:˖OOӘa*z]V(`$^i7_5:c^BECC>jtBNuYqwcEb4oř 3S{-'~qNjn!i=';'u2EY\OGnN6ydMYڒ5wC[ Кrq/^zo޾8WH~cXUه)BĻAH/CShr=J| q8z#h#BU%Mi= 4% RR M}t .$ɐ|wgh?VĴ=)1a޷PUg t y<ьxN2ug ^hao܍fKr{NCrikj[^ppsoy,lxBF$்8eH7 5K5f3fpQCGD{w‹4HKj+ri$?J{¨Ccoܱl4l4F !sLg["gĨCcty5zl m`Ad]Iлߤkendstream endobj 6 0 obj 3470 endobj 14 0 obj <> stream xYɖ+k0i>cU[$ŬsG6 CE-'_enM8ȃ8 Uu֭'a?Z|u[nXŧ+_Ye}C }.:׊=+k]-cnbv7]}gwKrV~dÂTZWVYAdg[xmaϥ=>/2ދoy. W8lъn({-^tY`']^„6{lZ,miO~NNʒtΐ෍LC[=^+y֔%.>@RuĈ7b%؊rrO4XDgLK+/ ْ/@[Ilo]kGKi4 R/_ T' _C,A3'0aͼih&3)1]J̑`xʮf\'|.,vsO_`Gi)bmx'sP"qml3Aھ?>zr >ܕM__%_4Ů9%Pz?t_k8u{Pfip;s_4$DAEh῞=BHőa/jhwHR*_Kja_$@npʣ4MQ3vgRbxYyVsLoEOR'yQZNf O YQtI~LQXA\b"y #q!B|pDEq4)T=_zRG?<Uґb4@mJWFLb0lH9Ɩ#4ǧjGE-Dp/Љ*#[[d  a؟/@d@Kg6vӉ'X!h:9OjD(oo> "SC\.JlQ{=ySIǡbLFT;P;UԤ |G(mi&R[d xΞ |x&,CWpʠlp}'on~'cX8:nbH0R,vdJ %ll1]vu& ^d$ (E'p n[㺕dVtCjrJ&-ʖocq5Ei:JЏ\"$ؙAng8QÐĉcךb`j=GS0hu TbiB@1*}i[l|/!Kq@iv6vvн٠ T(4VCi%Pȿ4vg)?\dOCWxRݩxMJmh`sc"wXUA$Qe}RV0i^Z"'nJ{ 3wbwG뎘Ü>B7 F*S! W Bh)hj ;MAY ~áʢ`!88\c'R Km^y*i}}{4HrHN}?K_Yc_l6ᢟ[Tl[$u}i7lW*l2ԤrTz8֝J7|}dK?׭M8社OX5Zғq3'spNFe8@[f>*|&cƇס3SφɊrDj2g;"i$bGc&cy+R(# sCOHѣa]8B-O1=4+W] ӑ4:cN_ƉSdsOU08w>[$kzН-} Z@A#5Z\9(>ғ1̮Y^+Lܱy/I"'t)龺U)}|,s۵(P@ѨnOA:ӓzǕ2]d&q|P8nk[rQvK%%t(ǃۡGP1.W8\?ohsSp\jK8 Ʌ~#@?qe+7 wn!%dЏ7~^7yendstream endobj 15 0 obj 3318 endobj 20 0 obj <> stream xXr}W*`2,+rCTq ^D2OG\IŢHbf{{O=3%~7%cF}F ؟٫-6>'Y,|!9>ʾ+] V7X™Rp~9*Z9|D&<ܭ4I?vÙS>Yװzl084=cMmZcp!rx02eE:EnFxF1 xk6aa&ABw8J۟0uݕMy)|^ .S_ +)scdJa$}/= :G{E2.CY sf3CWx_E/6q Ѡ\/|CڎWj]`]!98P"r,>n~gvqE|(k [M]=3Š";T0۫nz6+C3t 5PxT^H[*ծd΅[if'xwQ~,,BK,QKMj4;U_n.ꨗ!;V+\+? H}U7W>ԝBX "7 B fCGJ%/o1~n= nz96aL/ 9ؙ6lvbjP+v#7VL P f,|K2H&Ÿ) f粮B8 v''0N*f3q/M<.FO[;yK•%qvY~ҭ eć/:Ȇܕ N 'ټߒ'}0z8]ɇӒ$[0\X4 `ҩU#2B11EEhs; XKndx9q\JY$TP3ۨ$p}|r4L!޶!%yRt#4/0yID('s=u[\&)@rmW N>PkBS6j‰-qi*}R%:2 U1\n Ū;^Mh 74%9>!H4=zs}&b3b`o+nG=GM؟,'*@L4A,&S02x1~'iQHj:|Za˂uQ8)y26^M"8ZDC;Eh*M2K\ɘ:APޑaZywfm *WaH+@|͌5T/)-$;Lz;#^vUkXY&%z,i%|ioY.ᜰShQ-C,v;C= p=|R3AZRRaEqB iɬH$0!z@dWk!ٻ*g7pE^95sVTcy2g'9^Bi"ubJAcU=`؋fB6BC m D,k., @5~:æ1XUۖV)=h}gQl?޼[rbDQr`wlR S'u{b ]oH,Ё1֪}*.}6˾-$=fۇol<50AW4ŗse;ka w!L\$)'2N;K`t0@'!6"30\.-/npDXIE~Øi%c*,Q`ٺJ`ʯHy2Q ˅}}.uL&QQuuY[)IG^g|lv󫡬mv1r{R\ޑ"PSC]Vbǎ K_I A~<_D>YO2s[9 v1n >T5h2Lkvjyr}-hՍ$܋+5ҷ= yAP!' S},I#Wr&,-ϻgLw-7ZaZh1@*C9ٖ %[ f] z׏3E1*۫M8'5MSgQT tYd(?s -~3n^(?lě%9!+;!h< ^Pjs=_}B֊&q诹Tnv[p8Fyj?; H_c !gRBK_gV;]{3Olεqv~ۄ zy;N-VBl> stream xY[s~ׯ7CqMIcw8qj#w A@Kow ˹~9Y ^nel_^}zV{rz\}eˤdUF\lpt}5ն忱-\_ ">b_vÆ]ɊÁӚ^mV|]˵HxfqPoXQ_kՂt^!A<tBH/IFũg}9e]kP)$Vx)D-ooE:v:}8p:g1+[^1>7 y_T((WXrn(tERX̥ !`u1ZyۮXtWDu*mVe7T_tB T_@ Bt\< 32]deev.6m]בJEYP5[g-z;_+1”dsYYJѫ!2事j iJIYW̲2{Xjy{<OT"|fh)~|YL:?Bg(cI{Y|k<{(-(q4鐼Rh|C) aPLCIddb&m3TcKveHD>.( tJd7SW~]hƏ{ r"ĭEȬ\%ڲΪw//^~z]D#HG4~~)i#l2z(lkr 7:y5 4"um=^$Q9m'_h42=&mPlQ?Dr,B Q#@$U>5-={@idX"R=zk Xy1^|:&eyU.a80-N GJP9qPiE6)p}\*& 25osAM!yiv[v`d $p&uTE_T/TdE4]ۏt0I Btg(fB35:ȱQdwk<@R,\صOCYVO h@h;5qxFDv3tokm ИpI8 kI `ף/?<_)+&N3il9%fV bܸb8kF's8xhgx7 kSz箷 :|z:Ƽ`_5x:ǗrT]G0T=ۍ5˳@熉nRhG2!LIj=#d9b C'"QHS/363 ф>\XvB.Oi*DetRQ׾?mHT?i o4%1eb:a>:Cƞh<M_fIM3^e;k'M U۞&:}(ή v(5+d| ~t0VN s;2]{ `t72 ]6B҈`[wuTwPv/|xxGc! (h䘁I('h:1̌/tg>{3c P4V>(E?y+K2fe~dBuJuJWقjp{8"2IP!?SHORendstream endobj 26 0 obj 3017 endobj 30 0 obj <> stream xV]o6}o)Ra[3] {H@˴F(%.IIҢms9H!$Bj㭄Y?u `+pQbȶ d 9ZD1#4ij.:S٧ X2Œ$jCv>,/^iQf[O  C+Z덁n_t㒆kO05wlHx,]ix;c$ Kt .KPCY+7gNñHjOY2C#"/5ԪE\FCv}1ݎp*EI"Dz;z6VUHhyv֭|]< s}I%tޣ:cz"[mEY`v}pT:k?.mB=B^6HBRERjRGzHS푱oM]#p>%MĚ V89%B M;3JCzV39$IH"YeLcv?5Aq璢!2z*A"?0cy25toL{- nm}Rh&8) $8(dؘ;Ә&oVDrkX~2,]$᜞Z? aRr謬q"Ah&! c/靻l/bdz[:GPm[GWJ0FdJ@\E!3lE'3N҄^n1<)PHSO<`O@&c63="(=( ':Uv)`H)I[86= M_wK`g$0"%)k[Ed~!OVy%H0nQ,ҦؓߴF_NqF[`T Gl^L7'hz3Ph@ov)@Y<8TC PI4q;^hc/h2h:ޜf(R|cZ9i]7=ٝz IH޽yoN7(a>s YL#B(6^

> /Contents 5 0 R >> endobj 13 0 obj <> /Contents 14 0 R >> endobj 19 0 obj <> /Contents 20 0 R >> endobj 24 0 obj <> /Contents 25 0 R >> endobj 29 0 obj <> /Contents 30 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 13 0 R 19 0 R 24 0 R 29 0 R ] /Count 5 >> endobj 1 0 obj <> endobj 7 0 obj <>endobj 11 0 obj <> endobj 12 0 obj <> endobj 17 0 obj <> endobj 18 0 obj <> endobj 22 0 obj <> endobj 23 0 obj <> endobj 27 0 obj <> endobj 28 0 obj <> endobj 32 0 obj <> endobj 33 0 obj <> endobj 8 0 obj <> endobj 34 0 obj <> endobj 16 0 obj <> endobj 10 0 obj <> endobj 35 0 obj <> endobj 9 0 obj <> endobj 36 0 obj <>stream 2009-07-17T22:19:10-04:00 2009-07-17T22:19:10-04:00 groff version 1.18.1 Untitled endstream endobj 2 0 obj <>endobj xref 0 37 0000000000 65535 f 0000015219 00000 n 0000017568 00000 n 0000015132 00000 n 0000014324 00000 n 0000000015 00000 n 0000003555 00000 n 0000015284 00000 n 0000015736 00000 n 0000016089 00000 n 0000015949 00000 n 0000015325 00000 n 0000015355 00000 n 0000014484 00000 n 0000003575 00000 n 0000006965 00000 n 0000015887 00000 n 0000015405 00000 n 0000015435 00000 n 0000014646 00000 n 0000006986 00000 n 0000009914 00000 n 0000015496 00000 n 0000015526 00000 n 0000014808 00000 n 0000009935 00000 n 0000013024 00000 n 0000015576 00000 n 0000015606 00000 n 0000014970 00000 n 0000013045 00000 n 0000014303 00000 n 0000015667 00000 n 0000015697 00000 n 0000015818 00000 n 0000016033 00000 n 0000016154 00000 n trailer << /Size 37 /Root 1 0 R /Info 2 0 R /ID [<218D7BB5909A511A8CBD7AA09A51C115><218D7BB5909A511A8CBD7AA09A51C115>] >> startxref 17738 %%EOF