RE: speed command in openssl.exe

2009-09-04 Thread Will Bickford
1,310,720 times means it ran 1.25 x 1024 x 1024 times (iterations).

The total time taken was 11.17 seconds.  If that were an average it
would have taken 5.5 months to run the speed test.

--Will 

 -Original Message-
 From: owner-openssl-us...@openssl.org 
 [mailto:owner-openssl-us...@openssl.org] On Behalf Of jimmy_moh
 Sent: Thursday, September 03, 2009 5:32 AM
 To: openssl-users@openssl.org
 Subject: speed command in openssl.exe
 
 
 hi guys
 
 am new to openSSL , by using speed function i was checking 
 the performance of crypto algorithms.
 but i had a confusion in output report ..
 
 Doing sha1 1310720 times on 1024 blocks: 1310720 sha1's in 11.17 s
 
 here what is this number 1310720.. is it the number of 
 iterations...?
 and what is the value 11.17 s ..is it is the average time 
 take or total time.?
 
 thanks in advance
 --
 View this message in context: 
 http://www.nabble.com/speed-command-in-openssl.exe-tp25273330p
 25273330.html
 Sent from the OpenSSL - User mailing list archive at Nabble.com.
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org
 
 
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Using servername extension with tickets

2009-09-04 Thread Sreekanth Vadapalli
Hi,

 

I am running into a couple of issues while using these two extensions
together in 0.9.8j. They are working fine independently though.

 

First issue is the order of callback invocation for these extensions.
Ticket key callback is invoked ahead of the servername one. In my case,
the ticket decryption key is tied to the incoming servername extension,
and I need to know the servername value to return the right key in the
ticket key callback. So, is there anyway to get to the servername value
in the ticket key callback ?

 

Second, when server failed to decrypt the ticket, it is sending empty
servername and ticket extensions in its hello message, and the client
doesn't seem to like it. It is throwing a decode error while processing
the servername extension.

 

Here is the extension dump on the client side:

 

 TLS 1.0 Handshake [length 0034], ServerHello

02 00 00 30 03 01 4a 9f ff 08 9d eb af bd ae 57

01 ef 40 27 db df 69 0d dc 5a 0e 2b 99 b8 d0 d7

09 39 99 81 d3 f4 00 00 35 00 00 08 00 00 00 00

00 23 00 00

TLS server extension server name (id=0), len=0

TLS server extension server ticket (id=35), len=0

 TLS 1.0 Alert [length 0002], fatal decode_error

02 32

 

Here is the code where the error is thrown from:

 

ssl/t1_lib.c:  

 

ssl_parse_serverhello_tlsext()

{



if (!s-hit  tlsext_servername == 1)

{

if (s-tlsext_hostname)

{

if (s-session-tlsext_hostname == NULL)   This is
filled from the cached ticket that client sent in it's hello.

{

...

}

else

{

*al = SSL_AD_DECODE_ERROR;   Error here.

return 0;

}

}

}

}

 

Can some one comment on whether it is usage error or a bug.

 

Thanks,

Sreekanth.

 



ECDSA PKV Validation Failure

2009-09-04 Thread Will Bickford
In the following sample test case I get a false-positive from OpenSSL
1.0.0 Beta 3.  Note that this tests specifically for a vector larger
than should be allowed (192/32 = 6 32-bit integers, but Qy requires
7).  Other test cases succeed or fail as expected - this is an edge
case.

[P-192]
Qx = cd6d0f029a023e9aaca429615b8f577abee685d8257cc83a
Qy = 00019c410987680e9fb6c0b6ecc01d9a2647c8bae27721bacdfc

The correct result is a failure, but the following steps produce a
false positive.  I have removed error checking code for brevity, but
my test code includes it.  Is there something wrong with the process
I'm using?

EC_KEY *eckey = NULL;
EC_GROUP *group = NULL;
EC_POINT *pub_key = NULL;
BIGNUM *Qx = NULL;
BIGNUM *Qy = NULL;

BN_hex2bn(Qx, cd6d0f029a023e9aaca429615b8f577abee685d8257cc83a);
BN_hex2bn(Qy, 00019c410987680e9fb6c0b6ecc01d9a2647c8bae27721bacdfc);

eckey = EC_KEY_new();
group = EC_GROUP_new_by_curve_name(NID_X9_62_prime192v1);
EC_KEY_set_group(eckey, group);

pub_key = EC_POINT_new(group);
EC_POINT_set_affine_coordinates_GFp(group, pub_key, Qx, Qy, NULL);

EC_KEY_set_public_key(eckey, pub_key);

EC_KEY_check_key(eckey)

Will Bickford
In Google We Trust
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Using servername extension with tickets

2009-09-04 Thread Sreekanth Vadapalli
Hi,

 

I am running into a couple of issues while using these two extensions
together in 0.9.8j. They are working fine independently though.

 

First issue is the order of callback invocation for these extensions.
Ticket key callback is invoked ahead of the servername one. In my case,
the ticket decryption key is tied to the incoming servername extension,
and I need to know the servername value to return the right key in the
ticket key callback. So, is there anyway to get to the servername value
in the ticket key callback ?

 

Second, when server failed to decrypt the ticket, it is sending empty
servername and ticket extensions in its hello message, and the client
doesn't seem to like it. It is throwing a decode error while processing
the servername extension.

 

Here is the extension dump on the client side:

 

 TLS 1.0 Handshake [length 0034], ServerHello

02 00 00 30 03 01 4a 9f ff 08 9d eb af bd ae 57

01 ef 40 27 db df 69 0d dc 5a 0e 2b 99 b8 d0 d7

09 39 99 81 d3 f4 00 00 35 00 00 08 00 00 00 00

00 23 00 00

TLS server extension server name (id=0), len=0

TLS server extension server ticket (id=35), len=0

 TLS 1.0 Alert [length 0002], fatal decode_error

02 32

 

Here is the code where the error is thrown from:

 

ssl/t1_lib.c:  

 

ssl_parse_serverhello_tlsext()

{



if (!s-hit  tlsext_servername == 1)

{

if (s-tlsext_hostname)

{

if (s-session-tlsext_hostname == NULL)   This is
filled from the cached ticket that client sent in it's hello.

{

...

}

else

{

*al = SSL_AD_DECODE_ERROR;   Error here.

return 0;

}

}

}

}

 

Can some one comment on whether it is usage error or a bug.

 

Thanks,

Sreekanth.

 



Re: openssl C server and java clients

2009-09-04 Thread Sebastián Treu
I want to crush myself.

I feel sorry is this is spam for someone, but I realized that I needed
an SSL * list of elements because I was always yieldeng the same ssl
context.

Sleep well would be a good idea, I feel sorry and I apologize myself.

Solution: think of keeping a list of SSL * of each new connection.

Regards,
-- 
Sebastián Treu
http://labombiya.com.ar
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: openssl C server and java clients

2009-09-04 Thread Sebastián Treu
The information you gave me I set it right now on the application
server and client.

As I mentioned before, the server is multiplexed supporting multiple
clients. I wrote a C client and I have my java client as well (on
experimental phase). The server acts as a forwarder sending data
received from a client to all the others. I realized that when I
connect only one yet-another-echo-client to the server, comunication
goes well, in the term that the client receives it's own info back
again from the server, both the C client and the Java client.

For this I use file descriptor association, and believe me that my
code is pretty full of error checking with SSL_get_error() and I check
all the SSL_functions(). The problem is that seems that the file
descriptor associaton does not work when you associate more than one
(not at the same time of course) file descriptor, although no error
return from SSL_set_fd(), nor from *_wfd() and *_rfd().

I read the man pages and when you associate a different file
descriptor, BIO_free() will be called so I forgot about releasing or
something like that.

On the client side, if more than one clients are connected I do get an
error on SLL_read() function:

[ERR]: SSL_read() was unsuccessful (errCode: 1, ret: -1)

and the openssl error:

4787:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or
bad record mac:s3_pkt.c:422:

What I'm in concern is that I followed your advices and set TLSv1 as
method for both client and server. Clients really says so:

Connection made with version: TLSv1, cipher: AES256-SHA

And the error string is preffixed with SSL3_GET_RECORD. Though this
error does not shown when one client is connected and the info is
shared ok between server and client (C and Java clients as well). So,
they are communicating ok.

The main thing here is the file descriptor association I think. I hate
to ask, because I like reading and I read the man pages about almost
everything concerning my needs on the openssl library. I also try
setting the file descriptors for reading and for writting.

The main code of that part (already testing FD_ISSET() and knowing
that a client is sending data to the server) is:

http://pastebin.lugmen.org.ar/5217

I included my debug code to give information of what i've done. I also
have tryed using SSL_set_wfd() and SSL_set_rfd() on the respectively
places. The code is NOT exactly as the one I have, i removed comments
and maybe a ';' is missing. I say this just in case someone would say
that I have missings {'s and if-else's are wrong. I insist it should
be a bad file descriptor association by my part, or lack of theory in
SSL communications.

Best regards,
-- 
Sebastián Treu
http://labombiya.com.ar
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Info regarding books / material on OpenSSL

2009-09-04 Thread prashanth s joshi
Hi all,

I want to study OpenSSL code and work on it on some some the features such
as decrypting the messages passed between the cient and the server. I have
studied the TLS protocol.
Is there any book / material  that talks about how the OpenSSL code is
organized. And also how the SSL_read /write are implemented and such things.

Regards,
Prashanth


Re: ECDSA PKV Validation Failure

2009-09-04 Thread Bodo Moeller

On Sep 4, 2009, at 12:29 AM, Will Bickford wrote:


In the following sample test case I get a false-positive from OpenSSL
1.0.0 Beta 3.  Note that this tests specifically for a vector larger
than should be allowed (192/32 = 6 32-bit integers, but Qy requires
7).  Other test cases succeed or fail as expected - this is an edge
case.

[P-192]
Qx = cd6d0f029a023e9aaca429615b8f577abee685d8257cc83a
Qy = 00019c410987680e9fb6c0b6ecc01d9a2647c8bae27721bacdfc

The correct result is a failure, but the following steps produce a
false positive.


Note that EC_POINT_set_affine_coordinates_GFp() does not imply an out- 
of-bounds check.  This will just reduce the coordinates as needed (so  
no error is expected if your input Qy has more than 192 bits).  If you  
need to verify that the inputs are in an accepted range, this is a  
step you'll have to do explicitly in your software.


Bodo




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


Re: Bug in SNAPS 20090903 and 20090904 that affects BSD Unix

2009-09-04 Thread Dr. Stephen Henson
On Fri, Sep 04, 2009, The Doctor wrote:

 Right,  I did not see this in 20090902 but 
 did turn up in 20090903
 

Fixed now. I was sure make test passed on my system.. weird.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


standard process to validate a certificate chain ?

2009-09-04 Thread jehan procaccia

hello,
in a recent thread on this list about add extension to an existing 
(signed) CA certificate I was wondering how openssl software validate a 
certificate chain.

jehan procaccia wrote :

Can someone tell me how SSL clients check/verify a 3 level hierarchie ?
is it based on  extension authorityKeyIdentifier ?
At a specific level (1/2/3) it must match keyid ? and /or issuer 
(DirName humane readable ) ? and/or serial of  it's  near (just above) 
parent ?

is this procedure clarified somewhere ?
I finally found this presentation: 
http://www.oasis-pki.org/pdfs/Understanding_Path_construction-DS2.pdf

which starts by telling
The certification path construction process has not been standardized, 
and there is very little published information available


Well, since that publication date from 2002, I wonder if there are new 
recomandation/practice and perhaps real standard way to build and verify 
a certification path nowdays?


From that same thread (add extension to an existing (signed) CA 
certificate) you would understand that my actual PKI root-ca probably 
needs to be re-builded from scratch (sub-sub-ca and all leaf certs :-( 
as well ) beacause is lacks basic constraint CA:TRUE at the root .

so I want this time to start on good practice , notably for the extensions .
Root-CA shoud have: (idem for sub-ca ?)

[ROOT_CA]
nsComment   = root CA
subjectKeyIdentifier= hash
#authorityKeyIdentifier  = keyid:always,issuer#? maybe not that one for 
root-ca, only for sub-ca
basicConstraints= critical,CA:TRUE
keyUsage= keyCertSign, cRLSign

Thanks.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: post-connection assertions

2009-09-04 Thread Daniel Mentz

Dave Thompson wrote:

3. Use SSL_set_verify() and provide a callback function.
This sounds promising but the callback function gets called 
for every certificate in the chain. How can I find out 
whether the certificate in question is the peer's cert and 
not some intermediate cert?


x509storectx-error_depth == 0 (1,2,... are the CAs) even though 
this callback isn't for error. Yeah, it looks silly but it works.

Look at the loop in x509/x509_vfy.c internal_verify() to see why.


That works fine. Thanks a lot.
-Daniel

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


Re: Bug in SNAPS 20090903 and 20090904 that affects BSD Unix

2009-09-04 Thread The Doctor
On Fri, Sep 04, 2009 at 01:50:46PM +0200, Dr. Stephen Henson wrote:
 On Fri, Sep 04, 2009, The Doctor wrote:
 
  Right,  I did not see this in 20090902 but 
  did turn up in 20090903
  
 
 Fixed now. I was sure make test passed on my system.. weird.


Do you have a BSDish platform to work with?
 
 Steve.
 --
 Dr Stephen N. Henson. OpenSSL project core developer.
 Commercial tech support now available see: http://www.openssl.org
 __
 OpenSSL Project http://www.openssl.org
 Development Mailing List   openssl-...@openssl.org
 Automated List Manager   majord...@openssl.org

-- 
Member - Liberal International  This is doc...@nl2k.ab.ca
Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising!
Never Satan President Republic!
The fool says in his heart, There is no God. They are corrupt, and their ways 
are vile; there is no one who does good. - Ps 53:1
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: speed command in openssl.exe

2009-09-04 Thread jimmy_moh

thanks will

while using the speed command is there any option to specify the number of
iterations,,,?

and for RSA am getting the below message..

Doing 1310 1024 bit private rsa's : 1310 1024 bit private RSA's in 12.86 s

here the number 1310 is the iteration right..?


Will Bickford wrote:
 
 1,310,720 times means it ran 1.25 x 1024 x 1024 times (iterations).
 
 The total time taken was 11.17 seconds.  If that were an average it
 would have taken 5.5 months to run the speed test.
 
 --Will 
 
 -Original Message-
 From: owner-openssl-us...@openssl.org 
 [mailto:owner-openssl-us...@openssl.org] On Behalf Of jimmy_moh
 Sent: Thursday, September 03, 2009 5:32 AM
 To: openssl-users@openssl.org
 Subject: speed command in openssl.exe
 
 
 hi guys
 
 am new to openSSL , by using speed function i was checking 
 the performance of crypto algorithms.
 but i had a confusion in output report ..
 
 Doing sha1 1310720 times on 1024 blocks: 1310720 sha1's in 11.17 s
 
 here what is this number 1310720.. is it the number of 
 iterations...?
 and what is the value 11.17 s ..is it is the average time 
 take or total time.?
 
 thanks in advance
 --
 View this message in context: 
 http://www.nabble.com/speed-command-in-openssl.exe-tp25273330p
 25273330.html
 Sent from the OpenSSL - User mailing list archive at Nabble.com.
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org
 
 
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org
 
 

-- 
View this message in context: 
http://www.nabble.com/speed-command-in-openssl.exe-tp25273330p25293526.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


OpenSSL C example Base64 Decode,

2009-09-04 Thread Nigel Sollars

HI all,

I have a working example of Encoding base64 using the BIO methods but 
decrypting a string is being somewhat problematic.  The code in the man 
page for decoding does not work either as the stdin new_fp does not hand 
off / stop listening for input.


The openssl version is 0.9.8i

If anyone could supply a working example I would appreciate it,

Regards
Nigel
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: OpenSSL C example Base64 Decode,

2009-09-04 Thread Hazel John
This works for me:
void base64Decode(unsigned char* pIn, int inLen, unsigned char* pOut,
int outLen)
{
// create a memory buffer containing base64 encoded data
BIO* bmem = BIO_new_mem_buf((void*)pIn, inLen);

// push a Base64 filter so that reading from buffer decodes it
BIO *bioCmd = BIO_new(BIO_f_base64());
// we don't want newlines
BIO_set_flags(bioCmd, BIO_FLAGS_BASE64_NO_NL);
bmem = BIO_push(bioCmd, bmem);

int finalLen = BIO_read(bmem, (void*)pOut, outLen);
BIO_free_all(bmem);
outLen = finalLen;
}

On Fri, Sep 4, 2009 at 1:37 PM, Nigel Sollarsn...@vx.com wrote:
 HI all,

 I have a working example of Encoding base64 using the BIO methods but
 decrypting a string is being somewhat problematic.  The code in the man page
 for decoding does not work either as the stdin new_fp does not hand off /
 stop listening for input.

 The openssl version is 0.9.8i

 If anyone could supply a working example I would appreciate it,

 Regards
 Nigel
 __
 OpenSSL Project                                 http://www.openssl.org
 User Support Mailing List                    openssl-us...@openssl.org
 Automated List Manager                           majord...@openssl.org

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