Re: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Victor Duchovni
On Wed, Apr 11, 2007 at 05:50:04PM -0700, David Schwartz wrote:

> Why can't/doesn't Postfix use a separate SSL process? That's the right way
> to do this for a variety of reasons.

There is no single "right way". The current tradeoffs work reasonably
well. It would be useful to migrate established SSL connections between
processes, but instead we close the connection, cache the session on
our side, and hope that the other end does TLS session caching and is
able to resume.

Note that SMTP negotiates TLS mid-protocol, so having a central TLS
connection manager is tricky, a lot of descriptor passing... The machinery
is there now, and with some upcoming work in 2.5, the API between the TLS
layer and the SMTP layer in Postfix is more serializable than in 2.3, so
it is perhaps possible to trade the connected socket in for a pipe to a
one of a pool of TLS connection manager processes, but this adds a lot of
complexity. For now, TLS connection caching is just not important enough
to warrant the complexity. It would be much easier to cache *reachability*,
and throttle connection attempts to hosts recently observed unresponsive.

Anyway this is not a forum for designing MTAs, so I will stop...

-- 
Viktor.
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


RE: SSL_write and SSL_read

2007-04-11 Thread David Schwartz

Apologies if this was already responded to:

> Or if I put it in another way, if SSL_read() returns,
> SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE (from SSL_get_error())
> on the socket "fd" then, can I send data on the same socket using
> SSL_write() ? (Provided, both read and write operations on the
> "fd" are handled by same thread always.)

Yes. There is really only one caveat:

Suppose SSL_write returns 'SSL_ERROR_WANT_READ' and you subsequently call
SSL_read. No matter what happens in that SSL_read call, you must not then
block in select before retrying the SSL_write.

In other words, you can't allow this to happen:

1) SSL_write blocks because negotiation data needs to be read. You get a
WANT_READ.

2) The protocol data arrives on the socket just as you call SSL_read. It
fails because there is no application data but does read the protocol data,
you get a WANT_READ.

3) You call 'select' looking for data to be available for reading and don't
call 'SSL_write' until you get that data, but you never will because the
SSL_read got the data SSL_write was waiting for even though it returned
WANT_READ.

So you must be very careful of deadlock. If SSL_read returns WANT_READ, that
does *not* mean that it made no forward progress!

DS


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Certificate signature algorithm

2007-04-11 Thread Dr. Stephen Henson
On Wed, Apr 11, 2007, k b wrote:

> Hi,
> I'm trying to figure out if a particular cert that i receive has SHA1 or 
> SHA256 as its signature algorithm.
> 
> I know this could be done by using either i2t_ASN1_OBJECT(buffer, 
> x509->sig_alg->algorithm) or i2a_ASN1_OBJECT(bio, x509->sig_alg->algorithm)
> 
> The problem is, if the cert has sha1 sign algorithm i get a regular LN
> but if the cert has a sha256 sign algorithm get this 1.2.840.113549.1.1.11
> So my questions is :
> 1) Is there a better way to figure out if the cert is sha1 or sha256.
> 2) or is there a way I get an LN for a sha256 cert too.
> 

Check out the docs for the OBJ functions. OBJ_obj2nid() returns an integer
identifier for all standard objects.

If you aren't getting a LN it is possible that the OID isn't included in
OpenSSL's table. Which version are you using? It isn't in 0.9.7 bit is in
in 0.9.8.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Problem in compileing openssl in windows 2000

2007-04-11 Thread radha



Hi All,
  I tried to compile the openssl source in vc 6.0.
for this i followed the instructions in instal-32 file


Firstly you should run Configure:

 

 > perl Configure VC-WIN32 --prefix=c:/some/openssl/dir

 

Where the prefix argument specifies where OpenSSL will be installed to.

 

 Next you need to build the Makefiles and optionally the assembly language

 files:

 

 - If you are using MASM then run:

 

   > ms\do_masm

 

 - If you are using NASM then run:

 

   > ms\do_nasm

 

 - If you don't want to use the assembly language files at all then run:

 

   > ms\do_ms

 

 If you get errors about things not having numbers assigned then check the

 troubleshooting section: you probably won't be able to compile it as it

 stands.

 

 Then from the VC++ environment at a prompt do:

 

 > nmake -f ms\ntdll.mak


after this it says
  Building OPenSSL
NMAKE:fatel error U1073:don't know how to make '.\.\e_os.h'
Stop.

How can i solve this?
Thanks in advance.

Radha.

RE: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread David Schwartz

> It would be immensely useful in Postfix, because we could cache and
> re-use TLS encrypted connections. I would minimize the utility of the
> feature, but it is nearly impossible to retrofit. The design would have
> to support very complex serialization or many related data structures
> and I/O buffers. This is the sort of thing that is best done with a
> single server (O/S stream modules, or kernel server in a
> micro-kernel, ...)
> so that the crypto state never moves between address spaces, but client
> processes can communicate with the server (kernel, ...) to gain access
> to the encrypted stream.

>   Viktor.

Why can't/doesn't Postfix use a separate SSL process? That's the right way
to do this for a variety of reasons.

DS


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Victor Duchovni
On Wed, Apr 11, 2007 at 05:18:37PM -0700, David Schwartz wrote:

> 
> > Victor
> >
> > Thanks for your reply.
> > Is there a specific reason why this is not supported
> > by openssl?
> 
> It would add a lot of overhead and complexity to a significant fraction of
> the code for a feature that isn't all that useful and wouldn't be used all
> that often.

It would be immensely useful in Postfix, because we could cache and
re-use TLS encrypted connections. I would minimize the utility of the
feature, but it is nearly impossible to retrofit. The design would have
to support very complex serialization or many related data structures
and I/O buffers. This is the sort of thing that is best done with a
single server (O/S stream modules, or kernel server in a micro-kernel, ...)
so that the crypto state never moves between address spaces, but client
processes can communicate with the server (kernel, ...) to gain access
to the encrypted stream.

-- 
Viktor.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


RE: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread David Schwartz

> Victor
>
> Thanks for your reply.
> Is there a specific reason why this is not supported
> by openssl?

It would add a lot of overhead and complexity to a significant fraction of
the code for a feature that isn't all that useful and wouldn't be used all
that often.  It also creates a few thorny technical issues around things
like session resumption.

You can achieve precisely the same functionality in much simpler ways. I
suggest you create a process specifically to do SSL and create a nice API
for other processes to accept connections, create connections, and
read/write them.

OpenSSL is aimed at 95% of the problem. There are niche solutions available
for the other 5%.

DS


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Certificate signature algorithm

2007-04-11 Thread k b

Hi,
I'm trying to figure out if a particular cert that i receive has SHA1 or 
SHA256 as its signature algorithm.


I know this could be done by using either i2t_ASN1_OBJECT(buffer, 
x509->sig_alg->algorithm) or i2a_ASN1_OBJECT(bio, x509->sig_alg->algorithm)


The problem is, if the cert has sha1 sign algorithm i get a regular LN
but if the cert has a sha256 sign algorithm get this 1.2.840.113549.1.1.11
So my questions is :
1) Is there a better way to figure out if the cert is sha1 or sha256.
2) or is there a way I get an LN for a sha256 cert too.

Thanks
Kunal

_
Need a break? Find your escape route with Live Search Maps. 
http://maps.live.com/?icid=hmtag3


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Victor Duchovni
On Wed, Apr 11, 2007 at 03:50:46PM -0700, Jyothi Jagadish wrote:

> Victor
> 
> Thanks for your reply.
> Is there a specific reason why this is not supported
> by openssl?

Because the code does not work that way, and checkpointing al the relevant
data structures is very difficult. It would be nice to be able to pass
live TLS sessions between processes, but it is not possible.

-- 
Viktor.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Jyothi Jagadish
Victor

Thanks for your reply.
Is there a specific reason why this is not supported
by openssl?

Thanks
Jyothi


--- Victor Duchovni
<[EMAIL PROTECTED]> wrote:

> On Wed, Apr 11, 2007 at 03:31:36PM -0700, Jyothi
> Jagadish wrote:
> 
> > Hi
> > I am looking at how to share SSL session between
> > parent and child processes
> > 
> > So scenario would be 
> > 
> > Application opens up a SSL session
> > Does Read write
> > Forks and then does read write
> > Then when child process exits, the parent process
> > would continue to read and write.
> 
> This is not possible with OpenSSL, you have save
> SSL_SESSION objects
> in an external cache, which allows "session
> resumption", saving CPU
> cost of complex PKI handshakes, but there is no
> support for migrating
> SSL connections between processes, the state of the
> symmetric cipher,
> buffered encrypted and decrypted data, ... are not
> serializable.
> 
> -- 
>   Viktor.
>
__
> OpenSSL Project
> http://www.openssl.org
> User Support Mailing List   
> openssl-users@openssl.org
> Automated List Manager  
> [EMAIL PROTECTED]
> 



   

Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Victor Duchovni
On Wed, Apr 11, 2007 at 03:31:36PM -0700, Jyothi Jagadish wrote:

> Hi
> I am looking at how to share SSL session between
> parent and child processes
> 
> So scenario would be 
> 
> Application opens up a SSL session
> Does Read write
> Forks and then does read write
> Then when child process exits, the parent process
> would continue to read and write.

This is not possible with OpenSSL, you have save SSL_SESSION objects
in an external cache, which allows "session resumption", saving CPU
cost of complex PKI handshakes, but there is no support for migrating
SSL connections between processes, the state of the symmetric cipher,
buffered encrypted and decrypted data, ... are not serializable.

-- 
Viktor.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


How to share SSL sessions between parent and child process when doing fork /exec

2007-04-11 Thread Jyothi Jagadish
Hi
I am looking at how to share SSL session between
parent and child processes

So scenario would be 

Application opens up a SSL session
Does Read write
Forks and then does read write
Then when child process exits, the parent process
would continue to read and write.

Any help on this topic is appreciated.

Thanks
Jyothi


   

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: 0.9.8e changes BF cfb encryption

2007-04-11 Thread Nils Larsch

Valient Gough wrote:


My previous mail doesn't seem to have appeared on the list, so sending 
again:



Hello,

As the maintainer of a package which uses OpenSSL, I've received some 
reports
of 0.9.8e failing to decrypt data which was encrypted by previous 
versions of

OpenSSL.

Attached is a small bit of C++ code which demonstrates the problem.  It 
uses

the EVP interface with EVP_bf_cfb as the cipher and a 256 bit key (the
reports all point to Blowfish with key length > 128 bits).  What it does is
set a key, an IV, and run an encryption pass, then a decryption and compute
checksums of the three arrays (original, encrypted, decrypted).

When built against 0.9.8c, I get:
ort:tmp> g++ -Wall -g -o ssltest ssltest.cpp -lssl -lcrypto -lz
ort:tmp> ./ssltest
src chksum = 698614540
stage2 chksum = 2266501868
final chksum = 698614540

Another machine with 0.9.7a gives an identical result.  On a machine I
upgraded to 0.9.8e, I get the following output:

src chksum = 698614540
stage2 chksum = 2108297998
final chksum = 698614540


"stage2" is the encrypted data, and it differs on 0.9.8e.  What this 
means in

practice is that the program I'm using can encrypt/decrypt data just fine
when run in either version of OpenSSL, but if data is encrypted in an 
earlier

version and then OpenSSL is upgraded to 0.9.8e, then decryption fails.

The nearest I've narrowed down is to something changing between 0.9.8c and
0.9.8e, but I've received reports that 0.9.8d -> 0.9.8e also fails.  I've
been looking at the diffs between 0.9.8d -> 0.9.8e, but I'm not seeing any
obvious problem.  Reports are that only Blowfish with key > 128 bits has a
problem, and AES users are not affected.

Any ideas what's wrong, and if there's a way to get 0.9.8e output to match
earlier versions?


it's a bug in openssl 0.9.8e (see [1]).

Nils

[1] http://cvs.openssl.org/chngview?cn=15978

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


check_ssl_cert w/ PKI / X.509 Chain Validation

2007-04-11 Thread Brian A. Seklecki


These scripts are great thank you very much to all involved who 
contributed (no e-mail address for 'mastrboy'). .  I'm considering 
spending some time adding additional functionality:


--

In addition to simply parsing the date and comparing the date/time, I'd 
like to test the validity of the X.509 Cert against it's PKI 
infrastructure using the OpenSSL routines.


I'm pretty sure that this can be accomplished by checking the result code 
of openssl 's_client' or 'verify'; both permit for -CApath and -CAfile.


For internal PKI, this is pretty straightforward; just specify your 
organization's Root CA Cert.


For public cert verification; it gets tricky because you have to take a 
certificate store like the Mozilla NSS/NSPR default and convert it into 
OpenSSL c_rehash format -- taking ideas on that here.


http://lxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt

Thoughts?

l8*
-lava (Brian A. Seklecki - Pittsburgh, PA, USA)
   http://www.spiritual-machines.org/
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: howto generate RSA key from components?

2007-04-11 Thread Dr. Stephen Henson
On Wed, Apr 11, 2007, Iain Pople wrote:

> Hi,
> 
> I am trying to replace a legacy system with openssl. The legacy system 
> used RSA keys but stored them in its own format. I can extract the RSA 
> components but I'm not sure how to generate a PEM formatted RSA key. 
> What is the easiest way to do this? Can the command line tools do it, or 
> do I need to use the API?
> 

You can use the mini-ASN1 compiler in OpenSSL 0.9.8 with the asn1parse
-genconf option.

There is an example of how to generate an RSAPrivateKey structure in the
ASN1_generate_nconf manual page which can be fed to asn1parse.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: howto generate RSA key from components?

2007-04-11 Thread Marek Marcola
Hello,
> I am trying to replace a legacy system with openssl. The legacy system 
> used RSA keys but stored them in its own format. I can extract the RSA 
> components but I'm not sure how to generate a PEM formatted RSA key. 
> What is the easiest way to do this? Can the command line tools do it, or 
> do I need to use the API?
If you have RSA private key components you may use OpenSSL API
(RSA/BIGNUM) or you may convert this to ASN1 private key structure
(DER format) and next to PEM format.
You may use "openssl asn1parse" to display or convert.
Some time ago I sent small perl script to do something like that.
(conersion from BIND to DER fromat).
Hope this helps. 

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>


asn1conv.pl
Description: Perl program


Re: Cross-building OpenSSL from Intel Linux to others

2007-04-11 Thread cnelson
> On 2007.04.10 at 19:16:03 +0200, Christophe Devine wrote:
> 
> > I cross-compiled OpenSSL on ARM and MIPS a couple months ago, to 
> > perform some RSA benchmarking. I remember hacking the linux-
> > generic target to use arm-linux-gcc instead of gcc also added 
> > -static to the CFLAGS. There is probably a more elegant way to
> > do it, but at least it got the job done.
> 
> More elegant way is already implemented in the current 0.9.9 
> snapshots.There is additional option for Configure script --cross-
> compile-prefix.
> 
> In your cace 
> 
> ./Configure linux-generic --cross-compile-prefix=arm-linux-
> 
> should do, except for statically linking libc.

Does that just change the name of the compiler from "gcc" to
"arm-linux-gcc"?  Is there also an option to specify the exec_prefix? 
I'm 80% through adding that to my 0.9.8e and was going to send patches.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Cross-building OpenSSL from Intel Linux to others

2007-04-11 Thread Victor B. Wagner
On 2007.04.10 at 19:16:03 +0200, Christophe Devine wrote:

> I cross-compiled OpenSSL on ARM and MIPS a couple months ago, to perform
> some RSA benchmarking. I remember hacking the linux-generic target to
> use arm-linux-gcc instead of gcc also added -static to the CFLAGS. There
> is probably a more elegant way to do it, but at least it got the job done.

More elegant way is already implemented in the current 0.9.9 snapshots.
There is additional option for Configure script --cross-compile-prefix.

In your cace 

./Configure linux-generic --cross-compile-prefix=arm-linux-

should do, except for statically linking libc.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]