Index: keynote-2.3/configure.in
===================================================================
--- keynote-2.3.orig/configure.in	2007-06-04 13:22:41.284579072 +0200
+++ keynote-2.3/configure.in	2007-06-04 13:22:41.389563112 +0200
@@ -21,19 +21,13 @@
 AC_PATH_PROG(ECHO, echo, /bin/echo)
 AC_PATH_PROG(SED, sed, /usr/bin/sed)
 
-dnl Checks for libraries.
-LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\
- -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib"
-
 AC_CHECK_LIB(m, floor, LIBS="$LIBS -lm")
 AC_CHECK_LIB(rsaref, RSAPrivateDecrypt, LIBS="$LIBS -lrsaref")
 AC_CHECK_LIB(crypto, i2a_ASN1_STRING, LIBS="$LIBS -lcrypto")
 AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue")
 
 dnl Checks for header files.
-CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\
- -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\
- -I/usr/local/openssl/include -I/pkg/include"
+CPPFLAGS="-I/usr/include/openssl"
 
 AC_HEADER_STDC
 AC_HEADER_TIME
Index: keynote-2.3/keynote-keygen.c
===================================================================
--- keynote-2.3.orig/keynote-keygen.c	2007-06-04 13:22:41.290578160 +0200
+++ keynote-2.3/keynote-keygen.c	2007-06-04 13:22:41.389563112 +0200
@@ -161,7 +161,7 @@
     if (strlen(algname) + 2 > prlen)
     {
 	fprintf(stderr, "Parameter ``print-length'' should be larger "
-		"than the length of AlgorithmName (%d)\n", strlen(algname));
+		"than the length of AlgorithmName (%lu)\n", strlen(algname));
 	exit(-1);
     }
 
Index: keynote-2.3/keynote.l
===================================================================
--- keynote-2.3.orig/keynote.l	2007-06-04 13:22:41.295577400 +0200
+++ keynote-2.3/keynote.l	2007-06-04 13:22:41.390562960 +0200
@@ -61,7 +61,8 @@
 static struct lex_list *keynote_lex_list = (struct lex_list *) NULL;
 static int    keynote_max_lex_list = 32;
 static int    keynote_lex_counter = 0;
-static int    first_tok = 0;
+extern int    first_tok;
+int    first_tok = 0;
 %}
 digit		[0-9]
 specnumber      [1-9][0-9]*
@@ -766,7 +767,7 @@
     if (0)
     {
 	yyunput(0, NULL);
-	yy_flex_realloc(0, NULL);
+	yy_flex_realloc(NULL, 0);
     }
 
     return en;
Index: keynote-2.3/keynote-ver.l
===================================================================
--- keynote-2.3.orig/keynote-ver.l	2007-06-04 13:22:41.301576488 +0200
+++ keynote-2.3/keynote-ver.l	2007-06-04 13:22:41.390562960 +0200
@@ -267,7 +267,7 @@
     if (0)
     {
 	yyunput(0, NULL);
-	yy_flex_realloc(0, NULL);
+	yy_flex_realloc(NULL, 0);
     }
 }
 
Index: keynote-2.3/keynote-ver.y
===================================================================
--- keynote-2.3.orig/keynote-ver.y	2007-06-04 13:22:41.306575728 +0200
+++ keynote-2.3/keynote-ver.y	2007-06-04 13:22:41.390562960 +0200
@@ -49,7 +49,7 @@
 				 return keynote_errno;
                                free($1);
                              }
-
+		;
 expr: VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0);
 
                                if (i != 0)
@@ -64,6 +64,7 @@
 			       free($1);
 			       free($3);
                              } expr 
+		;
 %%
 void
 kverror(char *s)
Index: keynote-2.3/keynote.y
===================================================================
--- keynote-2.3.orig/keynote.y	2007-06-04 13:22:41.311574968 +0200
+++ keynote-2.3/keynote.y	2007-06-04 13:22:41.391562808 +0200
@@ -73,8 +73,7 @@
 %}
 %%
 
-grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; }
-                localinit
+grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } localinit
              | ACTSTR { keynote_exceptionflag = keynote_donteval = 0; } program
    	     | KEYPRE { keynote_exceptionflag = keynote_donteval = 0; }
                 keypredicate
@@ -91,17 +90,17 @@
                         STRING { keynote_lex_remove($3);
 			         keynote_privkey = $3;
 			       }
-    
+    		;
 keypredicate: /* Nothing */   { keynote_returnvalue = 0;
                                 return 0; 
                               }
        | notemptykeypredicate { keynote_returnvalue = $1;
 				return 0;
                               }
-
+		;
 notemptykeypredicate:  key     { $$ = $1; }
        		     | keyexp  { $$ = $1; }
-
+		;
 keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord)
                                      keynote_donteval = 1;
                                  } notemptykeypredicate 
@@ -138,7 +137,7 @@
 			    else
 			      $$ = 0;
 			  }  /* K-th */
-
+			;
 keylist: key
 	    { /* Don't do anything if we're just recording */ 
               if (!keynote_justrecord && !keynote_donteval)
@@ -155,7 +154,7 @@
 
 	      keylistcount++;
             }
-
+		;
 key: str        {
 		   if (keynote_donteval)
 		     $$ = 0;
@@ -193,10 +192,10 @@
 			 }
 		   }
                  }
-
+		;
 localinit: /* Nothing */
          | localconstants
-
+		;
 localconstants: VARIABLE EQQ STRING 
 	  {
             int i;
@@ -265,12 +264,12 @@
 	    if (i != RESULT_TRUE)
 	      return -1;
 	  } localconstants
-
+		;
 program: prog { 
 	        keynote_returnvalue = $1;
 		return 0;
 	      }
-
+		;
 prog:   /* Nada */ { $$ = 0; }
        | notemptyprog {
 			  /* 
@@ -285,7 +284,7 @@
 		      else
 			$$ = $4;
                     } 
-
+		;
 notemptyprog: expr HINT afterhint
               {
 		if (checkexception($1))
@@ -300,7 +299,7 @@
 		else
 		  $$ = 0;
 	      }
-
+		;
 afterhint: str {  if (keynote_exceptionflag || keynote_donteval)
 		    $$ = 0;
 		  else
@@ -315,7 +314,7 @@
 		  }
                 }
          | OPENBLOCK prog CLOSEBLOCK { $$ = $2; }
-
+		;
 
 expr:     OPENPAREN expr CLOSEPAREN 	{ $$ = $2; }
 	| expr AND { if ($1 == 0)
@@ -334,19 +333,19 @@
 	| stringexp 			{ $$ = $1; }
         | TRUE	  		        { $$ = 1; }
         | FALSE	  		        { $$ = 0; }
-
+		;
 numexp:	  numex LT numex { $$ = $1 < $3; }
 	| numex GT numex { $$ = $1 > $3; }
 	| numex EQ numex { $$ = $1 == $3; }
 	| numex LE numex { $$ = $1 <= $3; }
 	| numex GE numex { $$ = $1 >= $3; }
 	| numex NE numex { $$ = $1 != $3; }
-
+		;
 floatexp: floatex LT floatex { $$ = $1 < $3; }
 	| floatex GT floatex { $$ = $1 > $3; }
 	| floatex LE floatex { $$ = $1 <= $3; }
 	| floatex GE floatex { $$ = $1 >= $3; }
-
+		;
 numex:	  numex PLUS numex  { $$ = $1 + $3; }
 	| numex MINUS numex { $$ = $1 - $3; }
 	| numex MULT numex  { $$ = $1 * $3; }
@@ -384,7 +383,7 @@
 					      free($2);
 					  }
 					}
-
+		;
 floatex:  floatex PLUS floatex  	{ $$ = ($1 + $3); }
 	| floatex MINUS floatex 	{ $$ = ($1 - $3); }
 	| floatex MULT floatex          { $$ = ($1 * $3); }
@@ -418,7 +417,7 @@
 					      free($2);
 					  }
 	                                }
-
+		;
 stringexp: str EQ str {
                         if (keynote_exceptionflag || keynote_donteval)
 			  $$ = 0;
@@ -529,9 +528,9 @@
 		      if (i == 0)
 		      {
 #if !defined(HAVE_SNPRINTF)
-			  sprintf(grp, "%d", preg.re_nsub);
+			  sprintf(grp, "%d", (int)preg.re_nsub);
 #else /* !HAVE_SNPRINTF */
-			  snprintf(grp, 3, "%d", preg.re_nsub);
+			  snprintf(grp, 3, "%d", (int)preg.re_nsub);
 #endif /* !HAVE_SNPRINTF */
 			  if (keynote_env_add("_0", grp, &keynote_temp_list,
 					      1, 0) != RESULT_TRUE)
@@ -579,7 +578,7 @@
 		  }
 	      }
 	    }
-
+		;
 str: str DOTT str    {  if (keynote_exceptionflag || keynote_donteval)
 			  $$ = (char *) NULL;
 			else
@@ -605,7 +604,7 @@
 			}
 		      }
 	| strnotconcat { $$ = $1; }
-
+		;
 strnotconcat: STRING 	                { $$ = $1; }
         | OPENPAREN str CLOSEPAREN 	{ $$ = $2; }
         | VARIABLE      {  if (keynote_exceptionflag || keynote_donteval)
@@ -660,6 +659,7 @@
 				  return -1;
 			    }
 			 }
+		;
 %%
 
 /*
Index: keynote-2.3/Makefile.in
===================================================================
--- keynote-2.3.orig/Makefile.in	2007-06-04 13:22:41.317574056 +0200
+++ keynote-2.3/Makefile.in	2007-06-04 13:22:41.391562808 +0200
@@ -41,7 +41,8 @@
 YACCFLAGS = -d -p kn -b k
 LEXFLAGS2 = -Pkv -s -i
 LEXFLAGS = -Cr -Pkn -s -i
-CFLAGS = -O2 -Wall # -g
+CFLAGS = -O2 -Wall -fno-strict-aliasing # -g
+LDFLAGS = @LDFLAGS@
 RMFLAGS2 = -rf
 RMFLAGS = -f
 NROFFFLAGS = -mandoc
@@ -83,7 +84,7 @@
 	$(RANLIB) $(TARGET)
 
 $(TARGET2): $(TARGET) $(OBJS2)
-	$(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)
+	$(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LDFLAGS) $(LIBS)
 
 k.tab.c: keynote.y header.h keynote.h assertion.h config.h
 	$(YACC) $(YACCFLAGS) keynote.y
Index: keynote-2.3/signature.c
===================================================================
--- keynote-2.3.orig/signature.c	2007-06-04 13:22:41.323573144 +0200
+++ keynote-2.3/signature.c	2007-06-04 13:22:41.392562656 +0200
@@ -515,7 +515,7 @@
 	kk = dc->dec_key;
 	if (keytype == KEYNOTE_PRIVATE_KEY)
 	{
-	    if (d2i_DSAPrivateKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
+	    if (d2i_DSAPrivateKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
 	    {
 		if (ptr != (unsigned char *) NULL)
 		  free(ptr);
@@ -526,7 +526,7 @@
 	}
 	else
 	{
-	    if (d2i_DSAPublicKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
+	    if (d2i_DSAPublicKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
 	    {
 		if (ptr != (unsigned char *) NULL)
 		  free(ptr);
@@ -556,7 +556,7 @@
         kk = dc->dec_key;
         if (keytype == KEYNOTE_PRIVATE_KEY)
         {
-            if (d2i_RSAPrivateKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
+            if (d2i_RSAPrivateKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
             {
                 if (ptr != (unsigned char *) NULL)
                   free(ptr);
@@ -567,7 +567,7 @@
         }
         else
         {
-            if (d2i_RSAPublicKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
+            if (d2i_RSAPublicKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
             {
                 if (ptr != (unsigned char *) NULL)
                   free(ptr);