Re: [PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-29 Thread Zdenek Kotala

Marko Kreen wrote:

solaris openssl refuses to handle keys longer than 128bits.

* aes will crash on longer keys
* blowfish will silently cut the key which can result
  data corruption

to fix it:

- test errors from AES functions
- bf errors cannot be tested, do test encryption
- change aes compat macros to static function so they
  can return values



Tested on Solaris Nevada and works fine.


More general appriaches that also fix the problems are:

- test all ciphers on first use and test fails then disable
completely.  This is nice as it could detect much braded range
of errors.

Problem with this approach is that its too big overhead for small
gain, as it cannot still 100% guarantee that everything is working
correctly.

- Use EVP functions for encryption as they have better error
handling.  So crippled openssl can report via regular means
that something is not supported.


+1 for EVP solution.


Thank you very much

Zdenek

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


Re: [PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-29 Thread Zdenek Kotala

Tom Lane wrote:

Marko Kreen [EMAIL PROTECTED] writes:

solaris openssl refuses to handle keys longer than 128bits.
...
So something like the current patch should be still applied
as a near-term fix.


Applied to HEAD and 8.2.  I wasn't sure if there was interest in
patching further back, or if the patch was meant to work further back.
Let me know if you're not happy.



PostgreSQL 8.1 is shipped with Solaris. We are interesting it to have 
backport in 8.1. I tested patch on 8.1.10 and Solaris nevada and works fine.



Thanks Zdenek

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-29 Thread Tom Lane
Zdenek Kotala [EMAIL PROTECTED] writes:
 Tom Lane wrote:
 Applied to HEAD and 8.2.  I wasn't sure if there was interest in
 patching further back, or if the patch was meant to work further back.
 Let me know if you're not happy.

 PostgreSQL 8.1 is shipped with Solaris. We are interesting it to have 
 backport in 8.1. I tested patch on 8.1.10 and Solaris nevada and works fine.

OK, applied to 8.1 too.

regards, tom lane

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-29 Thread Zdenek Kotala

Tom Lane wrote:

Zdenek Kotala [EMAIL PROTECTED] writes:

Tom Lane wrote:

Applied to HEAD and 8.2.  I wasn't sure if there was interest in
patching further back, or if the patch was meant to work further back.
Let me know if you're not happy.


PostgreSQL 8.1 is shipped with Solaris. We are interesting it to have 
backport in 8.1. I tested patch on 8.1.10 and Solaris nevada and works fine.


OK, applied to 8.1 too.



Thanks.

Zdenek

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


[PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-28 Thread Marko Kreen
solaris openssl refuses to handle keys longer than 128bits.

* aes will crash on longer keys
* blowfish will silently cut the key which can result
  data corruption

to fix it:

- test errors from AES functions
- bf errors cannot be tested, do test encryption
- change aes compat macros to static function so they
  can return values

(Original patch by Zdenek Kotala)


I really dislike the patch, as it too specific for the
crippled openssl in solaris.  But still something should
be done because of the possible silent corruption.


More general appriaches that also fix the problems are:

- test all ciphers on first use and test fails then disable
completely.  This is nice as it could detect much braded range
of errors.

Problem with this approach is that its too big overhead for small
gain, as it cannot still 100% guarantee that everything is working
correctly.

- Use EVP functions for encryption as they have better error
handling.  So crippled openssl can report via regular means
that something is not supported.

Problem with this is that it can be done only from 0.9.7 onwards.
Which pushes the solution to 8.4.


So something like the current patch should be still applied
as a near-term fix.  But I'm starting to think that the blowfish
check should be #ifdef __solaris__ only.   Has anyone good reasons
why it should apply to everyone?

-- 
marko


solaris-fix-v03.diff
Description: Binary data

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] pgcrypto: fix for broken solaris openssl, v03

2007-09-28 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes:
 solaris openssl refuses to handle keys longer than 128bits.
 ...
 So something like the current patch should be still applied
 as a near-term fix.

Applied to HEAD and 8.2.  I wasn't sure if there was interest in
patching further back, or if the patch was meant to work further back.
Let me know if you're not happy.

 But I'm starting to think that the blowfish
 check should be #ifdef __solaris__ only.   Has anyone good reasons
 why it should apply to everyone?

As long as we've got to have the code, we may as well use it --- it's
possible that Sun isn't the only vendor who got worried about the crypto
export laws.  Your caching of the result should be enough to ensure that
the overhead is negligible.

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org