Thread: pgcryto failures on freebsd/alpha

pgcryto failures on freebsd/alpha

From
"Christopher Kings-Lynne"
Date:
Hi Marko,

Just testing pgcrypto on freebsd/alpha.  I get some warnings:

gcc -pipe -O -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -DPIC  
-DRAND_SILLY -I.  -I. -I../../src/include   -c -
o internal.o internal.c
internal.c: In function `rj_encrypt':
internal.c:314: warning: cast from pointer to integer of different size
internal.c: In function `rj_decrypt':
internal.c:342: warning: cast from pointer to integer of different size
internal.c: In function `bf_encrypt':
internal.c:429: warning: cast from pointer to integer of different size
internal.c: In function `bf_decrypt':
internal.c:453: warning: cast from pointer to integer of different size

And I can't do regression:

gmake -C ../../src/test/regress pg_regress
gmake[1]: Entering directory
`/home/chriskl/postgresql-7.2b4/src/test/regress'
gmake[1]: `pg_regress' is up to date.
gmake[1]: Leaving directory
`/home/chriskl/postgresql-7.2b4/src/test/regress'
../../src/test/regress/pg_regress init md5 sha1 hmac-md5 hmac-sha1 blowfish
rijndael crypt-des crypt-md5 crypt-blowfish cryp
t-xdes
(using postmaster on Unix socket, default port)
============== dropping database "regression"         ==============
ERROR:  DROP DATABASE: database "regression" does not exist
ERROR:  DROP DATABASE: database "regression" does not exist
dropdb: database removal failed
============== creating database "regression"         ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
ERROR:  DROP GROUP: group "regressgroup1" does not exist
============== installing PL/pgSQL                    ==============
============== running regression test queries        ==============
test init                 ... ERROR:  stat failed on file
'$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory
FAILED
test md5                  ... ERROR:  Function 'digest(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED
test sha1                 ... ERROR:  Function 'digest(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'digest(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED
test hmac-md5             ... ERROR:  Function 'hmac(unknown, bytea,
unknown)' does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, unknown, unknown)' does not exist       Unable to identify a function that satisfies
thegiven argument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
FAILED
test hmac-sha1            ... ERROR:  Function 'hmac(unknown, bytea,
unknown)' does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, unknown, unknown)' does not exist       Unable to identify a function that satisfies
thegiven argument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'hmac(unknown, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
FAILED
test blowfish             ... ERROR:  Function 'encrypt(bytea, bytea,
unknown)' does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
FAILED
test rijndael             ... ERROR:  Function 'encrypt(bytea, bytea,
unknown)' does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
ERROR:  Function 'encrypt(bytea, bytea, unknown)' does not exist       Unable to identify a function that satisfies the
givenargument
 
types       You may need to add explicit typecasts
FAILED
test crypt-des            ... ERROR:  Function 'crypt(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'gen_salt(unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED
test crypt-md5            ... ERROR:  Function 'crypt(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'gen_salt(unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED
test crypt-blowfish       ... ERROR:  Function 'crypt(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'gen_salt(unknown, int4)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED
test crypt-xdes           ... ERROR:  Function 'crypt(unknown, unknown)'
does not exist       Unable to identify a function that satisfies the given argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(unknown, unknown)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'gen_salt(unknown, int4)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
ERROR:  Function 'crypt(text, text)' does not exist       Unable to identify a function that satisfies the given
argument
types       You may need to add explicit typecasts
FAILED

========================11 of 11 tests failed.
========================

The differences that caused some tests to fail can be viewed in the
file `./regression.diffs'.  A copy of the test summary that you see
above is saved in the file `./regression.out'.



Re: pgcryto failures on freebsd/alpha

From
Marko Kreen
Date:
On Fri, Dec 21, 2001 at 11:43:21AM +0800, Christopher Kings-Lynne wrote:
> Hi Marko,
> 
> Just testing pgcrypto on freebsd/alpha.  I get some warnings:
> 
> gcc -pipe -O -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -DPIC  
> -DRAND_SILLY -I.  -I. -I../../src/include   -c -
> o internal.o internal.c
> internal.c: In function `rj_encrypt':
> internal.c:314: warning: cast from pointer to integer of different size
> internal.c: In function `rj_decrypt':
> internal.c:342: warning: cast from pointer to integer of different size
> internal.c: In function `bf_encrypt':
> internal.c:429: warning: cast from pointer to integer of different size
> internal.c: In function `bf_decrypt':
> internal.c:453: warning: cast from pointer to integer of different size

They should be harmless, although I should fix them.

> And I can't do regression:

[ ... ]

> ============== running regression test queries        ==============
> test init                 ... ERROR:  stat failed on file
> '$libdir/pgcrypto': No such file or directory
> ERROR:  stat failed on file '$libdir/pgcrypto': No such file or directory

You need to do 'make install' first.

-- 
marko



Re: pgcryto failures on freebsd/alpha

From
Bruce Momjian
Date:
Marko Kreen wrote:
> On Fri, Dec 21, 2001 at 11:43:21AM +0800, Christopher Kings-Lynne wrote:
> > Hi Marko,
> > 
> > Just testing pgcrypto on freebsd/alpha.  I get some warnings:
> > 
> > gcc -pipe -O -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -DPIC  
> > -DRAND_SILLY -I.  -I. -I../../src/include   -c -
> > o internal.o internal.c
> > internal.c: In function `rj_encrypt':
> > internal.c:314: warning: cast from pointer to integer of different size
> > internal.c: In function `rj_decrypt':
> > internal.c:342: warning: cast from pointer to integer of different size
> > internal.c: In function `bf_encrypt':
> > internal.c:429: warning: cast from pointer to integer of different size
> > internal.c: In function `bf_decrypt':
> > internal.c:453: warning: cast from pointer to integer of different size
> 
> They should be harmless, although I should fix them.

The actual code is:
   if ((dlen & 15) || (((unsigned) res) & 3))       return -1;

while res is defined as an uint8 pointer:
   rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)

Hard to imagine how (uint *) & 3 makes any sense, unless res isn't
always a (uint8 *).  Is that true?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: pgcryto failures on freebsd/alpha

From
Marko Kreen
Date:
On Thu, Jan 03, 2002 at 01:13:55AM -0500, Bruce Momjian wrote:
> Marko Kreen wrote:
> > On Fri, Dec 21, 2001 at 11:43:21AM +0800, Christopher Kings-Lynne wrote:
> > > Just testing pgcrypto on freebsd/alpha.  I get some warnings:
> > They should be harmless, although I should fix them.
> 
> The actual code is:
> 
>     if ((dlen & 15) || (((unsigned) res) & 3))
>         return -1;

> Hard to imagine how (uint *) & 3 makes any sense, unless res isn't
> always a (uint8 *).  Is that true?

At some point it was casted to (uint32*) so I wanted to be sure its ok.
ATM its pointless.  Please apply the following patch.

-- 
marko


Index: contrib/pgcrypto/internal.c
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/internal.c,v
retrieving revision 1.10
diff -u -r1.10 internal.c
--- contrib/pgcrypto/internal.c    20 Nov 2001 18:54:07 -0000    1.10
+++ contrib/pgcrypto/internal.c    21 Dec 2001 08:45:21 -0000
@@ -311,7 +311,7 @@    if (dlen == 0)        return 0;
-    if ((dlen & 15) || (((unsigned) res) & 3))
+    if (dlen & 15)        return -1;    memcpy(res, data, dlen);
@@ -339,7 +339,7 @@    if (dlen == 0)        return 0;
-    if ((dlen & 15) || (((unsigned) res) & 3))
+    if (dlen & 15)        return -1;    memcpy(res, data, dlen);
@@ -426,7 +426,7 @@    if (dlen == 0)        return 0;
-    if ((dlen & 7) || (((unsigned) res) & 3))
+    if (dlen & 7)        return -1;    memcpy(res, data, dlen);
@@ -450,7 +450,7 @@    if (dlen == 0)        return 0;
-    if ((dlen & 7) || (((unsigned) res) & 3))
+    if (dlen & 7)        return -1;    memcpy(res, data, dlen);


Re: pgcryto failures on freebsd/alpha

From
Bruce Momjian
Date:
Patch applied because it is to /contrib and is from the author, and
fixes some unusual code.  Did testing the bottom two bits actually test
anything (res & 3)?


---------------------------------------------------------------------------

Marko Kreen wrote:
> On Thu, Jan 03, 2002 at 01:13:55AM -0500, Bruce Momjian wrote:
> > Marko Kreen wrote:
> > > On Fri, Dec 21, 2001 at 11:43:21AM +0800, Christopher Kings-Lynne wrote:
> > > > Just testing pgcrypto on freebsd/alpha.  I get some warnings:
> > > They should be harmless, although I should fix them.
> > 
> > The actual code is:
> > 
> >     if ((dlen & 15) || (((unsigned) res) & 3))
> >         return -1;
> 
> > Hard to imagine how (uint *) & 3 makes any sense, unless res isn't
> > always a (uint8 *).  Is that true?
> 
> At some point it was casted to (uint32*) so I wanted to be sure its ok.
> ATM its pointless.  Please apply the following patch.
> 
> -- 
> marko
> 
> 
> Index: contrib/pgcrypto/internal.c
> ===================================================================
> RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/internal.c,v
> retrieving revision 1.10
> diff -u -r1.10 internal.c
> --- contrib/pgcrypto/internal.c    20 Nov 2001 18:54:07 -0000    1.10
> +++ contrib/pgcrypto/internal.c    21 Dec 2001 08:45:21 -0000
> @@ -311,7 +311,7 @@
>      if (dlen == 0)
>          return 0;
>  
> -    if ((dlen & 15) || (((unsigned) res) & 3))
> +    if (dlen & 15)
>          return -1;
>  
>      memcpy(res, data, dlen);
> @@ -339,7 +339,7 @@
>      if (dlen == 0)
>          return 0;
>  
> -    if ((dlen & 15) || (((unsigned) res) & 3))
> +    if (dlen & 15)
>          return -1;
>  
>      memcpy(res, data, dlen);
> @@ -426,7 +426,7 @@
>      if (dlen == 0)
>          return 0;
>  
> -    if ((dlen & 7) || (((unsigned) res) & 3))
> +    if (dlen & 7)
>          return -1;
>  
>      memcpy(res, data, dlen);
> @@ -450,7 +450,7 @@
>      if (dlen == 0)
>          return 0;
>  
> -    if ((dlen & 7) || (((unsigned) res) & 3))
> +    if (dlen & 7)
>          return -1;
>  
>      memcpy(res, data, dlen);
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: pgcryto failures on freebsd/alpha

From
Marko Kreen
Date:
On Thu, Jan 03, 2002 at 02:23:25AM -0500, Bruce Momjian wrote:
> 
> Patch applied because it is to /contrib and is from the author, and
> fixes some unusual code.  Did testing the bottom two bits actually test
> anything (res & 3)?

You mean if I did catch anything with it?  No.

-- 
marko